diff --git a/public/r/data-grid-keyboard-shortcuts.json b/public/r/data-grid-keyboard-shortcuts.json new file mode 100644 index 000000000..2cb67903b --- /dev/null +++ b/public/r/data-grid-keyboard-shortcuts.json @@ -0,0 +1,25 @@ +{ + "$schema": "https://ui.shadcn.com/schema/registry-item.json", + "name": "data-grid-keyboard-shortcuts", + "type": "registry:component", + "title": "Data Grid Keyboard Shortcuts", + "description": "A keyboard shortcuts dialog component for the data grid showing all available shortcuts", + "dependencies": [ + "lucide-react" + ], + "registryDependencies": [ + "button", + "dialog", + "input", + "kbd", + "separator" + ], + "files": [ + { + "path": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx", + "content": "\"use client\";\n\nimport { SearchIcon, XIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/components/ui/dialog\";\nimport { Input } from \"@/components/ui/input\";\nimport { Kbd, KbdGroup } from \"@/components/ui/kbd\";\nimport { Separator } from \"@/components/ui/separator\";\n\nconst SHORTCUT_KEY = \"/\";\n\ninterface ShortcutGroup {\n title: string;\n shortcuts: Array<{\n keys: string[];\n description: string;\n }>;\n}\n\ninterface DataGridKeyboardShortcutsProps {\n enableSearch?: boolean;\n}\n\nexport const DataGridKeyboardShortcuts = React.memo(\n DataGridKeyboardShortcutsImpl,\n (prev, next) => {\n return prev.enableSearch === next.enableSearch;\n },\n);\n\nfunction DataGridKeyboardShortcutsImpl({\n enableSearch = false,\n}: DataGridKeyboardShortcutsProps) {\n const [open, setOpen] = React.useState(false);\n const [input, setInput] = React.useState(\"\");\n const inputRef = React.useRef(null);\n\n const isMac =\n typeof navigator !== \"undefined\"\n ? /Mac|iPhone|iPad|iPod/.test(navigator.userAgent)\n : false;\n\n const modKey = isMac ? \"⌘\" : \"Ctrl\";\n\n const onOpenChange = React.useCallback((isOpen: boolean) => {\n setOpen(isOpen);\n if (!isOpen) {\n setInput(\"\");\n }\n }, []);\n\n const onOpenAutoFocus = React.useCallback((event: Event) => {\n event.preventDefault();\n inputRef.current?.focus();\n }, []);\n\n const onInputChange = React.useCallback(\n (event: React.ChangeEvent) => {\n setInput(event.target.value);\n },\n [],\n );\n\n const shortcutGroups: ShortcutGroup[] = React.useMemo(\n () => [\n {\n title: \"Navigation\",\n shortcuts: [\n {\n keys: [\"↑\", \"↓\", \"←\", \"→\"],\n description: \"Navigate between cells\",\n },\n {\n keys: [\"Tab\"],\n description: \"Move to next cell\",\n },\n {\n keys: [\"Shift\", \"Tab\"],\n description: \"Move to previous cell\",\n },\n {\n keys: [\"Home\"],\n description: \"Move to first column\",\n },\n {\n keys: [\"End\"],\n description: \"Move to last column\",\n },\n {\n keys: [modKey, \"Home\"],\n description: \"Move to first cell\",\n },\n {\n keys: [modKey, \"End\"],\n description: \"Move to last cell\",\n },\n {\n keys: [\"PgUp\"],\n description: \"Move up one page\",\n },\n {\n keys: [\"PgDn\"],\n description: \"Move down one page\",\n },\n ],\n },\n {\n title: \"Selection\",\n shortcuts: [\n {\n keys: [\"Shift\", \"↑↓←→\"],\n description: \"Extend selection\",\n },\n {\n keys: [modKey, \"A\"],\n description: \"Select all cells\",\n },\n {\n keys: [modKey, \"Click\"],\n description: \"Toggle cell selection\",\n },\n {\n keys: [\"Shift\", \"Click\"],\n description: \"Select range\",\n },\n {\n keys: [\"Esc\"],\n description: \"Clear selection\",\n },\n ],\n },\n {\n title: \"Editing\",\n shortcuts: [\n {\n keys: [\"Enter\"],\n description: \"Start editing cell\",\n },\n {\n keys: [\"Double Click\"],\n description: \"Start editing cell\",\n },\n {\n keys: [\"Delete\"],\n description: \"Clear selected cells\",\n },\n {\n keys: [\"Backspace\"],\n description: \"Clear selected cells\",\n },\n ],\n },\n ...(enableSearch\n ? [\n {\n title: \"Search\",\n shortcuts: [\n {\n keys: [modKey, \"F\"],\n description: \"Open search\",\n },\n {\n keys: [\"Enter\"],\n description: \"Next match\",\n },\n {\n keys: [\"Shift\", \"Enter\"],\n description: \"Previous match\",\n },\n {\n keys: [\"Esc\"],\n description: \"Close search\",\n },\n ],\n },\n ]\n : []),\n {\n title: \"Sorting\",\n shortcuts: [\n {\n keys: [modKey, \"Shift\", \"S\"],\n description: \"Toggle the sort menu\",\n },\n {\n keys: [\"Backspace\"],\n description: \"Remove sort (when focused)\",\n },\n {\n keys: [\"Delete\"],\n description: \"Remove sort (when focused)\",\n },\n ],\n },\n {\n title: \"General\",\n shortcuts: [\n {\n keys: [modKey, \"/\"],\n description: \"Show keyboard shortcuts\",\n },\n ],\n },\n ],\n [modKey, enableSearch],\n );\n\n const filteredGroups = React.useMemo(() => {\n if (!input.trim()) return shortcutGroups;\n\n const query = input.toLowerCase();\n return shortcutGroups\n .map((group) => ({\n ...group,\n shortcuts: group.shortcuts.filter(\n (shortcut) =>\n shortcut.description.toLowerCase().includes(query) ||\n shortcut.keys.some((key) => key.toLowerCase().includes(query)),\n ),\n }))\n .filter((group) => group.shortcuts.length > 0);\n }, [shortcutGroups, input]);\n\n React.useEffect(() => {\n function onKeyDown(event: KeyboardEvent) {\n if ((event.ctrlKey || event.metaKey) && event.key === SHORTCUT_KEY) {\n event.preventDefault();\n setOpen(true);\n }\n }\n\n window.addEventListener(\"keydown\", onKeyDown);\n return () => {\n window.removeEventListener(\"keydown\", onKeyDown);\n };\n }, []);\n\n return (\n \n \n \n \n \n \n Keyboard shortcuts\n \n Use these keyboard shortcuts to navigate and interact with the data\n grid more efficiently.\n \n \n
\n
\n \n \n
\n
\n \n
\n {filteredGroups.length === 0 ? (\n
\n
\n \n
\n
\n
\n No shortcuts found\n
\n

\n Try searching for a different term.\n

\n
\n
\n ) : (\n
\n {filteredGroups.map((shortcutGroup) => (\n
\n

\n {shortcutGroup.title}\n

\n
\n {shortcutGroup.shortcuts.map((shortcut, index) => (\n \n ))}\n
\n
\n ))}\n
\n )}\n
\n \n
\n );\n}\n\nfunction ShortcutCard({\n keys,\n description,\n}: ShortcutGroup[\"shortcuts\"][number]) {\n return (\n
\n {description}\n \n {keys.map((key, index) => (\n \n {index > 0 && (\n +\n )}\n {key}\n \n ))}\n \n
\n );\n}\n", + "type": "registry:component", + "target": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx" + } + ] +} \ No newline at end of file diff --git a/public/r/data-grid.json b/public/r/data-grid.json index 672083bbd..92d53c5af 100644 --- a/public/r/data-grid.json +++ b/public/r/data-grid.json @@ -16,10 +16,8 @@ "calendar", "checkbox", "command", - "dialog", "dropdown-menu", "input", - "kbd", "popover", "select", "separator", @@ -29,7 +27,7 @@ "files": [ { "path": "src/components/data-grid/data-grid.tsx", - "content": "\"use client\";\n\nimport { flexRender } from \"@tanstack/react-table\";\nimport { Plus } from \"lucide-react\";\nimport * as React from \"react\";\nimport { DataGridColumnHeader } from \"@/components/data-grid/data-grid-column-header\";\nimport { DataGridContextMenu } from \"@/components/data-grid/data-grid-context-menu\";\nimport { DataGridKeyboardShortcuts } from \"@/components/data-grid/data-grid-keyboard-shortcuts\";\nimport { DataGridRow } from \"@/components/data-grid/data-grid-row\";\nimport { DataGridSearch } from \"@/components/data-grid/data-grid-search\";\nimport type { useDataGrid } from \"@/hooks/use-data-grid\";\nimport { getCommonPinningStyles } from \"@/lib/data-table\";\nimport { cn } from \"@/lib/utils\";\n\ninterface DataGridProps\n extends ReturnType>,\n React.ComponentProps<\"div\"> {\n height?: number;\n}\n\nexport function DataGrid({\n dataGridRef,\n headerRef,\n rowMapRef,\n footerRef,\n table,\n rowVirtualizer,\n height = 600,\n searchState,\n columnSizeVars,\n onRowAdd,\n className,\n ...props\n}: DataGridProps) {\n const rows = table.getRowModel().rows;\n const columns = table.getAllColumns();\n\n const meta = table.options.meta;\n const rowHeight = meta?.rowHeight ?? \"short\";\n const focusedCell = meta?.focusedCell ?? null;\n\n const onGridContextMenu = React.useCallback(\n (event: React.MouseEvent) => {\n event.preventDefault();\n },\n [],\n );\n\n const onAddRowKeyDown = React.useCallback(\n (event: React.KeyboardEvent) => {\n if (!onRowAdd) return;\n\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n onRowAdd();\n }\n },\n [onRowAdd],\n );\n\n return (\n \n {searchState && }\n \n \n \n \n {table.getHeaderGroups().map((headerGroup, rowIndex) => (\n \n {headerGroup.headers.map((header, colIndex) => {\n const sorting = table.getState().sorting;\n const currentSort = sorting.find(\n (sort) => sort.id === header.column.id,\n );\n const isSortable = header.column.getCanSort();\n\n return (\n \n {header.isPlaceholder ? null : typeof header.column\n .columnDef.header === \"function\" ? (\n
\n {flexRender(\n header.column.columnDef.header,\n header.getContext(),\n )}\n
\n ) : (\n \n )}\n \n );\n })}\n \n ))}\n \n \n {rowVirtualizer.getVirtualIndexes().map((virtualRowIndex) => {\n const row = rows[virtualRowIndex];\n if (!row) return null;\n\n return (\n \n );\n })}\n \n {onRowAdd && (\n \n \n \n
\n \n Add row\n
\n \n \n \n )}\n \n \n );\n}\n", + "content": "\"use client\";\n\nimport { flexRender } from \"@tanstack/react-table\";\nimport { Plus } from \"lucide-react\";\nimport * as React from \"react\";\nimport { DataGridColumnHeader } from \"@/components/data-grid/data-grid-column-header\";\nimport { DataGridContextMenu } from \"@/components/data-grid/data-grid-context-menu\";\nimport { DataGridRow } from \"@/components/data-grid/data-grid-row\";\nimport { DataGridSearch } from \"@/components/data-grid/data-grid-search\";\nimport type { useDataGrid } from \"@/hooks/use-data-grid\";\nimport { getCommonPinningStyles } from \"@/lib/data-table\";\nimport { cn } from \"@/lib/utils\";\n\ninterface DataGridProps\n extends ReturnType>,\n React.ComponentProps<\"div\"> {\n height?: number;\n}\n\nexport function DataGrid({\n dataGridRef,\n headerRef,\n rowMapRef,\n footerRef,\n table,\n rowVirtualizer,\n height = 600,\n searchState,\n columnSizeVars,\n onRowAdd,\n className,\n ...props\n}: DataGridProps) {\n const rows = table.getRowModel().rows;\n const columns = table.getAllColumns();\n\n const meta = table.options.meta;\n const rowHeight = meta?.rowHeight ?? \"short\";\n const focusedCell = meta?.focusedCell ?? null;\n\n const onGridContextMenu = React.useCallback(\n (event: React.MouseEvent) => {\n event.preventDefault();\n },\n [],\n );\n\n const onAddRowKeyDown = React.useCallback(\n (event: React.KeyboardEvent) => {\n if (!onRowAdd) return;\n\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n onRowAdd();\n }\n },\n [onRowAdd],\n );\n\n return (\n \n {searchState && }\n \n \n \n {table.getHeaderGroups().map((headerGroup, rowIndex) => (\n \n {headerGroup.headers.map((header, colIndex) => {\n const sorting = table.getState().sorting;\n const currentSort = sorting.find(\n (sort) => sort.id === header.column.id,\n );\n const isSortable = header.column.getCanSort();\n\n return (\n \n {header.isPlaceholder ? null : typeof header.column\n .columnDef.header === \"function\" ? (\n
\n {flexRender(\n header.column.columnDef.header,\n header.getContext(),\n )}\n
\n ) : (\n \n )}\n \n );\n })}\n \n ))}\n \n \n {rowVirtualizer.getVirtualIndexes().map((virtualRowIndex) => {\n const row = rows[virtualRowIndex];\n if (!row) return null;\n\n return (\n \n );\n })}\n \n {onRowAdd && (\n \n \n \n
\n \n Add row\n
\n \n \n \n )}\n \n \n );\n}\n", "type": "registry:component", "target": "src/components/data-grid/data-grid.tsx" }, @@ -63,12 +61,6 @@ "type": "registry:component", "target": "src/components/data-grid/data-grid-context-menu.tsx" }, - { - "path": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx", - "content": "\"use client\";\n\nimport { SearchIcon, XIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/components/ui/dialog\";\nimport { Input } from \"@/components/ui/input\";\nimport { Kbd, KbdGroup } from \"@/components/ui/kbd\";\nimport { Separator } from \"@/components/ui/separator\";\n\nconst SHORTCUT_KEY = \"/\";\n\ninterface ShortcutGroup {\n title: string;\n shortcuts: Array<{\n keys: string[];\n description: string;\n }>;\n}\n\ninterface DataGridKeyboardShortcutsProps {\n enableSearch?: boolean;\n}\n\nexport const DataGridKeyboardShortcuts = React.memo(\n DataGridKeyboardShortcutsImpl,\n (prev, next) => {\n return prev.enableSearch === next.enableSearch;\n },\n);\n\nfunction DataGridKeyboardShortcutsImpl({\n enableSearch = false,\n}: DataGridKeyboardShortcutsProps) {\n const [open, setOpen] = React.useState(false);\n const [input, setInput] = React.useState(\"\");\n const inputRef = React.useRef(null);\n\n const isMac =\n typeof navigator !== \"undefined\"\n ? /Mac|iPhone|iPad|iPod/.test(navigator.userAgent)\n : false;\n\n const modKey = isMac ? \"⌘\" : \"Ctrl\";\n\n const onOpenChange = React.useCallback((isOpen: boolean) => {\n setOpen(isOpen);\n if (!isOpen) {\n setInput(\"\");\n }\n }, []);\n\n const onOpenAutoFocus = React.useCallback((event: Event) => {\n event.preventDefault();\n inputRef.current?.focus();\n }, []);\n\n const onInputChange = React.useCallback(\n (event: React.ChangeEvent) => {\n setInput(event.target.value);\n },\n [],\n );\n\n const shortcutGroups: ShortcutGroup[] = React.useMemo(\n () => [\n {\n title: \"Navigation\",\n shortcuts: [\n {\n keys: [\"↑\", \"↓\", \"←\", \"→\"],\n description: \"Navigate between cells\",\n },\n {\n keys: [\"Tab\"],\n description: \"Move to next cell\",\n },\n {\n keys: [\"Shift\", \"Tab\"],\n description: \"Move to previous cell\",\n },\n {\n keys: [\"Home\"],\n description: \"Move to first column\",\n },\n {\n keys: [\"End\"],\n description: \"Move to last column\",\n },\n {\n keys: [modKey, \"Home\"],\n description: \"Move to first cell\",\n },\n {\n keys: [modKey, \"End\"],\n description: \"Move to last cell\",\n },\n {\n keys: [\"PgUp\"],\n description: \"Move up one page\",\n },\n {\n keys: [\"PgDn\"],\n description: \"Move down one page\",\n },\n ],\n },\n {\n title: \"Selection\",\n shortcuts: [\n {\n keys: [\"Shift\", \"↑↓←→\"],\n description: \"Extend selection\",\n },\n {\n keys: [modKey, \"A\"],\n description: \"Select all cells\",\n },\n {\n keys: [modKey, \"Click\"],\n description: \"Toggle cell selection\",\n },\n {\n keys: [\"Shift\", \"Click\"],\n description: \"Select range\",\n },\n {\n keys: [\"Esc\"],\n description: \"Clear selection\",\n },\n ],\n },\n {\n title: \"Editing\",\n shortcuts: [\n {\n keys: [\"Enter\"],\n description: \"Start editing cell\",\n },\n {\n keys: [\"Double Click\"],\n description: \"Start editing cell\",\n },\n {\n keys: [\"Delete\"],\n description: \"Clear selected cells\",\n },\n {\n keys: [\"Backspace\"],\n description: \"Clear selected cells\",\n },\n ],\n },\n ...(enableSearch\n ? [\n {\n title: \"Search\",\n shortcuts: [\n {\n keys: [modKey, \"F\"],\n description: \"Open search\",\n },\n {\n keys: [\"Enter\"],\n description: \"Next match\",\n },\n {\n keys: [\"Shift\", \"Enter\"],\n description: \"Previous match\",\n },\n {\n keys: [\"Esc\"],\n description: \"Close search\",\n },\n ],\n },\n ]\n : []),\n {\n title: \"Sorting\",\n shortcuts: [\n {\n keys: [modKey, \"Shift\", \"S\"],\n description: \"Toggle the sort menu\",\n },\n {\n keys: [\"Backspace\"],\n description: \"Remove sort (when focused)\",\n },\n {\n keys: [\"Delete\"],\n description: \"Remove sort (when focused)\",\n },\n ],\n },\n {\n title: \"General\",\n shortcuts: [\n {\n keys: [modKey, \"/\"],\n description: \"Show keyboard shortcuts\",\n },\n ],\n },\n ],\n [modKey, enableSearch],\n );\n\n const filteredGroups = React.useMemo(() => {\n if (!input.trim()) return shortcutGroups;\n\n const query = input.toLowerCase();\n return shortcutGroups\n .map((group) => ({\n ...group,\n shortcuts: group.shortcuts.filter(\n (shortcut) =>\n shortcut.description.toLowerCase().includes(query) ||\n shortcut.keys.some((key) => key.toLowerCase().includes(query)),\n ),\n }))\n .filter((group) => group.shortcuts.length > 0);\n }, [shortcutGroups, input]);\n\n React.useEffect(() => {\n function onKeyDown(event: KeyboardEvent) {\n if ((event.ctrlKey || event.metaKey) && event.key === SHORTCUT_KEY) {\n event.preventDefault();\n setOpen(true);\n }\n }\n\n window.addEventListener(\"keydown\", onKeyDown);\n return () => {\n window.removeEventListener(\"keydown\", onKeyDown);\n };\n }, []);\n\n return (\n \n \n \n \n \n \n Keyboard shortcuts\n \n Use these keyboard shortcuts to navigate and interact with the data\n grid more efficiently.\n \n \n
\n
\n \n \n
\n
\n \n
\n {filteredGroups.length === 0 ? (\n
\n
\n \n
\n
\n
\n No shortcuts found\n
\n

\n Try searching for a different term.\n

\n
\n
\n ) : (\n
\n {filteredGroups.map((shortcutGroup) => (\n
\n

\n {shortcutGroup.title}\n

\n
\n {shortcutGroup.shortcuts.map((shortcut, index) => (\n \n ))}\n
\n
\n ))}\n
\n )}\n
\n \n
\n );\n}\n\nfunction ShortcutCard({\n keys,\n description,\n}: ShortcutGroup[\"shortcuts\"][number]) {\n return (\n
\n {description}\n \n {keys.map((key, index) => (\n \n {index > 0 && (\n +\n )}\n {key}\n \n ))}\n \n
\n );\n}\n", - "type": "registry:component", - "target": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx" - }, { "path": "src/components/data-grid/data-grid-row.tsx", "content": "\"use client\";\n\nimport { flexRender, type Row } from \"@tanstack/react-table\";\nimport type { Virtualizer } from \"@tanstack/react-virtual\";\nimport * as React from \"react\";\nimport { useComposedRefs } from \"@/lib/compose-refs\";\nimport { getRowHeightValue } from \"@/lib/data-grid\";\nimport { getCommonPinningStyles } from \"@/lib/data-table\";\nimport { cn } from \"@/lib/utils\";\nimport type { CellPosition, RowHeightValue } from \"@/types/data-grid\";\n\ninterface DataGridRowProps extends React.ComponentProps<\"div\"> {\n row: Row;\n rowVirtualizer: Virtualizer;\n virtualRowIndex: number;\n rowMapRef: React.RefObject>;\n rowHeight: RowHeightValue;\n focusedCell: CellPosition | null;\n}\n\nexport const DataGridRow = React.memo(DataGridRowImpl, (prev, next) => {\n if (prev.row.id !== next.row.id) {\n return false;\n }\n\n const prevRowIndex = prev.virtualRowIndex;\n const nextRowIndex = next.virtualRowIndex;\n\n const prevHasFocus = prev.focusedCell?.rowIndex === prevRowIndex;\n const nextHasFocus = next.focusedCell?.rowIndex === nextRowIndex;\n\n if (prevHasFocus !== nextHasFocus) {\n return false;\n }\n\n if (nextHasFocus && prevHasFocus) {\n const prevFocusedCol = prev.focusedCell?.columnId;\n const nextFocusedCol = next.focusedCell?.columnId;\n if (prevFocusedCol !== nextFocusedCol) {\n return false;\n }\n }\n\n if (next.rowVirtualizer.isScrolling) {\n return true;\n }\n\n return false;\n}) as typeof DataGridRowImpl;\n\nfunction DataGridRowImpl({\n row,\n virtualRowIndex,\n rowVirtualizer,\n rowMapRef,\n rowHeight,\n focusedCell,\n ref,\n className,\n ...props\n}: DataGridRowProps) {\n const rowRef = useComposedRefs(ref, (node) => {\n if (node && typeof virtualRowIndex !== \"undefined\") {\n rowVirtualizer.measureElement(node);\n rowMapRef.current.set(virtualRowIndex, node);\n }\n });\n\n const isRowSelected = row.getIsSelected();\n\n return (\n \n {row.getVisibleCells().map((cell, colIndex) => {\n const isCellFocused =\n focusedCell?.rowIndex === virtualRowIndex &&\n focusedCell?.columnId === cell.column.id;\n\n return (\n \n {typeof cell.column.columnDef.header === \"function\" ? (\n \n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n \n ) : (\n flexRender(cell.column.columnDef.cell, cell.getContext())\n )}\n \n );\n })}\n \n );\n}\n", diff --git a/public/r/registry.json b/public/r/registry.json index f507dd255..f73cfd9be 100644 --- a/public/r/registry.json +++ b/public/r/registry.json @@ -329,10 +329,8 @@ "calendar", "checkbox", "command", - "dialog", "dropdown-menu", "input", - "kbd", "popover", "select", "separator", @@ -376,11 +374,6 @@ "type": "registry:component", "target": "src/components/data-grid/data-grid-context-menu.tsx" }, - { - "path": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx", - "type": "registry:component", - "target": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx" - }, { "path": "src/components/data-grid/data-grid-row.tsx", "type": "registry:component", @@ -477,6 +470,21 @@ "target": "src/components/data-grid/data-grid-view-menu.tsx" } ] + }, + { + "name": "data-grid-keyboard-shortcuts", + "type": "registry:component", + "title": "Data Grid Keyboard Shortcuts", + "description": "A keyboard shortcuts dialog component for the data grid showing all available shortcuts", + "registryDependencies": ["button", "dialog", "input", "kbd", "separator"], + "dependencies": ["lucide-react"], + "files": [ + { + "path": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx", + "type": "registry:component", + "target": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx" + } + ] } ] } diff --git a/registry.json b/registry.json index f507dd255..f73cfd9be 100644 --- a/registry.json +++ b/registry.json @@ -329,10 +329,8 @@ "calendar", "checkbox", "command", - "dialog", "dropdown-menu", "input", - "kbd", "popover", "select", "separator", @@ -376,11 +374,6 @@ "type": "registry:component", "target": "src/components/data-grid/data-grid-context-menu.tsx" }, - { - "path": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx", - "type": "registry:component", - "target": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx" - }, { "path": "src/components/data-grid/data-grid-row.tsx", "type": "registry:component", @@ -477,6 +470,21 @@ "target": "src/components/data-grid/data-grid-view-menu.tsx" } ] + }, + { + "name": "data-grid-keyboard-shortcuts", + "type": "registry:component", + "title": "Data Grid Keyboard Shortcuts", + "description": "A keyboard shortcuts dialog component for the data grid showing all available shortcuts", + "registryDependencies": ["button", "dialog", "input", "kbd", "separator"], + "dependencies": ["lucide-react"], + "files": [ + { + "path": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx", + "type": "registry:component", + "target": "src/components/data-grid/data-grid-keyboard-shortcuts.tsx" + } + ] } ] } diff --git a/src/components/data-grid/data-grid-demo.tsx b/src/components/data-grid/data-grid-demo.tsx index 369171b83..5194d703e 100644 --- a/src/components/data-grid/data-grid-demo.tsx +++ b/src/components/data-grid/data-grid-demo.tsx @@ -4,6 +4,7 @@ import { faker } from "@faker-js/faker"; import type { ColumnDef } from "@tanstack/react-table"; import * as React from "react"; import { DataGrid } from "@/components/data-grid/data-grid"; +import { DataGridKeyboardShortcuts } from "@/components/data-grid/data-grid-keyboard-shortcuts"; import { DataGridRowHeightMenu } from "@/components/data-grid/data-grid-row-height-menu"; import { DataGridSortMenu } from "@/components/data-grid/data-grid-sort-menu"; import { DataGridViewMenu } from "@/components/data-grid/data-grid-view-menu"; @@ -347,6 +348,7 @@ export function DataGridDemo() { + ); diff --git a/src/components/data-grid/data-grid.tsx b/src/components/data-grid/data-grid.tsx index 16db41720..d92559ed3 100644 --- a/src/components/data-grid/data-grid.tsx +++ b/src/components/data-grid/data-grid.tsx @@ -5,7 +5,6 @@ import { Plus } from "lucide-react"; import * as React from "react"; import { DataGridColumnHeader } from "@/components/data-grid/data-grid-column-header"; import { DataGridContextMenu } from "@/components/data-grid/data-grid-context-menu"; -import { DataGridKeyboardShortcuts } from "@/components/data-grid/data-grid-keyboard-shortcuts"; import { DataGridRow } from "@/components/data-grid/data-grid-row"; import { DataGridSearch } from "@/components/data-grid/data-grid-search"; import type { useDataGrid } from "@/hooks/use-data-grid"; @@ -65,7 +64,6 @@ export function DataGrid({ {...props} > {searchState && } -