@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,197 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { SideMenuProps, SideMenuItemProps } from '../types/components';
|
|
3
|
+
import { SIDE_MENU } from '../constants/components';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* SideMenu state and functionality
|
|
7
|
+
* @param initialProps - Initial side menu properties
|
|
8
|
+
* @returns SideMenu state and methods
|
|
9
|
+
*/
|
|
10
|
+
export function useSideMenu(initialProps?: Partial<SideMenuProps>) {
|
|
11
|
+
// Default side menu properties
|
|
12
|
+
const defaultProps: Partial<SideMenuProps> = {
|
|
13
|
+
collapsible: true,
|
|
14
|
+
isOpen: false,
|
|
15
|
+
...initialProps,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Local open state for when not controlled externally
|
|
19
|
+
const [isOpenState, setIsOpenState] = useState(defaultProps.isOpen || false);
|
|
20
|
+
|
|
21
|
+
// Refs for managing responsive behavior
|
|
22
|
+
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
23
|
+
const innerRef = useRef<HTMLDivElement>(null);
|
|
24
|
+
|
|
25
|
+
// Update local state when external state changes
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (typeof defaultProps.isOpen !== 'undefined') {
|
|
28
|
+
setIsOpenState(defaultProps.isOpen);
|
|
29
|
+
}
|
|
30
|
+
}, [defaultProps.isOpen]);
|
|
31
|
+
|
|
32
|
+
// Handle responsive behavior - auto-open on desktop, controlled on mobile
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const handleResize = () => {
|
|
35
|
+
const isMobile = window.innerWidth < 768; // MD breakpoint
|
|
36
|
+
|
|
37
|
+
if (!isMobile && defaultProps.collapsible) {
|
|
38
|
+
// Auto-open on desktop
|
|
39
|
+
if (typeof defaultProps.onToggle === 'function') {
|
|
40
|
+
defaultProps.onToggle(true);
|
|
41
|
+
} else {
|
|
42
|
+
setIsOpenState(true);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Reset wrapper height on desktop
|
|
46
|
+
if (wrapperRef.current) {
|
|
47
|
+
wrapperRef.current.style.height = 'auto';
|
|
48
|
+
}
|
|
49
|
+
} else if (isMobile && wrapperRef.current && innerRef.current) {
|
|
50
|
+
// Set proper height for mobile animation
|
|
51
|
+
const currentOpen =
|
|
52
|
+
typeof defaultProps.isOpen !== 'undefined' ? defaultProps.isOpen : isOpenState;
|
|
53
|
+
if (currentOpen) {
|
|
54
|
+
wrapperRef.current.style.height = `${innerRef.current.scrollHeight}px`;
|
|
55
|
+
} else {
|
|
56
|
+
wrapperRef.current.style.height = '0px';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
handleResize(); // Initial call
|
|
62
|
+
window.addEventListener('resize', handleResize);
|
|
63
|
+
|
|
64
|
+
return () => {
|
|
65
|
+
window.removeEventListener('resize', handleResize);
|
|
66
|
+
};
|
|
67
|
+
}, [defaultProps.collapsible, defaultProps.isOpen, defaultProps.onToggle, isOpenState]);
|
|
68
|
+
|
|
69
|
+
// Update wrapper height when open state changes on mobile
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const isMobile = window.innerWidth < 768;
|
|
72
|
+
|
|
73
|
+
if (isMobile && wrapperRef.current && innerRef.current && defaultProps.collapsible) {
|
|
74
|
+
const currentOpen =
|
|
75
|
+
typeof defaultProps.isOpen !== 'undefined' ? defaultProps.isOpen : isOpenState;
|
|
76
|
+
|
|
77
|
+
if (currentOpen) {
|
|
78
|
+
wrapperRef.current.style.height = `${innerRef.current.scrollHeight}px`;
|
|
79
|
+
} else {
|
|
80
|
+
wrapperRef.current.style.height = '0px';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, [defaultProps.isOpen, isOpenState, defaultProps.collapsible]);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Generate side menu class based on properties
|
|
87
|
+
* @param props - Side menu properties
|
|
88
|
+
* @returns Class string
|
|
89
|
+
*/
|
|
90
|
+
const generateSideMenuClass = (props: Partial<SideMenuProps & { isOpen?: boolean }>): string => {
|
|
91
|
+
const { className = '', isOpen = false } = props;
|
|
92
|
+
|
|
93
|
+
const openClass = isOpen ? SIDE_MENU.CLASSES.IS_OPEN : '';
|
|
94
|
+
|
|
95
|
+
return `${SIDE_MENU.CLASSES.BASE} ${openClass} ${className}`.trim();
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Generate wrapper class
|
|
100
|
+
* @returns Class string
|
|
101
|
+
*/
|
|
102
|
+
const generateWrapperClass = (): string => {
|
|
103
|
+
return SIDE_MENU.CLASSES.WRAPPER;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Handle toggle click
|
|
108
|
+
*/
|
|
109
|
+
const handleToggle = () => {
|
|
110
|
+
if (defaultProps.disabled) return;
|
|
111
|
+
|
|
112
|
+
const newState =
|
|
113
|
+
typeof defaultProps.isOpen !== 'undefined' ? !defaultProps.isOpen : !isOpenState;
|
|
114
|
+
|
|
115
|
+
if (typeof defaultProps.onToggle === 'function') {
|
|
116
|
+
// Controlled component
|
|
117
|
+
defaultProps.onToggle(newState);
|
|
118
|
+
} else {
|
|
119
|
+
// Uncontrolled component
|
|
120
|
+
setIsOpenState(newState);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get current open state
|
|
126
|
+
* @returns Current open state
|
|
127
|
+
*/
|
|
128
|
+
const getCurrentOpenState = (): boolean => {
|
|
129
|
+
return typeof defaultProps.isOpen !== 'undefined' ? defaultProps.isOpen : isOpenState;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
defaultProps,
|
|
134
|
+
isOpenState: getCurrentOpenState(),
|
|
135
|
+
wrapperRef,
|
|
136
|
+
innerRef,
|
|
137
|
+
generateSideMenuClass,
|
|
138
|
+
generateWrapperClass,
|
|
139
|
+
handleToggle,
|
|
140
|
+
getCurrentOpenState,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* SideMenuItem state and functionality
|
|
146
|
+
* @param initialProps - Initial side menu item properties
|
|
147
|
+
* @returns SideMenuItem state and methods
|
|
148
|
+
*/
|
|
149
|
+
export function useSideMenuItem(initialProps?: Partial<SideMenuItemProps>) {
|
|
150
|
+
// Default side menu item properties
|
|
151
|
+
const defaultProps: Partial<SideMenuItemProps> = {
|
|
152
|
+
active: false,
|
|
153
|
+
disabled: false,
|
|
154
|
+
...initialProps,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Generate side menu item class based on properties
|
|
159
|
+
* @returns Class string
|
|
160
|
+
*/
|
|
161
|
+
const generateSideMenuItemClass = (): string => {
|
|
162
|
+
const {
|
|
163
|
+
active = defaultProps.active,
|
|
164
|
+
disabled = defaultProps.disabled,
|
|
165
|
+
className = '',
|
|
166
|
+
} = defaultProps;
|
|
167
|
+
|
|
168
|
+
const activeClass = active ? SIDE_MENU.CLASSES.ACTIVE : '';
|
|
169
|
+
const disabledClass = disabled ? SIDE_MENU.CLASSES.DISABLED : '';
|
|
170
|
+
|
|
171
|
+
return `${SIDE_MENU.CLASSES.LINK} ${activeClass} ${disabledClass} ${className}`.trim();
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Handle side menu item click with disabled check
|
|
176
|
+
* @param handler - Click handler function
|
|
177
|
+
* @returns Function that respects disabled state
|
|
178
|
+
*/
|
|
179
|
+
const handleClick = (handler?: (event: React.MouseEvent) => void) => {
|
|
180
|
+
return (e: React.MouseEvent) => {
|
|
181
|
+
if (defaultProps.disabled) {
|
|
182
|
+
e.preventDefault();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (handler) {
|
|
187
|
+
handler(e);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
defaultProps,
|
|
194
|
+
generateSideMenuItemClass,
|
|
195
|
+
handleClick,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { SliderProps, SliderSlide, SliderState } from '../types/components';
|
|
3
|
+
|
|
4
|
+
export interface UseSliderOptions extends Omit<SliderProps, 'slides' | 'children'> {
|
|
5
|
+
slides: SliderSlide[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface UseSliderReturn extends SliderState {
|
|
9
|
+
slideNext: () => void;
|
|
10
|
+
slidePrev: () => void;
|
|
11
|
+
goToSlide: (index: number) => void;
|
|
12
|
+
canSlideNext: boolean;
|
|
13
|
+
canSlidePrev: boolean;
|
|
14
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
15
|
+
wrapperRef: React.RefObject<HTMLDivElement | null>;
|
|
16
|
+
handleTouchStart: (e: React.TouchEvent | React.MouseEvent) => void;
|
|
17
|
+
handleTouchMove: (e: React.TouchEvent | React.MouseEvent) => void;
|
|
18
|
+
handleTouchEnd: (e: React.TouchEvent | React.MouseEvent) => void;
|
|
19
|
+
allSlides: SliderSlide[];
|
|
20
|
+
translateValue: number;
|
|
21
|
+
slideWidth: number;
|
|
22
|
+
currentSlidesToShow: number;
|
|
23
|
+
loopedSlides: number;
|
|
24
|
+
repositioningRef: React.RefObject<boolean>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function useSlider(options: UseSliderOptions): UseSliderReturn {
|
|
28
|
+
const {
|
|
29
|
+
slides,
|
|
30
|
+
slidesToShow = 1,
|
|
31
|
+
spaceBetween = 0,
|
|
32
|
+
loop = false,
|
|
33
|
+
initialSlide = 0,
|
|
34
|
+
direction = 'horizontal',
|
|
35
|
+
speed = 300,
|
|
36
|
+
allowTouchMove = true,
|
|
37
|
+
threshold = 50,
|
|
38
|
+
onSlideChange,
|
|
39
|
+
} = options;
|
|
40
|
+
|
|
41
|
+
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
42
|
+
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
|
43
|
+
const repositioningRef = useRef(false);
|
|
44
|
+
|
|
45
|
+
const [realIndex, setRealIndex] = useState(initialSlide);
|
|
46
|
+
const [internalIndex, setInternalIndex] = useState(0);
|
|
47
|
+
const [isTransitioning, setIsTransitioning] = useState(false);
|
|
48
|
+
const [containerSize, setContainerSize] = useState(0);
|
|
49
|
+
const [touching, setTouching] = useState(false);
|
|
50
|
+
const [touchStart, setTouchStart] = useState(0);
|
|
51
|
+
const [dragOffset, setDragOffset] = useState(0);
|
|
52
|
+
|
|
53
|
+
const slideWidth = useMemo(() => {
|
|
54
|
+
if (containerSize === 0) return 0;
|
|
55
|
+
return (containerSize - spaceBetween * (slidesToShow - 1)) / slidesToShow;
|
|
56
|
+
}, [containerSize, spaceBetween, slidesToShow]);
|
|
57
|
+
|
|
58
|
+
const allSlides = useMemo(() => {
|
|
59
|
+
if (!loop || slides.length === 0) return slides;
|
|
60
|
+
|
|
61
|
+
// Create unique keys for each set
|
|
62
|
+
const firstSet = slides.map((slide, i) => ({ ...slide, id: `set1-${slide.id || i}` }));
|
|
63
|
+
const secondSet = slides.map((slide, i) => ({ ...slide, id: `set2-${slide.id || i}` }));
|
|
64
|
+
const thirdSet = slides.map((slide, i) => ({ ...slide, id: `set3-${slide.id || i}` }));
|
|
65
|
+
|
|
66
|
+
return [...firstSet, ...secondSet, ...thirdSet];
|
|
67
|
+
}, [slides, loop]);
|
|
68
|
+
|
|
69
|
+
const loopedSlides = slides.length;
|
|
70
|
+
|
|
71
|
+
const translateValue = useMemo(() => {
|
|
72
|
+
if (slideWidth === 0) return 0;
|
|
73
|
+
return -(internalIndex * slideWidth) + dragOffset;
|
|
74
|
+
}, [slideWidth, internalIndex, dragOffset]);
|
|
75
|
+
|
|
76
|
+
// Initialize
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (loop) {
|
|
79
|
+
setInternalIndex(slides.length + initialSlide); // Start in middle set
|
|
80
|
+
} else {
|
|
81
|
+
setInternalIndex(initialSlide);
|
|
82
|
+
}
|
|
83
|
+
}, [loop, slides.length, initialSlide]);
|
|
84
|
+
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
const updateSize = () => {
|
|
87
|
+
if (containerRef.current) {
|
|
88
|
+
const size =
|
|
89
|
+
direction === 'horizontal'
|
|
90
|
+
? containerRef.current.offsetWidth
|
|
91
|
+
: containerRef.current.offsetHeight;
|
|
92
|
+
setContainerSize(size);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
updateSize();
|
|
96
|
+
window.addEventListener('resize', updateSize);
|
|
97
|
+
return () => window.removeEventListener('resize', updateSize);
|
|
98
|
+
}, [direction]);
|
|
99
|
+
|
|
100
|
+
const slideNext = useCallback(() => {
|
|
101
|
+
if (isTransitioning) return;
|
|
102
|
+
|
|
103
|
+
if (loop) {
|
|
104
|
+
const nextRealIndex = (realIndex + 1) % slides.length;
|
|
105
|
+
const nextInternalIndex = internalIndex + 1;
|
|
106
|
+
|
|
107
|
+
setRealIndex(nextRealIndex);
|
|
108
|
+
setInternalIndex(nextInternalIndex);
|
|
109
|
+
setIsTransitioning(true);
|
|
110
|
+
setDragOffset(0);
|
|
111
|
+
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
setIsTransitioning(false);
|
|
114
|
+
onSlideChange?.(nextRealIndex);
|
|
115
|
+
|
|
116
|
+
// Reposition after transition ends
|
|
117
|
+
if (nextInternalIndex >= slides.length * 2) {
|
|
118
|
+
repositioningRef.current = true;
|
|
119
|
+
setInternalIndex(slides.length + nextRealIndex);
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
repositioningRef.current = false;
|
|
122
|
+
}, 0);
|
|
123
|
+
}
|
|
124
|
+
}, speed);
|
|
125
|
+
} else {
|
|
126
|
+
const nextIndex = Math.min(realIndex + 1, slides.length - slidesToShow);
|
|
127
|
+
setRealIndex(nextIndex);
|
|
128
|
+
setInternalIndex(nextIndex);
|
|
129
|
+
setIsTransitioning(true);
|
|
130
|
+
setDragOffset(0);
|
|
131
|
+
|
|
132
|
+
setTimeout(() => {
|
|
133
|
+
setIsTransitioning(false);
|
|
134
|
+
onSlideChange?.(nextIndex);
|
|
135
|
+
}, speed);
|
|
136
|
+
}
|
|
137
|
+
}, [
|
|
138
|
+
realIndex,
|
|
139
|
+
internalIndex,
|
|
140
|
+
slides.length,
|
|
141
|
+
slidesToShow,
|
|
142
|
+
loop,
|
|
143
|
+
isTransitioning,
|
|
144
|
+
speed,
|
|
145
|
+
onSlideChange,
|
|
146
|
+
allSlides.length,
|
|
147
|
+
loopedSlides,
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
const slidePrev = useCallback(() => {
|
|
151
|
+
if (isTransitioning) return;
|
|
152
|
+
|
|
153
|
+
if (loop) {
|
|
154
|
+
const prevRealIndex = realIndex === 0 ? slides.length - 1 : realIndex - 1;
|
|
155
|
+
const prevInternalIndex = internalIndex - 1;
|
|
156
|
+
|
|
157
|
+
setRealIndex(prevRealIndex);
|
|
158
|
+
setInternalIndex(prevInternalIndex);
|
|
159
|
+
setIsTransitioning(true);
|
|
160
|
+
setDragOffset(0);
|
|
161
|
+
|
|
162
|
+
setTimeout(() => {
|
|
163
|
+
setIsTransitioning(false);
|
|
164
|
+
onSlideChange?.(prevRealIndex);
|
|
165
|
+
|
|
166
|
+
// Reposition after transition ends
|
|
167
|
+
if (prevInternalIndex < slides.length) {
|
|
168
|
+
repositioningRef.current = true;
|
|
169
|
+
setInternalIndex(slides.length + prevRealIndex);
|
|
170
|
+
setTimeout(() => {
|
|
171
|
+
repositioningRef.current = false;
|
|
172
|
+
}, 0);
|
|
173
|
+
}
|
|
174
|
+
}, speed);
|
|
175
|
+
} else {
|
|
176
|
+
const prevIndex = Math.max(realIndex - 1, 0);
|
|
177
|
+
setRealIndex(prevIndex);
|
|
178
|
+
setInternalIndex(prevIndex);
|
|
179
|
+
setIsTransitioning(true);
|
|
180
|
+
setDragOffset(0);
|
|
181
|
+
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
setIsTransitioning(false);
|
|
184
|
+
onSlideChange?.(prevIndex);
|
|
185
|
+
}, speed);
|
|
186
|
+
}
|
|
187
|
+
}, [
|
|
188
|
+
realIndex,
|
|
189
|
+
internalIndex,
|
|
190
|
+
slides.length,
|
|
191
|
+
loop,
|
|
192
|
+
isTransitioning,
|
|
193
|
+
speed,
|
|
194
|
+
onSlideChange,
|
|
195
|
+
allSlides.length,
|
|
196
|
+
loopedSlides,
|
|
197
|
+
]);
|
|
198
|
+
|
|
199
|
+
const goToSlide = useCallback(
|
|
200
|
+
(index: number) => {
|
|
201
|
+
if (isTransitioning || index === realIndex) return;
|
|
202
|
+
|
|
203
|
+
setIsTransitioning(true);
|
|
204
|
+
setDragOffset(0);
|
|
205
|
+
|
|
206
|
+
setRealIndex(index);
|
|
207
|
+
setInternalIndex(loop ? slides.length + index : index);
|
|
208
|
+
|
|
209
|
+
setTimeout(() => {
|
|
210
|
+
setIsTransitioning(false);
|
|
211
|
+
onSlideChange?.(index);
|
|
212
|
+
}, speed);
|
|
213
|
+
},
|
|
214
|
+
[realIndex, isTransitioning, speed, onSlideChange, loop, loopedSlides]
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
const handleTouchStart = useCallback(
|
|
218
|
+
(e: React.TouchEvent | React.MouseEvent) => {
|
|
219
|
+
if (!allowTouchMove) return;
|
|
220
|
+
|
|
221
|
+
const client =
|
|
222
|
+
direction === 'horizontal'
|
|
223
|
+
? 'touches' in e
|
|
224
|
+
? e.touches[0]?.clientX || 0
|
|
225
|
+
: e.clientX
|
|
226
|
+
: 'touches' in e
|
|
227
|
+
? e.touches[0]?.clientY || 0
|
|
228
|
+
: e.clientY;
|
|
229
|
+
setTouchStart(client);
|
|
230
|
+
setTouching(true);
|
|
231
|
+
setDragOffset(0);
|
|
232
|
+
},
|
|
233
|
+
[allowTouchMove, direction]
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
const handleTouchMove = useCallback(
|
|
237
|
+
(e: React.TouchEvent | React.MouseEvent) => {
|
|
238
|
+
if (!touching || !allowTouchMove) return;
|
|
239
|
+
|
|
240
|
+
const client =
|
|
241
|
+
direction === 'horizontal'
|
|
242
|
+
? 'touches' in e
|
|
243
|
+
? e.touches[0]?.clientX || 0
|
|
244
|
+
: e.clientX
|
|
245
|
+
: 'touches' in e
|
|
246
|
+
? e.touches[0]?.clientY || 0
|
|
247
|
+
: e.clientY;
|
|
248
|
+
const diff = touchStart - client;
|
|
249
|
+
|
|
250
|
+
if (Math.abs(diff) > 10) {
|
|
251
|
+
e.preventDefault();
|
|
252
|
+
setDragOffset(-diff * 0.5);
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
[touching, touchStart, allowTouchMove, direction]
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
const handleTouchEnd = useCallback(
|
|
259
|
+
(e: React.TouchEvent | React.MouseEvent) => {
|
|
260
|
+
if (!touching || !allowTouchMove) return;
|
|
261
|
+
|
|
262
|
+
const client =
|
|
263
|
+
direction === 'horizontal'
|
|
264
|
+
? 'changedTouches' in e
|
|
265
|
+
? e.changedTouches[0]?.clientX || 0
|
|
266
|
+
: e.clientX
|
|
267
|
+
: 'changedTouches' in e
|
|
268
|
+
? e.changedTouches[0]?.clientY || 0
|
|
269
|
+
: e.clientY;
|
|
270
|
+
const diff = touchStart - client;
|
|
271
|
+
|
|
272
|
+
setTouching(false);
|
|
273
|
+
setDragOffset(0);
|
|
274
|
+
|
|
275
|
+
if (Math.abs(diff) > threshold) {
|
|
276
|
+
if (diff > 0) {
|
|
277
|
+
slideNext();
|
|
278
|
+
} else {
|
|
279
|
+
slidePrev();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
[touching, touchStart, threshold, slideNext, slidePrev, allowTouchMove, direction]
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
const canSlideNext = loop || realIndex < slides.length - slidesToShow;
|
|
287
|
+
const canSlidePrev = loop || realIndex > 0;
|
|
288
|
+
|
|
289
|
+
return {
|
|
290
|
+
activeIndex: realIndex,
|
|
291
|
+
realIndex,
|
|
292
|
+
previousIndex: realIndex,
|
|
293
|
+
isBeginning: !loop && realIndex === 0,
|
|
294
|
+
isEnd: !loop && realIndex >= slides.length - slidesToShow,
|
|
295
|
+
progress: slides.length > 0 ? realIndex / (slides.length - 1) : 0,
|
|
296
|
+
autoplayRunning: false,
|
|
297
|
+
transitioning: isTransitioning,
|
|
298
|
+
touching,
|
|
299
|
+
translate: translateValue,
|
|
300
|
+
slidesPerView: slidesToShow,
|
|
301
|
+
slidesCount: slides.length,
|
|
302
|
+
isLocked: false,
|
|
303
|
+
destroyed: false,
|
|
304
|
+
size: containerSize,
|
|
305
|
+
touches: {
|
|
306
|
+
startX: 0,
|
|
307
|
+
startY: 0,
|
|
308
|
+
currentX: 0,
|
|
309
|
+
currentY: 0,
|
|
310
|
+
diff: 0,
|
|
311
|
+
},
|
|
312
|
+
allowSlideNext: canSlideNext,
|
|
313
|
+
allowSlidePrev: canSlidePrev,
|
|
314
|
+
allowTouchMove,
|
|
315
|
+
animating: isTransitioning,
|
|
316
|
+
enabled: true,
|
|
317
|
+
initialized: true,
|
|
318
|
+
|
|
319
|
+
slideNext,
|
|
320
|
+
slidePrev,
|
|
321
|
+
goToSlide,
|
|
322
|
+
canSlideNext,
|
|
323
|
+
canSlidePrev,
|
|
324
|
+
|
|
325
|
+
containerRef,
|
|
326
|
+
wrapperRef,
|
|
327
|
+
|
|
328
|
+
handleTouchStart,
|
|
329
|
+
handleTouchMove,
|
|
330
|
+
handleTouchEnd,
|
|
331
|
+
|
|
332
|
+
allSlides,
|
|
333
|
+
translateValue,
|
|
334
|
+
slideWidth,
|
|
335
|
+
currentSlidesToShow: slidesToShow,
|
|
336
|
+
loopedSlides,
|
|
337
|
+
repositioningRef,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SpinnerProps } from '../types/components';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Spinner state and functionality
|
|
5
|
+
* @param initialProps - Initial spinner properties
|
|
6
|
+
* @returns Spinner state and methods
|
|
7
|
+
*/
|
|
8
|
+
export function useSpinner(initialProps?: Partial<SpinnerProps>) {
|
|
9
|
+
// Default spinner properties
|
|
10
|
+
const defaultProps: Partial<SpinnerProps> = {
|
|
11
|
+
variant: 'primary',
|
|
12
|
+
size: 'md',
|
|
13
|
+
fullscreen: false,
|
|
14
|
+
...initialProps,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Generate spinner class based on properties
|
|
19
|
+
* @param props - Spinner properties
|
|
20
|
+
* @returns Class string
|
|
21
|
+
*/
|
|
22
|
+
const generateSpinnerClass = (props: Partial<SpinnerProps>): string => {
|
|
23
|
+
const {
|
|
24
|
+
variant = defaultProps.variant,
|
|
25
|
+
size = defaultProps.size,
|
|
26
|
+
fullscreen = defaultProps.fullscreen,
|
|
27
|
+
className = '',
|
|
28
|
+
} = props;
|
|
29
|
+
|
|
30
|
+
const baseClass = 'c-spinner';
|
|
31
|
+
const variantClass = variant ? `${baseClass}--${variant}` : '';
|
|
32
|
+
const sizeClass = size !== 'md' ? `${baseClass}--${size}` : '';
|
|
33
|
+
const fullscreenClass = fullscreen ? `${baseClass}--fullscreen` : '';
|
|
34
|
+
|
|
35
|
+
return `${baseClass} ${variantClass} ${sizeClass} ${fullscreenClass} ${className}`.trim();
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
defaultProps,
|
|
40
|
+
generateSpinnerClass,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TextareaProps } from '../types/components';
|
|
2
|
+
import { TEXTAREA } from '../constants/components';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Textarea state and functionality
|
|
6
|
+
* @param initialProps - Initial textarea properties
|
|
7
|
+
* @returns Textarea state and methods
|
|
8
|
+
*/
|
|
9
|
+
export function useTextarea(initialProps?: Partial<TextareaProps>) {
|
|
10
|
+
// Default textarea properties
|
|
11
|
+
const defaultProps: Partial<TextareaProps> = {
|
|
12
|
+
size: 'md',
|
|
13
|
+
disabled: false,
|
|
14
|
+
invalid: false,
|
|
15
|
+
valid: false,
|
|
16
|
+
...initialProps,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generate textarea class based on properties
|
|
21
|
+
* @param props - Textarea properties
|
|
22
|
+
* @returns Class string
|
|
23
|
+
*/
|
|
24
|
+
const generateTextareaClass = (props: Partial<TextareaProps>): string => {
|
|
25
|
+
const {
|
|
26
|
+
size = defaultProps.size,
|
|
27
|
+
variant = defaultProps.variant,
|
|
28
|
+
disabled = defaultProps.disabled,
|
|
29
|
+
invalid = defaultProps.invalid,
|
|
30
|
+
valid = defaultProps.valid,
|
|
31
|
+
className = '',
|
|
32
|
+
} = props;
|
|
33
|
+
|
|
34
|
+
const sizeClass =
|
|
35
|
+
size === 'md' ? '' : size === 'sm' ? TEXTAREA.CLASSES.SMALL : TEXTAREA.CLASSES.LARGE;
|
|
36
|
+
|
|
37
|
+
const variantClass = variant ? `c-input--${variant}` : '';
|
|
38
|
+
|
|
39
|
+
let validationClass = '';
|
|
40
|
+
if (invalid) {
|
|
41
|
+
validationClass = TEXTAREA.CLASSES.INVALID;
|
|
42
|
+
} else if (valid) {
|
|
43
|
+
validationClass = TEXTAREA.CLASSES.VALID;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const disabledClass = disabled ? TEXTAREA.CLASSES.DISABLED : '';
|
|
47
|
+
|
|
48
|
+
return `${TEXTAREA.CLASSES.BASE} ${sizeClass} ${variantClass} ${validationClass} ${disabledClass} ${className}`.trim();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
defaultProps,
|
|
53
|
+
generateTextareaClass,
|
|
54
|
+
};
|
|
55
|
+
}
|