@eggspot/ui 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Badge.d.ts +15 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/Badge.js +29 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Breadcrumb.d.ts +12 -0
- package/dist/components/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Breadcrumb.js +28 -0
- package/dist/components/Breadcrumb.js.map +1 -0
- package/dist/components/Button.d.ts +53 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +81 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Button.machine.d.ts +9 -0
- package/dist/components/Button.machine.d.ts.map +1 -0
- package/dist/components/Button.machine.js +50 -0
- package/dist/components/Button.machine.js.map +1 -0
- package/dist/components/Button.variants.d.ts +10 -0
- package/dist/components/Button.variants.d.ts.map +1 -0
- package/dist/components/Button.variants.js +214 -0
- package/dist/components/Button.variants.js.map +1 -0
- package/dist/components/ButtonGroup.d.ts +9 -0
- package/dist/components/ButtonGroup.d.ts.map +1 -0
- package/dist/components/ButtonGroup.js +23 -0
- package/dist/components/ButtonGroup.js.map +1 -0
- package/dist/components/Calendar.d.ts +24 -0
- package/dist/components/Calendar.d.ts.map +1 -0
- package/dist/components/Calendar.js +64 -0
- package/dist/components/Calendar.js.map +1 -0
- package/dist/components/Calendar.utils.d.ts +6 -0
- package/dist/components/Calendar.utils.d.ts.map +1 -0
- package/dist/components/Calendar.utils.js +17 -0
- package/dist/components/Calendar.utils.js.map +1 -0
- package/dist/components/Card.d.ts +8 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +19 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/Checkbox.d.ts +36 -0
- package/dist/components/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox.js +55 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/Collapsible.d.ts +20 -0
- package/dist/components/Collapsible.d.ts.map +1 -0
- package/dist/components/Collapsible.js +15 -0
- package/dist/components/Collapsible.js.map +1 -0
- package/dist/components/ConfirmDialog.d.ts +35 -0
- package/dist/components/ConfirmDialog.d.ts.map +1 -0
- package/dist/components/ConfirmDialog.js +81 -0
- package/dist/components/ConfirmDialog.js.map +1 -0
- package/dist/components/CopyButton.d.ts +67 -0
- package/dist/components/CopyButton.d.ts.map +1 -0
- package/dist/components/CopyButton.js +51 -0
- package/dist/components/CopyButton.js.map +1 -0
- package/dist/components/DashboardLayout/DashboardLayout.d.ts +3 -0
- package/dist/components/DashboardLayout/DashboardLayout.d.ts.map +1 -0
- package/dist/components/DashboardLayout/DashboardLayout.js +38 -0
- package/dist/components/DashboardLayout/DashboardLayout.js.map +1 -0
- package/dist/components/DashboardLayout/DashboardLayoutContent.d.ts +9 -0
- package/dist/components/DashboardLayout/DashboardLayoutContent.d.ts.map +1 -0
- package/dist/components/DashboardLayout/DashboardLayoutContent.js +10 -0
- package/dist/components/DashboardLayout/DashboardLayoutContent.js.map +1 -0
- package/dist/components/DashboardLayout/index.d.ts +4 -0
- package/dist/components/DashboardLayout/index.d.ts.map +1 -0
- package/dist/components/DashboardLayout/index.js +3 -0
- package/dist/components/DashboardLayout/index.js.map +1 -0
- package/dist/components/DashboardLayout/types.d.ts +37 -0
- package/dist/components/DashboardLayout/types.d.ts.map +1 -0
- package/dist/components/DashboardLayout/types.js +2 -0
- package/dist/components/DashboardLayout/types.js.map +1 -0
- package/dist/components/DataTable/DataTable.d.ts +9 -0
- package/dist/components/DataTable/DataTable.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.js +271 -0
- package/dist/components/DataTable/DataTable.js.map +1 -0
- package/dist/components/DataTable/DataTableColumnHeader.d.ts +11 -0
- package/dist/components/DataTable/DataTableColumnHeader.d.ts.map +1 -0
- package/dist/components/DataTable/DataTableColumnHeader.js +26 -0
- package/dist/components/DataTable/DataTableColumnHeader.js.map +1 -0
- package/dist/components/DataTable/DataTableDisplaySettings.d.ts +8 -0
- package/dist/components/DataTable/DataTableDisplaySettings.d.ts.map +1 -0
- package/dist/components/DataTable/DataTableDisplaySettings.js +88 -0
- package/dist/components/DataTable/DataTableDisplaySettings.js.map +1 -0
- package/dist/components/DataTable/DataTableFloatingBar.d.ts +8 -0
- package/dist/components/DataTable/DataTableFloatingBar.d.ts.map +1 -0
- package/dist/components/DataTable/DataTableFloatingBar.js +11 -0
- package/dist/components/DataTable/DataTableFloatingBar.js.map +1 -0
- package/dist/components/DataTable/DataTablePagination.d.ts +11 -0
- package/dist/components/DataTable/DataTablePagination.d.ts.map +1 -0
- package/dist/components/DataTable/DataTablePagination.js +68 -0
- package/dist/components/DataTable/DataTablePagination.js.map +1 -0
- package/dist/components/DataTable/DataTableStates.d.ts +13 -0
- package/dist/components/DataTable/DataTableStates.d.ts.map +1 -0
- package/dist/components/DataTable/DataTableStates.js +17 -0
- package/dist/components/DataTable/DataTableStates.js.map +1 -0
- package/dist/components/DataTable/DataTableToolbarContainer.d.ts +7 -0
- package/dist/components/DataTable/DataTableToolbarContainer.d.ts.map +1 -0
- package/dist/components/DataTable/DataTableToolbarContainer.js +7 -0
- package/dist/components/DataTable/DataTableToolbarContainer.js.map +1 -0
- package/dist/components/DataTable/hooks/use-data-table-settings.d.ts +19 -0
- package/dist/components/DataTable/hooks/use-data-table-settings.d.ts.map +1 -0
- package/dist/components/DataTable/hooks/use-data-table-settings.js +70 -0
- package/dist/components/DataTable/hooks/use-data-table-settings.js.map +1 -0
- package/dist/components/DataTable/index.d.ts +4 -0
- package/dist/components/DataTable/index.d.ts.map +1 -0
- package/dist/components/DataTable/index.js +3 -0
- package/dist/components/DataTable/index.js.map +1 -0
- package/dist/components/DataTable/types/data-table.d.ts +76 -0
- package/dist/components/DataTable/types/data-table.d.ts.map +1 -0
- package/dist/components/DataTable/types/data-table.js +2 -0
- package/dist/components/DataTable/types/data-table.js.map +1 -0
- package/dist/components/DatePicker.d.ts +19 -0
- package/dist/components/DatePicker.d.ts.map +1 -0
- package/dist/components/DatePicker.js +49 -0
- package/dist/components/DatePicker.js.map +1 -0
- package/dist/components/DatePicker.utils.d.ts +3 -0
- package/dist/components/DatePicker.utils.d.ts.map +1 -0
- package/dist/components/DatePicker.utils.js +23 -0
- package/dist/components/DatePicker.utils.js.map +1 -0
- package/dist/components/Datefield.d.ts +25 -0
- package/dist/components/Datefield.d.ts.map +1 -0
- package/dist/components/Datefield.js +29 -0
- package/dist/components/Datefield.js.map +1 -0
- package/dist/components/Datefield.utils.d.ts +3 -0
- package/dist/components/Datefield.utils.d.ts.map +1 -0
- package/dist/components/Datefield.utils.js +11 -0
- package/dist/components/Datefield.utils.js.map +1 -0
- package/dist/components/Dialog.d.ts +21 -0
- package/dist/components/Dialog.d.ts.map +1 -0
- package/dist/components/Dialog.js +23 -0
- package/dist/components/Dialog.js.map +1 -0
- package/dist/components/Field.d.ts +10 -0
- package/dist/components/Field.d.ts.map +1 -0
- package/dist/components/Field.js +32 -0
- package/dist/components/Field.js.map +1 -0
- package/dist/components/Filter/Filter.d.ts +4 -0
- package/dist/components/Filter/Filter.d.ts.map +1 -0
- package/dist/components/Filter/Filter.js +8 -0
- package/dist/components/Filter/Filter.js.map +1 -0
- package/dist/components/Filter/Filter.store.d.ts +13 -0
- package/dist/components/Filter/Filter.store.d.ts.map +1 -0
- package/dist/components/Filter/Filter.store.js +61 -0
- package/dist/components/Filter/Filter.store.js.map +1 -0
- package/dist/components/Filter/Filter.types.d.ts +66 -0
- package/dist/components/Filter/Filter.types.d.ts.map +1 -0
- package/dist/components/Filter/Filter.types.js +15 -0
- package/dist/components/Filter/Filter.types.js.map +1 -0
- package/dist/components/Filter/FilterBar.d.ts +7 -0
- package/dist/components/Filter/FilterBar.d.ts.map +1 -0
- package/dist/components/Filter/FilterBar.js +28 -0
- package/dist/components/Filter/FilterBar.js.map +1 -0
- package/dist/components/Filter/FilterBuilder.d.ts +3 -0
- package/dist/components/Filter/FilterBuilder.d.ts.map +1 -0
- package/dist/components/Filter/FilterBuilder.js +47 -0
- package/dist/components/Filter/FilterBuilder.js.map +1 -0
- package/dist/components/Filter/FilterField/DateModeRowValue.d.ts +5 -0
- package/dist/components/Filter/FilterField/DateModeRowValue.d.ts.map +1 -0
- package/dist/components/Filter/FilterField/DateModeRowValue.js +150 -0
- package/dist/components/Filter/FilterField/DateModeRowValue.js.map +1 -0
- package/dist/components/Filter/FilterField/FilterAsyncSelect.d.ts +13 -0
- package/dist/components/Filter/FilterField/FilterAsyncSelect.d.ts.map +1 -0
- package/dist/components/Filter/FilterField/FilterAsyncSelect.js +62 -0
- package/dist/components/Filter/FilterField/FilterAsyncSelect.js.map +1 -0
- package/dist/components/Filter/FilterField/FilterDateMode.d.ts +2 -0
- package/dist/components/Filter/FilterField/FilterDateMode.d.ts.map +1 -0
- package/dist/components/Filter/FilterField/FilterDateMode.js +167 -0
- package/dist/components/Filter/FilterField/FilterDateMode.js.map +1 -0
- package/dist/components/Filter/FilterField/FilterDateRange.d.ts +7 -0
- package/dist/components/Filter/FilterField/FilterDateRange.d.ts.map +1 -0
- package/dist/components/Filter/FilterField/FilterDateRange.js +60 -0
- package/dist/components/Filter/FilterField/FilterDateRange.js.map +1 -0
- package/dist/components/Filter/FilterField/FilterSelect.d.ts +12 -0
- package/dist/components/Filter/FilterField/FilterSelect.d.ts.map +1 -0
- package/dist/components/Filter/FilterField/FilterSelect.js +72 -0
- package/dist/components/Filter/FilterField/FilterSelect.js.map +1 -0
- package/dist/components/Filter/FilterField/FilterSingleDate.d.ts +8 -0
- package/dist/components/Filter/FilterField/FilterSingleDate.d.ts.map +1 -0
- package/dist/components/Filter/FilterField/FilterSingleDate.js +102 -0
- package/dist/components/Filter/FilterField/FilterSingleDate.js.map +1 -0
- package/dist/components/Filter/FilterField/OptionItem.d.ts +10 -0
- package/dist/components/Filter/FilterField/OptionItem.d.ts.map +1 -0
- package/dist/components/Filter/FilterField/OptionItem.js +20 -0
- package/dist/components/Filter/FilterField/OptionItem.js.map +1 -0
- package/dist/components/Filter/FilterField/index.d.ts +7 -0
- package/dist/components/Filter/FilterField/index.d.ts.map +1 -0
- package/dist/components/Filter/FilterField/index.js +7 -0
- package/dist/components/Filter/FilterField/index.js.map +1 -0
- package/dist/components/Filter/FilterRow.d.ts +7 -0
- package/dist/components/Filter/FilterRow.d.ts.map +1 -0
- package/dist/components/Filter/FilterRow.js +152 -0
- package/dist/components/Filter/FilterRow.js.map +1 -0
- package/dist/components/Filter/index.d.ts +7 -0
- package/dist/components/Filter/index.d.ts.map +1 -0
- package/dist/components/Filter/index.js +6 -0
- package/dist/components/Filter/index.js.map +1 -0
- package/dist/components/Form.d.ts +32 -0
- package/dist/components/Form.d.ts.map +1 -0
- package/dist/components/Form.js +82 -0
- package/dist/components/Form.js.map +1 -0
- package/dist/components/Heading.d.ts +10 -0
- package/dist/components/Heading.d.ts.map +1 -0
- package/dist/components/Heading.js +27 -0
- package/dist/components/Heading.js.map +1 -0
- package/dist/components/Input.d.ts +43 -0
- package/dist/components/Input.d.ts.map +1 -0
- package/dist/components/Input.js +58 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/InputOTP.d.ts +12 -0
- package/dist/components/InputOTP.d.ts.map +1 -0
- package/dist/components/InputOTP.js +24 -0
- package/dist/components/InputOTP.js.map +1 -0
- package/dist/components/Label.d.ts +9 -0
- package/dist/components/Label.d.ts.map +1 -0
- package/dist/components/Label.js +19 -0
- package/dist/components/Label.js.map +1 -0
- package/dist/components/Layout.d.ts +47 -0
- package/dist/components/Layout.d.ts.map +1 -0
- package/dist/components/Layout.js +78 -0
- package/dist/components/Layout.js.map +1 -0
- package/dist/components/ListBox.d.ts +8 -0
- package/dist/components/ListBox.d.ts.map +1 -0
- package/dist/components/ListBox.js +28 -0
- package/dist/components/ListBox.js.map +1 -0
- package/dist/components/Menu.d.ts +19 -0
- package/dist/components/Menu.d.ts.map +1 -0
- package/dist/components/Menu.js +29 -0
- package/dist/components/Menu.js.map +1 -0
- package/dist/components/NativeSelect.d.ts +10 -0
- package/dist/components/NativeSelect.d.ts.map +1 -0
- package/dist/components/NativeSelect.js +36 -0
- package/dist/components/NativeSelect.js.map +1 -0
- package/dist/components/NumberInput.d.ts +12 -0
- package/dist/components/NumberInput.d.ts.map +1 -0
- package/dist/components/NumberInput.js +25 -0
- package/dist/components/NumberInput.js.map +1 -0
- package/dist/components/Popover.d.ts +9 -0
- package/dist/components/Popover.d.ts.map +1 -0
- package/dist/components/Popover.js +17 -0
- package/dist/components/Popover.js.map +1 -0
- package/dist/components/Provider.d.ts +10 -0
- package/dist/components/Provider.d.ts.map +1 -0
- package/dist/components/Provider.js +11 -0
- package/dist/components/Provider.js.map +1 -0
- package/dist/components/RadioGroup.d.ts +37 -0
- package/dist/components/RadioGroup.d.ts.map +1 -0
- package/dist/components/RadioGroup.js +61 -0
- package/dist/components/RadioGroup.js.map +1 -0
- package/dist/components/Resizable.d.ts +25 -0
- package/dist/components/Resizable.d.ts.map +1 -0
- package/dist/components/Resizable.js +19 -0
- package/dist/components/Resizable.js.map +1 -0
- package/dist/components/ScrollArea.d.ts +6 -0
- package/dist/components/ScrollArea.d.ts.map +1 -0
- package/dist/components/ScrollArea.js +14 -0
- package/dist/components/ScrollArea.js.map +1 -0
- package/dist/components/Select.d.ts +88 -0
- package/dist/components/Select.d.ts.map +1 -0
- package/dist/components/Select.js +174 -0
- package/dist/components/Select.js.map +1 -0
- package/dist/components/Select.utils.d.ts +13 -0
- package/dist/components/Select.utils.d.ts.map +1 -0
- package/dist/components/Select.utils.js +41 -0
- package/dist/components/Select.utils.js.map +1 -0
- package/dist/components/Separator.d.ts +4 -0
- package/dist/components/Separator.d.ts.map +1 -0
- package/dist/components/Separator.js +7 -0
- package/dist/components/Separator.js.map +1 -0
- package/dist/components/Sheet.d.ts +19 -0
- package/dist/components/Sheet.d.ts.map +1 -0
- package/dist/components/Sheet.js +24 -0
- package/dist/components/Sheet.js.map +1 -0
- package/dist/components/Sidebar/LinkItem.d.ts +34 -0
- package/dist/components/Sidebar/LinkItem.d.ts.map +1 -0
- package/dist/components/Sidebar/LinkItem.js +19 -0
- package/dist/components/Sidebar/LinkItem.js.map +1 -0
- package/dist/components/Sidebar/PageTree.d.ts +46 -0
- package/dist/components/Sidebar/PageTree.d.ts.map +1 -0
- package/dist/components/Sidebar/PageTree.js +46 -0
- package/dist/components/Sidebar/PageTree.js.map +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +94 -0
- package/dist/components/Sidebar/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar/Sidebar.js +328 -0
- package/dist/components/Sidebar/Sidebar.js.map +1 -0
- package/dist/components/Sidebar/SidebarNavTree.d.ts +26 -0
- package/dist/components/Sidebar/SidebarNavTree.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarNavTree.js +32 -0
- package/dist/components/Sidebar/SidebarNavTree.js.map +1 -0
- package/dist/components/Sidebar/Tabs.d.ts +27 -0
- package/dist/components/Sidebar/Tabs.d.ts.map +1 -0
- package/dist/components/Sidebar/Tabs.js +49 -0
- package/dist/components/Sidebar/Tabs.js.map +1 -0
- package/dist/components/Sidebar/index.d.ts +6 -0
- package/dist/components/Sidebar/index.d.ts.map +1 -0
- package/dist/components/Sidebar/index.js +22 -0
- package/dist/components/Sidebar/index.js.map +1 -0
- package/dist/components/Sonner.d.ts +16 -0
- package/dist/components/Sonner.d.ts.map +1 -0
- package/dist/components/Sonner.js +38 -0
- package/dist/components/Sonner.js.map +1 -0
- package/dist/components/Spinner.d.ts +3 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +7 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Switch.d.ts +4 -0
- package/dist/components/Switch.d.ts.map +1 -0
- package/dist/components/Switch.js +19 -0
- package/dist/components/Switch.js.map +1 -0
- package/dist/components/Text.d.ts +10 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/Text.js +22 -0
- package/dist/components/Text.js.map +1 -0
- package/dist/components/Tooltip.d.ts +8 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip.js +24 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/Virtualizer.d.ts +8 -0
- package/dist/components/Virtualizer.d.ts.map +1 -0
- package/dist/components/Virtualizer.js +8 -0
- package/dist/components/Virtualizer.js.map +1 -0
- package/dist/consts/config.d.ts +3 -0
- package/dist/consts/config.d.ts.map +1 -0
- package/dist/consts/config.js +3 -0
- package/dist/consts/config.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +6 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +16 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +9 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +53 -5
- package/eslint.config.js +0 -41
- package/resolve-catalog.js +0 -61
- package/src/components/Button.machine.tsx +0 -50
- package/src/components/Button.tsx +0 -249
- package/src/components/Button.variants.tsx +0 -186
- package/src/components/ButtonGroup.tsx +0 -56
- package/src/components/Calendar.tsx +0 -275
- package/src/components/Calendar.utils.tsx +0 -22
- package/src/components/Checkbox.tsx +0 -199
- package/src/components/ConfirmDialog.tsx +0 -183
- package/src/components/DashboardLayout/DashboardLayout.tsx +0 -348
- package/src/components/DashboardLayout/SidebarNav.tsx +0 -509
- package/src/components/DashboardLayout/index.ts +0 -33
- package/src/components/DataTable/DataTable.tsx +0 -557
- package/src/components/DataTable/DataTableColumnHeader.tsx +0 -122
- package/src/components/DataTable/DataTableDisplaySettings.tsx +0 -265
- package/src/components/DataTable/DataTableFloatingBar.tsx +0 -44
- package/src/components/DataTable/DataTablePagination.tsx +0 -168
- package/src/components/DataTable/DataTableStates.tsx +0 -69
- package/src/components/DataTable/DataTableToolbarContainer.tsx +0 -47
- package/src/components/DataTable/hooks/use-data-table-settings.ts +0 -101
- package/src/components/DataTable/index.ts +0 -7
- package/src/components/DataTable/types/data-table.ts +0 -97
- package/src/components/DatePicker.tsx +0 -213
- package/src/components/DatePicker.utils.tsx +0 -38
- package/src/components/Datefield.tsx +0 -109
- package/src/components/Datefield.utils.ts +0 -10
- package/src/components/Dialog.tsx +0 -167
- package/src/components/Field.tsx +0 -49
- package/src/components/Filter/Filter.store.tsx +0 -122
- package/src/components/Filter/Filter.tsx +0 -11
- package/src/components/Filter/Filter.types.ts +0 -107
- package/src/components/Filter/FilterBar.tsx +0 -38
- package/src/components/Filter/FilterBuilder.tsx +0 -158
- package/src/components/Filter/FilterField/DateModeRowValue.tsx +0 -250
- package/src/components/Filter/FilterField/FilterAsyncSelect.tsx +0 -191
- package/src/components/Filter/FilterField/FilterDateMode.tsx +0 -241
- package/src/components/Filter/FilterField/FilterDateRange.tsx +0 -169
- package/src/components/Filter/FilterField/FilterSelect.tsx +0 -208
- package/src/components/Filter/FilterField/FilterSingleDate.tsx +0 -277
- package/src/components/Filter/FilterField/OptionItem.tsx +0 -112
- package/src/components/Filter/FilterField/index.ts +0 -6
- package/src/components/Filter/FilterRow.tsx +0 -527
- package/src/components/Filter/index.ts +0 -17
- package/src/components/Form.tsx +0 -195
- package/src/components/Heading.tsx +0 -41
- package/src/components/Input.tsx +0 -221
- package/src/components/InputOTP.tsx +0 -78
- package/src/components/Label.tsx +0 -65
- package/src/components/Layout.tsx +0 -129
- package/src/components/ListBox.tsx +0 -97
- package/src/components/Menu.tsx +0 -152
- package/src/components/NativeSelect.tsx +0 -77
- package/src/components/NumberInput.tsx +0 -114
- package/src/components/Popover.tsx +0 -44
- package/src/components/Provider.tsx +0 -22
- package/src/components/RadioGroup.tsx +0 -191
- package/src/components/Resizable.tsx +0 -71
- package/src/components/ScrollArea.tsx +0 -57
- package/src/components/Select.tsx +0 -626
- package/src/components/Select.utils.tsx +0 -64
- package/src/components/Separator.tsx +0 -25
- package/src/components/Sheet.tsx +0 -147
- package/src/components/Sonner.tsx +0 -96
- package/src/components/Spinner.tsx +0 -30
- package/src/components/Switch.tsx +0 -51
- package/src/components/Text.tsx +0 -35
- package/src/components/Tooltip.tsx +0 -58
- package/src/consts/config.ts +0 -2
- package/src/hooks/.gitkeep +0 -0
- package/src/lib/utils.ts +0 -10
- package/tsconfig.json +0 -27
- package/tsconfig.lint.json +0 -8
|
@@ -1,557 +0,0 @@
|
|
|
1
|
-
import { memo, RefObject, useEffect, useMemo, useRef } from "react"
|
|
2
|
-
import { Checkbox } from "@eggspot/ui/components/Checkbox"
|
|
3
|
-
import { DataTableProps } from "@eggspot/ui/components/DataTable/types/data-table"
|
|
4
|
-
import { cn } from "@eggspot/ui/lib/utils"
|
|
5
|
-
import {
|
|
6
|
-
Cell,
|
|
7
|
-
ColumnDef,
|
|
8
|
-
ColumnPinningState,
|
|
9
|
-
flexRender,
|
|
10
|
-
getCoreRowModel,
|
|
11
|
-
getFilteredRowModel,
|
|
12
|
-
getPaginationRowModel,
|
|
13
|
-
getSortedRowModel,
|
|
14
|
-
Header,
|
|
15
|
-
Table,
|
|
16
|
-
useReactTable,
|
|
17
|
-
} from "@tanstack/react-table"
|
|
18
|
-
import { useVirtualizer } from "@tanstack/react-virtual"
|
|
19
|
-
|
|
20
|
-
import { FilterValue } from "../Filter"
|
|
21
|
-
import { DataTableDisplaySettings } from "./DataTableDisplaySettings"
|
|
22
|
-
import { DataTableFloatingBar } from "./DataTableFloatingBar"
|
|
23
|
-
import { DataTablePagination } from "./DataTablePagination"
|
|
24
|
-
import {
|
|
25
|
-
DataTableEmpty,
|
|
26
|
-
DataTableError,
|
|
27
|
-
DataTableLoading,
|
|
28
|
-
} from "./DataTableStates"
|
|
29
|
-
import { DataTableToolbarContainer } from "./DataTableToolbarContainer"
|
|
30
|
-
import { useDataTableSettings } from "./hooks/use-data-table-settings"
|
|
31
|
-
|
|
32
|
-
function HeaderCell({
|
|
33
|
-
header,
|
|
34
|
-
isPinned,
|
|
35
|
-
}: {
|
|
36
|
-
header: Header<any, any>
|
|
37
|
-
isPinned?: "left" | "right"
|
|
38
|
-
}) {
|
|
39
|
-
const isResizing = header.column.getIsResizing()
|
|
40
|
-
return (
|
|
41
|
-
<th
|
|
42
|
-
key={header.id}
|
|
43
|
-
className={cn(
|
|
44
|
-
"text-gray-11 bg-gray-4 relative h-11 px-4 text-left align-middle font-semibold",
|
|
45
|
-
isPinned === "left" &&
|
|
46
|
-
"sticky left-0 z-20 shadow-[-6px_0_2px_-6px_var(--gray-6)_inset]",
|
|
47
|
-
isPinned === "right" &&
|
|
48
|
-
"sticky right-0 z-20 shadow-[6px_0_2px_-6px_var(--gray-6)_inset]",
|
|
49
|
-
header.column.getCanResize() && "group"
|
|
50
|
-
)}
|
|
51
|
-
style={{
|
|
52
|
-
width: header.getSize(),
|
|
53
|
-
minWidth: header.column.columnDef.minSize,
|
|
54
|
-
maxWidth: header.column.columnDef.maxSize,
|
|
55
|
-
...(isPinned === "left" && {
|
|
56
|
-
left: header.column.getStart("left"),
|
|
57
|
-
}),
|
|
58
|
-
...(isPinned === "right" && {
|
|
59
|
-
right: header.column.getAfter("right"),
|
|
60
|
-
}),
|
|
61
|
-
}}
|
|
62
|
-
>
|
|
63
|
-
{header.isPlaceholder
|
|
64
|
-
? null
|
|
65
|
-
: flexRender(header.column.columnDef.header, header.getContext())}
|
|
66
|
-
{header.column.getCanResize() && (
|
|
67
|
-
<div
|
|
68
|
-
data-slot="data-table-resize-handle"
|
|
69
|
-
onMouseDown={header.getResizeHandler()}
|
|
70
|
-
onTouchStart={header.getResizeHandler()}
|
|
71
|
-
className={cn(
|
|
72
|
-
"group/resize-handle absolute top-0 right-0 z-10 flex h-full w-2 cursor-col-resize touch-none items-center justify-center select-none"
|
|
73
|
-
)}
|
|
74
|
-
>
|
|
75
|
-
<div
|
|
76
|
-
className={cn(
|
|
77
|
-
"bg-gray-7 group-hover/resize-handle:bg-gray-11 h-6 w-px transition-colors duration-150",
|
|
78
|
-
isResizing && "bg-accent-9!"
|
|
79
|
-
)}
|
|
80
|
-
/>
|
|
81
|
-
</div>
|
|
82
|
-
)}
|
|
83
|
-
</th>
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function TableCell({
|
|
88
|
-
cell,
|
|
89
|
-
isPinned,
|
|
90
|
-
}: {
|
|
91
|
-
cell: Cell<any, any>
|
|
92
|
-
isPinned?: "left" | "right"
|
|
93
|
-
}) {
|
|
94
|
-
return (
|
|
95
|
-
<td
|
|
96
|
-
key={cell.id}
|
|
97
|
-
title={cell.getValue()}
|
|
98
|
-
className={cn(
|
|
99
|
-
"group-hover:bg-gray-3 truncate px-4 py-1 align-middle text-sm",
|
|
100
|
-
"group-data-[state=selected]:bg-gray-4",
|
|
101
|
-
isPinned === "left" &&
|
|
102
|
-
"bg-gray-2 group-data-[state=selected]:bg-gray-5 sticky left-0 z-10 shadow-[-6px_0_2px_-6px_var(--gray-6)_inset]",
|
|
103
|
-
isPinned === "right" &&
|
|
104
|
-
"bg-gray-2 group-data-[state=selected]:bg-gray-5 sticky right-0 z-10 shadow-[6px_0_2px_-6px_var(--gray-6)_inset]"
|
|
105
|
-
)}
|
|
106
|
-
style={{
|
|
107
|
-
width: cell.column.getSize(),
|
|
108
|
-
minWidth: cell.column.columnDef.minSize,
|
|
109
|
-
maxWidth: cell.column.columnDef.maxSize,
|
|
110
|
-
...(isPinned === "left" && {
|
|
111
|
-
left: cell.column.getStart("left"),
|
|
112
|
-
}),
|
|
113
|
-
...(isPinned === "right" && {
|
|
114
|
-
right: cell.column.getAfter("right"),
|
|
115
|
-
}),
|
|
116
|
-
}}
|
|
117
|
-
>
|
|
118
|
-
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
119
|
-
</td>
|
|
120
|
-
)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function TableBody({
|
|
124
|
-
table,
|
|
125
|
-
tableContainerRef,
|
|
126
|
-
estimatedRowHeight,
|
|
127
|
-
}: {
|
|
128
|
-
table: Table<any>
|
|
129
|
-
tableContainerRef: RefObject<HTMLDivElement | null>
|
|
130
|
-
estimatedRowHeight: number
|
|
131
|
-
}) {
|
|
132
|
-
const { rows } = table.getRowModel()
|
|
133
|
-
const rowVirtualizer = useVirtualizer({
|
|
134
|
-
count: rows.length,
|
|
135
|
-
getScrollElement: () => tableContainerRef.current,
|
|
136
|
-
estimateSize: () => estimatedRowHeight,
|
|
137
|
-
overscan: 10,
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
const virtualRows = rowVirtualizer.getVirtualItems()
|
|
141
|
-
const totalSize = rowVirtualizer.getTotalSize()
|
|
142
|
-
|
|
143
|
-
const paddingTop = virtualRows.length > 0 ? virtualRows[0]?.start || 0 : 0
|
|
144
|
-
const paddingBottom =
|
|
145
|
-
virtualRows.length > 0
|
|
146
|
-
? totalSize - (virtualRows[virtualRows.length - 1]?.end || 0)
|
|
147
|
-
: 0
|
|
148
|
-
|
|
149
|
-
const leftPinnedColumns = table.getLeftVisibleLeafColumns()
|
|
150
|
-
const rightPinnedColumns = table.getRightVisibleLeafColumns()
|
|
151
|
-
const centerColumns = table.getCenterVisibleLeafColumns()
|
|
152
|
-
|
|
153
|
-
return (
|
|
154
|
-
<tbody>
|
|
155
|
-
{paddingTop > 0 && (
|
|
156
|
-
<tr>
|
|
157
|
-
<td style={{ height: `${paddingTop}px` }} />
|
|
158
|
-
</tr>
|
|
159
|
-
)}
|
|
160
|
-
{virtualRows.map((virtualRow) => {
|
|
161
|
-
const row = rows[virtualRow.index]
|
|
162
|
-
|
|
163
|
-
if (!row) return null
|
|
164
|
-
|
|
165
|
-
const isSelected = row.getIsSelected()
|
|
166
|
-
|
|
167
|
-
return (
|
|
168
|
-
<tr
|
|
169
|
-
key={row.id}
|
|
170
|
-
data-state={isSelected ? "selected" : undefined}
|
|
171
|
-
className={cn(
|
|
172
|
-
"group border-gray-3 h-11 border-b transition-colors"
|
|
173
|
-
)}
|
|
174
|
-
>
|
|
175
|
-
{leftPinnedColumns.map((column) => {
|
|
176
|
-
const cell = row
|
|
177
|
-
.getVisibleCells()
|
|
178
|
-
.find((c) => c.column.id === column.id)
|
|
179
|
-
return cell ? (
|
|
180
|
-
<TableCell key={cell.id} cell={cell} isPinned="left" />
|
|
181
|
-
) : null
|
|
182
|
-
})}
|
|
183
|
-
{centerColumns.map((column) => {
|
|
184
|
-
const cell = row
|
|
185
|
-
.getVisibleCells()
|
|
186
|
-
.find((c) => c.column.id === column.id)
|
|
187
|
-
return cell ? <TableCell key={cell.id} cell={cell} /> : null
|
|
188
|
-
})}
|
|
189
|
-
{rightPinnedColumns.map((column) => {
|
|
190
|
-
const cell = row
|
|
191
|
-
.getVisibleCells()
|
|
192
|
-
.find((c) => c.column.id === column.id)
|
|
193
|
-
return cell ? (
|
|
194
|
-
<TableCell key={cell.id} cell={cell} isPinned="right" />
|
|
195
|
-
) : null
|
|
196
|
-
})}
|
|
197
|
-
</tr>
|
|
198
|
-
)
|
|
199
|
-
})}
|
|
200
|
-
{paddingBottom > 0 && (
|
|
201
|
-
<tr>
|
|
202
|
-
<td style={{ height: `${paddingBottom}px` }} />
|
|
203
|
-
</tr>
|
|
204
|
-
)}
|
|
205
|
-
</tbody>
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const MemoizedTableBody = memo(
|
|
210
|
-
TableBody,
|
|
211
|
-
(prev, next) => prev.table.options.data === next.table.options.data
|
|
212
|
-
) as typeof TableBody
|
|
213
|
-
|
|
214
|
-
export function DataTable<TData extends { id: string | number }>({
|
|
215
|
-
// Core data
|
|
216
|
-
columns,
|
|
217
|
-
data,
|
|
218
|
-
dataSource = "server",
|
|
219
|
-
|
|
220
|
-
// Loading/error states
|
|
221
|
-
isLoading = false,
|
|
222
|
-
isFetching,
|
|
223
|
-
isError = false,
|
|
224
|
-
errorMessage,
|
|
225
|
-
|
|
226
|
-
// Components
|
|
227
|
-
filterBar,
|
|
228
|
-
actionBar,
|
|
229
|
-
|
|
230
|
-
// State for server-side operations
|
|
231
|
-
initialState,
|
|
232
|
-
onStateChange,
|
|
233
|
-
rowCount,
|
|
234
|
-
|
|
235
|
-
// Selection
|
|
236
|
-
enableRowSelection = true,
|
|
237
|
-
|
|
238
|
-
// Display settings
|
|
239
|
-
storageKey = "default-table",
|
|
240
|
-
defaultColumnVisibility = {},
|
|
241
|
-
defaultColumnSizing = {},
|
|
242
|
-
defaultColumnPinning = { left: [], right: [] },
|
|
243
|
-
defaultColumnOrder,
|
|
244
|
-
|
|
245
|
-
// Virtualization
|
|
246
|
-
estimatedRowHeight = 44,
|
|
247
|
-
|
|
248
|
-
// Custom empty state
|
|
249
|
-
emptyStateTitle,
|
|
250
|
-
emptyStateDescription,
|
|
251
|
-
}: DataTableProps<TData>) {
|
|
252
|
-
const rendered = useRef(false)
|
|
253
|
-
const tableContainerRef = useRef<HTMLDivElement>(null)
|
|
254
|
-
|
|
255
|
-
// Calculate default column order from columns if not provided
|
|
256
|
-
const calculatedDefaultOrder = useMemo(() => {
|
|
257
|
-
if (defaultColumnOrder) return defaultColumnOrder
|
|
258
|
-
return [
|
|
259
|
-
"select",
|
|
260
|
-
...(columns
|
|
261
|
-
.map(
|
|
262
|
-
(col) =>
|
|
263
|
-
(col as { accessorKey?: string }).accessorKey ||
|
|
264
|
-
(col as { id?: string }).id
|
|
265
|
-
)
|
|
266
|
-
.filter(Boolean) as string[]),
|
|
267
|
-
]
|
|
268
|
-
}, [columns, defaultColumnOrder])
|
|
269
|
-
|
|
270
|
-
const {
|
|
271
|
-
settings,
|
|
272
|
-
updateColumnVisibility,
|
|
273
|
-
updateColumnSizing,
|
|
274
|
-
updateColumnPinning,
|
|
275
|
-
updateColumnOrder,
|
|
276
|
-
resetToDefaults,
|
|
277
|
-
} = useDataTableSettings({
|
|
278
|
-
storageKey,
|
|
279
|
-
defaultColumnVisibility,
|
|
280
|
-
defaultColumnSizing,
|
|
281
|
-
defaultColumnPinning,
|
|
282
|
-
defaultColumnOrder: calculatedDefaultOrder,
|
|
283
|
-
})
|
|
284
|
-
|
|
285
|
-
// Selection column
|
|
286
|
-
const selectionColumn: ColumnDef<TData> = {
|
|
287
|
-
id: "select",
|
|
288
|
-
size: 48,
|
|
289
|
-
minSize: 48,
|
|
290
|
-
maxSize: 48,
|
|
291
|
-
enableResizing: false,
|
|
292
|
-
enableSorting: false,
|
|
293
|
-
enableHiding: false,
|
|
294
|
-
header: ({ table }) => {
|
|
295
|
-
return (
|
|
296
|
-
<div className="flex items-center justify-center">
|
|
297
|
-
<Checkbox
|
|
298
|
-
isSelected={table.getIsAllPageRowsSelected()}
|
|
299
|
-
isIndeterminate={table.getIsSomePageRowsSelected()}
|
|
300
|
-
onChange={(isSelected) => {
|
|
301
|
-
table.toggleAllPageRowsSelected(isSelected)
|
|
302
|
-
}}
|
|
303
|
-
aria-label="Select all"
|
|
304
|
-
className="translate-y-[2px]"
|
|
305
|
-
/>
|
|
306
|
-
</div>
|
|
307
|
-
)
|
|
308
|
-
},
|
|
309
|
-
cell: ({ row }) => (
|
|
310
|
-
<div className="flex items-center justify-center">
|
|
311
|
-
<Checkbox
|
|
312
|
-
isSelected={row.getIsSelected()}
|
|
313
|
-
isDisabled={!row.getCanSelect()}
|
|
314
|
-
isIndeterminate={row.getIsSomeSelected()}
|
|
315
|
-
onChange={row.getToggleSelectedHandler()}
|
|
316
|
-
aria-label="Select row"
|
|
317
|
-
className="translate-y-[2px]"
|
|
318
|
-
/>
|
|
319
|
-
</div>
|
|
320
|
-
),
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const allColumns = useMemo(() => {
|
|
324
|
-
if (enableRowSelection) {
|
|
325
|
-
return [selectionColumn, ...columns]
|
|
326
|
-
}
|
|
327
|
-
return columns
|
|
328
|
-
}, [columns, enableRowSelection])
|
|
329
|
-
|
|
330
|
-
// Always pin selection column to the left
|
|
331
|
-
const columnPinning = useMemo((): ColumnPinningState => {
|
|
332
|
-
const left = settings.columnPinning.left || []
|
|
333
|
-
const right = settings.columnPinning.right || []
|
|
334
|
-
|
|
335
|
-
// Ensure "select" is always first in left pinned columns when row selection is enabled
|
|
336
|
-
if (enableRowSelection && !left.includes("select")) {
|
|
337
|
-
return { left: ["select", ...left], right }
|
|
338
|
-
}
|
|
339
|
-
return { left, right }
|
|
340
|
-
}, [settings.columnPinning, enableRowSelection])
|
|
341
|
-
|
|
342
|
-
const table = useReactTable({
|
|
343
|
-
data,
|
|
344
|
-
columns: allColumns,
|
|
345
|
-
initialState: {
|
|
346
|
-
pagination: {
|
|
347
|
-
pageSize: 20,
|
|
348
|
-
},
|
|
349
|
-
...initialState,
|
|
350
|
-
},
|
|
351
|
-
rowCount: rowCount,
|
|
352
|
-
state: {
|
|
353
|
-
columnVisibility: settings.columnVisibility,
|
|
354
|
-
columnSizing: settings.columnSizing,
|
|
355
|
-
columnPinning,
|
|
356
|
-
columnOrder:
|
|
357
|
-
settings.columnOrder.length > 0
|
|
358
|
-
? settings.columnOrder
|
|
359
|
-
: calculatedDefaultOrder,
|
|
360
|
-
},
|
|
361
|
-
enableColumnResizing: true,
|
|
362
|
-
columnResizeMode: "onChange",
|
|
363
|
-
getCoreRowModel: getCoreRowModel(),
|
|
364
|
-
getSortedRowModel: getSortedRowModel(),
|
|
365
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
366
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
367
|
-
globalFilterFn: "auto",
|
|
368
|
-
onColumnVisibilityChange: (updater) => {
|
|
369
|
-
const newVisibility =
|
|
370
|
-
typeof updater === "function"
|
|
371
|
-
? updater(settings.columnVisibility)
|
|
372
|
-
: updater
|
|
373
|
-
updateColumnVisibility(newVisibility)
|
|
374
|
-
},
|
|
375
|
-
onColumnSizingChange: (updater) => {
|
|
376
|
-
const newSizing =
|
|
377
|
-
typeof updater === "function" ? updater(settings.columnSizing) : updater
|
|
378
|
-
updateColumnSizing(newSizing)
|
|
379
|
-
},
|
|
380
|
-
onColumnPinningChange: (updater) => {
|
|
381
|
-
const newPinning =
|
|
382
|
-
typeof updater === "function"
|
|
383
|
-
? updater(settings.columnPinning)
|
|
384
|
-
: updater
|
|
385
|
-
updateColumnPinning(newPinning)
|
|
386
|
-
},
|
|
387
|
-
onColumnOrderChange: (updater) => {
|
|
388
|
-
const newOrder =
|
|
389
|
-
typeof updater === "function" ? updater(settings.columnOrder) : updater
|
|
390
|
-
updateColumnOrder(newOrder)
|
|
391
|
-
},
|
|
392
|
-
getRowId: (row) => String(row.id),
|
|
393
|
-
manualPagination: dataSource === "server",
|
|
394
|
-
manualFiltering: dataSource === "server",
|
|
395
|
-
manualSorting: dataSource === "server",
|
|
396
|
-
})
|
|
397
|
-
|
|
398
|
-
const { rows } = table.getRowModel()
|
|
399
|
-
|
|
400
|
-
// Get pinned and center columns
|
|
401
|
-
const leftPinnedColumns = table.getLeftVisibleLeafColumns()
|
|
402
|
-
const rightPinnedColumns = table.getRightVisibleLeafColumns()
|
|
403
|
-
const centerColumns = table.getCenterVisibleLeafColumns()
|
|
404
|
-
|
|
405
|
-
const state = table.getState()
|
|
406
|
-
|
|
407
|
-
// column filters props (client side)
|
|
408
|
-
const columnFilters: FilterValue = useMemo(
|
|
409
|
-
() =>
|
|
410
|
-
state.columnFilters.reduce((acc, filter) => {
|
|
411
|
-
try {
|
|
412
|
-
acc[filter.id] = filter.value as any
|
|
413
|
-
return acc
|
|
414
|
-
} catch (error) {
|
|
415
|
-
return acc
|
|
416
|
-
}
|
|
417
|
-
}, {} as FilterValue),
|
|
418
|
-
[state.columnFilters]
|
|
419
|
-
)
|
|
420
|
-
const setColumnFilters = (filters: FilterValue) => {
|
|
421
|
-
table.setColumnFilters(
|
|
422
|
-
Object.entries(filters).map(([id, value]) => ({ id, value }))
|
|
423
|
-
)
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// Notify parent of filters change
|
|
427
|
-
useEffect(() => {
|
|
428
|
-
onStateChange?.(state)
|
|
429
|
-
|
|
430
|
-
setTimeout(() => {
|
|
431
|
-
rendered.current = true
|
|
432
|
-
}, 200)
|
|
433
|
-
|
|
434
|
-
if (rendered.current) {
|
|
435
|
-
table.setPageIndex(0)
|
|
436
|
-
}
|
|
437
|
-
}, [
|
|
438
|
-
state.pagination.pageSize,
|
|
439
|
-
state.sorting,
|
|
440
|
-
state.globalFilter,
|
|
441
|
-
state.columnFilters,
|
|
442
|
-
])
|
|
443
|
-
|
|
444
|
-
// Notify parent of page index change
|
|
445
|
-
useEffect(() => {
|
|
446
|
-
onStateChange?.(state)
|
|
447
|
-
}, [state.pagination.pageIndex])
|
|
448
|
-
|
|
449
|
-
const clearSelection = () => {
|
|
450
|
-
table.resetRowSelection()
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
return (
|
|
454
|
-
<div className="flex h-full flex-col overflow-hidden">
|
|
455
|
-
{/* Toolbar */}
|
|
456
|
-
<DataTableToolbarContainer table={table}>
|
|
457
|
-
<div>
|
|
458
|
-
{filterBar?.({ value: columnFilters, onChange: setColumnFilters })}
|
|
459
|
-
</div>
|
|
460
|
-
<DataTableDisplaySettings
|
|
461
|
-
table={table}
|
|
462
|
-
onResetToDefaults={resetToDefaults}
|
|
463
|
-
/>
|
|
464
|
-
</DataTableToolbarContainer>
|
|
465
|
-
|
|
466
|
-
{/* Table Container */}
|
|
467
|
-
<div ref={tableContainerRef} className="relative flex-1 overflow-auto">
|
|
468
|
-
<table
|
|
469
|
-
data-fetching={isFetching ? "true" : undefined}
|
|
470
|
-
className="w-full table-fixed border-collapse data-[fetching=true]:opacity-60"
|
|
471
|
-
>
|
|
472
|
-
<thead className="sticky top-0 z-30">
|
|
473
|
-
{table.getHeaderGroups().map((headerGroup) => (
|
|
474
|
-
<tr key={headerGroup.id}>
|
|
475
|
-
{leftPinnedColumns.map((column) => {
|
|
476
|
-
const header = headerGroup.headers.find(
|
|
477
|
-
(h) => h.column.id === column.id
|
|
478
|
-
)
|
|
479
|
-
return header ? (
|
|
480
|
-
<HeaderCell
|
|
481
|
-
key={header.id}
|
|
482
|
-
header={header}
|
|
483
|
-
isPinned="left"
|
|
484
|
-
/>
|
|
485
|
-
) : null
|
|
486
|
-
})}
|
|
487
|
-
{centerColumns.map((column) => {
|
|
488
|
-
const header = headerGroup.headers.find(
|
|
489
|
-
(h) => h.column.id === column.id
|
|
490
|
-
)
|
|
491
|
-
return header ? (
|
|
492
|
-
<HeaderCell key={header.id} header={header} />
|
|
493
|
-
) : null
|
|
494
|
-
})}
|
|
495
|
-
{rightPinnedColumns.map((column) => {
|
|
496
|
-
const header = headerGroup.headers.find(
|
|
497
|
-
(h) => h.column.id === column.id
|
|
498
|
-
)
|
|
499
|
-
return header ? (
|
|
500
|
-
<HeaderCell
|
|
501
|
-
key={header.id}
|
|
502
|
-
header={header}
|
|
503
|
-
isPinned="right"
|
|
504
|
-
/>
|
|
505
|
-
) : null
|
|
506
|
-
})}
|
|
507
|
-
</tr>
|
|
508
|
-
))}
|
|
509
|
-
</thead>
|
|
510
|
-
{isLoading ? (
|
|
511
|
-
<DataTableLoading />
|
|
512
|
-
) : isError ? (
|
|
513
|
-
<DataTableError message={errorMessage} />
|
|
514
|
-
) : rows.length === 0 ? (
|
|
515
|
-
<DataTableEmpty
|
|
516
|
-
title={emptyStateTitle}
|
|
517
|
-
description={emptyStateDescription}
|
|
518
|
-
/>
|
|
519
|
-
) : (
|
|
520
|
-
<>
|
|
521
|
-
{table.getState().columnSizingInfo.isResizingColumn ? (
|
|
522
|
-
<MemoizedTableBody
|
|
523
|
-
table={table}
|
|
524
|
-
tableContainerRef={tableContainerRef}
|
|
525
|
-
estimatedRowHeight={estimatedRowHeight}
|
|
526
|
-
/>
|
|
527
|
-
) : (
|
|
528
|
-
<TableBody
|
|
529
|
-
table={table}
|
|
530
|
-
tableContainerRef={tableContainerRef}
|
|
531
|
-
estimatedRowHeight={estimatedRowHeight}
|
|
532
|
-
/>
|
|
533
|
-
)}
|
|
534
|
-
</>
|
|
535
|
-
)}
|
|
536
|
-
</table>
|
|
537
|
-
</div>
|
|
538
|
-
|
|
539
|
-
<DataTablePagination
|
|
540
|
-
pageIndex={table.getState().pagination.pageIndex}
|
|
541
|
-
pageSize={table.getState().pagination.pageSize}
|
|
542
|
-
totalRows={table.getRowCount()}
|
|
543
|
-
onPageChange={table.setPageIndex}
|
|
544
|
-
onPageSizeChange={table.setPageSize}
|
|
545
|
-
/>
|
|
546
|
-
|
|
547
|
-
{actionBar && enableRowSelection && (
|
|
548
|
-
<DataTableFloatingBar
|
|
549
|
-
selectedCount={Object.keys(table.getState().rowSelection).length}
|
|
550
|
-
onClearSelection={clearSelection}
|
|
551
|
-
>
|
|
552
|
-
{actionBar?.({ table, clearSelection })}
|
|
553
|
-
</DataTableFloatingBar>
|
|
554
|
-
)}
|
|
555
|
-
</div>
|
|
556
|
-
)
|
|
557
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { Button } from "@eggspot/ui/components/Button"
|
|
2
|
-
import { cn } from "@eggspot/ui/lib/utils"
|
|
3
|
-
import { Column } from "@tanstack/react-table"
|
|
4
|
-
import {
|
|
5
|
-
ArrowDown,
|
|
6
|
-
ArrowUp,
|
|
7
|
-
ArrowUpDown,
|
|
8
|
-
EyeOff,
|
|
9
|
-
Pin,
|
|
10
|
-
PinOff,
|
|
11
|
-
} from "lucide-react"
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
Menu,
|
|
15
|
-
MenuItem,
|
|
16
|
-
MenuPopover,
|
|
17
|
-
MenuSeparator,
|
|
18
|
-
MenuTrigger,
|
|
19
|
-
} from "../Menu"
|
|
20
|
-
|
|
21
|
-
interface DataTableColumnHeaderProps<TData, TValue>
|
|
22
|
-
extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
|
-
column: Column<TData, TValue>
|
|
24
|
-
title: string
|
|
25
|
-
enableSorting?: boolean
|
|
26
|
-
enablePinning?: boolean
|
|
27
|
-
enableHiding?: boolean
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function DataTableColumnHeader<TData, TValue>({
|
|
31
|
-
column,
|
|
32
|
-
title,
|
|
33
|
-
className,
|
|
34
|
-
enableSorting = true,
|
|
35
|
-
enablePinning = true,
|
|
36
|
-
enableHiding = true,
|
|
37
|
-
}: DataTableColumnHeaderProps<TData, TValue>) {
|
|
38
|
-
const isSorted = column.getIsSorted()
|
|
39
|
-
const isPinned = column.getIsPinned()
|
|
40
|
-
|
|
41
|
-
if (!enableSorting && !enablePinning && !enableHiding) {
|
|
42
|
-
return <div className={cn("flex items-center", className)}>{title}</div>
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div className={cn("flex items-center gap-1", className)}>
|
|
47
|
-
<MenuTrigger>
|
|
48
|
-
<Button
|
|
49
|
-
variant="ghost"
|
|
50
|
-
size="sm"
|
|
51
|
-
className={cn(
|
|
52
|
-
"text-gray-11 hover:bg-gray-5! hover:text-gray-12 aria-expanded:bg-gray-5! aria-expanded:text-gray-12 -ml-2 h-8 transition-colors",
|
|
53
|
-
isSorted && "text-gray-12 font-semibold"
|
|
54
|
-
)}
|
|
55
|
-
rightIcon={
|
|
56
|
-
isSorted === "desc" ? (
|
|
57
|
-
<ArrowDown />
|
|
58
|
-
) : isSorted === "asc" ? (
|
|
59
|
-
<ArrowUp />
|
|
60
|
-
) : (
|
|
61
|
-
<ArrowUpDown />
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
>
|
|
65
|
-
{title}
|
|
66
|
-
</Button>
|
|
67
|
-
<MenuPopover>
|
|
68
|
-
<Menu>
|
|
69
|
-
{enableSorting && (
|
|
70
|
-
<>
|
|
71
|
-
<MenuItem onClick={() => column.toggleSorting(false)}>
|
|
72
|
-
<ArrowUp className="text-gray-11 mr-2 h-3.5 w-3.5" />
|
|
73
|
-
Sort ascending
|
|
74
|
-
</MenuItem>
|
|
75
|
-
<MenuItem onClick={() => column.toggleSorting(true)}>
|
|
76
|
-
<ArrowDown className="text-gray-11 mr-2 h-3.5 w-3.5" />
|
|
77
|
-
Sort descending
|
|
78
|
-
</MenuItem>
|
|
79
|
-
{isSorted && (
|
|
80
|
-
<MenuItem onClick={() => column.clearSorting()}>
|
|
81
|
-
<ArrowUpDown className="text-gray-11 mr-2 h-3.5 w-3.5" />
|
|
82
|
-
Clear sorting
|
|
83
|
-
</MenuItem>
|
|
84
|
-
)}
|
|
85
|
-
{(enablePinning || enableHiding) && <MenuSeparator />}
|
|
86
|
-
</>
|
|
87
|
-
)}
|
|
88
|
-
{enablePinning && (
|
|
89
|
-
<>
|
|
90
|
-
{isPinned !== "left" && (
|
|
91
|
-
<MenuItem onClick={() => column.pin("left")}>
|
|
92
|
-
<Pin className="text-gray-11 mr-2 h-3.5 w-3.5 rotate-45" />
|
|
93
|
-
Pin to left
|
|
94
|
-
</MenuItem>
|
|
95
|
-
)}
|
|
96
|
-
{isPinned !== "right" && (
|
|
97
|
-
<MenuItem onClick={() => column.pin("right")}>
|
|
98
|
-
<Pin className="text-gray-11 mr-2 h-3.5 w-3.5 -rotate-45" />
|
|
99
|
-
Pin to right
|
|
100
|
-
</MenuItem>
|
|
101
|
-
)}
|
|
102
|
-
{isPinned && (
|
|
103
|
-
<MenuItem onClick={() => column.pin(false)}>
|
|
104
|
-
<PinOff className="text-gray-11 mr-2 h-3.5 w-3.5" />
|
|
105
|
-
Unpin column
|
|
106
|
-
</MenuItem>
|
|
107
|
-
)}
|
|
108
|
-
{enableHiding && <MenuSeparator />}
|
|
109
|
-
</>
|
|
110
|
-
)}
|
|
111
|
-
{enableHiding && (
|
|
112
|
-
<MenuItem onClick={() => column.toggleVisibility(false)}>
|
|
113
|
-
<EyeOff className="text-gray-11 mr-2 h-3.5 w-3.5" />
|
|
114
|
-
Hide column
|
|
115
|
-
</MenuItem>
|
|
116
|
-
)}
|
|
117
|
-
</Menu>
|
|
118
|
-
</MenuPopover>
|
|
119
|
-
</MenuTrigger>
|
|
120
|
-
</div>
|
|
121
|
-
)
|
|
122
|
-
}
|