@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,574 @@
|
|
|
1
|
+
import { forwardRef, memo, useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { ChartProps } from '../../lib/types/components';
|
|
3
|
+
import Chart from './Chart';
|
|
4
|
+
|
|
5
|
+
interface TreemapDataPoint {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
value: number;
|
|
9
|
+
color?: string;
|
|
10
|
+
parent?: string;
|
|
11
|
+
children?: TreemapDataPoint[];
|
|
12
|
+
metadata?: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface TreemapNode {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
value: number;
|
|
19
|
+
color: string;
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
depth: number;
|
|
25
|
+
parent?: TreemapNode;
|
|
26
|
+
children: TreemapNode[];
|
|
27
|
+
originalData: TreemapDataPoint;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface TreemapChartProps extends Omit<ChartProps, 'type' | 'datasets'> {
|
|
31
|
+
/**
|
|
32
|
+
* Treemap data
|
|
33
|
+
*/
|
|
34
|
+
data: TreemapDataPoint[];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Treemap algorithm
|
|
38
|
+
*/
|
|
39
|
+
algorithm?: 'squarified' | 'slice-dice' | 'binary';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Color configuration
|
|
43
|
+
*/
|
|
44
|
+
colorConfig?: {
|
|
45
|
+
/**
|
|
46
|
+
* Color scheme
|
|
47
|
+
*/
|
|
48
|
+
scheme: 'category' | 'value' | 'depth' | 'custom';
|
|
49
|
+
/**
|
|
50
|
+
* Color palette
|
|
51
|
+
*/
|
|
52
|
+
palette?: string[];
|
|
53
|
+
/**
|
|
54
|
+
* Value-based color range
|
|
55
|
+
*/
|
|
56
|
+
valueRange?: [string, string];
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Whether to show labels
|
|
61
|
+
*/
|
|
62
|
+
showLabels?: boolean;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Whether to show values
|
|
66
|
+
*/
|
|
67
|
+
showValues?: boolean;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Label configuration
|
|
71
|
+
*/
|
|
72
|
+
labelConfig?: {
|
|
73
|
+
/**
|
|
74
|
+
* Minimum cell size to show label
|
|
75
|
+
*/
|
|
76
|
+
minSize?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Font size
|
|
79
|
+
*/
|
|
80
|
+
fontSize?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Text color
|
|
83
|
+
*/
|
|
84
|
+
color?: string;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Border configuration
|
|
89
|
+
*/
|
|
90
|
+
borderConfig?: {
|
|
91
|
+
/**
|
|
92
|
+
* Border width
|
|
93
|
+
*/
|
|
94
|
+
width?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Border color
|
|
97
|
+
*/
|
|
98
|
+
color?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Border radius
|
|
101
|
+
*/
|
|
102
|
+
radius?: number;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Animation configuration
|
|
107
|
+
*/
|
|
108
|
+
animationConfig?: {
|
|
109
|
+
/**
|
|
110
|
+
* Enable animations
|
|
111
|
+
*/
|
|
112
|
+
enabled?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Animation duration
|
|
115
|
+
*/
|
|
116
|
+
duration?: number;
|
|
117
|
+
/**
|
|
118
|
+
* Animation easing
|
|
119
|
+
*/
|
|
120
|
+
easing?: string;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Interaction handlers
|
|
125
|
+
*/
|
|
126
|
+
onNodeClick?: (node: TreemapNode) => void;
|
|
127
|
+
onNodeHover?: (node: TreemapNode | null) => void;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const TreemapChart = memo(
|
|
131
|
+
forwardRef<HTMLDivElement, TreemapChartProps>(
|
|
132
|
+
(
|
|
133
|
+
{
|
|
134
|
+
data = [],
|
|
135
|
+
algorithm = 'squarified',
|
|
136
|
+
colorConfig = { scheme: 'category' },
|
|
137
|
+
showLabels = true,
|
|
138
|
+
showValues = false,
|
|
139
|
+
labelConfig = {
|
|
140
|
+
minSize: 1000,
|
|
141
|
+
fontSize: 12,
|
|
142
|
+
color: 'white',
|
|
143
|
+
},
|
|
144
|
+
borderConfig = {
|
|
145
|
+
width: 1,
|
|
146
|
+
color: 'white',
|
|
147
|
+
radius: 2,
|
|
148
|
+
},
|
|
149
|
+
animationConfig = {
|
|
150
|
+
enabled: true,
|
|
151
|
+
duration: 750,
|
|
152
|
+
easing: 'ease-out',
|
|
153
|
+
},
|
|
154
|
+
onNodeClick,
|
|
155
|
+
onNodeHover,
|
|
156
|
+
config = {},
|
|
157
|
+
...props
|
|
158
|
+
},
|
|
159
|
+
ref
|
|
160
|
+
) => {
|
|
161
|
+
const [hoveredNode, setHoveredNode] = useState<TreemapNode | null>(null);
|
|
162
|
+
const [selectedNode, setSelectedNode] = useState<TreemapNode | null>(null);
|
|
163
|
+
const [tooltipPosition, setTooltipPosition] = useState({ x: 0, y: 0 });
|
|
164
|
+
|
|
165
|
+
// Build hierarchical tree structure
|
|
166
|
+
const treeData = useMemo(() => {
|
|
167
|
+
console.log('TreemapChart data:', data);
|
|
168
|
+
if (!data.length) {
|
|
169
|
+
console.log('No data provided to TreemapChart');
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Create a map for quick lookup
|
|
174
|
+
const nodeMap = new Map<string, TreemapDataPoint>();
|
|
175
|
+
data.forEach(item => nodeMap.set(item.id, item));
|
|
176
|
+
|
|
177
|
+
// Find root nodes (nodes without parents or with non-existent parents)
|
|
178
|
+
const rootNodes: TreemapDataPoint[] = [];
|
|
179
|
+
const processedNodes = new Set<string>();
|
|
180
|
+
|
|
181
|
+
const buildTree = (node: TreemapDataPoint): TreemapDataPoint => {
|
|
182
|
+
if (processedNodes.has(node.id)) {
|
|
183
|
+
return node;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
processedNodes.add(node.id);
|
|
187
|
+
|
|
188
|
+
// Find children
|
|
189
|
+
const children = data.filter(item => item.parent === node.id);
|
|
190
|
+
|
|
191
|
+
if (children.length > 0) {
|
|
192
|
+
node.children = children.map(child => buildTree(child));
|
|
193
|
+
// For parent nodes, value is sum of children
|
|
194
|
+
node.value = node.children.reduce((sum, child) => sum + child.value, 0);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return node;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// Find root nodes
|
|
201
|
+
data.forEach(item => {
|
|
202
|
+
if (!item.parent || !nodeMap.has(item.parent)) {
|
|
203
|
+
rootNodes.push(buildTree(item));
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
return rootNodes.length === 1
|
|
208
|
+
? rootNodes[0]
|
|
209
|
+
: {
|
|
210
|
+
id: 'root',
|
|
211
|
+
label: 'Root',
|
|
212
|
+
value: rootNodes.reduce((sum, node) => sum + node.value, 0),
|
|
213
|
+
children: rootNodes,
|
|
214
|
+
};
|
|
215
|
+
}, [data]);
|
|
216
|
+
|
|
217
|
+
// Generate colors
|
|
218
|
+
const generateColor = useCallback(
|
|
219
|
+
(node: TreemapDataPoint, depth: number, index: number) => {
|
|
220
|
+
if (node.color) return node.color;
|
|
221
|
+
|
|
222
|
+
const { scheme, palette, valueRange } = colorConfig;
|
|
223
|
+
|
|
224
|
+
const defaultPalette = [
|
|
225
|
+
'#3b82f6',
|
|
226
|
+
'#ef4444',
|
|
227
|
+
'#10b981',
|
|
228
|
+
'#f59e0b',
|
|
229
|
+
'#8b5cf6',
|
|
230
|
+
'#06b6d4',
|
|
231
|
+
'#84cc16',
|
|
232
|
+
'#f97316',
|
|
233
|
+
'#ec4899',
|
|
234
|
+
'#6366f1',
|
|
235
|
+
];
|
|
236
|
+
|
|
237
|
+
const colors = palette || defaultPalette;
|
|
238
|
+
|
|
239
|
+
switch (scheme) {
|
|
240
|
+
case 'category':
|
|
241
|
+
return colors[index % colors.length];
|
|
242
|
+
case 'depth':
|
|
243
|
+
const depthColors = ['#1e40af', '#3b82f6', '#60a5fa', '#93c5fd', '#dbeafe'];
|
|
244
|
+
return depthColors[Math.min(depth, depthColors.length - 1)];
|
|
245
|
+
case 'value':
|
|
246
|
+
if (valueRange && treeData) {
|
|
247
|
+
const maxValue = Math.max(...data.map(d => d.value));
|
|
248
|
+
const minValue = Math.min(...data.map(d => d.value));
|
|
249
|
+
const ratio = (node.value - minValue) / (maxValue - minValue);
|
|
250
|
+
// Simple interpolation between two colors
|
|
251
|
+
return `hsl(${220 + ratio * 100}, 70%, ${30 + ratio * 40}%)`;
|
|
252
|
+
}
|
|
253
|
+
return colors[0];
|
|
254
|
+
default:
|
|
255
|
+
return colors[index % colors.length];
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
[colorConfig, data, treeData]
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
// Squarified treemap algorithm
|
|
262
|
+
const squarify = useCallback(
|
|
263
|
+
(nodes: TreemapNode[], x: number, y: number, width: number, height: number) => {
|
|
264
|
+
if (nodes.length === 0) return;
|
|
265
|
+
|
|
266
|
+
const totalValue = nodes.reduce((sum, node) => sum + node.value, 0);
|
|
267
|
+
|
|
268
|
+
if (nodes.length === 1) {
|
|
269
|
+
const node = nodes[0];
|
|
270
|
+
if (node) {
|
|
271
|
+
node.x = x;
|
|
272
|
+
node.y = y;
|
|
273
|
+
node.width = width;
|
|
274
|
+
node.height = height;
|
|
275
|
+
}
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Sort nodes by value (descending)
|
|
280
|
+
const sortedNodes = [...nodes].sort((a, b) => b.value - a.value);
|
|
281
|
+
|
|
282
|
+
const aspectRatio = (rect: { width: number; height: number }) =>
|
|
283
|
+
Math.max(rect.width / rect.height, rect.height / rect.width);
|
|
284
|
+
|
|
285
|
+
let currentRow: TreemapNode[] = [];
|
|
286
|
+
let remainingNodes = [...sortedNodes];
|
|
287
|
+
let currentX = x;
|
|
288
|
+
let currentY = y;
|
|
289
|
+
let remainingWidth = width;
|
|
290
|
+
let remainingHeight = height;
|
|
291
|
+
|
|
292
|
+
while (remainingNodes.length > 0) {
|
|
293
|
+
const node = remainingNodes.shift();
|
|
294
|
+
if (!node) break;
|
|
295
|
+
currentRow.push(node);
|
|
296
|
+
|
|
297
|
+
// Calculate dimensions for current row
|
|
298
|
+
const rowValue = currentRow.reduce((sum, n) => sum + n.value, 0);
|
|
299
|
+
const rowRatio = rowValue / totalValue;
|
|
300
|
+
|
|
301
|
+
let rowWidth, rowHeight;
|
|
302
|
+
if (remainingWidth >= remainingHeight) {
|
|
303
|
+
rowWidth = remainingWidth * rowRatio;
|
|
304
|
+
rowHeight = remainingHeight;
|
|
305
|
+
} else {
|
|
306
|
+
rowWidth = remainingWidth;
|
|
307
|
+
rowHeight = remainingHeight * rowRatio;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Check if adding next node improves aspect ratio
|
|
311
|
+
let shouldContinueRow = false;
|
|
312
|
+
if (remainingNodes.length > 0) {
|
|
313
|
+
const nextNode = remainingNodes[0];
|
|
314
|
+
if (!nextNode) break;
|
|
315
|
+
const testRow = [...currentRow, nextNode];
|
|
316
|
+
const testRowValue = testRow.reduce((sum, n) => sum + n.value, 0);
|
|
317
|
+
const testRowRatio = testRowValue / totalValue;
|
|
318
|
+
|
|
319
|
+
let testRowWidth, testRowHeight;
|
|
320
|
+
if (remainingWidth >= remainingHeight) {
|
|
321
|
+
testRowWidth = remainingWidth * testRowRatio;
|
|
322
|
+
testRowHeight = remainingHeight;
|
|
323
|
+
} else {
|
|
324
|
+
testRowWidth = remainingWidth;
|
|
325
|
+
testRowHeight = remainingHeight * testRowRatio;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const currentWorstAspect = Math.max(
|
|
329
|
+
...currentRow
|
|
330
|
+
.filter(n => n)
|
|
331
|
+
.map(n => {
|
|
332
|
+
const nodeRatio = n.value / rowValue;
|
|
333
|
+
const nodeWidth =
|
|
334
|
+
remainingWidth >= remainingHeight ? rowWidth : rowWidth * nodeRatio;
|
|
335
|
+
const nodeHeight =
|
|
336
|
+
remainingWidth >= remainingHeight ? rowHeight * nodeRatio : rowHeight;
|
|
337
|
+
return aspectRatio({ width: nodeWidth, height: nodeHeight });
|
|
338
|
+
})
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
const testWorstAspect = Math.max(
|
|
342
|
+
...testRow
|
|
343
|
+
.filter(n => n)
|
|
344
|
+
.map(n => {
|
|
345
|
+
const nodeRatio = n.value / testRowValue;
|
|
346
|
+
const nodeWidth =
|
|
347
|
+
remainingWidth >= remainingHeight ? testRowWidth : testRowWidth * nodeRatio;
|
|
348
|
+
const nodeHeight =
|
|
349
|
+
remainingWidth >= remainingHeight ? testRowHeight * nodeRatio : testRowHeight;
|
|
350
|
+
return aspectRatio({ width: nodeWidth, height: nodeHeight });
|
|
351
|
+
})
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
shouldContinueRow = testWorstAspect <= currentWorstAspect;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (!shouldContinueRow) {
|
|
358
|
+
// Layout current row
|
|
359
|
+
let nodeX = currentX;
|
|
360
|
+
let nodeY = currentY;
|
|
361
|
+
|
|
362
|
+
currentRow.forEach(rowNode => {
|
|
363
|
+
const nodeRatio = rowNode.value / rowValue;
|
|
364
|
+
|
|
365
|
+
if (remainingWidth >= remainingHeight) {
|
|
366
|
+
rowNode.x = nodeX;
|
|
367
|
+
rowNode.y = nodeY;
|
|
368
|
+
rowNode.width = rowWidth;
|
|
369
|
+
rowNode.height = remainingHeight * nodeRatio;
|
|
370
|
+
nodeY += rowNode.height;
|
|
371
|
+
} else {
|
|
372
|
+
rowNode.x = nodeX;
|
|
373
|
+
rowNode.y = nodeY;
|
|
374
|
+
rowNode.width = remainingWidth * nodeRatio;
|
|
375
|
+
rowNode.height = rowHeight;
|
|
376
|
+
nodeX += rowNode.width;
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// Update remaining space
|
|
381
|
+
if (remainingWidth >= remainingHeight) {
|
|
382
|
+
currentX += rowWidth;
|
|
383
|
+
remainingWidth -= rowWidth;
|
|
384
|
+
} else {
|
|
385
|
+
currentY += rowHeight;
|
|
386
|
+
remainingHeight -= rowHeight;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
currentRow = [];
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
[]
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
// Build treemap layout
|
|
397
|
+
const treemapNodes = useMemo(() => {
|
|
398
|
+
if (!data.length) return [];
|
|
399
|
+
|
|
400
|
+
// Simple flat layout for leaf nodes only
|
|
401
|
+
const leafNodes = data.filter(item => !item.children || item.children.length === 0);
|
|
402
|
+
const totalValue = leafNodes.reduce((sum, node) => sum + node.value, 0);
|
|
403
|
+
|
|
404
|
+
let currentX = 0;
|
|
405
|
+
let currentY = 0;
|
|
406
|
+
const nodeWidth = 800 / Math.ceil(Math.sqrt(leafNodes.length));
|
|
407
|
+
const nodeHeight = 600 / Math.ceil(Math.sqrt(leafNodes.length));
|
|
408
|
+
|
|
409
|
+
return leafNodes.map((item, index) => {
|
|
410
|
+
const node: TreemapNode = {
|
|
411
|
+
id: item.id,
|
|
412
|
+
label: item.label,
|
|
413
|
+
value: item.value,
|
|
414
|
+
color: generateColor(item, 0, index) || 'transparent',
|
|
415
|
+
x: currentX,
|
|
416
|
+
y: currentY,
|
|
417
|
+
width: nodeWidth,
|
|
418
|
+
height: nodeHeight,
|
|
419
|
+
depth: 0,
|
|
420
|
+
children: [],
|
|
421
|
+
originalData: item,
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
currentX += nodeWidth;
|
|
425
|
+
if (currentX >= 800) {
|
|
426
|
+
currentX = 0;
|
|
427
|
+
currentY += nodeHeight;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
return node;
|
|
431
|
+
});
|
|
432
|
+
}, [data, generateColor]);
|
|
433
|
+
|
|
434
|
+
// Handle node interactions
|
|
435
|
+
const handleNodeClick = useCallback(
|
|
436
|
+
(node: TreemapNode) => {
|
|
437
|
+
setSelectedNode(node);
|
|
438
|
+
onNodeClick?.(node);
|
|
439
|
+
},
|
|
440
|
+
[onNodeClick]
|
|
441
|
+
);
|
|
442
|
+
|
|
443
|
+
const handleNodeHover = useCallback(
|
|
444
|
+
(node: TreemapNode | null, event?: React.MouseEvent) => {
|
|
445
|
+
setHoveredNode(node);
|
|
446
|
+
onNodeHover?.(node);
|
|
447
|
+
|
|
448
|
+
if (event && node) {
|
|
449
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
450
|
+
setTooltipPosition({
|
|
451
|
+
x: event.clientX,
|
|
452
|
+
y: event.clientY,
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
[onNodeHover]
|
|
457
|
+
);
|
|
458
|
+
|
|
459
|
+
// Render treemap content
|
|
460
|
+
const renderContent = useCallback(() => {
|
|
461
|
+
if (!treemapNodes.length) return null;
|
|
462
|
+
|
|
463
|
+
return (
|
|
464
|
+
<g>
|
|
465
|
+
{treemapNodes.map(node => {
|
|
466
|
+
const isHovered = hoveredNode === node;
|
|
467
|
+
const isSelected = selectedNode === node;
|
|
468
|
+
const area = node.width * node.height;
|
|
469
|
+
const showLabel = showLabels && area >= (labelConfig.minSize || 1000);
|
|
470
|
+
|
|
471
|
+
return (
|
|
472
|
+
<g key={node.id}>
|
|
473
|
+
{/* Node rectangle */}
|
|
474
|
+
<rect
|
|
475
|
+
x={node.x}
|
|
476
|
+
y={node.y}
|
|
477
|
+
width={node.width}
|
|
478
|
+
height={node.height}
|
|
479
|
+
fill={node.color}
|
|
480
|
+
rx={borderConfig.radius || 2}
|
|
481
|
+
className={`c-chart__treemap-node ${isHovered ? 'c-chart__treemap-node--hovered' : ''} ${isSelected ? 'c-chart__treemap-node--selected' : ''} ${animationConfig.enabled ? 'c-chart__treemap-node--animated' : ''}`}
|
|
482
|
+
onMouseEnter={e => handleNodeHover(node, e)}
|
|
483
|
+
onMouseLeave={() => handleNodeHover(null)}
|
|
484
|
+
onClick={() => handleNodeClick(node)}
|
|
485
|
+
/>
|
|
486
|
+
|
|
487
|
+
{/* Node label */}
|
|
488
|
+
{showLabel && (
|
|
489
|
+
<g>
|
|
490
|
+
<text
|
|
491
|
+
x={node.x + node.width / 2}
|
|
492
|
+
y={node.y + node.height / 2 - (showValues ? 8 : 0)}
|
|
493
|
+
textAnchor="middle"
|
|
494
|
+
dominantBaseline="middle"
|
|
495
|
+
className="c-chart__treemap-label"
|
|
496
|
+
>
|
|
497
|
+
{node.label}
|
|
498
|
+
</text>
|
|
499
|
+
|
|
500
|
+
{showValues && (
|
|
501
|
+
<text
|
|
502
|
+
x={node.x + node.width / 2}
|
|
503
|
+
y={node.y + node.height / 2 + 12}
|
|
504
|
+
textAnchor="middle"
|
|
505
|
+
dominantBaseline="middle"
|
|
506
|
+
className="c-chart__treemap-value"
|
|
507
|
+
>
|
|
508
|
+
{node.value.toLocaleString()}
|
|
509
|
+
</text>
|
|
510
|
+
)}
|
|
511
|
+
</g>
|
|
512
|
+
)}
|
|
513
|
+
</g>
|
|
514
|
+
);
|
|
515
|
+
})}
|
|
516
|
+
</g>
|
|
517
|
+
);
|
|
518
|
+
}, [
|
|
519
|
+
treemapNodes,
|
|
520
|
+
hoveredNode,
|
|
521
|
+
selectedNode,
|
|
522
|
+
showLabels,
|
|
523
|
+
showValues,
|
|
524
|
+
labelConfig,
|
|
525
|
+
borderConfig,
|
|
526
|
+
animationConfig,
|
|
527
|
+
handleNodeHover,
|
|
528
|
+
handleNodeClick,
|
|
529
|
+
]);
|
|
530
|
+
|
|
531
|
+
return (
|
|
532
|
+
<Chart ref={ref} type="treemap" datasets={[]} config={config} {...props}>
|
|
533
|
+
<svg
|
|
534
|
+
width={800}
|
|
535
|
+
height={600}
|
|
536
|
+
viewBox="0 0 800 600"
|
|
537
|
+
style={{ width: '100%', height: '100%' }}
|
|
538
|
+
>
|
|
539
|
+
{renderContent()}
|
|
540
|
+
</svg>
|
|
541
|
+
|
|
542
|
+
{hoveredNode && (
|
|
543
|
+
<div
|
|
544
|
+
className="c-chart__tooltip"
|
|
545
|
+
style={{
|
|
546
|
+
position: 'fixed',
|
|
547
|
+
left: tooltipPosition.x + 10,
|
|
548
|
+
top: tooltipPosition.y - 10,
|
|
549
|
+
transform: 'translateY(-100%)',
|
|
550
|
+
background: 'var(--atomix-gray-9)',
|
|
551
|
+
color: 'white',
|
|
552
|
+
padding: '8px 12px',
|
|
553
|
+
borderRadius: '6px',
|
|
554
|
+
fontSize: '12px',
|
|
555
|
+
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.2)',
|
|
556
|
+
zIndex: 1000,
|
|
557
|
+
pointerEvents: 'none',
|
|
558
|
+
}}
|
|
559
|
+
>
|
|
560
|
+
<div>
|
|
561
|
+
<strong>{hoveredNode?.label}</strong>
|
|
562
|
+
</div>
|
|
563
|
+
<div>Value: {hoveredNode?.value.toLocaleString()}</div>
|
|
564
|
+
</div>
|
|
565
|
+
)}
|
|
566
|
+
</Chart>
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
)
|
|
570
|
+
);
|
|
571
|
+
|
|
572
|
+
TreemapChart.displayName = 'TreemapChart';
|
|
573
|
+
export default TreemapChart;
|
|
574
|
+
export type { TreemapChartProps, TreemapDataPoint, TreemapNode };
|