mirror of
https://github.com/SamyRai/tercul-frontend.git
synced 2025-12-27 00:11:35 +00:00
Improve data presentation and tag input features across the application
Refactors DataTable and TagInput components, and adds @tanstack/react-table dependency. Replit-Commit-Author: Agent Replit-Commit-Session-Id: bddfbb2b-6d6b-457b-b18c-05792cdaa035 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/39b5c689-6e8a-4d5a-9792-69cc81a56534/90b5f3d2-0e18-45bc-a027-dfc7f3a05b12.jpg
This commit is contained in:
parent
ec099f65b4
commit
b797c83ec6
@ -179,8 +179,8 @@ export function DataTable<TData, TValue>({
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-[180px]">
|
||||
{table.getAllColumns()
|
||||
.filter(column => column.getCanHide())
|
||||
.map(column => (
|
||||
.filter((column) => column.getCanHide())
|
||||
.map((column) => (
|
||||
<DropdownMenuCheckboxItem
|
||||
key={column.id}
|
||||
className="capitalize"
|
||||
@ -252,8 +252,8 @@ export function DataTable<TData, TValue>({
|
||||
<EmptyState
|
||||
title={emptyState.title}
|
||||
description={emptyState.description}
|
||||
action={emptyState.action}
|
||||
variant="ghost"
|
||||
actions={emptyState.action}
|
||||
variant="minimal"
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@ -154,14 +154,15 @@ export const TagInput = forwardRef<HTMLInputElement, TagInputProps>(({
|
||||
const [filteredSuggestions, setFilteredSuggestions] = useState(suggestions);
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
// Forward the ref
|
||||
const handleRef = (el: HTMLInputElement) => {
|
||||
// Merge refs
|
||||
const mergedRef = (el: HTMLInputElement | null) => {
|
||||
// Update inner ref
|
||||
if (el) inputRef.current = el;
|
||||
|
||||
// Forward to external ref
|
||||
if (typeof ref === 'function') {
|
||||
ref(el);
|
||||
} else if (ref) {
|
||||
ref.current = el;
|
||||
}
|
||||
inputRef.current = el;
|
||||
};
|
||||
|
||||
// Focus the input when clicking the container
|
||||
@ -342,7 +343,7 @@ export const TagInput = forwardRef<HTMLInputElement, TagInputProps>(({
|
||||
{!readOnly && (
|
||||
<div className="flex flex-1 items-center min-w-[180px]">
|
||||
<input
|
||||
ref={handleRef}
|
||||
ref={mergedRef}
|
||||
type="text"
|
||||
value={inputValue}
|
||||
onChange={(e) => setInputValue(e.target.value)}
|
||||
|
||||
34
package-lock.json
generated
34
package-lock.json
generated
@ -42,6 +42,7 @@
|
||||
"@radix-ui/react-tooltip": "^1.2.0",
|
||||
"@tailwindcss/vite": "^4.1.3",
|
||||
"@tanstack/react-query": "^5.60.5",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"cmdk": "^1.1.1",
|
||||
@ -3269,6 +3270,39 @@
|
||||
"react": "^18 || ^19"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/react-table": {
|
||||
"version": "8.21.3",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/react-table/-/react-table-8.21.3.tgz",
|
||||
"integrity": "sha512-5nNMTSETP4ykGegmVkhjcS8tTLW6Vl4axfEGQN3v0zdHYbK4UfoqfPChclTrJ4EoK9QynqAu9oUf8VEmrpZ5Ww==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tanstack/table-core": "8.21.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8",
|
||||
"react-dom": ">=16.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/table-core": {
|
||||
"version": "8.21.3",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/table-core/-/table-core-8.21.3.tgz",
|
||||
"integrity": "sha512-ldZXEhOBb8Is7xLs01fR3YEc3DERiz5silj8tnGkFZytt1abEvl/GhUmCE0PMLaMPTa3Jk4HbKmRlHmu+gCftg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/babel__core": {
|
||||
"version": "7.20.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
"@radix-ui/react-tooltip": "^1.2.0",
|
||||
"@tailwindcss/vite": "^4.1.3",
|
||||
"@tanstack/react-query": "^5.60.5",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"cmdk": "^1.1.1",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user