@shohojdhara/atomix 0.1.30 → 0.2.1
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/CHANGELOG.md +0 -0
- package/LICENSE +0 -0
- package/README.md +151 -39
- package/dist/atomix.css +13529 -0
- package/dist/atomix.min.css +15 -0
- package/dist/index.d.ts +6112 -1757
- package/dist/index.esm.js +16852 -8364
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16892 -8369
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/themes/boomdevs.css +13241 -0
- package/dist/themes/boomdevs.min.css +353 -0
- package/dist/themes/esrar.css +15374 -0
- package/dist/themes/esrar.min.css +189 -0
- package/dist/themes/mashroom.css +28079 -0
- package/dist/themes/mashroom.min.css +403 -0
- package/dist/themes/shaj-default.css +14203 -0
- package/dist/themes/shaj-default.min.css +500 -0
- package/dist/themes/yabai.css +13711 -0
- package/dist/themes/yabai.min.css +189 -0
- package/package.json +126 -99
- 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/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 +257 -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/Badge/Badge.stories.tsx +371 -0
- package/src/components/Badge/Badge.tsx +39 -0
- package/src/components/Badge/index.ts +3 -0
- package/src/components/Block/Block.stories.tsx +408 -0
- package/src/components/Block/Block.tsx +137 -0
- package/src/components/Block/index.ts +1 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +106 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +112 -0
- package/src/components/Breadcrumb/index.ts +3 -0
- package/src/components/Button/Button.stories.tsx +312 -0
- package/src/components/Button/Button.tsx +69 -0
- package/src/components/Button/index.ts +3 -0
- package/src/components/Callout/Callout.stories.tsx +588 -0
- package/src/components/Callout/Callout.tsx +78 -0
- package/src/components/Callout/index.ts +1 -0
- package/src/components/Card/Card.stories.tsx +105 -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/Chart/AdvancedChart.tsx +624 -0
- package/src/components/Chart/AnimatedChart.tsx +206 -0
- package/src/components/Chart/AreaChart.tsx +27 -0
- package/src/components/Chart/BarChart.tsx +148 -0
- package/src/components/Chart/BubbleChart.tsx +411 -0
- package/src/components/Chart/CandlestickChart.tsx +765 -0
- package/src/components/Chart/Chart.stories.tsx +527 -0
- package/src/components/Chart/Chart.tsx +218 -0
- package/src/components/Chart/ChartRenderer.tsx +322 -0
- package/src/components/Chart/ChartToolbar.tsx +436 -0
- package/src/components/Chart/ChartTooltip.tsx +101 -0
- package/src/components/Chart/DonutChart.tsx +370 -0
- package/src/components/Chart/FunnelChart.tsx +393 -0
- package/src/components/Chart/GaugeChart.tsx +550 -0
- package/src/components/Chart/HeatmapChart.tsx +614 -0
- package/src/components/Chart/LineChart.tsx +172 -0
- package/src/components/Chart/LineChartNew.tsx +167 -0
- package/src/components/Chart/MultiAxisChart.tsx +498 -0
- package/src/components/Chart/PieChart.tsx +103 -0
- package/src/components/Chart/RadarChart.tsx +332 -0
- package/src/components/Chart/RealTimeChart.tsx +436 -0
- package/src/components/Chart/ScatterChart.tsx +152 -0
- package/src/components/Chart/TreemapChart.tsx +574 -0
- package/src/components/Chart/WaterfallChart.tsx +450 -0
- package/src/components/Chart/index.ts +119 -0
- package/src/components/Chart/types.ts +338 -0
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +44 -0
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +85 -0
- package/src/components/ColorModeToggle/index.ts +2 -0
- package/src/components/Countdown/Countdown.stories.tsx +46 -0
- package/src/components/Countdown/Countdown.tsx +90 -0
- package/src/components/Countdown/index.ts +2 -0
- package/src/components/DataTable/DataTable.stories.tsx +248 -0
- package/src/components/DataTable/DataTable.tsx +213 -0
- package/src/components/DataTable/index.ts +3 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +364 -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/types.ts +167 -0
- package/src/components/DatePicker/utils.ts +185 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +358 -0
- package/src/components/Dropdown/Dropdown.tsx +352 -0
- package/src/components/Dropdown/index.ts +14 -0
- package/src/components/Dropdown/readme.md +151 -0
- package/src/components/EdgePanel/EdgePanel.stories.tsx +266 -0
- package/src/components/EdgePanel/EdgePanel.tsx +73 -0
- package/src/components/EdgePanel/index.ts +1 -0
- package/src/components/Form/Checkbox.stories.tsx +76 -0
- package/src/components/Form/Checkbox.tsx +69 -0
- package/src/components/Form/Form.stories.tsx +497 -0
- package/src/components/Form/Form.tsx +46 -0
- package/src/components/Form/FormGroup.stories.tsx +162 -0
- package/src/components/Form/FormGroup.tsx +53 -0
- package/src/components/Form/Input.stories.tsx +106 -0
- package/src/components/Form/Input.tsx +87 -0
- package/src/components/Form/Radio.stories.tsx +94 -0
- package/src/components/Form/Radio.tsx +65 -0
- package/src/components/Form/Select.stories.tsx +151 -0
- package/src/components/Form/Select.tsx +191 -0
- package/src/components/Form/Textarea.stories.tsx +123 -0
- package/src/components/Form/Textarea.tsx +78 -0
- package/src/components/Form/index.ts +7 -0
- package/src/components/Hero/Hero.stories.tsx +295 -0
- package/src/components/Hero/Hero.tsx +175 -0
- package/src/components/Hero/index.ts +6 -0
- package/src/components/Icon/Icon.tsx +87 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/List/List.stories.tsx +122 -0
- package/src/components/List/List.tsx +35 -0
- package/src/components/List/ListGroup.tsx +35 -0
- package/src/components/List/index.ts +2 -0
- package/src/components/Messages/Messages.stories.tsx +160 -0
- package/src/components/Messages/Messages.tsx +172 -0
- package/src/components/Messages/index.ts +3 -0
- package/src/components/Modal/Modal.stories.tsx +284 -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/Navigation/Menu/MegaMenu.tsx +109 -0
- package/src/components/Navigation/Menu/Menu.stories.tsx +339 -0
- package/src/components/Navigation/Menu/Menu.tsx +111 -0
- package/src/components/Navigation/Nav/Nav.stories.tsx +456 -0
- package/src/components/Navigation/Nav/Nav.tsx +51 -0
- package/src/components/Navigation/Nav/NavDropdown.tsx +105 -0
- package/src/components/Navigation/Nav/NavItem.tsx +168 -0
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +569 -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 +609 -0
- package/src/components/Navigation/SideMenu/SideMenu.tsx +101 -0
- package/src/components/Navigation/SideMenu/SideMenuItem.tsx +103 -0
- package/src/components/Navigation/SideMenu/SideMenuList.tsx +41 -0
- package/src/components/Navigation/index.ts +23 -0
- package/src/components/Pagination/Pagination.stories.tsx +188 -0
- package/src/components/Pagination/Pagination.tsx +162 -0
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +397 -0
- package/src/components/PhotoViewer/PhotoViewer.tsx +246 -0
- package/src/components/PhotoViewer/PhotoViewerHeader.tsx +184 -0
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +173 -0
- package/src/components/PhotoViewer/PhotoViewerInfo.tsx +91 -0
- package/src/components/PhotoViewer/PhotoViewerNavigation.tsx +85 -0
- package/src/components/PhotoViewer/PhotoViewerThumbnails.tsx +63 -0
- package/src/components/PhotoViewer/README.md +358 -0
- package/src/components/PhotoViewer/examples/ImageGallery.tsx +187 -0
- package/src/components/PhotoViewer/examples/SimpleGallery.tsx +73 -0
- package/src/components/PhotoViewer/examples/index.ts +2 -0
- package/src/components/PhotoViewer/index.ts +14 -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/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/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/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/River/River.stories.tsx +230 -0
- package/src/components/River/River.tsx +134 -0
- package/src/components/River/index.ts +2 -0
- package/src/components/SectionIntro/SectionIntro.stories.tsx +143 -0
- package/src/components/SectionIntro/SectionIntro.tsx +184 -0
- package/src/components/SectionIntro/index.ts +3 -0
- package/src/components/Slider/Slider.stories.tsx +241 -0
- package/src/components/Slider/Slider.tsx +225 -0
- package/src/components/Slider/index.ts +24 -0
- package/src/components/Spinner/Spinner.stories.tsx +65 -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 +115 -0
- package/src/components/Steps/index.ts +3 -0
- package/src/components/Tab/Tab.stories.tsx +129 -0
- package/src/components/Tab/Tab.tsx +111 -0
- package/src/components/Tab/index.ts +2 -0
- package/src/components/Testimonial/Testimonial.stories.tsx +180 -0
- package/src/components/Testimonial/Testimonial.tsx +138 -0
- package/src/components/Testimonial/index.ts +3 -0
- package/src/components/Todo/Todo.stories.tsx +103 -0
- package/src/components/Todo/Todo.tsx +158 -0
- package/src/components/Todo/index.ts +1 -0
- package/src/components/Toggle/Toggle.stories.tsx +49 -0
- package/src/components/Toggle/Toggle.tsx +84 -0
- package/src/components/Toggle/index.ts +2 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +115 -0
- package/src/components/Tooltip/Tooltip.tsx +150 -0
- package/src/components/Tooltip/index.ts +3 -0
- package/src/components/Upload/Upload.stories.tsx +220 -0
- package/src/components/Upload/Upload.tsx +354 -0
- package/src/components/Upload/index.ts +3 -0
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +484 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +574 -0
- package/src/components/VideoPlayer/index.ts +7 -0
- package/src/components/index.ts +111 -0
- package/src/layouts/Grid/Container.tsx +58 -0
- package/src/layouts/Grid/Grid.stories.tsx +861 -0
- package/src/layouts/Grid/Grid.tsx +68 -0
- package/src/layouts/Grid/GridCol.tsx +161 -0
- package/src/layouts/Grid/README.md +108 -0
- package/src/layouts/Grid/Row.tsx +70 -0
- package/src/layouts/Grid/index.ts +8 -0
- package/src/layouts/MasonryGrid/MasonryGrid.stories.tsx +387 -0
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +408 -0
- package/src/layouts/MasonryGrid/MasonryGridItem.tsx +44 -0
- package/src/layouts/MasonryGrid/README.md +117 -0
- package/src/layouts/MasonryGrid/index.ts +4 -0
- package/src/layouts/index.ts +7 -0
- package/src/lib/README.md +89 -0
- package/src/lib/composables/index.ts +63 -0
- package/src/lib/composables/useAccordion.ts +129 -0
- package/src/lib/composables/useAmbientMode.ts +90 -0
- package/src/lib/composables/useBadge.ts +42 -0
- package/src/lib/composables/useBarChart.ts +365 -0
- package/src/lib/composables/useBlock.ts +56 -0
- package/src/lib/composables/useBreadcrumb.ts +81 -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/useChart.ts +1082 -0
- package/src/lib/composables/useChartAnalytics.ts +505 -0
- package/src/lib/composables/useChartData.ts +38 -0
- package/src/lib/composables/useChartExport.ts +392 -0
- package/src/lib/composables/useChartInteraction.ts +34 -0
- package/src/lib/composables/useChartInteractions.ts +123 -0
- package/src/lib/composables/useChartPerformance.ts +323 -0
- package/src/lib/composables/useChartScale.ts +48 -0
- package/src/lib/composables/useChartToolbar.ts +532 -0
- package/src/lib/composables/useCheckbox.ts +70 -0
- package/src/lib/composables/useDataTable.ts +208 -0
- package/src/lib/composables/useDatePicker.ts +564 -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/useLineChart.ts +319 -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 +937 -0
- package/src/lib/composables/usePieChart.ts +362 -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/useSlider.ts +339 -0
- package/src/lib/composables/useSpinner.ts +42 -0
- package/src/lib/composables/useTextarea.ts +55 -0
- package/src/lib/composables/useTodo.ts +141 -0
- package/src/lib/composables/useVideoPlayer.ts +398 -0
- package/src/lib/constants/components.ts +1433 -0
- package/src/lib/constants/index.ts +4 -0
- package/src/lib/index.ts +11 -0
- package/src/lib/types/components.ts +4750 -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 +55 -0
- package/src/lib/utils/useForkRef.test.tsx +64 -0
- package/src/lib/utils/useForkRef.ts +36 -0
- package/src/lib/utils.test.ts +14 -0
- package/src/styles/01-settings/_index.scss +2 -0
- package/src/styles/01-settings/_settings.accordion.scss +7 -5
- package/src/styles/01-settings/_settings.animations.scss +0 -0
- package/src/styles/01-settings/_settings.avatar-group.scss +6 -3
- package/src/styles/01-settings/_settings.avatar.scss +2 -2
- package/src/styles/01-settings/_settings.badge.scss +15 -9
- package/src/styles/01-settings/_settings.block.scss +11 -0
- package/src/styles/01-settings/_settings.border-radius.scss +12 -9
- package/src/styles/01-settings/_settings.border.scss +4 -1
- package/src/styles/01-settings/_settings.box-shadow.scss +1 -1
- package/src/styles/01-settings/_settings.breadcrumb.scss +9 -8
- package/src/styles/01-settings/_settings.breakpoints.scss +0 -0
- package/src/styles/01-settings/_settings.btn-group.scss +4 -1
- package/src/styles/01-settings/_settings.button.scss +19 -21
- package/src/styles/01-settings/_settings.callout.scss +42 -24
- package/src/styles/01-settings/_settings.card.scss +12 -10
- package/src/styles/01-settings/_settings.chart.scss +199 -0
- package/src/styles/01-settings/_settings.checkbox-group.scss +0 -0
- package/src/styles/01-settings/_settings.checkbox.scss +0 -0
- package/src/styles/01-settings/_settings.color-mode.scss +0 -0
- package/src/styles/01-settings/_settings.colors.scss +20 -0
- package/src/styles/01-settings/_settings.config.scss +1 -1
- package/src/styles/01-settings/_settings.countdown.scss +0 -0
- package/src/styles/01-settings/_settings.data-table.scss +0 -0
- package/src/styles/01-settings/_settings.datepicker.scss +0 -0
- package/src/styles/01-settings/_settings.dropdown.scss +0 -0
- package/src/styles/01-settings/_settings.edge-panel.scss +0 -0
- package/src/styles/01-settings/_settings.fonts.scss +1 -1
- package/src/styles/01-settings/_settings.form-group.scss +0 -0
- package/src/styles/01-settings/_settings.form.scss +0 -0
- package/src/styles/01-settings/_settings.grid.scss +3 -3
- package/src/styles/01-settings/_settings.hero.scss +1 -1
- package/src/styles/01-settings/_settings.input.scss +1 -1
- package/src/styles/01-settings/_settings.link.scss +0 -0
- package/src/styles/01-settings/_settings.list-group.scss +0 -0
- package/src/styles/01-settings/_settings.list.scss +0 -0
- package/src/styles/01-settings/_settings.maps.scss +43 -8
- package/src/styles/01-settings/_settings.masonry-grid.scss +0 -0
- package/src/styles/01-settings/_settings.menu.scss +0 -0
- package/src/styles/01-settings/_settings.messages.scss +0 -0
- package/src/styles/01-settings/_settings.modal.scss +1 -1
- package/src/styles/01-settings/_settings.nav.scss +0 -0
- package/src/styles/01-settings/_settings.navbar.scss +0 -0
- package/src/styles/01-settings/_settings.pagination.scss +0 -0
- package/src/styles/01-settings/_settings.photoviewer.scss +89 -23
- package/src/styles/01-settings/_settings.popover.scss +0 -0
- package/src/styles/01-settings/_settings.position.scss +0 -0
- package/src/styles/01-settings/_settings.progress.scss +0 -0
- package/src/styles/01-settings/_settings.rating.scss +0 -0
- package/src/styles/01-settings/_settings.river.scss +0 -0
- package/src/styles/01-settings/_settings.sectionintro.scss +0 -0
- package/src/styles/01-settings/_settings.select.scss +0 -0
- package/src/styles/01-settings/_settings.side-menu.scss +0 -0
- package/src/styles/01-settings/_settings.skeleton.scss +0 -0
- package/src/styles/01-settings/_settings.slider.scss +59 -0
- package/src/styles/01-settings/_settings.spacing.scss +11 -3
- package/src/styles/01-settings/_settings.spinner.scss +0 -0
- package/src/styles/01-settings/_settings.steps.scss +1 -1
- package/src/styles/01-settings/_settings.tabs.scss +4 -4
- package/src/styles/01-settings/_settings.testimonials.scss +0 -0
- package/src/styles/01-settings/_settings.todo.scss +0 -0
- package/src/styles/01-settings/_settings.toggle.scss +1 -1
- package/src/styles/01-settings/_settings.tooltip.scss +0 -0
- package/src/styles/01-settings/_settings.typography.scss +2 -0
- package/src/styles/01-settings/_settings.upload.scss +0 -0
- package/src/styles/01-settings/_settings.video-player.scss +64 -0
- package/src/styles/01-settings/_settings.z-layers.scss +0 -0
- package/src/styles/02-tools/_index.scss +1 -0
- package/src/styles/02-tools/_tools.animations.scss +82 -0
- package/src/styles/02-tools/_tools.border-radius.scss +0 -0
- package/src/styles/02-tools/_tools.breakpoints.scss +0 -0
- package/src/styles/02-tools/_tools.button.scss +5 -0
- package/src/styles/02-tools/_tools.clearfix.scss +0 -0
- package/src/styles/02-tools/_tools.color-functions.scss +0 -0
- package/src/styles/02-tools/_tools.color-mode.scss +1 -1
- package/src/styles/02-tools/_tools.component.scss +479 -0
- package/src/styles/02-tools/_tools.event.scss +0 -0
- package/src/styles/02-tools/_tools.grid.scss +0 -0
- package/src/styles/02-tools/_tools.hidden-visually.scss +0 -0
- package/src/styles/02-tools/_tools.hidden.scss +0 -0
- package/src/styles/02-tools/_tools.map-loop.scss +0 -0
- package/src/styles/02-tools/_tools.media-queries.scss +0 -0
- package/src/styles/02-tools/_tools.object-fit.scss +0 -0
- package/src/styles/02-tools/_tools.placeholder.scss +0 -0
- package/src/styles/02-tools/_tools.rem.scss +5 -1
- package/src/styles/02-tools/_tools.size.scss +0 -0
- package/src/styles/02-tools/_tools.spacing.scss +0 -0
- package/src/styles/02-tools/_tools.to-rgb.scss +0 -0
- package/src/styles/02-tools/_tools.transition.scss +0 -0
- package/src/styles/02-tools/_tools.utilities.scss +0 -0
- package/src/styles/02-tools/_tools.utility-api.scss +23 -2
- package/src/styles/03-generic/_generic.fonts.scss +0 -0
- package/src/styles/03-generic/_generic.reset.scss +0 -0
- package/src/styles/03-generic/_generic.root.scss +5 -1
- package/src/styles/03-generic/_generic.selection.scss +0 -0
- package/src/styles/03-generic/_index.scss +0 -0
- package/src/styles/04-elements/_elements.all.scss +0 -0
- package/src/styles/04-elements/_elements.body.scss +0 -0
- package/src/styles/04-elements/_elements.heading.scss +0 -0
- package/src/styles/04-elements/_elements.html.scss +0 -0
- package/src/styles/04-elements/_elements.links.scss +0 -0
- package/src/styles/04-elements/_index.scss +0 -0
- package/src/styles/05-objects/_index.scss +1 -0
- package/src/styles/05-objects/_objects.block.scss +122 -0
- package/src/styles/05-objects/_objects.container.scss +14 -10
- package/src/styles/05-objects/_objects.grid.scss +0 -0
- package/src/styles/05-objects/_objects.masonry-grid.scss +0 -0
- package/src/styles/06-components/_components.accordion.scss +3 -1
- package/src/styles/06-components/_components.avatar-group.scss +0 -0
- package/src/styles/06-components/_components.avatar.scss +0 -0
- package/src/styles/06-components/_components.badge.scss +9 -9
- package/src/styles/06-components/_components.breadcrumb.scss +0 -0
- package/src/styles/06-components/_components.btn-group.scss +0 -0
- package/src/styles/06-components/_components.button.scss +0 -0
- package/src/styles/06-components/_components.callout.scss +2 -1
- package/src/styles/06-components/_components.card.scss +0 -1
- package/src/styles/06-components/_components.chart.scss +2102 -0
- package/src/styles/06-components/_components.checkbox-group.scss +0 -0
- package/src/styles/06-components/_components.checkbox.scss +0 -0
- package/src/styles/06-components/_components.color-mode-toggle.scss +0 -0
- package/src/styles/06-components/_components.countdown.scss +0 -0
- package/src/styles/06-components/_components.data-table.scss +0 -0
- package/src/styles/06-components/_components.datepicker.scss +0 -0
- package/src/styles/06-components/_components.dropdown.scss +0 -0
- package/src/styles/06-components/_components.edge-panel.scss +0 -0
- package/src/styles/06-components/_components.form-group.scss +0 -0
- package/src/styles/06-components/_components.form.scss +0 -0
- package/src/styles/06-components/_components.hero.scss +1 -0
- package/src/styles/06-components/_components.icon.scss +2 -2
- package/src/styles/06-components/_components.image-gallery.scss +0 -0
- package/src/styles/06-components/_components.input.scss +0 -0
- package/src/styles/06-components/_components.list-group.scss +0 -0
- package/src/styles/06-components/_components.list.scss +0 -0
- package/src/styles/06-components/_components.menu.scss +0 -0
- package/src/styles/06-components/_components.messages.scss +0 -0
- package/src/styles/06-components/_components.modal.scss +3 -0
- package/src/styles/06-components/_components.nav.scss +0 -0
- package/src/styles/06-components/_components.navbar.scss +0 -0
- package/src/styles/06-components/_components.pagination.scss +0 -0
- package/src/styles/06-components/_components.photoviewer.scss +603 -545
- package/src/styles/06-components/_components.popover.scss +0 -0
- package/src/styles/06-components/_components.product-review.scss +0 -0
- package/src/styles/06-components/_components.progress.scss +0 -0
- package/src/styles/06-components/_components.rating.scss +0 -0
- package/src/styles/06-components/_components.river.scss +0 -0
- package/src/styles/06-components/_components.sectionintro.scss +0 -0
- package/src/styles/06-components/_components.select.scss +0 -0
- package/src/styles/06-components/_components.side-menu.scss +0 -0
- package/src/styles/06-components/_components.skeleton.scss +0 -0
- package/src/styles/06-components/_components.slider.scss +273 -0
- package/src/styles/06-components/_components.spinner.scss +0 -0
- package/src/styles/06-components/_components.steps.scss +1 -0
- package/src/styles/06-components/_components.tabs.scss +0 -0
- package/src/styles/06-components/_components.testimonials.scss +0 -0
- package/src/styles/06-components/_components.todo.scss +0 -0
- package/src/styles/06-components/_components.toggle.scss +0 -0
- package/src/styles/06-components/_components.tooltip.scss +4 -9
- package/src/styles/06-components/_components.upload.scss +0 -0
- package/src/styles/06-components/_components.video-player.scss +623 -0
- package/src/styles/06-components/_index.scss +3 -0
- package/src/styles/06-components/old.chart.styles.scss +2819 -0
- package/src/styles/99-utilities/_index.scss +0 -0
- package/src/styles/99-utilities/_utilities.background.scss +0 -0
- package/src/styles/99-utilities/_utilities.border.scss +0 -0
- package/src/styles/99-utilities/_utilities.clearfix.scss +0 -0
- package/src/styles/99-utilities/_utilities.display.scss +0 -0
- package/src/styles/99-utilities/_utilities.flex.scss +0 -0
- package/src/styles/99-utilities/_utilities.link.scss +0 -0
- package/src/styles/99-utilities/_utilities.object-fit.scss +0 -0
- package/src/styles/99-utilities/_utilities.opacity.scss +0 -0
- package/src/styles/99-utilities/_utilities.overflow.scss +0 -0
- package/src/styles/99-utilities/_utilities.position.scss +0 -0
- package/src/styles/99-utilities/_utilities.scss +2 -1
- package/src/styles/99-utilities/_utilities.shadow.scss +0 -0
- package/src/styles/99-utilities/_utilities.sizes.scss +0 -0
- package/src/styles/99-utilities/_utilities.spacing.scss +0 -0
- package/src/styles/99-utilities/_utilities.text.scss +5 -0
- package/src/styles/99-utilities/_utilities.visibility.scss +0 -0
- package/src/styles/99-utilities/_utilities.visually-hidden.scss +0 -0
- package/src/styles/99-utilities/_utilities.z-index.scss +0 -0
- package/src/styles/css-modules.d.ts +0 -0
- package/src/styles/index.scss +0 -0
- package/dist/index.css +0 -15
- package/dist/index.esm.css +0 -15
- package/dist/index.min.css +0 -15
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
# PhotoViewer Component - Refactoring Documentation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The PhotoViewer component has been comprehensively refactored to follow Atomix design system guidelines. This document outlines the changes made, the new structure, and how to use the component.
|
|
6
|
+
|
|
7
|
+
## What Was Refactored
|
|
8
|
+
|
|
9
|
+
### 1. Component Structure
|
|
10
|
+
- **Before**: Single large file with inline sub-components
|
|
11
|
+
- **After**: Modular structure with separate files for each sub-component
|
|
12
|
+
|
|
13
|
+
### 2. File Organization
|
|
14
|
+
```
|
|
15
|
+
src/components/PhotoViewer/
|
|
16
|
+
├── PhotoViewer.tsx # Main component
|
|
17
|
+
├── PhotoViewerHeader.tsx # Header with controls
|
|
18
|
+
├── PhotoViewerNavigation.tsx # Navigation buttons
|
|
19
|
+
├── PhotoViewerImage.tsx # Image display with gestures
|
|
20
|
+
├── PhotoViewerThumbnails.tsx # Thumbnail navigation
|
|
21
|
+
├── PhotoViewerInfo.tsx # Image metadata panel
|
|
22
|
+
├── PhotoViewer.stories.tsx # Storybook examples
|
|
23
|
+
├── index.ts # Component exports
|
|
24
|
+
├── examples/ # Usage examples
|
|
25
|
+
│ ├── ImageGallery.tsx
|
|
26
|
+
│ └── SimpleGallery.tsx
|
|
27
|
+
└── scripts/ # Vanilla JS implementation
|
|
28
|
+
├── index.ts # Main PhotoViewer class
|
|
29
|
+
├── PhotoViewerInteractions.ts # Event handlers & utilities
|
|
30
|
+
└── bundle.ts # Global registration
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 3. New Features
|
|
34
|
+
- **Body Class Toggle**: Adds `is-open-photoviewer` class to body element when PhotoViewer is open
|
|
35
|
+
- **Per-Image State Management**: Each image maintains its own zoom, rotation, and position state
|
|
36
|
+
- **Smart Dragging Limits**: Dragging is constrained to image boundaries based on zoom level and rotation
|
|
37
|
+
- **Enhanced Touch Gestures**: Improved pinch-to-zoom and pan gestures for mobile devices
|
|
38
|
+
- **Smooth Transitions**: Enhanced animations for image navigation and state changes
|
|
39
|
+
- **Smart Zoom Levels**: Intelligent zoom presets (1x, 2x, 4x) with double-click support
|
|
40
|
+
|
|
41
|
+
### 4. Type Definitions
|
|
42
|
+
- **ImageType** interface moved to `src/lib/types/components.ts`
|
|
43
|
+
- All component props properly documented with JSDoc
|
|
44
|
+
- Comprehensive TypeScript support
|
|
45
|
+
|
|
46
|
+
### 4. Vanilla JS Implementation
|
|
47
|
+
- Complete rewrite of the vanilla JS version
|
|
48
|
+
- Full feature parity with React component
|
|
49
|
+
- Proper event handling and lifecycle management
|
|
50
|
+
- Global API registration under `window.Atomix.PhotoViewer`
|
|
51
|
+
|
|
52
|
+
### 5. Hook Improvements
|
|
53
|
+
- Added missing `imageRef` to `usePhotoViewer` hook
|
|
54
|
+
- Better TypeScript types
|
|
55
|
+
- Enhanced gesture handling
|
|
56
|
+
- Fixed infinite re-render issues
|
|
57
|
+
- Added comprehensive null safety checks
|
|
58
|
+
- Improved performance with optimized dependencies
|
|
59
|
+
|
|
60
|
+
### 6. Error Handling & Stability
|
|
61
|
+
- **Null Safety**: Comprehensive checks for DOM element availability
|
|
62
|
+
- **Mount State Tracking**: Prevents premature calculations
|
|
63
|
+
- **Graceful Degradation**: Fallbacks for missing image dimensions
|
|
64
|
+
- **Error Boundaries**: Try-catch blocks for critical operations
|
|
65
|
+
- **Performance Guards**: Prevents unnecessary re-renders
|
|
66
|
+
|
|
67
|
+
## Component Features
|
|
68
|
+
|
|
69
|
+
## Core Features
|
|
70
|
+
- ✅ Image navigation with keyboard support
|
|
71
|
+
- ✅ Zoom and pan functionality with edge constraints
|
|
72
|
+
- ✅ Touch gestures for mobile devices
|
|
73
|
+
- ✅ Fullscreen mode
|
|
74
|
+
- ✅ Image rotation
|
|
75
|
+
- ✅ Download and share capabilities
|
|
76
|
+
- ✅ Thumbnail navigation
|
|
77
|
+
- ✅ Image metadata display
|
|
78
|
+
- ✅ Responsive design
|
|
79
|
+
- ✅ Accessibility support (ARIA, keyboard navigation)
|
|
80
|
+
- ✅ Body class toggle for styling (`is-open-photoviewer` class)
|
|
81
|
+
- ✅ Per-image state persistence (zoom, pan, rotation)
|
|
82
|
+
- ✅ Smart boundary detection and constraint enforcement
|
|
83
|
+
- ✅ Smooth transitions and animations
|
|
84
|
+
- ✅ Error handling and null safety
|
|
85
|
+
- ✅ Per-image state persistence (zoom, rotation, position)
|
|
86
|
+
- ✅ Smart dragging boundaries
|
|
87
|
+
- ✅ Enhanced gesture recognition
|
|
88
|
+
- ✅ Smooth image transitions
|
|
89
|
+
- ✅ Intelligent zoom controls
|
|
90
|
+
|
|
91
|
+
### New Capabilities
|
|
92
|
+
- **Enhanced Type Safety**: All components properly typed
|
|
93
|
+
- **Modular Architecture**: Each sub-component can be used independently
|
|
94
|
+
- **Vanilla JS API**: Complete JavaScript implementation for non-React projects
|
|
95
|
+
- **Improved Performance**: Better event handling and optimizations
|
|
96
|
+
- **Better Error Handling**: Graceful handling of edge cases and null safety
|
|
97
|
+
- **Per-Image State Management**: Individual zoom, pan, and rotation states preserved
|
|
98
|
+
- **Advanced Boundary System**: Dynamic edge constraints based on zoom/rotation
|
|
99
|
+
- **Smooth UX**: Professional-grade animations and transitions
|
|
100
|
+
- **Mobile Excellence**: Native-like touch interactions and gestures
|
|
101
|
+
- **Per-Image State Management**: Each image remembers its zoom, rotation, and position
|
|
102
|
+
- **Smart Boundary Detection**: Dragging is intelligently constrained to image edges
|
|
103
|
+
- **Enhanced Mobile Experience**: Improved touch gestures and responsive design
|
|
104
|
+
- **Smooth Animations**: Fluid transitions between images and states
|
|
105
|
+
- **Advanced UX Features**: Per-image state, smart boundaries, enhanced gestures
|
|
106
|
+
- **Mobile-First Design**: Optimized touch interactions and responsive behavior
|
|
107
|
+
|
|
108
|
+
## Usage Examples
|
|
109
|
+
|
|
110
|
+
### React Component
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { PhotoViewer } from '@/components/PhotoViewer';
|
|
114
|
+
|
|
115
|
+
const images = [
|
|
116
|
+
{
|
|
117
|
+
src: 'https://example.com/image1.jpg',
|
|
118
|
+
alt: 'Image 1',
|
|
119
|
+
title: 'Beautiful Landscape',
|
|
120
|
+
description: 'A stunning mountain landscape',
|
|
121
|
+
tags: ['nature', 'mountains']
|
|
122
|
+
},
|
|
123
|
+
'https://example.com/image2.jpg' // Simple string format also supported
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
function MyComponent() {
|
|
127
|
+
return (
|
|
128
|
+
<PhotoViewer
|
|
129
|
+
images={images}
|
|
130
|
+
startIndex={0}
|
|
131
|
+
enableKeyboardNavigation={true}
|
|
132
|
+
enableGestures={true}
|
|
133
|
+
enableFullscreen={true}
|
|
134
|
+
thumbnailPosition="bottom"
|
|
135
|
+
onImageChange={(index) => console.log('Changed to image:', index)}
|
|
136
|
+
onClose={() => console.log('Viewer closed')}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Note: When PhotoViewer is open, an 'is-open-photoviewer' class
|
|
142
|
+
// is automatically added to the body element for styling purposes
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Vanilla JavaScript
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
// Initialize from data attributes
|
|
149
|
+
const viewers = Atomix.PhotoViewer.init();
|
|
150
|
+
|
|
151
|
+
// Create programmatically
|
|
152
|
+
const viewer = new Atomix.PhotoViewer.create(document.getElementById('viewer'), {
|
|
153
|
+
images: [
|
|
154
|
+
{ src: 'image1.jpg', title: 'Image 1' },
|
|
155
|
+
{ src: 'image2.jpg', title: 'Image 2' }
|
|
156
|
+
],
|
|
157
|
+
startIndex: 0,
|
|
158
|
+
enableKeyboardNavigation: true
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Open viewer programmatically
|
|
162
|
+
Atomix.PhotoViewer.open([
|
|
163
|
+
'image1.jpg',
|
|
164
|
+
'image2.jpg'
|
|
165
|
+
], { startIndex: 1 });
|
|
166
|
+
|
|
167
|
+
// Setup gallery
|
|
168
|
+
Atomix.PhotoViewer.setupGallery('.gallery', 'img');
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### HTML Data Attributes
|
|
172
|
+
|
|
173
|
+
```html
|
|
174
|
+
<div data-photoviewer
|
|
175
|
+
data-images='[{"src":"image1.jpg","title":"Image 1"},{"src":"image2.jpg","title":"Image 2"}]'
|
|
176
|
+
data-start-index="0"
|
|
177
|
+
data-enable-keyboard-navigation="true">
|
|
178
|
+
<!-- Content will be replaced by PhotoViewer -->
|
|
179
|
+
</div>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## API Reference
|
|
183
|
+
|
|
184
|
+
### React Props
|
|
185
|
+
|
|
186
|
+
| Prop | Type | Default | Description |
|
|
187
|
+
|------|------|---------|-------------|
|
|
188
|
+
| `images` | `(string \| ImageType)[]` | `[]` | Array of image URLs or objects |
|
|
189
|
+
| `startIndex` | `number` | `0` | Initial image index |
|
|
190
|
+
| `className` | `string` | `''` | Additional CSS classes |
|
|
191
|
+
| `disabled` | `boolean` | `false` | Disable all interactions |
|
|
192
|
+
| `enableKeyboardNavigation` | `boolean` | `true` | Enable arrow key navigation |
|
|
193
|
+
| `enableGestures` | `boolean` | `true` | Enable touch gestures |
|
|
194
|
+
| `enableFullscreen` | `boolean` | `true` | Enable fullscreen mode |
|
|
195
|
+
| `thumbnailPosition` | `'bottom' \| 'top' \| 'left' \| 'right' \| 'none'` | `'bottom'` | Thumbnail position |
|
|
196
|
+
| `onImageChange` | `(index: number) => void` | - | Image change callback |
|
|
197
|
+
| `onClose` | `() => void` | - | Close callback |
|
|
198
|
+
|
|
199
|
+
### Vanilla JS API
|
|
200
|
+
|
|
201
|
+
| Method | Description |
|
|
202
|
+
|--------|-------------|
|
|
203
|
+
| `Atomix.PhotoViewer.create(element, options)` | Create new instance |
|
|
204
|
+
| `Atomix.PhotoViewer.init()` | Initialize from data attributes |
|
|
205
|
+
| `Atomix.PhotoViewer.get(element)` | Get existing instance |
|
|
206
|
+
| `Atomix.PhotoViewer.open(images, options)` | Open viewer programmatically |
|
|
207
|
+
| `Atomix.PhotoViewer.setupGallery(selector)` | Setup gallery click handlers |
|
|
208
|
+
| `Atomix.PhotoViewer.disposeAll()` | Dispose all instances |
|
|
209
|
+
|
|
210
|
+
### ImageType Interface
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
interface ImageType {
|
|
214
|
+
src: string;
|
|
215
|
+
alt?: string;
|
|
216
|
+
thumbnail?: string;
|
|
217
|
+
title?: string;
|
|
218
|
+
description?: string;
|
|
219
|
+
date?: string;
|
|
220
|
+
author?: string;
|
|
221
|
+
tags?: string[];
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Accessibility Features
|
|
226
|
+
|
|
227
|
+
- **ARIA Support**: Proper roles and labels
|
|
228
|
+
- **Keyboard Navigation**: Arrow keys, Escape, Tab navigation
|
|
229
|
+
- **Screen Reader**: Descriptive alt text and announcements
|
|
230
|
+
- **Focus Management**: Proper focus handling in modal state
|
|
231
|
+
- **High Contrast**: Works with high contrast modes
|
|
232
|
+
- **Reduced Motion**: Respects `prefers-reduced-motion`
|
|
233
|
+
|
|
234
|
+
## Browser Support
|
|
235
|
+
|
|
236
|
+
- **Modern Browsers**: Chrome 80+, Firefox 74+, Safari 13+, Edge 80+
|
|
237
|
+
- **Mobile**: iOS Safari 13+, Chrome Mobile 80+
|
|
238
|
+
- **Touch Gestures**: Full support on touch devices
|
|
239
|
+
- **Fullscreen API**: Where supported by browser
|
|
240
|
+
|
|
241
|
+
## Performance Optimizations
|
|
242
|
+
|
|
243
|
+
- **Lazy Loading**: Thumbnails loaded on demand
|
|
244
|
+
- **Event Delegation**: Efficient event handling
|
|
245
|
+
- **Memory Management**: Proper cleanup on destroy
|
|
246
|
+
- **Image Preloading**: Smart preloading of adjacent images
|
|
247
|
+
- **CSS Optimizations**: Hardware acceleration for smooth animations
|
|
248
|
+
|
|
249
|
+
## Migration Guide
|
|
250
|
+
|
|
251
|
+
### From Previous Version
|
|
252
|
+
|
|
253
|
+
1. **Import Changes**:
|
|
254
|
+
```tsx
|
|
255
|
+
// Old
|
|
256
|
+
import { PhotoViewer, ImageType } from './PhotoViewer';
|
|
257
|
+
|
|
258
|
+
// New
|
|
259
|
+
import { PhotoViewer, ImageType } from './PhotoViewer';
|
|
260
|
+
// ImageType now imported from types
|
|
261
|
+
import { ImageType } from '../../lib/types/components';
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
2. **No Breaking Changes**: All existing props and functionality preserved
|
|
265
|
+
|
|
266
|
+
3. **New Features**: Additional capabilities available without migration
|
|
267
|
+
|
|
268
|
+
### Vanilla JS Migration
|
|
269
|
+
|
|
270
|
+
If migrating from a custom implementation:
|
|
271
|
+
|
|
272
|
+
1. Replace custom initialization with `Atomix.PhotoViewer.init()`
|
|
273
|
+
2. Use data attributes for configuration
|
|
274
|
+
3. Leverage built-in gallery setup with `setupGallery()`
|
|
275
|
+
|
|
276
|
+
## Troubleshooting
|
|
277
|
+
|
|
278
|
+
### Common Issues
|
|
279
|
+
|
|
280
|
+
1. **Navigator.share not available**: Gracefully handled, button hidden when unsupported
|
|
281
|
+
2. **Touch events**: Properly handles passive/active listeners
|
|
282
|
+
3. **Fullscreen API**: Falls back gracefully when not supported
|
|
283
|
+
4. **Image loading errors**: Shows placeholder and continues to work
|
|
284
|
+
5. **Body styling**: Uses `is-open-photoviewer` class on body element for additional styling
|
|
285
|
+
6. **getBoundingClientRect errors**: Fixed with comprehensive null checks and mount state tracking
|
|
286
|
+
7. **Infinite re-renders**: Resolved with optimized useEffect dependencies
|
|
287
|
+
8. **Performance issues**: Mitigated with proper state management and bounds calculation
|
|
288
|
+
|
|
289
|
+
### Fixed Issues (v1.1.0)
|
|
290
|
+
|
|
291
|
+
- ✅ **Fixed**: `Cannot read properties of null (reading 'getBoundingClientRect')` error
|
|
292
|
+
- ✅ **Fixed**: Maximum update depth exceeded warnings
|
|
293
|
+
- ✅ **Fixed**: Infinite re-render loops in usePhotoViewer hook
|
|
294
|
+
- ✅ **Fixed**: Memory leaks from improper cleanup
|
|
295
|
+
- ✅ **Fixed**: Race conditions with DOM element initialization
|
|
296
|
+
- ✅ **Fixed**: Touch gesture conflicts with browser behaviors
|
|
297
|
+
|
|
298
|
+
### CSS Styling Hook
|
|
299
|
+
|
|
300
|
+
```css
|
|
301
|
+
/* Example of using the body class to style other elements when PhotoViewer is open */
|
|
302
|
+
body.is-open-photoviewer .site-header {
|
|
303
|
+
z-index: 0; /* Lower z-index when PhotoViewer is open */
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
body.is-open-photoviewer {
|
|
307
|
+
overflow: hidden; /* Prevent background scrolling */
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Debug Mode
|
|
312
|
+
|
|
313
|
+
```javascript
|
|
314
|
+
// Enable debug logging
|
|
315
|
+
window.Atomix.PhotoViewer.debug = true;
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## Recent Updates (v1.1.0)
|
|
319
|
+
|
|
320
|
+
### 🐛 Bug Fixes
|
|
321
|
+
- Fixed critical `getBoundingClientRect` null reference errors
|
|
322
|
+
- Resolved infinite re-render issues in React hook
|
|
323
|
+
- Added comprehensive null safety checks throughout
|
|
324
|
+
- Improved DOM element initialization handling
|
|
325
|
+
- Fixed memory leaks and performance issues
|
|
326
|
+
|
|
327
|
+
### 🚀 Performance Improvements
|
|
328
|
+
- Optimized useEffect dependencies to prevent unnecessary re-renders
|
|
329
|
+
- Added mount state tracking for better initialization
|
|
330
|
+
- Improved bounds calculation efficiency
|
|
331
|
+
- Enhanced error handling with try-catch blocks
|
|
332
|
+
- Better state management for per-image persistence
|
|
333
|
+
|
|
334
|
+
### ✨ UX Enhancements
|
|
335
|
+
- Smoother image transitions with loading states
|
|
336
|
+
- Enhanced touch gesture recognition
|
|
337
|
+
- Better boundary constraint system
|
|
338
|
+
- Improved mobile experience
|
|
339
|
+
- Professional-grade animations and easing
|
|
340
|
+
|
|
341
|
+
## Future Enhancements
|
|
342
|
+
|
|
343
|
+
- **Virtual Scrolling**: For large image sets
|
|
344
|
+
- **Image Comparison**: Side-by-side comparison mode
|
|
345
|
+
- **Video Support**: Extend to support video files
|
|
346
|
+
- **Advanced Filters**: Built-in image filters
|
|
347
|
+
- **Cloud Integration**: Direct integration with cloud storage APIs
|
|
348
|
+
- **AI Features**: Smart cropping and enhancement suggestions
|
|
349
|
+
|
|
350
|
+
## Contributing
|
|
351
|
+
|
|
352
|
+
When contributing to PhotoViewer:
|
|
353
|
+
|
|
354
|
+
1. Follow Atomix component guidelines
|
|
355
|
+
2. Maintain feature parity between React and Vanilla JS versions
|
|
356
|
+
3. Add comprehensive tests for new features
|
|
357
|
+
4. Update documentation and examples
|
|
358
|
+
5. Ensure accessibility compliance
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { MasonryGridItem } from '../../../layouts/MasonryGrid/MasonryGridItem';
|
|
3
|
+
import { MasonryGrid } from '../../../layouts/MasonryGrid/MasonryGrid';
|
|
4
|
+
import { PhotoViewer } from '../PhotoViewer';
|
|
5
|
+
import { Card } from '../../Card/Card';
|
|
6
|
+
|
|
7
|
+
// Define the image gallery item type
|
|
8
|
+
export interface GalleryImage {
|
|
9
|
+
id: number;
|
|
10
|
+
title: string;
|
|
11
|
+
description: string;
|
|
12
|
+
url: string;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Create sample gallery data with different aspect ratios
|
|
18
|
+
const galleryImages: GalleryImage[] = [
|
|
19
|
+
{
|
|
20
|
+
id: 1,
|
|
21
|
+
title: 'Mountain Landscape',
|
|
22
|
+
description: 'Beautiful mountain landscape with a lake view',
|
|
23
|
+
url: 'https://picsum.photos/id/10/800/600',
|
|
24
|
+
width: 800,
|
|
25
|
+
height: 600,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 2,
|
|
29
|
+
title: 'Beach Sunset',
|
|
30
|
+
description: 'Stunning sunset over the ocean',
|
|
31
|
+
url: 'https://picsum.photos/id/11/800/1000',
|
|
32
|
+
width: 800,
|
|
33
|
+
height: 1000,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 3,
|
|
37
|
+
title: 'Forest Path',
|
|
38
|
+
description: 'A serene path through a dense forest',
|
|
39
|
+
url: 'https://picsum.photos/id/12/800/500',
|
|
40
|
+
width: 800,
|
|
41
|
+
height: 500,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 4,
|
|
45
|
+
title: 'City Skyline',
|
|
46
|
+
description: 'Urban skyline with modern architecture',
|
|
47
|
+
url: 'https://picsum.photos/id/13/800/800',
|
|
48
|
+
width: 800,
|
|
49
|
+
height: 800,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 5,
|
|
53
|
+
title: 'Abstract Art',
|
|
54
|
+
description: 'Colorful abstract painting with geometric shapes',
|
|
55
|
+
url: 'https://picsum.photos/id/14/800/600',
|
|
56
|
+
width: 800,
|
|
57
|
+
height: 600,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 6,
|
|
61
|
+
title: 'Wildlife',
|
|
62
|
+
description: 'Wild animals in their natural habitat',
|
|
63
|
+
url: 'https://picsum.photos/id/15/800/1200',
|
|
64
|
+
width: 800,
|
|
65
|
+
height: 1200,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 7,
|
|
69
|
+
title: 'Architecture',
|
|
70
|
+
description: 'Impressive architectural details of a historic building',
|
|
71
|
+
url: 'https://picsum.photos/id/16/800/600',
|
|
72
|
+
width: 800,
|
|
73
|
+
height: 600,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 8,
|
|
77
|
+
title: 'Food Photography',
|
|
78
|
+
description: 'Delicious culinary creation beautifully presented',
|
|
79
|
+
url: 'https://picsum.photos/id/17/800/700',
|
|
80
|
+
width: 800,
|
|
81
|
+
height: 700,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 9,
|
|
85
|
+
title: 'Portrait',
|
|
86
|
+
description: 'Expressive portrait capturing human emotion',
|
|
87
|
+
url: 'https://picsum.photos/id/18/800/1000',
|
|
88
|
+
width: 800,
|
|
89
|
+
height: 1000,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 10,
|
|
93
|
+
title: 'Nature Closeup',
|
|
94
|
+
description: 'Macro photography revealing intricate natural details',
|
|
95
|
+
url: 'https://picsum.photos/id/19/800/600',
|
|
96
|
+
width: 800,
|
|
97
|
+
height: 600,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: 11,
|
|
101
|
+
title: 'Travel Destination',
|
|
102
|
+
description: 'Iconic landmark from a popular travel destination',
|
|
103
|
+
url: 'https://picsum.photos/id/20/800/900',
|
|
104
|
+
width: 800,
|
|
105
|
+
height: 900,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: 12,
|
|
109
|
+
title: 'Minimalist Scene',
|
|
110
|
+
description: 'Clean, minimalist composition with simple elements',
|
|
111
|
+
url: 'https://picsum.photos/id/21/800/600',
|
|
112
|
+
width: 800,
|
|
113
|
+
height: 600,
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
export const ImageGallery: React.FC = () => {
|
|
118
|
+
// State to track which images are selected for the PhotoViewer
|
|
119
|
+
const [selectedImageIndex, setSelectedImageIndex] = useState(0);
|
|
120
|
+
const [showPhotoViewer, setShowPhotoViewer] = useState(false);
|
|
121
|
+
|
|
122
|
+
// Create enhanced image objects for the PhotoViewer
|
|
123
|
+
const enhancedImages = galleryImages.map(image => ({
|
|
124
|
+
src: image.url,
|
|
125
|
+
alt: image.title,
|
|
126
|
+
title: image.title,
|
|
127
|
+
description: image.description,
|
|
128
|
+
tags: [`${image.width}x${image.height}`],
|
|
129
|
+
}));
|
|
130
|
+
|
|
131
|
+
// Handle clicking on a gallery item
|
|
132
|
+
const handleImageClick = (index: number) => {
|
|
133
|
+
setSelectedImageIndex(index);
|
|
134
|
+
setShowPhotoViewer(true);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Handle closing the PhotoViewer
|
|
138
|
+
const handlePhotoViewerClose = () => {
|
|
139
|
+
setShowPhotoViewer(false);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Create spy function for image change handler
|
|
143
|
+
const handleImageChange = (index: number) => setSelectedImageIndex(index);
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<div className="c-image-gallery">
|
|
147
|
+
<h2 className="c-image-gallery__title">Image Gallery</h2>
|
|
148
|
+
<p className="c-image-gallery__description">
|
|
149
|
+
Click on any image to view it in the PhotoViewer. Navigate through the gallery using the
|
|
150
|
+
arrow buttons or thumbnails.
|
|
151
|
+
</p>
|
|
152
|
+
|
|
153
|
+
{/* MasonryGrid for the image gallery */}
|
|
154
|
+
<MasonryGrid xs={1} sm={2} md={3} lg={4} gap={16} animate={true} imagesLoaded={true}>
|
|
155
|
+
{galleryImages.map((image, index) => (
|
|
156
|
+
<MasonryGridItem key={image.id}>
|
|
157
|
+
<div className="c-image-gallery__item" onClick={() => handleImageClick(index)}>
|
|
158
|
+
<Card
|
|
159
|
+
image={image.url}
|
|
160
|
+
imageAlt={image.title}
|
|
161
|
+
title={image.title}
|
|
162
|
+
text={image.description}
|
|
163
|
+
className="c-image-gallery__card"
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
</MasonryGridItem>
|
|
167
|
+
))}
|
|
168
|
+
</MasonryGrid>
|
|
169
|
+
|
|
170
|
+
{/* PhotoViewer component */}
|
|
171
|
+
{showPhotoViewer && (
|
|
172
|
+
<PhotoViewer
|
|
173
|
+
images={enhancedImages}
|
|
174
|
+
startIndex={selectedImageIndex}
|
|
175
|
+
onClose={handlePhotoViewerClose}
|
|
176
|
+
thumbnailPosition="bottom"
|
|
177
|
+
enableFullscreen={true}
|
|
178
|
+
enableGestures={true}
|
|
179
|
+
enableKeyboardNavigation={true}
|
|
180
|
+
onImageChange={handleImageChange}
|
|
181
|
+
/>
|
|
182
|
+
)}
|
|
183
|
+
</div>
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export default ImageGallery;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { PhotoViewer } from '../PhotoViewer';
|
|
3
|
+
|
|
4
|
+
const images = [
|
|
5
|
+
'https://picsum.photos/id/10/800/600',
|
|
6
|
+
'https://picsum.photos/id/11/800/1000',
|
|
7
|
+
'https://picsum.photos/id/12/800/500',
|
|
8
|
+
'https://picsum.photos/id/13/800/800',
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export const SimpleGallery: React.FC = () => {
|
|
12
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
13
|
+
const [showViewer, setShowViewer] = useState(false);
|
|
14
|
+
|
|
15
|
+
const handleOpen = (index: number) => {
|
|
16
|
+
setSelectedIndex(index);
|
|
17
|
+
setShowViewer(true);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const handleClose = () => {
|
|
21
|
+
setShowViewer(false);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const handleImageChange = (index: number) => setSelectedIndex(index);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div style={{ padding: '20px' }}>
|
|
28
|
+
<h2 style={{ marginBottom: '20px' }}>Simple Gallery Example</h2>
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
display: 'grid',
|
|
32
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',
|
|
33
|
+
gap: '16px',
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
{images.map((src, index) => (
|
|
37
|
+
<div
|
|
38
|
+
key={index}
|
|
39
|
+
onClick={() => handleOpen(index)}
|
|
40
|
+
style={{
|
|
41
|
+
cursor: 'pointer',
|
|
42
|
+
borderRadius: '8px',
|
|
43
|
+
overflow: 'hidden',
|
|
44
|
+
boxShadow: '0 4px 6px rgba(0,0,0,0.1)',
|
|
45
|
+
transition: 'transform 0.3s ease',
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
<img
|
|
49
|
+
src={src}
|
|
50
|
+
alt={`Gallery image ${index + 1}`}
|
|
51
|
+
style={{ width: '100%', height: 'auto', display: 'block' }}
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
{showViewer && (
|
|
58
|
+
<PhotoViewer
|
|
59
|
+
images={images}
|
|
60
|
+
startIndex={selectedIndex}
|
|
61
|
+
onClose={handleClose}
|
|
62
|
+
thumbnailPosition="bottom"
|
|
63
|
+
enableFullscreen={true}
|
|
64
|
+
enableGestures={true}
|
|
65
|
+
enableKeyboardNavigation={true}
|
|
66
|
+
onImageChange={handleImageChange}
|
|
67
|
+
/>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default SimpleGallery;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { PhotoViewer } from './PhotoViewer';
|
|
2
|
+
export { default } from './PhotoViewer';
|
|
3
|
+
export { PhotoViewerHeader } from './PhotoViewerHeader';
|
|
4
|
+
export { PhotoViewerNavigation } from './PhotoViewerNavigation';
|
|
5
|
+
export { PhotoViewerImage } from './PhotoViewerImage';
|
|
6
|
+
export { PhotoViewerThumbnails } from './PhotoViewerThumbnails';
|
|
7
|
+
export { PhotoViewerInfo } from './PhotoViewerInfo';
|
|
8
|
+
|
|
9
|
+
export type { PhotoViewerProps, ImageType } from '../../lib/types/components';
|
|
10
|
+
export type { PhotoViewerHeaderProps } from './PhotoViewerHeader';
|
|
11
|
+
export type { PhotoViewerNavigationProps } from './PhotoViewerNavigation';
|
|
12
|
+
export type { PhotoViewerImageProps } from './PhotoViewerImage';
|
|
13
|
+
export type { PhotoViewerThumbnailsProps } from './PhotoViewerThumbnails';
|
|
14
|
+
export type { PhotoViewerInfoProps } from './PhotoViewerInfo';
|