@shohojdhara/atomix 0.1.16 → 0.1.18
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/CONTRIBUTING.md +151 -0
- package/NEXTJS_INTEGRATION.md +358 -0
- package/README.md +168 -119
- package/babel.config.js +58 -0
- package/css.d.ts +10 -0
- package/dist/css/atomix.css +1 -2
- package/dist/js/194.js +1 -2
- package/dist/js/244.js +1 -0
- package/dist/js/atomix.react.cjs.js +1 -0
- package/dist/js/atomix.react.esm.js +1 -2
- package/dist/js/atomix.react.umd.js +1 -2
- package/dist/js/chunks/cjs/202.9d3b1ef1eaa0d5c8a309.js +1 -0
- package/dist/js/chunks/cjs/308.6ea9685ea38ead4120d0.js +1 -0
- package/dist/js/chunks/cjs/54.73db6922594e421ba6b1.js +1 -0
- package/dist/js/chunks/cjs/619.51feecaadcab819780d4.js +1 -0
- package/dist/js/chunks/cjs/690.90f6d11164081cbcbc4d.js +1 -0
- package/dist/js/chunks/cjs/894.24877561df336a8dfd14.js +1 -0
- package/dist/js/chunks/cjs/897.6c2a71fae95338890de7.js +1 -0
- package/dist/js/chunks/esm/{202.ff48d27672233280e021.js → 202.82aa7b3244e53c9edb72.js} +1 -2
- package/dist/js/chunks/esm/{308.f873332126eba90e5c62.js → 308.27e1e4005705ae320432.js} +1 -2
- package/dist/js/chunks/esm/{54.4db919e5e4e5cc6d7c72.js → 54.ece1fd6964f98d4d994f.js} +1 -2
- package/dist/js/chunks/esm/{619.afc5a718eff77fa423b5.js → 619.ebeb0298432a066ac05c.js} +1 -2
- package/dist/js/chunks/esm/{690.a9e968c7497d61e56cdc.js → 690.c5f412cc979b55740359.js} +1 -2
- package/dist/js/chunks/esm/{894.f1091a4a8758c26d29e4.js → 894.3604ddc9367d75191198.js} +1 -2
- package/dist/js/chunks/esm/{897.561a50f7d043d42169da.js → 897.a4aab2fad9401693eb12.js} +1 -2
- package/dist/js/chunks/umd/{202.dac7605cc555b6bda542.js → 202.5017dd0403d696bf1644.js} +1 -2
- package/dist/js/chunks/umd/{308.6709979849dcbdb90c9b.js → 308.4bc14b9d7b16b6ee0ab8.js} +1 -2
- package/dist/js/chunks/umd/{54.403470e1f7d0ef4424a7.js → 54.7fdfb4a031989470a70d.js} +1 -2
- package/dist/js/chunks/umd/{619.fa05ea98c10270eb64c5.js → 619.84a0c35ecee695250085.js} +1 -2
- package/dist/js/chunks/umd/{690.aa7054d1c53e5402c2d6.js → 690.d7041094a34a4a434be2.js} +1 -2
- package/dist/js/chunks/umd/{894.3e1eaf0a2aadf4434390.js → 894.c127ee4e9513c22ee97d.js} +1 -2
- package/dist/js/chunks/umd/{897.554ea37be4453698c167.js → 897.26932ac837a39fc91907.js} +1 -2
- package/dist/types/components/Badge/index.d.ts +3 -3
- package/dist/types/components/{Navbar → Navigation/Menu}/MegaMenu.d.ts +1 -1
- package/dist/types/components/{Navbar → Navigation/Menu}/Menu.d.ts +1 -1
- package/dist/types/components/Navigation/Nav/Nav.d.ts +20 -0
- package/dist/types/components/{Navbar → Navigation/Nav}/NavDropdown.d.ts +1 -1
- package/dist/types/components/Navigation/Nav/NavItem.d.ts +33 -0
- package/dist/types/components/Navigation/Navbar/Navbar.d.ts +19 -0
- package/dist/types/components/Navigation/SideMenu/SideMenu.d.ts +20 -0
- package/dist/types/components/Navigation/SideMenu/SideMenuItem.d.ts +30 -0
- package/dist/types/components/Navigation/SideMenu/SideMenuList.d.ts +17 -0
- package/dist/types/components/Navigation/index.d.ts +10 -0
- package/dist/types/components/PhotoViewer/PhotoViewer.d.ts +2 -2
- package/dist/types/components/PhotoViewer/PhotoViewerHeader.d.ts +2 -2
- package/dist/types/components/Tab/index.d.ts +2 -2
- package/dist/types/components/Toggle/index.d.ts +2 -2
- package/dist/types/components/Tooltip/index.d.ts +3 -3
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/lib/composables/index.d.ts +1 -0
- package/dist/types/lib/composables/useDatePicker.d.ts +1 -1
- package/dist/types/lib/composables/useDropdown.d.ts +1 -1
- package/dist/types/lib/composables/useModal.d.ts +1 -1
- package/dist/types/lib/composables/usePhotoViewer.d.ts +1 -1
- package/dist/types/lib/composables/useRating.d.ts +1 -1
- package/dist/types/lib/composables/useSideMenu.d.ts +28 -0
- package/dist/types/lib/constants/components.d.ts +72 -0
- package/dist/types/lib/types/components.d.ts +103 -0
- package/examples/nextjs-example.tsx +271 -0
- package/implementation-guide.md +505 -0
- package/next.config.js +69 -0
- package/package.json +80 -42
- package/postcss.config.js +28 -0
- package/src/Introduction.mdx +3 -5
- package/src/assets/fonts/HelveticaNeue/stylesheet.css +140 -127
- package/src/components/Accordion/Accordion.stories.tsx +58 -45
- package/src/components/Accordion/Accordion.tsx +14 -4
- package/src/components/Accordion/scripts/accordionInteractions.ts +9 -9
- package/src/components/Accordion/scripts/bundle.ts +1 -1
- package/src/components/Accordion/scripts/index.ts +3 -3
- package/src/components/AtomixLogo.tsx +13 -19
- package/src/components/Avatar/Avatar.stories.tsx +24 -21
- package/src/components/Avatar/Avatar.tsx +5 -8
- package/src/components/Avatar/AvatarGroup.tsx +11 -11
- package/src/components/Avatar/index.ts +1 -1
- package/src/components/Avatar/scripts/index.ts +66 -71
- package/src/components/Badge/Badge.stories.tsx +51 -21
- package/src/components/Badge/Badge.tsx +14 -12
- package/src/components/Badge/index.ts +3 -3
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +40 -40
- package/src/components/Breadcrumb/Breadcrumb.tsx +19 -26
- package/src/components/Breadcrumb/index.ts +1 -1
- package/src/components/Breadcrumb/scripts/breadcrumb.ts +36 -34
- package/src/components/Breadcrumb/scripts/index.ts +1 -1
- package/src/components/Breadcrumb/scripts/types.ts +9 -9
- package/src/components/Button/Button.stories.tsx +36 -12
- package/src/components/Button/Button.tsx +52 -39
- package/src/components/Button/index.ts +1 -1
- package/src/components/Button/scripts/buttonInteractions.ts +9 -9
- package/src/components/Button/scripts/index.ts +1 -1
- package/src/components/Callout/Callout.stories.tsx +207 -114
- package/src/components/Callout/Callout.tsx +12 -12
- package/src/components/Callout/index.ts +1 -1
- package/src/components/Callout/scripts/CalloutInteractions.ts +58 -48
- package/src/components/Callout/scripts/bundle.ts +2 -2
- package/src/components/Callout/scripts/index.ts +19 -15
- package/src/components/Card/Card.stories.tsx +2 -2
- package/src/components/Card/Card.tsx +49 -72
- package/src/components/Card/ElevationCard.tsx +4 -8
- package/src/components/Card/index.ts +1 -1
- package/src/components/Card/scripts/bundle.ts +7 -7
- package/src/components/Card/scripts/cardInteractions.ts +24 -24
- package/src/components/Card/scripts/index.ts +25 -26
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +6 -3
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +12 -15
- package/src/components/ColorModeToggle/index.ts +1 -1
- package/src/components/Countdown/Countdown.stories.tsx +6 -2
- package/src/components/Countdown/Countdown.tsx +56 -48
- package/src/components/Countdown/index.ts +1 -1
- package/src/components/Countdown/scripts/index.ts +33 -28
- package/src/components/DataTable/DataTable.stories.tsx +23 -18
- package/src/components/DataTable/DataTable.tsx +39 -39
- package/src/components/DataTable/index.ts +1 -1
- package/src/components/DataTable/scripts/bundle.ts +8 -3
- package/src/components/DataTable/scripts/index.ts +182 -164
- package/src/components/DatePicker/DatePicker.stories.tsx +136 -148
- package/src/components/DatePicker/DatePicker.tsx +461 -420
- package/src/components/DatePicker/scripts/bundle.ts +12 -7
- package/src/components/DatePicker/scripts/componentInteractions.ts +76 -46
- package/src/components/DatePicker/scripts/index.ts +176 -156
- package/src/components/DatePicker/types.ts +32 -32
- package/src/components/DatePicker/utils.ts +41 -30
- package/src/components/Dropdown/Dropdown.stories.tsx +85 -55
- package/src/components/Dropdown/Dropdown.tsx +97 -88
- package/src/components/Dropdown/index.ts +5 -10
- package/src/components/Dropdown/scripts/bundle.ts +10 -10
- package/src/components/Dropdown/scripts/componentInteractions.ts +10 -2
- package/src/components/Dropdown/scripts/index.ts +122 -117
- package/src/components/EdgePanel/EdgePanel.stories.tsx +142 -58
- package/src/components/EdgePanel/EdgePanel.tsx +7 -13
- package/src/components/EdgePanel/index.ts +1 -1
- package/src/components/EdgePanel/scripts/bundle.ts +5 -5
- package/src/components/EdgePanel/scripts/edgePanelInteractions.ts +26 -26
- package/src/components/EdgePanel/scripts/index.ts +53 -53
- package/src/components/Form/Checkbox.stories.tsx +2 -2
- package/src/components/Form/Checkbox.tsx +13 -7
- package/src/components/Form/Form.stories.tsx +144 -218
- package/src/components/Form/Form.tsx +6 -6
- package/src/components/Form/FormGroup.stories.tsx +21 -38
- package/src/components/Form/FormGroup.tsx +18 -20
- package/src/components/Form/Input.stories.tsx +1 -1
- package/src/components/Form/Input.tsx +18 -8
- package/src/components/Form/Radio.stories.tsx +12 -25
- package/src/components/Form/Radio.tsx +11 -6
- package/src/components/Form/Select.stories.tsx +6 -6
- package/src/components/Form/Select.tsx +31 -33
- package/src/components/Form/Textarea.stories.tsx +7 -2
- package/src/components/Form/Textarea.tsx +17 -8
- package/src/components/Form/index.ts +1 -1
- package/src/components/Hero/Hero.stories.tsx +44 -42
- package/src/components/Hero/Hero.tsx +28 -38
- package/src/components/Hero/index.ts +1 -1
- package/src/components/Hero/scripts/bundle.ts +6 -6
- package/src/components/Hero/scripts/heroInteractions.ts +24 -29
- package/src/components/Hero/scripts/index.ts +16 -17
- package/src/components/Icon/Icon.tsx +16 -18
- package/src/components/Icon/index.ts +1 -1
- package/src/components/List/List.stories.tsx +1 -3
- package/src/components/List/List.tsx +6 -10
- package/src/components/List/ListGroup.tsx +1 -1
- package/src/components/List/index.ts +1 -1
- package/src/components/Messages/Messages.stories.tsx +30 -29
- package/src/components/Messages/Messages.tsx +60 -55
- package/src/components/Messages/index.ts +1 -1
- package/src/components/Messages/scripts/bundle.ts +1 -6
- package/src/components/Messages/scripts/componentInteractions.ts +32 -37
- package/src/components/Messages/scripts/index.ts +61 -55
- package/src/components/Modal/Modal.stories.tsx +77 -53
- package/src/components/Modal/Modal.tsx +63 -62
- package/src/components/Modal/index.ts +1 -1
- package/src/components/Modal/scripts/bundle.ts +3 -3
- package/src/components/Modal/scripts/index.ts +96 -84
- package/src/components/Modal/scripts/modalInteractions.ts +16 -14
- package/src/components/{Navbar → Navigation/Menu}/MegaMenu.tsx +50 -59
- package/src/components/Navigation/Menu/Menu.stories.tsx +340 -0
- package/src/components/Navigation/Menu/Menu.tsx +110 -0
- package/src/components/Navigation/Nav/Nav.stories.tsx +458 -0
- package/src/components/Navigation/Nav/Nav.tsx +50 -0
- package/src/components/Navigation/Nav/NavDropdown.tsx +105 -0
- package/src/components/Navigation/Nav/NavItem.tsx +159 -0
- package/src/components/{Navbar → Navigation/Navbar}/Navbar.stories.tsx +198 -104
- package/src/components/Navigation/Navbar/Navbar.tsx +150 -0
- package/src/components/Navigation/README.md +314 -0
- package/src/components/Navigation/SideMenu/SideMenu.README.md +494 -0
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +618 -0
- package/src/components/Navigation/SideMenu/SideMenu.tsx +101 -0
- package/src/components/Navigation/SideMenu/SideMenuItem.tsx +95 -0
- package/src/components/Navigation/SideMenu/SideMenuList.tsx +41 -0
- package/src/components/Navigation/index.ts +23 -0
- package/src/components/Navigation/scripts/NavbarInteractions.ts +171 -0
- package/src/components/Navigation/scripts/SideMenu.ts +319 -0
- package/src/components/Navigation/scripts/SideMenuBundle.ts +69 -0
- package/src/components/Navigation/scripts/SideMenuInteractions.ts +250 -0
- package/src/components/Navigation/scripts/bundle.ts +58 -0
- package/src/components/Navigation/scripts/index.ts +248 -0
- package/src/components/Pagination/Pagination.stories.tsx +34 -33
- package/src/components/Pagination/Pagination.tsx +25 -35
- package/src/components/Pagination/index.ts +1 -1
- package/src/components/Pagination/scripts/index.ts +42 -37
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +48 -48
- package/src/components/PhotoViewer/PhotoViewer.tsx +29 -46
- package/src/components/PhotoViewer/PhotoViewerHeader.tsx +20 -26
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +19 -17
- package/src/components/PhotoViewer/PhotoViewerInfo.tsx +13 -5
- package/src/components/PhotoViewer/PhotoViewerNavigation.tsx +5 -5
- package/src/components/PhotoViewer/PhotoViewerThumbnails.tsx +31 -30
- package/src/components/PhotoViewer/examples/ImageGallery.tsx +27 -37
- package/src/components/PhotoViewer/examples/SimpleGallery.tsx +19 -13
- package/src/components/PhotoViewer/examples/index.ts +1 -1
- package/src/components/PhotoViewer/index.ts +1 -1
- package/src/components/PhotoViewer/scripts/PhotoViewerInteractions.ts +43 -33
- package/src/components/PhotoViewer/scripts/bundle.ts +14 -14
- package/src/components/PhotoViewer/scripts/index.ts +173 -129
- package/src/components/Popover/Popover.stories.tsx +11 -12
- package/src/components/Popover/Popover.tsx +36 -36
- package/src/components/Popover/index.ts +1 -1
- package/src/components/Popover/scripts/bundle.ts +1 -1
- package/src/components/Popover/scripts/componentInteractions.ts +34 -46
- package/src/components/Popover/scripts/index.ts +64 -53
- package/src/components/ProductReview/ProductReview.stories.tsx +10 -8
- package/src/components/ProductReview/ProductReview.tsx +28 -32
- package/src/components/ProductReview/scripts/componentInteractions.ts +20 -20
- package/src/components/Progress/Progress.tsx +36 -34
- package/src/components/Progress/scripts/bundle.ts +7 -2
- package/src/components/Progress/scripts/componentInteractions.ts +29 -23
- package/src/components/Progress/scripts/index.ts +45 -39
- package/src/components/Rating/Rating.stories.tsx +3 -16
- package/src/components/Rating/Rating.tsx +250 -231
- package/src/components/Rating/scripts/bundle.ts +11 -6
- package/src/components/Rating/scripts/index.ts +85 -80
- package/src/components/Rating/scripts/ratingInteractions.ts +27 -24
- package/src/components/River/River.stories.tsx +70 -24
- package/src/components/River/River.tsx +28 -38
- package/src/components/River/index.ts +1 -1
- package/src/components/River/scripts/index.ts +11 -12
- package/src/components/SectionIntro/SectionIntro.stories.tsx +12 -9
- package/src/components/SectionIntro/SectionIntro.tsx +25 -31
- package/src/components/SectionIntro/scripts/componentInteractions.ts +1 -1
- package/src/components/SectionIntro/scripts/index.ts +30 -16
- package/src/components/Spinner/Spinner.stories.tsx +5 -7
- package/src/components/Spinner/Spinner.tsx +11 -6
- package/src/components/Spinner/index.ts +2 -2
- package/src/components/Steps/Steps.stories.tsx +44 -48
- package/src/components/Steps/Steps.tsx +20 -20
- package/src/components/Steps/index.ts +1 -1
- package/src/components/Steps/scripts/index.ts +9 -9
- package/src/components/Tab/Tab.stories.tsx +14 -6
- package/src/components/Tab/Tab.tsx +16 -18
- package/src/components/Tab/index.ts +2 -2
- package/src/components/Tab/scripts/index.ts +13 -13
- package/src/components/Testimonial/Testimonial.stories.tsx +54 -51
- package/src/components/Testimonial/Testimonial.tsx +18 -19
- package/src/components/Testimonial/index.ts +1 -1
- package/src/components/Testimonial/scripts/index.ts +19 -8
- package/src/components/Todo/Todo.stories.tsx +7 -24
- package/src/components/Todo/Todo.tsx +35 -46
- package/src/components/Todo/index.ts +1 -1
- package/src/components/Todo/scripts/bundle.ts +1 -1
- package/src/components/Todo/scripts/index.ts +99 -81
- package/src/components/Todo/scripts/todoInteractions.ts +12 -12
- package/src/components/Todo/scripts/types.ts +3 -3
- package/src/components/Toggle/Toggle.stories.tsx +2 -2
- package/src/components/Toggle/Toggle.tsx +18 -18
- package/src/components/Toggle/index.ts +2 -2
- package/src/components/Toggle/scripts/bundle.ts +7 -2
- package/src/components/Toggle/scripts/index.ts +14 -10
- package/src/components/Toggle/scripts/toggleInteractions.ts +11 -14
- package/src/components/Tooltip/Tooltip.stories.tsx +13 -6
- package/src/components/Tooltip/Tooltip.tsx +25 -15
- package/src/components/Tooltip/index.ts +3 -3
- package/src/components/Tooltip/scripts/bundle.ts +0 -1
- package/src/components/Tooltip/scripts/index.ts +44 -41
- package/src/components/Tooltip/scripts/tooltipInteractions.ts +22 -22
- package/src/components/Upload/Upload.stories.tsx +28 -34
- package/src/components/Upload/Upload.tsx +86 -71
- package/src/components/Upload/index.ts +1 -1
- package/src/components/Upload/scripts/index.ts +58 -43
- package/src/components/index.ts +5 -6
- package/src/design-tokens/BoxShadow/BoxShadow.stories.tsx +13 -10
- package/src/design-tokens/Colors/colors.scss +10 -7
- package/src/design-tokens/Colors/colors.stories.tsx +46 -59
- package/src/design-tokens/Spacing/Spacing.scss +7 -5
- package/src/design-tokens/Spacing/Spacing.stories.tsx +19 -18
- package/src/design-tokens/Typography/Typography.scss +88 -25
- package/src/design-tokens/Typography/Typography.stories.tsx +22 -25
- package/src/docs/implementation-guide.mdx +2 -2
- package/src/htmlComponentsEntry.ts +23 -23
- package/src/index.ts +1 -1
- package/src/layouts/Grid/Container.tsx +6 -10
- package/src/layouts/Grid/Grid.stories.tsx +72 -34
- package/src/layouts/Grid/Grid.tsx +6 -13
- package/src/layouts/Grid/GridCol.tsx +29 -26
- package/src/layouts/Grid/Row.tsx +6 -13
- package/src/layouts/MasonryGrid/MasonryGrid.stories.tsx +79 -72
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +23 -25
- package/src/layouts/MasonryGrid/MasonryGridItem.tsx +4 -12
- package/src/layouts/index.ts +3 -4
- package/src/lib/composables/index.ts +3 -3
- package/src/lib/composables/useAccordion.ts +15 -6
- package/src/lib/composables/useBadge.ts +3 -3
- package/src/lib/composables/useBreadcrumb.ts +6 -12
- package/src/lib/composables/useButton.ts +3 -3
- package/src/lib/composables/useCallout.ts +3 -3
- package/src/lib/composables/useCard.ts +50 -28
- package/src/lib/composables/useCheckbox.ts +7 -7
- package/src/lib/composables/useDataTable.ts +61 -57
- package/src/lib/composables/useDatePicker.ts +255 -231
- package/src/lib/composables/useDropdown.ts +90 -75
- package/src/lib/composables/useEdgePanel.ts +50 -47
- package/src/lib/composables/useForm.ts +4 -7
- package/src/lib/composables/useFormGroup.ts +11 -12
- package/src/lib/composables/useHero.ts +36 -38
- package/src/lib/composables/useInput.ts +9 -10
- package/src/lib/composables/useMessages.ts +12 -14
- package/src/lib/composables/useModal.ts +37 -34
- package/src/lib/composables/useNavbar.ts +33 -22
- package/src/lib/composables/usePagination.ts +3 -10
- package/src/lib/composables/usePhotoViewer.ts +625 -578
- package/src/lib/composables/usePopover.ts +68 -62
- package/src/lib/composables/useProgress.ts +9 -12
- package/src/lib/composables/useRadio.ts +4 -4
- package/src/lib/composables/useRating.ts +82 -70
- package/src/lib/composables/useRiver.ts +28 -31
- package/src/lib/composables/useSelect.ts +7 -8
- package/src/lib/composables/useSideMenu.ts +197 -0
- package/src/lib/composables/useSpinner.ts +3 -3
- package/src/lib/composables/useTextarea.ts +8 -9
- package/src/lib/composables/useTodo.ts +14 -18
- package/src/lib/constants/components.ts +191 -118
- package/src/lib/constants/index.ts +1 -1
- package/src/lib/types/components.ts +454 -324
- package/src/lib/utils/dom.ts +2 -6
- package/src/lib/utils/icons.ts +20 -12
- package/src/lib/utils/index.ts +2 -2
- package/src/lib/utils/useForkRef.ts +1 -2
- package/src/styles/01-settings/_index.scss +59 -59
- package/src/styles/01-settings/_settings.accordion.scss +21 -21
- package/src/styles/01-settings/_settings.animations.scss +2 -2
- package/src/styles/01-settings/_settings.avatar-group.scss +14 -14
- package/src/styles/01-settings/_settings.avatar.scss +31 -31
- package/src/styles/01-settings/_settings.badge.scss +11 -11
- package/src/styles/01-settings/_settings.border-radius.scss +10 -9
- package/src/styles/01-settings/_settings.border.scss +7 -7
- package/src/styles/01-settings/_settings.box-shadow.scss +24 -12
- package/src/styles/01-settings/_settings.breadcrumb.scss +18 -18
- package/src/styles/01-settings/_settings.btn-group.scss +1 -1
- package/src/styles/01-settings/_settings.button.scss +63 -49
- package/src/styles/01-settings/_settings.callout.scss +27 -7
- package/src/styles/01-settings/_settings.card.scss +27 -30
- package/src/styles/01-settings/_settings.checkbox-group.scss +2 -3
- package/src/styles/01-settings/_settings.checkbox.scss +17 -18
- package/src/styles/01-settings/_settings.color-mode.scss +1 -1
- package/src/styles/01-settings/_settings.colors.scss +197 -214
- package/src/styles/01-settings/_settings.config.scss +1 -3
- package/src/styles/01-settings/_settings.countdown.scss +14 -14
- package/src/styles/01-settings/_settings.data-table.scss +6 -6
- package/src/styles/01-settings/_settings.datepicker.scss +40 -42
- package/src/styles/01-settings/_settings.dropdown.scss +30 -30
- package/src/styles/01-settings/_settings.edge-panel.scss +16 -16
- package/src/styles/01-settings/_settings.fonts.scss +14 -12
- package/src/styles/01-settings/_settings.form-group.scss +10 -10
- package/src/styles/01-settings/_settings.form.scss +3 -3
- package/src/styles/01-settings/_settings.grid.scss +1 -1
- package/src/styles/01-settings/_settings.hero.scss +23 -23
- package/src/styles/01-settings/_settings.input.scss +32 -32
- package/src/styles/01-settings/_settings.link.scss +6 -6
- package/src/styles/01-settings/_settings.list-group.scss +12 -12
- package/src/styles/01-settings/_settings.list.scss +2 -2
- package/src/styles/01-settings/_settings.maps.scss +183 -188
- package/src/styles/01-settings/_settings.masonry-grid.scss +2 -2
- package/src/styles/01-settings/_settings.menu.scss +35 -38
- package/src/styles/01-settings/_settings.messages.scss +71 -77
- package/src/styles/01-settings/_settings.modal.scss +24 -24
- package/src/styles/01-settings/_settings.nav.scss +15 -15
- package/src/styles/01-settings/_settings.navbar.scss +39 -12
- package/src/styles/01-settings/_settings.pagination.scss +21 -21
- package/src/styles/01-settings/_settings.photoviewer.scss +1 -1
- package/src/styles/01-settings/_settings.popover.scss +3 -3
- package/src/styles/01-settings/_settings.position.scss +2 -2
- package/src/styles/01-settings/_settings.progress.scss +15 -18
- package/src/styles/01-settings/_settings.rating.scss +7 -7
- package/src/styles/01-settings/_settings.river.scss +25 -25
- package/src/styles/01-settings/_settings.sectionintro.scss +15 -16
- package/src/styles/01-settings/_settings.select.scss +31 -31
- package/src/styles/01-settings/_settings.side-menu.scss +64 -16
- package/src/styles/01-settings/_settings.skeleton.scss +12 -12
- package/src/styles/01-settings/_settings.spacing.scss +62 -33
- package/src/styles/01-settings/_settings.spinner.scss +10 -10
- package/src/styles/01-settings/_settings.steps.scss +22 -22
- package/src/styles/01-settings/_settings.tabs.scss +25 -25
- package/src/styles/01-settings/_settings.testimonials.scss +17 -19
- package/src/styles/01-settings/_settings.todo.scss +1 -1
- package/src/styles/01-settings/_settings.toggle.scss +26 -26
- package/src/styles/01-settings/_settings.tooltip.scss +15 -15
- package/src/styles/01-settings/_settings.typography.scss +65 -48
- package/src/styles/01-settings/_settings.upload.scss +70 -77
- package/src/styles/01-settings/_settings.z-layers.scss +1 -1
- package/src/styles/02-tools/_index.scss +19 -19
- package/src/styles/02-tools/_tools.animations.scss +4 -4
- package/src/styles/02-tools/_tools.border-radius.scss +4 -5
- package/src/styles/02-tools/_tools.breakpoints.scss +33 -34
- package/src/styles/02-tools/_tools.button.scss +49 -25
- package/src/styles/02-tools/_tools.color-mode.scss +11 -11
- package/src/styles/02-tools/_tools.event.scss +1 -1
- package/src/styles/02-tools/_tools.hidden-visually.scss +1 -1
- package/src/styles/02-tools/_tools.hidden.scss +1 -1
- package/src/styles/02-tools/_tools.map-loop.scss +9 -9
- package/src/styles/02-tools/_tools.media-queries.scss +5 -3
- package/src/styles/02-tools/_tools.object-fit.scss +3 -3
- package/src/styles/02-tools/_tools.placeholder.scss +0 -1
- package/src/styles/02-tools/_tools.rem.scss +1 -1
- package/src/styles/02-tools/_tools.spacing.scss +8 -34
- package/src/styles/02-tools/_tools.to-rgb.scss +3 -3
- package/src/styles/02-tools/_tools.transition.scss +1 -1
- package/src/styles/02-tools/_tools.utility-api.scss +29 -14
- package/src/styles/03-generic/_generic.fonts.scss +0 -1
- package/src/styles/03-generic/_generic.reset.scss +13 -8
- package/src/styles/03-generic/_generic.root.scss +5 -5
- package/src/styles/03-generic/_index.scss +4 -4
- package/src/styles/04-elements/_elements.all.scss +2 -2
- package/src/styles/04-elements/_elements.body.scss +1 -2
- package/src/styles/04-elements/_elements.heading.scss +37 -21
- package/src/styles/04-elements/_elements.links.scss +0 -1
- package/src/styles/04-elements/_index.scss +5 -5
- package/src/styles/05-objects/_index.scss +3 -3
- package/src/styles/05-objects/_objects.container.scss +5 -4
- package/src/styles/05-objects/_objects.grid.scss +12 -12
- package/src/styles/05-objects/_objects.masonry-grid.scss +80 -74
- package/src/styles/06-components/_components.accordion.scss +12 -6
- package/src/styles/06-components/_components.avatar-group.scss +9 -8
- package/src/styles/06-components/_components.avatar.scss +78 -77
- package/src/styles/06-components/_components.badge.scss +48 -48
- package/src/styles/06-components/_components.breadcrumb.scss +57 -58
- package/src/styles/06-components/_components.btn-group.scss +22 -22
- package/src/styles/06-components/_components.button.scss +118 -110
- package/src/styles/06-components/_components.callout.scss +21 -15
- package/src/styles/06-components/_components.card.scss +6 -10
- package/src/styles/06-components/_components.checkbox-group.scss +9 -10
- package/src/styles/06-components/_components.checkbox.scss +10 -17
- package/src/styles/06-components/_components.color-mode-toggle.scss +6 -6
- package/src/styles/06-components/_components.countdown.scss +53 -54
- package/src/styles/06-components/_components.data-table.scss +40 -36
- package/src/styles/06-components/_components.datepicker.scss +95 -73
- package/src/styles/06-components/_components.dropdown.scss +15 -9
- package/src/styles/06-components/_components.edge-panel.scss +87 -46
- package/src/styles/06-components/_components.form-group.scss +5 -4
- package/src/styles/06-components/_components.hero.scss +128 -132
- package/src/styles/06-components/_components.icon.scss +16 -16
- package/src/styles/06-components/_components.image-gallery.scss +9 -7
- package/src/styles/06-components/_components.input.scss +18 -16
- package/src/styles/06-components/_components.list-group.scss +52 -51
- package/src/styles/06-components/_components.list.scss +15 -15
- package/src/styles/06-components/_components.menu.scss +225 -220
- package/src/styles/06-components/_components.messages.scss +45 -32
- package/src/styles/06-components/_components.modal.scss +0 -1
- package/src/styles/06-components/_components.nav.scss +56 -11
- package/src/styles/06-components/_components.navbar.scss +278 -202
- package/src/styles/06-components/_components.pagination.scss +7 -6
- package/src/styles/06-components/_components.photoviewer.scss +121 -116
- package/src/styles/06-components/_components.popover.scss +10 -10
- package/src/styles/06-components/_components.product-review.scss +3 -3
- package/src/styles/06-components/_components.progress.scss +32 -35
- package/src/styles/06-components/_components.rating.scss +9 -8
- package/src/styles/06-components/_components.river.scss +4 -2
- package/src/styles/06-components/_components.sectionintro.scss +19 -26
- package/src/styles/06-components/_components.select.scss +7 -8
- package/src/styles/06-components/_components.side-menu.scss +154 -28
- package/src/styles/06-components/_components.skeleton.scss +0 -1
- package/src/styles/06-components/_components.spinner.scss +2 -4
- package/src/styles/06-components/_components.steps.scss +76 -77
- package/src/styles/06-components/_components.tabs.scss +17 -12
- package/src/styles/06-components/_components.testimonials.scss +49 -52
- package/src/styles/06-components/_components.todo.scss +26 -26
- package/src/styles/06-components/_components.tooltip.scss +114 -115
- package/src/styles/06-components/_components.upload.scss +8 -18
- package/src/styles/06-components/_index.scss +48 -48
- package/src/styles/99-utilities/_index.scss +18 -18
- package/src/styles/99-utilities/_utilities.background.scss +13 -13
- package/src/styles/99-utilities/_utilities.border.scss +30 -30
- package/src/styles/99-utilities/_utilities.clearfix.scss +1 -1
- package/src/styles/99-utilities/_utilities.display.scss +5 -4
- package/src/styles/99-utilities/_utilities.flex.scss +19 -19
- package/src/styles/99-utilities/_utilities.link.scss +52 -35
- package/src/styles/99-utilities/_utilities.object-fit.scss +3 -3
- package/src/styles/99-utilities/_utilities.opacity.scss +6 -6
- package/src/styles/99-utilities/_utilities.overflow.scss +4 -4
- package/src/styles/99-utilities/_utilities.position.scss +8 -8
- package/src/styles/99-utilities/_utilities.shadow.scss +13 -13
- package/src/styles/99-utilities/_utilities.sizes.scss +17 -17
- package/src/styles/99-utilities/_utilities.spacing.scss +72 -37
- package/src/styles/99-utilities/_utilities.text.scss +15 -15
- package/src/styles/99-utilities/_utilities.visibility.scss +8 -8
- package/src/styles/99-utilities/_utilities.visually-hidden.scss +1 -1
- package/src/styles/99-utilities/_utilities.z-index.scss +2 -2
- package/tsconfig.json +74 -0
- package/webpack.config.js +463 -0
- package/NPM_PUBLISHING.md +0 -221
- package/dist/css/atomix.css.map +0 -1
- package/dist/js/194.js.map +0 -1
- package/dist/js/atomix.react.esm.js.map +0 -1
- package/dist/js/atomix.react.umd.js.map +0 -1
- package/dist/js/chunks/esm/202.ff48d27672233280e021.js.map +0 -1
- package/dist/js/chunks/esm/308.f873332126eba90e5c62.js.map +0 -1
- package/dist/js/chunks/esm/54.4db919e5e4e5cc6d7c72.js.map +0 -1
- package/dist/js/chunks/esm/619.afc5a718eff77fa423b5.js.map +0 -1
- package/dist/js/chunks/esm/690.a9e968c7497d61e56cdc.js.map +0 -1
- package/dist/js/chunks/esm/894.f1091a4a8758c26d29e4.js.map +0 -1
- package/dist/js/chunks/esm/897.561a50f7d043d42169da.js.map +0 -1
- package/dist/js/chunks/umd/202.dac7605cc555b6bda542.js.map +0 -1
- package/dist/js/chunks/umd/308.6709979849dcbdb90c9b.js.map +0 -1
- package/dist/js/chunks/umd/54.403470e1f7d0ef4424a7.js.map +0 -1
- package/dist/js/chunks/umd/619.fa05ea98c10270eb64c5.js.map +0 -1
- package/dist/js/chunks/umd/690.aa7054d1c53e5402c2d6.js.map +0 -1
- package/dist/js/chunks/umd/894.3e1eaf0a2aadf4434390.js.map +0 -1
- package/dist/js/chunks/umd/897.554ea37be4453698c167.js.map +0 -1
- package/dist/types/components/Navbar/Nav.d.ts +0 -5
- package/dist/types/components/Navbar/NavItem.d.ts +0 -5
- package/dist/types/components/Navbar/Navbar.d.ts +0 -5
- package/dist/types/components/Navbar/index.d.ts +0 -6
- package/src/components/Navbar/Menu.tsx +0 -122
- package/src/components/Navbar/Nav.tsx +0 -35
- package/src/components/Navbar/NavDropdown.tsx +0 -108
- package/src/components/Navbar/NavItem.tsx +0 -128
- package/src/components/Navbar/Navbar.tsx +0 -124
- package/src/components/Navbar/index.ts +0 -6
|
@@ -54,7 +54,7 @@ interface TimeParts {
|
|
|
54
54
|
export default class Countdown implements CountdownInstance {
|
|
55
55
|
// DOM element
|
|
56
56
|
private element: HTMLElement;
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
// Options and state
|
|
59
59
|
private options: CountdownOptions;
|
|
60
60
|
private completed: boolean = false;
|
|
@@ -67,17 +67,16 @@ export default class Countdown implements CountdownInstance {
|
|
|
67
67
|
*/
|
|
68
68
|
constructor(element: string | HTMLElement, options: Partial<CountdownOptions> = {}) {
|
|
69
69
|
// Get element reference
|
|
70
|
-
this.element =
|
|
71
|
-
? document.querySelector(element) as HTMLElement
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
this.element =
|
|
71
|
+
typeof element === 'string' ? (document.querySelector(element) as HTMLElement) : element;
|
|
72
|
+
|
|
74
73
|
if (!this.element) {
|
|
75
74
|
throw new Error('Countdown: element not found');
|
|
76
75
|
}
|
|
77
|
-
|
|
76
|
+
|
|
78
77
|
// Merge default options with provided options
|
|
79
78
|
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
80
|
-
|
|
79
|
+
|
|
81
80
|
// Initialize the component
|
|
82
81
|
this._initialize();
|
|
83
82
|
}
|
|
@@ -103,14 +102,17 @@ export default class Countdown implements CountdownInstance {
|
|
|
103
102
|
*/
|
|
104
103
|
private _render(): void {
|
|
105
104
|
const now = new Date();
|
|
106
|
-
const targetDate =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
const targetDate =
|
|
106
|
+
this.options.target !== undefined
|
|
107
|
+
? typeof this.options.target === 'string'
|
|
108
|
+
? new Date(this.options.target)
|
|
109
|
+
: this.options.target
|
|
110
|
+
: (DEFAULT_OPTIONS.target as Date);
|
|
111
|
+
|
|
110
112
|
const diff = targetDate.getTime() - now.getTime();
|
|
111
113
|
const { days, hours, minutes, seconds } = this._getTimeParts(diff);
|
|
112
114
|
const show = this.options.show || DEFAULT_OPTIONS.show!;
|
|
113
|
-
|
|
115
|
+
|
|
114
116
|
const timeParts: { label: string; value: number }[] = [];
|
|
115
117
|
if (show.includes('days')) timeParts.push({ label: 'Days', value: days });
|
|
116
118
|
if (show.includes('hours')) timeParts.push({ label: 'Hours', value: hours });
|
|
@@ -121,7 +123,7 @@ export default class Countdown implements CountdownInstance {
|
|
|
121
123
|
const rootClass = `${COUNTDOWN.CLASSES.BASE}${
|
|
122
124
|
this.options.focused ? ' ' + COUNTDOWN.CLASSES.FOCUSED : ''
|
|
123
125
|
}${this.options.className ? ' ' + this.options.className : ''}`;
|
|
124
|
-
|
|
126
|
+
|
|
125
127
|
// Build HTML
|
|
126
128
|
let html = `<div class="${rootClass.trim()}">`;
|
|
127
129
|
timeParts.forEach((part, idx) => {
|
|
@@ -136,7 +138,7 @@ export default class Countdown implements CountdownInstance {
|
|
|
136
138
|
}
|
|
137
139
|
});
|
|
138
140
|
html += '</div>';
|
|
139
|
-
|
|
141
|
+
|
|
140
142
|
this.element.innerHTML = html;
|
|
141
143
|
}
|
|
142
144
|
|
|
@@ -157,12 +159,15 @@ export default class Countdown implements CountdownInstance {
|
|
|
157
159
|
private _start(): void {
|
|
158
160
|
this.interval = window.setInterval(() => {
|
|
159
161
|
const now = new Date();
|
|
160
|
-
const targetDate =
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
const targetDate =
|
|
163
|
+
this.options.target !== undefined
|
|
164
|
+
? typeof this.options.target === 'string'
|
|
165
|
+
? new Date(this.options.target)
|
|
166
|
+
: this.options.target
|
|
167
|
+
: (DEFAULT_OPTIONS.target as Date);
|
|
168
|
+
|
|
164
169
|
const diff = targetDate.getTime() - now.getTime();
|
|
165
|
-
|
|
170
|
+
|
|
166
171
|
if (diff <= 0 && !this.completed) {
|
|
167
172
|
this.completed = true;
|
|
168
173
|
if (this.interval !== null) clearInterval(this.interval);
|
|
@@ -172,7 +177,7 @@ export default class Countdown implements CountdownInstance {
|
|
|
172
177
|
this._render();
|
|
173
178
|
}
|
|
174
179
|
}, 1000);
|
|
175
|
-
|
|
180
|
+
|
|
176
181
|
this._render();
|
|
177
182
|
}
|
|
178
183
|
|
|
@@ -185,7 +190,7 @@ export default class Countdown implements CountdownInstance {
|
|
|
185
190
|
clearInterval(this.interval);
|
|
186
191
|
this.interval = null;
|
|
187
192
|
}
|
|
188
|
-
|
|
193
|
+
|
|
189
194
|
this.element.innerHTML = '';
|
|
190
195
|
}
|
|
191
196
|
|
|
@@ -200,11 +205,11 @@ export default class Countdown implements CountdownInstance {
|
|
|
200
205
|
return Array.from(elements).map(element => {
|
|
201
206
|
// Try to get options from data attributes
|
|
202
207
|
const options: CountdownOptions = {};
|
|
203
|
-
|
|
208
|
+
|
|
204
209
|
// Get target date/time
|
|
205
210
|
const target = element.getAttribute('data-target');
|
|
206
211
|
if (target) options.target = target;
|
|
207
|
-
|
|
212
|
+
|
|
208
213
|
// Get show parts
|
|
209
214
|
const showAttr = element.getAttribute('data-show');
|
|
210
215
|
if (showAttr) {
|
|
@@ -214,20 +219,20 @@ export default class Countdown implements CountdownInstance {
|
|
|
214
219
|
console.error('Countdown: Error parsing show data attribute', e);
|
|
215
220
|
}
|
|
216
221
|
}
|
|
217
|
-
|
|
222
|
+
|
|
218
223
|
// Get separator
|
|
219
224
|
const separator = element.getAttribute('data-separator');
|
|
220
225
|
if (separator) options.separator = separator;
|
|
221
|
-
|
|
226
|
+
|
|
222
227
|
// Get focused state
|
|
223
228
|
const focused = element.getAttribute('data-focused');
|
|
224
229
|
options.focused = focused === 'true';
|
|
225
|
-
|
|
230
|
+
|
|
226
231
|
// Get className
|
|
227
232
|
const className = element.getAttribute('data-class-name');
|
|
228
233
|
if (className) options.className = className;
|
|
229
|
-
|
|
234
|
+
|
|
230
235
|
return new Countdown(element as HTMLElement, options);
|
|
231
236
|
});
|
|
232
237
|
}
|
|
233
|
-
}
|
|
238
|
+
}
|
|
@@ -32,13 +32,13 @@ type Story = StoryObj<typeof DataTable>;
|
|
|
32
32
|
const generateUsers = (count: number) => {
|
|
33
33
|
const roles = ['Admin', 'User', 'Editor', 'Manager', 'Guest'];
|
|
34
34
|
const statuses = ['Active', 'Inactive', 'Pending', 'Suspended'];
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
return Array.from({ length: count }, (_, i) => ({
|
|
37
37
|
id: i + 1,
|
|
38
38
|
name: `User ${i + 1}`,
|
|
39
39
|
email: `user${i + 1}@example.com`,
|
|
40
40
|
role: roles[Math.floor(Math.random() * roles.length)],
|
|
41
|
-
status: statuses[Math.floor(Math.random() * statuses.length)]
|
|
41
|
+
status: statuses[Math.floor(Math.random() * statuses.length)],
|
|
42
42
|
}));
|
|
43
43
|
};
|
|
44
44
|
|
|
@@ -67,9 +67,9 @@ const columns: DataTableColumn[] = [
|
|
|
67
67
|
{ key: 'name', title: 'Name', sortable: true },
|
|
68
68
|
{ key: 'email', title: 'Email', sortable: true },
|
|
69
69
|
{ key: 'role', title: 'Role', sortable: true },
|
|
70
|
-
{
|
|
71
|
-
key: 'status',
|
|
72
|
-
title: 'Status',
|
|
70
|
+
{
|
|
71
|
+
key: 'status',
|
|
72
|
+
title: 'Status',
|
|
73
73
|
sortable: true,
|
|
74
74
|
render: (value, row) => {
|
|
75
75
|
let color = '';
|
|
@@ -88,7 +88,7 @@ const columns: DataTableColumn[] = [
|
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
90
|
return <span style={{ color }}>{value}</span>;
|
|
91
|
-
}
|
|
91
|
+
},
|
|
92
92
|
},
|
|
93
93
|
];
|
|
94
94
|
|
|
@@ -129,7 +129,7 @@ export const Paginated: Story = {
|
|
|
129
129
|
parameters: {
|
|
130
130
|
docs: {
|
|
131
131
|
description: {
|
|
132
|
-
story: 'A paginated table with standard pagination controls below the table.'
|
|
132
|
+
story: 'A paginated table with standard pagination controls below the table.',
|
|
133
133
|
},
|
|
134
134
|
},
|
|
135
135
|
},
|
|
@@ -146,7 +146,8 @@ export const PaginatedLargeDataset: Story = {
|
|
|
146
146
|
parameters: {
|
|
147
147
|
docs: {
|
|
148
148
|
description: {
|
|
149
|
-
story:
|
|
149
|
+
story:
|
|
150
|
+
'Pagination with a large dataset (100 items) demonstrating first/last buttons and ellipsis.',
|
|
150
151
|
},
|
|
151
152
|
},
|
|
152
153
|
},
|
|
@@ -167,7 +168,7 @@ export const CompleteFeatures: Story = {
|
|
|
167
168
|
parameters: {
|
|
168
169
|
docs: {
|
|
169
170
|
description: {
|
|
170
|
-
story: 'A complete data table with sorting, filtering, and pagination enabled.'
|
|
171
|
+
story: 'A complete data table with sorting, filtering, and pagination enabled.',
|
|
171
172
|
},
|
|
172
173
|
},
|
|
173
174
|
},
|
|
@@ -214,21 +215,25 @@ export const Loading: Story = {
|
|
|
214
215
|
|
|
215
216
|
// Interactive example with row click handler
|
|
216
217
|
export const Interactive: Story = {
|
|
217
|
-
render:
|
|
218
|
+
render: args => {
|
|
218
219
|
const [selectedUser, setSelectedUser] = useState<any>(null);
|
|
219
|
-
|
|
220
|
+
|
|
220
221
|
const handleRowClick = (row: any) => {
|
|
221
222
|
setSelectedUser(row);
|
|
222
223
|
};
|
|
223
|
-
|
|
224
|
+
|
|
224
225
|
return (
|
|
225
226
|
<div>
|
|
226
|
-
<DataTable
|
|
227
|
-
{...args}
|
|
228
|
-
onRowClick={handleRowClick}
|
|
229
|
-
/>
|
|
227
|
+
<DataTable {...args} onRowClick={handleRowClick} />
|
|
230
228
|
{selectedUser && (
|
|
231
|
-
<div
|
|
229
|
+
<div
|
|
230
|
+
style={{
|
|
231
|
+
marginTop: '1rem',
|
|
232
|
+
padding: '1rem',
|
|
233
|
+
border: '1px solid #ccc',
|
|
234
|
+
borderRadius: '4px',
|
|
235
|
+
}}
|
|
236
|
+
>
|
|
232
237
|
<h3>Selected User:</h3>
|
|
233
238
|
<pre>{JSON.stringify(selectedUser, null, 2)}</pre>
|
|
234
239
|
</div>
|
|
@@ -241,4 +246,4 @@ export const Interactive: Story = {
|
|
|
241
246
|
columns,
|
|
242
247
|
sortable: true,
|
|
243
248
|
},
|
|
244
|
-
};
|
|
249
|
+
};
|
|
@@ -8,10 +8,10 @@ import { Pagination } from '../Pagination/Pagination';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* DataTable - A flexible and accessible data table component
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```tsx
|
|
14
|
-
* <DataTable
|
|
14
|
+
* <DataTable
|
|
15
15
|
* data={users}
|
|
16
16
|
* columns={columns}
|
|
17
17
|
* sortable={true}
|
|
@@ -37,7 +37,7 @@ export const DataTable: React.FC<DataTableProps> = ({
|
|
|
37
37
|
...props
|
|
38
38
|
}) => {
|
|
39
39
|
const tableRef = useRef<HTMLTableElement>(null);
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
const {
|
|
42
42
|
displayData,
|
|
43
43
|
sortConfig,
|
|
@@ -54,7 +54,7 @@ export const DataTable: React.FC<DataTableProps> = ({
|
|
|
54
54
|
pageSize,
|
|
55
55
|
onSort,
|
|
56
56
|
});
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
// Generate component classes
|
|
59
59
|
const tableClass = [
|
|
60
60
|
DATA_TABLE_CLASSES.base,
|
|
@@ -62,28 +62,40 @@ export const DataTable: React.FC<DataTableProps> = ({
|
|
|
62
62
|
bordered && DATA_TABLE_CLASSES.bordered,
|
|
63
63
|
dense && DATA_TABLE_CLASSES.dense,
|
|
64
64
|
loading && DATA_TABLE_CLASSES.loading,
|
|
65
|
-
className
|
|
66
|
-
]
|
|
67
|
-
|
|
65
|
+
className,
|
|
66
|
+
]
|
|
67
|
+
.filter(Boolean)
|
|
68
|
+
.join(' ');
|
|
69
|
+
|
|
68
70
|
const renderHeader = () => {
|
|
69
71
|
return (
|
|
70
72
|
<thead className={DATA_TABLE_CLASSES.header}>
|
|
71
73
|
<tr>
|
|
72
74
|
{columns.map((column, index) => (
|
|
73
|
-
<th
|
|
75
|
+
<th
|
|
74
76
|
key={`header-${index}`}
|
|
75
77
|
className={`${DATA_TABLE_CLASSES.headerCell} ${column.sortable !== false && sortable ? DATA_TABLE_CLASSES.sortable : ''}`}
|
|
76
|
-
onClick={() =>
|
|
77
|
-
|
|
78
|
+
onClick={() =>
|
|
79
|
+
column.sortable !== false && sortable ? handleSort(column.key) : null
|
|
80
|
+
}
|
|
81
|
+
aria-sort={
|
|
82
|
+
sortConfig?.key === column.key
|
|
83
|
+
? sortConfig.direction === 'asc'
|
|
84
|
+
? 'ascending'
|
|
85
|
+
: 'descending'
|
|
86
|
+
: undefined
|
|
87
|
+
}
|
|
78
88
|
>
|
|
79
89
|
<div className={DATA_TABLE_CLASSES.headerContent}>
|
|
80
90
|
<span>{column.title}</span>
|
|
81
91
|
{column.sortable !== false && sortable && (
|
|
82
92
|
<span className={DATA_TABLE_CLASSES.sortIcon}>
|
|
83
93
|
{sortConfig?.key === column.key ? (
|
|
84
|
-
sortConfig.direction === 'asc' ?
|
|
85
|
-
<Icon name="CaretUp" size="sm" />
|
|
94
|
+
sortConfig.direction === 'asc' ? (
|
|
95
|
+
<Icon name="CaretUp" size="sm" />
|
|
96
|
+
) : (
|
|
86
97
|
<Icon name="CaretDown" size="sm" />
|
|
98
|
+
)
|
|
87
99
|
) : null}
|
|
88
100
|
</span>
|
|
89
101
|
)}
|
|
@@ -94,16 +106,13 @@ export const DataTable: React.FC<DataTableProps> = ({
|
|
|
94
106
|
</thead>
|
|
95
107
|
);
|
|
96
108
|
};
|
|
97
|
-
|
|
109
|
+
|
|
98
110
|
const renderBody = () => {
|
|
99
111
|
if (loading) {
|
|
100
112
|
return (
|
|
101
113
|
<tbody>
|
|
102
114
|
<tr>
|
|
103
|
-
<td
|
|
104
|
-
colSpan={columns.length}
|
|
105
|
-
className={DATA_TABLE_CLASSES.loadingCell}
|
|
106
|
-
>
|
|
115
|
+
<td colSpan={columns.length} className={DATA_TABLE_CLASSES.loadingCell}>
|
|
107
116
|
<div className={DATA_TABLE_CLASSES.loadingIndicator}>
|
|
108
117
|
<Spinner size="md" variant="primary" />
|
|
109
118
|
</div>
|
|
@@ -112,26 +121,23 @@ export const DataTable: React.FC<DataTableProps> = ({
|
|
|
112
121
|
</tbody>
|
|
113
122
|
);
|
|
114
123
|
}
|
|
115
|
-
|
|
124
|
+
|
|
116
125
|
if (displayData.length === 0) {
|
|
117
126
|
return (
|
|
118
127
|
<tbody>
|
|
119
128
|
<tr>
|
|
120
|
-
<td
|
|
121
|
-
colSpan={columns.length}
|
|
122
|
-
className={DATA_TABLE_CLASSES.emptyCell}
|
|
123
|
-
>
|
|
129
|
+
<td colSpan={columns.length} className={DATA_TABLE_CLASSES.emptyCell}>
|
|
124
130
|
{emptyMessage}
|
|
125
131
|
</td>
|
|
126
132
|
</tr>
|
|
127
133
|
</tbody>
|
|
128
134
|
);
|
|
129
135
|
}
|
|
130
|
-
|
|
136
|
+
|
|
131
137
|
return (
|
|
132
138
|
<tbody>
|
|
133
139
|
{displayData.map((row: any, rowIndex: number) => (
|
|
134
|
-
<tr
|
|
140
|
+
<tr
|
|
135
141
|
key={`row-${rowIndex}`}
|
|
136
142
|
className={DATA_TABLE_CLASSES.row}
|
|
137
143
|
onClick={onRowClick ? () => onRowClick(row) : undefined}
|
|
@@ -139,10 +145,7 @@ export const DataTable: React.FC<DataTableProps> = ({
|
|
|
139
145
|
role={onRowClick ? 'button' : undefined}
|
|
140
146
|
>
|
|
141
147
|
{columns.map((column, colIndex) => (
|
|
142
|
-
<td
|
|
143
|
-
key={`cell-${rowIndex}-${colIndex}`}
|
|
144
|
-
className={DATA_TABLE_CLASSES.cell}
|
|
145
|
-
>
|
|
148
|
+
<td key={`cell-${rowIndex}-${colIndex}`} className={DATA_TABLE_CLASSES.cell}>
|
|
146
149
|
{column.render ? column.render(row[column.key], row) : row[column.key]}
|
|
147
150
|
</td>
|
|
148
151
|
))}
|
|
@@ -151,10 +154,10 @@ export const DataTable: React.FC<DataTableProps> = ({
|
|
|
151
154
|
</tbody>
|
|
152
155
|
);
|
|
153
156
|
};
|
|
154
|
-
|
|
157
|
+
|
|
155
158
|
const renderPagination = () => {
|
|
156
159
|
if (!paginated || totalPages <= 1) return null;
|
|
157
|
-
|
|
160
|
+
|
|
158
161
|
return (
|
|
159
162
|
<div className={DATA_TABLE_CLASSES.pagination}>
|
|
160
163
|
<Pagination
|
|
@@ -170,10 +173,10 @@ export const DataTable: React.FC<DataTableProps> = ({
|
|
|
170
173
|
</div>
|
|
171
174
|
);
|
|
172
175
|
};
|
|
173
|
-
|
|
176
|
+
|
|
174
177
|
const renderToolbar = () => {
|
|
175
178
|
if (!filterable) return null;
|
|
176
|
-
|
|
179
|
+
|
|
177
180
|
return (
|
|
178
181
|
<div className={DATA_TABLE_CLASSES.toolbar}>
|
|
179
182
|
<div className={DATA_TABLE_CLASSES.search}>
|
|
@@ -181,22 +184,19 @@ export const DataTable: React.FC<DataTableProps> = ({
|
|
|
181
184
|
type="text"
|
|
182
185
|
placeholder="Search..."
|
|
183
186
|
className={`${DATA_TABLE_CLASSES.searchInput} c-input`}
|
|
184
|
-
onChange={
|
|
187
|
+
onChange={e => handleSearch(e.target.value)}
|
|
185
188
|
aria-label="Search table"
|
|
186
189
|
/>
|
|
187
190
|
</div>
|
|
188
191
|
</div>
|
|
189
192
|
);
|
|
190
193
|
};
|
|
191
|
-
|
|
194
|
+
|
|
192
195
|
return (
|
|
193
196
|
<div className={DATA_TABLE_CLASSES.container} {...props}>
|
|
194
197
|
{renderToolbar()}
|
|
195
198
|
<div className={DATA_TABLE_CLASSES.tableWrapper}>
|
|
196
|
-
<table
|
|
197
|
-
ref={tableRef}
|
|
198
|
-
className={tableClass}
|
|
199
|
-
>
|
|
199
|
+
<table ref={tableRef} className={tableClass}>
|
|
200
200
|
{renderHeader()}
|
|
201
201
|
{renderBody()}
|
|
202
202
|
</table>
|
|
@@ -210,4 +210,4 @@ export type { DataTableProps };
|
|
|
210
210
|
|
|
211
211
|
DataTable.displayName = 'DataTable';
|
|
212
212
|
|
|
213
|
-
export default DataTable;
|
|
213
|
+
export default DataTable;
|
|
@@ -7,9 +7,14 @@ window.Atomix = window.Atomix || {};
|
|
|
7
7
|
window.Atomix.DataTable = {
|
|
8
8
|
DataTable,
|
|
9
9
|
initializeAll: DataTable.initializeAll,
|
|
10
|
-
create: (
|
|
10
|
+
create: (
|
|
11
|
+
element: string | HTMLElement,
|
|
12
|
+
data: any[] = [],
|
|
13
|
+
columns: DataTableColumn[] = [],
|
|
14
|
+
options: DataTableOptions = {}
|
|
15
|
+
) => {
|
|
11
16
|
return new DataTable(element, data, columns, options);
|
|
12
|
-
}
|
|
17
|
+
},
|
|
13
18
|
};
|
|
14
19
|
|
|
15
|
-
export default DataTable;
|
|
20
|
+
export default DataTable;
|