@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,63 @@
|
|
|
1
|
+
// Button composables
|
|
2
|
+
export * from './useButton';
|
|
3
|
+
|
|
4
|
+
// Accordion composables
|
|
5
|
+
export * from './useAccordion';
|
|
6
|
+
|
|
7
|
+
// Badge composables
|
|
8
|
+
export * from './useBadge';
|
|
9
|
+
|
|
10
|
+
// Hero composables
|
|
11
|
+
export * from './useHero';
|
|
12
|
+
|
|
13
|
+
// River composables
|
|
14
|
+
export * from './useRiver';
|
|
15
|
+
|
|
16
|
+
// Spinner composables
|
|
17
|
+
export * from './useSpinner';
|
|
18
|
+
|
|
19
|
+
// Navbar composables
|
|
20
|
+
export * from './useNavbar';
|
|
21
|
+
|
|
22
|
+
// SideMenu composables
|
|
23
|
+
export * from './useSideMenu';
|
|
24
|
+
|
|
25
|
+
// EdgePanel composables
|
|
26
|
+
export * from './useEdgePanel';
|
|
27
|
+
|
|
28
|
+
// Todo composables
|
|
29
|
+
export * from './useTodo';
|
|
30
|
+
|
|
31
|
+
// Form composables
|
|
32
|
+
export * from './useCheckbox';
|
|
33
|
+
export * from './useForm';
|
|
34
|
+
export * from './useFormGroup';
|
|
35
|
+
export * from './useInput';
|
|
36
|
+
export * from './useRadio';
|
|
37
|
+
export * from './useSelect';
|
|
38
|
+
export * from './useTextarea';
|
|
39
|
+
|
|
40
|
+
// Export other composables as needed
|
|
41
|
+
|
|
42
|
+
// New composables
|
|
43
|
+
export * from './useBreadcrumb';
|
|
44
|
+
export * from './useCard';
|
|
45
|
+
export * from './useDataTable';
|
|
46
|
+
export * from './useModal';
|
|
47
|
+
export * from './usePagination';
|
|
48
|
+
export * from './useSlider';
|
|
49
|
+
|
|
50
|
+
// Chart composables - simplified
|
|
51
|
+
export * from './useChartData';
|
|
52
|
+
export * from './useChartScale';
|
|
53
|
+
export * from './useChartInteraction';
|
|
54
|
+
|
|
55
|
+
// Legacy chart composables (deprecated)
|
|
56
|
+
export * from './useLineChart';
|
|
57
|
+
export * from './useBarChart';
|
|
58
|
+
export * from './usePieChart';
|
|
59
|
+
|
|
60
|
+
// Theme composables
|
|
61
|
+
|
|
62
|
+
// Block composables
|
|
63
|
+
export * from './useBlock';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { AccordionProps, AccordionState, IconPosition, ElementRefs } from '../types/components';
|
|
2
|
+
import { useState, useEffect, useRef } from 'react';
|
|
3
|
+
import { ACCORDION } from '../constants/components';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Accordion functionality hook result
|
|
7
|
+
*/
|
|
8
|
+
interface UseAccordionResult {
|
|
9
|
+
/** Current accordion state */
|
|
10
|
+
state: AccordionState;
|
|
11
|
+
/** Toggle the accordion open/closed */
|
|
12
|
+
toggle: () => void;
|
|
13
|
+
/** Update the panel height based on content */
|
|
14
|
+
updatePanelHeight: () => void;
|
|
15
|
+
/** Reference to the panel element */
|
|
16
|
+
panelRef: React.RefObject<HTMLDivElement | null>;
|
|
17
|
+
/** Reference to the content element */
|
|
18
|
+
contentRef: React.RefObject<HTMLDivElement | null>;
|
|
19
|
+
/** Generate accordion class names based on state */
|
|
20
|
+
generateClassNames: (baseClassName?: string) => string;
|
|
21
|
+
/** Generate header class names */
|
|
22
|
+
generateHeaderClassNames: () => string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Accordion functionality hook
|
|
27
|
+
* @param initialProps - Initial accordion properties
|
|
28
|
+
* @returns Accordion state and methods
|
|
29
|
+
*/
|
|
30
|
+
export function useAccordion(
|
|
31
|
+
initialProps?: Partial<AccordionProps> & {
|
|
32
|
+
isOpen?: boolean;
|
|
33
|
+
onOpenChange?: (open: boolean) => void;
|
|
34
|
+
}
|
|
35
|
+
): UseAccordionResult {
|
|
36
|
+
// Default accordion properties
|
|
37
|
+
const defaultProps: Partial<AccordionProps> & {
|
|
38
|
+
isOpen?: boolean;
|
|
39
|
+
onOpenChange?: (open: boolean) => void;
|
|
40
|
+
} = {
|
|
41
|
+
defaultOpen: false,
|
|
42
|
+
disabled: false,
|
|
43
|
+
iconPosition: 'right' as IconPosition,
|
|
44
|
+
...initialProps,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Controlled/uncontrolled open state
|
|
48
|
+
const isControlled = typeof defaultProps.isOpen === 'boolean';
|
|
49
|
+
const [internalOpen, setInternalOpen] = useState(defaultProps.defaultOpen || false);
|
|
50
|
+
const isOpen = isControlled ? defaultProps.isOpen! : internalOpen;
|
|
51
|
+
|
|
52
|
+
const [panelHeight, setPanelHeight] = useState<string>(isOpen ? 'auto' : '0px');
|
|
53
|
+
|
|
54
|
+
const panelRef = useRef<HTMLDivElement>(null);
|
|
55
|
+
const contentRef = useRef<HTMLDivElement>(null);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Toggle accordion open/closed state
|
|
59
|
+
*/
|
|
60
|
+
const toggle = (): void => {
|
|
61
|
+
if (!defaultProps.disabled) {
|
|
62
|
+
if (isControlled) {
|
|
63
|
+
defaultProps.onOpenChange && defaultProps.onOpenChange(!isOpen);
|
|
64
|
+
} else {
|
|
65
|
+
setInternalOpen(prev => !prev);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Update panel height based on content
|
|
72
|
+
*/
|
|
73
|
+
const updatePanelHeight = (): void => {
|
|
74
|
+
if (contentRef.current && panelRef.current) {
|
|
75
|
+
const height = isOpen ? `${contentRef.current.clientHeight}px` : '0px';
|
|
76
|
+
panelRef.current.style.setProperty(ACCORDION.CSS_VARS.PANEL_HEIGHT, height);
|
|
77
|
+
setPanelHeight(height);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Effect to update panel height when open state changes
|
|
83
|
+
*/
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
updatePanelHeight();
|
|
86
|
+
}, [isOpen]);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Effect to handle window resize and update panel height
|
|
90
|
+
*/
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
const handleResize = (): void => {
|
|
93
|
+
if (isOpen) {
|
|
94
|
+
updatePanelHeight();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
window.addEventListener('resize', handleResize);
|
|
99
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
100
|
+
}, [isOpen]);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Generate accordion class names based on state
|
|
104
|
+
*/
|
|
105
|
+
const generateClassNames = (baseClassName: string = ''): string => {
|
|
106
|
+
const openClass = isOpen ? ACCORDION.CLASSES.IS_OPEN : '';
|
|
107
|
+
const disabledClass = defaultProps.disabled ? ACCORDION.CLASSES.IS_DISABLED : '';
|
|
108
|
+
return `c-accordion ${openClass} ${disabledClass} ${baseClassName}`.trim();
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Generate header class names
|
|
113
|
+
*/
|
|
114
|
+
const generateHeaderClassNames = (): string => {
|
|
115
|
+
const iconPositionClass =
|
|
116
|
+
defaultProps.iconPosition === 'left' ? 'c-accordion__header--icon-left' : '';
|
|
117
|
+
return `c-accordion__header ${iconPositionClass}`.trim();
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
state: { isOpen, panelHeight },
|
|
122
|
+
toggle,
|
|
123
|
+
updatePanelHeight,
|
|
124
|
+
panelRef,
|
|
125
|
+
contentRef,
|
|
126
|
+
generateClassNames,
|
|
127
|
+
generateHeaderClassNames,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { RefObject, useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface UseAmbientModeOptions {
|
|
4
|
+
videoRef: RefObject<HTMLVideoElement | null>;
|
|
5
|
+
canvasRef: RefObject<HTMLCanvasElement | null>;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
blur?: number;
|
|
8
|
+
opacity?: number;
|
|
9
|
+
scale?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function useAmbientMode({
|
|
13
|
+
videoRef,
|
|
14
|
+
canvasRef,
|
|
15
|
+
enabled,
|
|
16
|
+
blur = 60,
|
|
17
|
+
opacity = 0.6,
|
|
18
|
+
scale = 1.2,
|
|
19
|
+
}: UseAmbientModeOptions) {
|
|
20
|
+
const animationFrameRef = useRef<number>(60);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!enabled || !videoRef.current || !canvasRef.current) return undefined;
|
|
24
|
+
|
|
25
|
+
const video = videoRef.current;
|
|
26
|
+
const canvas = canvasRef.current;
|
|
27
|
+
const ctx = canvas.getContext('2d');
|
|
28
|
+
|
|
29
|
+
if (!ctx) return undefined;
|
|
30
|
+
|
|
31
|
+
const updateAmbientEffect = () => {
|
|
32
|
+
if (!video || !canvas || !ctx) return;
|
|
33
|
+
|
|
34
|
+
// Set canvas size to match container
|
|
35
|
+
const rect = video.getBoundingClientRect();
|
|
36
|
+
canvas.width = rect.width * scale;
|
|
37
|
+
canvas.height = rect.height * scale;
|
|
38
|
+
|
|
39
|
+
// Draw video frame to canvas
|
|
40
|
+
ctx.filter = `blur(${blur}px)`;
|
|
41
|
+
ctx.globalAlpha = opacity;
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
// Handle CORS or other drawing errors silently
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (enabled) {
|
|
50
|
+
animationFrameRef.current = requestAnimationFrame(updateAmbientEffect);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Start ambient effect when video plays
|
|
55
|
+
const handlePlay = () => {
|
|
56
|
+
if (enabled) {
|
|
57
|
+
updateAmbientEffect();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const handlePause = () => {
|
|
62
|
+
if (animationFrameRef.current) {
|
|
63
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
video.addEventListener('play', handlePlay);
|
|
68
|
+
video.addEventListener('pause', handlePause);
|
|
69
|
+
video.addEventListener('ended', handlePause);
|
|
70
|
+
|
|
71
|
+
// Initial setup if video is already playing
|
|
72
|
+
if (!video.paused) {
|
|
73
|
+
handlePlay();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return () => {
|
|
77
|
+
video.removeEventListener('play', handlePlay);
|
|
78
|
+
video.removeEventListener('pause', handlePause);
|
|
79
|
+
video.removeEventListener('ended', handlePause);
|
|
80
|
+
|
|
81
|
+
if (animationFrameRef.current) {
|
|
82
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}, [enabled, blur, opacity, scale, videoRef, canvasRef]);
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
isActive: enabled,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BadgeProps } from '../types/components';
|
|
2
|
+
import { BADGE } from '../constants/components';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Badge state and functionality
|
|
6
|
+
* @param initialProps - Initial badge properties
|
|
7
|
+
* @returns Badge state and methods
|
|
8
|
+
*/
|
|
9
|
+
export function useBadge(initialProps?: Partial<BadgeProps>) {
|
|
10
|
+
// Default badge properties
|
|
11
|
+
const defaultProps: Partial<BadgeProps> = {
|
|
12
|
+
variant: 'primary',
|
|
13
|
+
size: 'md',
|
|
14
|
+
disabled: false,
|
|
15
|
+
...initialProps,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Generate badge class based on properties
|
|
20
|
+
* @param props - Badge properties
|
|
21
|
+
* @returns Class string
|
|
22
|
+
*/
|
|
23
|
+
const generateBadgeClass = (props: Partial<BadgeProps>): string => {
|
|
24
|
+
const {
|
|
25
|
+
variant = defaultProps.variant,
|
|
26
|
+
size = defaultProps.size,
|
|
27
|
+
disabled = defaultProps.disabled,
|
|
28
|
+
className = '',
|
|
29
|
+
} = props;
|
|
30
|
+
|
|
31
|
+
const sizeClass = size === 'md' ? '' : `${BADGE.SIZE_PREFIX}${size}`;
|
|
32
|
+
const variantClass = variant ? `${BADGE.VARIANT_PREFIX}${variant}` : '';
|
|
33
|
+
const disabledClass = disabled ? 'c-badge--disabled' : '';
|
|
34
|
+
|
|
35
|
+
return `${BADGE.BASE_CLASS} ${variantClass} ${sizeClass} ${disabledClass} ${className}`.trim();
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
defaultProps,
|
|
40
|
+
generateBadgeClass,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
import { ChartDataset } from '../types/components';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Bar chart specific options
|
|
6
|
+
*/
|
|
7
|
+
export interface BarChartOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Whether bars are stacked
|
|
10
|
+
*/
|
|
11
|
+
stacked?: boolean;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Whether to show values on bars
|
|
15
|
+
*/
|
|
16
|
+
showValues?: boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Corner radius for bars
|
|
20
|
+
*/
|
|
21
|
+
cornerRadius?: number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Padding between bar groups
|
|
25
|
+
*/
|
|
26
|
+
groupPadding?: number;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Padding between individual bars
|
|
30
|
+
*/
|
|
31
|
+
barPadding?: number;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Whether to enable animations
|
|
35
|
+
*/
|
|
36
|
+
enableAnimations?: boolean;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Animation duration in milliseconds
|
|
40
|
+
*/
|
|
41
|
+
animationDuration?: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Animation delay between bars
|
|
45
|
+
*/
|
|
46
|
+
animationDelay?: number;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Whether to use gradients
|
|
50
|
+
*/
|
|
51
|
+
useGradients?: boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Whether to enable hover effects
|
|
55
|
+
*/
|
|
56
|
+
enableHoverEffects?: boolean;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Whether to enable data labels
|
|
60
|
+
*/
|
|
61
|
+
enableDataLabels?: boolean;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Data label position
|
|
65
|
+
*/
|
|
66
|
+
dataLabelPosition?: 'inside' | 'outside' | 'center';
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Value formatter function
|
|
70
|
+
*/
|
|
71
|
+
valueFormatter?: (value: number) => string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Minimum bar height
|
|
75
|
+
*/
|
|
76
|
+
minBarHeight?: number;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Maximum bar width
|
|
80
|
+
*/
|
|
81
|
+
maxBarWidth?: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Bar dimensions interface
|
|
86
|
+
*/
|
|
87
|
+
export interface BarDimensions {
|
|
88
|
+
x: number;
|
|
89
|
+
y: number;
|
|
90
|
+
width: number;
|
|
91
|
+
height: number;
|
|
92
|
+
value: number;
|
|
93
|
+
datasetIndex: number;
|
|
94
|
+
pointIndex: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Hook for bar chart functionality
|
|
99
|
+
*/
|
|
100
|
+
export function useBarChart(datasets: ChartDataset[], options: BarChartOptions = {}) {
|
|
101
|
+
const [hoveredBar, setHoveredBar] = useState<{
|
|
102
|
+
datasetIndex: number;
|
|
103
|
+
pointIndex: number;
|
|
104
|
+
x: number;
|
|
105
|
+
y: number;
|
|
106
|
+
} | null>(null);
|
|
107
|
+
|
|
108
|
+
const [animationProgress, setAnimationProgress] = useState(0);
|
|
109
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
110
|
+
|
|
111
|
+
// Calculate bar dimensions
|
|
112
|
+
const calculateBarDimensions = useCallback(
|
|
113
|
+
(
|
|
114
|
+
datasets: ChartDataset[],
|
|
115
|
+
width: number,
|
|
116
|
+
height: number,
|
|
117
|
+
padding = { top: 20, right: 30, bottom: 40, left: 50 },
|
|
118
|
+
horizontal = false
|
|
119
|
+
): BarDimensions[] => {
|
|
120
|
+
if (!datasets.length) return [];
|
|
121
|
+
|
|
122
|
+
const innerWidth = width - padding.left - padding.right;
|
|
123
|
+
const innerHeight = height - padding.top - padding.bottom;
|
|
124
|
+
const numCategories = datasets[0]?.data?.length || 0;
|
|
125
|
+
const numDatasets = datasets.length;
|
|
126
|
+
|
|
127
|
+
if (numCategories === 0) return [];
|
|
128
|
+
|
|
129
|
+
// Calculate value bounds
|
|
130
|
+
const allValues = datasets.flatMap(
|
|
131
|
+
dataset => dataset.data?.map(d => d.value).filter(v => typeof v === 'number') || []
|
|
132
|
+
);
|
|
133
|
+
const minValue = Math.min(0, ...allValues);
|
|
134
|
+
const maxValue = Math.max(...allValues);
|
|
135
|
+
const valueRange = maxValue - minValue;
|
|
136
|
+
|
|
137
|
+
const bars: BarDimensions[] = [];
|
|
138
|
+
const stackedPositions = Array(numCategories).fill(0);
|
|
139
|
+
|
|
140
|
+
datasets.forEach((dataset, datasetIndex) => {
|
|
141
|
+
dataset.data?.forEach((point, categoryIndex) => {
|
|
142
|
+
const value = typeof point.value === 'number' ? point.value : 0;
|
|
143
|
+
if (isNaN(value) || !isFinite(value)) return;
|
|
144
|
+
|
|
145
|
+
let barX, barY, barWidth, barHeight;
|
|
146
|
+
|
|
147
|
+
if (horizontal) {
|
|
148
|
+
const categoryHeight = innerHeight / numCategories;
|
|
149
|
+
const availableHeight = categoryHeight * (1 - (options.groupPadding || 0.2));
|
|
150
|
+
|
|
151
|
+
barHeight = options.stacked ? availableHeight : availableHeight / numDatasets;
|
|
152
|
+
barY =
|
|
153
|
+
padding.top + categoryIndex * categoryHeight + (categoryHeight - availableHeight) / 2;
|
|
154
|
+
|
|
155
|
+
if (!options.stacked) {
|
|
156
|
+
barY += datasetIndex * barHeight * (1 + (options.barPadding || 0.05));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
barX = padding.left;
|
|
160
|
+
barWidth = ((value - minValue) / valueRange) * innerWidth;
|
|
161
|
+
|
|
162
|
+
if (options.stacked && datasetIndex > 0) {
|
|
163
|
+
barX =
|
|
164
|
+
padding.left +
|
|
165
|
+
((stackedPositions[categoryIndex] - minValue) / valueRange) * innerWidth;
|
|
166
|
+
stackedPositions[categoryIndex] += value;
|
|
167
|
+
} else if (options.stacked) {
|
|
168
|
+
stackedPositions[categoryIndex] = value;
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
const categoryWidth = innerWidth / numCategories;
|
|
172
|
+
const availableWidth = categoryWidth * (1 - (options.groupPadding || 0.2));
|
|
173
|
+
|
|
174
|
+
barWidth = options.stacked ? availableWidth : availableWidth / numDatasets;
|
|
175
|
+
barX =
|
|
176
|
+
padding.left + categoryIndex * categoryWidth + (categoryWidth - availableWidth) / 2;
|
|
177
|
+
|
|
178
|
+
if (!options.stacked) {
|
|
179
|
+
barX += datasetIndex * barWidth * (1 + (options.barPadding || 0.05));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
barHeight = ((value - minValue) / valueRange) * innerHeight;
|
|
183
|
+
barY = height - padding.bottom - barHeight;
|
|
184
|
+
|
|
185
|
+
if (options.stacked && datasetIndex > 0) {
|
|
186
|
+
const stackedHeight =
|
|
187
|
+
((stackedPositions[categoryIndex] - minValue) / valueRange) * innerHeight;
|
|
188
|
+
barY = height - padding.bottom - stackedHeight - barHeight;
|
|
189
|
+
stackedPositions[categoryIndex] += value;
|
|
190
|
+
} else if (options.stacked) {
|
|
191
|
+
stackedPositions[categoryIndex] = value;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Apply minimum bar height
|
|
196
|
+
if (options.minBarHeight && (horizontal ? barWidth : barHeight) < options.minBarHeight) {
|
|
197
|
+
if (horizontal) {
|
|
198
|
+
barWidth = options.minBarHeight;
|
|
199
|
+
} else {
|
|
200
|
+
barHeight = options.minBarHeight;
|
|
201
|
+
barY = height - padding.bottom - barHeight;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Apply maximum bar width
|
|
206
|
+
if (options.maxBarWidth && (horizontal ? barHeight : barWidth) > options.maxBarWidth) {
|
|
207
|
+
if (horizontal) {
|
|
208
|
+
barHeight = options.maxBarWidth;
|
|
209
|
+
barY =
|
|
210
|
+
padding.top +
|
|
211
|
+
categoryIndex * (innerHeight / numCategories) +
|
|
212
|
+
(innerHeight / numCategories - barHeight) / 2;
|
|
213
|
+
} else {
|
|
214
|
+
barWidth = options.maxBarWidth;
|
|
215
|
+
const categoryWidth = (width - padding.left - padding.right) / numCategories;
|
|
216
|
+
barX = padding.left + categoryIndex * categoryWidth + (categoryWidth - barWidth) / 2;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
bars.push({
|
|
221
|
+
x: Math.max(barX, 0),
|
|
222
|
+
y: Math.max(barY, 0),
|
|
223
|
+
width: Math.max(barWidth, 0),
|
|
224
|
+
height: Math.max(barHeight, 0),
|
|
225
|
+
value,
|
|
226
|
+
datasetIndex,
|
|
227
|
+
pointIndex: categoryIndex,
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
return bars;
|
|
233
|
+
},
|
|
234
|
+
[
|
|
235
|
+
options.stacked,
|
|
236
|
+
options.groupPadding,
|
|
237
|
+
options.barPadding,
|
|
238
|
+
options.minBarHeight,
|
|
239
|
+
options.maxBarWidth,
|
|
240
|
+
]
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
// Animation helpers
|
|
244
|
+
const startAnimation = useCallback(() => {
|
|
245
|
+
if (!options.enableAnimations) return;
|
|
246
|
+
|
|
247
|
+
setIsAnimating(true);
|
|
248
|
+
setAnimationProgress(0);
|
|
249
|
+
|
|
250
|
+
const duration = options.animationDuration || 1000;
|
|
251
|
+
const startTime = Date.now();
|
|
252
|
+
|
|
253
|
+
const animate = () => {
|
|
254
|
+
const elapsed = Date.now() - startTime;
|
|
255
|
+
const progress = Math.min(elapsed / duration, 1);
|
|
256
|
+
|
|
257
|
+
// Easing function (ease-out)
|
|
258
|
+
const easedProgress = 1 - Math.pow(1 - progress, 3);
|
|
259
|
+
setAnimationProgress(easedProgress);
|
|
260
|
+
|
|
261
|
+
if (progress < 1) {
|
|
262
|
+
requestAnimationFrame(animate);
|
|
263
|
+
} else {
|
|
264
|
+
setIsAnimating(false);
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
requestAnimationFrame(animate);
|
|
269
|
+
}, [options.enableAnimations, options.animationDuration]);
|
|
270
|
+
|
|
271
|
+
// Bar hover handlers
|
|
272
|
+
const handleBarHover = useCallback(
|
|
273
|
+
(datasetIndex: number, pointIndex: number, x: number, y: number) => {
|
|
274
|
+
setHoveredBar({ datasetIndex, pointIndex, x, y });
|
|
275
|
+
},
|
|
276
|
+
[]
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
const handleBarLeave = useCallback(() => {
|
|
280
|
+
setHoveredBar(null);
|
|
281
|
+
}, []);
|
|
282
|
+
|
|
283
|
+
// Generate gradient definitions
|
|
284
|
+
const generateGradients = useCallback(
|
|
285
|
+
(datasets: ChartDataset[]) => {
|
|
286
|
+
if (!options.useGradients) return [];
|
|
287
|
+
|
|
288
|
+
return datasets.map((dataset, index) => {
|
|
289
|
+
const baseColor = dataset.color || `var(--atomix-color-${index + 1})`;
|
|
290
|
+
|
|
291
|
+
return {
|
|
292
|
+
id: `bar-gradient-${index}`,
|
|
293
|
+
stops: [
|
|
294
|
+
{ offset: '0%', color: baseColor, opacity: 0.8 },
|
|
295
|
+
{ offset: '100%', color: baseColor, opacity: 0.4 },
|
|
296
|
+
],
|
|
297
|
+
};
|
|
298
|
+
});
|
|
299
|
+
},
|
|
300
|
+
[options.useGradients]
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
// Format value for display
|
|
304
|
+
const formatValue = useCallback(
|
|
305
|
+
(value: number) => {
|
|
306
|
+
if (options.valueFormatter) {
|
|
307
|
+
return options.valueFormatter(value);
|
|
308
|
+
}
|
|
309
|
+
return value.toString();
|
|
310
|
+
},
|
|
311
|
+
[options.valueFormatter]
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
// Calculate data label position
|
|
315
|
+
const getDataLabelPosition = useCallback(
|
|
316
|
+
(bar: BarDimensions, horizontal = false) => {
|
|
317
|
+
const { x, y, width, height } = bar;
|
|
318
|
+
|
|
319
|
+
switch (options.dataLabelPosition) {
|
|
320
|
+
case 'inside':
|
|
321
|
+
return {
|
|
322
|
+
x: horizontal ? x + width / 2 : x + width / 2,
|
|
323
|
+
y: horizontal ? y + height / 2 : y + height / 2,
|
|
324
|
+
};
|
|
325
|
+
case 'outside':
|
|
326
|
+
return {
|
|
327
|
+
x: horizontal ? x + width + 5 : x + width / 2,
|
|
328
|
+
y: horizontal ? y + height / 2 : y - 5,
|
|
329
|
+
};
|
|
330
|
+
case 'center':
|
|
331
|
+
default:
|
|
332
|
+
return {
|
|
333
|
+
x: x + width / 2,
|
|
334
|
+
y: y + height / 2,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
[options.dataLabelPosition]
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
return {
|
|
342
|
+
// State
|
|
343
|
+
hoveredBar,
|
|
344
|
+
animationProgress,
|
|
345
|
+
isAnimating,
|
|
346
|
+
|
|
347
|
+
// Calculations
|
|
348
|
+
calculateBarDimensions,
|
|
349
|
+
generateGradients,
|
|
350
|
+
getDataLabelPosition,
|
|
351
|
+
|
|
352
|
+
// Handlers
|
|
353
|
+
handleBarHover,
|
|
354
|
+
handleBarLeave,
|
|
355
|
+
startAnimation,
|
|
356
|
+
|
|
357
|
+
// Utilities
|
|
358
|
+
formatValue,
|
|
359
|
+
|
|
360
|
+
// State setters
|
|
361
|
+
setHoveredBar,
|
|
362
|
+
setAnimationProgress,
|
|
363
|
+
setIsAnimating,
|
|
364
|
+
};
|
|
365
|
+
}
|