@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,436 @@
|
|
|
1
|
+
import { forwardRef, memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { ChartProps } from '../../lib/types/components';
|
|
3
|
+
import Chart from './Chart';
|
|
4
|
+
import ChartRenderer from './ChartRenderer';
|
|
5
|
+
|
|
6
|
+
interface RealTimeChartProps extends Omit<ChartProps, 'type'> {
|
|
7
|
+
/**
|
|
8
|
+
* Data stream configuration
|
|
9
|
+
*/
|
|
10
|
+
streamConfig?: {
|
|
11
|
+
/**
|
|
12
|
+
* Update interval in milliseconds
|
|
13
|
+
*/
|
|
14
|
+
interval: number;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum number of data points to keep
|
|
17
|
+
*/
|
|
18
|
+
maxDataPoints: number;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to auto-scroll to latest data
|
|
21
|
+
*/
|
|
22
|
+
autoScroll: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Buffer size for smooth updates
|
|
25
|
+
*/
|
|
26
|
+
bufferSize?: number;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Data source function that returns new data points
|
|
31
|
+
*/
|
|
32
|
+
dataSource?: () => Promise<{ label: string; value: number; timestamp?: number }[]>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* WebSocket URL for real-time data
|
|
36
|
+
*/
|
|
37
|
+
websocketUrl?: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Callback when new data arrives
|
|
41
|
+
*/
|
|
42
|
+
onDataUpdate?: (newData: any[]) => void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Performance monitoring
|
|
46
|
+
*/
|
|
47
|
+
enablePerformanceMonitoring?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const RealTimeChart = memo(
|
|
51
|
+
forwardRef<HTMLDivElement, RealTimeChartProps>(
|
|
52
|
+
(
|
|
53
|
+
{
|
|
54
|
+
datasets = [],
|
|
55
|
+
config = {},
|
|
56
|
+
streamConfig = {
|
|
57
|
+
interval: 1000,
|
|
58
|
+
maxDataPoints: 100,
|
|
59
|
+
autoScroll: true,
|
|
60
|
+
bufferSize: 10,
|
|
61
|
+
},
|
|
62
|
+
dataSource,
|
|
63
|
+
websocketUrl,
|
|
64
|
+
onDataUpdate,
|
|
65
|
+
enablePerformanceMonitoring = false,
|
|
66
|
+
...props
|
|
67
|
+
},
|
|
68
|
+
ref
|
|
69
|
+
) => {
|
|
70
|
+
const [realTimeData, setRealTimeData] = useState(datasets);
|
|
71
|
+
const [isStreaming, setIsStreaming] = useState(false);
|
|
72
|
+
const [performanceMetrics, setPerformanceMetrics] = useState({
|
|
73
|
+
fps: 0,
|
|
74
|
+
updateTime: 0,
|
|
75
|
+
dataPoints: 0,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
|
79
|
+
const websocketRef = useRef<WebSocket | null>(null);
|
|
80
|
+
const frameCountRef = useRef(0);
|
|
81
|
+
const lastFrameTimeRef = useRef(Date.now());
|
|
82
|
+
const dataBufferRef = useRef<any[]>([]);
|
|
83
|
+
|
|
84
|
+
// Performance monitoring
|
|
85
|
+
const updatePerformanceMetrics = useCallback(() => {
|
|
86
|
+
if (!enablePerformanceMonitoring) return;
|
|
87
|
+
|
|
88
|
+
const now = Date.now();
|
|
89
|
+
const deltaTime = now - lastFrameTimeRef.current;
|
|
90
|
+
|
|
91
|
+
if (deltaTime >= 1000) {
|
|
92
|
+
const fps = Math.round((frameCountRef.current * 1000) / deltaTime);
|
|
93
|
+
setPerformanceMetrics(prev => ({
|
|
94
|
+
...prev,
|
|
95
|
+
fps,
|
|
96
|
+
dataPoints: realTimeData.reduce((sum, dataset) => sum + (dataset.data?.length || 0), 0),
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
frameCountRef.current = 0;
|
|
100
|
+
lastFrameTimeRef.current = now;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
frameCountRef.current++;
|
|
104
|
+
}, [enablePerformanceMonitoring, realTimeData]);
|
|
105
|
+
|
|
106
|
+
// Data buffer management for smooth updates
|
|
107
|
+
const processDataBuffer = useCallback(() => {
|
|
108
|
+
if (dataBufferRef.current.length === 0) return;
|
|
109
|
+
|
|
110
|
+
const startTime = performance.now();
|
|
111
|
+
|
|
112
|
+
setRealTimeData(prevData => {
|
|
113
|
+
const newData = [...prevData];
|
|
114
|
+
|
|
115
|
+
// Process buffered data points
|
|
116
|
+
dataBufferRef.current.forEach(newPoints => {
|
|
117
|
+
newPoints.forEach((point: any, datasetIndex: number) => {
|
|
118
|
+
if (!newData[datasetIndex]) {
|
|
119
|
+
newData[datasetIndex] = {
|
|
120
|
+
label: `Dataset ${datasetIndex + 1}`,
|
|
121
|
+
data: [],
|
|
122
|
+
color: `hsl(${datasetIndex * 60}, 70%, 50%)`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const dataset = newData[datasetIndex];
|
|
127
|
+
const currentData = dataset.data || [];
|
|
128
|
+
|
|
129
|
+
// Add new point with timestamp
|
|
130
|
+
const newPoint = {
|
|
131
|
+
...point,
|
|
132
|
+
timestamp: point.timestamp || Date.now(),
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
currentData.push(newPoint);
|
|
136
|
+
|
|
137
|
+
// Maintain max data points
|
|
138
|
+
if (currentData.length > streamConfig.maxDataPoints) {
|
|
139
|
+
currentData.splice(0, currentData.length - streamConfig.maxDataPoints);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
dataset.data = currentData;
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
return newData;
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Clear buffer
|
|
150
|
+
dataBufferRef.current = [];
|
|
151
|
+
|
|
152
|
+
const endTime = performance.now();
|
|
153
|
+
setPerformanceMetrics(prev => ({
|
|
154
|
+
...prev,
|
|
155
|
+
updateTime: endTime - startTime,
|
|
156
|
+
}));
|
|
157
|
+
|
|
158
|
+
onDataUpdate?.(realTimeData);
|
|
159
|
+
updatePerformanceMetrics();
|
|
160
|
+
}, [streamConfig.maxDataPoints, onDataUpdate, realTimeData, updatePerformanceMetrics]);
|
|
161
|
+
|
|
162
|
+
// WebSocket connection
|
|
163
|
+
const connectWebSocket = useCallback(() => {
|
|
164
|
+
if (!websocketUrl) return;
|
|
165
|
+
|
|
166
|
+
try {
|
|
167
|
+
websocketRef.current = new WebSocket(websocketUrl);
|
|
168
|
+
|
|
169
|
+
websocketRef.current.onopen = () => {
|
|
170
|
+
setIsStreaming(true);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
websocketRef.current.onmessage = event => {
|
|
174
|
+
try {
|
|
175
|
+
const data = JSON.parse(event.data);
|
|
176
|
+
dataBufferRef.current.push(Array.isArray(data) ? data : [data]);
|
|
177
|
+
} catch (error) {
|
|
178
|
+
console.error('Error parsing WebSocket data:', error);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
websocketRef.current.onclose = () => {
|
|
183
|
+
setIsStreaming(false);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
websocketRef.current.onerror = error => {
|
|
187
|
+
console.error('WebSocket error:', error);
|
|
188
|
+
setIsStreaming(false);
|
|
189
|
+
};
|
|
190
|
+
} catch (error) {
|
|
191
|
+
console.error('Error connecting to WebSocket:', error);
|
|
192
|
+
}
|
|
193
|
+
}, [websocketUrl]);
|
|
194
|
+
|
|
195
|
+
// Polling data source
|
|
196
|
+
const startPolling = useCallback(() => {
|
|
197
|
+
if (!dataSource) return;
|
|
198
|
+
|
|
199
|
+
intervalRef.current = setInterval(async () => {
|
|
200
|
+
try {
|
|
201
|
+
const newData = await dataSource();
|
|
202
|
+
if (newData && newData.length > 0) {
|
|
203
|
+
dataBufferRef.current.push(newData);
|
|
204
|
+
}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.error('Error fetching data:', error);
|
|
207
|
+
}
|
|
208
|
+
}, streamConfig.interval);
|
|
209
|
+
|
|
210
|
+
setIsStreaming(true);
|
|
211
|
+
}, [dataSource, streamConfig.interval]);
|
|
212
|
+
|
|
213
|
+
// Start streaming
|
|
214
|
+
const startStreaming = useCallback(() => {
|
|
215
|
+
if (websocketUrl) {
|
|
216
|
+
connectWebSocket();
|
|
217
|
+
} else if (dataSource) {
|
|
218
|
+
startPolling();
|
|
219
|
+
}
|
|
220
|
+
}, [websocketUrl, dataSource, connectWebSocket, startPolling]);
|
|
221
|
+
|
|
222
|
+
// Stop streaming
|
|
223
|
+
const stopStreaming = useCallback(() => {
|
|
224
|
+
setIsStreaming(false);
|
|
225
|
+
|
|
226
|
+
if (intervalRef.current) {
|
|
227
|
+
clearInterval(intervalRef.current);
|
|
228
|
+
intervalRef.current = null;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (websocketRef.current) {
|
|
232
|
+
websocketRef.current.close();
|
|
233
|
+
websocketRef.current = null;
|
|
234
|
+
}
|
|
235
|
+
}, []);
|
|
236
|
+
|
|
237
|
+
// Process buffer at regular intervals
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
const bufferInterval = setInterval(processDataBuffer, streamConfig.interval / 4);
|
|
240
|
+
return () => clearInterval(bufferInterval);
|
|
241
|
+
}, [processDataBuffer, streamConfig.interval]);
|
|
242
|
+
|
|
243
|
+
// Auto-start streaming
|
|
244
|
+
useEffect(() => {
|
|
245
|
+
if (dataSource || websocketUrl) {
|
|
246
|
+
startStreaming();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return () => {
|
|
250
|
+
stopStreaming();
|
|
251
|
+
};
|
|
252
|
+
}, [dataSource, websocketUrl, startStreaming, stopStreaming]);
|
|
253
|
+
|
|
254
|
+
// Render content with real-time optimizations
|
|
255
|
+
const renderContent = useCallback(
|
|
256
|
+
({
|
|
257
|
+
scales,
|
|
258
|
+
colors,
|
|
259
|
+
datasets: renderedDatasets,
|
|
260
|
+
handlers,
|
|
261
|
+
}: {
|
|
262
|
+
scales: any;
|
|
263
|
+
colors: any;
|
|
264
|
+
datasets: any;
|
|
265
|
+
handlers: any;
|
|
266
|
+
}) => {
|
|
267
|
+
if (!renderedDatasets.length) return null;
|
|
268
|
+
|
|
269
|
+
return renderedDatasets.map((dataset: any, datasetIndex: number) => {
|
|
270
|
+
const color = dataset.color || colors[datasetIndex];
|
|
271
|
+
const points =
|
|
272
|
+
dataset.data?.map((point: any, i: number) => ({
|
|
273
|
+
x: scales.xScale(i, dataset.data?.length),
|
|
274
|
+
y: scales.yScale(point.value),
|
|
275
|
+
timestamp: point.timestamp,
|
|
276
|
+
})) || [];
|
|
277
|
+
|
|
278
|
+
// Generate path with performance optimization
|
|
279
|
+
const path =
|
|
280
|
+
points.length > 1 ? `M ${points.map((p: any) => `${p.x},${p.y}`).join(' L ')}` : '';
|
|
281
|
+
|
|
282
|
+
return (
|
|
283
|
+
<g key={`realtime-dataset-${datasetIndex}`}>
|
|
284
|
+
{/* Animated line with gradient */}
|
|
285
|
+
<defs>
|
|
286
|
+
<linearGradient id={`gradient-${datasetIndex}`} x1="0%" y1="0%" x2="100%" y2="0%">
|
|
287
|
+
<stop offset="0%" stopColor={color} stopOpacity="0.1" />
|
|
288
|
+
<stop offset="100%" stopColor={color} stopOpacity="0.8" />
|
|
289
|
+
</linearGradient>
|
|
290
|
+
</defs>
|
|
291
|
+
|
|
292
|
+
{/* Main line */}
|
|
293
|
+
<path
|
|
294
|
+
d={path}
|
|
295
|
+
stroke={`url(#gradient-${datasetIndex})`}
|
|
296
|
+
fill="none"
|
|
297
|
+
strokeWidth="2"
|
|
298
|
+
strokeLinecap="round"
|
|
299
|
+
strokeLinejoin="round"
|
|
300
|
+
/>
|
|
301
|
+
|
|
302
|
+
{/* Data points with pulse animation for latest */}
|
|
303
|
+
{dataset.data?.map((point: any, i: number) => {
|
|
304
|
+
const x = scales.xScale(i, dataset.data?.length);
|
|
305
|
+
const y = scales.yScale(point.value);
|
|
306
|
+
const isLatest = i === (dataset.data?.length || 0) - 1;
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<g key={`point-${i}`}>
|
|
310
|
+
{isLatest && (
|
|
311
|
+
<circle cx={x} cy={y} r="8" fill={color} opacity="0.3">
|
|
312
|
+
<animate
|
|
313
|
+
attributeName="r"
|
|
314
|
+
values="4;12;4"
|
|
315
|
+
dur="2s"
|
|
316
|
+
repeatCount="indefinite"
|
|
317
|
+
/>
|
|
318
|
+
<animate
|
|
319
|
+
attributeName="opacity"
|
|
320
|
+
values="0.8;0.1;0.8"
|
|
321
|
+
dur="2s"
|
|
322
|
+
repeatCount="indefinite"
|
|
323
|
+
/>
|
|
324
|
+
</circle>
|
|
325
|
+
)}
|
|
326
|
+
<circle
|
|
327
|
+
cx={x}
|
|
328
|
+
cy={y}
|
|
329
|
+
r="3"
|
|
330
|
+
fill={color}
|
|
331
|
+
stroke="white"
|
|
332
|
+
strokeWidth="1"
|
|
333
|
+
onClick={() => handlers.onDataPointClick?.(point, datasetIndex, i)}
|
|
334
|
+
style={{ cursor: 'pointer' }}
|
|
335
|
+
/>
|
|
336
|
+
</g>
|
|
337
|
+
);
|
|
338
|
+
})}
|
|
339
|
+
</g>
|
|
340
|
+
);
|
|
341
|
+
});
|
|
342
|
+
},
|
|
343
|
+
[]
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
return (
|
|
347
|
+
<Chart
|
|
348
|
+
ref={ref}
|
|
349
|
+
type="line"
|
|
350
|
+
datasets={realTimeData}
|
|
351
|
+
config={config}
|
|
352
|
+
title={`Real-time Chart ${isStreaming ? '🔴 LIVE' : '⏸️ PAUSED'}`}
|
|
353
|
+
showToolbar
|
|
354
|
+
enableRefresh
|
|
355
|
+
onRefresh={startStreaming}
|
|
356
|
+
{...props}
|
|
357
|
+
>
|
|
358
|
+
<ChartRenderer
|
|
359
|
+
datasets={realTimeData}
|
|
360
|
+
config={config}
|
|
361
|
+
renderContent={renderContent}
|
|
362
|
+
enableRealTime
|
|
363
|
+
enablePerformanceOptimization
|
|
364
|
+
/>
|
|
365
|
+
|
|
366
|
+
{/* Performance overlay */}
|
|
367
|
+
{enablePerformanceMonitoring && (
|
|
368
|
+
<div
|
|
369
|
+
style={{
|
|
370
|
+
position: 'absolute',
|
|
371
|
+
top: '10px',
|
|
372
|
+
right: '10px',
|
|
373
|
+
background: 'rgba(0, 0, 0, 0.8)',
|
|
374
|
+
color: 'white',
|
|
375
|
+
padding: '8px',
|
|
376
|
+
borderRadius: '4px',
|
|
377
|
+
fontSize: '12px',
|
|
378
|
+
fontFamily: 'monospace',
|
|
379
|
+
}}
|
|
380
|
+
>
|
|
381
|
+
<div>FPS: {performanceMetrics.fps}</div>
|
|
382
|
+
<div>Update: {performanceMetrics.updateTime.toFixed(2)}ms</div>
|
|
383
|
+
<div>Points: {performanceMetrics.dataPoints}</div>
|
|
384
|
+
<div>Status: {isStreaming ? 'STREAMING' : 'STOPPED'}</div>
|
|
385
|
+
</div>
|
|
386
|
+
)}
|
|
387
|
+
|
|
388
|
+
{/* Streaming controls */}
|
|
389
|
+
<div
|
|
390
|
+
style={{
|
|
391
|
+
position: 'absolute',
|
|
392
|
+
bottom: '10px',
|
|
393
|
+
left: '10px',
|
|
394
|
+
display: 'flex',
|
|
395
|
+
gap: '8px',
|
|
396
|
+
}}
|
|
397
|
+
>
|
|
398
|
+
<button
|
|
399
|
+
onClick={isStreaming ? stopStreaming : startStreaming}
|
|
400
|
+
style={{
|
|
401
|
+
padding: '6px 12px',
|
|
402
|
+
borderRadius: '4px',
|
|
403
|
+
border: 'none',
|
|
404
|
+
background: isStreaming ? '#ef4444' : '#10b981',
|
|
405
|
+
color: 'white',
|
|
406
|
+
cursor: 'pointer',
|
|
407
|
+
fontSize: '12px',
|
|
408
|
+
}}
|
|
409
|
+
>
|
|
410
|
+
{isStreaming ? 'Stop' : 'Start'}
|
|
411
|
+
</button>
|
|
412
|
+
|
|
413
|
+
<button
|
|
414
|
+
onClick={() => setRealTimeData([])}
|
|
415
|
+
style={{
|
|
416
|
+
padding: '6px 12px',
|
|
417
|
+
borderRadius: '4px',
|
|
418
|
+
border: 'none',
|
|
419
|
+
background: '#6b7280',
|
|
420
|
+
color: 'white',
|
|
421
|
+
cursor: 'pointer',
|
|
422
|
+
fontSize: '12px',
|
|
423
|
+
}}
|
|
424
|
+
>
|
|
425
|
+
Clear
|
|
426
|
+
</button>
|
|
427
|
+
</div>
|
|
428
|
+
</Chart>
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
)
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
RealTimeChart.displayName = 'RealTimeChart';
|
|
435
|
+
export default RealTimeChart;
|
|
436
|
+
export type { RealTimeChartProps };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { forwardRef, memo, ReactElement, useState } from 'react';
|
|
2
|
+
import Chart from './Chart';
|
|
3
|
+
import ChartRenderer from './ChartRenderer';
|
|
4
|
+
import ChartTooltip from './ChartTooltip';
|
|
5
|
+
import { ChartProps } from './types';
|
|
6
|
+
|
|
7
|
+
export interface ScatterDataPoint {
|
|
8
|
+
label: string;
|
|
9
|
+
value: number;
|
|
10
|
+
x?: number;
|
|
11
|
+
y?: number;
|
|
12
|
+
size?: number;
|
|
13
|
+
color?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ScatterChartProps extends Omit<ChartProps, 'type'> {
|
|
17
|
+
/**
|
|
18
|
+
* Scatter chart specific options
|
|
19
|
+
*/
|
|
20
|
+
scatterOptions?: {
|
|
21
|
+
/**
|
|
22
|
+
* Point radius
|
|
23
|
+
*/
|
|
24
|
+
pointRadius?: number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Whether to show point labels
|
|
28
|
+
*/
|
|
29
|
+
showLabels?: boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Enable hover effects
|
|
33
|
+
*/
|
|
34
|
+
enableHoverEffects?: boolean;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const ScatterChart = memo(
|
|
39
|
+
forwardRef<HTMLDivElement, ScatterChartProps>(
|
|
40
|
+
(
|
|
41
|
+
{
|
|
42
|
+
datasets = [],
|
|
43
|
+
config = {},
|
|
44
|
+
scatterOptions = {
|
|
45
|
+
pointRadius: 4,
|
|
46
|
+
showLabels: false,
|
|
47
|
+
enableHoverEffects: true,
|
|
48
|
+
},
|
|
49
|
+
onDataPointClick,
|
|
50
|
+
...props
|
|
51
|
+
},
|
|
52
|
+
ref
|
|
53
|
+
) => {
|
|
54
|
+
const [hoveredPoint, setHoveredPoint] = useState<{
|
|
55
|
+
datasetIndex: number;
|
|
56
|
+
pointIndex: number;
|
|
57
|
+
clientX: number;
|
|
58
|
+
clientY: number;
|
|
59
|
+
} | null>(null);
|
|
60
|
+
return (
|
|
61
|
+
<Chart ref={ref} type="scatter" datasets={datasets} config={config} {...props}>
|
|
62
|
+
<ChartRenderer
|
|
63
|
+
datasets={datasets}
|
|
64
|
+
config={config}
|
|
65
|
+
interactive={scatterOptions.enableHoverEffects}
|
|
66
|
+
renderContent={({ scales, colors, datasets: renderedDatasets }) => {
|
|
67
|
+
if (!renderedDatasets.length) return null;
|
|
68
|
+
|
|
69
|
+
const points: ReactElement[] = [];
|
|
70
|
+
|
|
71
|
+
renderedDatasets.forEach((dataset: any, datasetIndex: number) => {
|
|
72
|
+
const color = dataset.color || colors[datasetIndex % colors.length];
|
|
73
|
+
|
|
74
|
+
dataset.data?.forEach((point: any, pointIndex: number) => {
|
|
75
|
+
const x =
|
|
76
|
+
point.x !== undefined
|
|
77
|
+
? scales.padding.left + (point.x / 100) * scales.innerWidth
|
|
78
|
+
: scales.xScale(pointIndex, dataset.data?.length);
|
|
79
|
+
|
|
80
|
+
const y =
|
|
81
|
+
point.y !== undefined
|
|
82
|
+
? scales.padding.top +
|
|
83
|
+
scales.innerHeight -
|
|
84
|
+
(point.y / 100) * scales.innerHeight
|
|
85
|
+
: scales.yScale(point.value);
|
|
86
|
+
|
|
87
|
+
points.push(
|
|
88
|
+
<g key={`point-${datasetIndex}-${pointIndex}`}>
|
|
89
|
+
<circle
|
|
90
|
+
cx={x}
|
|
91
|
+
cy={y}
|
|
92
|
+
r={point.size || scatterOptions.pointRadius || 4}
|
|
93
|
+
fill={point.color || color}
|
|
94
|
+
className="c-chart__scatter-point"
|
|
95
|
+
onClick={() => onDataPointClick?.(point, datasetIndex, pointIndex)}
|
|
96
|
+
onMouseEnter={e => {
|
|
97
|
+
if (scatterOptions.enableHoverEffects) {
|
|
98
|
+
e.currentTarget.setAttribute(
|
|
99
|
+
'r',
|
|
100
|
+
String((point.size || scatterOptions.pointRadius || 4) * 1.5)
|
|
101
|
+
);
|
|
102
|
+
const rect = e.currentTarget.ownerSVGElement?.getBoundingClientRect();
|
|
103
|
+
const clientX = rect ? rect.left + x : e.clientX;
|
|
104
|
+
const clientY = rect ? rect.top + y : e.clientY;
|
|
105
|
+
setHoveredPoint({ datasetIndex, pointIndex, clientX, clientY });
|
|
106
|
+
}
|
|
107
|
+
}}
|
|
108
|
+
onMouseLeave={e => {
|
|
109
|
+
e.currentTarget.setAttribute(
|
|
110
|
+
'r',
|
|
111
|
+
String(point.size || scatterOptions.pointRadius || 4)
|
|
112
|
+
);
|
|
113
|
+
setHoveredPoint(null);
|
|
114
|
+
}}
|
|
115
|
+
/>
|
|
116
|
+
|
|
117
|
+
{scatterOptions.showLabels && (
|
|
118
|
+
<text
|
|
119
|
+
x={x}
|
|
120
|
+
y={y - (scatterOptions.pointRadius || 4) - 5}
|
|
121
|
+
textAnchor="middle"
|
|
122
|
+
className="c-chart__scatter-label"
|
|
123
|
+
>
|
|
124
|
+
{point.label}
|
|
125
|
+
</text>
|
|
126
|
+
)}
|
|
127
|
+
</g>
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
return <>{points}</>;
|
|
133
|
+
}}
|
|
134
|
+
/>
|
|
135
|
+
{hoveredPoint && datasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex] && (
|
|
136
|
+
<ChartTooltip
|
|
137
|
+
dataPoint={datasets[hoveredPoint.datasetIndex]!.data![hoveredPoint.pointIndex]!}
|
|
138
|
+
datasetLabel={datasets[hoveredPoint.datasetIndex]?.label}
|
|
139
|
+
datasetColor={datasets[hoveredPoint.datasetIndex]?.color}
|
|
140
|
+
position={{ x: hoveredPoint.clientX, y: hoveredPoint.clientY }}
|
|
141
|
+
visible={true}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
144
|
+
</Chart>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
ScatterChart.displayName = 'ScatterChart';
|
|
151
|
+
export default ScatterChart;
|
|
152
|
+
export type { ScatterChartProps };
|