@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,348 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import {
|
|
3
|
+
ColorPalette,
|
|
4
|
+
SpacingReference,
|
|
5
|
+
TypographyReference,
|
|
6
|
+
ShadowReference,
|
|
7
|
+
RadiusReference,
|
|
8
|
+
AnimationReference,
|
|
9
|
+
ZIndexReference,
|
|
10
|
+
OpacityReference,
|
|
11
|
+
GradientReference,
|
|
12
|
+
} from './TokenVisualizations';
|
|
13
|
+
|
|
14
|
+
<Meta title="Design System/Tokens" />
|
|
15
|
+
|
|
16
|
+
# Design Tokens
|
|
17
|
+
|
|
18
|
+
Design tokens are the foundational visual design atoms of the design system. They represent design decisions about colors, spacing, typography, shadows, and more. Using tokens ensures consistency across all components and makes it easy to maintain and update the design system.
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
The design token system uses a **Factory Pattern** to create type-safe tokens consistently. All tokens follow a standardized structure and can be accessed through helper functions.
|
|
23
|
+
|
|
24
|
+
## Color Tokens
|
|
25
|
+
|
|
26
|
+
Color tokens provide semantic color values with support for light and dark themes.
|
|
27
|
+
|
|
28
|
+
### Color Roles
|
|
29
|
+
|
|
30
|
+
- `primary` - Primary brand color
|
|
31
|
+
- `secondary` - Secondary brand color
|
|
32
|
+
- `success` - Success states and positive actions
|
|
33
|
+
- `warning` - Warning states and caution
|
|
34
|
+
- `error` - Error states and destructive actions
|
|
35
|
+
- `info` - Informational content
|
|
36
|
+
- `neutral` - Neutral grays for text and backgrounds
|
|
37
|
+
|
|
38
|
+
### Color Shades
|
|
39
|
+
|
|
40
|
+
Each color role has four shades:
|
|
41
|
+
- `light` - Lightest variant
|
|
42
|
+
- `DEFAULT` - Default/main color
|
|
43
|
+
- `dark` - Darkest variant
|
|
44
|
+
- `contrast` - Contrast color for text on colored backgrounds
|
|
45
|
+
|
|
46
|
+
### Usage
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { getColorClass } from '@fabio.caffarello/react-design-system';
|
|
50
|
+
|
|
51
|
+
// Background color
|
|
52
|
+
const bgClass = getColorClass('primary', 'DEFAULT', 'bg'); // 'bg-indigo-500'
|
|
53
|
+
|
|
54
|
+
// Text color
|
|
55
|
+
const textClass = getColorClass('error', 'dark', 'text'); // 'text-red-600'
|
|
56
|
+
|
|
57
|
+
// Border color
|
|
58
|
+
const borderClass = getColorClass('neutral', 'DEFAULT', 'border'); // 'border-gray-300'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Color Palette
|
|
62
|
+
|
|
63
|
+
<ColorPalette />
|
|
64
|
+
|
|
65
|
+
## Spacing Tokens
|
|
66
|
+
|
|
67
|
+
Spacing tokens are based on a 4px base unit, providing consistent spacing throughout the design system.
|
|
68
|
+
|
|
69
|
+
### Spacing Scale
|
|
70
|
+
|
|
71
|
+
- `xs` - 4px
|
|
72
|
+
- `sm` - 8px
|
|
73
|
+
- `md` - 12px
|
|
74
|
+
- `base` - 16px
|
|
75
|
+
- `lg` - 24px
|
|
76
|
+
- `xl` - 32px
|
|
77
|
+
- `2xl` - 40px
|
|
78
|
+
- `3xl` - 48px
|
|
79
|
+
- `4xl` - 64px
|
|
80
|
+
- `5xl` - 80px
|
|
81
|
+
- `6xl` - 96px
|
|
82
|
+
|
|
83
|
+
### Usage
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { getSpacingClass } from '@fabio.caffarello/react-design-system';
|
|
87
|
+
|
|
88
|
+
// Padding
|
|
89
|
+
const paddingClass = getSpacingClass('md', 'p'); // 'p-3'
|
|
90
|
+
|
|
91
|
+
// Margin
|
|
92
|
+
const marginClass = getSpacingClass('lg', 'mx'); // 'mx-6'
|
|
93
|
+
|
|
94
|
+
// Gap
|
|
95
|
+
const gapClass = getSpacingClass('base', 'gap'); // 'gap-4'
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Spacing Reference
|
|
99
|
+
|
|
100
|
+
<SpacingReference />
|
|
101
|
+
|
|
102
|
+
## Typography Tokens
|
|
103
|
+
|
|
104
|
+
Typography tokens define font sizes, weights, and line heights for consistent text styling.
|
|
105
|
+
|
|
106
|
+
### Font Sizes
|
|
107
|
+
|
|
108
|
+
- `xs` - 12px
|
|
109
|
+
- `sm` - 14px
|
|
110
|
+
- `base` - 16px
|
|
111
|
+
- `lg` - 18px
|
|
112
|
+
- `xl` - 20px
|
|
113
|
+
- `2xl` - 24px
|
|
114
|
+
- `3xl` - 30px
|
|
115
|
+
- `4xl` - 36px
|
|
116
|
+
- `5xl` - 48px
|
|
117
|
+
- `6xl` - 60px
|
|
118
|
+
|
|
119
|
+
### Font Weights
|
|
120
|
+
|
|
121
|
+
- `light` - 300
|
|
122
|
+
- `normal` - 400
|
|
123
|
+
- `medium` - 500
|
|
124
|
+
- `semibold` - 600
|
|
125
|
+
- `bold` - 700
|
|
126
|
+
|
|
127
|
+
### Usage
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
import { getTypographyClasses } from '@fabio.caffarello/react-design-system';
|
|
131
|
+
|
|
132
|
+
// Heading styles
|
|
133
|
+
const h1Classes = getTypographyClasses('h1'); // 'text-4xl leading-tight font-bold'
|
|
134
|
+
const h2Classes = getTypographyClasses('h2'); // 'text-3xl leading-tight font-bold'
|
|
135
|
+
const bodyClasses = getTypographyClasses('body'); // 'text-base leading-relaxed font-normal'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Typography Reference
|
|
139
|
+
|
|
140
|
+
<TypographyReference />
|
|
141
|
+
|
|
142
|
+
## Shadow Tokens
|
|
143
|
+
|
|
144
|
+
Shadow tokens provide consistent elevation and depth.
|
|
145
|
+
|
|
146
|
+
### Shadow Sizes
|
|
147
|
+
|
|
148
|
+
- `none` - No shadow
|
|
149
|
+
- `sm` - Small shadow for subtle elevation
|
|
150
|
+
- `md` - Medium shadow for cards
|
|
151
|
+
- `lg` - Large shadow for modals
|
|
152
|
+
- `xl` - Extra large shadow
|
|
153
|
+
- `2xl` - 2X large shadow
|
|
154
|
+
- `inner` - Inner shadow
|
|
155
|
+
|
|
156
|
+
### Usage
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
import { getShadowClass } from '@fabio.caffarello/react-design-system';
|
|
160
|
+
|
|
161
|
+
const shadowClass = getShadowClass('lg'); // 'shadow-lg'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Shadow Reference
|
|
165
|
+
|
|
166
|
+
<ShadowReference />
|
|
167
|
+
|
|
168
|
+
## Radius Tokens
|
|
169
|
+
|
|
170
|
+
Radius tokens define border radius values for rounded corners.
|
|
171
|
+
|
|
172
|
+
### Radius Sizes
|
|
173
|
+
|
|
174
|
+
- `none` - 0px
|
|
175
|
+
- `sm` - 2px
|
|
176
|
+
- `md` - 6px
|
|
177
|
+
- `lg` - 8px
|
|
178
|
+
- `xl` - 12px
|
|
179
|
+
- `2xl` - 16px
|
|
180
|
+
- `3xl` - 24px
|
|
181
|
+
- `full` - 9999px (fully rounded)
|
|
182
|
+
|
|
183
|
+
### Usage
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
import { getRadiusClass } from '@fabio.caffarello/react-design-system';
|
|
187
|
+
|
|
188
|
+
const radiusClass = getRadiusClass('lg'); // 'rounded-lg'
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Animation Tokens
|
|
192
|
+
|
|
193
|
+
Animation tokens define consistent timing and easing for transitions and animations.
|
|
194
|
+
|
|
195
|
+
### Animation Durations
|
|
196
|
+
|
|
197
|
+
- `fast` - 150ms
|
|
198
|
+
- `base` - 200ms
|
|
199
|
+
- `slow` - 300ms
|
|
200
|
+
- `slower` - 500ms
|
|
201
|
+
|
|
202
|
+
### Easing Functions
|
|
203
|
+
|
|
204
|
+
- `ease-in` - Slow start, fast end
|
|
205
|
+
- `ease-out` - Fast start, slow end
|
|
206
|
+
- `ease-in-out` - Slow start and end, fast middle
|
|
207
|
+
- `spring` - Spring-like bounce effect
|
|
208
|
+
|
|
209
|
+
### Usage
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
import { getAnimationClass, getTransitionClass } from '@fabio.caffarello/react-design-system';
|
|
213
|
+
|
|
214
|
+
// Animation classes
|
|
215
|
+
const animClass = getAnimationClass('base', 'ease-in-out'); // 'duration-200 ease-in-out'
|
|
216
|
+
|
|
217
|
+
// Transition classes
|
|
218
|
+
const transitionClass = getTransitionClass(['color', 'background-color'], 'base'); // 'duration-200 ease-in-out'
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Z-Index Tokens
|
|
222
|
+
|
|
223
|
+
Z-index tokens provide consistent layering for overlapping elements.
|
|
224
|
+
|
|
225
|
+
### Z-Index Layers
|
|
226
|
+
|
|
227
|
+
- `base` - 0 (normal content)
|
|
228
|
+
- `dropdown` - 1000 (dropdown menus)
|
|
229
|
+
- `sticky` - 1020 (sticky headers)
|
|
230
|
+
- `fixed` - 1030 (fixed elements)
|
|
231
|
+
- `modal-backdrop` - 1040 (modal overlays)
|
|
232
|
+
- `modal` - 1050 (modal dialogs)
|
|
233
|
+
- `popover` - 1060 (popovers)
|
|
234
|
+
- `tooltip` - 1070 (tooltips)
|
|
235
|
+
- `toast` - 1080 (toast notifications)
|
|
236
|
+
|
|
237
|
+
### Usage
|
|
238
|
+
|
|
239
|
+
```tsx
|
|
240
|
+
import { getZIndexClass } from '@fabio.caffarello/react-design-system';
|
|
241
|
+
|
|
242
|
+
const zIndexClass = getZIndexClass('modal'); // 'z-[1050]'
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Opacity Tokens
|
|
246
|
+
|
|
247
|
+
Opacity tokens define consistent transparency values.
|
|
248
|
+
|
|
249
|
+
### Opacity Values
|
|
250
|
+
|
|
251
|
+
- `0` - Fully transparent
|
|
252
|
+
- `5` - Very light overlay
|
|
253
|
+
- `10` - Light overlay
|
|
254
|
+
- `25` - Quarter opacity
|
|
255
|
+
- `50` - Half opacity
|
|
256
|
+
- `75` - Three-quarter opacity
|
|
257
|
+
- `90` - Very high opacity
|
|
258
|
+
- `100` - Fully opaque
|
|
259
|
+
|
|
260
|
+
### Usage
|
|
261
|
+
|
|
262
|
+
```tsx
|
|
263
|
+
import { getOpacityClass } from '@fabio.caffarello/react-design-system';
|
|
264
|
+
|
|
265
|
+
const opacityClass = getOpacityClass(50); // 'opacity-50'
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Gradient Tokens
|
|
269
|
+
|
|
270
|
+
Gradient tokens provide semantic color gradients.
|
|
271
|
+
|
|
272
|
+
### Gradient Roles
|
|
273
|
+
|
|
274
|
+
- `primary` - Primary color gradient
|
|
275
|
+
- `secondary` - Secondary color gradient
|
|
276
|
+
- `success` - Success color gradient
|
|
277
|
+
- `error` - Error color gradient
|
|
278
|
+
- `info` - Info color gradient
|
|
279
|
+
- `warning` - Warning color gradient
|
|
280
|
+
|
|
281
|
+
### Gradient Directions
|
|
282
|
+
|
|
283
|
+
- `to-r` - To right
|
|
284
|
+
- `to-l` - To left
|
|
285
|
+
- `to-t` - To top
|
|
286
|
+
- `to-b` - To bottom
|
|
287
|
+
- `to-tr` - To top right
|
|
288
|
+
- `to-tl` - To top left
|
|
289
|
+
- `to-br` - To bottom right
|
|
290
|
+
- `to-bl` - To bottom left
|
|
291
|
+
|
|
292
|
+
### Usage
|
|
293
|
+
|
|
294
|
+
```tsx
|
|
295
|
+
import { getGradientClass } from '@fabio.caffarello/react-design-system';
|
|
296
|
+
|
|
297
|
+
const gradientClass = getGradientClass('primary', 'to-r'); // 'bg-gradient-to-r from-[...] via-[...] to-[...]'
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Best Practices
|
|
301
|
+
|
|
302
|
+
### ✅ Do Use Tokens
|
|
303
|
+
|
|
304
|
+
```tsx
|
|
305
|
+
// ✅ Good - Using tokens
|
|
306
|
+
import { getColorClass, getSpacingClass, getRadiusClass } from '@fabio.caffarello/react-design-system';
|
|
307
|
+
|
|
308
|
+
const className = `
|
|
309
|
+
${getColorClass('primary', 'DEFAULT', 'bg')}
|
|
310
|
+
${getSpacingClass('md', 'p')}
|
|
311
|
+
${getRadiusClass('lg')}
|
|
312
|
+
`;
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### ❌ Don't Use Hardcoded Classes
|
|
316
|
+
|
|
317
|
+
```tsx
|
|
318
|
+
// ❌ Bad - Hardcoded classes
|
|
319
|
+
const className = 'bg-indigo-500 p-3 rounded-lg';
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## Token Factory
|
|
323
|
+
|
|
324
|
+
The `TokensFactory` provides a unified interface for creating all types of tokens:
|
|
325
|
+
|
|
326
|
+
```tsx
|
|
327
|
+
import { TokensFactory } from '@fabio.caffarello/react-design-system';
|
|
328
|
+
|
|
329
|
+
const factory = new TokensFactory('light');
|
|
330
|
+
const tokenSet = factory.createTokenSet();
|
|
331
|
+
|
|
332
|
+
// Access all tokens
|
|
333
|
+
const spacing = tokenSet.spacing;
|
|
334
|
+
const colors = tokenSet.colors;
|
|
335
|
+
const shadows = tokenSet.shadows;
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
## Migration Guide
|
|
339
|
+
|
|
340
|
+
When refactoring components, replace hardcoded classes with tokens:
|
|
341
|
+
|
|
342
|
+
1. **Colors**: `bg-gray-500` → `getColorClass('neutral', 'DEFAULT', 'bg')`
|
|
343
|
+
2. **Spacing**: `p-4` → `getSpacingClass('base', 'p')`
|
|
344
|
+
3. **Shadows**: `shadow-lg` → `getShadowClass('lg')`
|
|
345
|
+
4. **Radius**: `rounded-md` → `getRadiusClass('md')`
|
|
346
|
+
5. **Borders**: `border-2` → `getBorderWidthClass('medium')`
|
|
347
|
+
|
|
348
|
+
Run `npm run audit:tokens` to find hardcoded classes in your components.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation Tokens
|
|
3
|
+
*
|
|
4
|
+
* Centralized animation and transition system for consistent timing and easing.
|
|
5
|
+
* Uses Factory Pattern for type-safe token creation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type AnimationDuration = 'fast' | 'base' | 'slow' | 'slower';
|
|
9
|
+
export type EasingFunction = 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring';
|
|
10
|
+
|
|
11
|
+
export interface AnimationToken {
|
|
12
|
+
duration: {
|
|
13
|
+
value: string;
|
|
14
|
+
ms: number;
|
|
15
|
+
tailwind: string;
|
|
16
|
+
};
|
|
17
|
+
easing: {
|
|
18
|
+
value: string;
|
|
19
|
+
tailwind: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TransitionToken {
|
|
25
|
+
property: string;
|
|
26
|
+
duration: string;
|
|
27
|
+
timingFunction: string;
|
|
28
|
+
tailwind: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Animation Token Factory
|
|
33
|
+
* Creates animation tokens with consistent timing and easing
|
|
34
|
+
*/
|
|
35
|
+
export class AnimationTokenFactory {
|
|
36
|
+
/**
|
|
37
|
+
* Create an animation token
|
|
38
|
+
*/
|
|
39
|
+
static create(duration: AnimationDuration, easing: EasingFunction = 'ease-in-out'): AnimationToken {
|
|
40
|
+
const durationMap: Record<AnimationDuration, { value: string; ms: number; tailwind: string }> = {
|
|
41
|
+
fast: {
|
|
42
|
+
value: '150ms',
|
|
43
|
+
ms: 150,
|
|
44
|
+
tailwind: 'duration-150',
|
|
45
|
+
},
|
|
46
|
+
base: {
|
|
47
|
+
value: '200ms',
|
|
48
|
+
ms: 200,
|
|
49
|
+
tailwind: 'duration-200',
|
|
50
|
+
},
|
|
51
|
+
slow: {
|
|
52
|
+
value: '300ms',
|
|
53
|
+
ms: 300,
|
|
54
|
+
tailwind: 'duration-300',
|
|
55
|
+
},
|
|
56
|
+
slower: {
|
|
57
|
+
value: '500ms',
|
|
58
|
+
ms: 500,
|
|
59
|
+
tailwind: 'duration-500',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const easingMap: Record<EasingFunction, { value: string; tailwind: string; description: string }> = {
|
|
64
|
+
'ease-in': {
|
|
65
|
+
value: 'cubic-bezier(0.4, 0, 1, 1)',
|
|
66
|
+
tailwind: 'ease-in',
|
|
67
|
+
description: 'Slow start, fast end',
|
|
68
|
+
},
|
|
69
|
+
'ease-out': {
|
|
70
|
+
value: 'cubic-bezier(0, 0, 0.2, 1)',
|
|
71
|
+
tailwind: 'ease-out',
|
|
72
|
+
description: 'Fast start, slow end',
|
|
73
|
+
},
|
|
74
|
+
'ease-in-out': {
|
|
75
|
+
value: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
|
76
|
+
tailwind: 'ease-in-out',
|
|
77
|
+
description: 'Slow start and end, fast middle',
|
|
78
|
+
},
|
|
79
|
+
spring: {
|
|
80
|
+
value: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
|
|
81
|
+
tailwind: 'ease-[cubic-bezier(0.68,-0.55,0.265,1.55)]',
|
|
82
|
+
description: 'Spring-like bounce effect',
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
duration: durationMap[duration],
|
|
88
|
+
easing: easingMap[easing],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Create a transition token
|
|
94
|
+
*/
|
|
95
|
+
static createTransition(
|
|
96
|
+
property: string | string[],
|
|
97
|
+
duration: AnimationDuration = 'base',
|
|
98
|
+
easing: EasingFunction = 'ease-in-out'
|
|
99
|
+
): TransitionToken {
|
|
100
|
+
const durationToken = this.create(duration, easing);
|
|
101
|
+
const properties = Array.isArray(property) ? property.join(', ') : property;
|
|
102
|
+
const tailwindClasses = [
|
|
103
|
+
durationToken.duration.tailwind,
|
|
104
|
+
durationToken.easing.tailwind,
|
|
105
|
+
].join(' ');
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
property: properties,
|
|
109
|
+
duration: durationToken.duration.value,
|
|
110
|
+
timingFunction: durationToken.easing.value,
|
|
111
|
+
tailwind: tailwindClasses,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Pre-defined animation tokens
|
|
118
|
+
*/
|
|
119
|
+
export const ANIMATION_TOKENS = {
|
|
120
|
+
fast: AnimationTokenFactory.create('fast'),
|
|
121
|
+
base: AnimationTokenFactory.create('base'),
|
|
122
|
+
slow: AnimationTokenFactory.create('slow'),
|
|
123
|
+
slower: AnimationTokenFactory.create('slower'),
|
|
124
|
+
|
|
125
|
+
// Common transitions
|
|
126
|
+
colors: AnimationTokenFactory.createTransition(['color', 'background-color', 'border-color'], 'base'),
|
|
127
|
+
opacity: AnimationTokenFactory.createTransition('opacity', 'fast'),
|
|
128
|
+
transform: AnimationTokenFactory.createTransition('transform', 'base'),
|
|
129
|
+
all: AnimationTokenFactory.createTransition('all', 'base'),
|
|
130
|
+
} as const;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Helper function to get animation token
|
|
134
|
+
*/
|
|
135
|
+
export function getAnimation(duration: AnimationDuration, easing?: EasingFunction): AnimationToken {
|
|
136
|
+
return AnimationTokenFactory.create(duration, easing);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Helper function to get animation classes
|
|
141
|
+
*/
|
|
142
|
+
export function getAnimationClass(duration: AnimationDuration, easing: EasingFunction = 'ease-in-out'): string {
|
|
143
|
+
const token = AnimationTokenFactory.create(duration, easing);
|
|
144
|
+
return `${token.duration.tailwind} ${token.easing.tailwind}`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Helper function to get transition classes
|
|
149
|
+
*/
|
|
150
|
+
export function getTransitionClass(
|
|
151
|
+
property: string | string[],
|
|
152
|
+
duration: AnimationDuration = 'base',
|
|
153
|
+
easing: EasingFunction = 'ease-in-out'
|
|
154
|
+
): string {
|
|
155
|
+
const transition = AnimationTokenFactory.createTransition(property, duration, easing);
|
|
156
|
+
return transition.tailwind;
|
|
157
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Border Tokens
|
|
3
|
+
*
|
|
4
|
+
* Centralized border system for consistent borders and dividers.
|
|
5
|
+
* Uses Factory Pattern for type-safe token creation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type BorderWidth = 'none' | 'thin' | 'base' | 'medium' | 'thick';
|
|
9
|
+
export type BorderStyle = 'solid' | 'dashed' | 'dotted';
|
|
10
|
+
|
|
11
|
+
export interface BorderToken {
|
|
12
|
+
width: {
|
|
13
|
+
value: number;
|
|
14
|
+
px: string;
|
|
15
|
+
tailwind: string;
|
|
16
|
+
};
|
|
17
|
+
style: BorderStyle;
|
|
18
|
+
description: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Border Token Factory
|
|
23
|
+
* Creates border tokens with consistent values
|
|
24
|
+
*/
|
|
25
|
+
export class BorderTokenFactory {
|
|
26
|
+
/**
|
|
27
|
+
* Create a border width token
|
|
28
|
+
*/
|
|
29
|
+
static createWidth(width: BorderWidth): BorderToken['width'] {
|
|
30
|
+
const widthMap: Record<BorderWidth, { px: number; tailwind: string }> = {
|
|
31
|
+
none: {
|
|
32
|
+
px: 0,
|
|
33
|
+
tailwind: 'border-0',
|
|
34
|
+
},
|
|
35
|
+
thin: {
|
|
36
|
+
px: 1,
|
|
37
|
+
tailwind: 'border',
|
|
38
|
+
},
|
|
39
|
+
base: {
|
|
40
|
+
px: 1,
|
|
41
|
+
tailwind: 'border',
|
|
42
|
+
},
|
|
43
|
+
medium: {
|
|
44
|
+
px: 2,
|
|
45
|
+
tailwind: 'border-2',
|
|
46
|
+
},
|
|
47
|
+
thick: {
|
|
48
|
+
px: 4,
|
|
49
|
+
tailwind: 'border-4',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const config = widthMap[width];
|
|
54
|
+
return {
|
|
55
|
+
value: config.px,
|
|
56
|
+
px: `${config.px}px`,
|
|
57
|
+
tailwind: config.tailwind,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Create a complete border token
|
|
63
|
+
*/
|
|
64
|
+
static create(width: BorderWidth, style: BorderStyle = 'solid'): BorderToken {
|
|
65
|
+
return {
|
|
66
|
+
width: this.createWidth(width),
|
|
67
|
+
style,
|
|
68
|
+
description: `${width} ${style} border`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Pre-defined border tokens
|
|
75
|
+
*/
|
|
76
|
+
export const BORDER_TOKENS = {
|
|
77
|
+
none: BorderTokenFactory.create('none'),
|
|
78
|
+
thin: BorderTokenFactory.create('thin'),
|
|
79
|
+
base: BorderTokenFactory.create('base'),
|
|
80
|
+
medium: BorderTokenFactory.create('medium'),
|
|
81
|
+
thick: BorderTokenFactory.create('thick'),
|
|
82
|
+
// Dashed variants
|
|
83
|
+
thinDashed: BorderTokenFactory.create('thin', 'dashed'),
|
|
84
|
+
baseDashed: BorderTokenFactory.create('base', 'dashed'),
|
|
85
|
+
// Dotted variants
|
|
86
|
+
thinDotted: BorderTokenFactory.create('thin', 'dotted'),
|
|
87
|
+
baseDotted: BorderTokenFactory.create('base', 'dotted'),
|
|
88
|
+
} as const;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Helper function to get border token
|
|
92
|
+
*/
|
|
93
|
+
export function getBorder(size: keyof typeof BORDER_TOKENS): BorderToken {
|
|
94
|
+
return BORDER_TOKENS[size];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Helper function to get border width as Tailwind class
|
|
99
|
+
*/
|
|
100
|
+
export function getBorderWidthClass(width: BorderWidth): string {
|
|
101
|
+
return BorderTokenFactory.createWidth(width).tailwind;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Helper function to get border style as Tailwind class
|
|
106
|
+
*/
|
|
107
|
+
export function getBorderStyleClass(style: BorderStyle): string {
|
|
108
|
+
const styleMap: Record<BorderStyle, string> = {
|
|
109
|
+
solid: 'border-solid',
|
|
110
|
+
dashed: 'border-dashed',
|
|
111
|
+
dotted: 'border-dotted',
|
|
112
|
+
};
|
|
113
|
+
return styleMap[style];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Helper function to get complete border classes
|
|
118
|
+
*/
|
|
119
|
+
export function getBorderClasses(width: BorderWidth, style: BorderStyle = 'solid'): string {
|
|
120
|
+
return `${getBorderWidthClass(width)} ${getBorderStyleClass(style)}`;
|
|
121
|
+
}
|