@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
|
@@ -11,16 +11,19 @@ interface PhotoViewerOptions {
|
|
|
11
11
|
thumbnailPosition?: 'bottom' | 'top' | 'left' | 'right' | 'none';
|
|
12
12
|
onImageChange?: (index: number) => void;
|
|
13
13
|
onClose?: () => void;
|
|
14
|
-
images?: Array<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
images?: Array<
|
|
15
|
+
| string
|
|
16
|
+
| {
|
|
17
|
+
src: string;
|
|
18
|
+
alt?: string;
|
|
19
|
+
thumbnail?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
date?: string;
|
|
23
|
+
author?: string;
|
|
24
|
+
tags?: string[];
|
|
25
|
+
}
|
|
26
|
+
>;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
interface ImageType {
|
|
@@ -79,13 +82,14 @@ class PhotoViewer {
|
|
|
79
82
|
enableGestures: true,
|
|
80
83
|
enableFullscreen: true,
|
|
81
84
|
thumbnailPosition: 'bottom',
|
|
82
|
-
images: []
|
|
85
|
+
images: [],
|
|
83
86
|
};
|
|
84
87
|
|
|
85
88
|
constructor(element: string | HTMLElement, options: PhotoViewerOptions = {}) {
|
|
86
|
-
this.element =
|
|
89
|
+
this.element =
|
|
90
|
+
typeof element === 'string' ? (document.querySelector(element) as HTMLElement) : element;
|
|
87
91
|
this.options = { ...PhotoViewer.DEFAULTS, ...options };
|
|
88
|
-
|
|
92
|
+
|
|
89
93
|
if (!this.element) {
|
|
90
94
|
throw new Error('PhotoViewer: Element not found');
|
|
91
95
|
}
|
|
@@ -93,7 +97,7 @@ class PhotoViewer {
|
|
|
93
97
|
this.currentIndex = this.options.startIndex || 0;
|
|
94
98
|
this.images = this.processImages(this.options.images || []);
|
|
95
99
|
this.initializeImageStates();
|
|
96
|
-
|
|
100
|
+
|
|
97
101
|
this.init();
|
|
98
102
|
}
|
|
99
103
|
|
|
@@ -115,7 +119,7 @@ class PhotoViewer {
|
|
|
115
119
|
zoomLevel: 1,
|
|
116
120
|
position: { x: 0, y: 0 },
|
|
117
121
|
rotation: 0,
|
|
118
|
-
bounds: { minX: 0, maxX: 0, minY: 0, maxY: 0 }
|
|
122
|
+
bounds: { minX: 0, maxX: 0, minY: 0, maxY: 0 },
|
|
119
123
|
};
|
|
120
124
|
}
|
|
121
125
|
|
|
@@ -126,7 +130,7 @@ class PhotoViewer {
|
|
|
126
130
|
private updateCurrentImageState(updates: Partial<ImageState>): void {
|
|
127
131
|
this.imageStates[this.currentIndex] = {
|
|
128
132
|
...this.getCurrentImageState(),
|
|
129
|
-
...updates
|
|
133
|
+
...updates,
|
|
130
134
|
};
|
|
131
135
|
this.updateImageTransform();
|
|
132
136
|
}
|
|
@@ -142,21 +146,21 @@ class PhotoViewer {
|
|
|
142
146
|
|
|
143
147
|
const image = this.imageElement;
|
|
144
148
|
const container = this.imageContainer;
|
|
145
|
-
|
|
149
|
+
|
|
146
150
|
const imageWidth = image.naturalWidth || image.width;
|
|
147
151
|
const imageHeight = image.naturalHeight || image.height;
|
|
148
|
-
|
|
152
|
+
|
|
149
153
|
const containerRect = container.getBoundingClientRect();
|
|
150
154
|
const containerWidth = containerRect.width;
|
|
151
155
|
const containerHeight = containerRect.height;
|
|
152
|
-
|
|
156
|
+
|
|
153
157
|
const rotationRad = (rotation * Math.PI) / 180;
|
|
154
158
|
const cos = Math.abs(Math.cos(rotationRad));
|
|
155
159
|
const sin = Math.abs(Math.sin(rotationRad));
|
|
156
|
-
|
|
160
|
+
|
|
157
161
|
const aspectRatio = imageWidth / imageHeight;
|
|
158
162
|
let displayWidth, displayHeight;
|
|
159
|
-
|
|
163
|
+
|
|
160
164
|
if (containerWidth / containerHeight > aspectRatio) {
|
|
161
165
|
displayHeight = Math.min(containerHeight * 0.9, imageHeight);
|
|
162
166
|
displayWidth = displayHeight * aspectRatio;
|
|
@@ -164,28 +168,31 @@ class PhotoViewer {
|
|
|
164
168
|
displayWidth = Math.min(containerWidth * 0.9, imageWidth);
|
|
165
169
|
displayHeight = displayWidth / aspectRatio;
|
|
166
170
|
}
|
|
167
|
-
|
|
171
|
+
|
|
168
172
|
const rotatedWidth = displayWidth * cos + displayHeight * sin;
|
|
169
173
|
const rotatedHeight = displayWidth * sin + displayHeight * cos;
|
|
170
|
-
|
|
174
|
+
|
|
171
175
|
const scaledWidth = rotatedWidth * zoomLevel;
|
|
172
176
|
const scaledHeight = rotatedHeight * zoomLevel;
|
|
173
|
-
|
|
177
|
+
|
|
174
178
|
const maxX = Math.max(0, (scaledWidth - containerWidth) / 2);
|
|
175
179
|
const maxY = Math.max(0, (scaledHeight - containerHeight) / 2);
|
|
176
|
-
|
|
180
|
+
|
|
177
181
|
return {
|
|
178
182
|
minX: -maxX,
|
|
179
183
|
maxX: maxX,
|
|
180
184
|
minY: -maxY,
|
|
181
|
-
maxY: maxY
|
|
185
|
+
maxY: maxY,
|
|
182
186
|
};
|
|
183
187
|
}
|
|
184
188
|
|
|
185
|
-
private constrainPosition(
|
|
189
|
+
private constrainPosition(
|
|
190
|
+
position: { x: number; y: number },
|
|
191
|
+
bounds: ImageState['bounds']
|
|
192
|
+
): { x: number; y: number } {
|
|
186
193
|
return {
|
|
187
194
|
x: Math.max(bounds.minX, Math.min(bounds.maxX, position.x)),
|
|
188
|
-
y: Math.max(bounds.minY, Math.min(bounds.maxY, position.y))
|
|
195
|
+
y: Math.max(bounds.minY, Math.min(bounds.maxY, position.y)),
|
|
189
196
|
};
|
|
190
197
|
}
|
|
191
198
|
|
|
@@ -193,10 +200,10 @@ class PhotoViewer {
|
|
|
193
200
|
const currentState = this.getCurrentImageState();
|
|
194
201
|
const newBounds = this.calculateBounds(currentState.zoomLevel, currentState.rotation);
|
|
195
202
|
const constrainedPosition = this.constrainPosition(currentState.position, newBounds);
|
|
196
|
-
|
|
203
|
+
|
|
197
204
|
this.updateCurrentImageState({
|
|
198
205
|
bounds: newBounds,
|
|
199
|
-
position: constrainedPosition
|
|
206
|
+
position: constrainedPosition,
|
|
200
207
|
});
|
|
201
208
|
}
|
|
202
209
|
|
|
@@ -264,7 +271,9 @@ class PhotoViewer {
|
|
|
264
271
|
this.container = this.element.querySelector('.c-photo-viewer__container') as HTMLElement;
|
|
265
272
|
this.header = this.element.querySelector('.c-photo-viewer__header') as HTMLElement;
|
|
266
273
|
this.content = this.element.querySelector('.c-photo-viewer__content') as HTMLElement;
|
|
267
|
-
this.imageContainer = this.element.querySelector(
|
|
274
|
+
this.imageContainer = this.element.querySelector(
|
|
275
|
+
'.c-photo-viewer__image-container'
|
|
276
|
+
) as HTMLElement;
|
|
268
277
|
this.imageElement = this.element.querySelector('.c-photo-viewer__image') as HTMLImageElement;
|
|
269
278
|
this.thumbnails = this.element.querySelector('.c-photo-viewer__thumbnails') as HTMLElement;
|
|
270
279
|
this.infoPanel = this.element.querySelector('.c-photo-viewer__info-panel') as HTMLElement;
|
|
@@ -275,33 +284,41 @@ class PhotoViewer {
|
|
|
275
284
|
private bindEvents(): void {
|
|
276
285
|
// Action buttons
|
|
277
286
|
this.element.addEventListener('click', this.handleActionClick.bind(this));
|
|
278
|
-
|
|
287
|
+
|
|
279
288
|
// Backdrop click to close
|
|
280
289
|
this.backdrop?.addEventListener('click', () => this.close());
|
|
281
|
-
|
|
290
|
+
|
|
282
291
|
// Image interactions
|
|
283
292
|
if (this.imageContainer) {
|
|
284
293
|
this.imageContainer.addEventListener('mousedown', this.handleMouseDown.bind(this));
|
|
285
294
|
this.imageContainer.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
286
295
|
this.imageContainer.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
287
296
|
this.imageContainer.addEventListener('mouseleave', this.handleMouseUp.bind(this));
|
|
288
|
-
this.imageContainer.addEventListener('wheel', this.handleWheel.bind(this), {
|
|
297
|
+
this.imageContainer.addEventListener('wheel', this.handleWheel.bind(this), {
|
|
298
|
+
passive: false,
|
|
299
|
+
});
|
|
289
300
|
this.imageContainer.addEventListener('dblclick', this.handleDoubleClick.bind(this));
|
|
290
|
-
|
|
301
|
+
|
|
291
302
|
// Touch events
|
|
292
|
-
this.imageContainer.addEventListener('touchstart', this.handleTouchStart.bind(this), {
|
|
293
|
-
|
|
294
|
-
|
|
303
|
+
this.imageContainer.addEventListener('touchstart', this.handleTouchStart.bind(this), {
|
|
304
|
+
passive: false,
|
|
305
|
+
});
|
|
306
|
+
this.imageContainer.addEventListener('touchmove', this.handleTouchMove.bind(this), {
|
|
307
|
+
passive: false,
|
|
308
|
+
});
|
|
309
|
+
this.imageContainer.addEventListener('touchend', this.handleTouchEnd.bind(this), {
|
|
310
|
+
passive: false,
|
|
311
|
+
});
|
|
295
312
|
}
|
|
296
|
-
|
|
313
|
+
|
|
297
314
|
// Keyboard events
|
|
298
315
|
if (this.options.enableKeyboardNavigation) {
|
|
299
316
|
document.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
300
317
|
}
|
|
301
|
-
|
|
318
|
+
|
|
302
319
|
// Fullscreen change
|
|
303
320
|
document.addEventListener('fullscreenchange', this.handleFullscreenChange.bind(this));
|
|
304
|
-
|
|
321
|
+
|
|
305
322
|
// Window resize
|
|
306
323
|
window.addEventListener('resize', this.handleResize.bind(this));
|
|
307
324
|
}
|
|
@@ -310,9 +327,9 @@ class PhotoViewer {
|
|
|
310
327
|
const target = event.target as HTMLElement;
|
|
311
328
|
const button = target.closest('[data-action]') as HTMLElement;
|
|
312
329
|
if (!button) return;
|
|
313
|
-
|
|
330
|
+
|
|
314
331
|
const action = button.getAttribute('data-action');
|
|
315
|
-
|
|
332
|
+
|
|
316
333
|
switch (action) {
|
|
317
334
|
case 'zoom-out':
|
|
318
335
|
this.zoomOut();
|
|
@@ -372,18 +389,18 @@ class PhotoViewer {
|
|
|
372
389
|
this.isDragging = true;
|
|
373
390
|
this.startDragPosition = {
|
|
374
391
|
x: event.clientX - currentState.position.x,
|
|
375
|
-
y: event.clientY - currentState.position.y
|
|
392
|
+
y: event.clientY - currentState.position.y,
|
|
376
393
|
};
|
|
377
394
|
}
|
|
378
395
|
}
|
|
379
396
|
|
|
380
397
|
private handleMouseMove(event: MouseEvent): void {
|
|
381
398
|
if (!this.isDragging) return;
|
|
382
|
-
|
|
399
|
+
|
|
383
400
|
const currentState = this.getCurrentImageState();
|
|
384
401
|
const newPosition = {
|
|
385
402
|
x: event.clientX - this.startDragPosition.x,
|
|
386
|
-
y: event.clientY - this.startDragPosition.y
|
|
403
|
+
y: event.clientY - this.startDragPosition.y,
|
|
387
404
|
};
|
|
388
405
|
const constrainedPosition = this.constrainPosition(newPosition, currentState.bounds);
|
|
389
406
|
this.updateCurrentImageState({ position: constrainedPosition });
|
|
@@ -395,15 +412,15 @@ class PhotoViewer {
|
|
|
395
412
|
|
|
396
413
|
private handleWheel(event: WheelEvent): void {
|
|
397
414
|
const currentState = this.getCurrentImageState();
|
|
398
|
-
|
|
415
|
+
|
|
399
416
|
// Detect platform and gesture type for proper handling
|
|
400
417
|
const isMac = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
401
418
|
const isTrackpadPinch = event.ctrlKey && isMac;
|
|
402
419
|
const isTrackpadScroll = !event.ctrlKey && Math.abs(event.deltaX) > 0;
|
|
403
|
-
|
|
420
|
+
|
|
404
421
|
// Handle different zoom gesture types
|
|
405
422
|
let zoomAmount: number;
|
|
406
|
-
|
|
423
|
+
|
|
407
424
|
if (isTrackpadPinch) {
|
|
408
425
|
// MacBook trackpad pinch zoom - high sensitivity, smooth scaling
|
|
409
426
|
zoomAmount = event.deltaY * -0.02;
|
|
@@ -425,9 +442,9 @@ class PhotoViewer {
|
|
|
425
442
|
event.preventDefault();
|
|
426
443
|
event.stopPropagation();
|
|
427
444
|
}
|
|
428
|
-
|
|
445
|
+
|
|
429
446
|
if (!this.imageContainer) return;
|
|
430
|
-
|
|
447
|
+
|
|
431
448
|
let rect;
|
|
432
449
|
try {
|
|
433
450
|
rect = this.imageContainer.getBoundingClientRect();
|
|
@@ -435,14 +452,14 @@ class PhotoViewer {
|
|
|
435
452
|
console.warn('PhotoViewer: Error getting bounding rect', error);
|
|
436
453
|
return;
|
|
437
454
|
}
|
|
438
|
-
|
|
455
|
+
|
|
439
456
|
if (!rect || rect.width === 0 || rect.height === 0) return;
|
|
440
|
-
|
|
457
|
+
|
|
441
458
|
const centerX = rect.width / 2;
|
|
442
459
|
const centerY = rect.height / 2;
|
|
443
460
|
const cursorX = event.clientX - rect.left - centerX;
|
|
444
461
|
const cursorY = event.clientY - rect.top - centerY;
|
|
445
|
-
|
|
462
|
+
|
|
446
463
|
this.zoom(currentState.zoomLevel + zoomAmount, cursorX, cursorY);
|
|
447
464
|
}
|
|
448
465
|
|
|
@@ -453,10 +470,10 @@ class PhotoViewer {
|
|
|
453
470
|
const centerY = rect.height / 2;
|
|
454
471
|
const cursorX = event.clientX - rect.left - centerX;
|
|
455
472
|
const cursorY = event.clientY - rect.top - centerY;
|
|
456
|
-
|
|
473
|
+
|
|
457
474
|
let newZoom: number;
|
|
458
475
|
let newPosition = { x: 0, y: 0 };
|
|
459
|
-
|
|
476
|
+
|
|
460
477
|
if (currentState.zoomLevel < 1.5) {
|
|
461
478
|
newZoom = 2;
|
|
462
479
|
newPosition = { x: -cursorX * 0.5, y: -cursorY * 0.5 };
|
|
@@ -467,67 +484,67 @@ class PhotoViewer {
|
|
|
467
484
|
newZoom = 1;
|
|
468
485
|
newPosition = { x: 0, y: 0 };
|
|
469
486
|
}
|
|
470
|
-
|
|
487
|
+
|
|
471
488
|
this.zoom(newZoom, 0, 0, newPosition);
|
|
472
489
|
}
|
|
473
490
|
|
|
474
491
|
private handleTouchStart(event: TouchEvent): void {
|
|
475
492
|
if (!this.options.enableGestures) return;
|
|
476
|
-
|
|
493
|
+
|
|
477
494
|
const touches = event.touches;
|
|
478
|
-
|
|
495
|
+
|
|
479
496
|
// Always prevent default for multi-touch to stop page zoom
|
|
480
497
|
if (touches.length > 1) {
|
|
481
498
|
event.preventDefault();
|
|
482
499
|
event.stopPropagation();
|
|
483
500
|
}
|
|
484
|
-
|
|
501
|
+
|
|
485
502
|
this.touchPoints = Array.from(touches).map(touch => ({
|
|
486
503
|
x: touch.clientX,
|
|
487
|
-
y: touch.clientY
|
|
504
|
+
y: touch.clientY,
|
|
488
505
|
}));
|
|
489
|
-
|
|
506
|
+
|
|
490
507
|
const currentState = this.getCurrentImageState();
|
|
491
|
-
|
|
508
|
+
|
|
492
509
|
if (touches.length === 1 && currentState.zoomLevel > 1) {
|
|
493
510
|
this.isDragging = true;
|
|
494
511
|
this.startDragPosition = {
|
|
495
512
|
x: touches[0].clientX - currentState.position.x,
|
|
496
|
-
y: touches[0].clientY - currentState.position.y
|
|
513
|
+
y: touches[0].clientY - currentState.position.y,
|
|
497
514
|
};
|
|
498
515
|
} else if (touches.length === 2) {
|
|
499
516
|
const dx = touches[0].clientX - touches[1].clientX;
|
|
500
517
|
const dy = touches[0].clientY - touches[1].clientY;
|
|
501
518
|
this.lastDistance = Math.sqrt(dx * dx + dy * dy);
|
|
502
|
-
|
|
519
|
+
|
|
503
520
|
this.lastMidpoint = {
|
|
504
521
|
x: (touches[0].clientX + touches[1].clientX) / 2,
|
|
505
|
-
y: (touches[0].clientY + touches[1].clientY) / 2
|
|
522
|
+
y: (touches[0].clientY + touches[1].clientY) / 2,
|
|
506
523
|
};
|
|
507
524
|
}
|
|
508
525
|
}
|
|
509
526
|
|
|
510
527
|
private handleTouchMove(event: TouchEvent): void {
|
|
511
528
|
if (!this.options.enableGestures) return;
|
|
512
|
-
|
|
529
|
+
|
|
513
530
|
const touches = event.touches;
|
|
514
531
|
const currentState = this.getCurrentImageState();
|
|
515
|
-
|
|
532
|
+
|
|
516
533
|
// Always prevent default for multi-touch gestures to stop page zoom
|
|
517
534
|
if (touches.length > 1) {
|
|
518
535
|
event.preventDefault();
|
|
519
536
|
event.stopPropagation();
|
|
520
537
|
}
|
|
521
|
-
|
|
538
|
+
|
|
522
539
|
// Prevent default for single touch when zoomed in to avoid conflicts
|
|
523
540
|
if (currentState.zoomLevel > 1 && touches.length === 1) {
|
|
524
541
|
event.preventDefault();
|
|
525
542
|
}
|
|
526
|
-
|
|
543
|
+
|
|
527
544
|
if (touches.length === 1 && this.isDragging && currentState.zoomLevel > 1) {
|
|
528
545
|
const newPosition = {
|
|
529
546
|
x: touches[0].clientX - this.startDragPosition.x,
|
|
530
|
-
y: touches[0].clientY - this.startDragPosition.y
|
|
547
|
+
y: touches[0].clientY - this.startDragPosition.y,
|
|
531
548
|
};
|
|
532
549
|
const constrainedPosition = this.constrainPosition(newPosition, currentState.bounds);
|
|
533
550
|
this.updateCurrentImageState({ position: constrainedPosition });
|
|
@@ -535,15 +552,15 @@ class PhotoViewer {
|
|
|
535
552
|
const dx = touches[0].clientX - touches[1].clientX;
|
|
536
553
|
const dy = touches[0].clientY - touches[1].clientY;
|
|
537
554
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
538
|
-
|
|
555
|
+
|
|
539
556
|
const zoomDelta = (distance - this.lastDistance) * 0.005;
|
|
540
557
|
this.lastDistance = distance;
|
|
541
|
-
|
|
558
|
+
|
|
542
559
|
const currentMidpoint = {
|
|
543
560
|
x: (touches[0].clientX + touches[1].clientX) / 2,
|
|
544
|
-
y: (touches[0].clientY + touches[1].clientY) / 2
|
|
561
|
+
y: (touches[0].clientY + touches[1].clientY) / 2,
|
|
545
562
|
};
|
|
546
|
-
|
|
563
|
+
|
|
547
564
|
if (this.lastMidpoint && this.imageContainer) {
|
|
548
565
|
let rect;
|
|
549
566
|
try {
|
|
@@ -552,17 +569,17 @@ class PhotoViewer {
|
|
|
552
569
|
console.warn('PhotoViewer: Error getting bounding rect in touch move', error);
|
|
553
570
|
return;
|
|
554
571
|
}
|
|
555
|
-
|
|
572
|
+
|
|
556
573
|
if (!rect || rect.width === 0 || rect.height === 0) return;
|
|
557
|
-
|
|
574
|
+
|
|
558
575
|
const centerX = rect.width / 2;
|
|
559
576
|
const centerY = rect.height / 2;
|
|
560
577
|
const midpointX = currentMidpoint.x - rect.left - centerX;
|
|
561
578
|
const midpointY = currentMidpoint.y - rect.top - centerY;
|
|
562
|
-
|
|
579
|
+
|
|
563
580
|
this.zoom(currentState.zoomLevel + zoomDelta, midpointX, midpointY);
|
|
564
581
|
}
|
|
565
|
-
|
|
582
|
+
|
|
566
583
|
this.lastMidpoint = currentMidpoint;
|
|
567
584
|
}
|
|
568
585
|
}
|
|
@@ -583,43 +600,48 @@ class PhotoViewer {
|
|
|
583
600
|
this.updateBounds();
|
|
584
601
|
}
|
|
585
602
|
|
|
586
|
-
private zoom(
|
|
603
|
+
private zoom(
|
|
604
|
+
newZoomLevel: number,
|
|
605
|
+
centerX: number = 0,
|
|
606
|
+
centerY: number = 0,
|
|
607
|
+
forcePosition?: { x: number; y: number }
|
|
608
|
+
): void {
|
|
587
609
|
const currentState = this.getCurrentImageState();
|
|
588
610
|
const oldZoom = currentState.zoomLevel;
|
|
589
611
|
const clampedZoom = Math.max(0.1, Math.min(5, newZoomLevel));
|
|
590
|
-
|
|
612
|
+
|
|
591
613
|
if (clampedZoom !== oldZoom) {
|
|
592
614
|
const newBounds = this.calculateBounds(clampedZoom, currentState.rotation);
|
|
593
615
|
let newPosition: { x: number; y: number };
|
|
594
|
-
|
|
616
|
+
|
|
595
617
|
if (forcePosition) {
|
|
596
618
|
newPosition = forcePosition;
|
|
597
619
|
} else {
|
|
598
620
|
const zoomFactor = clampedZoom / oldZoom;
|
|
599
621
|
newPosition = {
|
|
600
622
|
x: currentState.position.x + centerX * (1 - zoomFactor) * 0.5,
|
|
601
|
-
y: currentState.position.y + centerY * (1 - zoomFactor) * 0.5
|
|
623
|
+
y: currentState.position.y + centerY * (1 - zoomFactor) * 0.5,
|
|
602
624
|
};
|
|
603
625
|
}
|
|
604
|
-
|
|
626
|
+
|
|
605
627
|
const constrainedPosition = this.constrainPosition(newPosition, newBounds);
|
|
606
|
-
|
|
628
|
+
|
|
607
629
|
this.updateCurrentImageState({
|
|
608
630
|
zoomLevel: clampedZoom,
|
|
609
631
|
bounds: newBounds,
|
|
610
|
-
position: constrainedPosition
|
|
632
|
+
position: constrainedPosition,
|
|
611
633
|
});
|
|
612
|
-
|
|
634
|
+
|
|
613
635
|
this.updateControls();
|
|
614
636
|
}
|
|
615
637
|
}
|
|
616
638
|
|
|
617
639
|
private updateImageTransform(): void {
|
|
618
640
|
if (!this.imageElement) return;
|
|
619
|
-
|
|
641
|
+
|
|
620
642
|
const currentState = this.getCurrentImageState();
|
|
621
643
|
const cursor = this.isDragging ? 'grabbing' : currentState.zoomLevel > 1 ? 'grab' : 'default';
|
|
622
|
-
|
|
644
|
+
|
|
623
645
|
if (this.imageContainer) {
|
|
624
646
|
this.imageContainer.style.cursor = cursor;
|
|
625
647
|
this.imageContainer.style.opacity = this.isTransitioning ? '0.7' : '1';
|
|
@@ -629,12 +651,12 @@ class PhotoViewer {
|
|
|
629
651
|
this.imageContainer.classList.remove('is-transitioning');
|
|
630
652
|
}
|
|
631
653
|
}
|
|
632
|
-
|
|
654
|
+
|
|
633
655
|
this.imageElement.style.transform = `scale(${currentState.zoomLevel}) translate(${currentState.position.x}px, ${currentState.position.y}px) rotate(${currentState.rotation}deg)`;
|
|
634
|
-
this.imageElement.style.transition = this.isDragging
|
|
635
|
-
? 'none'
|
|
636
|
-
: this.isTransitioning
|
|
637
|
-
? 'opacity 0.15s ease-out'
|
|
656
|
+
this.imageElement.style.transition = this.isDragging
|
|
657
|
+
? 'none'
|
|
658
|
+
: this.isTransitioning
|
|
659
|
+
? 'opacity 0.15s ease-out'
|
|
638
660
|
: 'transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
|
|
639
661
|
this.imageElement.style.transformOrigin = 'center center';
|
|
640
662
|
this.imageElement.style.willChange = this.isDragging ? 'transform' : 'auto';
|
|
@@ -647,8 +669,10 @@ class PhotoViewer {
|
|
|
647
669
|
this.isDragging ? 'c-photo-viewer--dragging' : '',
|
|
648
670
|
this.isFullscreen ? 'c-photo-viewer--fullscreen' : '',
|
|
649
671
|
this.showInfo ? 'c-photo-viewer--info-open' : '',
|
|
650
|
-
this.isTransitioning ? 'is-transitioning' : ''
|
|
651
|
-
]
|
|
672
|
+
this.isTransitioning ? 'is-transitioning' : '',
|
|
673
|
+
]
|
|
674
|
+
.filter(Boolean)
|
|
675
|
+
.join(' ');
|
|
652
676
|
}
|
|
653
677
|
|
|
654
678
|
private render(): void {
|
|
@@ -670,10 +694,10 @@ class PhotoViewer {
|
|
|
670
694
|
private updateImage(): void {
|
|
671
695
|
const currentImage = this.images[this.currentIndex];
|
|
672
696
|
if (!currentImage || !this.imageElement) return;
|
|
673
|
-
|
|
697
|
+
|
|
674
698
|
this.imageElement.src = currentImage.src;
|
|
675
699
|
this.imageElement.alt = currentImage.alt || `Image ${this.currentIndex + 1}`;
|
|
676
|
-
|
|
700
|
+
|
|
677
701
|
// Update bounds when image loads
|
|
678
702
|
if (this.imageElement.complete) {
|
|
679
703
|
this.updateBounds();
|
|
@@ -684,14 +708,16 @@ class PhotoViewer {
|
|
|
684
708
|
|
|
685
709
|
private updateThumbnails(): void {
|
|
686
710
|
if (!this.thumbnails || this.options.thumbnailPosition === 'none') return;
|
|
687
|
-
|
|
711
|
+
|
|
688
712
|
if (this.images.length <= 1) {
|
|
689
713
|
this.thumbnails.style.display = 'none';
|
|
690
714
|
return;
|
|
691
715
|
}
|
|
692
|
-
|
|
716
|
+
|
|
693
717
|
this.thumbnails.style.display = 'flex';
|
|
694
|
-
this.thumbnails.innerHTML = this.images
|
|
718
|
+
this.thumbnails.innerHTML = this.images
|
|
719
|
+
.map(
|
|
720
|
+
(image, index) => `
|
|
695
721
|
<button class="c-photo-viewer__thumbnail ${index === this.currentIndex ? 'is-active' : ''}"
|
|
696
722
|
data-index="${index}"
|
|
697
723
|
aria-label="View image ${index + 1}"
|
|
@@ -701,10 +727,12 @@ class PhotoViewer {
|
|
|
701
727
|
class="c-photo-viewer__thumbnail-img"
|
|
702
728
|
loading="lazy">
|
|
703
729
|
</button>
|
|
704
|
-
`
|
|
705
|
-
|
|
730
|
+
`
|
|
731
|
+
)
|
|
732
|
+
.join('');
|
|
733
|
+
|
|
706
734
|
// Bind thumbnail clicks
|
|
707
|
-
this.thumbnails.addEventListener('click',
|
|
735
|
+
this.thumbnails.addEventListener('click', event => {
|
|
708
736
|
const button = (event.target as HTMLElement).closest('[data-index]') as HTMLElement;
|
|
709
737
|
if (button) {
|
|
710
738
|
const index = parseInt(button.getAttribute('data-index') || '0');
|
|
@@ -717,15 +745,22 @@ class PhotoViewer {
|
|
|
717
745
|
const currentState = this.getCurrentImageState();
|
|
718
746
|
const zoomOutBtn = this.element.querySelector('[data-action="zoom-out"]') as HTMLButtonElement;
|
|
719
747
|
const zoomInBtn = this.element.querySelector('[data-action="zoom-in"]') as HTMLButtonElement;
|
|
720
|
-
const resetZoomBtn = this.element.querySelector(
|
|
721
|
-
|
|
748
|
+
const resetZoomBtn = this.element.querySelector(
|
|
749
|
+
'[data-action="reset-zoom"]'
|
|
750
|
+
) as HTMLButtonElement;
|
|
751
|
+
|
|
722
752
|
if (zoomOutBtn) zoomOutBtn.disabled = currentState.zoomLevel <= 0.1;
|
|
723
753
|
if (zoomInBtn) zoomInBtn.disabled = currentState.zoomLevel >= 5;
|
|
724
|
-
if (resetZoomBtn)
|
|
725
|
-
|
|
754
|
+
if (resetZoomBtn)
|
|
755
|
+
resetZoomBtn.disabled =
|
|
756
|
+
currentState.zoomLevel === 1 &&
|
|
757
|
+
currentState.position.x === 0 &&
|
|
758
|
+
currentState.position.y === 0 &&
|
|
759
|
+
currentState.rotation === 0;
|
|
760
|
+
|
|
726
761
|
if (this.navPrev) this.navPrev.style.display = this.images.length > 1 ? 'flex' : 'none';
|
|
727
762
|
if (this.navNext) this.navNext.style.display = this.images.length > 1 ? 'flex' : 'none';
|
|
728
|
-
|
|
763
|
+
|
|
729
764
|
const prevBtn = this.navPrev as HTMLButtonElement;
|
|
730
765
|
const nextBtn = this.navNext as HTMLButtonElement;
|
|
731
766
|
if (prevBtn) prevBtn.disabled = this.currentIndex === 0;
|
|
@@ -734,26 +769,35 @@ class PhotoViewer {
|
|
|
734
769
|
|
|
735
770
|
private updateInfoPanel(): void {
|
|
736
771
|
if (!this.infoPanel) return;
|
|
737
|
-
|
|
772
|
+
|
|
738
773
|
this.infoPanel.style.display = this.showInfo ? 'block' : 'none';
|
|
739
|
-
|
|
774
|
+
|
|
740
775
|
if (!this.showInfo) return;
|
|
741
|
-
|
|
776
|
+
|
|
742
777
|
const currentImage = this.images[this.currentIndex];
|
|
743
778
|
const content = this.infoPanel.querySelector('.c-photo-viewer__info-content');
|
|
744
|
-
|
|
779
|
+
|
|
745
780
|
if (!content || !currentImage) return;
|
|
746
|
-
|
|
781
|
+
|
|
747
782
|
content.innerHTML = [
|
|
748
783
|
currentImage.title ? `<h3 class="c-photo-viewer__info-title">${currentImage.title}</h3>` : '',
|
|
749
|
-
currentImage.description
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
currentImage.
|
|
753
|
-
`<
|
|
784
|
+
currentImage.description
|
|
785
|
+
? `<p class="c-photo-viewer__info-description">${currentImage.description}</p>`
|
|
786
|
+
: '',
|
|
787
|
+
currentImage.date
|
|
788
|
+
? `<p class="c-photo-viewer__info-meta">Date: ${currentImage.date}</p>`
|
|
789
|
+
: '',
|
|
790
|
+
currentImage.author
|
|
791
|
+
? `<p class="c-photo-viewer__info-meta">By: ${currentImage.author}</p>`
|
|
792
|
+
: '',
|
|
793
|
+
currentImage.tags && currentImage.tags.length > 0
|
|
794
|
+
? `<div class="c-photo-viewer__info-tags">
|
|
754
795
|
${currentImage.tags.map(tag => `<span class="c-photo-viewer__info-tag">${tag}</span>`).join('')}
|
|
755
|
-
</div>`
|
|
756
|
-
|
|
796
|
+
</div>`
|
|
797
|
+
: '',
|
|
798
|
+
]
|
|
799
|
+
.filter(Boolean)
|
|
800
|
+
.join('');
|
|
757
801
|
}
|
|
758
802
|
|
|
759
803
|
// Public API methods
|
|
@@ -778,7 +822,7 @@ class PhotoViewer {
|
|
|
778
822
|
if (index >= 0 && index < this.images.length && index !== this.currentIndex) {
|
|
779
823
|
this.isTransitioning = true;
|
|
780
824
|
this.updateImageTransform();
|
|
781
|
-
|
|
825
|
+
|
|
782
826
|
setTimeout(() => {
|
|
783
827
|
this.currentIndex = index;
|
|
784
828
|
this.isTransitioning = false;
|
|
@@ -824,18 +868,18 @@ class PhotoViewer {
|
|
|
824
868
|
const newRotation = (currentState.rotation + 90) % 360;
|
|
825
869
|
const newBounds = this.calculateBounds(currentState.zoomLevel, newRotation);
|
|
826
870
|
const constrainedPosition = this.constrainPosition(currentState.position, newBounds);
|
|
827
|
-
|
|
871
|
+
|
|
828
872
|
this.updateCurrentImageState({
|
|
829
873
|
rotation: newRotation,
|
|
830
874
|
bounds: newBounds,
|
|
831
|
-
position: constrainedPosition
|
|
875
|
+
position: constrainedPosition,
|
|
832
876
|
});
|
|
833
877
|
}
|
|
834
878
|
|
|
835
879
|
public download(): void {
|
|
836
880
|
const currentImage = this.images[this.currentIndex];
|
|
837
881
|
if (!currentImage?.src) return;
|
|
838
|
-
|
|
882
|
+
|
|
839
883
|
const link = document.createElement('a');
|
|
840
884
|
link.href = currentImage.src;
|
|
841
885
|
link.download = currentImage.title || `image-${this.currentIndex + 1}`;
|
|
@@ -852,7 +896,7 @@ class PhotoViewer {
|
|
|
852
896
|
|
|
853
897
|
public toggleFullscreen(): void {
|
|
854
898
|
if (!this.options.enableFullscreen) return;
|
|
855
|
-
|
|
899
|
+
|
|
856
900
|
if (!this.isFullscreen) {
|
|
857
901
|
if (document.documentElement.requestFullscreen) {
|
|
858
902
|
document.documentElement.requestFullscreen();
|
|
@@ -884,11 +928,11 @@ class PhotoViewer {
|
|
|
884
928
|
document.removeEventListener('keydown', this.handleKeyDown.bind(this));
|
|
885
929
|
document.removeEventListener('fullscreenchange', this.handleFullscreenChange.bind(this));
|
|
886
930
|
window.removeEventListener('resize', this.handleResize.bind(this));
|
|
887
|
-
|
|
931
|
+
|
|
888
932
|
// Restore body overflow and remove class
|
|
889
933
|
document.body.style.overflow = '';
|
|
890
934
|
document.body.classList.remove('is-open-photoviewer');
|
|
891
|
-
|
|
935
|
+
|
|
892
936
|
// Clear element
|
|
893
937
|
this.element.innerHTML = '';
|
|
894
938
|
this.element.className = '';
|
|
@@ -900,4 +944,4 @@ class PhotoViewer {
|
|
|
900
944
|
}
|
|
901
945
|
}
|
|
902
946
|
|
|
903
|
-
export default PhotoViewer;
|
|
947
|
+
export default PhotoViewer;
|