@fabio.caffarello/react-design-system 1.7.0 → 1.8.0
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/README.md +48 -3
- package/dist/docs/components/ComponentStatusTable.d.ts +11 -0
- package/dist/ui/atoms/Accordion/Accordion.d.ts +34 -0
- package/dist/ui/atoms/Accordion/Accordion.stories.d.ts +11 -0
- package/dist/ui/atoms/Accordion/Accordion.test.d.ts +1 -0
- package/dist/ui/atoms/Accordion/index.d.ts +2 -0
- package/dist/ui/atoms/Avatar/Avatar.d.ts +30 -0
- package/dist/ui/atoms/Avatar/Avatar.stories.d.ts +13 -0
- package/dist/ui/atoms/Avatar/Avatar.test.d.ts +1 -0
- package/dist/ui/atoms/Avatar/AvatarGroup.d.ts +26 -0
- package/dist/ui/atoms/Avatar/index.d.ts +9 -0
- package/dist/ui/atoms/Badge/Badge.d.ts +14 -6
- package/dist/ui/atoms/Badge/Badge.stories.d.ts +8 -9
- package/dist/ui/atoms/BoxWrapper/BoxWrapper.d.ts +3 -3
- package/dist/ui/atoms/BoxWrapper/BoxWrapper.test.d.ts +1 -0
- package/dist/ui/atoms/Button/Button.d.ts +32 -10
- package/dist/ui/atoms/Button/Button.stories.d.ts +7 -0
- package/dist/ui/atoms/Button/Button.test.d.ts +1 -0
- package/dist/ui/atoms/Checkbox/Checkbox.d.ts +2 -1
- package/dist/ui/atoms/Collapsible/Collapsible.stories.d.ts +2 -0
- package/dist/ui/atoms/Info/Info.d.ts +2 -3
- package/dist/ui/atoms/Info/Info.test.d.ts +1 -0
- package/dist/ui/atoms/Input/Input.d.ts +14 -4
- package/dist/ui/atoms/Input/Input.stories.d.ts +6 -0
- package/dist/ui/atoms/Popover/Popover.d.ts +35 -0
- package/dist/ui/atoms/Popover/Popover.stories.d.ts +11 -0
- package/dist/ui/atoms/Popover/Popover.test.d.ts +1 -0
- package/dist/ui/atoms/Popover/index.d.ts +2 -0
- package/dist/ui/atoms/Progress/Progress.d.ts +33 -0
- package/dist/ui/atoms/Progress/Progress.stories.d.ts +12 -0
- package/dist/ui/atoms/Progress/Progress.test.d.ts +1 -0
- package/dist/ui/atoms/Select/Select.d.ts +18 -6
- package/dist/ui/atoms/Select/Select.stories.d.ts +11 -8
- package/dist/ui/atoms/Separator/Separator.d.ts +23 -0
- package/dist/ui/atoms/Separator/Separator.stories.d.ts +10 -0
- package/dist/ui/atoms/Separator/Separator.test.d.ts +1 -0
- package/dist/ui/atoms/Separator/index.d.ts +2 -0
- package/dist/ui/atoms/Skeleton/Skeleton.d.ts +1 -1
- package/dist/ui/atoms/Skeleton/Skeleton.stories.d.ts +24 -0
- package/dist/ui/atoms/Slider/Slider.d.ts +45 -0
- package/dist/ui/atoms/Slider/Slider.stories.d.ts +13 -0
- package/dist/ui/atoms/Slider/Slider.test.d.ts +1 -0
- package/dist/ui/atoms/Slider/index.d.ts +2 -0
- package/dist/ui/atoms/Spinner/Spinner.d.ts +22 -0
- package/dist/ui/atoms/Spinner/Spinner.stories.d.ts +9 -0
- package/dist/ui/atoms/Spinner/Spinner.test.d.ts +1 -0
- package/dist/ui/atoms/Switch/Switch.d.ts +28 -0
- package/dist/ui/atoms/Switch/Switch.stories.d.ts +11 -0
- package/dist/ui/atoms/Switch/Switch.test.d.ts +1 -0
- package/dist/ui/atoms/Switch/index.d.ts +2 -0
- package/dist/ui/atoms/Tooltip/Tooltip.d.ts +2 -1
- package/dist/ui/atoms/Tooltip/Tooltip.stories.d.ts +17 -0
- package/dist/ui/atoms/index.d.ts +20 -3
- package/dist/ui/index.d.ts +6 -1
- package/dist/ui/molecules/Card/Card.d.ts +6 -2
- package/dist/ui/molecules/Card/Card.stories.d.ts +2 -0
- package/dist/ui/molecules/ColorPicker/ColorPicker.d.ts +28 -0
- package/dist/ui/molecules/ColorPicker/ColorPicker.stories.d.ts +12 -0
- package/dist/ui/molecules/ColorPicker/ColorPicker.test.d.ts +1 -0
- package/dist/ui/molecules/ColorPicker/index.d.ts +2 -0
- package/dist/ui/molecules/DatePicker/DatePicker.d.ts +74 -0
- package/dist/ui/molecules/DatePicker/DatePicker.stories.d.ts +12 -0
- package/dist/ui/molecules/DatePicker/DatePicker.test.d.ts +1 -0
- package/dist/ui/molecules/DatePicker/DatePickerCalendar.d.ts +6 -0
- package/dist/ui/molecules/DatePicker/DatePickerContext.d.ts +28 -0
- package/dist/ui/molecules/DatePicker/DatePickerInput.d.ts +9 -0
- package/dist/ui/molecules/DatePicker/DatePickerProvider.d.ts +23 -0
- package/dist/ui/molecules/DatePicker/index.d.ts +14 -0
- package/dist/ui/molecules/Dropdown/Dropdown.d.ts +2 -1
- package/dist/ui/molecules/Dropdown/Dropdown.stories.d.ts +13 -0
- package/dist/ui/molecules/EmptyState/EmptyState.stories.d.ts +22 -0
- package/dist/ui/molecules/FileUpload/FileUpload.d.ts +37 -0
- package/dist/ui/molecules/FileUpload/FileUpload.stories.d.ts +12 -0
- package/dist/ui/molecules/FileUpload/FileUpload.test.d.ts +1 -0
- package/dist/ui/molecules/FileUpload/index.d.ts +2 -0
- package/dist/ui/molecules/Form/Form.d.ts +29 -4
- package/dist/ui/molecules/Form/Form.stories.d.ts +2 -0
- package/dist/ui/molecules/Form/FormContext.d.ts +17 -0
- package/dist/ui/molecules/Form/FormField.d.ts +36 -0
- package/dist/ui/molecules/Form/FormProvider.d.ts +14 -0
- package/dist/ui/molecules/Form/index.d.ts +13 -0
- package/dist/ui/molecules/Form/useFormFieldArray.d.ts +28 -0
- package/dist/ui/molecules/InputWithLabel/InputWithLabel.test.d.ts +1 -0
- package/dist/ui/molecules/Rating/Rating.d.ts +33 -0
- package/dist/ui/molecules/Rating/Rating.stories.d.ts +13 -0
- package/dist/ui/molecules/Rating/Rating.test.d.ts +1 -0
- package/dist/ui/molecules/Rating/index.d.ts +2 -0
- package/dist/ui/molecules/SearchInput/SearchInput.d.ts +24 -0
- package/dist/ui/molecules/SearchInput/SearchInput.stories.d.ts +10 -0
- package/dist/ui/molecules/SearchInput/SearchInput.test.d.ts +1 -0
- package/dist/ui/molecules/SearchInput/index.d.ts +2 -0
- package/dist/ui/molecules/SidebarHeader/SidebarHeader.test.d.ts +1 -0
- package/dist/ui/molecules/TableActions/TableActions.d.ts +31 -0
- package/dist/ui/molecules/TableActions/TableActions.stories.d.ts +7 -0
- package/dist/ui/molecules/TableActions/TableActions.test.d.ts +1 -0
- package/dist/ui/molecules/TableFilters/TableFilters.d.ts +37 -0
- package/dist/ui/molecules/TableFilters/TableFilters.stories.d.ts +7 -0
- package/dist/ui/molecules/TableFilters/TableFilters.test.d.ts +1 -0
- package/dist/ui/molecules/TablePagination/TablePagination.d.ts +29 -0
- package/dist/ui/molecules/TablePagination/TablePagination.stories.d.ts +8 -0
- package/dist/ui/molecules/TablePagination/TablePagination.test.d.ts +1 -0
- package/dist/ui/molecules/Tabs/Tabs.d.ts +15 -0
- package/dist/ui/molecules/Tabs/Tabs.stories.d.ts +10 -0
- package/dist/ui/molecules/Tabs/Tabs.test.d.ts +1 -0
- package/dist/ui/molecules/Tabs/TabsContent.d.ts +14 -0
- package/dist/ui/molecules/Tabs/TabsContext.d.ts +18 -0
- package/dist/ui/molecules/Tabs/TabsList.d.ts +12 -0
- package/dist/ui/molecules/Tabs/TabsProvider.d.ts +16 -0
- package/dist/ui/molecules/Tabs/TabsTrigger.d.ts +13 -0
- package/dist/ui/molecules/Tabs/index.d.ts +17 -0
- package/dist/ui/molecules/TimePicker/TimePicker.d.ts +29 -0
- package/dist/ui/molecules/TimePicker/TimePicker.stories.d.ts +12 -0
- package/dist/ui/molecules/TimePicker/TimePicker.test.d.ts +1 -0
- package/dist/ui/molecules/TimePicker/index.d.ts +2 -0
- package/dist/ui/molecules/index.d.ts +13 -5
- package/dist/ui/organisms/CommandPalette/CommandPalette.d.ts +37 -0
- package/dist/ui/organisms/CommandPalette/CommandPalette.stories.d.ts +11 -0
- package/dist/ui/organisms/CommandPalette/CommandPalette.test.d.ts +1 -0
- package/dist/ui/organisms/CommandPalette/index.d.ts +2 -0
- package/dist/ui/organisms/DataGrid/DataGrid.d.ts +84 -0
- package/dist/ui/organisms/DataGrid/DataGrid.stories.d.ts +14 -0
- package/dist/ui/organisms/DataGrid/DataGrid.test.d.ts +1 -0
- package/dist/ui/organisms/DataGrid/index.d.ts +2 -0
- package/dist/ui/organisms/Dialog/AlertDialog.d.ts +34 -0
- package/dist/ui/organisms/Dialog/Dialog.d.ts +58 -0
- package/dist/ui/organisms/Dialog/Dialog.stories.d.ts +13 -0
- package/dist/ui/organisms/Dialog/Dialog.test.d.ts +1 -0
- package/dist/ui/organisms/Dialog/DialogClose.d.ts +8 -0
- package/dist/ui/organisms/Dialog/DialogContent.d.ts +8 -0
- package/dist/ui/organisms/Dialog/DialogContext.d.ts +10 -0
- package/dist/ui/organisms/Dialog/DialogDescription.d.ts +4 -0
- package/dist/ui/organisms/Dialog/DialogFooter.d.ts +5 -0
- package/dist/ui/organisms/Dialog/DialogHeader.d.ts +5 -0
- package/dist/ui/organisms/Dialog/DialogProvider.d.ts +10 -0
- package/dist/ui/organisms/Dialog/DialogTitle.d.ts +5 -0
- package/dist/ui/organisms/Dialog/DialogTrigger.d.ts +6 -0
- package/dist/ui/organisms/Dialog/index.d.ts +22 -0
- package/dist/ui/organisms/Sidebar/Sidebar.d.ts +7 -4
- package/dist/ui/organisms/Sidebar/SidebarGroup/SidebarGroup.d.ts +27 -0
- package/dist/ui/organisms/Sidebar/SidebarGroup/SidebarGroup.stories.d.ts +11 -0
- package/dist/ui/organisms/Sidebar/SidebarGroup/SidebarGroup.test.d.ts +1 -0
- package/dist/ui/organisms/Sidebar/SidebarHeader/SidebarHeader.d.ts +19 -0
- package/dist/ui/organisms/Sidebar/SidebarHeader/SidebarHeader.test.d.ts +1 -0
- package/dist/ui/organisms/Sidebar/SidebarItem/SidebarItem.d.ts +23 -0
- package/dist/ui/organisms/Sidebar/SidebarItem/SidebarItem.stories.d.ts +10 -0
- package/dist/ui/organisms/Sidebar/SidebarItem/SidebarItem.test.d.ts +1 -0
- package/dist/ui/organisms/Sidebar/index.d.ts +8 -0
- package/dist/ui/organisms/Stepper/Stepper.d.ts +40 -0
- package/dist/ui/organisms/Stepper/Stepper.stories.d.ts +12 -0
- package/dist/ui/organisms/Stepper/Stepper.test.d.ts +1 -0
- package/dist/ui/organisms/Stepper/index.d.ts +2 -0
- package/dist/ui/organisms/Table/Table.d.ts +84 -16
- package/dist/ui/organisms/Table/Table.stories.d.ts +15 -0
- package/dist/ui/organisms/Table/TableActions/TableActions.d.ts +31 -0
- package/dist/ui/organisms/Table/TableActions/TableActions.stories.d.ts +7 -0
- package/dist/ui/organisms/Table/TableActions/TableActions.test.d.ts +1 -0
- package/dist/ui/organisms/Table/TableActions.d.ts +13 -0
- package/dist/ui/organisms/Table/TableBody.d.ts +12 -0
- package/dist/ui/organisms/Table/TableCell.d.ts +14 -0
- package/dist/ui/organisms/Table/TableContext.d.ts +75 -0
- package/dist/ui/organisms/Table/TableEmptyState.d.ts +11 -0
- package/dist/ui/organisms/Table/TableFilters/TableFilters.d.ts +37 -0
- package/dist/ui/organisms/Table/TableFilters/TableFilters.stories.d.ts +7 -0
- package/dist/ui/organisms/Table/TableFilters/TableFilters.test.d.ts +1 -0
- package/dist/ui/organisms/Table/TableFilters.d.ts +12 -0
- package/dist/ui/organisms/Table/TableHeader.d.ts +10 -0
- package/dist/ui/organisms/Table/TableHeaderCell.d.ts +18 -0
- package/dist/ui/organisms/Table/TableHeaderRow.d.ts +10 -0
- package/dist/ui/organisms/Table/TablePagination/TablePagination.d.ts +29 -0
- package/dist/ui/organisms/Table/TablePagination/TablePagination.stories.d.ts +8 -0
- package/dist/ui/organisms/Table/TablePagination/TablePagination.test.d.ts +1 -0
- package/dist/ui/organisms/Table/TablePagination.d.ts +14 -0
- package/dist/ui/organisms/Table/TableProvider.d.ts +55 -0
- package/dist/ui/organisms/Table/TableRow.d.ts +14 -0
- package/dist/ui/organisms/Table/TableTypes.d.ts +8 -0
- package/dist/ui/organisms/Table/index.d.ts +30 -0
- package/dist/ui/organisms/Table/useColumnResizing.d.ts +39 -0
- package/dist/ui/organisms/Table/useVirtualScrolling.d.ts +35 -0
- package/dist/ui/organisms/Timeline/Timeline.d.ts +34 -0
- package/dist/ui/organisms/Timeline/Timeline.stories.d.ts +12 -0
- package/dist/ui/organisms/Timeline/Timeline.test.d.ts +1 -0
- package/dist/ui/organisms/Timeline/index.d.ts +2 -0
- package/dist/ui/organisms/Toast/Toast.d.ts +8 -0
- package/dist/ui/organisms/Toast/Toast.stories.d.ts +14 -0
- package/dist/ui/organisms/Toast/Toast.test.d.ts +1 -0
- package/dist/ui/organisms/Toast/ToastContainer.d.ts +5 -0
- package/dist/ui/organisms/Toast/ToastContext.d.ts +21 -0
- package/dist/ui/organisms/Toast/ToastProvider.d.ts +7 -0
- package/dist/ui/organisms/Toast/index.d.ts +15 -0
- package/dist/ui/organisms/Toast/useToast.d.ts +35 -0
- package/dist/ui/organisms/index.d.ts +12 -2
- package/dist/ui/providers/AdvancedThemeProvider.d.ts +52 -0
- package/dist/ui/providers/index.d.ts +9 -0
- package/dist/ui/themes/ThemeBuilder.d.ts +28 -0
- package/dist/ui/themes/ThemeRegistry.d.ts +55 -0
- package/dist/ui/themes/index.d.ts +9 -0
- package/dist/ui/themes/types.d.ts +48 -0
- package/dist/ui/themes/utils.d.ts +21 -0
- package/dist/ui/tokens/TokenVisualizations.d.ts +41 -0
- package/dist/ui/tokens/animations.d.ts +65 -0
- package/dist/ui/tokens/borders.d.ts +61 -0
- package/dist/ui/tokens/gradients.d.ts +55 -0
- package/dist/ui/tokens/index.d.ts +31 -0
- package/dist/ui/tokens/opacity.d.ts +51 -0
- package/dist/ui/tokens/radius.d.ts +45 -0
- package/dist/ui/tokens/shadows.d.ts +42 -0
- package/dist/ui/tokens/themes/dark.d.ts +26 -26
- package/dist/ui/tokens/themes/light.d.ts +26 -26
- package/dist/ui/tokens/tokens.factory.d.ts +42 -0
- package/dist/ui/tokens/z-index.d.ts +44 -0
- package/dist/ui/utils/index.d.ts +6 -0
- package/package.json +50 -6
- package/src/docs/Accessibility.mdx +402 -0
- package/src/docs/BestPractices.mdx +315 -0
- package/src/docs/ComponentComposition.mdx +381 -0
- package/src/docs/ComponentStatus.mdx +177 -0
- package/src/docs/DesignSystem.mdx +121 -0
- package/src/docs/GettingStarted.mdx +284 -0
- package/src/docs/MigrationGuide.mdx +297 -0
- package/src/docs/Performance.mdx +206 -0
- package/src/docs/components/ComponentStatusTable.tsx +184 -0
- package/src/setupTests.ts +32 -0
- package/src/ui/atoms/Accordion/Accordion.stories.tsx +147 -0
- package/src/ui/atoms/Accordion/Accordion.test.tsx +86 -0
- package/src/ui/atoms/Accordion/Accordion.tsx +147 -0
- package/src/ui/atoms/Accordion/index.ts +2 -0
- package/src/ui/atoms/Avatar/Avatar.stories.tsx +226 -0
- package/src/ui/atoms/Avatar/Avatar.test.tsx +233 -0
- package/src/ui/atoms/Avatar/Avatar.tsx +128 -0
- package/src/ui/atoms/Avatar/AvatarGroup.tsx +96 -0
- package/src/ui/atoms/Avatar/index.ts +11 -0
- package/src/ui/atoms/Badge/Badge.stories.tsx +65 -56
- package/src/ui/atoms/Badge/Badge.test.tsx +27 -50
- package/src/ui/atoms/Badge/Badge.tsx +70 -27
- package/src/ui/atoms/BoxWrapper/BoxWrapper.stories.tsx +1 -1
- package/src/ui/atoms/BoxWrapper/BoxWrapper.test.tsx +27 -0
- package/src/ui/atoms/BoxWrapper/BoxWrapper.tsx +5 -2
- package/src/ui/atoms/Button/Button.stories.tsx +130 -1
- package/src/ui/atoms/Button/Button.test.tsx +233 -0
- package/src/ui/atoms/Button/Button.tsx +160 -53
- package/src/ui/atoms/Checkbox/Checkbox.tsx +14 -1
- package/src/ui/atoms/Collapsible/Collapsible.stories.tsx +47 -1
- package/src/ui/atoms/Collapsible/Collapsible.test.tsx +36 -24
- package/src/ui/atoms/Collapsible/Collapsible.tsx +9 -1
- package/src/ui/atoms/ErrorMessage/ErrorMessage.stories.tsx +1 -1
- package/src/ui/atoms/Info/Info.stories.tsx +1 -1
- package/src/ui/atoms/Info/Info.test.tsx +45 -0
- package/src/ui/atoms/Info/Info.tsx +2 -2
- package/src/ui/atoms/Input/Input.stories.tsx +80 -0
- package/src/ui/atoms/Input/Input.test.tsx +190 -36
- package/src/ui/atoms/Input/Input.tsx +144 -25
- package/src/ui/atoms/Label/Label.stories.tsx +1 -1
- package/src/ui/atoms/NavLink/NavLink.stories.tsx +1 -1
- package/src/ui/atoms/Popover/Popover.stories.tsx +157 -0
- package/src/ui/atoms/Popover/Popover.test.tsx +80 -0
- package/src/ui/atoms/Popover/Popover.tsx +256 -0
- package/src/ui/atoms/Popover/index.ts +2 -0
- package/src/ui/atoms/Progress/Progress.css +17 -0
- package/src/ui/atoms/Progress/Progress.stories.tsx +170 -0
- package/src/ui/atoms/Progress/Progress.test.tsx +134 -0
- package/src/ui/atoms/Progress/Progress.tsx +138 -0
- package/src/ui/atoms/Radio/Radio.tsx +1 -1
- package/src/ui/atoms/Select/Select.stories.tsx +93 -58
- package/src/ui/atoms/Select/Select.test.tsx +162 -46
- package/src/ui/atoms/Select/Select.tsx +142 -44
- package/src/ui/atoms/Separator/Separator.stories.tsx +88 -0
- package/src/ui/atoms/Separator/Separator.test.tsx +34 -0
- package/src/ui/atoms/Separator/Separator.tsx +81 -0
- package/src/ui/atoms/Separator/index.ts +2 -0
- package/src/ui/atoms/Skeleton/Skeleton.stories.tsx +62 -0
- package/src/ui/atoms/Skeleton/Skeleton.tsx +19 -2
- package/src/ui/atoms/Slider/Slider.stories.tsx +205 -0
- package/src/ui/atoms/Slider/Slider.test.tsx +53 -0
- package/src/ui/atoms/Slider/Slider.tsx +307 -0
- package/src/ui/atoms/Slider/index.ts +2 -0
- package/src/ui/atoms/Spinner/Spinner.stories.tsx +56 -0
- package/src/ui/atoms/Spinner/Spinner.test.tsx +35 -0
- package/src/ui/atoms/Spinner/Spinner.tsx +88 -0
- package/src/ui/atoms/Switch/Switch.stories.tsx +182 -0
- package/src/ui/atoms/Switch/Switch.test.tsx +90 -0
- package/src/ui/atoms/Switch/Switch.tsx +181 -0
- package/src/ui/atoms/Switch/index.ts +2 -0
- package/src/ui/atoms/Text/Text.stories.tsx +1 -1
- package/src/ui/atoms/Text/Text.test.tsx +48 -32
- package/src/ui/atoms/Textarea/Textarea.stories.tsx +1 -1
- package/src/ui/atoms/Tooltip/Tooltip.stories.tsx +44 -0
- package/src/ui/atoms/Tooltip/Tooltip.tsx +94 -6
- package/src/ui/atoms/index.ts +27 -4
- package/src/ui/index.ts +6 -1
- package/src/ui/molecules/Breadcrumb/Breadcrumb.stories.tsx +1 -1
- package/src/ui/molecules/Breadcrumb/Breadcrumb.tsx +1 -1
- package/src/ui/molecules/Card/Card.stories.tsx +49 -1
- package/src/ui/molecules/Card/Card.tsx +40 -5
- package/src/ui/molecules/ColorPicker/ColorPicker.stories.tsx +156 -0
- package/src/ui/molecules/ColorPicker/ColorPicker.test.tsx +47 -0
- package/src/ui/molecules/ColorPicker/ColorPicker.tsx +271 -0
- package/src/ui/molecules/ColorPicker/index.ts +2 -0
- package/src/ui/molecules/DatePicker/DatePicker.mdx +150 -0
- package/src/ui/molecules/DatePicker/DatePicker.stories.tsx +188 -0
- package/src/ui/molecules/DatePicker/DatePicker.test.tsx +381 -0
- package/src/ui/molecules/DatePicker/DatePicker.tsx +231 -0
- package/src/ui/molecules/DatePicker/DatePickerCalendar.tsx +277 -0
- package/src/ui/molecules/DatePicker/DatePickerContext.tsx +39 -0
- package/src/ui/molecules/DatePicker/DatePickerInput.tsx +147 -0
- package/src/ui/molecules/DatePicker/DatePickerProvider.tsx +100 -0
- package/src/ui/molecules/DatePicker/index.ts +16 -0
- package/src/ui/molecules/Dropdown/Dropdown.stories.tsx +50 -8
- package/src/ui/molecules/Dropdown/Dropdown.test.tsx +272 -12
- package/src/ui/molecules/Dropdown/Dropdown.tsx +176 -10
- package/src/ui/molecules/EmptyState/EmptyState.stories.tsx +24 -2
- package/src/ui/molecules/EmptyState/EmptyState.tsx +9 -3
- package/src/ui/molecules/FileUpload/FileUpload.stories.tsx +177 -0
- package/src/ui/molecules/FileUpload/FileUpload.test.tsx +114 -0
- package/src/ui/molecules/FileUpload/FileUpload.tsx +312 -0
- package/src/ui/molecules/FileUpload/index.ts +2 -0
- package/src/ui/molecules/Form/Form.mdx +145 -0
- package/src/ui/molecules/Form/Form.stories.tsx +121 -1
- package/src/ui/molecules/Form/Form.test.tsx +1 -3
- package/src/ui/molecules/Form/Form.tsx +95 -15
- package/src/ui/molecules/Form/FormContext.tsx +35 -0
- package/src/ui/molecules/Form/FormField.tsx +83 -0
- package/src/ui/molecules/Form/FormProvider.tsx +34 -0
- package/src/ui/molecules/Form/index.ts +21 -0
- package/src/ui/molecules/Form/useFormFieldArray.ts +46 -0
- package/src/ui/molecules/InputWithLabel/InputWithLabel.stories.tsx +1 -1
- package/src/ui/molecules/InputWithLabel/InputWithLabel.test.tsx +44 -0
- package/src/ui/molecules/InputWithLabel/InputWithLabel.tsx +3 -1
- package/src/ui/molecules/NavbarGroup/NavbarGroup.stories.tsx +1 -1
- package/src/ui/molecules/Pagination/Pagination.stories.tsx +1 -1
- package/src/ui/molecules/Rating/Rating.stories.tsx +206 -0
- package/src/ui/molecules/Rating/Rating.test.tsx +60 -0
- package/src/ui/molecules/Rating/Rating.tsx +173 -0
- package/src/ui/molecules/Rating/index.ts +2 -0
- package/src/ui/molecules/SearchInput/SearchInput.stories.tsx +146 -0
- package/src/ui/molecules/SearchInput/SearchInput.test.tsx +82 -0
- package/src/ui/molecules/SearchInput/SearchInput.tsx +133 -0
- package/src/ui/molecules/SearchInput/index.ts +2 -0
- package/src/ui/molecules/Tabs/Tabs.stories.tsx +229 -0
- package/src/ui/molecules/Tabs/Tabs.test.tsx +497 -0
- package/src/ui/molecules/Tabs/Tabs.tsx +58 -0
- package/src/ui/molecules/Tabs/TabsContent.tsx +50 -0
- package/src/ui/molecules/Tabs/TabsContext.tsx +36 -0
- package/src/ui/molecules/Tabs/TabsList.tsx +98 -0
- package/src/ui/molecules/Tabs/TabsProvider.tsx +53 -0
- package/src/ui/molecules/Tabs/TabsTrigger.tsx +111 -0
- package/src/ui/molecules/Tabs/index.ts +23 -0
- package/src/ui/molecules/TimePicker/TimePicker.stories.tsx +145 -0
- package/src/ui/molecules/TimePicker/TimePicker.test.tsx +41 -0
- package/src/ui/molecules/TimePicker/TimePicker.tsx +264 -0
- package/src/ui/molecules/TimePicker/index.ts +2 -0
- package/src/ui/molecules/index.ts +20 -7
- package/src/ui/organisms/CommandPalette/CommandPalette.stories.tsx +218 -0
- package/src/ui/organisms/CommandPalette/CommandPalette.test.tsx +85 -0
- package/src/ui/organisms/CommandPalette/CommandPalette.tsx +333 -0
- package/src/ui/organisms/CommandPalette/index.ts +2 -0
- package/src/ui/organisms/DataGrid/DataGrid.stories.tsx +196 -0
- package/src/ui/organisms/DataGrid/DataGrid.test.tsx +53 -0
- package/src/ui/organisms/DataGrid/DataGrid.tsx +294 -0
- package/src/ui/organisms/DataGrid/index.ts +2 -0
- package/src/ui/organisms/Dialog/AlertDialog.tsx +92 -0
- package/src/ui/organisms/Dialog/Dialog.mdx +200 -0
- package/src/ui/organisms/Dialog/Dialog.stories.tsx +226 -0
- package/src/ui/organisms/Dialog/Dialog.test.tsx +435 -0
- package/src/ui/organisms/Dialog/Dialog.tsx +79 -0
- package/src/ui/organisms/Dialog/DialogClose.tsx +45 -0
- package/src/ui/organisms/Dialog/DialogContent.tsx +149 -0
- package/src/ui/organisms/Dialog/DialogContext.tsx +25 -0
- package/src/ui/organisms/Dialog/DialogDescription.tsx +28 -0
- package/src/ui/organisms/Dialog/DialogFooter.tsx +18 -0
- package/src/ui/organisms/Dialog/DialogHeader.tsx +18 -0
- package/src/ui/organisms/Dialog/DialogProvider.tsx +73 -0
- package/src/ui/organisms/Dialog/DialogTitle.tsx +31 -0
- package/src/ui/organisms/Dialog/DialogTrigger.tsx +34 -0
- package/src/ui/organisms/Dialog/index.ts +24 -0
- package/src/ui/organisms/LoginBox/LoginBox.stories.tsx +1 -1
- package/src/ui/organisms/Modal/Modal.stories.tsx +2 -2
- package/src/ui/organisms/Modal/Modal.test.tsx +1 -1
- package/src/ui/organisms/Sidebar/Sidebar.stories.tsx +1 -1
- package/src/ui/organisms/Sidebar/Sidebar.test.tsx +5 -3
- package/src/ui/organisms/Sidebar/Sidebar.tsx +21 -6
- package/src/ui/{molecules → organisms/Sidebar}/SidebarGroup/SidebarGroup.stories.tsx +2 -2
- package/src/ui/{molecules → organisms/Sidebar}/SidebarGroup/SidebarGroup.test.tsx +32 -9
- package/src/ui/{molecules → organisms/Sidebar}/SidebarGroup/SidebarGroup.tsx +7 -7
- package/src/ui/organisms/Sidebar/SidebarHeader/SidebarHeader.test.tsx +66 -0
- package/src/ui/{molecules → organisms/Sidebar}/SidebarHeader/SidebarHeader.tsx +1 -2
- package/src/ui/{atoms → organisms/Sidebar}/SidebarItem/SidebarItem.stories.tsx +1 -1
- package/src/ui/{atoms → organisms/Sidebar}/SidebarItem/SidebarItem.test.tsx +9 -8
- package/src/ui/{atoms → organisms/Sidebar}/SidebarItem/SidebarItem.tsx +9 -3
- package/src/ui/organisms/Sidebar/index.ts +13 -0
- package/src/ui/organisms/Stepper/Stepper.stories.tsx +253 -0
- package/src/ui/organisms/Stepper/Stepper.test.tsx +76 -0
- package/src/ui/organisms/Stepper/Stepper.tsx +323 -0
- package/src/ui/organisms/Stepper/index.ts +2 -0
- package/src/ui/organisms/Table/Table.mdx +154 -0
- package/src/ui/organisms/Table/Table.stories.tsx +614 -4
- package/src/ui/organisms/Table/Table.test.tsx +86 -4
- package/src/ui/organisms/Table/Table.tsx +215 -99
- package/src/ui/organisms/Table/TableActions/TableActions.stories.tsx +88 -0
- package/src/ui/organisms/Table/TableActions/TableActions.test.tsx +64 -0
- package/src/ui/organisms/Table/TableActions/TableActions.tsx +71 -0
- package/src/ui/organisms/Table/TableActions.tsx +46 -0
- package/src/ui/organisms/Table/TableBody.tsx +137 -0
- package/src/ui/organisms/Table/TableCell.tsx +36 -0
- package/src/ui/organisms/Table/TableContext.tsx +111 -0
- package/src/ui/organisms/Table/TableEmptyState.tsx +51 -0
- package/src/ui/organisms/Table/TableFilters/TableFilters.stories.tsx +111 -0
- package/src/ui/organisms/Table/TableFilters/TableFilters.test.tsx +104 -0
- package/src/ui/organisms/Table/TableFilters/TableFilters.tsx +191 -0
- package/src/ui/organisms/Table/TableFilters.tsx +39 -0
- package/src/ui/organisms/Table/TableHeader.tsx +29 -0
- package/src/ui/organisms/Table/TableHeaderCell.tsx +142 -0
- package/src/ui/organisms/Table/TableHeaderRow.tsx +72 -0
- package/src/ui/organisms/Table/TablePagination/TablePagination.stories.tsx +87 -0
- package/src/ui/organisms/Table/TablePagination/TablePagination.test.tsx +90 -0
- package/src/ui/organisms/Table/TablePagination/TablePagination.tsx +207 -0
- package/src/ui/organisms/Table/TablePagination.tsx +48 -0
- package/src/ui/organisms/Table/TableProvider.tsx +429 -0
- package/src/ui/organisms/Table/TableRow.tsx +85 -0
- package/src/ui/organisms/Table/TableTypes.ts +11 -0
- package/src/ui/organisms/Table/index.ts +55 -0
- package/src/ui/organisms/Table/useColumnResizing.ts +134 -0
- package/src/ui/organisms/Table/useVirtualScrolling.ts +116 -0
- package/src/ui/organisms/Timeline/Timeline.stories.tsx +230 -0
- package/src/ui/organisms/Timeline/Timeline.test.tsx +47 -0
- package/src/ui/organisms/Timeline/Timeline.tsx +179 -0
- package/src/ui/organisms/Timeline/index.ts +2 -0
- package/src/ui/organisms/Toast/Toast.stories.tsx +169 -0
- package/src/ui/organisms/Toast/Toast.test.tsx +537 -0
- package/src/ui/organisms/Toast/Toast.tsx +144 -0
- package/src/ui/organisms/Toast/ToastContainer.tsx +54 -0
- package/src/ui/organisms/Toast/ToastContext.tsx +38 -0
- package/src/ui/organisms/Toast/ToastProvider.tsx +56 -0
- package/src/ui/organisms/Toast/index.ts +17 -0
- package/src/ui/organisms/Toast/useToast.ts +70 -0
- package/src/ui/organisms/index.ts +17 -2
- package/src/ui/providers/AdvancedThemeProvider.tsx +229 -0
- package/src/ui/providers/index.ts +14 -0
- package/src/ui/themes/README.md +281 -0
- package/src/ui/themes/ThemeBuilder.ts +149 -0
- package/src/ui/themes/ThemeRegistry.ts +187 -0
- package/src/ui/themes/index.ts +20 -0
- package/src/ui/themes/types.ts +53 -0
- package/src/ui/themes/utils.ts +70 -0
- package/src/ui/tokens/README.md +212 -0
- package/src/ui/tokens/TokenVisualizations.tsx +273 -0
- package/src/ui/tokens/Tokens.mdx +348 -0
- package/src/ui/tokens/animations.ts +157 -0
- package/src/ui/tokens/borders.ts +121 -0
- package/src/ui/tokens/gradients.ts +154 -0
- package/src/ui/tokens/index.ts +57 -0
- package/src/ui/tokens/opacity.ts +107 -0
- package/src/ui/tokens/radius.ts +107 -0
- package/src/ui/tokens/shadows.ts +92 -0
- package/src/ui/tokens/tokens.factory.ts +124 -0
- package/src/ui/tokens/z-index.ts +113 -0
- package/src/ui/utils/index.ts +10 -0
- package/src/App.css +0 -42
- package/src/App.tsx +0 -35
- package/src/index.css +0 -68
- package/src/main.tsx +0 -15
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState, useMemo, type ReactNode } from 'react';
|
|
4
|
+
import { Download, ArrowUpDown } from 'lucide-react';
|
|
5
|
+
import Table, { type TableColumn } from '../Table/Table';
|
|
6
|
+
import Button from '../../atoms/Button/Button';
|
|
7
|
+
import { getSpacingClass } from '../../tokens/spacing';
|
|
8
|
+
import type { TableAction } from '../Table/TableActions/TableActions';
|
|
9
|
+
|
|
10
|
+
export type DataGridColumn<T = unknown> = TableColumn<T> & {
|
|
11
|
+
groupable?: boolean;
|
|
12
|
+
exportable?: boolean;
|
|
13
|
+
defaultWidth?: number;
|
|
14
|
+
minWidth?: number;
|
|
15
|
+
maxWidth?: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export interface DataGridGroup {
|
|
19
|
+
column: string;
|
|
20
|
+
expanded?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface DataGridProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
24
|
+
columns: DataGridColumn<T>[];
|
|
25
|
+
data: T[];
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
|
|
28
|
+
// Sorting
|
|
29
|
+
onSort?: (columnKey: string, direction: 'asc' | 'desc') => void;
|
|
30
|
+
sortColumn?: string;
|
|
31
|
+
sortDirection?: 'asc' | 'desc';
|
|
32
|
+
multiSort?: boolean;
|
|
33
|
+
|
|
34
|
+
// Grouping
|
|
35
|
+
groups?: DataGridGroup[];
|
|
36
|
+
onGroupChange?: (groups: DataGridGroup[]) => void;
|
|
37
|
+
groupable?: boolean;
|
|
38
|
+
|
|
39
|
+
// Column Management
|
|
40
|
+
resizable?: boolean;
|
|
41
|
+
reorderable?: boolean;
|
|
42
|
+
onColumnReorder?: (columns: DataGridColumn<T>[]) => void;
|
|
43
|
+
columnWidths?: Record<string, number>;
|
|
44
|
+
onColumnResize?: (columnKey: string, width: number) => void;
|
|
45
|
+
|
|
46
|
+
// Selection
|
|
47
|
+
selectable?: boolean;
|
|
48
|
+
selectedRows?: string[];
|
|
49
|
+
onSelectionChange?: (selected: string[]) => void;
|
|
50
|
+
rowId?: (row: T) => string;
|
|
51
|
+
|
|
52
|
+
// Export
|
|
53
|
+
exportable?: boolean;
|
|
54
|
+
onExport?: (format: 'csv' | 'xlsx' | 'json') => void;
|
|
55
|
+
exportFormats?: ('csv' | 'xlsx' | 'json')[];
|
|
56
|
+
|
|
57
|
+
// Pagination
|
|
58
|
+
pagination?: {
|
|
59
|
+
page: number;
|
|
60
|
+
pageSize: number;
|
|
61
|
+
total: number;
|
|
62
|
+
onPageChange: (page: number) => void;
|
|
63
|
+
onPageSizeChange: (size: number) => void;
|
|
64
|
+
pageSizeOptions?: number[];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Filters
|
|
68
|
+
filters?: {
|
|
69
|
+
config: unknown[];
|
|
70
|
+
onFilter: (filters: Record<string, unknown>) => void;
|
|
71
|
+
initialValues?: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// Actions
|
|
75
|
+
actions?: (row: T) => TableAction<T>[];
|
|
76
|
+
toolbarActions?: ReactNode;
|
|
77
|
+
|
|
78
|
+
// Virtual Scrolling
|
|
79
|
+
virtualScrolling?: boolean;
|
|
80
|
+
virtualScrollingOptions?: {
|
|
81
|
+
itemHeight?: number;
|
|
82
|
+
containerHeight?: number;
|
|
83
|
+
overscan?: number;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Empty State
|
|
87
|
+
emptyMessage?: string;
|
|
88
|
+
emptyStateTitle?: string;
|
|
89
|
+
emptyStateMessage?: string;
|
|
90
|
+
emptyStateIllustration?: ReactNode;
|
|
91
|
+
emptyStateAction?: ReactNode;
|
|
92
|
+
|
|
93
|
+
className?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* DataGrid Component
|
|
98
|
+
*
|
|
99
|
+
* An advanced data grid component with sorting, filtering, grouping, column management, and export.
|
|
100
|
+
* Extends the Table component with additional enterprise features.
|
|
101
|
+
* Follows Atomic Design principles as an Organism component.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* <DataGrid
|
|
106
|
+
* columns={columns}
|
|
107
|
+
* data={data}
|
|
108
|
+
* groupable
|
|
109
|
+
* exportable
|
|
110
|
+
* onExport={(format) => console.log('Export as', format)}
|
|
111
|
+
* />
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export default function DataGrid<T extends Record<string, unknown> = Record<string, unknown>>({
|
|
115
|
+
columns,
|
|
116
|
+
data,
|
|
117
|
+
loading = false,
|
|
118
|
+
onSort,
|
|
119
|
+
sortColumn,
|
|
120
|
+
sortDirection,
|
|
121
|
+
multiSort: _multiSort = false,
|
|
122
|
+
groups = [],
|
|
123
|
+
onGroupChange,
|
|
124
|
+
groupable = false,
|
|
125
|
+
resizable = true,
|
|
126
|
+
reorderable: _reorderable = false,
|
|
127
|
+
onColumnReorder: _onColumnReorder,
|
|
128
|
+
columnWidths,
|
|
129
|
+
onColumnResize,
|
|
130
|
+
selectable = false,
|
|
131
|
+
selectedRows,
|
|
132
|
+
onSelectionChange,
|
|
133
|
+
rowId,
|
|
134
|
+
exportable = false,
|
|
135
|
+
onExport,
|
|
136
|
+
exportFormats = ['csv', 'xlsx', 'json'],
|
|
137
|
+
pagination,
|
|
138
|
+
filters,
|
|
139
|
+
actions,
|
|
140
|
+
toolbarActions,
|
|
141
|
+
virtualScrolling = false,
|
|
142
|
+
virtualScrollingOptions,
|
|
143
|
+
emptyMessage,
|
|
144
|
+
emptyStateTitle,
|
|
145
|
+
emptyStateMessage,
|
|
146
|
+
emptyStateIllustration,
|
|
147
|
+
emptyStateAction,
|
|
148
|
+
className = '',
|
|
149
|
+
}: DataGridProps<T>) {
|
|
150
|
+
const [internalGroups, setInternalGroups] = useState<DataGridGroup[]>(groups);
|
|
151
|
+
const [internalColumnWidths, setInternalColumnWidths] = useState<Record<string, number>>(
|
|
152
|
+
columnWidths || {}
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
// Convert DataGrid columns to Table columns
|
|
156
|
+
const tableColumns: TableColumn<T>[] = useMemo(() => {
|
|
157
|
+
return columns.map((col) => ({
|
|
158
|
+
...col,
|
|
159
|
+
width: internalColumnWidths[col.key] || col.defaultWidth,
|
|
160
|
+
}));
|
|
161
|
+
}, [columns, internalColumnWidths]);
|
|
162
|
+
|
|
163
|
+
const _handleGroupToggle = (columnKey: string) => {
|
|
164
|
+
const newGroups = internalGroups.map((g) =>
|
|
165
|
+
g.column === columnKey ? { ...g, expanded: !g.expanded } : g
|
|
166
|
+
);
|
|
167
|
+
setInternalGroups(newGroups);
|
|
168
|
+
onGroupChange?.(newGroups);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const handleExport = (format: 'csv' | 'xlsx' | 'json') => {
|
|
172
|
+
if (onExport) {
|
|
173
|
+
onExport(format);
|
|
174
|
+
} else {
|
|
175
|
+
// Default export implementation
|
|
176
|
+
if (format === 'csv') {
|
|
177
|
+
exportToCSV(data, columns);
|
|
178
|
+
} else if (format === 'json') {
|
|
179
|
+
exportToJSON(data);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const exportToCSV = (data: T[], cols: DataGridColumn<T>[]) => {
|
|
185
|
+
const headers = cols.filter((c) => c.exportable !== false).map((c) => c.label || c.key);
|
|
186
|
+
const rows = data.map((row) =>
|
|
187
|
+
cols
|
|
188
|
+
.filter((c) => c.exportable !== false)
|
|
189
|
+
.map((c) => {
|
|
190
|
+
const value = row[c.key];
|
|
191
|
+
return typeof value === 'string' && value.includes(',') ? `"${value}"` : value;
|
|
192
|
+
})
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const csv = [headers.join(','), ...rows.map((r) => r.join(','))].join('\n');
|
|
196
|
+
const blob = new Blob([csv], { type: 'text/csv' });
|
|
197
|
+
const url = URL.createObjectURL(blob);
|
|
198
|
+
const a = document.createElement('a');
|
|
199
|
+
a.href = url;
|
|
200
|
+
a.download = `export-${Date.now()}.csv`;
|
|
201
|
+
a.click();
|
|
202
|
+
URL.revokeObjectURL(url);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const exportToJSON = (data: T[]) => {
|
|
206
|
+
const json = JSON.stringify(data, null, 2);
|
|
207
|
+
const blob = new Blob([json], { type: 'application/json' });
|
|
208
|
+
const url = URL.createObjectURL(blob);
|
|
209
|
+
const a = document.createElement('a');
|
|
210
|
+
a.href = url;
|
|
211
|
+
a.download = `export-${Date.now()}.json`;
|
|
212
|
+
a.click();
|
|
213
|
+
URL.revokeObjectURL(url);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<div className={`space-y-4 ${className}`}>
|
|
218
|
+
{/* Toolbar */}
|
|
219
|
+
{(exportable || groupable || toolbarActions) && (
|
|
220
|
+
<div className={`
|
|
221
|
+
flex
|
|
222
|
+
items-center
|
|
223
|
+
justify-between
|
|
224
|
+
${getSpacingClass('base', 'p')}
|
|
225
|
+
bg-white
|
|
226
|
+
border
|
|
227
|
+
border-gray-200
|
|
228
|
+
rounded-lg
|
|
229
|
+
`}>
|
|
230
|
+
<div className="flex items-center gap-2">
|
|
231
|
+
{groupable && (
|
|
232
|
+
<Button
|
|
233
|
+
variant="outline"
|
|
234
|
+
size="sm"
|
|
235
|
+
leftIcon={<ArrowUpDown className="h-4 w-4" />}
|
|
236
|
+
>
|
|
237
|
+
Group
|
|
238
|
+
</Button>
|
|
239
|
+
)}
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
<div className="flex items-center gap-2">
|
|
243
|
+
{toolbarActions}
|
|
244
|
+
{exportable && (
|
|
245
|
+
<div className="flex items-center gap-1">
|
|
246
|
+
{exportFormats.map((format) => (
|
|
247
|
+
<Button
|
|
248
|
+
key={format}
|
|
249
|
+
variant="outline"
|
|
250
|
+
size="sm"
|
|
251
|
+
leftIcon={<Download className="h-4 w-4" />}
|
|
252
|
+
onClick={() => handleExport(format)}
|
|
253
|
+
>
|
|
254
|
+
{format.toUpperCase()}
|
|
255
|
+
</Button>
|
|
256
|
+
))}
|
|
257
|
+
</div>
|
|
258
|
+
)}
|
|
259
|
+
</div>
|
|
260
|
+
</div>
|
|
261
|
+
)}
|
|
262
|
+
|
|
263
|
+
{/* Table */}
|
|
264
|
+
<Table
|
|
265
|
+
columns={tableColumns}
|
|
266
|
+
data={data}
|
|
267
|
+
loading={loading}
|
|
268
|
+
onSort={onSort}
|
|
269
|
+
sortColumn={sortColumn}
|
|
270
|
+
sortDirection={sortDirection}
|
|
271
|
+
pagination={pagination}
|
|
272
|
+
filters={filters}
|
|
273
|
+
selectable={selectable}
|
|
274
|
+
selectedRows={selectedRows}
|
|
275
|
+
onSelectionChange={onSelectionChange}
|
|
276
|
+
rowId={rowId}
|
|
277
|
+
actions={actions}
|
|
278
|
+
resizable={resizable}
|
|
279
|
+
columnWidths={internalColumnWidths}
|
|
280
|
+
onColumnResize={(key, width) => {
|
|
281
|
+
setInternalColumnWidths((prev) => ({ ...prev, [key]: width }));
|
|
282
|
+
onColumnResize?.(key, width);
|
|
283
|
+
}}
|
|
284
|
+
virtualScrolling={virtualScrolling}
|
|
285
|
+
virtualScrollingOptions={virtualScrollingOptions}
|
|
286
|
+
emptyMessage={emptyMessage}
|
|
287
|
+
emptyStateTitle={emptyStateTitle}
|
|
288
|
+
emptyStateMessage={emptyStateMessage}
|
|
289
|
+
emptyStateIllustration={emptyStateIllustration}
|
|
290
|
+
emptyStateAction={emptyStateAction}
|
|
291
|
+
/>
|
|
292
|
+
</div>
|
|
293
|
+
);
|
|
294
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
import Dialog from './Dialog';
|
|
5
|
+
import { DialogContent } from './DialogContent';
|
|
6
|
+
import { DialogHeader } from './DialogHeader';
|
|
7
|
+
import { DialogFooter } from './DialogFooter';
|
|
8
|
+
import Button from '../../atoms/Button/Button';
|
|
9
|
+
|
|
10
|
+
export interface AlertDialogProps {
|
|
11
|
+
open?: boolean;
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
14
|
+
title: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
confirmLabel?: string;
|
|
17
|
+
cancelLabel?: string;
|
|
18
|
+
variant?: 'default' | 'destructive';
|
|
19
|
+
onConfirm?: () => void;
|
|
20
|
+
onCancel?: () => void;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* AlertDialog Component
|
|
26
|
+
*
|
|
27
|
+
* A specialized dialog for confirmations and alerts.
|
|
28
|
+
* Built on top of Dialog with pre-configured layout.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <AlertDialog
|
|
33
|
+
* open={isOpen}
|
|
34
|
+
* onOpenChange={setIsOpen}
|
|
35
|
+
* title="Delete Item"
|
|
36
|
+
* description="Are you sure? This action cannot be undone."
|
|
37
|
+
* variant="destructive"
|
|
38
|
+
* onConfirm={handleDelete}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function AlertDialog({
|
|
43
|
+
open,
|
|
44
|
+
defaultOpen,
|
|
45
|
+
onOpenChange,
|
|
46
|
+
title,
|
|
47
|
+
description,
|
|
48
|
+
confirmLabel = 'Confirm',
|
|
49
|
+
cancelLabel = 'Cancel',
|
|
50
|
+
variant = 'default',
|
|
51
|
+
onConfirm,
|
|
52
|
+
onCancel,
|
|
53
|
+
children,
|
|
54
|
+
}: AlertDialogProps) {
|
|
55
|
+
const handleConfirm = () => {
|
|
56
|
+
onConfirm?.();
|
|
57
|
+
onOpenChange?.(false);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handleCancel = () => {
|
|
61
|
+
onCancel?.();
|
|
62
|
+
onOpenChange?.(false);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Dialog open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>
|
|
67
|
+
<DialogContent size="sm" closeOnOverlayClick={false}>
|
|
68
|
+
{children || (
|
|
69
|
+
<>
|
|
70
|
+
<DialogHeader>
|
|
71
|
+
<Dialog.Title>{title}</Dialog.Title>
|
|
72
|
+
{description && <Dialog.Description>{description}</Dialog.Description>}
|
|
73
|
+
</DialogHeader>
|
|
74
|
+
<DialogFooter>
|
|
75
|
+
<Button variant="outline" onClick={handleCancel}>
|
|
76
|
+
{cancelLabel}
|
|
77
|
+
</Button>
|
|
78
|
+
<Button
|
|
79
|
+
variant={variant === 'destructive' ? 'error' : 'primary'}
|
|
80
|
+
onClick={handleConfirm}
|
|
81
|
+
>
|
|
82
|
+
{confirmLabel}
|
|
83
|
+
</Button>
|
|
84
|
+
</DialogFooter>
|
|
85
|
+
</>
|
|
86
|
+
)}
|
|
87
|
+
</DialogContent>
|
|
88
|
+
</Dialog>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default AlertDialog;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Organisms/Dialog" />
|
|
4
|
+
|
|
5
|
+
# Dialog
|
|
6
|
+
|
|
7
|
+
A flexible and accessible dialog component using the compound components pattern. Supports both controlled and uncontrolled modes with full keyboard navigation and focus management.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Compound Components**: Flexible API with composable parts
|
|
12
|
+
- **Controlled/Uncontrolled**: Works in both modes
|
|
13
|
+
- **Focus Trap**: Automatically traps focus within dialog
|
|
14
|
+
- **Portal Rendering**: Renders outside DOM hierarchy
|
|
15
|
+
- **Accessibility**: Full ARIA support and keyboard navigation
|
|
16
|
+
- **Sizes**: Multiple size options (sm, md, lg, xl, fullscreen)
|
|
17
|
+
- **Body Scroll Lock**: Prevents background scrolling when open
|
|
18
|
+
|
|
19
|
+
## Basic Usage
|
|
20
|
+
|
|
21
|
+
### Uncontrolled Mode
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { Dialog, Button } from '@fabio.caffarello/react-design-system';
|
|
25
|
+
|
|
26
|
+
<Dialog>
|
|
27
|
+
<Dialog.Trigger>
|
|
28
|
+
<Button>Open Dialog</Button>
|
|
29
|
+
</Dialog.Trigger>
|
|
30
|
+
<Dialog.Content>
|
|
31
|
+
<Dialog.Header>
|
|
32
|
+
<Dialog.Title>Dialog Title</Dialog.Title>
|
|
33
|
+
<Dialog.Description>
|
|
34
|
+
Dialog description text
|
|
35
|
+
</Dialog.Description>
|
|
36
|
+
</Dialog.Header>
|
|
37
|
+
<Dialog.Footer>
|
|
38
|
+
<Dialog.Close>
|
|
39
|
+
<Button variant="outline">Cancel</Button>
|
|
40
|
+
</Dialog.Close>
|
|
41
|
+
<Button>Confirm</Button>
|
|
42
|
+
</Dialog.Footer>
|
|
43
|
+
</Dialog.Content>
|
|
44
|
+
</Dialog>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Controlled Mode
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { useState } from 'react';
|
|
51
|
+
import { Dialog, Button } from '@fabio.caffarello/react-design-system';
|
|
52
|
+
|
|
53
|
+
function MyComponent() {
|
|
54
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
<Button onClick={() => setIsOpen(true)}>Open Dialog</Button>
|
|
59
|
+
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
|
60
|
+
<Dialog.Content>
|
|
61
|
+
<Dialog.Header>
|
|
62
|
+
<Dialog.Title>Dialog Title</Dialog.Title>
|
|
63
|
+
</Dialog.Header>
|
|
64
|
+
<Dialog.Footer>
|
|
65
|
+
<Button variant="outline" onClick={() => setIsOpen(false)}>
|
|
66
|
+
Cancel
|
|
67
|
+
</Button>
|
|
68
|
+
<Button onClick={() => setIsOpen(false)}>Confirm</Button>
|
|
69
|
+
</Dialog.Footer>
|
|
70
|
+
</Dialog.Content>
|
|
71
|
+
</Dialog>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Compound Components
|
|
78
|
+
|
|
79
|
+
### Dialog.Trigger
|
|
80
|
+
|
|
81
|
+
Opens the dialog when clicked:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<Dialog.Trigger>
|
|
85
|
+
<Button>Open</Button>
|
|
86
|
+
</Dialog.Trigger>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Dialog.Content
|
|
90
|
+
|
|
91
|
+
The main dialog container:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<Dialog.Content size="lg" closeOnOverlayClick closeOnEscape>
|
|
95
|
+
{/* Content */}
|
|
96
|
+
</Dialog.Content>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Props:**
|
|
100
|
+
- `size`: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen'
|
|
101
|
+
- `closeOnOverlayClick`: Close when clicking overlay
|
|
102
|
+
- `closeOnEscape`: Close on Escape key
|
|
103
|
+
|
|
104
|
+
### Dialog.Header
|
|
105
|
+
|
|
106
|
+
Container for title and description:
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
<Dialog.Header>
|
|
110
|
+
<Dialog.Title>Title</Dialog.Title>
|
|
111
|
+
<Dialog.Description>Description</Dialog.Description>
|
|
112
|
+
</Dialog.Header>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Dialog.Title
|
|
116
|
+
|
|
117
|
+
The dialog title (required for accessibility):
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<Dialog.Title>Dialog Title</Dialog.Title>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Dialog.Description
|
|
124
|
+
|
|
125
|
+
Optional description text:
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
<Dialog.Description>
|
|
129
|
+
Additional context about the dialog
|
|
130
|
+
</Dialog.Description>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Dialog.Footer
|
|
134
|
+
|
|
135
|
+
Container for action buttons:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
<Dialog.Footer>
|
|
139
|
+
<Button>Action</Button>
|
|
140
|
+
</Dialog.Footer>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Dialog.Close
|
|
144
|
+
|
|
145
|
+
Closes the dialog when clicked:
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
<Dialog.Close>
|
|
149
|
+
<Button variant="outline">Close</Button>
|
|
150
|
+
</Dialog.Close>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Sizes
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
<Dialog.Content size="sm">Small Dialog</Dialog.Content>
|
|
157
|
+
<Dialog.Content size="md">Medium Dialog</Dialog.Content>
|
|
158
|
+
<Dialog.Content size="lg">Large Dialog</Dialog.Content>
|
|
159
|
+
<Dialog.Content size="xl">Extra Large Dialog</Dialog.Content>
|
|
160
|
+
<Dialog.Content size="fullscreen">Fullscreen Dialog</Dialog.Content>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Focus Management
|
|
164
|
+
|
|
165
|
+
The Dialog automatically:
|
|
166
|
+
|
|
167
|
+
- Focuses the first focusable element when opened
|
|
168
|
+
- Traps focus within the dialog
|
|
169
|
+
- Restores focus to the trigger when closed
|
|
170
|
+
- Prevents body scrolling when open
|
|
171
|
+
|
|
172
|
+
## Keyboard Navigation
|
|
173
|
+
|
|
174
|
+
- **Escape**: Closes the dialog (if `closeOnEscape` is true)
|
|
175
|
+
- **Tab**: Navigates between focusable elements
|
|
176
|
+
- **Shift+Tab**: Navigates backwards
|
|
177
|
+
- Focus wraps within the dialog
|
|
178
|
+
|
|
179
|
+
## Accessibility
|
|
180
|
+
|
|
181
|
+
The Dialog component follows ARIA best practices:
|
|
182
|
+
|
|
183
|
+
- Uses `role="dialog"` with `aria-modal="true"`
|
|
184
|
+
- Associates title via `aria-labelledby`
|
|
185
|
+
- Associates description via `aria-describedby`
|
|
186
|
+
- Manages focus automatically
|
|
187
|
+
- Supports screen readers
|
|
188
|
+
|
|
189
|
+
### Required ARIA Attributes
|
|
190
|
+
|
|
191
|
+
- **Title**: Always provide a `Dialog.Title` for `aria-labelledby`
|
|
192
|
+
- **Description**: Optional but recommended for `aria-describedby`
|
|
193
|
+
|
|
194
|
+
## Best Practices
|
|
195
|
+
|
|
196
|
+
1. **Always provide a title**: Required for accessibility
|
|
197
|
+
2. **Use descriptions**: Help users understand the dialog purpose
|
|
198
|
+
3. **Clear actions**: Make button labels clear and actionable
|
|
199
|
+
4. **Escape to close**: Allow users to close with Escape key
|
|
200
|
+
5. **Focus management**: Let the component handle focus automatically
|