@shohojdhara/atomix 0.1.17 → 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 -1
- package/dist/js/244.js +1 -0
- package/dist/js/atomix.react.cjs.js +1 -0
- package/dist/js/atomix.react.esm.js +1 -1
- package/dist/js/atomix.react.umd.js +1 -1
- 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/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/index.d.ts +1 -1
- package/dist/types/lib/composables/index.d.ts +1 -0
- 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 +26 -5
- package/postcss.config.js +28 -0
- package/src/Introduction.mdx +44 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-Alternatives.eot +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-Alternatives.ttf +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-Alternatives.woff +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-Alternatives.woff2 +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-Expert.eot +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-Expert.ttf +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-Expert.woff +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-Expert.woff2 +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-ItalicSwash.eot +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-ItalicSwash.ttf +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-ItalicSwash.woff +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-ItalicSwash.woff2 +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-SmallCaps.eot +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-SmallCaps.ttf +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-SmallCaps.woff +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslon-SmallCaps.woff2 +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Black.eot +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Black.ttf +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Black.woff +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Black.woff2 +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-BlackItalic.eot +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-BlackItalic.ttf +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-BlackItalic.woff +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-BlackItalic.woff2 +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Bold.eot +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Bold.ttf +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Bold.woff +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Bold.woff2 +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-BoldItalic.eot +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-BoldItalic.ttf +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-BoldItalic.woff +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-BoldItalic.woff2 +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Italic.eot +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Italic.ttf +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Italic.woff +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Italic.woff2 +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Regular.eot +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Regular.ttf +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Regular.woff +0 -0
- package/src/assets/fonts/BigCaslon/BigCaslonFB-Regular.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Black.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Black.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Black.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Black.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BlackItalic.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BlackItalic.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BlackItalic.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BlackItalic.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Bold.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Bold.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Bold.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Bold.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BoldItalic.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BoldItalic.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BoldItalic.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BoldItalic.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Book.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Book.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Book.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Book.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BookItalic.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BookItalic.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BookItalic.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-BookItalic.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Heavy.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Heavy.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Heavy.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Heavy.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-HeavyItalic.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-HeavyItalic.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-HeavyItalic.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-HeavyItalic.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Light.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Light.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Light.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Light.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-LightItalic.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-LightItalic.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-LightItalic.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-LightItalic.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Medium.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Medium.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Medium.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Medium.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-MediumItalic.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-MediumItalic.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-MediumItalic.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-MediumItalic.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Regular.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Regular.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Regular.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Regular.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-RegularItalic.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-RegularItalic.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-RegularItalic.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-RegularItalic.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Thin.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Thin.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Thin.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-Thin.woff2 +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-ThinItalic.eot +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-ThinItalic.ttf +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-ThinItalic.woff +0 -0
- package/src/assets/fonts/FilsonPro/FilsonPro-ThinItalic.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Bold.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Bold.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Bold.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Bold.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-BoldItalic.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-BoldItalic.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-BoldItalic.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-BoldItalic.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-CondensedBlack.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-CondensedBlack.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-CondensedBlack.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-CondensedBlack.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-CondensedBold.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-CondensedBold.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-CondensedBold.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-CondensedBold.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Italic.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Italic.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Italic.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Italic.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Light.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Light.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Light.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Light.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-LightItalic.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-LightItalic.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-LightItalic.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-LightItalic.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Medium.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Medium.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Medium.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Medium.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-MediumItalic.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-MediumItalic.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-MediumItalic.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-MediumItalic.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Thin.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Thin.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Thin.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-Thin.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-ThinItalic.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-ThinItalic.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-ThinItalic.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-ThinItalic.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-UltraLight.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-UltraLight.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-UltraLight.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-UltraLight.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-UltraLightItalic.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-UltraLightItalic.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-UltraLightItalic.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue-UltraLightItalic.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue.eot +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue.ttf +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue.woff +0 -0
- package/src/assets/fonts/HelveticaNeue/HelveticaNeue.woff2 +0 -0
- package/src/assets/fonts/HelveticaNeue/demo.html +569 -0
- package/src/assets/fonts/HelveticaNeue/stylesheet.css +181 -0
- package/src/assets/fonts/Lato/Lato-Black.eot +0 -0
- package/src/assets/fonts/Lato/Lato-Black.ttf +0 -0
- package/src/assets/fonts/Lato/Lato-Black.woff +0 -0
- package/src/assets/fonts/Lato/Lato-Black.woff2 +0 -0
- package/src/assets/fonts/Lato/Lato-Bold.eot +0 -0
- package/src/assets/fonts/Lato/Lato-Bold.ttf +0 -0
- package/src/assets/fonts/Lato/Lato-Bold.woff +0 -0
- package/src/assets/fonts/Lato/Lato-Bold.woff2 +0 -0
- package/src/assets/fonts/Lato/Lato-Light.eot +0 -0
- package/src/assets/fonts/Lato/Lato-Light.ttf +0 -0
- package/src/assets/fonts/Lato/Lato-Light.woff +0 -0
- package/src/assets/fonts/Lato/Lato-Light.woff2 +0 -0
- package/src/assets/fonts/Lato/Lato-Regular.eot +0 -0
- package/src/assets/fonts/Lato/Lato-Regular.ttf +0 -0
- package/src/assets/fonts/Lato/Lato-Regular.woff +0 -0
- package/src/assets/fonts/Lato/Lato-Regular.woff2 +0 -0
- package/src/assets/fonts/Lux-Icons.woff2 +0 -0
- package/src/assets/fonts/MaterialIcons-Regular.eot +0 -0
- package/src/assets/fonts/MaterialIcons-Regular.ttf +0 -0
- package/src/assets/fonts/MaterialIcons-Regular.woff +0 -0
- package/src/assets/fonts/MaterialIcons-Regular.woff2 +0 -0
- package/src/assets/fonts/OpenSans-Regular.ttf +0 -0
- package/src/assets/fonts/Roboto-Regular.ttf +0 -0
- package/src/assets/images/logo-transparent.png +0 -0
- package/src/assets/svgs/atomix-logo.svg +9 -0
- package/src/components/Accordion/Accordion.stories.tsx +271 -0
- package/src/components/Accordion/Accordion.tsx +131 -0
- package/src/components/Accordion/index.ts +3 -0
- package/src/components/Accordion/scripts/accordionInteractions.ts +70 -0
- package/src/components/Accordion/scripts/bundle.ts +24 -0
- package/src/components/Accordion/scripts/constants.ts +11 -0
- package/src/components/Accordion/scripts/index.ts +212 -0
- package/src/components/AtomixLogo/AtomixLogo.tsx +36 -0
- package/src/components/AtomixLogo/index.ts +3 -0
- package/src/components/AtomixLogo.tsx +40 -0
- package/src/components/Avatar/Avatar.stories.tsx +263 -0
- package/src/components/Avatar/Avatar.tsx +68 -0
- package/src/components/Avatar/AvatarGroup.tsx +73 -0
- package/src/components/Avatar/index.ts +3 -0
- package/src/components/Avatar/scripts/index.ts +497 -0
- package/src/components/Badge/Badge.stories.tsx +374 -0
- package/src/components/Badge/Badge.tsx +39 -0
- package/src/components/Badge/index.ts +3 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +108 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +98 -0
- package/src/components/Breadcrumb/index.ts +3 -0
- package/src/components/Breadcrumb/scripts/breadcrumb.ts +208 -0
- package/src/components/Breadcrumb/scripts/demo.html +246 -0
- package/src/components/Breadcrumb/scripts/index.ts +5 -0
- package/src/components/Breadcrumb/scripts/types.ts +69 -0
- package/src/components/Button/Button.stories.tsx +313 -0
- package/src/components/Button/Button.tsx +70 -0
- package/src/components/Button/index.ts +3 -0
- package/src/components/Button/scripts/buttonInteractions.ts +73 -0
- package/src/components/Button/scripts/index.ts +1 -0
- package/src/components/Callout/Callout.stories.tsx +595 -0
- package/src/components/Callout/Callout.tsx +78 -0
- package/src/components/Callout/index.ts +1 -0
- package/src/components/Callout/scripts/CalloutInteractions.ts +350 -0
- package/src/components/Callout/scripts/bundle.ts +18 -0
- package/src/components/Callout/scripts/index.ts +130 -0
- package/src/components/Card/Card.stories.tsx +107 -0
- package/src/components/Card/Card.tsx +69 -0
- package/src/components/Card/ElevationCard.tsx +47 -0
- package/src/components/Card/index.ts +15 -0
- package/src/components/Card/scripts/bundle.ts +30 -0
- package/src/components/Card/scripts/cardInteractions.ts +171 -0
- package/src/components/Card/scripts/demo.html +322 -0
- package/src/components/Card/scripts/index.ts +318 -0
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +46 -0
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +85 -0
- package/src/components/ColorModeToggle/index.ts +2 -0
- package/src/components/Countdown/Countdown.stories.tsx +47 -0
- package/src/components/Countdown/Countdown.tsx +90 -0
- package/src/components/Countdown/index.ts +2 -0
- package/src/components/Countdown/scripts/index.ts +238 -0
- package/src/components/DataTable/DataTable.stories.tsx +249 -0
- package/src/components/DataTable/DataTable.tsx +213 -0
- package/src/components/DataTable/index.ts +3 -0
- package/src/components/DataTable/scripts/bundle.ts +20 -0
- package/src/components/DataTable/scripts/index.ts +781 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +365 -0
- package/src/components/DatePicker/DatePicker.tsx +504 -0
- package/src/components/DatePicker/index.ts +4 -0
- package/src/components/DatePicker/readme.md +106 -0
- package/src/components/DatePicker/scripts/bundle.ts +39 -0
- package/src/components/DatePicker/scripts/componentInteractions.ts +230 -0
- package/src/components/DatePicker/scripts/index.ts +907 -0
- package/src/components/DatePicker/types.ts +167 -0
- package/src/components/DatePicker/utils.ts +163 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +359 -0
- package/src/components/Dropdown/Dropdown.tsx +342 -0
- package/src/components/Dropdown/index.ts +14 -0
- package/src/components/Dropdown/readme.md +151 -0
- package/src/components/Dropdown/scripts/bundle.ts +24 -0
- package/src/components/Dropdown/scripts/componentInteractions.ts +39 -0
- package/src/components/Dropdown/scripts/index.ts +612 -0
- package/src/components/EdgePanel/EdgePanel.stories.tsx +267 -0
- package/src/components/EdgePanel/EdgePanel.tsx +73 -0
- package/src/components/EdgePanel/index.ts +1 -0
- package/src/components/EdgePanel/scripts/bundle.ts +30 -0
- package/src/components/EdgePanel/scripts/edgePanelInteractions.ts +206 -0
- package/src/components/EdgePanel/scripts/index.ts +415 -0
- package/src/components/Form/Checkbox.stories.tsx +77 -0
- package/src/components/Form/Checkbox.tsx +69 -0
- package/src/components/Form/Form.stories.tsx +491 -0
- package/src/components/Form/Form.tsx +46 -0
- package/src/components/Form/FormGroup.stories.tsx +163 -0
- package/src/components/Form/FormGroup.tsx +53 -0
- package/src/components/Form/Input.stories.tsx +107 -0
- package/src/components/Form/Input.tsx +87 -0
- package/src/components/Form/Radio.stories.tsx +95 -0
- package/src/components/Form/Radio.tsx +65 -0
- package/src/components/Form/Select.stories.tsx +152 -0
- package/src/components/Form/Select.tsx +191 -0
- package/src/components/Form/Textarea.stories.tsx +124 -0
- package/src/components/Form/Textarea.tsx +78 -0
- package/src/components/Form/index.ts +7 -0
- package/src/components/Hero/Hero.stories.tsx +297 -0
- package/src/components/Hero/Hero.tsx +175 -0
- package/src/components/Hero/index.ts +6 -0
- package/src/components/Hero/scripts/bundle.ts +33 -0
- package/src/components/Hero/scripts/heroInteractions.ts +130 -0
- package/src/components/Hero/scripts/index.ts +144 -0
- package/src/components/Icon/Icon.tsx +87 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/List/List.stories.tsx +123 -0
- package/src/components/List/List.tsx +35 -0
- package/src/components/List/ListGroup.tsx +34 -0
- package/src/components/List/index.ts +2 -0
- package/src/components/Messages/Messages.stories.tsx +161 -0
- package/src/components/Messages/Messages.tsx +172 -0
- package/src/components/Messages/index.ts +3 -0
- package/src/components/Messages/scripts/bundle.ts +47 -0
- package/src/components/Messages/scripts/componentInteractions.ts +132 -0
- package/src/components/Messages/scripts/index.ts +378 -0
- package/src/components/Modal/Modal.stories.tsx +288 -0
- package/src/components/Modal/Modal.tsx +198 -0
- package/src/components/Modal/README.md +169 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/Modal/scripts/bundle.ts +23 -0
- package/src/components/Modal/scripts/index.ts +374 -0
- package/src/components/Modal/scripts/modalInteractions.ts +141 -0
- package/src/components/Navigation/Menu/MegaMenu.tsx +107 -0
- 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/Navigation/Navbar/Navbar.stories.tsx +552 -0
- 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 +194 -0
- package/src/components/Pagination/Pagination.tsx +162 -0
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/Pagination/scripts/bundle.ts +15 -0
- package/src/components/Pagination/scripts/index.ts +315 -0
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +160 -0
- package/src/components/PhotoViewer/PhotoViewer.tsx +246 -0
- package/src/components/PhotoViewer/PhotoViewerHeader.tsx +177 -0
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +173 -0
- package/src/components/PhotoViewer/PhotoViewerInfo.tsx +65 -0
- package/src/components/PhotoViewer/PhotoViewerNavigation.tsx +82 -0
- package/src/components/PhotoViewer/PhotoViewerThumbnails.tsx +53 -0
- package/src/components/PhotoViewer/README.md +358 -0
- package/src/components/PhotoViewer/examples/ImageGallery.tsx +190 -0
- package/src/components/PhotoViewer/examples/SimpleGallery.tsx +77 -0
- package/src/components/PhotoViewer/examples/index.ts +2 -0
- package/src/components/PhotoViewer/index.ts +14 -0
- package/src/components/PhotoViewer/scripts/PhotoViewerInteractions.ts +253 -0
- package/src/components/PhotoViewer/scripts/bundle.ts +81 -0
- package/src/components/PhotoViewer/scripts/index.ts +947 -0
- package/src/components/Popover/Popover.stories.tsx +143 -0
- package/src/components/Popover/Popover.tsx +137 -0
- package/src/components/Popover/index.ts +5 -0
- package/src/components/Popover/readme.md +120 -0
- package/src/components/Popover/scripts/bundle.ts +12 -0
- package/src/components/Popover/scripts/componentInteractions.ts +299 -0
- package/src/components/Popover/scripts/index.ts +342 -0
- package/src/components/ProductReview/ProductReview.stories.tsx +88 -0
- package/src/components/ProductReview/ProductReview.tsx +169 -0
- package/src/components/ProductReview/index.ts +3 -0
- package/src/components/ProductReview/scripts/bundle.ts +3 -0
- package/src/components/ProductReview/scripts/componentInteractions.ts +129 -0
- package/src/components/ProductReview/scripts/index.ts +3 -0
- package/src/components/Progress/Progress.stories.tsx +75 -0
- package/src/components/Progress/Progress.tsx +45 -0
- package/src/components/Progress/index.ts +1 -0
- package/src/components/Progress/scripts/bundle.ts +17 -0
- package/src/components/Progress/scripts/componentInteractions.ts +101 -0
- package/src/components/Progress/scripts/index.ts +184 -0
- package/src/components/Rating/Rating.stories.tsx +109 -0
- package/src/components/Rating/Rating.tsx +286 -0
- package/src/components/Rating/index.ts +6 -0
- package/src/components/Rating/scripts/bundle.ts +39 -0
- package/src/components/Rating/scripts/index.d.ts +12 -0
- package/src/components/Rating/scripts/index.ts +336 -0
- package/src/components/Rating/scripts/ratingInteractions.ts +160 -0
- package/src/components/River/River.stories.tsx +230 -0
- package/src/components/River/River.tsx +162 -0
- package/src/components/River/examples.html +223 -0
- package/src/components/River/index.ts +2 -0
- package/src/components/River/scripts/index.ts +137 -0
- package/src/components/SectionIntro/SectionIntro.stories.tsx +145 -0
- package/src/components/SectionIntro/SectionIntro.tsx +197 -0
- package/src/components/SectionIntro/index.ts +3 -0
- package/src/components/SectionIntro/scripts/bundle.ts +9 -0
- package/src/components/SectionIntro/scripts/componentInteractions.ts +37 -0
- package/src/components/SectionIntro/scripts/index.ts +163 -0
- package/src/components/Spinner/Spinner.stories.tsx +66 -0
- package/src/components/Spinner/Spinner.tsx +36 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Steps/Steps.stories.tsx +158 -0
- package/src/components/Steps/Steps.tsx +154 -0
- package/src/components/Steps/index.ts +3 -0
- package/src/components/Steps/scripts/index.ts +159 -0
- package/src/components/Tab/Tab.stories.tsx +129 -0
- package/src/components/Tab/Tab.tsx +133 -0
- package/src/components/Tab/index.ts +2 -0
- package/src/components/Tab/scripts/index.ts +200 -0
- package/src/components/Testimonial/Testimonial.stories.tsx +180 -0
- package/src/components/Testimonial/Testimonial.tsx +148 -0
- package/src/components/Testimonial/index.ts +3 -0
- package/src/components/Testimonial/scripts/index.ts +107 -0
- package/src/components/Todo/Todo.stories.tsx +155 -0
- package/src/components/Todo/Todo.tsx +158 -0
- package/src/components/Todo/index.ts +1 -0
- package/src/components/Todo/scripts/bundle.ts +14 -0
- package/src/components/Todo/scripts/index.ts +534 -0
- package/src/components/Todo/scripts/todoInteractions.ts +118 -0
- package/src/components/Todo/scripts/types.ts +19 -0
- package/src/components/Toggle/Toggle.stories.tsx +50 -0
- package/src/components/Toggle/Toggle.tsx +114 -0
- package/src/components/Toggle/index.ts +2 -0
- package/src/components/Toggle/scripts/bundle.ts +19 -0
- package/src/components/Toggle/scripts/index.ts +118 -0
- package/src/components/Toggle/scripts/toggleInteractions.ts +77 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +115 -0
- package/src/components/Tooltip/Tooltip.tsx +105 -0
- package/src/components/Tooltip/index.ts +3 -0
- package/src/components/Tooltip/scripts/bundle.ts +0 -0
- package/src/components/Tooltip/scripts/index.ts +395 -0
- package/src/components/Tooltip/scripts/tooltipInteractions.ts +165 -0
- package/src/components/Upload/Upload.stories.tsx +221 -0
- package/src/components/Upload/Upload.tsx +422 -0
- package/src/components/Upload/index.ts +3 -0
- package/src/components/Upload/scripts/index.ts +467 -0
- package/src/components/index.ts +117 -0
- package/src/design-tokens/BoxShadow/BoxShadow.stories.tsx +115 -0
- package/src/design-tokens/Colors/colors.scss +121 -0
- package/src/design-tokens/Colors/colors.stories.tsx +313 -0
- package/src/design-tokens/Spacing/Spacing.scss +62 -0
- package/src/design-tokens/Spacing/Spacing.stories.tsx +115 -0
- package/src/design-tokens/Typography/Typography.scss +240 -0
- package/src/design-tokens/Typography/Typography.stories.tsx +167 -0
- package/src/docs/atomix-component-guidelines.mdx +942 -0
- package/src/docs/atomix-roadmap.mdx +325 -0
- package/src/docs/implementation-guide.mdx +506 -0
- package/src/htmlComponentsEntry.ts +318 -0
- package/src/index.ts +21 -0
- package/src/layouts/Grid/Container.tsx +56 -0
- package/src/layouts/Grid/Grid.stories.tsx +560 -0
- package/src/layouts/Grid/Grid.tsx +67 -0
- package/src/layouts/Grid/GridCol.tsx +160 -0
- package/src/layouts/Grid/README.md +108 -0
- package/src/layouts/Grid/Row.tsx +68 -0
- package/src/layouts/Grid/index.ts +8 -0
- package/src/layouts/MasonryGrid/MasonryGrid.stories.tsx +388 -0
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +406 -0
- package/src/layouts/MasonryGrid/MasonryGridItem.tsx +42 -0
- package/src/layouts/MasonryGrid/README.md +117 -0
- package/src/layouts/MasonryGrid/index.ts +4 -0
- package/src/layouts/index.ts +9 -0
- package/src/lib/README.md +89 -0
- package/src/lib/composables/index.ts +44 -0
- package/src/lib/composables/useAccordion.ts +129 -0
- package/src/lib/composables/useBadge.ts +42 -0
- package/src/lib/composables/useBreadcrumb.ts +74 -0
- package/src/lib/composables/useButton.ts +59 -0
- package/src/lib/composables/useCallout.ts +55 -0
- package/src/lib/composables/useCard.ts +155 -0
- package/src/lib/composables/useCheckbox.ts +70 -0
- package/src/lib/composables/useDataTable.ts +208 -0
- package/src/lib/composables/useDatePicker.ts +562 -0
- package/src/lib/composables/useDropdown.ts +272 -0
- package/src/lib/composables/useEdgePanel.ts +261 -0
- package/src/lib/composables/useForm.ts +62 -0
- package/src/lib/composables/useFormGroup.ts +51 -0
- package/src/lib/composables/useHero.ts +250 -0
- package/src/lib/composables/useInput.ts +58 -0
- package/src/lib/composables/useMessages.ts +77 -0
- package/src/lib/composables/useModal.ts +110 -0
- package/src/lib/composables/useNavbar.ts +288 -0
- package/src/lib/composables/usePagination.ts +101 -0
- package/src/lib/composables/usePhotoViewer.ts +904 -0
- package/src/lib/composables/usePopover.ts +354 -0
- package/src/lib/composables/useProgress.ts +74 -0
- package/src/lib/composables/useRadio.ts +47 -0
- package/src/lib/composables/useRating.ts +174 -0
- package/src/lib/composables/useRiver.ts +205 -0
- package/src/lib/composables/useSelect.ts +52 -0
- package/src/lib/composables/useSideMenu.ts +197 -0
- package/src/lib/composables/useSpinner.ts +42 -0
- package/src/lib/composables/useTextarea.ts +55 -0
- package/src/lib/composables/useTodo.ts +142 -0
- package/src/lib/constants/components.ts +1050 -0
- package/src/lib/constants/index.ts +4 -0
- package/src/lib/index.ts +11 -0
- package/src/lib/types/components.ts +2498 -0
- package/src/lib/types/index.ts +2 -0
- package/src/lib/utils/dom.ts +41 -0
- package/src/lib/utils/icons.ts +74 -0
- package/src/lib/utils/index.ts +7 -0
- package/src/lib/utils/useForkRef.ts +36 -0
- package/src/styles/01-settings/_index.scss +64 -0
- package/src/styles/01-settings/_settings.accordion.scss +29 -0
- package/src/styles/01-settings/_settings.animations.scss +2 -0
- package/src/styles/01-settings/_settings.avatar-group.scss +20 -0
- package/src/styles/01-settings/_settings.avatar.scss +46 -0
- package/src/styles/01-settings/_settings.badge.scss +12 -0
- package/src/styles/01-settings/_settings.border-radius.scss +12 -0
- package/src/styles/01-settings/_settings.border.scss +14 -0
- package/src/styles/01-settings/_settings.box-shadow.scss +28 -0
- package/src/styles/01-settings/_settings.breadcrumb.scss +19 -0
- package/src/styles/01-settings/_settings.breakpoints.scss +8 -0
- package/src/styles/01-settings/_settings.btn-group.scss +1 -0
- package/src/styles/01-settings/_settings.button.scss +81 -0
- package/src/styles/01-settings/_settings.callout.scss +61 -0
- package/src/styles/01-settings/_settings.card.scss +36 -0
- package/src/styles/01-settings/_settings.checkbox-group.scss +2 -0
- package/src/styles/01-settings/_settings.checkbox.scss +20 -0
- package/src/styles/01-settings/_settings.color-mode.scss +5 -0
- package/src/styles/01-settings/_settings.colors.scss +252 -0
- package/src/styles/01-settings/_settings.config.scss +4 -0
- package/src/styles/01-settings/_settings.countdown.scss +15 -0
- package/src/styles/01-settings/_settings.data-table.scss +52 -0
- package/src/styles/01-settings/_settings.datepicker.scss +44 -0
- package/src/styles/01-settings/_settings.dropdown.scss +38 -0
- package/src/styles/01-settings/_settings.edge-panel.scss +17 -0
- package/src/styles/01-settings/_settings.fonts.scss +17 -0
- package/src/styles/01-settings/_settings.form-group.scss +11 -0
- package/src/styles/01-settings/_settings.form.scss +3 -0
- package/src/styles/01-settings/_settings.grid.scss +15 -0
- package/src/styles/01-settings/_settings.hero.scss +30 -0
- package/src/styles/01-settings/_settings.input.scss +38 -0
- package/src/styles/01-settings/_settings.link.scss +12 -0
- package/src/styles/01-settings/_settings.list-group.scss +14 -0
- package/src/styles/01-settings/_settings.list.scss +10 -0
- package/src/styles/01-settings/_settings.maps.scss +278 -0
- package/src/styles/01-settings/_settings.masonry-grid.scss +17 -0
- package/src/styles/01-settings/_settings.menu.scss +35 -0
- package/src/styles/01-settings/_settings.messages.scss +71 -0
- package/src/styles/01-settings/_settings.modal.scss +31 -0
- package/src/styles/01-settings/_settings.nav.scss +18 -0
- package/src/styles/01-settings/_settings.navbar.scss +46 -0
- package/src/styles/01-settings/_settings.pagination.scss +29 -0
- package/src/styles/01-settings/_settings.photoviewer.scss +35 -0
- package/src/styles/01-settings/_settings.popover.scss +13 -0
- package/src/styles/01-settings/_settings.position.scss +7 -0
- package/src/styles/01-settings/_settings.progress.scss +15 -0
- package/src/styles/01-settings/_settings.rating.scss +8 -0
- package/src/styles/01-settings/_settings.river.scss +34 -0
- package/src/styles/01-settings/_settings.sectionintro.scss +21 -0
- package/src/styles/01-settings/_settings.select.scss +32 -0
- package/src/styles/01-settings/_settings.side-menu.scss +64 -0
- package/src/styles/01-settings/_settings.skeleton.scss +14 -0
- package/src/styles/01-settings/_settings.spacing.scss +68 -0
- package/src/styles/01-settings/_settings.spinner.scss +13 -0
- package/src/styles/01-settings/_settings.steps.scss +26 -0
- package/src/styles/01-settings/_settings.tabs.scss +28 -0
- package/src/styles/01-settings/_settings.testimonials.scss +18 -0
- package/src/styles/01-settings/_settings.todo.scss +50 -0
- package/src/styles/01-settings/_settings.toggle.scss +34 -0
- package/src/styles/01-settings/_settings.tooltip.scss +19 -0
- package/src/styles/01-settings/_settings.typography.scss +93 -0
- package/src/styles/01-settings/_settings.upload.scss +70 -0
- package/src/styles/01-settings/_settings.z-layers.scss +9 -0
- package/src/styles/02-tools/_index.scss +20 -0
- package/src/styles/02-tools/_tools.animations.scss +19 -0
- package/src/styles/02-tools/_tools.border-radius.scss +78 -0
- package/src/styles/02-tools/_tools.breakpoints.scss +48 -0
- package/src/styles/02-tools/_tools.button.scss +115 -0
- package/src/styles/02-tools/_tools.clearfix.scss +10 -0
- package/src/styles/02-tools/_tools.color-functions.scss +28 -0
- package/src/styles/02-tools/_tools.color-mode.scss +22 -0
- package/src/styles/02-tools/_tools.event.scss +22 -0
- package/src/styles/02-tools/_tools.grid.scss +76 -0
- package/src/styles/02-tools/_tools.hidden-visually.scss +32 -0
- package/src/styles/02-tools/_tools.hidden.scss +2 -0
- package/src/styles/02-tools/_tools.map-loop.scss +31 -0
- package/src/styles/02-tools/_tools.media-queries.scss +69 -0
- package/src/styles/02-tools/_tools.object-fit.scss +4 -0
- package/src/styles/02-tools/_tools.placeholder.scss +17 -0
- package/src/styles/02-tools/_tools.rem.scss +5 -0
- package/src/styles/02-tools/_tools.size.scss +8 -0
- package/src/styles/02-tools/_tools.spacing.scss +140 -0
- package/src/styles/02-tools/_tools.to-rgb.scss +9 -0
- package/src/styles/02-tools/_tools.transition.scss +50 -0
- package/src/styles/02-tools/_tools.utilities.scss +14 -0
- package/src/styles/02-tools/_tools.utility-api.scss +144 -0
- package/src/styles/03-generic/_generic.fonts.scss +24 -0
- package/src/styles/03-generic/_generic.reset.scss +402 -0
- package/src/styles/03-generic/_generic.root.scss +184 -0
- package/src/styles/03-generic/_generic.selection.scss +15 -0
- package/src/styles/03-generic/_index.scss +5 -0
- package/src/styles/04-elements/_elements.all.scss +16 -0
- package/src/styles/04-elements/_elements.body.scss +15 -0
- package/src/styles/04-elements/_elements.heading.scss +54 -0
- package/src/styles/04-elements/_elements.html.scss +9 -0
- package/src/styles/04-elements/_elements.links.scss +11 -0
- package/src/styles/04-elements/_index.scss +6 -0
- package/src/styles/05-objects/_index.scss +4 -0
- package/src/styles/05-objects/_objects.container.scss +36 -0
- package/src/styles/05-objects/_objects.grid.scss +25 -0
- package/src/styles/05-objects/_objects.masonry-grid.scss +96 -0
- package/src/styles/06-components/_components.accordion.scss +109 -0
- package/src/styles/06-components/_components.avatar-group.scss +85 -0
- package/src/styles/06-components/_components.avatar.scss +101 -0
- package/src/styles/06-components/_components.badge.scss +62 -0
- package/src/styles/06-components/_components.breadcrumb.scss +80 -0
- package/src/styles/06-components/_components.btn-group.scss +35 -0
- package/src/styles/06-components/_components.button.scss +134 -0
- package/src/styles/06-components/_components.callout.scss +272 -0
- package/src/styles/06-components/_components.card.scss +148 -0
- package/src/styles/06-components/_components.checkbox-group.scss +17 -0
- package/src/styles/06-components/_components.checkbox.scss +135 -0
- package/src/styles/06-components/_components.color-mode-toggle.scss +36 -0
- package/src/styles/06-components/_components.countdown.scss +63 -0
- package/src/styles/06-components/_components.data-table.scss +183 -0
- package/src/styles/06-components/_components.datepicker.scss +546 -0
- package/src/styles/06-components/_components.dropdown.scss +255 -0
- package/src/styles/06-components/_components.edge-panel.scss +350 -0
- package/src/styles/06-components/_components.form-group.scss +78 -0
- package/src/styles/06-components/_components.form.scss +21 -0
- package/src/styles/06-components/_components.hero.scss +147 -0
- package/src/styles/06-components/_components.icon.scss +80 -0
- package/src/styles/06-components/_components.image-gallery.scss +72 -0
- package/src/styles/06-components/_components.input.scss +107 -0
- package/src/styles/06-components/_components.list-group.scss +63 -0
- package/src/styles/06-components/_components.list.scss +57 -0
- package/src/styles/06-components/_components.menu.scss +239 -0
- package/src/styles/06-components/_components.messages.scss +332 -0
- package/src/styles/06-components/_components.modal.scss +153 -0
- package/src/styles/06-components/_components.nav.scss +172 -0
- package/src/styles/06-components/_components.navbar.scss +310 -0
- package/src/styles/06-components/_components.pagination.scss +155 -0
- package/src/styles/06-components/_components.photoviewer.scss +878 -0
- package/src/styles/06-components/_components.popover.scss +99 -0
- package/src/styles/06-components/_components.product-review.scss +128 -0
- package/src/styles/06-components/_components.progress.scss +43 -0
- package/src/styles/06-components/_components.rating.scss +161 -0
- package/src/styles/06-components/_components.river.scss +216 -0
- package/src/styles/06-components/_components.sectionintro.scss +163 -0
- package/src/styles/06-components/_components.select.scss +125 -0
- package/src/styles/06-components/_components.side-menu.scss +234 -0
- package/src/styles/06-components/_components.skeleton.scss +55 -0
- package/src/styles/06-components/_components.spinner.scss +45 -0
- package/src/styles/06-components/_components.steps.scss +99 -0
- package/src/styles/06-components/_components.tabs.scss +124 -0
- package/src/styles/06-components/_components.testimonials.scss +65 -0
- package/src/styles/06-components/_components.todo.scss +163 -0
- package/src/styles/06-components/_components.toggle.scss +100 -0
- package/src/styles/06-components/_components.tooltip.scss +136 -0
- package/src/styles/06-components/_components.upload.scss +250 -0
- package/src/styles/06-components/_index.scss +49 -0
- package/src/styles/99-utilities/_index.scss +21 -0
- package/src/styles/99-utilities/_utilities.background.scss +28 -0
- package/src/styles/99-utilities/_utilities.border.scss +157 -0
- package/src/styles/99-utilities/_utilities.clearfix.scss +5 -0
- package/src/styles/99-utilities/_utilities.display.scss +13 -0
- package/src/styles/99-utilities/_utilities.flex.scss +109 -0
- package/src/styles/99-utilities/_utilities.link.scss +96 -0
- package/src/styles/99-utilities/_utilities.object-fit.scss +17 -0
- package/src/styles/99-utilities/_utilities.opacity.scss +16 -0
- package/src/styles/99-utilities/_utilities.overflow.scss +20 -0
- package/src/styles/99-utilities/_utilities.position.scss +40 -0
- package/src/styles/99-utilities/_utilities.scss +42 -0
- package/src/styles/99-utilities/_utilities.shadow.scss +19 -0
- package/src/styles/99-utilities/_utilities.sizes.scss +81 -0
- package/src/styles/99-utilities/_utilities.spacing.scss +188 -0
- package/src/styles/99-utilities/_utilities.text.scss +87 -0
- package/src/styles/99-utilities/_utilities.visibility.scss +13 -0
- package/src/styles/99-utilities/_utilities.visually-hidden.scss +5 -0
- package/src/styles/99-utilities/_utilities.z-index.scss +11 -0
- package/src/styles/index.scss +12 -0
- package/tsconfig.json +74 -0
- package/webpack.config.js +463 -0
- 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
|
@@ -0,0 +1,947 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PhotoViewer - Vanilla JavaScript implementation
|
|
3
|
+
* A comprehensive photo viewer component with zoom, pan, navigation, and touch gestures
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
interface PhotoViewerOptions {
|
|
7
|
+
startIndex?: number;
|
|
8
|
+
enableKeyboardNavigation?: boolean;
|
|
9
|
+
enableGestures?: boolean;
|
|
10
|
+
enableFullscreen?: boolean;
|
|
11
|
+
thumbnailPosition?: 'bottom' | 'top' | 'left' | 'right' | 'none';
|
|
12
|
+
onImageChange?: (index: number) => void;
|
|
13
|
+
onClose?: () => void;
|
|
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
|
+
>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ImageType {
|
|
30
|
+
src: string;
|
|
31
|
+
alt?: string;
|
|
32
|
+
thumbnail?: string;
|
|
33
|
+
title?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
date?: string;
|
|
36
|
+
author?: string;
|
|
37
|
+
tags?: string[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface ImageState {
|
|
41
|
+
zoomLevel: number;
|
|
42
|
+
position: { x: number; y: number };
|
|
43
|
+
rotation: number;
|
|
44
|
+
bounds: {
|
|
45
|
+
minX: number;
|
|
46
|
+
maxX: number;
|
|
47
|
+
minY: number;
|
|
48
|
+
maxY: number;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
class PhotoViewer {
|
|
53
|
+
private element: HTMLElement;
|
|
54
|
+
private options: PhotoViewerOptions;
|
|
55
|
+
private currentIndex: number = 0;
|
|
56
|
+
private images: ImageType[] = [];
|
|
57
|
+
private imageStates: Record<number, ImageState> = {};
|
|
58
|
+
private isDragging = false;
|
|
59
|
+
private isFullscreen = false;
|
|
60
|
+
private showInfo = false;
|
|
61
|
+
private isTransitioning = false;
|
|
62
|
+
private startDragPosition = { x: 0, y: 0 };
|
|
63
|
+
private touchPoints: { x: number; y: number }[] = [];
|
|
64
|
+
private lastDistance: number | null = null;
|
|
65
|
+
private lastMidpoint: { x: number; y: number } | null = null;
|
|
66
|
+
|
|
67
|
+
// DOM references
|
|
68
|
+
private backdrop?: HTMLElement;
|
|
69
|
+
private container?: HTMLElement;
|
|
70
|
+
private header?: HTMLElement;
|
|
71
|
+
private content?: HTMLElement;
|
|
72
|
+
private imageContainer?: HTMLElement;
|
|
73
|
+
private imageElement?: HTMLImageElement;
|
|
74
|
+
private thumbnails?: HTMLElement;
|
|
75
|
+
private infoPanel?: HTMLElement;
|
|
76
|
+
private navPrev?: HTMLElement;
|
|
77
|
+
private navNext?: HTMLElement;
|
|
78
|
+
|
|
79
|
+
static DEFAULTS: PhotoViewerOptions = {
|
|
80
|
+
startIndex: 0,
|
|
81
|
+
enableKeyboardNavigation: true,
|
|
82
|
+
enableGestures: true,
|
|
83
|
+
enableFullscreen: true,
|
|
84
|
+
thumbnailPosition: 'bottom',
|
|
85
|
+
images: [],
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
constructor(element: string | HTMLElement, options: PhotoViewerOptions = {}) {
|
|
89
|
+
this.element =
|
|
90
|
+
typeof element === 'string' ? (document.querySelector(element) as HTMLElement) : element;
|
|
91
|
+
this.options = { ...PhotoViewer.DEFAULTS, ...options };
|
|
92
|
+
|
|
93
|
+
if (!this.element) {
|
|
94
|
+
throw new Error('PhotoViewer: Element not found');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this.currentIndex = this.options.startIndex || 0;
|
|
98
|
+
this.images = this.processImages(this.options.images || []);
|
|
99
|
+
this.initializeImageStates();
|
|
100
|
+
|
|
101
|
+
this.init();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private init(): void {
|
|
105
|
+
this.createStructure();
|
|
106
|
+
this.bindEvents();
|
|
107
|
+
this.render();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private initializeImageStates(): void {
|
|
111
|
+
this.imageStates = {};
|
|
112
|
+
for (let i = 0; i < this.images.length; i++) {
|
|
113
|
+
this.imageStates[i] = this.getDefaultImageState();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private getDefaultImageState(): ImageState {
|
|
118
|
+
return {
|
|
119
|
+
zoomLevel: 1,
|
|
120
|
+
position: { x: 0, y: 0 },
|
|
121
|
+
rotation: 0,
|
|
122
|
+
bounds: { minX: 0, maxX: 0, minY: 0, maxY: 0 },
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private getCurrentImageState(): ImageState {
|
|
127
|
+
return this.imageStates[this.currentIndex] || this.getDefaultImageState();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private updateCurrentImageState(updates: Partial<ImageState>): void {
|
|
131
|
+
this.imageStates[this.currentIndex] = {
|
|
132
|
+
...this.getCurrentImageState(),
|
|
133
|
+
...updates,
|
|
134
|
+
};
|
|
135
|
+
this.updateImageTransform();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private processImages(images: Array<string | ImageType>): ImageType[] {
|
|
139
|
+
return images.map(img => (typeof img === 'string' ? { src: img } : img));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private calculateBounds(zoomLevel: number, rotation: number): ImageState['bounds'] {
|
|
143
|
+
if (!this.imageElement || !this.imageContainer) {
|
|
144
|
+
return { minX: 0, maxX: 0, minY: 0, maxY: 0 };
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const image = this.imageElement;
|
|
148
|
+
const container = this.imageContainer;
|
|
149
|
+
|
|
150
|
+
const imageWidth = image.naturalWidth || image.width;
|
|
151
|
+
const imageHeight = image.naturalHeight || image.height;
|
|
152
|
+
|
|
153
|
+
const containerRect = container.getBoundingClientRect();
|
|
154
|
+
const containerWidth = containerRect.width;
|
|
155
|
+
const containerHeight = containerRect.height;
|
|
156
|
+
|
|
157
|
+
const rotationRad = (rotation * Math.PI) / 180;
|
|
158
|
+
const cos = Math.abs(Math.cos(rotationRad));
|
|
159
|
+
const sin = Math.abs(Math.sin(rotationRad));
|
|
160
|
+
|
|
161
|
+
const aspectRatio = imageWidth / imageHeight;
|
|
162
|
+
let displayWidth, displayHeight;
|
|
163
|
+
|
|
164
|
+
if (containerWidth / containerHeight > aspectRatio) {
|
|
165
|
+
displayHeight = Math.min(containerHeight * 0.9, imageHeight);
|
|
166
|
+
displayWidth = displayHeight * aspectRatio;
|
|
167
|
+
} else {
|
|
168
|
+
displayWidth = Math.min(containerWidth * 0.9, imageWidth);
|
|
169
|
+
displayHeight = displayWidth / aspectRatio;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const rotatedWidth = displayWidth * cos + displayHeight * sin;
|
|
173
|
+
const rotatedHeight = displayWidth * sin + displayHeight * cos;
|
|
174
|
+
|
|
175
|
+
const scaledWidth = rotatedWidth * zoomLevel;
|
|
176
|
+
const scaledHeight = rotatedHeight * zoomLevel;
|
|
177
|
+
|
|
178
|
+
const maxX = Math.max(0, (scaledWidth - containerWidth) / 2);
|
|
179
|
+
const maxY = Math.max(0, (scaledHeight - containerHeight) / 2);
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
minX: -maxX,
|
|
183
|
+
maxX: maxX,
|
|
184
|
+
minY: -maxY,
|
|
185
|
+
maxY: maxY,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private constrainPosition(
|
|
190
|
+
position: { x: number; y: number },
|
|
191
|
+
bounds: ImageState['bounds']
|
|
192
|
+
): { x: number; y: number } {
|
|
193
|
+
return {
|
|
194
|
+
x: Math.max(bounds.minX, Math.min(bounds.maxX, position.x)),
|
|
195
|
+
y: Math.max(bounds.minY, Math.min(bounds.maxY, position.y)),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
private updateBounds(): void {
|
|
200
|
+
const currentState = this.getCurrentImageState();
|
|
201
|
+
const newBounds = this.calculateBounds(currentState.zoomLevel, currentState.rotation);
|
|
202
|
+
const constrainedPosition = this.constrainPosition(currentState.position, newBounds);
|
|
203
|
+
|
|
204
|
+
this.updateCurrentImageState({
|
|
205
|
+
bounds: newBounds,
|
|
206
|
+
position: constrainedPosition,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private createStructure(): void {
|
|
211
|
+
this.element.className = 'c-photo-viewer';
|
|
212
|
+
this.element.setAttribute('role', 'dialog');
|
|
213
|
+
this.element.setAttribute('aria-modal', 'true');
|
|
214
|
+
this.element.setAttribute('aria-label', 'Photo viewer');
|
|
215
|
+
|
|
216
|
+
this.element.innerHTML = `
|
|
217
|
+
<div class="c-photo-viewer__backdrop"></div>
|
|
218
|
+
<div class="c-photo-viewer__container">
|
|
219
|
+
<div class="c-photo-viewer__header">
|
|
220
|
+
<div class="c-photo-viewer__counter-badge"></div>
|
|
221
|
+
<div class="c-photo-viewer__actions">
|
|
222
|
+
<button class="c-photo-viewer__action-button" data-action="zoom-out" aria-label="Zoom out">
|
|
223
|
+
<svg width="20" height="20"><path d="M3 10h14" stroke="currentColor" stroke-width="2"/></svg>
|
|
224
|
+
</button>
|
|
225
|
+
<button class="c-photo-viewer__action-button" data-action="reset-zoom" aria-label="Reset zoom">
|
|
226
|
+
<svg width="20" height="20"><circle cx="10" cy="10" r="7" stroke="currentColor" stroke-width="2" fill="none"/></svg>
|
|
227
|
+
</button>
|
|
228
|
+
<button class="c-photo-viewer__action-button" data-action="zoom-in" aria-label="Zoom in">
|
|
229
|
+
<svg width="20" height="20"><path d="M10 3v14M3 10h14" stroke="currentColor" stroke-width="2"/></svg>
|
|
230
|
+
</button>
|
|
231
|
+
<button class="c-photo-viewer__action-button" data-action="rotate" aria-label="Rotate image">
|
|
232
|
+
<svg width="20" height="20"><path d="M1 4v6h6M23 20v-6h-6" stroke="currentColor" stroke-width="2" fill="none"/><path d="M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15" stroke="currentColor" stroke-width="2" fill="none"/></svg>
|
|
233
|
+
</button>
|
|
234
|
+
<button class="c-photo-viewer__action-button" data-action="download" aria-label="Download image">
|
|
235
|
+
<svg width="20" height="20"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" stroke="currentColor" stroke-width="2" fill="none"/></svg>
|
|
236
|
+
</button>
|
|
237
|
+
<button class="c-photo-viewer__action-button" data-action="info" aria-label="Toggle info">
|
|
238
|
+
<svg width="20" height="20"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"/><path d="M12 16v-4M12 8h.01" stroke="currentColor" stroke-width="2"/></svg>
|
|
239
|
+
</button>
|
|
240
|
+
<button class="c-photo-viewer__action-button" data-action="fullscreen" aria-label="Toggle fullscreen">
|
|
241
|
+
<svg width="20" height="20"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" stroke="currentColor" stroke-width="2" fill="none"/></svg>
|
|
242
|
+
</button>
|
|
243
|
+
<button class="c-photo-viewer__action-button c-photo-viewer__close" data-action="close" aria-label="Close">
|
|
244
|
+
<svg width="20" height="20"><path d="M18 6L6 18M6 6l12 12" stroke="currentColor" stroke-width="2"/></svg>
|
|
245
|
+
</button>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
<div class="c-photo-viewer__content">
|
|
249
|
+
<button class="c-photo-viewer__nav-button c-photo-viewer__nav-button--prev" data-action="prev" aria-label="Previous image">
|
|
250
|
+
<svg width="24" height="24"><path d="M15 18l-6-6 6-6" stroke="currentColor" stroke-width="2" fill="none"/></svg>
|
|
251
|
+
</button>
|
|
252
|
+
<div class="c-photo-viewer__image-container">
|
|
253
|
+
<img class="c-photo-viewer__image" alt="" draggable="false">
|
|
254
|
+
</div>
|
|
255
|
+
<button class="c-photo-viewer__nav-button c-photo-viewer__nav-button--next" data-action="next" aria-label="Next image">
|
|
256
|
+
<svg width="24" height="24"><path d="M9 18l6-6-6-6" stroke="currentColor" stroke-width="2" fill="none"/></svg>
|
|
257
|
+
</button>
|
|
258
|
+
</div>
|
|
259
|
+
<div class="c-photo-viewer__thumbnails"></div>
|
|
260
|
+
<div class="c-photo-viewer__info-panel">
|
|
261
|
+
<button class="c-photo-viewer__info-close" data-action="close-info" aria-label="Close info">
|
|
262
|
+
<svg width="20" height="20"><path d="M18 6L6 18M6 6l12 12" stroke="currentColor" stroke-width="2"/></svg>
|
|
263
|
+
</button>
|
|
264
|
+
<div class="c-photo-viewer__info-content"></div>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
`;
|
|
268
|
+
|
|
269
|
+
// Store DOM references
|
|
270
|
+
this.backdrop = this.element.querySelector('.c-photo-viewer__backdrop') as HTMLElement;
|
|
271
|
+
this.container = this.element.querySelector('.c-photo-viewer__container') as HTMLElement;
|
|
272
|
+
this.header = this.element.querySelector('.c-photo-viewer__header') as HTMLElement;
|
|
273
|
+
this.content = this.element.querySelector('.c-photo-viewer__content') as HTMLElement;
|
|
274
|
+
this.imageContainer = this.element.querySelector(
|
|
275
|
+
'.c-photo-viewer__image-container'
|
|
276
|
+
) as HTMLElement;
|
|
277
|
+
this.imageElement = this.element.querySelector('.c-photo-viewer__image') as HTMLImageElement;
|
|
278
|
+
this.thumbnails = this.element.querySelector('.c-photo-viewer__thumbnails') as HTMLElement;
|
|
279
|
+
this.infoPanel = this.element.querySelector('.c-photo-viewer__info-panel') as HTMLElement;
|
|
280
|
+
this.navPrev = this.element.querySelector('[data-action="prev"]') as HTMLElement;
|
|
281
|
+
this.navNext = this.element.querySelector('[data-action="next"]') as HTMLElement;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
private bindEvents(): void {
|
|
285
|
+
// Action buttons
|
|
286
|
+
this.element.addEventListener('click', this.handleActionClick.bind(this));
|
|
287
|
+
|
|
288
|
+
// Backdrop click to close
|
|
289
|
+
this.backdrop?.addEventListener('click', () => this.close());
|
|
290
|
+
|
|
291
|
+
// Image interactions
|
|
292
|
+
if (this.imageContainer) {
|
|
293
|
+
this.imageContainer.addEventListener('mousedown', this.handleMouseDown.bind(this));
|
|
294
|
+
this.imageContainer.addEventListener('mousemove', this.handleMouseMove.bind(this));
|
|
295
|
+
this.imageContainer.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
296
|
+
this.imageContainer.addEventListener('mouseleave', this.handleMouseUp.bind(this));
|
|
297
|
+
this.imageContainer.addEventListener('wheel', this.handleWheel.bind(this), {
|
|
298
|
+
passive: false,
|
|
299
|
+
});
|
|
300
|
+
this.imageContainer.addEventListener('dblclick', this.handleDoubleClick.bind(this));
|
|
301
|
+
|
|
302
|
+
// Touch events
|
|
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
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Keyboard events
|
|
315
|
+
if (this.options.enableKeyboardNavigation) {
|
|
316
|
+
document.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Fullscreen change
|
|
320
|
+
document.addEventListener('fullscreenchange', this.handleFullscreenChange.bind(this));
|
|
321
|
+
|
|
322
|
+
// Window resize
|
|
323
|
+
window.addEventListener('resize', this.handleResize.bind(this));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
private handleActionClick(event: Event): void {
|
|
327
|
+
const target = event.target as HTMLElement;
|
|
328
|
+
const button = target.closest('[data-action]') as HTMLElement;
|
|
329
|
+
if (!button) return;
|
|
330
|
+
|
|
331
|
+
const action = button.getAttribute('data-action');
|
|
332
|
+
|
|
333
|
+
switch (action) {
|
|
334
|
+
case 'zoom-out':
|
|
335
|
+
this.zoomOut();
|
|
336
|
+
break;
|
|
337
|
+
case 'zoom-in':
|
|
338
|
+
this.zoomIn();
|
|
339
|
+
break;
|
|
340
|
+
case 'reset-zoom':
|
|
341
|
+
this.resetZoom();
|
|
342
|
+
break;
|
|
343
|
+
case 'rotate':
|
|
344
|
+
this.rotate();
|
|
345
|
+
break;
|
|
346
|
+
case 'download':
|
|
347
|
+
this.download();
|
|
348
|
+
break;
|
|
349
|
+
case 'info':
|
|
350
|
+
this.toggleInfo();
|
|
351
|
+
break;
|
|
352
|
+
case 'fullscreen':
|
|
353
|
+
this.toggleFullscreen();
|
|
354
|
+
break;
|
|
355
|
+
case 'close':
|
|
356
|
+
this.close();
|
|
357
|
+
break;
|
|
358
|
+
case 'prev':
|
|
359
|
+
this.goToPrevious();
|
|
360
|
+
break;
|
|
361
|
+
case 'next':
|
|
362
|
+
this.goToNext();
|
|
363
|
+
break;
|
|
364
|
+
case 'close-info':
|
|
365
|
+
this.showInfo = false;
|
|
366
|
+
this.updateInfoPanel();
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
private handleKeyDown(event: KeyboardEvent): void {
|
|
372
|
+
switch (event.key) {
|
|
373
|
+
case 'ArrowLeft':
|
|
374
|
+
this.goToPrevious();
|
|
375
|
+
break;
|
|
376
|
+
case 'ArrowRight':
|
|
377
|
+
this.goToNext();
|
|
378
|
+
break;
|
|
379
|
+
case 'Escape':
|
|
380
|
+
this.close();
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
private handleMouseDown(event: MouseEvent): void {
|
|
386
|
+
const currentState = this.getCurrentImageState();
|
|
387
|
+
if (currentState.zoomLevel > 1) {
|
|
388
|
+
event.preventDefault();
|
|
389
|
+
this.isDragging = true;
|
|
390
|
+
this.startDragPosition = {
|
|
391
|
+
x: event.clientX - currentState.position.x,
|
|
392
|
+
y: event.clientY - currentState.position.y,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
private handleMouseMove(event: MouseEvent): void {
|
|
398
|
+
if (!this.isDragging) return;
|
|
399
|
+
|
|
400
|
+
const currentState = this.getCurrentImageState();
|
|
401
|
+
const newPosition = {
|
|
402
|
+
x: event.clientX - this.startDragPosition.x,
|
|
403
|
+
y: event.clientY - this.startDragPosition.y,
|
|
404
|
+
};
|
|
405
|
+
const constrainedPosition = this.constrainPosition(newPosition, currentState.bounds);
|
|
406
|
+
this.updateCurrentImageState({ position: constrainedPosition });
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
private handleMouseUp(): void {
|
|
410
|
+
this.isDragging = false;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
private handleWheel(event: WheelEvent): void {
|
|
414
|
+
const currentState = this.getCurrentImageState();
|
|
415
|
+
|
|
416
|
+
// Detect platform and gesture type for proper handling
|
|
417
|
+
const isMac = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
418
|
+
const isTrackpadPinch = event.ctrlKey && isMac;
|
|
419
|
+
const isTrackpadScroll = !event.ctrlKey && Math.abs(event.deltaX) > 0;
|
|
420
|
+
|
|
421
|
+
// Handle different zoom gesture types
|
|
422
|
+
let zoomAmount: number;
|
|
423
|
+
|
|
424
|
+
if (isTrackpadPinch) {
|
|
425
|
+
// MacBook trackpad pinch zoom - high sensitivity, smooth scaling
|
|
426
|
+
zoomAmount = event.deltaY * -0.02;
|
|
427
|
+
event.preventDefault();
|
|
428
|
+
event.stopPropagation();
|
|
429
|
+
} else if (isTrackpadScroll) {
|
|
430
|
+
// MacBook trackpad scroll - ignore horizontal, handle vertical carefully
|
|
431
|
+
if (currentState.zoomLevel > 1) {
|
|
432
|
+
// Only prevent scroll when zoomed in
|
|
433
|
+
event.preventDefault();
|
|
434
|
+
zoomAmount = event.deltaY * -0.002;
|
|
435
|
+
} else {
|
|
436
|
+
// Allow natural scroll when not zoomed
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
} else {
|
|
440
|
+
// Regular mouse wheel - medium sensitivity, always zoom when PhotoViewer is active
|
|
441
|
+
zoomAmount = event.deltaY * -0.005;
|
|
442
|
+
event.preventDefault();
|
|
443
|
+
event.stopPropagation();
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (!this.imageContainer) return;
|
|
447
|
+
|
|
448
|
+
let rect;
|
|
449
|
+
try {
|
|
450
|
+
rect = this.imageContainer.getBoundingClientRect();
|
|
451
|
+
} catch (error) {
|
|
452
|
+
console.warn('PhotoViewer: Error getting bounding rect', error);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (!rect || rect.width === 0 || rect.height === 0) return;
|
|
457
|
+
|
|
458
|
+
const centerX = rect.width / 2;
|
|
459
|
+
const centerY = rect.height / 2;
|
|
460
|
+
const cursorX = event.clientX - rect.left - centerX;
|
|
461
|
+
const cursorY = event.clientY - rect.top - centerY;
|
|
462
|
+
|
|
463
|
+
this.zoom(currentState.zoomLevel + zoomAmount, cursorX, cursorY);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
private handleDoubleClick(event: MouseEvent): void {
|
|
467
|
+
const currentState = this.getCurrentImageState();
|
|
468
|
+
const rect = this.imageContainer!.getBoundingClientRect();
|
|
469
|
+
const centerX = rect.width / 2;
|
|
470
|
+
const centerY = rect.height / 2;
|
|
471
|
+
const cursorX = event.clientX - rect.left - centerX;
|
|
472
|
+
const cursorY = event.clientY - rect.top - centerY;
|
|
473
|
+
|
|
474
|
+
let newZoom: number;
|
|
475
|
+
let newPosition = { x: 0, y: 0 };
|
|
476
|
+
|
|
477
|
+
if (currentState.zoomLevel < 1.5) {
|
|
478
|
+
newZoom = 2;
|
|
479
|
+
newPosition = { x: -cursorX * 0.5, y: -cursorY * 0.5 };
|
|
480
|
+
} else if (currentState.zoomLevel < 3) {
|
|
481
|
+
newZoom = 4;
|
|
482
|
+
newPosition = { x: -cursorX * 0.75, y: -cursorY * 0.75 };
|
|
483
|
+
} else {
|
|
484
|
+
newZoom = 1;
|
|
485
|
+
newPosition = { x: 0, y: 0 };
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
this.zoom(newZoom, 0, 0, newPosition);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
private handleTouchStart(event: TouchEvent): void {
|
|
492
|
+
if (!this.options.enableGestures) return;
|
|
493
|
+
|
|
494
|
+
const touches = event.touches;
|
|
495
|
+
|
|
496
|
+
// Always prevent default for multi-touch to stop page zoom
|
|
497
|
+
if (touches.length > 1) {
|
|
498
|
+
event.preventDefault();
|
|
499
|
+
event.stopPropagation();
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
this.touchPoints = Array.from(touches).map(touch => ({
|
|
503
|
+
x: touch.clientX,
|
|
504
|
+
y: touch.clientY,
|
|
505
|
+
}));
|
|
506
|
+
|
|
507
|
+
const currentState = this.getCurrentImageState();
|
|
508
|
+
|
|
509
|
+
if (touches.length === 1 && currentState.zoomLevel > 1) {
|
|
510
|
+
this.isDragging = true;
|
|
511
|
+
this.startDragPosition = {
|
|
512
|
+
x: touches[0].clientX - currentState.position.x,
|
|
513
|
+
y: touches[0].clientY - currentState.position.y,
|
|
514
|
+
};
|
|
515
|
+
} else if (touches.length === 2) {
|
|
516
|
+
const dx = touches[0].clientX - touches[1].clientX;
|
|
517
|
+
const dy = touches[0].clientY - touches[1].clientY;
|
|
518
|
+
this.lastDistance = Math.sqrt(dx * dx + dy * dy);
|
|
519
|
+
|
|
520
|
+
this.lastMidpoint = {
|
|
521
|
+
x: (touches[0].clientX + touches[1].clientX) / 2,
|
|
522
|
+
y: (touches[0].clientY + touches[1].clientY) / 2,
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
private handleTouchMove(event: TouchEvent): void {
|
|
528
|
+
if (!this.options.enableGestures) return;
|
|
529
|
+
|
|
530
|
+
const touches = event.touches;
|
|
531
|
+
const currentState = this.getCurrentImageState();
|
|
532
|
+
|
|
533
|
+
// Always prevent default for multi-touch gestures to stop page zoom
|
|
534
|
+
if (touches.length > 1) {
|
|
535
|
+
event.preventDefault();
|
|
536
|
+
event.stopPropagation();
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// Prevent default for single touch when zoomed in to avoid conflicts
|
|
540
|
+
if (currentState.zoomLevel > 1 && touches.length === 1) {
|
|
541
|
+
event.preventDefault();
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (touches.length === 1 && this.isDragging && currentState.zoomLevel > 1) {
|
|
545
|
+
const newPosition = {
|
|
546
|
+
x: touches[0].clientX - this.startDragPosition.x,
|
|
547
|
+
y: touches[0].clientY - this.startDragPosition.y,
|
|
548
|
+
};
|
|
549
|
+
const constrainedPosition = this.constrainPosition(newPosition, currentState.bounds);
|
|
550
|
+
this.updateCurrentImageState({ position: constrainedPosition });
|
|
551
|
+
} else if (touches.length === 2 && this.lastDistance !== null) {
|
|
552
|
+
const dx = touches[0].clientX - touches[1].clientX;
|
|
553
|
+
const dy = touches[0].clientY - touches[1].clientY;
|
|
554
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
555
|
+
|
|
556
|
+
const zoomDelta = (distance - this.lastDistance) * 0.005;
|
|
557
|
+
this.lastDistance = distance;
|
|
558
|
+
|
|
559
|
+
const currentMidpoint = {
|
|
560
|
+
x: (touches[0].clientX + touches[1].clientX) / 2,
|
|
561
|
+
y: (touches[0].clientY + touches[1].clientY) / 2,
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
if (this.lastMidpoint && this.imageContainer) {
|
|
565
|
+
let rect;
|
|
566
|
+
try {
|
|
567
|
+
rect = this.imageContainer.getBoundingClientRect();
|
|
568
|
+
} catch (error) {
|
|
569
|
+
console.warn('PhotoViewer: Error getting bounding rect in touch move', error);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if (!rect || rect.width === 0 || rect.height === 0) return;
|
|
574
|
+
|
|
575
|
+
const centerX = rect.width / 2;
|
|
576
|
+
const centerY = rect.height / 2;
|
|
577
|
+
const midpointX = currentMidpoint.x - rect.left - centerX;
|
|
578
|
+
const midpointY = currentMidpoint.y - rect.top - centerY;
|
|
579
|
+
|
|
580
|
+
this.zoom(currentState.zoomLevel + zoomDelta, midpointX, midpointY);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
this.lastMidpoint = currentMidpoint;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
private handleTouchEnd(): void {
|
|
588
|
+
this.isDragging = false;
|
|
589
|
+
this.lastDistance = null;
|
|
590
|
+
this.lastMidpoint = null;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
private handleFullscreenChange(): void {
|
|
594
|
+
this.isFullscreen = !!document.fullscreenElement;
|
|
595
|
+
this.updateClasses();
|
|
596
|
+
setTimeout(() => this.updateBounds(), 100);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
private handleResize(): void {
|
|
600
|
+
this.updateBounds();
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
private zoom(
|
|
604
|
+
newZoomLevel: number,
|
|
605
|
+
centerX: number = 0,
|
|
606
|
+
centerY: number = 0,
|
|
607
|
+
forcePosition?: { x: number; y: number }
|
|
608
|
+
): void {
|
|
609
|
+
const currentState = this.getCurrentImageState();
|
|
610
|
+
const oldZoom = currentState.zoomLevel;
|
|
611
|
+
const clampedZoom = Math.max(0.1, Math.min(5, newZoomLevel));
|
|
612
|
+
|
|
613
|
+
if (clampedZoom !== oldZoom) {
|
|
614
|
+
const newBounds = this.calculateBounds(clampedZoom, currentState.rotation);
|
|
615
|
+
let newPosition: { x: number; y: number };
|
|
616
|
+
|
|
617
|
+
if (forcePosition) {
|
|
618
|
+
newPosition = forcePosition;
|
|
619
|
+
} else {
|
|
620
|
+
const zoomFactor = clampedZoom / oldZoom;
|
|
621
|
+
newPosition = {
|
|
622
|
+
x: currentState.position.x + centerX * (1 - zoomFactor) * 0.5,
|
|
623
|
+
y: currentState.position.y + centerY * (1 - zoomFactor) * 0.5,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
const constrainedPosition = this.constrainPosition(newPosition, newBounds);
|
|
628
|
+
|
|
629
|
+
this.updateCurrentImageState({
|
|
630
|
+
zoomLevel: clampedZoom,
|
|
631
|
+
bounds: newBounds,
|
|
632
|
+
position: constrainedPosition,
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
this.updateControls();
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
private updateImageTransform(): void {
|
|
640
|
+
if (!this.imageElement) return;
|
|
641
|
+
|
|
642
|
+
const currentState = this.getCurrentImageState();
|
|
643
|
+
const cursor = this.isDragging ? 'grabbing' : currentState.zoomLevel > 1 ? 'grab' : 'default';
|
|
644
|
+
|
|
645
|
+
if (this.imageContainer) {
|
|
646
|
+
this.imageContainer.style.cursor = cursor;
|
|
647
|
+
this.imageContainer.style.opacity = this.isTransitioning ? '0.7' : '1';
|
|
648
|
+
if (this.isTransitioning) {
|
|
649
|
+
this.imageContainer.classList.add('is-transitioning');
|
|
650
|
+
} else {
|
|
651
|
+
this.imageContainer.classList.remove('is-transitioning');
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
this.imageElement.style.transform = `scale(${currentState.zoomLevel}) translate(${currentState.position.x}px, ${currentState.position.y}px) rotate(${currentState.rotation}deg)`;
|
|
656
|
+
this.imageElement.style.transition = this.isDragging
|
|
657
|
+
? 'none'
|
|
658
|
+
: this.isTransitioning
|
|
659
|
+
? 'opacity 0.15s ease-out'
|
|
660
|
+
: 'transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
|
|
661
|
+
this.imageElement.style.transformOrigin = 'center center';
|
|
662
|
+
this.imageElement.style.willChange = this.isDragging ? 'transform' : 'auto';
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
private updateClasses(): void {
|
|
666
|
+
this.element.className = [
|
|
667
|
+
'c-photo-viewer',
|
|
668
|
+
`c-photo-viewer--thumbnails-${this.options.thumbnailPosition}`,
|
|
669
|
+
this.isDragging ? 'c-photo-viewer--dragging' : '',
|
|
670
|
+
this.isFullscreen ? 'c-photo-viewer--fullscreen' : '',
|
|
671
|
+
this.showInfo ? 'c-photo-viewer--info-open' : '',
|
|
672
|
+
this.isTransitioning ? 'is-transitioning' : '',
|
|
673
|
+
]
|
|
674
|
+
.filter(Boolean)
|
|
675
|
+
.join(' ');
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
private render(): void {
|
|
679
|
+
this.updateCounter();
|
|
680
|
+
this.updateImage();
|
|
681
|
+
this.updateThumbnails();
|
|
682
|
+
this.updateControls();
|
|
683
|
+
this.updateInfoPanel();
|
|
684
|
+
this.updateClasses();
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
private updateCounter(): void {
|
|
688
|
+
const counter = this.element.querySelector('.c-photo-viewer__counter-badge');
|
|
689
|
+
if (counter) {
|
|
690
|
+
counter.textContent = `${this.currentIndex + 1} / ${this.images.length}`;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
private updateImage(): void {
|
|
695
|
+
const currentImage = this.images[this.currentIndex];
|
|
696
|
+
if (!currentImage || !this.imageElement) return;
|
|
697
|
+
|
|
698
|
+
this.imageElement.src = currentImage.src;
|
|
699
|
+
this.imageElement.alt = currentImage.alt || `Image ${this.currentIndex + 1}`;
|
|
700
|
+
|
|
701
|
+
// Update bounds when image loads
|
|
702
|
+
if (this.imageElement.complete) {
|
|
703
|
+
this.updateBounds();
|
|
704
|
+
} else {
|
|
705
|
+
this.imageElement.onload = () => this.updateBounds();
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
private updateThumbnails(): void {
|
|
710
|
+
if (!this.thumbnails || this.options.thumbnailPosition === 'none') return;
|
|
711
|
+
|
|
712
|
+
if (this.images.length <= 1) {
|
|
713
|
+
this.thumbnails.style.display = 'none';
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
this.thumbnails.style.display = 'flex';
|
|
718
|
+
this.thumbnails.innerHTML = this.images
|
|
719
|
+
.map(
|
|
720
|
+
(image, index) => `
|
|
721
|
+
<button class="c-photo-viewer__thumbnail ${index === this.currentIndex ? 'is-active' : ''}"
|
|
722
|
+
data-index="${index}"
|
|
723
|
+
aria-label="View image ${index + 1}"
|
|
724
|
+
${index === this.currentIndex ? 'aria-current="true"' : ''}>
|
|
725
|
+
<img src="${image.thumbnail || image.src}"
|
|
726
|
+
alt="${image.alt || `Thumbnail ${index + 1}`}"
|
|
727
|
+
class="c-photo-viewer__thumbnail-img"
|
|
728
|
+
loading="lazy">
|
|
729
|
+
</button>
|
|
730
|
+
`
|
|
731
|
+
)
|
|
732
|
+
.join('');
|
|
733
|
+
|
|
734
|
+
// Bind thumbnail clicks
|
|
735
|
+
this.thumbnails.addEventListener('click', event => {
|
|
736
|
+
const button = (event.target as HTMLElement).closest('[data-index]') as HTMLElement;
|
|
737
|
+
if (button) {
|
|
738
|
+
const index = parseInt(button.getAttribute('data-index') || '0');
|
|
739
|
+
this.goToImage(index);
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
private updateControls(): void {
|
|
745
|
+
const currentState = this.getCurrentImageState();
|
|
746
|
+
const zoomOutBtn = this.element.querySelector('[data-action="zoom-out"]') as HTMLButtonElement;
|
|
747
|
+
const zoomInBtn = this.element.querySelector('[data-action="zoom-in"]') as HTMLButtonElement;
|
|
748
|
+
const resetZoomBtn = this.element.querySelector(
|
|
749
|
+
'[data-action="reset-zoom"]'
|
|
750
|
+
) as HTMLButtonElement;
|
|
751
|
+
|
|
752
|
+
if (zoomOutBtn) zoomOutBtn.disabled = currentState.zoomLevel <= 0.1;
|
|
753
|
+
if (zoomInBtn) zoomInBtn.disabled = currentState.zoomLevel >= 5;
|
|
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
|
+
|
|
761
|
+
if (this.navPrev) this.navPrev.style.display = this.images.length > 1 ? 'flex' : 'none';
|
|
762
|
+
if (this.navNext) this.navNext.style.display = this.images.length > 1 ? 'flex' : 'none';
|
|
763
|
+
|
|
764
|
+
const prevBtn = this.navPrev as HTMLButtonElement;
|
|
765
|
+
const nextBtn = this.navNext as HTMLButtonElement;
|
|
766
|
+
if (prevBtn) prevBtn.disabled = this.currentIndex === 0;
|
|
767
|
+
if (nextBtn) nextBtn.disabled = this.currentIndex === this.images.length - 1;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
private updateInfoPanel(): void {
|
|
771
|
+
if (!this.infoPanel) return;
|
|
772
|
+
|
|
773
|
+
this.infoPanel.style.display = this.showInfo ? 'block' : 'none';
|
|
774
|
+
|
|
775
|
+
if (!this.showInfo) return;
|
|
776
|
+
|
|
777
|
+
const currentImage = this.images[this.currentIndex];
|
|
778
|
+
const content = this.infoPanel.querySelector('.c-photo-viewer__info-content');
|
|
779
|
+
|
|
780
|
+
if (!content || !currentImage) return;
|
|
781
|
+
|
|
782
|
+
content.innerHTML = [
|
|
783
|
+
currentImage.title ? `<h3 class="c-photo-viewer__info-title">${currentImage.title}</h3>` : '',
|
|
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">
|
|
795
|
+
${currentImage.tags.map(tag => `<span class="c-photo-viewer__info-tag">${tag}</span>`).join('')}
|
|
796
|
+
</div>`
|
|
797
|
+
: '',
|
|
798
|
+
]
|
|
799
|
+
.filter(Boolean)
|
|
800
|
+
.join('');
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
// Public API methods
|
|
804
|
+
public open(index: number = 0): void {
|
|
805
|
+
this.currentIndex = Math.max(0, Math.min(index, this.images.length - 1));
|
|
806
|
+
this.element.style.display = 'flex';
|
|
807
|
+
this.render();
|
|
808
|
+
document.body.style.overflow = 'hidden';
|
|
809
|
+
document.body.classList.add('is-open-photoviewer');
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
public close(): void {
|
|
813
|
+
this.element.style.display = 'none';
|
|
814
|
+
document.body.style.overflow = '';
|
|
815
|
+
document.body.classList.remove('is-open-photoviewer');
|
|
816
|
+
if (this.options.onClose) {
|
|
817
|
+
this.options.onClose();
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
public goToImage(index: number): void {
|
|
822
|
+
if (index >= 0 && index < this.images.length && index !== this.currentIndex) {
|
|
823
|
+
this.isTransitioning = true;
|
|
824
|
+
this.updateImageTransform();
|
|
825
|
+
|
|
826
|
+
setTimeout(() => {
|
|
827
|
+
this.currentIndex = index;
|
|
828
|
+
this.isTransitioning = false;
|
|
829
|
+
this.render();
|
|
830
|
+
if (this.options.onImageChange) {
|
|
831
|
+
this.options.onImageChange(index);
|
|
832
|
+
}
|
|
833
|
+
// Update bounds for new image without affecting body class
|
|
834
|
+
setTimeout(() => this.updateBounds(), 100);
|
|
835
|
+
}, 150);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
public goToPrevious(): void {
|
|
840
|
+
if (this.currentIndex > 0) {
|
|
841
|
+
this.goToImage(this.currentIndex - 1);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
public goToNext(): void {
|
|
846
|
+
if (this.currentIndex < this.images.length - 1) {
|
|
847
|
+
this.goToImage(this.currentIndex + 1);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
public zoomIn(): void {
|
|
852
|
+
const currentState = this.getCurrentImageState();
|
|
853
|
+
this.zoom(currentState.zoomLevel + 0.25);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
public zoomOut(): void {
|
|
857
|
+
const currentState = this.getCurrentImageState();
|
|
858
|
+
this.zoom(currentState.zoomLevel - 0.25);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
public resetZoom(): void {
|
|
862
|
+
this.updateCurrentImageState(this.getDefaultImageState());
|
|
863
|
+
this.updateControls();
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
public rotate(): void {
|
|
867
|
+
const currentState = this.getCurrentImageState();
|
|
868
|
+
const newRotation = (currentState.rotation + 90) % 360;
|
|
869
|
+
const newBounds = this.calculateBounds(currentState.zoomLevel, newRotation);
|
|
870
|
+
const constrainedPosition = this.constrainPosition(currentState.position, newBounds);
|
|
871
|
+
|
|
872
|
+
this.updateCurrentImageState({
|
|
873
|
+
rotation: newRotation,
|
|
874
|
+
bounds: newBounds,
|
|
875
|
+
position: constrainedPosition,
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
public download(): void {
|
|
880
|
+
const currentImage = this.images[this.currentIndex];
|
|
881
|
+
if (!currentImage?.src) return;
|
|
882
|
+
|
|
883
|
+
const link = document.createElement('a');
|
|
884
|
+
link.href = currentImage.src;
|
|
885
|
+
link.download = currentImage.title || `image-${this.currentIndex + 1}`;
|
|
886
|
+
document.body.appendChild(link);
|
|
887
|
+
link.click();
|
|
888
|
+
document.body.removeChild(link);
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
public toggleInfo(): void {
|
|
892
|
+
this.showInfo = !this.showInfo;
|
|
893
|
+
this.updateInfoPanel();
|
|
894
|
+
this.updateClasses();
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
public toggleFullscreen(): void {
|
|
898
|
+
if (!this.options.enableFullscreen) return;
|
|
899
|
+
|
|
900
|
+
if (!this.isFullscreen) {
|
|
901
|
+
if (document.documentElement.requestFullscreen) {
|
|
902
|
+
document.documentElement.requestFullscreen();
|
|
903
|
+
}
|
|
904
|
+
} else {
|
|
905
|
+
if (document.exitFullscreen) {
|
|
906
|
+
document.exitFullscreen();
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
public setImages(images: Array<string | ImageType>): void {
|
|
912
|
+
this.images = this.processImages(images);
|
|
913
|
+
this.currentIndex = 0;
|
|
914
|
+
this.initializeImageStates();
|
|
915
|
+
this.render();
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
public getCurrentIndex(): number {
|
|
919
|
+
return this.currentIndex;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
public getImages(): ImageType[] {
|
|
923
|
+
return [...this.images];
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
public destroy(): void {
|
|
927
|
+
// Remove event listeners
|
|
928
|
+
document.removeEventListener('keydown', this.handleKeyDown.bind(this));
|
|
929
|
+
document.removeEventListener('fullscreenchange', this.handleFullscreenChange.bind(this));
|
|
930
|
+
window.removeEventListener('resize', this.handleResize.bind(this));
|
|
931
|
+
|
|
932
|
+
// Restore body overflow and remove class
|
|
933
|
+
document.body.style.overflow = '';
|
|
934
|
+
document.body.classList.remove('is-open-photoviewer');
|
|
935
|
+
|
|
936
|
+
// Clear element
|
|
937
|
+
this.element.innerHTML = '';
|
|
938
|
+
this.element.className = '';
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
private resetImageState(): void {
|
|
942
|
+
this.updateCurrentImageState(this.getDefaultImageState());
|
|
943
|
+
this.isDragging = false;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
export default PhotoViewer;
|