@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
|
@@ -61,25 +61,25 @@ export class DataTable {
|
|
|
61
61
|
striped: false,
|
|
62
62
|
bordered: false,
|
|
63
63
|
dense: false,
|
|
64
|
-
emptyMessage: 'No data available'
|
|
64
|
+
emptyMessage: 'No data available',
|
|
65
65
|
};
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
// DOM elements
|
|
68
68
|
private element: HTMLElement;
|
|
69
69
|
private tableElement: HTMLTableElement | null = null;
|
|
70
70
|
private searchInput: HTMLInputElement | null = null;
|
|
71
71
|
private paginationElement: PaginationElement | null = null;
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
// State
|
|
74
74
|
private data: any[] = [];
|
|
75
75
|
private columns: DataTableColumn[] = [];
|
|
76
76
|
private sortConfig: SortConfig | null = null;
|
|
77
77
|
private currentPage: number = 1;
|
|
78
78
|
private searchQuery: string = '';
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
// Configuration
|
|
81
81
|
private options: DataTableOptions;
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
/**
|
|
84
84
|
* Constructor
|
|
85
85
|
* @param element - DOM element or selector
|
|
@@ -88,31 +88,30 @@ export class DataTable {
|
|
|
88
88
|
* @param options - Configuration options
|
|
89
89
|
*/
|
|
90
90
|
constructor(
|
|
91
|
-
element: string | HTMLElement,
|
|
92
|
-
data: any[] = [],
|
|
91
|
+
element: string | HTMLElement,
|
|
92
|
+
data: any[] = [],
|
|
93
93
|
columns: DataTableColumn[] = [],
|
|
94
94
|
options: DataTableOptions = {}
|
|
95
95
|
) {
|
|
96
96
|
// Get element reference
|
|
97
|
-
this.element =
|
|
98
|
-
? document.querySelector(element) as HTMLElement
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
this.element =
|
|
98
|
+
typeof element === 'string' ? (document.querySelector(element) as HTMLElement) : element;
|
|
99
|
+
|
|
101
100
|
if (!this.element) {
|
|
102
101
|
throw new Error('DataTable: Element not found');
|
|
103
102
|
}
|
|
104
|
-
|
|
103
|
+
|
|
105
104
|
// Store data and columns
|
|
106
105
|
this.data = data;
|
|
107
106
|
this.columns = columns;
|
|
108
|
-
|
|
107
|
+
|
|
109
108
|
// Merge default options with provided options
|
|
110
109
|
this.options = { ...DataTable.defaults, ...options };
|
|
111
|
-
|
|
110
|
+
|
|
112
111
|
// Initialize the component
|
|
113
112
|
this._initialize();
|
|
114
113
|
}
|
|
115
|
-
|
|
114
|
+
|
|
116
115
|
/**
|
|
117
116
|
* Initialize the component
|
|
118
117
|
* @private
|
|
@@ -120,17 +119,17 @@ export class DataTable {
|
|
|
120
119
|
private _initialize(): void {
|
|
121
120
|
// Create container structure
|
|
122
121
|
this._createStructure();
|
|
123
|
-
|
|
122
|
+
|
|
124
123
|
// Render table
|
|
125
124
|
this._renderTable();
|
|
126
|
-
|
|
125
|
+
|
|
127
126
|
// Bind events
|
|
128
127
|
this._bindEvents();
|
|
129
|
-
|
|
128
|
+
|
|
130
129
|
// Add modifier classes
|
|
131
130
|
this._addModifierClasses();
|
|
132
131
|
}
|
|
133
|
-
|
|
132
|
+
|
|
134
133
|
/**
|
|
135
134
|
* Create container structure
|
|
136
135
|
* @private
|
|
@@ -138,45 +137,45 @@ export class DataTable {
|
|
|
138
137
|
private _createStructure(): void {
|
|
139
138
|
// Clear element
|
|
140
139
|
this.element.innerHTML = '';
|
|
141
|
-
|
|
140
|
+
|
|
142
141
|
// Add container class
|
|
143
142
|
this.element.classList.add('c-data-table-container');
|
|
144
|
-
|
|
143
|
+
|
|
145
144
|
// Create toolbar if filterable
|
|
146
145
|
if (this.options.filterable) {
|
|
147
146
|
const toolbar = document.createElement('div');
|
|
148
147
|
toolbar.className = 'c-data-table-toolbar';
|
|
149
|
-
|
|
148
|
+
|
|
150
149
|
const searchContainer = document.createElement('div');
|
|
151
150
|
searchContainer.className = 'c-data-table-search';
|
|
152
|
-
|
|
151
|
+
|
|
153
152
|
this.searchInput = document.createElement('input');
|
|
154
153
|
this.searchInput.type = 'text';
|
|
155
154
|
this.searchInput.placeholder = 'Search...';
|
|
156
155
|
this.searchInput.className = 'c-data-table-search__input c-input';
|
|
157
156
|
this.searchInput.setAttribute('aria-label', 'Search table');
|
|
158
|
-
|
|
157
|
+
|
|
159
158
|
searchContainer.appendChild(this.searchInput);
|
|
160
159
|
toolbar.appendChild(searchContainer);
|
|
161
160
|
this.element.appendChild(toolbar);
|
|
162
161
|
}
|
|
163
|
-
|
|
162
|
+
|
|
164
163
|
// Create table wrapper
|
|
165
164
|
const tableWrapper = document.createElement('div');
|
|
166
165
|
tableWrapper.className = 'c-data-table-wrapper';
|
|
167
|
-
|
|
166
|
+
|
|
168
167
|
// Create table
|
|
169
168
|
this.tableElement = document.createElement('table');
|
|
170
169
|
this.tableElement.className = 'c-data-table';
|
|
171
|
-
|
|
170
|
+
|
|
172
171
|
tableWrapper.appendChild(this.tableElement);
|
|
173
172
|
this.element.appendChild(tableWrapper);
|
|
174
|
-
|
|
173
|
+
|
|
175
174
|
// Create pagination container if needed
|
|
176
175
|
if (this.options.paginated) {
|
|
177
176
|
const paginationContainer = document.createElement('div');
|
|
178
177
|
paginationContainer.className = 'c-data-table__pagination-container';
|
|
179
|
-
|
|
178
|
+
|
|
180
179
|
this.paginationElement = document.createElement('nav') as PaginationElement;
|
|
181
180
|
this.paginationElement.className = 'c-pagination c-pagination--sm';
|
|
182
181
|
this.paginationElement.setAttribute('aria-label', 'Data table pagination');
|
|
@@ -185,32 +184,32 @@ export class DataTable {
|
|
|
185
184
|
this.paginationElement.setAttribute('data-total-pages', '1');
|
|
186
185
|
this.paginationElement.setAttribute('data-show-first-last-buttons', 'true');
|
|
187
186
|
this.paginationElement.setAttribute('data-show-prev-next-buttons', 'true');
|
|
188
|
-
|
|
187
|
+
|
|
189
188
|
paginationContainer.appendChild(this.paginationElement);
|
|
190
189
|
this.element.appendChild(paginationContainer);
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
|
-
|
|
192
|
+
|
|
194
193
|
/**
|
|
195
194
|
* Add modifier classes based on options
|
|
196
195
|
* @private
|
|
197
196
|
*/
|
|
198
197
|
private _addModifierClasses(): void {
|
|
199
198
|
if (!this.tableElement) return;
|
|
200
|
-
|
|
199
|
+
|
|
201
200
|
if (this.options.striped) {
|
|
202
201
|
this.tableElement.classList.add('c-data-table--striped');
|
|
203
202
|
}
|
|
204
|
-
|
|
203
|
+
|
|
205
204
|
if (this.options.bordered) {
|
|
206
205
|
this.tableElement.classList.add('c-data-table--bordered');
|
|
207
206
|
}
|
|
208
|
-
|
|
207
|
+
|
|
209
208
|
if (this.options.dense) {
|
|
210
209
|
this.tableElement.classList.add('c-data-table--dense');
|
|
211
210
|
}
|
|
212
211
|
}
|
|
213
|
-
|
|
212
|
+
|
|
214
213
|
/**
|
|
215
214
|
* Bind event listeners
|
|
216
215
|
* @private
|
|
@@ -220,7 +219,7 @@ export class DataTable {
|
|
|
220
219
|
if (this.searchInput) {
|
|
221
220
|
this.searchInput.addEventListener('input', this._handleSearch.bind(this));
|
|
222
221
|
}
|
|
223
|
-
|
|
222
|
+
|
|
224
223
|
// Sort header click events
|
|
225
224
|
if (this.options.sortable && this.tableElement) {
|
|
226
225
|
const headerCells = this.tableElement.querySelectorAll(DATA_TABLE_SELECTORS.HEADER_CELL);
|
|
@@ -234,10 +233,10 @@ export class DataTable {
|
|
|
234
233
|
}
|
|
235
234
|
});
|
|
236
235
|
}
|
|
237
|
-
|
|
236
|
+
|
|
238
237
|
// Row click events
|
|
239
238
|
if (this.options.onRowClick && this.tableElement) {
|
|
240
|
-
this.tableElement.addEventListener('click',
|
|
239
|
+
this.tableElement.addEventListener('click', event => {
|
|
241
240
|
const target = event.target as HTMLElement;
|
|
242
241
|
const row = target.closest(DATA_TABLE_SELECTORS.ROW) as HTMLElement;
|
|
243
242
|
if (row) {
|
|
@@ -252,7 +251,7 @@ export class DataTable {
|
|
|
252
251
|
});
|
|
253
252
|
}
|
|
254
253
|
}
|
|
255
|
-
|
|
254
|
+
|
|
256
255
|
/**
|
|
257
256
|
* Handle search input
|
|
258
257
|
* @private
|
|
@@ -263,56 +262,60 @@ export class DataTable {
|
|
|
263
262
|
this.currentPage = 1; // Reset to first page
|
|
264
263
|
this._renderTable();
|
|
265
264
|
}
|
|
266
|
-
|
|
265
|
+
|
|
267
266
|
/**
|
|
268
267
|
* Handle sort header click
|
|
269
268
|
* @private
|
|
270
269
|
*/
|
|
271
270
|
private _handleSort(key: string): void {
|
|
272
271
|
if (!this.options.sortable) return;
|
|
273
|
-
|
|
272
|
+
|
|
274
273
|
let direction: 'asc' | 'desc' = 'asc';
|
|
275
|
-
|
|
274
|
+
|
|
276
275
|
if (this.sortConfig && this.sortConfig.key === key) {
|
|
277
276
|
direction = this.sortConfig.direction === 'asc' ? 'desc' : 'asc';
|
|
278
277
|
}
|
|
279
|
-
|
|
278
|
+
|
|
280
279
|
this.sortConfig = { key, direction };
|
|
281
280
|
this._renderTable();
|
|
282
|
-
|
|
281
|
+
|
|
283
282
|
// Dispatch custom event
|
|
284
|
-
this.element.dispatchEvent(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
283
|
+
this.element.dispatchEvent(
|
|
284
|
+
new CustomEvent('data-table:sort', {
|
|
285
|
+
bubbles: true,
|
|
286
|
+
detail: { sortConfig: this.sortConfig },
|
|
287
|
+
})
|
|
288
|
+
);
|
|
288
289
|
}
|
|
289
|
-
|
|
290
|
+
|
|
290
291
|
/**
|
|
291
292
|
* Handle page change
|
|
292
293
|
* @private
|
|
293
294
|
*/
|
|
294
295
|
private _handlePageChange(page: number): void {
|
|
295
296
|
if (page < 1 || page > this._getTotalPages()) return;
|
|
296
|
-
|
|
297
|
+
|
|
297
298
|
this.currentPage = page;
|
|
298
299
|
this._renderTable();
|
|
299
|
-
|
|
300
|
+
|
|
300
301
|
// Dispatch custom event
|
|
301
|
-
this.element.dispatchEvent(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
302
|
+
this.element.dispatchEvent(
|
|
303
|
+
new CustomEvent('data-table:page', {
|
|
304
|
+
bubbles: true,
|
|
305
|
+
detail: { page: this.currentPage },
|
|
306
|
+
})
|
|
307
|
+
);
|
|
305
308
|
}
|
|
306
|
-
|
|
309
|
+
|
|
307
310
|
/**
|
|
308
311
|
* Get filtered data based on search query
|
|
309
312
|
* @private
|
|
310
313
|
*/
|
|
311
314
|
private _getFilteredData(): any[] {
|
|
312
315
|
if (!this.searchQuery) return this.data;
|
|
313
|
-
|
|
316
|
+
|
|
314
317
|
const lowercaseQuery = this.searchQuery.toLowerCase();
|
|
315
|
-
|
|
318
|
+
|
|
316
319
|
return this.data.filter(row => {
|
|
317
320
|
return this.columns.some(column => {
|
|
318
321
|
const value = row[column.key];
|
|
@@ -321,48 +324,52 @@ export class DataTable {
|
|
|
321
324
|
});
|
|
322
325
|
});
|
|
323
326
|
}
|
|
324
|
-
|
|
327
|
+
|
|
325
328
|
/**
|
|
326
329
|
* Get sorted data
|
|
327
330
|
* @private
|
|
328
331
|
*/
|
|
329
332
|
private _getSortedData(): any[] {
|
|
330
333
|
const filteredData = this._getFilteredData();
|
|
331
|
-
|
|
334
|
+
|
|
332
335
|
if (!this.sortConfig || !this.options.sortable) return filteredData;
|
|
333
|
-
|
|
336
|
+
|
|
334
337
|
return [...filteredData].sort((a, b) => {
|
|
335
338
|
const aValue = a[this.sortConfig!.key];
|
|
336
339
|
const bValue = b[this.sortConfig!.key];
|
|
337
|
-
|
|
340
|
+
|
|
338
341
|
if (aValue == null) return this.sortConfig!.direction === 'asc' ? -1 : 1;
|
|
339
342
|
if (bValue == null) return this.sortConfig!.direction === 'asc' ? 1 : -1;
|
|
340
|
-
|
|
343
|
+
|
|
341
344
|
if (typeof aValue === 'string' && typeof bValue === 'string') {
|
|
342
|
-
return this.sortConfig!.direction === 'asc'
|
|
343
|
-
? aValue.localeCompare(bValue)
|
|
345
|
+
return this.sortConfig!.direction === 'asc'
|
|
346
|
+
? aValue.localeCompare(bValue)
|
|
344
347
|
: bValue.localeCompare(aValue);
|
|
345
348
|
}
|
|
346
|
-
|
|
347
|
-
return this.sortConfig!.direction === 'asc'
|
|
348
|
-
?
|
|
349
|
-
|
|
349
|
+
|
|
350
|
+
return this.sortConfig!.direction === 'asc'
|
|
351
|
+
? aValue > bValue
|
|
352
|
+
? 1
|
|
353
|
+
: -1
|
|
354
|
+
: aValue > bValue
|
|
355
|
+
? -1
|
|
356
|
+
: 1;
|
|
350
357
|
});
|
|
351
358
|
}
|
|
352
|
-
|
|
359
|
+
|
|
353
360
|
/**
|
|
354
361
|
* Get paginated data
|
|
355
362
|
* @private
|
|
356
363
|
*/
|
|
357
364
|
private _getPaginatedData(): any[] {
|
|
358
365
|
const sortedData = this._getSortedData();
|
|
359
|
-
|
|
366
|
+
|
|
360
367
|
if (!this.options.paginated) return sortedData;
|
|
361
|
-
|
|
368
|
+
|
|
362
369
|
const startIndex = (this.currentPage - 1) * (this.options.pageSize || 10);
|
|
363
370
|
return sortedData.slice(startIndex, startIndex + (this.options.pageSize || 10));
|
|
364
371
|
}
|
|
365
|
-
|
|
372
|
+
|
|
366
373
|
/**
|
|
367
374
|
* Get display data (filtered, sorted, paginated)
|
|
368
375
|
* @private
|
|
@@ -370,45 +377,45 @@ export class DataTable {
|
|
|
370
377
|
private _getDisplayData(): any[] {
|
|
371
378
|
return this._getPaginatedData();
|
|
372
379
|
}
|
|
373
|
-
|
|
380
|
+
|
|
374
381
|
/**
|
|
375
382
|
* Get total pages
|
|
376
383
|
* @private
|
|
377
384
|
*/
|
|
378
385
|
private _getTotalPages(): number {
|
|
379
386
|
if (!this.options.paginated) return 1;
|
|
380
|
-
|
|
387
|
+
|
|
381
388
|
const filteredData = this._getFilteredData();
|
|
382
389
|
return Math.max(1, Math.ceil(filteredData.length / (this.options.pageSize || 10)));
|
|
383
390
|
}
|
|
384
|
-
|
|
391
|
+
|
|
385
392
|
/**
|
|
386
393
|
* Render table
|
|
387
394
|
* @private
|
|
388
395
|
*/
|
|
389
396
|
private _renderTable(): void {
|
|
390
397
|
if (!this.tableElement) return;
|
|
391
|
-
|
|
398
|
+
|
|
392
399
|
// Clear table
|
|
393
400
|
this.tableElement.innerHTML = '';
|
|
394
|
-
|
|
401
|
+
|
|
395
402
|
// Render header
|
|
396
403
|
this._renderHeader();
|
|
397
|
-
|
|
404
|
+
|
|
398
405
|
// Check if loading
|
|
399
406
|
if (this.options.loading) {
|
|
400
407
|
const tbody = document.createElement('tbody');
|
|
401
408
|
const tr = document.createElement('tr');
|
|
402
409
|
const td = document.createElement('td');
|
|
403
|
-
|
|
410
|
+
|
|
404
411
|
td.className = 'c-data-table__loading-cell';
|
|
405
412
|
td.colSpan = this.columns.length;
|
|
406
|
-
|
|
413
|
+
|
|
407
414
|
const loadingContainer = document.createElement('div');
|
|
408
415
|
loadingContainer.className = 'c-data-table__loading-indicator';
|
|
409
|
-
|
|
416
|
+
|
|
410
417
|
loadingContainer.appendChild(this._createSpinner());
|
|
411
|
-
|
|
418
|
+
|
|
412
419
|
td.appendChild(loadingContainer);
|
|
413
420
|
tr.appendChild(td);
|
|
414
421
|
tbody.appendChild(tr);
|
|
@@ -417,68 +424,71 @@ export class DataTable {
|
|
|
417
424
|
// Render body
|
|
418
425
|
this._renderBody();
|
|
419
426
|
}
|
|
420
|
-
|
|
427
|
+
|
|
421
428
|
// Render pagination
|
|
422
429
|
if (this.options.paginated) {
|
|
423
430
|
this._renderPagination();
|
|
424
431
|
}
|
|
425
432
|
}
|
|
426
|
-
|
|
433
|
+
|
|
427
434
|
/**
|
|
428
435
|
* Render table header
|
|
429
436
|
* @private
|
|
430
437
|
*/
|
|
431
438
|
private _renderHeader(): void {
|
|
432
439
|
if (!this.tableElement) return;
|
|
433
|
-
|
|
440
|
+
|
|
434
441
|
const thead = document.createElement('thead');
|
|
435
442
|
thead.className = 'c-data-table__header';
|
|
436
|
-
|
|
443
|
+
|
|
437
444
|
const tr = document.createElement('tr');
|
|
438
|
-
|
|
445
|
+
|
|
439
446
|
this.columns.forEach(column => {
|
|
440
447
|
const th = document.createElement('th');
|
|
441
448
|
th.className = 'c-data-table__header-cell';
|
|
442
|
-
|
|
449
|
+
|
|
443
450
|
if (column.sortable !== false && this.options.sortable) {
|
|
444
451
|
th.classList.add('c-data-table__header-cell--sortable');
|
|
445
452
|
th.setAttribute('data-column-key', column.key);
|
|
446
|
-
|
|
453
|
+
|
|
447
454
|
if (this.sortConfig && this.sortConfig.key === column.key) {
|
|
448
|
-
th.setAttribute(
|
|
455
|
+
th.setAttribute(
|
|
456
|
+
'aria-sort',
|
|
457
|
+
this.sortConfig.direction === 'asc' ? 'ascending' : 'descending'
|
|
458
|
+
);
|
|
449
459
|
}
|
|
450
460
|
}
|
|
451
|
-
|
|
461
|
+
|
|
452
462
|
if (column.width) {
|
|
453
463
|
th.style.width = column.width;
|
|
454
464
|
}
|
|
455
|
-
|
|
465
|
+
|
|
456
466
|
const content = document.createElement('div');
|
|
457
467
|
content.className = 'c-data-table__header-content';
|
|
458
|
-
|
|
468
|
+
|
|
459
469
|
const title = document.createElement('span');
|
|
460
470
|
title.textContent = column.title;
|
|
461
471
|
content.appendChild(title);
|
|
462
|
-
|
|
472
|
+
|
|
463
473
|
if (column.sortable !== false && this.options.sortable) {
|
|
464
474
|
const sortIcon = document.createElement('span');
|
|
465
475
|
sortIcon.className = 'c-data-table__sort-icon';
|
|
466
|
-
|
|
476
|
+
|
|
467
477
|
if (this.sortConfig && this.sortConfig.key === column.key) {
|
|
468
478
|
// Create SVG icon
|
|
469
479
|
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
470
480
|
svg.setAttribute('width', '16');
|
|
471
481
|
svg.setAttribute('height', '16');
|
|
472
482
|
svg.setAttribute('viewBox', '0 0 256 256');
|
|
473
|
-
|
|
483
|
+
|
|
474
484
|
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
475
|
-
|
|
485
|
+
|
|
476
486
|
if (this.sortConfig.direction === 'asc') {
|
|
477
487
|
// CaretUp icon
|
|
478
488
|
path.setAttribute('d', 'M128 90.5L51.6 170l-6.5-5.4l76.4-79.5l6.5 5.4z');
|
|
479
489
|
path.setAttribute('fill', 'currentColor');
|
|
480
490
|
svg.appendChild(path);
|
|
481
|
-
|
|
491
|
+
|
|
482
492
|
const path2 = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
483
493
|
path2.setAttribute('d', 'M128 90.5l76.4 79.5l-6.5 5.4l-76.4-79.5l6.5-5.4z');
|
|
484
494
|
path2.setAttribute('fill', 'currentColor');
|
|
@@ -488,37 +498,37 @@ export class DataTable {
|
|
|
488
498
|
path.setAttribute('d', 'M128 165.5L51.6 86l-6.5 5.4l76.4 79.5l6.5-5.4z');
|
|
489
499
|
path.setAttribute('fill', 'currentColor');
|
|
490
500
|
svg.appendChild(path);
|
|
491
|
-
|
|
501
|
+
|
|
492
502
|
const path2 = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
493
503
|
path2.setAttribute('d', 'M128 165.5l76.4-79.5l-6.5-5.4l-76.4 79.5l6.5 5.4z');
|
|
494
504
|
path2.setAttribute('fill', 'currentColor');
|
|
495
505
|
svg.appendChild(path2);
|
|
496
506
|
}
|
|
497
|
-
|
|
507
|
+
|
|
498
508
|
sortIcon.appendChild(svg);
|
|
499
509
|
}
|
|
500
|
-
|
|
510
|
+
|
|
501
511
|
content.appendChild(sortIcon);
|
|
502
512
|
}
|
|
503
|
-
|
|
513
|
+
|
|
504
514
|
th.appendChild(content);
|
|
505
515
|
tr.appendChild(th);
|
|
506
516
|
});
|
|
507
|
-
|
|
517
|
+
|
|
508
518
|
thead.appendChild(tr);
|
|
509
519
|
this.tableElement.appendChild(thead);
|
|
510
520
|
}
|
|
511
|
-
|
|
521
|
+
|
|
512
522
|
/**
|
|
513
523
|
* Render table body
|
|
514
524
|
* @private
|
|
515
525
|
*/
|
|
516
526
|
private _renderBody(): void {
|
|
517
527
|
if (!this.tableElement) return;
|
|
518
|
-
|
|
528
|
+
|
|
519
529
|
const tbody = document.createElement('tbody');
|
|
520
530
|
const displayData = this._getDisplayData();
|
|
521
|
-
|
|
531
|
+
|
|
522
532
|
if (displayData.length === 0) {
|
|
523
533
|
const tr = document.createElement('tr');
|
|
524
534
|
const td = document.createElement('td');
|
|
@@ -532,18 +542,18 @@ export class DataTable {
|
|
|
532
542
|
const tr = document.createElement('tr');
|
|
533
543
|
tr.className = 'c-data-table__row';
|
|
534
544
|
tr.setAttribute('data-row-index', rowIndex.toString());
|
|
535
|
-
|
|
545
|
+
|
|
536
546
|
if (this.options.onRowClick) {
|
|
537
547
|
tr.setAttribute('role', 'button');
|
|
538
548
|
tr.tabIndex = 0;
|
|
539
549
|
}
|
|
540
|
-
|
|
550
|
+
|
|
541
551
|
this.columns.forEach(column => {
|
|
542
552
|
const td = document.createElement('td');
|
|
543
553
|
td.className = 'c-data-table__cell';
|
|
544
|
-
|
|
554
|
+
|
|
545
555
|
const value = row[column.key];
|
|
546
|
-
|
|
556
|
+
|
|
547
557
|
if (column.render) {
|
|
548
558
|
const rendered = column.render(value, row);
|
|
549
559
|
if (typeof rendered === 'string') {
|
|
@@ -554,17 +564,17 @@ export class DataTable {
|
|
|
554
564
|
} else {
|
|
555
565
|
td.textContent = value != null ? String(value) : '';
|
|
556
566
|
}
|
|
557
|
-
|
|
567
|
+
|
|
558
568
|
tr.appendChild(td);
|
|
559
569
|
});
|
|
560
|
-
|
|
570
|
+
|
|
561
571
|
tbody.appendChild(tr);
|
|
562
572
|
});
|
|
563
573
|
}
|
|
564
|
-
|
|
574
|
+
|
|
565
575
|
this.tableElement.appendChild(tbody);
|
|
566
576
|
}
|
|
567
|
-
|
|
577
|
+
|
|
568
578
|
/**
|
|
569
579
|
* Create loading spinner
|
|
570
580
|
* @private
|
|
@@ -573,35 +583,35 @@ export class DataTable {
|
|
|
573
583
|
const spinner = document.createElement('div');
|
|
574
584
|
spinner.className = 'c-spinner c-spinner--primary';
|
|
575
585
|
spinner.setAttribute('role', 'status');
|
|
576
|
-
|
|
586
|
+
|
|
577
587
|
const srText = document.createElement('span');
|
|
578
588
|
srText.className = 'u-visually-hidden';
|
|
579
589
|
srText.textContent = 'Loading...';
|
|
580
|
-
|
|
590
|
+
|
|
581
591
|
spinner.appendChild(srText);
|
|
582
592
|
return spinner;
|
|
583
593
|
}
|
|
584
|
-
|
|
594
|
+
|
|
585
595
|
/**
|
|
586
596
|
* Render pagination
|
|
587
597
|
* @private
|
|
588
598
|
*/
|
|
589
599
|
private _renderPagination(): void {
|
|
590
600
|
if (!this.paginationElement) return;
|
|
591
|
-
|
|
601
|
+
|
|
592
602
|
const totalPages = this._getTotalPages();
|
|
593
|
-
|
|
603
|
+
|
|
594
604
|
if (totalPages <= 1) {
|
|
595
605
|
this.paginationElement.style.display = 'none';
|
|
596
606
|
return;
|
|
597
607
|
} else {
|
|
598
608
|
this.paginationElement.style.display = '';
|
|
599
609
|
}
|
|
600
|
-
|
|
610
|
+
|
|
601
611
|
// Update pagination data attributes
|
|
602
612
|
this.paginationElement.setAttribute('data-current-page', String(this.currentPage));
|
|
603
613
|
this.paginationElement.setAttribute('data-total-pages', String(totalPages));
|
|
604
|
-
|
|
614
|
+
|
|
605
615
|
// Initialize or update Pagination component
|
|
606
616
|
if (!this.paginationElement.paginationInstance) {
|
|
607
617
|
// Create a new instance if it doesn't exist
|
|
@@ -612,24 +622,24 @@ export class DataTable {
|
|
|
612
622
|
showFirstLastButtons: true,
|
|
613
623
|
showPrevNextButtons: true,
|
|
614
624
|
size: 'sm',
|
|
615
|
-
onPageChange: (page: number) => this._handlePageChange(page)
|
|
625
|
+
onPageChange: (page: number) => this._handlePageChange(page),
|
|
616
626
|
});
|
|
617
|
-
|
|
627
|
+
|
|
618
628
|
// Store the instance in a property on the element
|
|
619
629
|
Object.defineProperty(this.paginationElement, 'paginationInstance', {
|
|
620
630
|
value: paginationInstance,
|
|
621
631
|
writable: true,
|
|
622
|
-
configurable: true
|
|
632
|
+
configurable: true,
|
|
623
633
|
});
|
|
624
634
|
} else {
|
|
625
635
|
// Update existing instance
|
|
626
636
|
this.paginationElement.paginationInstance.update({
|
|
627
637
|
currentPage: this.currentPage,
|
|
628
|
-
totalPages: totalPages
|
|
638
|
+
totalPages: totalPages,
|
|
629
639
|
});
|
|
630
640
|
}
|
|
631
641
|
}
|
|
632
|
-
|
|
642
|
+
|
|
633
643
|
/**
|
|
634
644
|
* Update data
|
|
635
645
|
* @public
|
|
@@ -638,14 +648,16 @@ export class DataTable {
|
|
|
638
648
|
this.data = data;
|
|
639
649
|
this.currentPage = 1; // Reset to first page
|
|
640
650
|
this._renderTable();
|
|
641
|
-
|
|
651
|
+
|
|
642
652
|
// Dispatch custom event
|
|
643
|
-
this.element.dispatchEvent(
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
653
|
+
this.element.dispatchEvent(
|
|
654
|
+
new CustomEvent('data-table:update', {
|
|
655
|
+
bubbles: true,
|
|
656
|
+
detail: { data },
|
|
657
|
+
})
|
|
658
|
+
);
|
|
647
659
|
}
|
|
648
|
-
|
|
660
|
+
|
|
649
661
|
/**
|
|
650
662
|
* Update columns
|
|
651
663
|
* @public
|
|
@@ -653,31 +665,35 @@ export class DataTable {
|
|
|
653
665
|
public updateColumns(columns: DataTableColumn[]): void {
|
|
654
666
|
this.columns = columns;
|
|
655
667
|
this._renderTable();
|
|
656
|
-
|
|
668
|
+
|
|
657
669
|
// Dispatch custom event
|
|
658
|
-
this.element.dispatchEvent(
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
670
|
+
this.element.dispatchEvent(
|
|
671
|
+
new CustomEvent('data-table:update', {
|
|
672
|
+
bubbles: true,
|
|
673
|
+
detail: { columns },
|
|
674
|
+
})
|
|
675
|
+
);
|
|
662
676
|
}
|
|
663
|
-
|
|
677
|
+
|
|
664
678
|
/**
|
|
665
679
|
* Sort by column
|
|
666
680
|
* @public
|
|
667
681
|
*/
|
|
668
682
|
public sortBy(key: string, direction: 'asc' | 'desc' = 'asc'): void {
|
|
669
683
|
if (!this.options.sortable) return;
|
|
670
|
-
|
|
684
|
+
|
|
671
685
|
this.sortConfig = { key, direction };
|
|
672
686
|
this._renderTable();
|
|
673
|
-
|
|
687
|
+
|
|
674
688
|
// Dispatch custom event
|
|
675
|
-
this.element.dispatchEvent(
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
689
|
+
this.element.dispatchEvent(
|
|
690
|
+
new CustomEvent('data-table:sort', {
|
|
691
|
+
bubbles: true,
|
|
692
|
+
detail: { sortConfig: this.sortConfig },
|
|
693
|
+
})
|
|
694
|
+
);
|
|
679
695
|
}
|
|
680
|
-
|
|
696
|
+
|
|
681
697
|
/**
|
|
682
698
|
* Set page
|
|
683
699
|
* @public
|
|
@@ -685,7 +701,7 @@ export class DataTable {
|
|
|
685
701
|
public setPage(page: number): void {
|
|
686
702
|
this._handlePageChange(page);
|
|
687
703
|
}
|
|
688
|
-
|
|
704
|
+
|
|
689
705
|
/**
|
|
690
706
|
* Search
|
|
691
707
|
* @public
|
|
@@ -693,20 +709,22 @@ export class DataTable {
|
|
|
693
709
|
public search(query: string): void {
|
|
694
710
|
this.searchQuery = query;
|
|
695
711
|
this.currentPage = 1; // Reset to first page
|
|
696
|
-
|
|
712
|
+
|
|
697
713
|
if (this.searchInput) {
|
|
698
714
|
this.searchInput.value = query;
|
|
699
715
|
}
|
|
700
|
-
|
|
716
|
+
|
|
701
717
|
this._renderTable();
|
|
702
|
-
|
|
718
|
+
|
|
703
719
|
// Dispatch custom event
|
|
704
|
-
this.element.dispatchEvent(
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
720
|
+
this.element.dispatchEvent(
|
|
721
|
+
new CustomEvent('data-table:search', {
|
|
722
|
+
bubbles: true,
|
|
723
|
+
detail: { query },
|
|
724
|
+
})
|
|
725
|
+
);
|
|
708
726
|
}
|
|
709
|
-
|
|
727
|
+
|
|
710
728
|
/**
|
|
711
729
|
* Destroy the component
|
|
712
730
|
* @public
|
|
@@ -716,25 +734,25 @@ export class DataTable {
|
|
|
716
734
|
if (this.searchInput) {
|
|
717
735
|
this.searchInput.removeEventListener('input', this._handleSearch.bind(this));
|
|
718
736
|
}
|
|
719
|
-
|
|
737
|
+
|
|
720
738
|
// Clean up pagination instance if it exists
|
|
721
739
|
if (this.paginationElement && this.paginationElement.paginationInstance) {
|
|
722
740
|
this.paginationElement.paginationInstance.destroy();
|
|
723
741
|
}
|
|
724
|
-
|
|
742
|
+
|
|
725
743
|
// Clear element
|
|
726
744
|
this.element.innerHTML = '';
|
|
727
745
|
this.element.classList.remove('c-data-table-container');
|
|
728
|
-
|
|
746
|
+
|
|
729
747
|
// Clear references
|
|
730
748
|
this.tableElement = null;
|
|
731
749
|
this.searchInput = null;
|
|
732
750
|
this.paginationElement = null;
|
|
733
|
-
|
|
751
|
+
|
|
734
752
|
// Dispatch event
|
|
735
753
|
this.element.dispatchEvent(new CustomEvent('data-table:destroy', { bubbles: true }));
|
|
736
754
|
}
|
|
737
|
-
|
|
755
|
+
|
|
738
756
|
/**
|
|
739
757
|
* Initialize all DataTables on the page
|
|
740
758
|
* @public
|
|
@@ -746,18 +764,18 @@ export class DataTable {
|
|
|
746
764
|
// Try to get data from data attributes
|
|
747
765
|
const dataAttr = element.getAttribute('data-table-data');
|
|
748
766
|
const columnsAttr = element.getAttribute('data-table-columns');
|
|
749
|
-
|
|
767
|
+
|
|
750
768
|
let data: any[] = [];
|
|
751
769
|
let columns: DataTableColumn[] = [];
|
|
752
|
-
|
|
770
|
+
|
|
753
771
|
try {
|
|
754
772
|
if (dataAttr) data = JSON.parse(dataAttr);
|
|
755
773
|
if (columnsAttr) columns = JSON.parse(columnsAttr);
|
|
756
774
|
} catch (e) {
|
|
757
775
|
console.error('Error parsing DataTable data attributes:', e);
|
|
758
776
|
}
|
|
759
|
-
|
|
777
|
+
|
|
760
778
|
return new DataTable(element as HTMLElement, data, columns, options);
|
|
761
779
|
});
|
|
762
780
|
}
|
|
763
|
-
}
|
|
781
|
+
}
|