@synertech/ui 0.44.0 → 0.45.0
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/.claude/skills/use-synertech-ui/SKILL.md +75 -4
- package/README.md +36 -8
- package/dist/components/accordion/Accordion.cjs +1 -0
- package/dist/components/accordion/Accordion.js +1 -0
- package/dist/components/accordion/index.cjs +1 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/advance-detachable/AdvanceDetachable.cjs +1 -0
- package/dist/components/advance-detachable/AdvanceDetachable.js +1 -0
- package/dist/components/advance-detachable/index.cjs +1 -0
- package/dist/components/advance-detachable/index.js +1 -0
- package/dist/components/area-chart/AreaChart.cjs +1 -0
- package/dist/components/area-chart/AreaChart.js +1 -0
- package/dist/components/area-chart/index.cjs +1 -0
- package/dist/components/area-chart/index.js +1 -0
- package/dist/components/avatar/Avatar.cjs +1 -0
- package/dist/components/avatar/Avatar.js +1 -0
- package/dist/components/avatar/index.cjs +1 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/badge/Badge.cjs +1 -0
- package/dist/components/badge/Badge.js +1 -0
- package/dist/components/badge/index.cjs +1 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/banner/Banner.cjs +1 -0
- package/dist/components/banner/Banner.js +1 -0
- package/dist/components/banner/index.cjs +1 -0
- package/dist/components/banner/index.js +1 -0
- package/dist/components/bar-chart/BarChart.cjs +1 -0
- package/dist/components/bar-chart/BarChart.js +1 -0
- package/dist/components/bar-chart/index.cjs +1 -0
- package/dist/components/bar-chart/index.js +1 -0
- package/dist/components/box-plot/BoxPlot.cjs +1 -0
- package/dist/components/box-plot/BoxPlot.js +1 -0
- package/dist/components/box-plot/index.cjs +1 -0
- package/dist/components/box-plot/index.js +1 -0
- package/dist/components/breadcrumb/Breadcrumb.cjs +1 -0
- package/dist/components/breadcrumb/Breadcrumb.js +1 -0
- package/dist/components/breadcrumb/index.cjs +1 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/bullet-chart/BulletChart.cjs +1 -0
- package/dist/components/bullet-chart/BulletChart.js +1 -0
- package/dist/components/bullet-chart/index.cjs +1 -0
- package/dist/components/bullet-chart/index.js +1 -0
- package/dist/components/button/Button.cjs +1 -0
- package/dist/components/button/Button.js +1 -0
- package/dist/components/button/index.cjs +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/button-group/ButtonGroup.cjs +1 -0
- package/dist/components/button-group/ButtonGroup.js +1 -0
- package/dist/components/button-group/index.cjs +1 -0
- package/dist/components/button-group/index.js +1 -0
- package/dist/components/calendar/Calendar.cjs +1 -0
- package/dist/components/calendar/Calendar.js +1 -0
- package/dist/components/calendar/index.cjs +1 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/candlestick-chart/CandlestickChart.cjs +1 -0
- package/dist/components/candlestick-chart/CandlestickChart.js +1 -0
- package/dist/components/candlestick-chart/index.cjs +1 -0
- package/dist/components/candlestick-chart/index.js +1 -0
- package/dist/components/card/Card.cjs +1 -0
- package/dist/components/card/Card.js +1 -0
- package/dist/components/card/CardBody.cjs +1 -0
- package/dist/components/card/CardBody.js +1 -0
- package/dist/components/card/CardDescription.cjs +1 -0
- package/dist/components/card/CardDescription.js +1 -0
- package/dist/components/card/CardFooter.cjs +1 -0
- package/dist/components/card/CardFooter.js +1 -0
- package/dist/components/card/CardHeader.cjs +1 -0
- package/dist/components/card/CardHeader.js +1 -0
- package/dist/components/card/CardImage.cjs +1 -0
- package/dist/components/card/CardImage.js +1 -0
- package/dist/components/card/CardTitle.cjs +1 -0
- package/dist/components/card/CardTitle.js +1 -0
- package/dist/components/card/index.cjs +1 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/chart/ChartAnnotations.cjs +1 -0
- package/dist/components/chart/ChartAnnotations.js +1 -0
- package/dist/components/chart/ChartAxis.cjs +1 -0
- package/dist/components/chart/ChartAxis.js +1 -0
- package/dist/components/chart/ChartBrush.cjs +1 -0
- package/dist/components/chart/ChartBrush.js +1 -0
- package/dist/components/chart/ChartContainer.cjs +1 -0
- package/dist/components/chart/ChartContainer.js +1 -0
- package/dist/components/chart/ChartExportButton.cjs +1 -0
- package/dist/components/chart/ChartExportButton.js +1 -0
- package/dist/components/chart/ChartFacets.cjs +1 -0
- package/dist/components/chart/ChartFacets.js +1 -0
- package/dist/components/chart/ChartFilterBar.cjs +1 -0
- package/dist/components/chart/ChartFilterBar.js +1 -0
- package/dist/components/chart/ChartGrid.cjs +1 -0
- package/dist/components/chart/ChartGrid.js +1 -0
- package/dist/components/chart/ChartLegend.cjs +1 -0
- package/dist/components/chart/ChartLegend.js +1 -0
- package/dist/components/chart/ChartPatterns.cjs +1 -0
- package/dist/components/chart/ChartPatterns.js +1 -0
- package/dist/components/chart/ChartPeriodPicker.cjs +1 -0
- package/dist/components/chart/ChartPeriodPicker.js +1 -0
- package/dist/components/chart/ChartScaleLegend.cjs +1 -0
- package/dist/components/chart/ChartScaleLegend.js +1 -0
- package/dist/components/chart/ChartSync.cjs +1 -0
- package/dist/components/chart/ChartSync.js +1 -0
- package/dist/components/chart/ChartTableView.cjs +1 -0
- package/dist/components/chart/ChartTableView.js +1 -0
- package/dist/components/chart/ChartTooltip.cjs +1 -0
- package/dist/components/chart/ChartTooltip.js +1 -0
- package/dist/components/chart/chart.types.cjs +1 -0
- package/dist/components/chart/chart.types.js +0 -0
- package/dist/components/chart/index.cjs +1 -0
- package/dist/components/chart/index.js +1 -0
- package/dist/components/chart/palette.cjs +1 -0
- package/dist/components/chart/palette.js +1 -0
- package/dist/components/chart/useChartSize.cjs +1 -0
- package/dist/components/chart/useChartSize.js +1 -0
- package/dist/components/chart/utils/bins.cjs +1 -0
- package/dist/components/chart/utils/bins.js +1 -0
- package/dist/components/chart/utils/cartesian.cjs +1 -0
- package/dist/components/chart/utils/cartesian.js +1 -0
- package/dist/components/chart/utils/data.cjs +1 -0
- package/dist/components/chart/utils/data.js +1 -0
- package/dist/components/chart/utils/decimate.cjs +1 -0
- package/dist/components/chart/utils/decimate.js +1 -0
- package/dist/components/chart/utils/export.cjs +2 -0
- package/dist/components/chart/utils/export.js +2 -0
- package/dist/components/chart/utils/format.cjs +1 -0
- package/dist/components/chart/utils/format.js +1 -0
- package/dist/components/chart/utils/path.cjs +1 -0
- package/dist/components/chart/utils/path.js +1 -0
- package/dist/components/chart/utils/period.cjs +1 -0
- package/dist/components/chart/utils/period.js +1 -0
- package/dist/components/chart/utils/quantile.cjs +1 -0
- package/dist/components/chart/utils/quantile.js +1 -0
- package/dist/components/chart/utils/scales.cjs +1 -0
- package/dist/components/chart/utils/scales.js +1 -0
- package/dist/components/chart/utils/stack.cjs +1 -0
- package/dist/components/chart/utils/stack.js +1 -0
- package/dist/components/chart/utils/text.cjs +1 -0
- package/dist/components/chart/utils/text.js +1 -0
- package/dist/components/chart/utils/ticks.cjs +1 -0
- package/dist/components/chart/utils/ticks.js +1 -0
- package/dist/components/chart/utils/time.cjs +1 -0
- package/dist/components/chart/utils/time.js +1 -0
- package/dist/components/checkbox/Checkbox.cjs +1 -0
- package/dist/components/checkbox/Checkbox.js +1 -0
- package/dist/components/checkbox/CheckboxGroup.cjs +1 -0
- package/dist/components/checkbox/CheckboxGroup.js +1 -0
- package/dist/components/checkbox/index.cjs +1 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/chip/Chip.cjs +1 -0
- package/dist/components/chip/Chip.js +1 -0
- package/dist/components/chip/index.cjs +1 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/circular-progress/CircularProgress.cjs +1 -0
- package/dist/components/circular-progress/CircularProgress.js +1 -0
- package/dist/components/circular-progress/index.cjs +1 -0
- package/dist/components/circular-progress/index.js +1 -0
- package/dist/components/datagrid/DataGrid.cjs +2 -0
- package/dist/components/datagrid/DataGrid.js +2 -0
- package/dist/components/datagrid/index.cjs +1 -0
- package/dist/components/datagrid/index.js +1 -0
- package/dist/components/detachable/Detachable.cjs +1 -0
- package/dist/components/detachable/Detachable.js +1 -0
- package/dist/components/detachable/index.cjs +1 -0
- package/dist/components/detachable/index.js +1 -0
- package/dist/components/device-mockup/DeviceMockup.cjs +1 -0
- package/dist/components/device-mockup/DeviceMockup.js +1 -0
- package/dist/components/device-mockup/index.cjs +1 -0
- package/dist/components/device-mockup/index.js +1 -0
- package/dist/components/divider/Divider.cjs +1 -0
- package/dist/components/divider/Divider.js +1 -0
- package/dist/components/divider/index.cjs +1 -0
- package/dist/components/divider/index.js +1 -0
- package/dist/components/drawer/Drawer.cjs +1 -0
- package/dist/components/drawer/Drawer.js +1 -0
- package/dist/components/drawer/index.cjs +1 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/dropdown/Dropdown.cjs +1 -0
- package/dist/components/dropdown/Dropdown.js +1 -0
- package/dist/components/dropdown/DropdownCheckboxItem.cjs +1 -0
- package/dist/components/dropdown/DropdownCheckboxItem.js +1 -0
- package/dist/components/dropdown/DropdownContent.cjs +1 -0
- package/dist/components/dropdown/DropdownContent.js +1 -0
- package/dist/components/dropdown/DropdownItem.cjs +1 -0
- package/dist/components/dropdown/DropdownItem.js +1 -0
- package/dist/components/dropdown/DropdownRadio.cjs +1 -0
- package/dist/components/dropdown/DropdownRadio.js +1 -0
- package/dist/components/dropdown/DropdownSeparator.cjs +1 -0
- package/dist/components/dropdown/DropdownSeparator.js +1 -0
- package/dist/components/dropdown/DropdownSubMenu.cjs +1 -0
- package/dist/components/dropdown/DropdownSubMenu.js +1 -0
- package/dist/components/dropdown/DropdownTrigger.cjs +1 -0
- package/dist/components/dropdown/DropdownTrigger.js +1 -0
- package/dist/components/dropdown/hooks/index.cjs +1 -0
- package/dist/components/dropdown/hooks/index.js +1 -0
- package/dist/components/dropdown/hooks/useClickOutside.cjs +1 -0
- package/dist/components/dropdown/hooks/useClickOutside.js +1 -0
- package/dist/components/dropdown/hooks/useKeyboardNavigation.cjs +1 -0
- package/dist/components/dropdown/hooks/useKeyboardNavigation.js +1 -0
- package/dist/components/dropdown/hooks/useLatest.cjs +1 -0
- package/dist/components/dropdown/hooks/useLatest.js +1 -0
- package/dist/components/dropdown/hooks/usePositioning.cjs +1 -0
- package/dist/components/dropdown/hooks/usePositioning.js +1 -0
- package/dist/components/dropdown/index.cjs +1 -0
- package/dist/components/dropdown/index.js +1 -0
- package/dist/components/dumbbell-chart/DumbbellChart.cjs +1 -0
- package/dist/components/dumbbell-chart/DumbbellChart.js +1 -0
- package/dist/components/dumbbell-chart/index.cjs +1 -0
- package/dist/components/dumbbell-chart/index.js +1 -0
- package/dist/components/file-selector/FileSelector.cjs +1 -0
- package/dist/components/file-selector/FileSelector.js +1 -0
- package/dist/components/file-selector/index.cjs +1 -0
- package/dist/components/file-selector/index.js +1 -0
- package/dist/components/footer/Footer.cjs +1 -0
- package/dist/components/footer/Footer.js +1 -0
- package/dist/components/footer/FooterBottom.cjs +1 -0
- package/dist/components/footer/FooterBottom.js +1 -0
- package/dist/components/footer/FooterColumn.cjs +1 -0
- package/dist/components/footer/FooterColumn.js +1 -0
- package/dist/components/footer/FooterLink.cjs +1 -0
- package/dist/components/footer/FooterLink.js +1 -0
- package/dist/components/footer/FooterSection.cjs +1 -0
- package/dist/components/footer/FooterSection.js +1 -0
- package/dist/components/footer/FooterSocial.cjs +1 -0
- package/dist/components/footer/FooterSocial.js +1 -0
- package/dist/components/footer/index.cjs +1 -0
- package/dist/components/footer/index.js +1 -0
- package/dist/components/form/index.cjs +1 -0
- package/dist/components/form/index.js +1 -0
- package/dist/components/form/input/Input.cjs +1 -0
- package/dist/components/form/input/Input.js +1 -0
- package/dist/components/form/input/index.cjs +1 -0
- package/dist/components/form/input/index.js +1 -0
- package/dist/components/form/mention-input/MentionInput.cjs +1 -0
- package/dist/components/form/mention-input/MentionInput.js +1 -0
- package/dist/components/form/mention-input/index.cjs +1 -0
- package/dist/components/form/mention-input/index.js +1 -0
- package/dist/components/form/number-input/NumberInput.cjs +1 -0
- package/dist/components/form/number-input/NumberInput.js +1 -0
- package/dist/components/form/number-input/index.cjs +1 -0
- package/dist/components/form/number-input/index.js +1 -0
- package/dist/components/form/shared/InputWrapper.cjs +1 -0
- package/dist/components/form/shared/InputWrapper.js +1 -0
- package/dist/components/form/shared/inputStyles.cjs +1 -0
- package/dist/components/form/shared/inputStyles.js +1 -0
- package/dist/components/form/types/mention.cjs +1 -0
- package/dist/components/form/types/mention.js +0 -0
- package/dist/components/funnel-chart/FunnelChart.cjs +1 -0
- package/dist/components/funnel-chart/FunnelChart.js +1 -0
- package/dist/components/funnel-chart/index.cjs +1 -0
- package/dist/components/funnel-chart/index.js +1 -0
- package/dist/components/gantt-chart/GanttChart.cjs +1 -0
- package/dist/components/gantt-chart/GanttChart.js +1 -0
- package/dist/components/gantt-chart/index.cjs +1 -0
- package/dist/components/gantt-chart/index.js +1 -0
- package/dist/components/header/Header.cjs +1 -0
- package/dist/components/header/Header.js +1 -0
- package/dist/components/header/index.cjs +1 -0
- package/dist/components/header/index.js +1 -0
- package/dist/components/heat-map/Heatmap.cjs +1 -0
- package/dist/components/heat-map/Heatmap.js +1 -0
- package/dist/components/heat-map/index.cjs +1 -0
- package/dist/components/heat-map/index.js +1 -0
- package/dist/components/help-button/HelpButton.cjs +22 -0
- package/dist/components/help-button/HelpButton.js +22 -0
- package/dist/components/help-button/MarkdownEditor.cjs +1 -0
- package/dist/components/help-button/MarkdownEditor.js +1 -0
- package/dist/components/help-button/index.cjs +1 -0
- package/dist/components/help-button/index.js +1 -0
- package/dist/components/help-button/types.cjs +1 -0
- package/dist/components/help-button/types.js +0 -0
- package/dist/components/image-uploader/ImageUploader.cjs +1 -0
- package/dist/components/image-uploader/ImageUploader.js +1 -0
- package/dist/components/image-uploader/index.cjs +1 -0
- package/dist/components/image-uploader/index.js +1 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/indicator/Indicator.cjs +1 -0
- package/dist/components/indicator/Indicator.js +1 -0
- package/dist/components/indicator/index.cjs +1 -0
- package/dist/components/indicator/index.js +1 -0
- package/dist/components/label/Label.cjs +1 -0
- package/dist/components/label/Label.js +1 -0
- package/dist/components/label/index.cjs +1 -0
- package/dist/components/label/index.js +1 -0
- package/dist/components/line-chart/LineChart.cjs +1 -0
- package/dist/components/line-chart/LineChart.js +1 -0
- package/dist/components/line-chart/index.cjs +1 -0
- package/dist/components/line-chart/index.js +1 -0
- package/dist/components/modal/Modal.cjs +1 -0
- package/dist/components/modal/Modal.js +1 -0
- package/dist/components/modal/index.cjs +1 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/pagination/Pagination.cjs +1 -0
- package/dist/components/pagination/Pagination.js +1 -0
- package/dist/components/pagination/index.cjs +1 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/pie-chart/PieChart.cjs +1 -0
- package/dist/components/pie-chart/PieChart.js +1 -0
- package/dist/components/pie-chart/index.cjs +1 -0
- package/dist/components/pie-chart/index.js +1 -0
- package/dist/components/progress-bar/ProgressBar.cjs +1 -0
- package/dist/components/progress-bar/ProgressBar.js +1 -0
- package/dist/components/progress-bar/index.cjs +1 -0
- package/dist/components/progress-bar/index.js +1 -0
- package/dist/components/radio-button/RadioButton.cjs +1 -0
- package/dist/components/radio-button/RadioButton.js +1 -0
- package/dist/components/radio-button/index.cjs +1 -0
- package/dist/components/radio-button/index.js +1 -0
- package/dist/components/scatter-chart/ScatterChart.cjs +1 -0
- package/dist/components/scatter-chart/ScatterChart.js +1 -0
- package/dist/components/scatter-chart/index.cjs +1 -0
- package/dist/components/scatter-chart/index.js +1 -0
- package/dist/components/schema-editor/SchemaEditor.cjs +1 -0
- package/dist/components/schema-editor/SchemaEditor.js +1 -0
- package/dist/components/schema-editor/SchemaEditor.types.cjs +1 -0
- package/dist/components/schema-editor/SchemaEditor.types.js +0 -0
- package/dist/components/schema-editor/canvas/GridLayer.cjs +1 -0
- package/dist/components/schema-editor/canvas/GridLayer.js +1 -0
- package/dist/components/schema-editor/index.cjs +1 -0
- package/dist/components/schema-editor/index.js +1 -0
- package/dist/components/schema-editor/legend/SchemaLegend.cjs +1 -0
- package/dist/components/schema-editor/legend/SchemaLegend.js +1 -0
- package/dist/components/schema-editor/minimap/SchemaMinimap.cjs +1 -0
- package/dist/components/schema-editor/minimap/SchemaMinimap.js +1 -0
- package/dist/components/schema-editor/relations/SchemaRelationRenderer.cjs +1 -0
- package/dist/components/schema-editor/relations/SchemaRelationRenderer.js +1 -0
- package/dist/components/schema-editor/tables/SchemaTableRenderer.cjs +1 -0
- package/dist/components/schema-editor/tables/SchemaTableRenderer.js +1 -0
- package/dist/components/schema-editor/toolbar/SchemaToolbar.cjs +1 -0
- package/dist/components/schema-editor/toolbar/SchemaToolbar.js +1 -0
- package/dist/components/schema-editor/utils/auto-layout.cjs +1 -0
- package/dist/components/schema-editor/utils/auto-layout.js +1 -0
- package/dist/components/schema-editor/utils/geometry.cjs +1 -0
- package/dist/components/schema-editor/utils/geometry.js +1 -0
- package/dist/components/schema-editor/utils/schema-helpers.cjs +1 -0
- package/dist/components/schema-editor/utils/schema-helpers.js +1 -0
- package/dist/components/schema-editor/utils/sql-export.cjs +9 -0
- package/dist/components/schema-editor/utils/sql-export.js +9 -0
- package/dist/components/select/Select.cjs +1 -0
- package/dist/components/select/Select.js +1 -0
- package/dist/components/select/index.cjs +1 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/sidebar/Sidebar.cjs +1 -0
- package/dist/components/sidebar/Sidebar.js +1 -0
- package/dist/components/sidebar/index.cjs +1 -0
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/skeleton/Skeleton.cjs +1 -0
- package/dist/components/skeleton/Skeleton.js +1 -0
- package/dist/components/skeleton/index.cjs +1 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/slider/Slider.cjs +1 -0
- package/dist/components/slider/Slider.js +1 -0
- package/dist/components/slider/index.cjs +1 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/sparkline/Sparkline.cjs +1 -0
- package/dist/components/sparkline/Sparkline.js +1 -0
- package/dist/components/sparkline/index.cjs +1 -0
- package/dist/components/sparkline/index.js +1 -0
- package/dist/components/stat-card/StatCard.cjs +1 -0
- package/dist/components/stat-card/StatCard.js +1 -0
- package/dist/components/stat-card/StatCardGroup.cjs +1 -0
- package/dist/components/stat-card/StatCardGroup.js +1 -0
- package/dist/components/stat-card/index.cjs +1 -0
- package/dist/components/stat-card/index.js +1 -0
- package/dist/components/table/Table.cjs +1 -0
- package/dist/components/table/Table.js +1 -0
- package/dist/components/table/TableBody.cjs +1 -0
- package/dist/components/table/TableBody.js +1 -0
- package/dist/components/table/TableCell.cjs +1 -0
- package/dist/components/table/TableCell.js +1 -0
- package/dist/components/table/TableHeader.cjs +1 -0
- package/dist/components/table/TableHeader.js +1 -0
- package/dist/components/table/TableHeaderCell.cjs +1 -0
- package/dist/components/table/TableHeaderCell.js +1 -0
- package/dist/components/table/TableRow.cjs +1 -0
- package/dist/components/table/TableRow.js +1 -0
- package/dist/components/table/index.cjs +1 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/tabs/Tabs.cjs +1 -0
- package/dist/components/tabs/Tabs.js +1 -0
- package/dist/components/tabs/TabsContent.cjs +1 -0
- package/dist/components/tabs/TabsContent.js +1 -0
- package/dist/components/tabs/TabsContext.cjs +1 -0
- package/dist/components/tabs/TabsContext.js +1 -0
- package/dist/components/tabs/TabsList.cjs +1 -0
- package/dist/components/tabs/TabsList.js +1 -0
- package/dist/components/tabs/TabsTrigger.cjs +1 -0
- package/dist/components/tabs/TabsTrigger.js +1 -0
- package/dist/components/tabs/index.cjs +1 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/toast/Toast.cjs +1 -0
- package/dist/components/toast/Toast.js +1 -0
- package/dist/components/toast/index.cjs +1 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/tooltip/Tooltip.cjs +1 -0
- package/dist/components/tooltip/Tooltip.js +1 -0
- package/dist/components/tooltip/index.cjs +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/waterfall-chart/WaterfallChart.cjs +1 -0
- package/dist/components/waterfall-chart/WaterfallChart.js +1 -0
- package/dist/components/waterfall-chart/index.cjs +1 -0
- package/dist/components/waterfall-chart/index.js +1 -0
- package/dist/components/wizard/Wizard.cjs +1 -0
- package/dist/components/wizard/Wizard.js +1 -0
- package/dist/components/wizard/index.cjs +1 -0
- package/dist/components/wizard/index.js +1 -0
- package/dist/components/workflow-editor/WorkflowEditor.cjs +1 -0
- package/dist/components/workflow-editor/WorkflowEditor.js +1 -0
- package/dist/components/workflow-editor/WorkflowEditor.types.cjs +1 -0
- package/dist/components/workflow-editor/WorkflowEditor.types.js +0 -0
- package/dist/components/workflow-editor/canvas/GridLayer.cjs +1 -0
- package/dist/components/workflow-editor/canvas/GridLayer.js +1 -0
- package/dist/components/workflow-editor/edges/WorkflowEdgeRenderer.cjs +1 -0
- package/dist/components/workflow-editor/edges/WorkflowEdgeRenderer.js +1 -0
- package/dist/components/workflow-editor/index.cjs +1 -0
- package/dist/components/workflow-editor/index.js +1 -0
- package/dist/components/workflow-editor/nodes/WorkflowNodeRenderer.cjs +1 -0
- package/dist/components/workflow-editor/nodes/WorkflowNodeRenderer.js +1 -0
- package/dist/components/workflow-editor/toolbar/WorkflowToolbar.cjs +1 -0
- package/dist/components/workflow-editor/toolbar/WorkflowToolbar.js +1 -0
- package/dist/components/workflow-editor/utils/geometry.cjs +1 -0
- package/dist/components/workflow-editor/utils/geometry.js +1 -0
- package/dist/hooks/index.cjs +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useDialogA11y.cjs +1 -0
- package/dist/hooks/useDialogA11y.js +1 -0
- package/dist/index.cjs +1 -32
- package/dist/index.d.cts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +1 -32
- package/dist/lib/aria-hide.cjs +1 -0
- package/dist/lib/aria-hide.js +1 -0
- package/dist/lib/cn.cjs +1 -0
- package/dist/lib/cn.js +1 -0
- package/dist/lib/dialog-stack.cjs +1 -0
- package/dist/lib/dialog-stack.js +1 -0
- package/dist/lib/focus.cjs +1 -0
- package/dist/lib/focus.js +1 -0
- package/dist/lib/i18n.cjs +1 -0
- package/dist/lib/i18n.js +1 -0
- package/dist/markdown-editor.cjs +1 -1
- package/dist/markdown-editor.js +1 -1
- package/dist/styles.css +125 -0
- package/package.json +1 -1
|
@@ -75,6 +75,30 @@ style de l'éditeur est incluse. Sans cette prop, le mode édition affiche un me
|
|
|
75
75
|
**Anti-pattern** : ne jamais importer `@synertech/ui/markdown-editor` dans une application
|
|
76
76
|
qui n'installe pas `@mdxeditor/editor` — son build échouerait sur un module introuvable.
|
|
77
77
|
|
|
78
|
+
### 4. Next.js avec webpack : `optimizePackageImports`
|
|
79
|
+
|
|
80
|
+
Next.js 16 construit avec Turbopack par défaut : rien à régler. Avec webpack — ce
|
|
81
|
+
qu'utilise `next build` avant Next.js 16, ou `next build --webpack` depuis — ajouter le
|
|
82
|
+
package à `optimizePackageImports` :
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
// next.config.mjs
|
|
86
|
+
export default {
|
|
87
|
+
experimental: {
|
|
88
|
+
optimizePackageImports: ["@synertech/ui"],
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Sans ce réglage, un Server Component qui importe quoi que ce soit depuis `@synertech/ui`
|
|
94
|
+
(un `UILabelsProvider` dans le layout racine suffit) fait envoyer par webpack tous les
|
|
95
|
+
composants clients de la librairie au navigateur, sur chaque page. Mesuré sur une page
|
|
96
|
+
serveur minimale avec Next.js 14.2 : 275 Ko de JavaScript au premier chargement sans le
|
|
97
|
+
réglage, 90 Ko avec.
|
|
98
|
+
|
|
99
|
+
**Anti-pattern** : dans une application Next.js sous webpack, importer `@synertech/ui`
|
|
100
|
+
depuis un Server Component sans avoir ajouté ce réglage.
|
|
101
|
+
|
|
78
102
|
---
|
|
79
103
|
|
|
80
104
|
## Imports
|
|
@@ -1718,7 +1742,14 @@ const [value, setValue] = useState("");
|
|
|
1718
1742
|
|
|
1719
1743
|
### 3. Composants dans Server Components (Next.js)
|
|
1720
1744
|
|
|
1721
|
-
|
|
1745
|
+
Tous les composants s'importent directement depuis un Server Component. La
|
|
1746
|
+
librairie porte elle-même ses directives `"use client"` : l'application n'a pas
|
|
1747
|
+
à en écrire pour s'en servir, et rien ne change dans une application React sans
|
|
1748
|
+
Next.js.
|
|
1749
|
+
|
|
1750
|
+
Les composants **d'affichage** (`Card`, `Button`, `Avatar`, `Badge`, `Divider`,
|
|
1751
|
+
`Skeleton`, `Table`, `StatCard`, `Sparkline`...) n'ont pas de directive : ils
|
|
1752
|
+
sont rendus sur le serveur et n'envoient aucun JavaScript au navigateur.
|
|
1722
1753
|
|
|
1723
1754
|
```tsx
|
|
1724
1755
|
// app/page.tsx (Server Component)
|
|
@@ -1737,19 +1768,59 @@ export default function Page() {
|
|
|
1737
1768
|
}
|
|
1738
1769
|
```
|
|
1739
1770
|
|
|
1740
|
-
Les composants **
|
|
1771
|
+
Les composants **interactifs** (`Tabs`, `Accordion`, `Dropdown`, `Select`,
|
|
1772
|
+
`Input`, `Chip`, les graphiques...) sont des Client Components. Ils se placent
|
|
1773
|
+
eux aussi dans un Server Component, tant que leurs props sont sérialisables :
|
|
1774
|
+
texte, nombres, objets, tableaux, JSX.
|
|
1775
|
+
|
|
1776
|
+
```tsx
|
|
1777
|
+
// app/dashboard/page.tsx (Server Component, aucune directive)
|
|
1778
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent, LineChart } from "@synertech/ui";
|
|
1779
|
+
|
|
1780
|
+
export default async function Page() {
|
|
1781
|
+
const revenue = await getRevenue(); // lu sur le serveur
|
|
1782
|
+
|
|
1783
|
+
return (
|
|
1784
|
+
<Tabs defaultValue="chart">
|
|
1785
|
+
<TabsList>
|
|
1786
|
+
<TabsTrigger value="chart">Graphique</TabsTrigger>
|
|
1787
|
+
<TabsTrigger value="notes">Notes</TabsTrigger>
|
|
1788
|
+
</TabsList>
|
|
1789
|
+
<TabsContent value="chart">
|
|
1790
|
+
{/* `locale` : sans elle, le serveur et le navigateur formatent chacun dans leur langue */}
|
|
1791
|
+
<LineChart
|
|
1792
|
+
data={revenue}
|
|
1793
|
+
x={{ key: "month" }}
|
|
1794
|
+
series={[{ key: "revenue", label: "Revenu" }]}
|
|
1795
|
+
locale="fr-CA"
|
|
1796
|
+
/>
|
|
1797
|
+
</TabsContent>
|
|
1798
|
+
<TabsContent value="notes">...</TabsContent>
|
|
1799
|
+
</Tabs>
|
|
1800
|
+
);
|
|
1801
|
+
}
|
|
1802
|
+
```
|
|
1803
|
+
|
|
1804
|
+
Avec webpack, pensez à `optimizePackageImports` (voir Installation) : sans lui, ces imports
|
|
1805
|
+
depuis un Server Component embarquent tous les composants clients de la librairie.
|
|
1806
|
+
|
|
1807
|
+
`"use client"` reste nécessaire dans **votre** fichier dès qu'il tient un état ou
|
|
1808
|
+
passe une fonction à un composant (`onClick`, `onValueChange`, une fonction
|
|
1809
|
+
`render`, un formateur) : React ne fait pas passer une fonction du serveur au
|
|
1810
|
+
client, quelle que soit la librairie.
|
|
1741
1811
|
|
|
1742
1812
|
```tsx
|
|
1743
1813
|
// components/UserForm.tsx
|
|
1744
1814
|
"use client";
|
|
1815
|
+
import { useState } from "react";
|
|
1745
1816
|
import { Select, Input, Checkbox } from "@synertech/ui";
|
|
1746
1817
|
|
|
1747
1818
|
export function UserForm() {
|
|
1748
|
-
|
|
1819
|
+
const [country, setCountry] = useState("ca");
|
|
1749
1820
|
return (
|
|
1750
1821
|
<form>
|
|
1751
1822
|
<Input label="Nom" />
|
|
1752
|
-
<Select options={countries} />
|
|
1823
|
+
<Select options={countries} value={country} onValueChange={setCountry} />
|
|
1753
1824
|
<Checkbox label="Accepter" />
|
|
1754
1825
|
</form>
|
|
1755
1826
|
);
|
package/README.md
CHANGED
|
@@ -45,7 +45,27 @@ module.exports = {
|
|
|
45
45
|
|
|
46
46
|
</details>
|
|
47
47
|
|
|
48
|
-
### 3.
|
|
48
|
+
### 3. Next.js with webpack: optimize the package imports
|
|
49
|
+
|
|
50
|
+
Next.js 16 builds with Turbopack by default and needs nothing more. With webpack — what
|
|
51
|
+
`next build` uses before Next.js 16, or `next build --webpack` since — add the package to
|
|
52
|
+
`optimizePackageImports`:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
// next.config.mjs
|
|
56
|
+
export default {
|
|
57
|
+
experimental: {
|
|
58
|
+
optimizePackageImports: ["@synertech/ui"],
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Without it, a Server Component that imports anything from `@synertech/ui` — a
|
|
64
|
+
`UILabelsProvider` in the root layout is enough — makes webpack send every client
|
|
65
|
+
component of the library to the browser, on every page. Measured on a minimal server page
|
|
66
|
+
with Next.js 14.2: 275 kB of first-load JavaScript without the setting, 90 kB with it.
|
|
67
|
+
|
|
68
|
+
### 4. Optional: Markdown editing
|
|
49
69
|
|
|
50
70
|
`<HelpButton markdown editable>` uses [MDXEditor](https://mdxeditor.dev/), which is an
|
|
51
71
|
**optional** peer dependency — it pulls in a large dependency tree, so it is not
|
|
@@ -198,7 +218,7 @@ import {
|
|
|
198
218
|
### Adding a new component
|
|
199
219
|
|
|
200
220
|
1. Create the component in the appropriate category: `src/components/<category>/<Component>.tsx`
|
|
201
|
-
2. Add `"use client"` directive if
|
|
221
|
+
2. Add `"use client"` directive if the module needs it (see [Conventions](#use-client-directive))
|
|
202
222
|
3. Export the component and its props type
|
|
203
223
|
4. Add export in `src/components/<category>/index.ts`
|
|
204
224
|
5. Verify: `pnpm typecheck && pnpm build`
|
|
@@ -211,7 +231,7 @@ import {
|
|
|
211
231
|
- **No compiled CSS** – Tailwind classes are applied, not compiled
|
|
212
232
|
- **React as peer dependency** – Don't bundle React
|
|
213
233
|
- **Next.js compatible** – Proper ESM/CJS exports
|
|
214
|
-
- **Use `"use client"`** – Only for
|
|
234
|
+
- **Use `"use client"`** – Only for modules using client-only React APIs or their own event handlers
|
|
215
235
|
- **Accept `className`** – All components should allow style overrides
|
|
216
236
|
- **Export types** – Each component exports its props type
|
|
217
237
|
|
|
@@ -280,11 +300,19 @@ This project uses [Changesets](https://github.com/changesets/changesets) for ver
|
|
|
280
300
|
|
|
281
301
|
### `"use client"` directive
|
|
282
302
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
-
|
|
303
|
+
An application never has to write `"use client"` just to import a component: the
|
|
304
|
+
library's own modules carry the directive, and each one is published as its own file so
|
|
305
|
+
the directive survives the build. A module gets it when it:
|
|
306
|
+
|
|
307
|
+
- uses a client-only React API: state, effects, refs, context (`useId`, `useMemo`,
|
|
308
|
+
`useCallback`, `forwardRef` and `memo` also exist on the server);
|
|
309
|
+
- or attaches an event handler of its own to what it renders (`Chip` has no hook, but
|
|
310
|
+
always wires `onClick`).
|
|
311
|
+
|
|
312
|
+
Display components (`Card`, `Button`, `Avatar`, `Table`, `StatCard`, `Sparkline`…) have no
|
|
313
|
+
directive and render as Server Components. `pnpm build` runs
|
|
314
|
+
`scripts/check-bundle-boundary.mjs`, which fails when a directive is lost or when a module
|
|
315
|
+
without one uses a client-only API.
|
|
288
316
|
|
|
289
317
|
### `className` prop
|
|
290
318
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var y=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var S=(e,r)=>{for(var i in r)y(e,i,{get:r[i],enumerable:!0})},V=(e,r,i,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of E(r))!D.call(e,t)&&t!==i&&y(e,t,{get:()=>r[t],enumerable:!(n=T(r,t))||n.enumerable});return e};var H=e=>V(y({},"__esModule",{value:!0}),e);var G={};S(G,{Accordion:()=>$,AccordionContent:()=>F,AccordionItem:()=>q,AccordionTrigger:()=>B});module.exports=H(G);var o=require("react"),b=require("../../lib/cn.cjs"),d=require("react/jsx-runtime"),v=(0,o.createContext)(null),I=(0,o.createContext)(null);function A(){let e=(0,o.useContext)(v);if(!e)throw new Error("Accordion sub-components must be used within <Accordion>");return e}function C(){let e=(0,o.useContext)(I);if(!e)throw new Error("AccordionTrigger/AccordionContent must be used within <AccordionItem>");return e}var N={sm:{trigger:"px-3 py-2",content:"px-3 pb-2",text:"text-sm",icon:"w-3.5 h-3.5"},md:{trigger:"px-4 py-3",content:"px-4 pb-3",text:"text-base",icon:"w-4 h-4"},lg:{trigger:"px-5 py-4",content:"px-5 pb-4",text:"text-lg",icon:"w-5 h-5"}},M=({className:e})=>(0,d.jsx)("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,d.jsx)("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),K={default:"border border-gray-200 dark:border-gray-700 rounded-lg divide-y divide-gray-200 dark:divide-gray-700",bordered:"border-2 border-gray-300 dark:border-gray-600 rounded-lg divide-y divide-gray-300 dark:divide-gray-600",separated:"space-y-2",ghost:""},L={default:"",bordered:"",separated:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",ghost:"border-b border-gray-200 dark:border-gray-700 last:border-b-0"};function $({type:e="single",value:r,defaultValue:i,onValueChange:n,collapsible:t=!1,variant:c="default",size:l="md",disabled:a=!1,iconPosition:g="right",icon:s,hideIcon:u=!1,className:k,children:w}){let[R,P]=(0,o.useState)(()=>i?Array.isArray(i)?i:[i]:[]),m=r!==void 0,p=m?Array.isArray(r)?r:[r]:R,h=(0,o.useCallback)(x=>{let f;e==="single"?p.includes(x)?f=t?[]:[x]:f=[x]:f=p.includes(x)?p.filter(O=>O!==x):[...p,x],m||P(f),n?.(e==="single"?f[0]??"":f)},[e,p,t,m,n]),z=(0,o.useMemo)(()=>({openItems:p,toggle:h,variant:c,size:l,disabled:a,iconPosition:g,icon:s??null,hideIcon:u}),[p,h,c,l,a,g,s,u]);return(0,d.jsx)(v.Provider,{value:z,children:(0,d.jsx)("div",{className:(0,b.cn)(K[c],k),"data-testid":"accordion",children:w})})}function q({value:e,disabled:r,className:i,children:n}){let t=A(),c=t.openItems.includes(e),l=r??t.disabled,a=(0,o.useId)(),g=`accordion-trigger-${a}`,s=`accordion-content-${a}`,u=(0,o.useMemo)(()=>({value:e,isOpen:c,disabled:l,triggerId:g,contentId:s}),[e,c,l,g,s]);return(0,d.jsx)(I.Provider,{value:u,children:(0,d.jsx)("div",{className:(0,b.cn)(L[t.variant],i),"data-state":c?"open":"closed","data-testid":"accordion-item",children:n})})}function B({className:e,icon:r,children:i}){let n=A(),t=C(),c=N[n.size],l=()=>{t.disabled||n.toggle(t.value)},a=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),l())},g=r??n.icon??(0,d.jsx)(M,{className:c.icon}),s=!n.hideIcon&&(0,d.jsx)("span",{className:(0,b.cn)("shrink-0 text-gray-500 dark:text-gray-400 transition-transform duration-200",t.isOpen&&"rotate-180"),"data-testid":"accordion-icon",children:g});return(0,d.jsxs)("button",{type:"button",id:t.triggerId,"aria-expanded":t.isOpen,"aria-controls":t.contentId,disabled:t.disabled,onClick:l,onKeyDown:a,className:(0,b.cn)("flex items-center w-full text-left font-medium transition-colors cursor-pointer",c.trigger,c.text,"text-gray-900 dark:text-gray-100",!t.disabled&&"hover:bg-gray-50 dark:hover:bg-gray-800/50",t.disabled&&"opacity-50 cursor-not-allowed",e),"data-testid":"accordion-trigger",children:[n.iconPosition==="left"&&s,(0,d.jsx)("span",{className:"flex-1",children:i}),n.iconPosition==="right"&&s]})}function F({className:e,children:r}){let i=A(),n=C(),t=N[i.size],c=(0,o.useRef)(null),[l,a]=(0,o.useState)(n.isOpen?void 0:0),g=(0,o.useRef)(!0);return(0,o.useEffect)(()=>{if(g.current){g.current=!1,a(n.isOpen?void 0:0);return}if(n.isOpen){let s=c.current;if(s){a(s.scrollHeight);let u=setTimeout(()=>a(void 0),200);return()=>clearTimeout(u)}}else{let s=c.current;s&&(a(s.scrollHeight),requestAnimationFrame(()=>a(0)))}},[n.isOpen]),(0,d.jsx)("div",{id:n.contentId,role:"region","aria-labelledby":n.triggerId,className:"overflow-hidden transition-[height] duration-200 ease-in-out",style:{height:l===void 0?"auto":l},"data-testid":"accordion-content","data-state":n.isOpen?"open":"closed",children:(0,d.jsx)("div",{ref:c,className:(0,b.cn)(t.content,"text-gray-600 dark:text-gray-400",t.text==="text-lg"?"text-base":"text-sm",e),children:r})})}0&&(module.exports={Accordion,AccordionContent,AccordionItem,AccordionTrigger});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{createContext as h,useContext as v,useState as I,useCallback as S,useMemo as C,useRef as A,useEffect as V,useId as H}from"react";import{cn as f}from"../../lib/cn.js";import{jsx as s,jsxs as $}from"react/jsx-runtime";var N=h(null),k=h(null);function m(){let e=v(N);if(!e)throw new Error("Accordion sub-components must be used within <Accordion>");return e}function w(){let e=v(k);if(!e)throw new Error("AccordionTrigger/AccordionContent must be used within <AccordionItem>");return e}var R={sm:{trigger:"px-3 py-2",content:"px-3 pb-2",text:"text-sm",icon:"w-3.5 h-3.5"},md:{trigger:"px-4 py-3",content:"px-4 pb-3",text:"text-base",icon:"w-4 h-4"},lg:{trigger:"px-5 py-4",content:"px-5 pb-4",text:"text-lg",icon:"w-5 h-5"}},M=({className:e})=>s("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:s("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),K={default:"border border-gray-200 dark:border-gray-700 rounded-lg divide-y divide-gray-200 dark:divide-gray-700",bordered:"border-2 border-gray-300 dark:border-gray-600 rounded-lg divide-y divide-gray-300 dark:divide-gray-600",separated:"space-y-2",ghost:""},L={default:"",bordered:"",separated:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",ghost:"border-b border-gray-200 dark:border-gray-700 last:border-b-0"};function F({type:e="single",value:d,defaultValue:a,onValueChange:t,collapsible:n=!1,variant:o="default",size:c="md",disabled:i=!1,iconPosition:l="right",icon:r,hideIcon:g=!1,className:P,children:z}){let[O,T]=I(()=>a?Array.isArray(a)?a:[a]:[]),b=d!==void 0,u=b?Array.isArray(d)?d:[d]:O,y=S(p=>{let x;e==="single"?u.includes(p)?x=n?[]:[p]:x=[p]:x=u.includes(p)?u.filter(D=>D!==p):[...u,p],b||T(x),t?.(e==="single"?x[0]??"":x)},[e,u,n,b,t]),E=C(()=>({openItems:u,toggle:y,variant:o,size:c,disabled:i,iconPosition:l,icon:r??null,hideIcon:g}),[u,y,o,c,i,l,r,g]);return s(N.Provider,{value:E,children:s("div",{className:f(K[o],P),"data-testid":"accordion",children:z})})}function G({value:e,disabled:d,className:a,children:t}){let n=m(),o=n.openItems.includes(e),c=d??n.disabled,i=H(),l=`accordion-trigger-${i}`,r=`accordion-content-${i}`,g=C(()=>({value:e,isOpen:o,disabled:c,triggerId:l,contentId:r}),[e,o,c,l,r]);return s(k.Provider,{value:g,children:s("div",{className:f(L[n.variant],a),"data-state":o?"open":"closed","data-testid":"accordion-item",children:t})})}function J({className:e,icon:d,children:a}){let t=m(),n=w(),o=R[t.size],c=()=>{n.disabled||t.toggle(n.value)},i=g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),c())},l=d??t.icon??s(M,{className:o.icon}),r=!t.hideIcon&&s("span",{className:f("shrink-0 text-gray-500 dark:text-gray-400 transition-transform duration-200",n.isOpen&&"rotate-180"),"data-testid":"accordion-icon",children:l});return $("button",{type:"button",id:n.triggerId,"aria-expanded":n.isOpen,"aria-controls":n.contentId,disabled:n.disabled,onClick:c,onKeyDown:i,className:f("flex items-center w-full text-left font-medium transition-colors cursor-pointer",o.trigger,o.text,"text-gray-900 dark:text-gray-100",!n.disabled&&"hover:bg-gray-50 dark:hover:bg-gray-800/50",n.disabled&&"opacity-50 cursor-not-allowed",e),"data-testid":"accordion-trigger",children:[t.iconPosition==="left"&&r,s("span",{className:"flex-1",children:a}),t.iconPosition==="right"&&r]})}function Q({className:e,children:d}){let a=m(),t=w(),n=R[a.size],o=A(null),[c,i]=I(t.isOpen?void 0:0),l=A(!0);return V(()=>{if(l.current){l.current=!1,i(t.isOpen?void 0:0);return}if(t.isOpen){let r=o.current;if(r){i(r.scrollHeight);let g=setTimeout(()=>i(void 0),200);return()=>clearTimeout(g)}}else{let r=o.current;r&&(i(r.scrollHeight),requestAnimationFrame(()=>i(0)))}},[t.isOpen]),s("div",{id:t.contentId,role:"region","aria-labelledby":t.triggerId,className:"overflow-hidden transition-[height] duration-200 ease-in-out",style:{height:c===void 0?"auto":c},"data-testid":"accordion-content","data-state":t.isOpen?"open":"closed",children:s("div",{ref:o,className:f(n.content,"text-gray-600 dark:text-gray-400",n.text==="text-lg"?"text-base":"text-sm",e),children:d})})}export{F as Accordion,Q as AccordionContent,G as AccordionItem,J as AccordionTrigger};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var g=(c,o)=>{for(var i in o)d(c,i,{get:o[i],enumerable:!0})},m=(c,o,i,A)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of t(o))!p.call(c,n)&&n!==i&&d(c,n,{get:()=>o[n],enumerable:!(A=e(o,n))||A.enumerable});return c};var s=c=>m(d({},"__esModule",{value:!0}),c);var P={};g(P,{Accordion:()=>r.Accordion,AccordionContent:()=>r.AccordionContent,AccordionItem:()=>r.AccordionItem,AccordionTrigger:()=>r.AccordionTrigger});module.exports=s(P);var r=require("./Accordion.cjs");0&&(module.exports={Accordion,AccordionContent,AccordionItem,AccordionTrigger});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Accordion as c,AccordionItem as n,AccordionTrigger as i,AccordionContent as d}from"./Accordion.js";export{c as Accordion,d as AccordionContent,n as AccordionItem,i as AccordionTrigger};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var V=Object.defineProperty;var we=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Ce=(t,r)=>{for(var a in r)V(t,a,{get:r[a],enumerable:!0})},Ee=(t,r,a,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of Re(r))!De.call(t,l)&&l!==a&&V(t,l,{get:()=>r[l],enumerable:!(s=we(r,l))||s.enumerable});return t};var Te=t=>Ee(V({},"__esModule",{value:!0}),t);var He={};Ce(He,{AdvanceDetachable:()=>de});module.exports=Te(He);var e=require("react"),ie=require("react-dom"),g=require("react/jsx-runtime");function Ae(...t){return t.filter(Boolean).join(" ")}var Ne="@synertech/ui/AdvanceDetachable",Me=300,Se="width=800,height=600,menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes",Le=0;function Ie(){return`${Date.now()}-${++Le}-${Math.random().toString(36).slice(2,8)}`}function le(t){try{return JSON.stringify(t)}catch{return String(t)}}function ue(t){try{return JSON.parse(t)}catch{return t}}function xe(t,r){t.querySelectorAll("style").forEach(a=>{let s=r.createElement("style");s.textContent=a.textContent,r.head.appendChild(s)}),t.querySelectorAll('link[rel="stylesheet"]').forEach(a=>{let s=a,l=r.createElement("link");l.rel="stylesheet",l.href=s.href,s.crossOrigin&&(l.crossOrigin=s.crossOrigin),r.head.appendChild(l)}),t.documentElement.className&&(r.documentElement.className=t.documentElement.className),t.body.className&&(r.body.className=t.body.className)}function Oe(t,r){let a=new MutationObserver(s=>{for(let l of s)for(let f of Array.from(l.addedNodes))if(f instanceof HTMLStyleElement){let u=r.createElement("style");u.textContent=f.textContent,r.head.appendChild(u)}else if(f instanceof HTMLLinkElement&&f.rel==="stylesheet"){let u=r.createElement("link");u.rel="stylesheet",u.href=f.href,r.head.appendChild(u)}});return a.observe(t.head,{childList:!0}),a}function ke(){return typeof BroadcastChannel<"u"}function Pe({mode:t,id:r,title:a="",children:s,value:l,defaultValue:f,onValueChange:u,isDetached:B,defaultDetached:fe=!1,onDetachedChange:z,features:$,target:F,autoFocus:W=!0,className:pe,detachedBodyClassName:U,disabled:_=!1,readOnly:q=!1,closeOnMainWindowUnload:J=!0,name:X,serialize:j,deserialize:G},he){let i=B!==void 0,[me,w]=(0,e.useState)(fe),p=i?B:me,M=l!==void 0,[ge,ye]=(0,e.useState)(f),v=M?l:ge,[K,Q]=(0,e.useState)(null),c=(0,e.useRef)(null),y=(0,e.useRef)(null),R=(0,e.useRef)(null),D=(0,e.useRef)(null),C=(0,e.useRef)(!1),E=(0,e.useRef)(null),S=(0,e.useRef)(null),Y=(0,e.useRef)(null),[T]=(0,e.useState)(()=>`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),d=(0,e.useRef)({title:a,features:$,target:F,autoFocus:W,detachedBodyClassName:U,closeOnMainWindowUnload:J,disabled:_,readOnly:q,mode:t,id:r});d.current={title:a,features:$,target:F,autoFocus:W,detachedBodyClassName:U,closeOnMainWindowUnload:J,disabled:_,readOnly:q,mode:t,id:r};let L=(0,e.useRef)(j??le);L.current=j??le;let Z=(0,e.useRef)(G??ue);Z.current=G??ue;let ee=(0,e.useRef)(u);ee.current=u;let b=(0,e.useRef)(z);b.current=z;let I=(0,e.useRef)(p);I.current=p;let h=`${Ne}/${r}`,A=(0,e.useCallback)(()=>{R.current&&(clearInterval(R.current),R.current=null),D.current&&(D.current.disconnect(),D.current=null),Q(null)},[]),N=(0,e.useCallback)(()=>{y.current&&(y.current.close(),y.current=null),E.current&&typeof window<"u"&&(window.removeEventListener("message",E.current),E.current=null)},[]),x=(0,e.useCallback)(n=>{if(!(!n||n.channel!==h)&&n.instanceId!==T&&!d.current.readOnly&&n.type==="value-sync"&&n.payload!==void 0){S.current=n.payload;let o=Z.current(n.payload);M||ye(o),ee.current?.(o)}},[h,T,M]),ne=(0,e.useCallback)(()=>{if(N(),!(typeof window>"u"))if(ke()){let n=new BroadcastChannel(h),o=m=>x(m.data);n.addEventListener("message",o),y.current=n}else{let n=o=>{o.data?.channel===h&&x(o.data)};window.addEventListener("message",n),E.current=n}},[h,N,x]),te=(0,e.useCallback)(n=>{if(d.current.readOnly)return;let o=L.current(n);if(o===Y.current)return;if(o===S.current){S.current=null;return}Y.current=o;let m={channel:h,instanceId:T,messageId:Ie(),origin:"main",timestamp:Date.now(),type:"value-sync",payload:o};y.current?y.current.postMessage(m):c.current&&!c.current.closed&&c.current.postMessage(m,"*")},[h,T]),re=(0,e.useCallback)(()=>{if(typeof window>"u"||d.current.disabled||C.current||c.current&&!c.current.closed)return;C.current=!0;let n=d.current,o=window.open("",n.target||"",n.features||Se);if(!o){C.current=!1;return}c.current=o,o.document.title=n.title||document.title,n.detachedBodyClassName&&(o.document.body.className=n.detachedBodyClassName);let m=o.document.createElement("div");o.document.body.appendChild(m),Q(m),xe(document,o.document),D.current=Oe(document,o.document),R.current=setInterval(()=>{o.closed&&(A(),c.current=null,i||w(!1),b.current?.(!1))},Me),n.autoFocus&&o.focus(),C.current=!1},[i,A]),ce=(0,e.useCallback)(()=>{c.current&&!c.current.closed&&c.current.close(),c.current=null,A()},[A]),oe=(0,e.useRef)(re);oe.current=re;let O=(0,e.useRef)(ce);O.current=ce;let ae=(0,e.useRef)(te);ae.current=te;let k=(0,e.useCallback)(()=>{d.current.disabled||(i||w(!0),b.current?.(!0))},[i]),P=(0,e.useCallback)(()=>{i||w(!1),b.current?.(!1)},[i]),H=(0,e.useCallback)(()=>{let n=!I.current;n&&d.current.disabled||(i||w(n),b.current?.(n))},[i]);(0,e.useImperativeHandle)(he,()=>({open:k,close:P,toggle:H,get isDetached(){return I.current},get window(){return c.current}}),[k,P,H]),(0,e.useEffect)(()=>(ne(),()=>N()),[ne,N]),(0,e.useEffect)(()=>{if(p)return oe.current(),()=>O.current();O.current()},[p]),(0,e.useEffect)(()=>{v!==void 0&&ae.current(v)},[v]),(0,e.useEffect)(()=>{c.current&&!c.current.closed&&a&&(c.current.document.title=a)},[a]),(0,e.useEffect)(()=>{if(typeof window>"u")return;let n=()=>{d.current.closeOnMainWindowUnload&&c.current&&!c.current.closed&&c.current.close()};return window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n),c.current&&!c.current.closed&&c.current.close(),c.current=null}},[]);let se=typeof s=="function"?s({open:k,close:P,toggle:H,detached:p,windowRef:c.current}):s,ve=t==="clone"||!p,be=p&&K!==null;return(0,g.jsxs)(g.Fragment,{children:[X&&v!==void 0&&(0,g.jsx)("input",{type:"hidden",name:X,value:L.current(v)}),ve&&(0,g.jsx)("div",{className:Ae(pe),children:se}),be&&(0,ie.createPortal)(se,K)]})}var de=(0,e.forwardRef)(Pe);de.displayName="AdvanceDetachable";0&&(module.exports={AdvanceDetachable});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useState as S,useRef as c,useEffect as w,useCallback as l,useImperativeHandle as we,forwardRef as Re}from"react";import{createPortal as De}from"react-dom";import{Fragment as ke,jsx as de,jsxs as Pe}from"react/jsx-runtime";function Ce(...r){return r.filter(Boolean).join(" ")}var Ee="@synertech/ui/AdvanceDetachable",Te=300,Ae="width=800,height=600,menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes",Ne=0;function Me(){return`${Date.now()}-${++Ne}-${Math.random().toString(36).slice(2,8)}`}function ue(r){try{return JSON.stringify(r)}catch{return String(r)}}function ie(r){try{return JSON.parse(r)}catch{return r}}function Se(r,o){r.querySelectorAll("style").forEach(a=>{let s=o.createElement("style");s.textContent=a.textContent,o.head.appendChild(s)}),r.querySelectorAll('link[rel="stylesheet"]').forEach(a=>{let s=a,u=o.createElement("link");u.rel="stylesheet",u.href=s.href,s.crossOrigin&&(u.crossOrigin=s.crossOrigin),o.head.appendChild(u)}),r.documentElement.className&&(o.documentElement.className=r.documentElement.className),r.body.className&&(o.body.className=r.body.className)}function Le(r,o){let a=new MutationObserver(s=>{for(let u of s)for(let p of Array.from(u.addedNodes))if(p instanceof HTMLStyleElement){let i=o.createElement("style");i.textContent=p.textContent,o.head.appendChild(i)}else if(p instanceof HTMLLinkElement&&p.rel==="stylesheet"){let i=o.createElement("link");i.rel="stylesheet",i.href=p.href,o.head.appendChild(i)}});return a.observe(r.head,{childList:!0}),a}function Ie(){return typeof BroadcastChannel<"u"}function xe({mode:r,id:o,title:a="",children:s,value:u,defaultValue:p,onValueChange:i,isDetached:z,defaultDetached:fe=!1,onDetachedChange:$,features:F,target:W,autoFocus:U=!0,className:pe,detachedBodyClassName:_,disabled:q=!1,readOnly:J=!1,closeOnMainWindowUnload:X=!0,name:j,serialize:G,deserialize:K},he){let d=z!==void 0,[me,R]=S(fe),h=d?z:me,L=u!==void 0,[ge,ye]=S(p),v=L?u:ge,[Q,Y]=S(null),n=c(null),y=c(null),D=c(null),C=c(null),E=c(!1),T=c(null),I=c(null),Z=c(null),[A]=S(()=>`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),f=c({title:a,features:F,target:W,autoFocus:U,detachedBodyClassName:_,closeOnMainWindowUnload:X,disabled:q,readOnly:J,mode:r,id:o});f.current={title:a,features:F,target:W,autoFocus:U,detachedBodyClassName:_,closeOnMainWindowUnload:X,disabled:q,readOnly:J,mode:r,id:o};let x=c(G??ue);x.current=G??ue;let ee=c(K??ie);ee.current=K??ie;let ne=c(i);ne.current=i;let b=c($);b.current=$;let O=c(h);O.current=h;let m=`${Ee}/${o}`,N=l(()=>{D.current&&(clearInterval(D.current),D.current=null),C.current&&(C.current.disconnect(),C.current=null),Y(null)},[]),M=l(()=>{y.current&&(y.current.close(),y.current=null),T.current&&typeof window<"u"&&(window.removeEventListener("message",T.current),T.current=null)},[]),k=l(e=>{if(!(!e||e.channel!==m)&&e.instanceId!==A&&!f.current.readOnly&&e.type==="value-sync"&&e.payload!==void 0){I.current=e.payload;let t=ee.current(e.payload);L||ye(t),ne.current?.(t)}},[m,A,L]),te=l(()=>{if(M(),!(typeof window>"u"))if(Ie()){let e=new BroadcastChannel(m),t=g=>k(g.data);e.addEventListener("message",t),y.current=e}else{let e=t=>{t.data?.channel===m&&k(t.data)};window.addEventListener("message",e),T.current=e}},[m,M,k]),re=l(e=>{if(f.current.readOnly)return;let t=x.current(e);if(t===Z.current)return;if(t===I.current){I.current=null;return}Z.current=t;let g={channel:m,instanceId:A,messageId:Me(),origin:"main",timestamp:Date.now(),type:"value-sync",payload:t};y.current?y.current.postMessage(g):n.current&&!n.current.closed&&n.current.postMessage(g,"*")},[m,A]),ce=l(()=>{if(typeof window>"u"||f.current.disabled||E.current||n.current&&!n.current.closed)return;E.current=!0;let e=f.current,t=window.open("",e.target||"",e.features||Ae);if(!t){E.current=!1;return}n.current=t,t.document.title=e.title||document.title,e.detachedBodyClassName&&(t.document.body.className=e.detachedBodyClassName);let g=t.document.createElement("div");t.document.body.appendChild(g),Y(g),Se(document,t.document),C.current=Le(document,t.document),D.current=setInterval(()=>{t.closed&&(N(),n.current=null,d||R(!1),b.current?.(!1))},Te),e.autoFocus&&t.focus(),E.current=!1},[d,N]),oe=l(()=>{n.current&&!n.current.closed&&n.current.close(),n.current=null,N()},[N]),ae=c(ce);ae.current=ce;let P=c(oe);P.current=oe;let se=c(re);se.current=re;let H=l(()=>{f.current.disabled||(d||R(!0),b.current?.(!0))},[d]),V=l(()=>{d||R(!1),b.current?.(!1)},[d]),B=l(()=>{let e=!O.current;e&&f.current.disabled||(d||R(e),b.current?.(e))},[d]);we(he,()=>({open:H,close:V,toggle:B,get isDetached(){return O.current},get window(){return n.current}}),[H,V,B]),w(()=>(te(),()=>M()),[te,M]),w(()=>{if(h)return ae.current(),()=>P.current();P.current()},[h]),w(()=>{v!==void 0&&se.current(v)},[v]),w(()=>{n.current&&!n.current.closed&&a&&(n.current.document.title=a)},[a]),w(()=>{if(typeof window>"u")return;let e=()=>{f.current.closeOnMainWindowUnload&&n.current&&!n.current.closed&&n.current.close()};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e),n.current&&!n.current.closed&&n.current.close(),n.current=null}},[]);let le=typeof s=="function"?s({open:H,close:V,toggle:B,detached:h,windowRef:n.current}):s,ve=r==="clone"||!h,be=h&&Q!==null;return Pe(ke,{children:[j&&v!==void 0&&de("input",{type:"hidden",name:j,value:x.current(v)}),ve&&de("div",{className:Ce(pe),children:le}),be&&De(le,Q)]})}var Oe=Re(xe);Oe.displayName="AdvanceDetachable";export{Oe as AdvanceDetachable};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var n=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var l=(a,e)=>{for(var t in e)n(a,t,{get:e[t],enumerable:!0})},v=(a,e,t,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of b(e))!h.call(a,c)&&c!==t&&n(a,c,{get:()=>e[c],enumerable:!(d=r(e,c))||d.enumerable});return a};var A=a=>v(n({},"__esModule",{value:!0}),a);var D={};l(D,{AdvanceDetachable:()=>o.AdvanceDetachable});module.exports=A(D);var o=require("./AdvanceDetachable.cjs");0&&(module.exports={AdvanceDetachable});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AdvanceDetachable as c}from"./AdvanceDetachable.js";export{c as AdvanceDetachable};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var Ee=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Ue=Object.prototype.hasOwnProperty;var Fe=(h,i)=>{for(var r in i)Ee(h,r,{get:i[r],enumerable:!0})},je=(h,i,r,g)=>{if(i&&typeof i=="object"||typeof i=="function")for(let m of _e(i))!Ue.call(h,m)&&m!==r&&Ee(h,m,{get:()=>i[m],enumerable:!(g=Ye(i,m))||g.enumerable});return h};var Ze=h=>je(Ee({},"__esModule",{value:!0}),h);var rt={};Fe(rt,{AreaChart:()=>nt});module.exports=Ze(rt);var s=require("react"),He=require("../../lib/cn.cjs"),We=require("../../lib/i18n.cjs"),Q=require("../chart/ChartAnnotations.cjs"),Te=require("../chart/ChartAxis.cjs"),de=require("../chart/ChartBrush.cjs"),De=require("../chart/ChartContainer.cjs"),Me=require("../chart/ChartGrid.cjs"),Ke=require("../chart/ChartLegend.cjs"),ge=require("../chart/ChartPatterns.cjs"),$e=require("../chart/ChartSync.cjs"),Xe=require("../chart/ChartTableView.cjs"),fe=require("../chart/ChartTooltip.cjs"),E=require("../chart/palette.cjs"),P=require("../chart/utils/cartesian.cjs"),pe=require("../chart/utils/data.cjs"),be=require("../chart/utils/decimate.cjs"),x=require("../chart/utils/format.cjs"),M=require("../chart/utils/path.cjs"),T=require("../chart/utils/scales.cjs"),Ce=require("../chart/utils/stack.cjs"),Ge=require("../chart/utils/ticks.cjs"),n=require("react/jsx-runtime"),qe=.12,Je=.9,Qe=10,et=(0,s.memo)(function({bands:i,stacked:r,patterns:g,patternBaseId:m}){return(0,n.jsx)("g",{children:i.map(d=>(0,n.jsxs)("g",{children:[(0,n.jsx)("path",{d:d.area,fill:(0,ge.patternFill)(g,m,d.slot,d.color),fillOpacity:r?Je:qe,stroke:"none"}),d.gap?(0,n.jsx)("path",{d:d.gap,fill:"none",strokeWidth:2,className:"stroke-white dark:stroke-gray-800"}):null,(0,n.jsx)("path",{d:d.edge,fill:"none",stroke:d.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]},d.key))})});function tt({width:h,height:i,data:r,resolvedSeries:g,x:m,y:d,grid:C,size:ee,curve:b,stack:L,baseline:A,connectNulls:N,referenceLines:K,annotations:S,annotationsLabel:ye,patterns:te,patternBaseId:ne,overlay:ke,maxPoints:y,brush:re,onBrush:oe,brushLabel:ve,syncEnabled:$,margin:ae,tooltip:B,onPointClick:X,plotLabel:xe,formatValue:k,formatRaw:G,formatX:I}){let[O,z]=(0,s.useState)(null),u=O!==null&&O<r.length?O:null,[Pe,Le]=(0,s.useState)(null),Ae=(0,$e.useChartSync)(),l=$?Ae:null,t=(0,s.useMemo)(()=>{let e=g.filter(w=>!w.hidden),o=e.map(w=>w.key),a=L!=="none",c=(0,Ce.stackSeries)(r,o,L),ue=a?(0,Ce.stackExtent)(c):(0,Ge.extent)([...(0,pe.collectAllValues)(r,o),A]),p=(0,P.buildCartesianGeometry)({width:h,height:i,data:r,x:m,y:d,bounds:ue,margin:ae,placement:"point",formatValue:k,formatX:I,defaultIncludeZero:!0}),Re=p.categoryCenters,ce=p.valueScale,Oe=ce(a?0:A),ze=e.map((w,we)=>{let Z=r.map((q,J)=>{let V=c[J].segments[we];return{x:Re[J],y:V.value===null?Number.NaN:ce(V.end),defined:V.value!==null}}),Ne=r.map((q,J)=>{let V=c[J].segments[we];return{x:Re[J],y:V.value===null?Number.NaN:ce(a?V.start:A),defined:V.value!==null}}),he={connectNulls:N},me=y&&y>0&&Z.length>y?(0,be.decimateIndices)(Z,y):null,Ve=me?me.map(q=>Z[q]):Z,Ie=me?me.map(q=>Ne[q]):Ne;return y||(0,be.warnPointBudget)("AreaChart",Z.length),{key:w.key,color:w.color,slot:w.slot,area:a?(0,M.buildAreaPath)(Ve,Ie,b,he):(0,M.buildAreaPath)(Ve,Oe,b,he),edge:(0,M.buildLinePath)(Ve,b,he),gap:a&&we>0?(0,M.buildLinePath)(Ie,b,he):""}});return{visible:e,locate:(0,P.createCategoryLocator)(p),plot:(0,P.createPlotContext)({geometry:p,width:h,height:i,data:r,series:e,formatValue:k,formatX:I}),rows:c,stacked:a,xValues:p.xValues,positions:Re,xTicks:p.categoryTicks,yTicks:p.valueTicks,valueScale:ce,innerWidth:p.innerWidth,innerHeight:p.innerHeight,margin:p.margin,bands:ze}},[r,g,m,d,h,i,ae,b,L,A,N,y,k,I]),Y=(0,s.useCallback)(e=>t.visible.map((o,a)=>{let c=(0,pe.readNumber)(r[e],o.key),ue=t.rows[e].segments[a],p=c===null?"\u2014":L==="percent"?`${G(c)} (${k(ue.end-ue.start)})`:k(c);return{seriesKey:o.key,seriesLabel:(0,E.getSeriesLabel)(o),color:o.color,value:c,formattedValue:p,datum:r[e]}}),[r,t.visible,t.rows,L,k,G]),se=l?l.brush:Pe,le=(0,s.useCallback)(e=>{Le(e),l?.setBrush(e),oe?.(e)},[l,oe]),f=(0,de.useChartBrush)({enabled:re,active:se!==null,centers:t.positions,xValues:t.xValues,offset:t.margin.left,orientation:"vertical",onCommit:le}),Se=(0,s.useCallback)(e=>{if(f.onPointerMove(e),B===!1||r.length===0)return;let o=e.currentTarget.getBoundingClientRect(),a=e.clientX-o.left-t.margin.left,c=(0,T.nearestIndex)(t.positions,a);z(c>=0?c:null),l?.setHovered(c>=0?t.xValues[c]:null)},[f,B,r.length,t.margin.left,t.positions,t.xValues,l]),ie=(0,s.useCallback)(()=>{z(null),l?.setHovered(null)},[l]),H=(0,s.useCallback)(e=>{if(r.length===0)return;f.onKeyDown(e,u);let o=r.length-1,a=u??0,c=e.key==="ArrowRight"?Math.min(o,a+1):e.key==="ArrowLeft"?Math.max(0,a-1):e.key==="Home"?0:e.key==="End"?o:e.key==="Escape"?null:void 0;c!==void 0&&(e.preventDefault(),z(c),l?.setHovered(c===null?null:t.xValues[c]))},[r.length,u,f,l,t.xValues]),W=(0,s.useCallback)(()=>{if(f.consumedClick()||!X||u===null)return;let[e]=Y(u);e&&X({...e,index:u,x:t.xValues[u]})},[f,X,u,Y,t.xValues]),Be=u!==null||!l?.hovered?null:(()=>{let e=(0,T.toKey)(l.hovered),o=t.xValues.findIndex(a=>(0,T.toKey)(a)===e);return o<0?null:o})(),v=u??Be,_=u===null?null:Y(u),D=v===null?[]:t.visible.map((e,o)=>{let a=t.rows[v].segments[o];return a.value===null?null:{key:e.key,color:e.color,y:t.valueScale(a.end)}}).filter(e=>e!==null),U=f.dragging??se,F=(()=>{if(!U)return null;let e=t.locate(U.from),o=t.locate(U.to);return e===null||o===null?null:{from:e,to:o}})(),j=(0,P.splitOverlay)(ke),R=u===null||_===null?null:{x:t.xValues[u],xLabel:I(t.xValues[u],u),index:u,points:_};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{width:h,height:i,role:"img","aria-label":xe??[t.visible.map(e=>(0,E.getSeriesLabel)(e)).join(", "),(0,Q.describeAnnotations)(S,ye)].filter(Boolean).join(". "),tabIndex:0,className:(0,He.cn)("touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",re&&"select-none"),onPointerDown:f.onPointerDown,onPointerMove:Se,onPointerUp:f.onPointerUp,onPointerCancel:f.onPointerUp,onPointerLeave:ie,onKeyDown:H,onBlur:ie,onClick:W,children:[te?(0,n.jsx)(ge.ChartPatternDefs,{id:ne,entries:g.map(e=>({slot:e.slot,color:e.color}))}):null,(0,n.jsxs)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:[(0,n.jsx)(Me.ChartGrid,{width:t.innerWidth,height:t.innerHeight,horizontal:C==="y"||C==="both"?t.yTicks.map(e=>e.offset):void 0,vertical:C==="x"||C==="both"?t.xTicks.map(e=>e.offset):void 0}),S?(0,n.jsx)(Q.ChartAnnotationLayer,{layer:"under",annotations:S,xAt:t.locate,yAt:t.valueScale,width:t.innerWidth,height:t.innerHeight}):null,F?(0,n.jsx)(de.ChartBrushLayer,{from:F.from,to:F.to,width:t.innerWidth,height:t.innerHeight,live:f.dragging!==null,label:ve}):null,j.under?.(t.plot),(0,n.jsx)(et,{bands:t.bands,stacked:t.stacked,patterns:te&&t.stacked,patternBaseId:ne}),S?(0,n.jsx)(Q.ChartAnnotationLayer,{annotations:S,xAt:t.locate,yAt:t.valueScale,width:t.innerWidth,height:t.innerHeight}):null,K?.map(e=>{let o=t.valueScale(e.value),a=o<Qe?o+12:o-4;return(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:0,y1:o,x2:t.innerWidth,y2:o,stroke:e.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:e.dashed===!1?void 0:"4 4"}),e.label?(0,n.jsx)("text",{x:t.innerWidth,y:a,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:e.label}):null]},`${e.value}-${e.label??""}`)}),j.over?.(t.plot),v!==null?(0,n.jsxs)("g",{"aria-hidden":"true",children:[(0,n.jsx)("line",{x1:t.positions[v],y1:0,x2:t.positions[v],y2:t.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:u===null?"3 3":void 0}),D.map(e=>(0,n.jsx)("circle",{cx:t.positions[v],cy:e.y,r:4,fill:e.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},e.key))]}):null]}),(0,n.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top+t.innerHeight})`,children:m.hidden?null:(0,n.jsx)(Te.ChartAxis,{orientation:"bottom",ticks:t.xTicks,length:t.innerWidth,label:m.label,size:ee})}),(0,n.jsx)("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:d?.hidden?null:(0,n.jsx)(Te.ChartAxis,{orientation:"left",ticks:t.yTicks,length:t.innerHeight,showLine:!1,label:d?.label,size:ee})})]}),R&&B!==!1?(0,n.jsx)(fe.ChartTooltip,{x:t.margin.left+t.positions[R.index],y:t.margin.top+(D.length>0?Math.min(...D.map(e=>e.y)):t.innerHeight/2),containerWidth:h,children:typeof B=="function"?B(R):(0,n.jsx)(fe.ChartTooltipContent,{title:R.xLabel,points:R.points})}):null]})}function nt({data:h,series:i,x:r,y:g,height:m=240,width:d,size:C="md",grid:ee="y",legend:b,tooltip:L=!0,tableView:A=!1,emphasis:N,title:K,description:S,loading:ye=!1,emptyState:te,error:ne=!1,errorState:ke,onRetry:y,actions:re,onPointClick:oe,curve:ve="monotone",stack:$="none",baseline:ae=0,connectNulls:B=!1,referenceLines:X,annotations:xe,overlay:k,patterns:G=!1,legendToggle:I=!0,maxPoints:O,brush:z=!1,onBrush:u,brushLabel:Pe,sync:Le=!0,margin:Ae,locale:l,plotLabel:t,className:Y,...se}){let le=(0,We.useUILabels)(),[f,Se]=(0,s.useState)(()=>new Set),ie=(0,s.useId)(),H=(0,s.useMemo)(()=>i.map((e,o)=>({...e,slot:o,hidden:e.hidden||f.has(e.key),color:(0,E.resolveSeriesColor)(e,o,N)})),[i,f,N]),W=$==="percent",Be=(0,s.useMemo)(()=>W?{domain:[0,100],...g}:g,[W,g]),v=(0,s.useMemo)(()=>g?.format??(W?e=>(0,x.formatPercent)(e,{locale:l,alreadyScaled:!0,maximumFractionDigits:0}):e=>(0,x.formatAuto)(e,l)),[g?.format,W,l]),_=(0,s.useMemo)(()=>e=>(0,x.formatAuto)(e,l),[l]),D=(0,s.useMemo)(()=>r.format??(e=>r.scale==="time"?(0,x.formatXValue)(e instanceof Date?e:new Date((0,T.toNumber)(e)),l):(0,x.formatXValue)(e,l)),[r.format,r.scale,l]),U=(0,s.useCallback)(e=>{Se(o=>{let a=new Set(o);return a.has(e)?a.delete(e):a.add(e),a})},[]),F=b===void 0?i.length>=2:b!==!1,j=typeof b=="string"?b:"bottom",R=H.filter(e=>!e.hidden).length;return(0,n.jsx)(De.ChartContainer,{title:K,description:S,height:m,width:d,size:C,loading:ye,empty:h.length===0||R===0,emptyState:te,error:ne,errorState:ke,onRetry:y,actions:re,tableView:A,legendPosition:j,legend:F?(0,n.jsx)(Ke.ChartLegend,{items:(0,E.toLegendItems)(H,N,G&&$!=="none"),position:j,marker:"rect",size:C,onToggle:I?U:void 0}):void 0,table:A?(0,n.jsx)(Xe.ChartTableView,{data:h,series:H,xKey:r.key,xLabel:r.label??r.key,formatX:D,formatValue:_,caption:typeof K=="string"?K:void 0}):void 0,className:Y,...se,children:({width:e})=>(0,n.jsx)(tt,{width:e,height:m,data:h,resolvedSeries:H,x:r,y:Be,grid:ee,size:C,curve:ve,stack:$,baseline:ae,connectNulls:B,referenceLines:X,annotations:xe,annotationsLabel:le.chartAnnotations,patterns:G,patternBaseId:ie,overlay:k,maxPoints:O,brush:z,onBrush:u,brushLabel:Pe??le.chartBrush,syncEnabled:Le,margin:Ae,tooltip:L,onPointClick:oe,plotLabel:t,formatValue:v,formatRaw:_,formatX:D})})}0&&(module.exports={AreaChart});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{memo as Ie,useCallback as R,useId as He,useMemo as I,useState as ve}from"react";import{cn as We}from"../../lib/cn.js";import{useUILabels as De}from"../../lib/i18n.js";import{ChartAnnotationLayer as Le,describeAnnotations as Me}from"../chart/ChartAnnotations.js";import{ChartAxis as Ae}from"../chart/ChartAxis.js";import{ChartBrushLayer as Ke,useChartBrush as $e}from"../chart/ChartBrush.js";import{ChartContainer as Xe}from"../chart/ChartContainer.js";import{ChartGrid as Ge}from"../chart/ChartGrid.js";import{ChartLegend as Oe}from"../chart/ChartLegend.js";import{ChartPatternDefs as ze,patternFill as Ye}from"../chart/ChartPatterns.js";import{useChartSync as _e}from"../chart/ChartSync.js";import{ChartTableView as Ue}from"../chart/ChartTableView.js";import{ChartTooltip as Fe,ChartTooltipContent as je}from"../chart/ChartTooltip.js";import{getSeriesLabel as Se,resolveSeriesColor as Ze,toLegendItems as qe}from"../chart/palette.js";import{buildCartesianGeometry as Je,createCategoryLocator as Qe,createPlotContext as et,splitOverlay as tt}from"../chart/utils/cartesian.js";import{collectAllValues as nt,readNumber as rt}from"../chart/utils/data.js";import{decimateIndices as ot,warnPointBudget as at}from"../chart/utils/decimate.js";import{formatAuto as Be,formatPercent as st,formatXValue as Re}from"../chart/utils/format.js";import{buildAreaPath as we,buildLinePath as Ve}from"../chart/utils/path.js";import{nearestIndex as lt,toKey as Ee,toNumber as it}from"../chart/utils/scales.js";import{stackExtent as ut,stackSeries as ct}from"../chart/utils/stack.js";import{extent as ht}from"../chart/utils/ticks.js";import{Fragment as bt,jsx as a,jsxs as H}from"react/jsx-runtime";var mt=.12,dt=.9,gt=10,ft=Ie(function({bands:g,stacked:r,patterns:m,patternBaseId:p}){return a("g",{children:g.map(u=>H("g",{children:[a("path",{d:u.area,fill:Ye(m,p,u.slot,u.color),fillOpacity:r?dt:mt,stroke:"none"}),u.gap?a("path",{d:u.gap,fill:"none",strokeWidth:2,className:"stroke-white dark:stroke-gray-800"}):null,a("path",{d:u.edge,fill:"none",stroke:u.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]},u.key))})});function pt({width:d,height:g,data:r,resolvedSeries:m,x:p,y:u,grid:b,size:Z,curve:f,stack:v,baseline:x,connectNulls:w,referenceLines:W,annotations:P,annotationsLabel:ue,patterns:q,patternBaseId:J,overlay:ce,maxPoints:C,brush:Q,onBrush:ee,brushLabel:he,syncEnabled:D,margin:te,tooltip:L,onPointClick:M,plotLabel:me,formatValue:y,formatRaw:K,formatX:V}){let[$,X]=ve(null),l=$!==null&&$<r.length?$:null,[de,ge]=ve(null),fe=_e(),s=D?fe:null,t=I(()=>{let e=m.filter(S=>!S.hidden),n=e.map(S=>S.key),o=v!=="none",i=ct(r,n,v),ae=o?ut(i):ht([...nt(r,n),x]),h=Je({width:d,height:g,data:r,x:p,y:u,bounds:ae,margin:te,placement:"point",formatValue:y,formatX:V,defaultIncludeZero:!0}),Ce=h.categoryCenters,se=h.valueScale,Te=se(o?0:x),Ne=e.map((S,ye)=>{let U=r.map((F,j)=>{let B=i[j].segments[ye];return{x:Ce[j],y:B.value===null?Number.NaN:se(B.end),defined:B.value!==null}}),xe=r.map((F,j)=>{let B=i[j].segments[ye];return{x:Ce[j],y:B.value===null?Number.NaN:se(o?B.start:x),defined:B.value!==null}}),le={connectNulls:w},ie=C&&C>0&&U.length>C?ot(U,C):null,ke=ie?ie.map(F=>U[F]):U,Pe=ie?ie.map(F=>xe[F]):xe;return C||at("AreaChart",U.length),{key:S.key,color:S.color,slot:S.slot,area:o?we(ke,Pe,f,le):we(ke,Te,f,le),edge:Ve(ke,f,le),gap:o&&ye>0?Ve(Pe,f,le):""}});return{visible:e,locate:Qe(h),plot:et({geometry:h,width:d,height:g,data:r,series:e,formatValue:y,formatX:V}),rows:i,stacked:o,xValues:h.xValues,positions:Ce,xTicks:h.categoryTicks,yTicks:h.valueTicks,valueScale:se,innerWidth:h.innerWidth,innerHeight:h.innerHeight,margin:h.margin,bands:Ne}},[r,m,p,u,d,g,te,f,v,x,w,C,y,V]),G=R(e=>t.visible.map((n,o)=>{let i=rt(r[e],n.key),ae=t.rows[e].segments[o],h=i===null?"\u2014":v==="percent"?`${K(i)} (${y(ae.end-ae.start)})`:y(i);return{seriesKey:n.key,seriesLabel:Se(n),color:n.color,value:i,formattedValue:h,datum:r[e]}}),[r,t.visible,t.rows,v,y,K]),ne=s?s.brush:de,re=R(e=>{ge(e),s?.setBrush(e),ee?.(e)},[s,ee]),c=$e({enabled:Q,active:ne!==null,centers:t.positions,xValues:t.xValues,offset:t.margin.left,orientation:"vertical",onCommit:re}),pe=R(e=>{if(c.onPointerMove(e),L===!1||r.length===0)return;let n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-t.margin.left,i=lt(t.positions,o);X(i>=0?i:null),s?.setHovered(i>=0?t.xValues[i]:null)},[c,L,r.length,t.margin.left,t.positions,t.xValues,s]),oe=R(()=>{X(null),s?.setHovered(null)},[s]),E=R(e=>{if(r.length===0)return;c.onKeyDown(e,l);let n=r.length-1,o=l??0,i=e.key==="ArrowRight"?Math.min(n,o+1):e.key==="ArrowLeft"?Math.max(0,o-1):e.key==="Home"?0:e.key==="End"?n:e.key==="Escape"?null:void 0;i!==void 0&&(e.preventDefault(),X(i),s?.setHovered(i===null?null:t.xValues[i]))},[r.length,l,c,s,t.xValues]),T=R(()=>{if(c.consumedClick()||!M||l===null)return;let[e]=G(l);e&&M({...e,index:l,x:t.xValues[l]})},[c,M,l,G,t.xValues]),be=l!==null||!s?.hovered?null:(()=>{let e=Ee(s.hovered),n=t.xValues.findIndex(o=>Ee(o)===e);return n<0?null:n})(),k=l??be,O=l===null?null:G(l),N=k===null?[]:t.visible.map((e,n)=>{let o=t.rows[k].segments[n];return o.value===null?null:{key:e.key,color:e.color,y:t.valueScale(o.end)}}).filter(e=>e!==null),z=c.dragging??ne,Y=(()=>{if(!z)return null;let e=t.locate(z.from),n=t.locate(z.to);return e===null||n===null?null:{from:e,to:n}})(),_=tt(ce),A=l===null||O===null?null:{x:t.xValues[l],xLabel:V(t.xValues[l],l),index:l,points:O};return H(bt,{children:[H("svg",{width:d,height:g,role:"img","aria-label":me??[t.visible.map(e=>Se(e)).join(", "),Me(P,ue)].filter(Boolean).join(". "),tabIndex:0,className:We("touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",Q&&"select-none"),onPointerDown:c.onPointerDown,onPointerMove:pe,onPointerUp:c.onPointerUp,onPointerCancel:c.onPointerUp,onPointerLeave:oe,onKeyDown:E,onBlur:oe,onClick:T,children:[q?a(ze,{id:J,entries:m.map(e=>({slot:e.slot,color:e.color}))}):null,H("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:[a(Ge,{width:t.innerWidth,height:t.innerHeight,horizontal:b==="y"||b==="both"?t.yTicks.map(e=>e.offset):void 0,vertical:b==="x"||b==="both"?t.xTicks.map(e=>e.offset):void 0}),P?a(Le,{layer:"under",annotations:P,xAt:t.locate,yAt:t.valueScale,width:t.innerWidth,height:t.innerHeight}):null,Y?a(Ke,{from:Y.from,to:Y.to,width:t.innerWidth,height:t.innerHeight,live:c.dragging!==null,label:he}):null,_.under?.(t.plot),a(ft,{bands:t.bands,stacked:t.stacked,patterns:q&&t.stacked,patternBaseId:J}),P?a(Le,{annotations:P,xAt:t.locate,yAt:t.valueScale,width:t.innerWidth,height:t.innerHeight}):null,W?.map(e=>{let n=t.valueScale(e.value),o=n<gt?n+12:n-4;return H("g",{children:[a("line",{x1:0,y1:n,x2:t.innerWidth,y2:n,stroke:e.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:e.dashed===!1?void 0:"4 4"}),e.label?a("text",{x:t.innerWidth,y:o,textAnchor:"end",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:e.label}):null]},`${e.value}-${e.label??""}`)}),_.over?.(t.plot),k!==null?H("g",{"aria-hidden":"true",children:[a("line",{x1:t.positions[k],y1:0,x2:t.positions[k],y2:t.innerHeight,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:1,strokeDasharray:l===null?"3 3":void 0}),N.map(e=>a("circle",{cx:t.positions[k],cy:e.y,r:4,fill:e.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},e.key))]}):null]}),a("g",{transform:`translate(${t.margin.left}, ${t.margin.top+t.innerHeight})`,children:p.hidden?null:a(Ae,{orientation:"bottom",ticks:t.xTicks,length:t.innerWidth,label:p.label,size:Z})}),a("g",{transform:`translate(${t.margin.left}, ${t.margin.top})`,children:u?.hidden?null:a(Ae,{orientation:"left",ticks:t.yTicks,length:t.innerHeight,showLine:!1,label:u?.label,size:Z})})]}),A&&L!==!1?a(Fe,{x:t.margin.left+t.positions[A.index],y:t.margin.top+(N.length>0?Math.min(...N.map(e=>e.y)):t.innerHeight/2),containerWidth:d,children:typeof L=="function"?L(A):a(je,{title:A.xLabel,points:A.points})}):null]})}function $t({data:d,series:g,x:r,y:m,height:p=240,width:u,size:b="md",grid:Z="y",legend:f,tooltip:v=!0,tableView:x=!1,emphasis:w,title:W,description:P,loading:ue=!1,emptyState:q,error:J=!1,errorState:ce,onRetry:C,actions:Q,onPointClick:ee,curve:he="monotone",stack:D="none",baseline:te=0,connectNulls:L=!1,referenceLines:M,annotations:me,overlay:y,patterns:K=!1,legendToggle:V=!0,maxPoints:$,brush:X=!1,onBrush:l,brushLabel:de,sync:ge=!0,margin:fe,locale:s,plotLabel:t,className:G,...ne}){let re=De(),[c,pe]=ve(()=>new Set),oe=He(),E=I(()=>g.map((e,n)=>({...e,slot:n,hidden:e.hidden||c.has(e.key),color:Ze(e,n,w)})),[g,c,w]),T=D==="percent",be=I(()=>T?{domain:[0,100],...m}:m,[T,m]),k=I(()=>m?.format??(T?e=>st(e,{locale:s,alreadyScaled:!0,maximumFractionDigits:0}):e=>Be(e,s)),[m?.format,T,s]),O=I(()=>e=>Be(e,s),[s]),N=I(()=>r.format??(e=>r.scale==="time"?Re(e instanceof Date?e:new Date(it(e)),s):Re(e,s)),[r.format,r.scale,s]),z=R(e=>{pe(n=>{let o=new Set(n);return o.has(e)?o.delete(e):o.add(e),o})},[]),Y=f===void 0?g.length>=2:f!==!1,_=typeof f=="string"?f:"bottom",A=E.filter(e=>!e.hidden).length;return a(Xe,{title:W,description:P,height:p,width:u,size:b,loading:ue,empty:d.length===0||A===0,emptyState:q,error:J,errorState:ce,onRetry:C,actions:Q,tableView:x,legendPosition:_,legend:Y?a(Oe,{items:qe(E,w,K&&D!=="none"),position:_,marker:"rect",size:b,onToggle:V?z:void 0}):void 0,table:x?a(Ue,{data:d,series:E,xKey:r.key,xLabel:r.label??r.key,formatX:N,formatValue:O,caption:typeof W=="string"?W:void 0}):void 0,className:G,...ne,children:({width:e})=>a(pt,{width:e,height:p,data:d,resolvedSeries:E,x:r,y:be,grid:Z,size:b,curve:he,stack:D,baseline:te,connectNulls:L,referenceLines:M,annotations:me,annotationsLabel:re.chartAnnotations,patterns:K,patternBaseId:oe,overlay:y,maxPoints:$,brush:X,onBrush:l,brushLabel:de??re.chartBrush,syncEnabled:ge,margin:fe,tooltip:v,onPointClick:ee,plotLabel:t,formatValue:k,formatRaw:O,formatX:N})})}export{$t as AreaChart};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var m=(a,r)=>{for(var t in r)o(a,t,{get:r[t],enumerable:!0})},x=(a,r,t,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of C(r))!f.call(a,e)&&e!==t&&o(a,e,{get:()=>r[e],enumerable:!(p=A(r,e))||p.enumerable});return a};var s=a=>x(o({},"__esModule",{value:!0}),a);var y={};m(y,{AreaChart:()=>h.AreaChart});module.exports=s(y);var h=require("./AreaChart.cjs");0&&(module.exports={AreaChart});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AreaChart as e}from"./AreaChart.js";export{e as AreaChart};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var f=(r,e)=>{for(var a in e)o(r,a,{get:e[a],enumerable:!0})},p=(r,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of g(e))!x.call(r,t)&&t!==a&&o(r,t,{get:()=>e[t],enumerable:!(s=m(e,t))||s.enumerable});return r};var u=r=>p(o({},"__esModule",{value:!0}),r);var b={};f(b,{Avatar:()=>w});module.exports=u(b);var i=require("../../lib/cn.cjs"),n=require("react/jsx-runtime"),h={xs:"h-6 w-6 text-xs",sm:"h-8 w-8 text-sm",md:"h-10 w-10 text-base",lg:"h-12 w-12 text-lg",xl:"h-16 w-16 text-xl"},v={circle:"rounded-full",square:"rounded-none",rounded:"rounded-md"};function w({src:r,alt:e="Avatar",fallback:a,size:s="md",variant:t="circle",border:l=!1,className:d,...c}){return(0,n.jsx)("div",{className:(0,i.cn)("inline-flex items-center justify-center overflow-hidden bg-gray-200 font-medium text-gray-600 dark:bg-gray-700 dark:text-gray-300",h[s],v[t],l&&"ring-2 ring-white dark:ring-gray-900",d),...c,children:r?(0,n.jsx)("img",{src:r,alt:e,className:"h-full w-full object-cover"}):(0,n.jsx)("span",{children:a||e.charAt(0).toUpperCase()})})}0&&(module.exports={Avatar});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cn as d}from"../../lib/cn.js";import{jsx as e}from"react/jsx-runtime";var c={xs:"h-6 w-6 text-xs",sm:"h-8 w-8 text-sm",md:"h-10 w-10 text-base",lg:"h-12 w-12 text-lg",xl:"h-16 w-16 text-xl"},m={circle:"rounded-full",square:"rounded-none",rounded:"rounded-md"};function x({src:r,alt:t="Avatar",fallback:a,size:s="md",variant:n="circle",border:o=!1,className:i,...l}){return e("div",{className:d("inline-flex items-center justify-center overflow-hidden bg-gray-200 font-medium text-gray-600 dark:bg-gray-700 dark:text-gray-300",c[s],m[n],o&&"ring-2 ring-white dark:ring-gray-900",i),...l,children:r?e("img",{src:r,alt:t,className:"h-full w-full object-cover"}):e("span",{children:a||t.charAt(0).toUpperCase()})})}export{x as Avatar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var x=(a,r)=>{for(var o in r)p(a,o,{get:r[o],enumerable:!0})},s=(a,r,o,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of f(r))!m.call(a,t)&&t!==o&&p(a,t,{get:()=>r[t],enumerable:!(e=A(r,t))||e.enumerable});return a};var y=a=>s(p({},"__esModule",{value:!0}),a);var P={};x(P,{Avatar:()=>v.Avatar});module.exports=y(P);var v=require("./Avatar.cjs");0&&(module.exports={Avatar});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Avatar as t}from"./Avatar.js";export{t as Avatar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var g=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of u(e))!k.call(t,d)&&d!==r&&g(t,d,{get:()=>e[d],enumerable:!(o=p(e,d))||o.enumerable});return t};var w=t=>c(g({},"__esModule",{value:!0}),t);var C={};y(C,{Badge:()=>n});module.exports=w(C);var l=require("../../lib/cn.cjs"),a=require("react/jsx-runtime"),f={default:{solid:"bg-gray-500 text-white",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",outlined:"border border-gray-300 text-gray-600 dark:border-gray-600 dark:text-gray-400",subtle:"bg-gray-50 text-gray-600 dark:bg-gray-800 dark:text-gray-400"},primary:{solid:"bg-blue-600 text-white",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",outlined:"border border-blue-500 text-blue-600 dark:border-blue-400 dark:text-blue-400",subtle:"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400"},success:{solid:"bg-green-600 text-white",soft:"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",outlined:"border border-green-500 text-green-600 dark:border-green-400 dark:text-green-400",subtle:"bg-green-50 text-green-600 dark:bg-green-900/30 dark:text-green-400"},warning:{solid:"bg-yellow-500 text-white",soft:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",outlined:"border border-yellow-400 text-yellow-600 dark:border-yellow-400 dark:text-yellow-400",subtle:"bg-yellow-50 text-yellow-600 dark:bg-yellow-900/30 dark:text-yellow-400"},error:{solid:"bg-red-600 text-white",soft:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",outlined:"border border-red-500 text-red-600 dark:border-red-400 dark:text-red-400",subtle:"bg-red-50 text-red-600 dark:bg-red-900/30 dark:text-red-400"},info:{solid:"bg-cyan-600 text-white",soft:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",outlined:"border border-cyan-500 text-cyan-600 dark:border-cyan-400 dark:text-cyan-400",subtle:"bg-cyan-50 text-cyan-600 dark:bg-cyan-900/30 dark:text-cyan-400"},purple:{solid:"bg-purple-600 text-white",soft:"bg-purple-100 text-purple-700 dark:bg-purple-900/50 dark:text-purple-300",outlined:"border border-purple-500 text-purple-600 dark:border-purple-400 dark:text-purple-400",subtle:"bg-purple-50 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400"},indigo:{solid:"bg-indigo-600 text-white",soft:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",outlined:"border border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400",subtle:"bg-indigo-50 text-indigo-600 dark:bg-indigo-900/30 dark:text-indigo-400"},teal:{solid:"bg-teal-600 text-white",soft:"bg-teal-100 text-teal-700 dark:bg-teal-900/50 dark:text-teal-300",outlined:"border border-teal-500 text-teal-600 dark:border-teal-400 dark:text-teal-400",subtle:"bg-teal-50 text-teal-600 dark:bg-teal-900/30 dark:text-teal-400"}},m={default:"bg-gray-500",primary:"bg-blue-500",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",purple:"bg-purple-500",indigo:"bg-indigo-500",teal:"bg-teal-500"},h={sm:"text-[10px] px-1.5 py-0.5 gap-1",md:"text-xs px-2 py-0.5 gap-1",lg:"text-sm px-2.5 py-1 gap-1.5"},B={sm:"w-1.5 h-1.5",md:"w-1.5 h-1.5",lg:"w-2 h-2"},R={sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5"};function n({children:t,color:e="default",size:r="md",variant:o="soft",dot:d=!1,icon:i,pill:b=!0,className:s,...x}){return(0,a.jsxs)("span",{className:(0,l.cn)("inline-flex items-center font-medium",h[r],b?"rounded-full":"rounded",f[e][o],s),...x,children:[d&&(0,a.jsx)("span",{className:(0,l.cn)("shrink-0 rounded-full",B[r],m[e]),"aria-hidden":"true"}),i&&!d&&(0,a.jsx)("span",{className:(0,l.cn)("shrink-0",R[r]),"aria-hidden":"true",children:i}),t]})}n.displayName="Badge";0&&(module.exports={Badge});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cn as t}from"../../lib/cn.js";import{jsx as o,jsxs as c}from"react/jsx-runtime";var s={default:{solid:"bg-gray-500 text-white",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",outlined:"border border-gray-300 text-gray-600 dark:border-gray-600 dark:text-gray-400",subtle:"bg-gray-50 text-gray-600 dark:bg-gray-800 dark:text-gray-400"},primary:{solid:"bg-blue-600 text-white",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",outlined:"border border-blue-500 text-blue-600 dark:border-blue-400 dark:text-blue-400",subtle:"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400"},success:{solid:"bg-green-600 text-white",soft:"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",outlined:"border border-green-500 text-green-600 dark:border-green-400 dark:text-green-400",subtle:"bg-green-50 text-green-600 dark:bg-green-900/30 dark:text-green-400"},warning:{solid:"bg-yellow-500 text-white",soft:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",outlined:"border border-yellow-400 text-yellow-600 dark:border-yellow-400 dark:text-yellow-400",subtle:"bg-yellow-50 text-yellow-600 dark:bg-yellow-900/30 dark:text-yellow-400"},error:{solid:"bg-red-600 text-white",soft:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",outlined:"border border-red-500 text-red-600 dark:border-red-400 dark:text-red-400",subtle:"bg-red-50 text-red-600 dark:bg-red-900/30 dark:text-red-400"},info:{solid:"bg-cyan-600 text-white",soft:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",outlined:"border border-cyan-500 text-cyan-600 dark:border-cyan-400 dark:text-cyan-400",subtle:"bg-cyan-50 text-cyan-600 dark:bg-cyan-900/30 dark:text-cyan-400"},purple:{solid:"bg-purple-600 text-white",soft:"bg-purple-100 text-purple-700 dark:bg-purple-900/50 dark:text-purple-300",outlined:"border border-purple-500 text-purple-600 dark:border-purple-400 dark:text-purple-400",subtle:"bg-purple-50 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400"},indigo:{solid:"bg-indigo-600 text-white",soft:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",outlined:"border border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400",subtle:"bg-indigo-50 text-indigo-600 dark:bg-indigo-900/30 dark:text-indigo-400"},teal:{solid:"bg-teal-600 text-white",soft:"bg-teal-100 text-teal-700 dark:bg-teal-900/50 dark:text-teal-300",outlined:"border border-teal-500 text-teal-600 dark:border-teal-400 dark:text-teal-400",subtle:"bg-teal-50 text-teal-600 dark:bg-teal-900/30 dark:text-teal-400"}},x={default:"bg-gray-500",primary:"bg-blue-500",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",purple:"bg-purple-500",indigo:"bg-indigo-500",teal:"bg-teal-500"},p={sm:"text-[10px] px-1.5 py-0.5 gap-1",md:"text-xs px-2 py-0.5 gap-1",lg:"text-sm px-2.5 py-1 gap-1.5"},u={sm:"w-1.5 h-1.5",md:"w-1.5 h-1.5",lg:"w-2 h-2"},k={sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5"};function y({children:l,color:r="default",size:e="md",variant:g="soft",dot:d=!1,icon:a,pill:i=!0,className:n,...b}){return c("span",{className:t("inline-flex items-center font-medium",p[e],i?"rounded-full":"rounded",s[r][g],n),...b,children:[d&&o("span",{className:t("shrink-0 rounded-full",u[e],x[r]),"aria-hidden":"true"}),a&&!d&&o("span",{className:t("shrink-0",k[e]),"aria-hidden":"true",children:a}),l]})}y.displayName="Badge";export{y as Badge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var i=(a,e)=>{for(var r in e)d(a,r,{get:e[r],enumerable:!0})},m=(a,e,r,g)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of t(e))!f.call(a,o)&&o!==r&&d(a,o,{get:()=>e[o],enumerable:!(g=p(e,o))||g.enumerable});return a};var x=a=>m(d({},"__esModule",{value:!0}),a);var l={};i(l,{Badge:()=>B.Badge});module.exports=x(l);var B=require("./Badge.cjs");0&&(module.exports={Badge});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Badge as o}from"./Badge.js";export{o as Badge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var x=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var L=(t,r)=>{for(var o in r)x(t,o,{get:r[o],enumerable:!0})},M=(t,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of y(r))!B.call(t,n)&&n!==o&&x(t,n,{get:()=>r[n],enumerable:!(s=N(r,n))||s.enumerable});return t};var R=t=>M(x({},"__esModule",{value:!0}),t);var z={};L(z,{Banner:()=>C});module.exports=R(z);var v=require("react"),a=require("../../lib/cn.cjs"),e=require("react/jsx-runtime");function k({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M13 16H12V12H11M12 8H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function I({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M9 12L11 14L15 10M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function P({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M12 9V13M12 17H12.01M10.29 3.86L1.82 18C1.65 18.3 1.55 18.65 1.55 18.99C1.55 19.34 1.64 19.69 1.81 19.99C1.99 20.29 2.24 20.55 2.54 20.72C2.84 20.901 3.18 20.99 3.53 21H20.47C20.82 20.99 21.16 20.901 21.46 20.72C21.76 20.55 22.01 20.29 22.19 19.99C22.36 19.69 22.449 19.34 22.448 18.99C22.447 18.65 22.35 18.3 22.18 18L13.71 3.86C13.53 3.57 13.28 3.32 12.98 3.15C12.68 2.99 12.34 2.9 12 2.9C11.66 2.9 11.32 2.99 11.02 3.15C10.72 3.32 10.47 3.57 10.29 3.86Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function W({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M12 8V12M12 16H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function h({className:t}){return(0,e.jsx)("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var V={info:k,success:I,warning:P,error:W,default:k},H={info:"bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-900/20 dark:text-blue-300 dark:border-blue-800",success:"bg-green-50 text-green-800 border-green-200 dark:bg-green-900/20 dark:text-green-300 dark:border-green-800",warning:"bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-300 dark:border-yellow-800",error:"bg-red-50 text-red-800 border-red-200 dark:bg-red-900/20 dark:text-red-300 dark:border-red-800",default:"bg-gray-50 text-gray-800 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"},T={info:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",default:"text-gray-600 dark:text-gray-400"};function j({type:t="default",title:r,description:o,children:s,icon:n,action:i,closable:d=!1,onClose:c,fullWidth:u=!1,className:g,...f}){let[m,b]=(0,v.useState)(!0);if(!m)return null;let l=()=>{b(!1),c?.()},p=V[t],w=s??o;return(0,e.jsxs)("div",{role:"alert",className:(0,a.cn)("flex items-start gap-3 border px-4 py-3",u?"w-full":"rounded-lg",H[t],g),...f,children:[(0,e.jsx)("div",{className:(0,a.cn)("shrink-0 mt-0.5",T[t]),children:n??(0,e.jsx)(p,{className:"w-5 h-5"})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[r&&(0,e.jsx)("div",{className:"font-semibold text-sm",children:r}),w&&(0,e.jsx)("div",{className:(0,a.cn)("text-sm",r?"mt-1 opacity-90":!1),children:w}),i&&(0,e.jsx)("div",{className:"mt-3",children:i})]}),d&&(0,e.jsx)("button",{type:"button",onClick:l,className:(0,a.cn)("shrink-0 rounded-md p-1 transition-colors","hover:bg-black/10 dark:hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-current"),"aria-label":"Close banner",children:(0,e.jsx)(h,{className:"w-4 h-4"})})]})}function O({title:t,description:r,children:o,action:s,backgroundImage:n,closable:i=!1,onClose:d,fullWidth:c=!1,className:u,...g}){let[f,m]=(0,v.useState)(!0);if(!f)return null;let b=()=>{m(!1),d?.()},l=o??r;return(0,e.jsxs)("div",{className:(0,a.cn)("relative overflow-hidden bg-gray-900 text-white",c?"w-full":"rounded-xl","py-12 px-6 sm:px-12",u),style:n?{backgroundImage:`url(${n})`,backgroundSize:"cover",backgroundPosition:"center"}:void 0,...g,children:[n&&(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),(0,e.jsxs)("div",{className:"relative z-10 max-w-3xl mx-auto text-center",children:[t&&(0,e.jsx)("h2",{className:"text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight",children:t}),l&&(0,e.jsx)("div",{className:(0,a.cn)("text-base sm:text-lg opacity-90",t?"mt-4":!1),children:l}),s&&(0,e.jsx)("div",{className:"mt-6",children:s})]}),i&&(0,e.jsx)("button",{type:"button",onClick:b,className:(0,a.cn)("absolute top-4 right-4 z-10 rounded-md p-1.5 text-white/80 transition-colors","hover:text-white hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-white"),"aria-label":"Close banner",children:(0,e.jsx)(h,{className:"w-5 h-5"})})]})}function Z({title:t,description:r,children:o,icon:s,action:n,badge:i,closable:d=!1,onClose:c,fullWidth:u=!1,className:g,...f}){let[m,b]=(0,v.useState)(!0);if(!m)return null;let l=()=>{b(!1),c?.()},p=o??r;return(0,e.jsxs)("div",{className:(0,a.cn)("relative flex items-center gap-4 bg-linear-to-r from-indigo-600 to-purple-600 text-white px-4 py-3",u?"w-full":"rounded-lg",g),...f,children:[s&&(0,e.jsx)("div",{className:"shrink-0",children:s}),i&&(0,e.jsx)("span",{className:"shrink-0 inline-flex items-center rounded-full bg-white/20 px-2.5 py-0.5 text-xs font-semibold uppercase tracking-wide",children:i}),(0,e.jsxs)("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-x-4 gap-y-1",children:[t&&(0,e.jsx)("span",{className:"font-semibold text-sm",children:t}),p&&(0,e.jsx)("span",{className:"text-sm opacity-90",children:p})]}),n&&(0,e.jsx)("div",{className:"shrink-0",children:n}),d&&(0,e.jsx)("button",{type:"button",onClick:l,className:(0,a.cn)("shrink-0 rounded-md p-1 text-white/80 transition-colors","hover:text-white hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-white"),"aria-label":"Close banner",children:(0,e.jsx)(h,{className:"w-4 h-4"})})]})}function C({variant:t="notification",...r}){switch(t){case"hero":return(0,e.jsx)(O,{...r});case"promotion":return(0,e.jsx)(Z,{...r});default:return(0,e.jsx)(j,{...r})}}C.displayName="Banner";0&&(module.exports={Banner});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useState as x}from"react";import{cn as n}from"../../lib/cn.js";import{jsx as e,jsxs as l}from"react/jsx-runtime";function k({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M13 16H12V12H11M12 8H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function C({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M9 12L11 14L15 10M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function N({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M12 9V13M12 17H12.01M10.29 3.86L1.82 18C1.65 18.3 1.55 18.65 1.55 18.99C1.55 19.34 1.64 19.69 1.81 19.99C1.99 20.29 2.24 20.55 2.54 20.72C2.84 20.901 3.18 20.99 3.53 21H20.47C20.82 20.99 21.16 20.901 21.46 20.72C21.76 20.55 22.01 20.29 22.19 19.99C22.36 19.69 22.449 19.34 22.448 18.99C22.447 18.65 22.35 18.3 22.18 18L13.71 3.86C13.53 3.57 13.28 3.32 12.98 3.15C12.68 2.99 12.34 2.9 12 2.9C11.66 2.9 11.32 2.99 11.02 3.15C10.72 3.32 10.47 3.57 10.29 3.86Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function y({className:t}){return e("svg",{className:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M12 8V12M12 16H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function h({className:t}){return e("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var B={info:k,success:C,warning:N,error:y,default:k},L={info:"bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-900/20 dark:text-blue-300 dark:border-blue-800",success:"bg-green-50 text-green-800 border-green-200 dark:bg-green-900/20 dark:text-green-300 dark:border-green-800",warning:"bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-300 dark:border-yellow-800",error:"bg-red-50 text-red-800 border-red-200 dark:bg-red-900/20 dark:text-red-300 dark:border-red-800",default:"bg-gray-50 text-gray-800 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"},M={info:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",default:"text-gray-600 dark:text-gray-400"};function R({type:t="default",title:r,description:d,children:s,icon:o,action:a,closable:c=!1,onClose:u,fullWidth:g=!1,className:f,...m}){let[b,p]=x(!0);if(!b)return null;let i=()=>{p(!1),u?.()},v=B[t],w=s??d;return l("div",{role:"alert",className:n("flex items-start gap-3 border px-4 py-3",g?"w-full":"rounded-lg",L[t],f),...m,children:[e("div",{className:n("shrink-0 mt-0.5",M[t]),children:o??e(v,{className:"w-5 h-5"})}),l("div",{className:"flex-1 min-w-0",children:[r&&e("div",{className:"font-semibold text-sm",children:r}),w&&e("div",{className:n("text-sm",r?"mt-1 opacity-90":!1),children:w}),a&&e("div",{className:"mt-3",children:a})]}),c&&e("button",{type:"button",onClick:i,className:n("shrink-0 rounded-md p-1 transition-colors","hover:bg-black/10 dark:hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-current"),"aria-label":"Close banner",children:e(h,{className:"w-4 h-4"})})]})}function I({title:t,description:r,children:d,action:s,backgroundImage:o,closable:a=!1,onClose:c,fullWidth:u=!1,className:g,...f}){let[m,b]=x(!0);if(!m)return null;let p=()=>{b(!1),c?.()},i=d??r;return l("div",{className:n("relative overflow-hidden bg-gray-900 text-white",u?"w-full":"rounded-xl","py-12 px-6 sm:px-12",g),style:o?{backgroundImage:`url(${o})`,backgroundSize:"cover",backgroundPosition:"center"}:void 0,...f,children:[o&&e("div",{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),l("div",{className:"relative z-10 max-w-3xl mx-auto text-center",children:[t&&e("h2",{className:"text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight",children:t}),i&&e("div",{className:n("text-base sm:text-lg opacity-90",t?"mt-4":!1),children:i}),s&&e("div",{className:"mt-6",children:s})]}),a&&e("button",{type:"button",onClick:p,className:n("absolute top-4 right-4 z-10 rounded-md p-1.5 text-white/80 transition-colors","hover:text-white hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-white"),"aria-label":"Close banner",children:e(h,{className:"w-5 h-5"})})]})}function P({title:t,description:r,children:d,icon:s,action:o,badge:a,closable:c=!1,onClose:u,fullWidth:g=!1,className:f,...m}){let[b,p]=x(!0);if(!b)return null;let i=()=>{p(!1),u?.()},v=d??r;return l("div",{className:n("relative flex items-center gap-4 bg-linear-to-r from-indigo-600 to-purple-600 text-white px-4 py-3",g?"w-full":"rounded-lg",f),...m,children:[s&&e("div",{className:"shrink-0",children:s}),a&&e("span",{className:"shrink-0 inline-flex items-center rounded-full bg-white/20 px-2.5 py-0.5 text-xs font-semibold uppercase tracking-wide",children:a}),l("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-x-4 gap-y-1",children:[t&&e("span",{className:"font-semibold text-sm",children:t}),v&&e("span",{className:"text-sm opacity-90",children:v})]}),o&&e("div",{className:"shrink-0",children:o}),c&&e("button",{type:"button",onClick:i,className:n("shrink-0 rounded-md p-1 text-white/80 transition-colors","hover:text-white hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-white"),"aria-label":"Close banner",children:e(h,{className:"w-4 h-4"})})]})}function W({variant:t="notification",...r}){switch(t){case"hero":return e(I,{...r});case"promotion":return e(P,{...r});default:return e(R,{...r})}}W.displayName="Banner";export{W as Banner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var x=(r,n)=>{for(var a in n)o(r,a,{get:n[a],enumerable:!0})},y=(r,n,a,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of f(n))!m.call(r,e)&&e!==a&&o(r,e,{get:()=>n[e],enumerable:!(p=t(n,e))||p.enumerable});return r};var i=r=>y(o({},"__esModule",{value:!0}),r);var s={};x(s,{Banner:()=>B.Banner});module.exports=i(s);var B=require("./Banner.cjs");0&&(module.exports={Banner});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Banner as e}from"./Banner.js";export{e as Banner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var Qe=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Tt=Object.prototype.hasOwnProperty;var It=(g,c)=>{for(var n in c)Qe(g,n,{get:c[n],enumerable:!0})},Dt=(g,c,n,m)=>{if(c&&typeof c=="object"||typeof c=="function")for(let d of Vt(c))!Tt.call(g,d)&&d!==n&&Qe(g,d,{get:()=>c[d],enumerable:!(m=Mt(c,d))||m.enumerable});return g};var Wt=g=>Dt(Qe({},"__esModule",{value:!0}),g);var Gt={};It(Gt,{BarChart:()=>zt,resetBarChartWarnings:()=>Ot});module.exports=Wt(Gt);var s=require("react"),dt=require("../../lib/cn.cjs"),mt=require("../../lib/i18n.cjs"),we=require("../chart/ChartAnnotations.cjs"),et=require("../chart/ChartAxis.cjs"),$e=require("../chart/ChartBrush.cjs"),ft=require("../chart/ChartContainer.cjs"),gt=require("../chart/ChartGrid.cjs"),bt=require("../chart/ChartLegend.cjs"),Oe=require("../chart/ChartPatterns.cjs"),pt=require("../chart/ChartScaleLegend.cjs"),yt=require("../chart/ChartSync.cjs"),Ct=require("../chart/ChartTableView.cjs"),Ke=require("../chart/ChartTooltip.cjs"),L=require("../chart/palette.cjs"),X=require("../chart/utils/cartesian.cjs"),T=require("../chart/utils/data.cjs"),de=require("../chart/utils/format.cjs"),vt=require("../chart/utils/bins.cjs"),_e=require("../chart/utils/path.cjs"),Se=require("../chart/utils/scales.cjs"),me=require("../chart/utils/stack.cjs"),xt=require("../chart/utils/text.cjs"),Be=require("../chart/utils/ticks.cjs"),r=require("react/jsx-runtime"),Ht=24,ne=2,Nt=4,he=6,$t=10,tt=!1,nt=!1;function Ot(){tt=!1,nt=!1}var Kt=(0,s.memo)(function({bars:c,patterns:n,patternBaseId:m}){return(0,r.jsx)("g",{children:c.map((d,A)=>(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{d:d.d,fill:(0,Oe.patternFill)(n,m,d.slot,d.color)}),d.label?(0,r.jsx)("text",{x:d.label.x,y:d.label.y,textAnchor:d.label.anchor,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] [font-variant-numeric:tabular-nums] dark:fill-gray-300",children:d.label.text}):null]},`${d.key}-${A}`))})}),_t=(0,s.memo)(function({lines:c}){return(0,r.jsx)("g",{children:c.map(n=>(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{d:n.d,fill:"none",stroke:n.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:n.dashed?"5 4":void 0}),n.markers.map(m=>(0,r.jsx)("circle",{cx:m.x,cy:m.y,r:3,fill:n.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${m.x}-${m.y}`))]},n.key))})});function Xt({width:g,height:c,data:n,resolvedSeries:m,x:d,y:A,grid:I,size:Pe,orientation:R,stack:N,center:E,centerKey:D,valueColors:z,binned:re,curve:Le,barSize:Ae,showValues:Re,referenceLines:Xe,annotations:G,annotationsLabel:ze,patterns:Ee,patternBaseId:oe,overlay:Me,brush:M,onBrush:U,brushLabel:Ge,syncEnabled:Ue,margin:ae,tooltip:F,onPointClick:fe,plotLabel:Ve,formatValue:$,formatRaw:Y,formatX:le}){let[ge,be]=(0,s.useState)(null),f=ge!==null&&ge<n.length?ge:null,[Fe,Ye]=(0,s.useState)(null),W=(0,yt.useChartSync)(),C=Ue?W:null,e=(0,s.useMemo)(()=>{let t=R==="vertical",o=m.filter(p=>!p.hidden),l=o.filter(p=>p.type!=="line"),y=o.filter(p=>p.type==="line"),w=l.map(p=>p.key),b=D!==null||N!=="none",K=D!==null?(0,me.stackDiverging)(n,w,{centerKey:D,percent:N==="percent"}):(0,me.stackSeries)(n,w,N),i=b?(0,me.stackExtent)(K):(0,Be.extent)((0,T.collectAllValues)(n,w)),a=(0,Be.extent)((0,T.collectAllValues)(n,y.map(p=>p.key))),u=i===null?a:a===null?i:[Math.min(i[0],a[0]),Math.max(i[1],a[1])],h=(0,X.buildCartesianGeometry)({width:g,height:c,data:n,x:d,y:A,bounds:u===null?null:[Math.min(u[0],E),Math.max(u[1],E)],margin:ae,orientation:R,placement:"band",bandPaddingInner:re?0:void 0,formatValue:$,formatX:le,defaultIncludeZero:E===0}),{valueScale:J,bandwidth:ve,categoryPositions:rt,innerWidth:ot,innerHeight:at}=h,kt=J(E),De=Math.max(1,l.length),wt=b?ve:ve/De,_=Math.min(Ae??(re?Number.POSITIVE_INFINITY:Ht),Math.max(1,wt-(b&&!re?0:ne))),St=b?_:De*_+(De-1)*ne,lt=(ve-St)/2,it=[],st=p=>b?p.end>=p.start:p.end>=E;K.forEach((p,We)=>{let Q=-1,He=-1;p.segments.forEach((P,ce)=>{P.value!==null&&P.outer!==!1&&(st(P)?Q=ce:He=ce)});let se=0,xe=0;p.segments.forEach((P,ce)=>{if(P.value===null)return;let je=l[ce],v=st(P),ct=J(b?P.start:E),ut=J(P.end),ee=Math.min(ct,ut),ue=Math.abs(ut-ct),Pt=P.base??(v?se===0:xe===0),Lt=t?!v:v;b&&!Pt&&ue>ne&&(ue-=ne,Lt&&(ee+=ne)),v?se+=1:xe+=1;let Ne=rt[We]+(b?lt:lt+ce*(_+ne)),At=ce===(v?Q:He)?t?v?"top":"bottom":v?"right":"left":"none",Rt=t?{x:Ne,y:ee,width:_,height:ue}:{x:ee,y:Ne,width:ue,height:_},qe=null;if(Re&&!b){let Je=Y(P.value),ht=(0,xt.estimateTextWidth)(Je,10);if(t){let te=v?ee:ee+ue,ke=v?te-he:te+he,Et=De>1?_+ne:ve;ht<=Et&&(v?ke>8:ke<at-4)&&(qe={x:Ne+_/2,y:ke,anchor:"middle",text:Je})}else{let te=v?ee+ue:ee,ke=v?ot-te-he:te-he;ht<=ke&&(qe={x:v?te+he:te-he,y:Ne+_/2,anchor:v?"start":"end",text:Je})}}it.push({key:je.key,slot:je.slot,color:z&&P.value!==null?z(P.value):je.color,d:(0,_e.buildBarPath)({...Rt,radius:Nt,round:At}),label:qe})})});let Bt=y.map(p=>{let We=h.categoryCenters.map((Q,He)=>{let se=(0,T.readNumber)(n[He],p.key),xe=se===null?Number.NaN:J(se);return{x:t?Q:xe,y:t?xe:Q,defined:se!==null}});return{key:p.key,color:p.color,dashed:p.dashed,d:(0,_e.buildLinePath)(We,Le),markers:We.filter(Q=>Q.defined!==!1)}});return{vertical:t,visible:o,locate:(0,X.createCategoryLocator)(h),barSeries:l,rows:K,stacked:b,plot:(0,X.createPlotContext)({geometry:h,width:g,height:c,data:n,series:o,formatValue:$,formatX:le}),xValues:h.xValues,categoryPositions:rt,categoryCenters:h.categoryCenters,bandwidth:ve,categoryTicks:h.categoryTicks,valueTicks:h.valueTicks,valueScale:J,baseline:kt,innerWidth:ot,innerHeight:at,margin:h.margin,bars:it,lines:Bt}},[n,m,d,A,g,c,ae,R,N,E,D,z,re,Le,Ae,Re,$,Y,le]),pe=(0,s.useCallback)(t=>e.visible.map(o=>{let l=(0,T.readNumber)(n[t],o.key),y=e.barSeries.indexOf(o),w=y===-1?null:e.rows[t].segments[y],b=l===null?"\u2014":N==="percent"&&w!==null?`${Y(l)} (${$(w.end-w.start)})`:$(l);return{seriesKey:o.key,seriesLabel:(0,L.getSeriesLabel)(o),color:o.color,value:l,formattedValue:b,datum:n[t]}}),[n,e.visible,e.barSeries,e.rows,N,$,Y]),ye=C?C.brush:Fe,Te=(0,s.useCallback)(t=>{Ye(t),C?.setBrush(t),U?.(t)},[C,U]),x=(0,$e.useChartBrush)({enabled:M,active:ye!==null,centers:e.categoryCenters,xValues:e.xValues,offset:e.vertical?e.margin.left:e.margin.top,orientation:R,onCommit:Te}),Ze=(0,s.useCallback)(t=>{if(x.onPointerMove(t),F===!1||n.length===0)return;let o=t.currentTarget.getBoundingClientRect(),l=e.vertical?t.clientX-o.left-e.margin.left:t.clientY-o.top-e.margin.top,y=(0,Se.nearestIndex)(e.categoryCenters,l);be(y>=0?y:null),C?.setHovered(y>=0?e.xValues[y]:null)},[x,F,n.length,e.vertical,e.margin,e.categoryCenters,e.xValues,C]),S=(0,s.useCallback)(()=>{be(null),C?.setHovered(null)},[C]),k=(0,s.useCallback)(t=>{if(n.length===0)return;x.onKeyDown(t,f);let o=n.length-1,l=f??0,y=e.vertical?"ArrowRight":"ArrowDown",w=e.vertical?"ArrowLeft":"ArrowUp",b=t.key===y?Math.min(o,l+1):t.key===w?Math.max(0,l-1):t.key==="Home"?0:t.key==="End"?o:t.key==="Escape"?null:void 0;b!==void 0&&(t.preventDefault(),be(b),C?.setHovered(b===null?null:e.xValues[b]))},[n.length,f,e.vertical,x,C,e.xValues]),Z=(0,s.useCallback)(()=>{if(x.consumedClick()||!fe||f===null)return;let[t]=pe(f);t&&fe({...t,index:f,x:e.xValues[f]})},[x,fe,f,pe,e.xValues]),O=f!==null||!C?.hovered?null:(()=>{let t=(0,Se.toKey)(C.hovered),o=e.xValues.findIndex(l=>(0,Se.toKey)(l)===t);return o<0?null:o})(),V=f??O,B=x.dragging??ye,H=(()=>{if(!B)return null;let t=e.locate(B.from),o=e.locate(B.to);if(t===null||o===null)return null;let l=e.bandwidth/2;return{from:Math.min(t,o)-l,to:Math.max(t,o)+l}})(),j=(0,X.splitOverlay)(Me),Ie=f===null?null:pe(f),q=f===null||Ie===null?null:{x:e.xValues[f],xLabel:le(e.xValues[f],f),index:f,points:Ie},Ce=t=>{let o=e.rows[t].segments.filter(l=>l.value!==null).map(l=>e.valueScale(l.end));for(let l of e.lines){let y=(0,T.readNumber)(n[t],l.key);y!==null&&o.push(e.valueScale(y))}return o},ie=f===null?null:e.vertical?{x:e.margin.left+e.categoryCenters[f],y:e.margin.top+Math.min(...Ce(f),e.baseline)}:{x:e.margin.left+Math.max(...Ce(f),e.baseline),y:e.margin.top+e.categoryCenters[f]};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{width:g,height:c,role:"img","aria-label":Ve??[e.visible.map(t=>(0,L.getSeriesLabel)(t)).join(", "),(0,we.describeAnnotations)(G,ze)].filter(Boolean).join(". "),tabIndex:0,className:(0,dt.cn)("touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",M&&"select-none"),onPointerDown:x.onPointerDown,onPointerMove:Ze,onPointerUp:x.onPointerUp,onPointerCancel:x.onPointerUp,onPointerLeave:S,onKeyDown:k,onBlur:S,onClick:Z,children:[Ee?(0,r.jsx)(Oe.ChartPatternDefs,{id:oe,entries:m.map(t=>({slot:t.slot,color:t.color}))}):null,(0,r.jsxs)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[(0,r.jsx)(gt.ChartGrid,{width:e.innerWidth,height:e.innerHeight,horizontal:e.vertical&&(I==="y"||I==="both")?e.valueTicks.map(t=>t.offset):void 0,vertical:!e.vertical&&(I==="y"||I==="both")?e.valueTicks.map(t=>t.offset):void 0}),G?(0,r.jsx)(we.ChartAnnotationLayer,{layer:"under",annotations:G,xAt:e.locate,yAt:e.valueScale,width:e.innerWidth,height:e.innerHeight,bandwidth:e.bandwidth}):null,H?(0,r.jsx)($e.ChartBrushLayer,{from:H.from,to:H.to,width:e.innerWidth,height:e.innerHeight,orientation:R,live:x.dragging!==null,label:Ge}):null,V!==null?(0,r.jsx)("rect",{x:e.vertical?e.categoryPositions[V]:0,y:e.vertical?0:e.categoryPositions[V],width:e.vertical?e.bandwidth:e.innerWidth,height:e.vertical?e.innerHeight:e.bandwidth,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,j.under?.(e.plot),(0,r.jsx)(Kt,{bars:e.bars,patterns:Ee,patternBaseId:oe}),e.lines.length>0?(0,r.jsx)(_t,{lines:e.lines}):null,(0,r.jsx)("line",{x1:e.vertical?0:e.baseline,y1:e.vertical?e.baseline:0,x2:e.vertical?e.innerWidth:e.baseline,y2:e.vertical?e.baseline:e.innerHeight,className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,shapeRendering:"crispEdges"}),G?(0,r.jsx)(we.ChartAnnotationLayer,{annotations:G,xAt:e.locate,yAt:e.valueScale,width:e.innerWidth,height:e.innerHeight,bandwidth:e.bandwidth}):null,j.over?.(e.plot),Xe?.map(t=>{let o=e.valueScale(t.value),l=o<$t?o+12:o-4;return(0,r.jsxs)("g",{children:[(0,r.jsx)("line",{x1:e.vertical?0:o,y1:e.vertical?o:0,x2:e.vertical?e.innerWidth:o,y2:e.vertical?o:e.innerHeight,stroke:t.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"4 4"}),t.label?(0,r.jsx)("text",{x:e.vertical?e.innerWidth:o+4,y:e.vertical?l:8,textAnchor:e.vertical?"end":"start",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)})]}),(0,r.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:(e.vertical?d.hidden:A?.hidden)?null:(0,r.jsx)(et.ChartAxis,{orientation:"bottom",ticks:e.vertical?e.categoryTicks:e.valueTicks,length:e.innerWidth,label:e.vertical?d.label:A?.label,size:Pe})}),(0,r.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:(e.vertical?A?.hidden:d.hidden)?null:(0,r.jsx)(et.ChartAxis,{orientation:"left",ticks:e.vertical?e.valueTicks:e.categoryTicks,length:e.innerHeight,showLine:!1,label:e.vertical?A?.label:d.label,size:Pe})})]}),q&&ie&&F!==!1?(0,r.jsx)(Ke.ChartTooltip,{x:ie.x,y:ie.y,containerWidth:g,children:typeof F=="function"?F(q):(0,r.jsx)(Ke.ChartTooltipContent,{title:q.xLabel,points:q.points})}):null]})}function zt({data:g,series:c,x:n,y:m,height:d=260,width:A,size:I="md",grid:Pe="y",legend:R,tooltip:N=!0,tableView:E=!1,emphasis:D,title:z,description:re,loading:Le=!1,emptyState:Ae,error:Re=!1,errorState:Xe,onRetry:G,actions:ze,onPointClick:Ee,orientation:oe="vertical",stack:Me="none",diverging:M,bins:U,curve:Ge="linear",barSize:Ue,sort:ae="none",showValues:F=!1,referenceLines:fe,annotations:Ve,overlay:$,patterns:Y=!1,legendToggle:le=!0,brush:ge=!1,onBrush:be,brushLabel:f,sync:Fe=!0,margin:Ye,locale:W,plotLabel:C,className:e,...pe}){let ye=(0,mt.useUILabels)(),[Te,x]=(0,s.useState)(()=>new Set),Ze=(0,s.useId)(),S=U!==void 0&&U!==!1,k=S||typeof M!="string"?null:M,Z=!S&&typeof M=="number"?M:0,O=(0,s.useMemo)(()=>{let i=k===null?null:(0,L.createDivergingScale)([0,Math.max(1,c.length-1)],{center:Math.max(0,c.findIndex(a=>a.key===k)),symmetric:!1});return c.map((a,u)=>({...a,slot:u,hidden:a.hidden||Te.has(a.key),color:i&&!a.color&&!D?a.key===k?L.CHART_MUTED_COLOR:i(u):(0,L.resolveSeriesColor)(a,u,D)}))},[c,Te,D,k]),V=(0,s.useMemo)(()=>i=>(0,de.formatAuto)(i,W),[W]),B=(0,s.useMemo)(()=>{if(!S)return null;c.length>1&&!tt&&(tt=!0,console.warn("[@synertech/ui] BarChart was given `bins` and more than one series. A histogram counts a single field \u2014 the extra series are ignored. Facet the chart, or draw the distributions side by side."));let i=c[0]?.key??"count",a=n.format?h=>n.format(h,0):h=>V(h),u=(0,vt.binValues)(g.map(h=>(0,T.readNumber)(h,n.key)),U);return{rows:u.map(h=>({[n.key]:h.from,[i]:h.count})),labels:u.map(h=>`${a(h.from)}\u2013${a(h.to)}`)}},[S,U,g,n.key,n.format,c,V]),H=(0,s.useMemo)(()=>{if(B)return B.rows;if(ae==="none")return g;let i=O.filter(u=>!u.hidden).map(u=>u.key),a=u=>i.reduce((h,J)=>h+((0,T.readNumber)(u,J)??0),0);return[...g].sort((u,h)=>ae==="asc"?a(u)-a(h):a(h)-a(u))},[B,g,ae,O]),j=!S&&Me==="percent",Ie=(0,s.useMemo)(()=>j?{domain:k===null?[0,100]:[-100,100],...m}:m,[j,k,m]),q=(0,s.useMemo)(()=>{let i=m?.format??(j?a=>(0,de.formatPercent)(a,{locale:W,alreadyScaled:!0,maximumFractionDigits:0}):V);return k===null?i:a=>i(Math.abs(a))},[m?.format,j,W,V,k]),Ce=(0,s.useMemo)(()=>B?(i,a)=>B.labels[a]??"":n.format??(i=>(0,de.formatXValue)(i,W)),[B,n.format,W]),ie=(0,s.useMemo)(()=>B?{...n,scale:"category"}:n,[B,n]),t=(0,s.useCallback)(i=>{x(a=>{let u=new Set(a);return u.has(i)?u.delete(i):u.add(i),u})},[]),o=oe==="vertical"?Ve:void 0;Ve&&oe!=="vertical"&&!nt&&(nt=!0,console.warn("[@synertech/ui] BarChart was given `annotations` and a horizontal orientation. Annotations are read on the category axis, which runs up the side there: they are ignored. Use `referenceLines` for a threshold on the value axis."));let l=R===void 0?c.length>=2:R!==!1,y=typeof R=="string"?R:"bottom",w=O.filter(i=>!i.hidden),b=w.length,K=(0,s.useMemo)(()=>{if(S||M===void 0||M===!1||k!==null||b!==1)return null;let i=(0,T.collectAllValues)(H,w.map(u=>u.key)),a=(0,Be.resolveDomain)([...i,Z],{domain:m?.domain,includeZero:m?.includeZero??Z===0,ticks:m?.ticks??5});return(0,L.createDivergingScale)(a,{center:Z})},[S,M,k,b,w,H,Z,m]);return(0,r.jsx)(ft.ChartContainer,{title:z,description:re,height:d,width:A,size:I,loading:Le,empty:H.length===0||b===0,emptyState:Ae,error:Re,errorState:Xe,onRetry:G,actions:ze,tableView:E,legendPosition:y,legend:K?(0,r.jsx)(pt.ChartScaleLegend,{scale:K,label:m?.label,format:q,size:I,locale:W}):l?(0,r.jsx)(bt.ChartLegend,{items:(0,L.toLegendItems)(O,D,Y),position:y,marker:"rect",size:I,onToggle:le?t:void 0}):void 0,table:E?(0,r.jsx)(Ct.ChartTableView,{data:H,series:O,xKey:ie.key,xLabel:n.label??n.key,formatX:Ce,formatValue:V,caption:typeof z=="string"?z:void 0}):void 0,className:e,...pe,children:({width:i})=>(0,r.jsx)(Xt,{width:i,height:d,data:H,resolvedSeries:O,x:ie,y:Ie,grid:Pe,size:I,orientation:oe,stack:S?"none":Me,center:Z,centerKey:k,valueColors:K,binned:S,curve:Ge,barSize:Ue,showValues:F,referenceLines:fe,annotations:o,annotationsLabel:ye.chartAnnotations,patterns:Y&&K===null,patternBaseId:Ze,overlay:$,brush:ge,onBrush:be,brushLabel:f??ye.chartBrush,syncEnabled:Fe,margin:Ye,tooltip:N,onPointClick:Ee,plotLabel:C,formatValue:q,formatRaw:V,formatX:Ce})})}0&&(module.exports={BarChart,resetBarChartWarnings});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{memo as ct,useCallback as ee,useId as Ct,useMemo as M,useState as ze}from"react";import{cn as vt}from"../../lib/cn.js";import{useUILabels as xt}from"../../lib/i18n.js";import{ChartAnnotationLayer as rt,describeAnnotations as kt}from"../chart/ChartAnnotations.js";import{ChartAxis as ot}from"../chart/ChartAxis.js";import{ChartBrushLayer as wt,useChartBrush as St}from"../chart/ChartBrush.js";import{ChartContainer as Bt}from"../chart/ChartContainer.js";import{ChartGrid as Pt}from"../chart/ChartGrid.js";import{ChartLegend as Lt}from"../chart/ChartLegend.js";import{ChartPatternDefs as At,patternFill as Rt}from"../chart/ChartPatterns.js";import{ChartScaleLegend as Et}from"../chart/ChartScaleLegend.js";import{useChartSync as Mt}from"../chart/ChartSync.js";import{ChartTableView as Vt}from"../chart/ChartTableView.js";import{ChartTooltip as Tt,ChartTooltipContent as It}from"../chart/ChartTooltip.js";import{CHART_MUTED_COLOR as Dt,createDivergingScale as at,getSeriesLabel as lt,resolveSeriesColor as Wt,toLegendItems as Ht}from"../chart/palette.js";import{buildCartesianGeometry as Nt,createCategoryLocator as $t,createPlotContext as Ot,splitOverlay as Kt}from"../chart/utils/cartesian.js";import{collectAllValues as Ge,readNumber as ve}from"../chart/utils/data.js";import{formatAuto as _t,formatPercent as Xt,formatXValue as zt}from"../chart/utils/format.js";import{binValues as Gt}from"../chart/utils/bins.js";import{buildBarPath as Ut,buildLinePath as Ft}from"../chart/utils/path.js";import{nearestIndex as Yt,toKey as it}from"../chart/utils/scales.js";import{stackDiverging as Zt,stackExtent as jt,stackSeries as qt}from"../chart/utils/stack.js";import{estimateTextWidth as Jt}from"../chart/utils/text.js";import{extent as st,resolveDomain as Qt}from"../chart/utils/ticks.js";import{Fragment as ln,jsx as i,jsxs as ue}from"react/jsx-runtime";var en=24,Q=2,tn=4,ce=6,nn=10,Ue=!1,Fe=!1;function In(){Ue=!1,Fe=!1}var rn=ct(function({bars:b,patterns:n,patternBaseId:h}){return i("g",{children:b.map((f,P)=>ue("g",{children:[i("path",{d:f.d,fill:Rt(n,h,f.slot,f.color)}),f.label?i("text",{x:f.label.x,y:f.label.y,textAnchor:f.label.anchor,dominantBaseline:"middle",className:"fill-gray-600 text-[10px] [font-variant-numeric:tabular-nums] dark:fill-gray-300",children:f.label.text}):null]},`${f.key}-${P}`))})}),on=ct(function({lines:b}){return i("g",{children:b.map(n=>ue("g",{children:[i("path",{d:n.d,fill:"none",stroke:n.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:n.dashed?"5 4":void 0}),n.markers.map(h=>i("circle",{cx:h.x,cy:h.y,r:3,fill:n.color,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"},`${h.x}-${h.y}`))]},n.key))})});function an({width:C,height:b,data:n,resolvedSeries:h,x:f,y:P,grid:V,size:xe,orientation:L,stack:W,center:A,centerKey:T,valueColors:K,binned:te,curve:ke,barSize:we,showValues:Se,referenceLines:Ie,annotations:_,annotationsLabel:De,patterns:Be,patternBaseId:ne,overlay:Pe,brush:R,onBrush:X,brushLabel:We,syncEnabled:He,margin:re,tooltip:z,onPointClick:he,plotLabel:Le,formatValue:H,formatRaw:G,formatX:oe}){let[de,me]=ze(null),u=de!==null&&de<n.length?de:null,[Ne,$e]=ze(null),I=Mt(),p=He?I:null,e=M(()=>{let t=L==="vertical",r=h.filter(m=>!m.hidden),a=r.filter(m=>m.type!=="line"),g=r.filter(m=>m.type==="line"),k=a.map(m=>m.key),d=T!==null||W!=="none",$=T!==null?Zt(n,k,{centerKey:T,percent:W==="percent"}):qt(n,k,W),l=d?jt($):st(Ge(n,k)),o=st(Ge(n,g.map(m=>m.key))),s=l===null?o:o===null?l:[Math.min(l[0],o[0]),Math.max(l[1],o[1])],c=Nt({width:C,height:b,data:n,x:f,y:P,bounds:s===null?null:[Math.min(s[0],A),Math.max(s[1],A)],margin:re,orientation:L,placement:"band",bandPaddingInner:te?0:void 0,formatValue:H,formatX:oe,defaultIncludeZero:A===0}),{valueScale:Z,bandwidth:pe,categoryPositions:Ye,innerWidth:Ze,innerHeight:je}=c,ut=Z(A),Ee=Math.max(1,a.length),ht=d?pe:pe/Ee,O=Math.min(we??(te?Number.POSITIVE_INFINITY:en),Math.max(1,ht-(d&&!te?0:Q))),dt=d?O:Ee*O+(Ee-1)*Q,qe=(pe-dt)/2,Je=[],Qe=m=>d?m.end>=m.start:m.end>=A;$.forEach((m,Me)=>{let j=-1,Ve=-1;m.segments.forEach((B,ie)=>{B.value!==null&&B.outer!==!1&&(Qe(B)?j=ie:Ve=ie)});let le=0,ye=0;m.segments.forEach((B,ie)=>{if(B.value===null)return;let Ke=a[ie],y=Qe(B),et=Z(d?B.start:A),tt=Z(B.end),q=Math.min(et,tt),se=Math.abs(tt-et),ft=B.base??(y?le===0:ye===0),gt=t?!y:y;d&&!ft&&se>Q&&(se-=Q,gt&&(q+=Q)),y?le+=1:ye+=1;let Te=Ye[Me]+(d?qe:qe+ie*(O+Q)),bt=ie===(y?j:Ve)?t?y?"top":"bottom":y?"right":"left":"none",pt=t?{x:Te,y:q,width:O,height:se}:{x:q,y:Te,width:se,height:O},_e=null;if(Se&&!d){let Xe=G(B.value),nt=Jt(Xe,10);if(t){let J=y?q:q+se,Ce=y?J-ce:J+ce,yt=Ee>1?O+Q:pe;nt<=yt&&(y?Ce>8:Ce<je-4)&&(_e={x:Te+O/2,y:Ce,anchor:"middle",text:Xe})}else{let J=y?q+se:q,Ce=y?Ze-J-ce:J-ce;nt<=Ce&&(_e={x:y?J+ce:J-ce,y:Te+O/2,anchor:y?"start":"end",text:Xe})}}Je.push({key:Ke.key,slot:Ke.slot,color:K&&B.value!==null?K(B.value):Ke.color,d:Ut({...pt,radius:tn,round:bt}),label:_e})})});let mt=g.map(m=>{let Me=c.categoryCenters.map((j,Ve)=>{let le=ve(n[Ve],m.key),ye=le===null?Number.NaN:Z(le);return{x:t?j:ye,y:t?ye:j,defined:le!==null}});return{key:m.key,color:m.color,dashed:m.dashed,d:Ft(Me,ke),markers:Me.filter(j=>j.defined!==!1)}});return{vertical:t,visible:r,locate:$t(c),barSeries:a,rows:$,stacked:d,plot:Ot({geometry:c,width:C,height:b,data:n,series:r,formatValue:H,formatX:oe}),xValues:c.xValues,categoryPositions:Ye,categoryCenters:c.categoryCenters,bandwidth:pe,categoryTicks:c.categoryTicks,valueTicks:c.valueTicks,valueScale:Z,baseline:ut,innerWidth:Ze,innerHeight:je,margin:c.margin,bars:Je,lines:mt}},[n,h,f,P,C,b,re,L,W,A,T,K,te,ke,we,Se,H,G,oe]),fe=ee(t=>e.visible.map(r=>{let a=ve(n[t],r.key),g=e.barSeries.indexOf(r),k=g===-1?null:e.rows[t].segments[g],d=a===null?"\u2014":W==="percent"&&k!==null?`${G(a)} (${H(k.end-k.start)})`:H(a);return{seriesKey:r.key,seriesLabel:lt(r),color:r.color,value:a,formattedValue:d,datum:n[t]}}),[n,e.visible,e.barSeries,e.rows,W,H,G]),ge=p?p.brush:Ne,Ae=ee(t=>{$e(t),p?.setBrush(t),X?.(t)},[p,X]),v=St({enabled:R,active:ge!==null,centers:e.categoryCenters,xValues:e.xValues,offset:e.vertical?e.margin.left:e.margin.top,orientation:L,onCommit:Ae}),Oe=ee(t=>{if(v.onPointerMove(t),z===!1||n.length===0)return;let r=t.currentTarget.getBoundingClientRect(),a=e.vertical?t.clientX-r.left-e.margin.left:t.clientY-r.top-e.margin.top,g=Yt(e.categoryCenters,a);me(g>=0?g:null),p?.setHovered(g>=0?e.xValues[g]:null)},[v,z,n.length,e.vertical,e.margin,e.categoryCenters,e.xValues,p]),w=ee(()=>{me(null),p?.setHovered(null)},[p]),x=ee(t=>{if(n.length===0)return;v.onKeyDown(t,u);let r=n.length-1,a=u??0,g=e.vertical?"ArrowRight":"ArrowDown",k=e.vertical?"ArrowLeft":"ArrowUp",d=t.key===g?Math.min(r,a+1):t.key===k?Math.max(0,a-1):t.key==="Home"?0:t.key==="End"?r:t.key==="Escape"?null:void 0;d!==void 0&&(t.preventDefault(),me(d),p?.setHovered(d===null?null:e.xValues[d]))},[n.length,u,e.vertical,v,p,e.xValues]),U=ee(()=>{if(v.consumedClick()||!he||u===null)return;let[t]=fe(u);t&&he({...t,index:u,x:e.xValues[u]})},[v,he,u,fe,e.xValues]),N=u!==null||!p?.hovered?null:(()=>{let t=it(p.hovered),r=e.xValues.findIndex(a=>it(a)===t);return r<0?null:r})(),E=u??N,S=v.dragging??ge,D=(()=>{if(!S)return null;let t=e.locate(S.from),r=e.locate(S.to);if(t===null||r===null)return null;let a=e.bandwidth/2;return{from:Math.min(t,r)-a,to:Math.max(t,r)+a}})(),F=Kt(Pe),Re=u===null?null:fe(u),Y=u===null||Re===null?null:{x:e.xValues[u],xLabel:oe(e.xValues[u],u),index:u,points:Re},be=t=>{let r=e.rows[t].segments.filter(a=>a.value!==null).map(a=>e.valueScale(a.end));for(let a of e.lines){let g=ve(n[t],a.key);g!==null&&r.push(e.valueScale(g))}return r},ae=u===null?null:e.vertical?{x:e.margin.left+e.categoryCenters[u],y:e.margin.top+Math.min(...be(u),e.baseline)}:{x:e.margin.left+Math.max(...be(u),e.baseline),y:e.margin.top+e.categoryCenters[u]};return ue(ln,{children:[ue("svg",{width:C,height:b,role:"img","aria-label":Le??[e.visible.map(t=>lt(t)).join(", "),kt(_,De)].filter(Boolean).join(". "),tabIndex:0,className:vt("touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",R&&"select-none"),onPointerDown:v.onPointerDown,onPointerMove:Oe,onPointerUp:v.onPointerUp,onPointerCancel:v.onPointerUp,onPointerLeave:w,onKeyDown:x,onBlur:w,onClick:U,children:[Be?i(At,{id:ne,entries:h.map(t=>({slot:t.slot,color:t.color}))}):null,ue("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[i(Pt,{width:e.innerWidth,height:e.innerHeight,horizontal:e.vertical&&(V==="y"||V==="both")?e.valueTicks.map(t=>t.offset):void 0,vertical:!e.vertical&&(V==="y"||V==="both")?e.valueTicks.map(t=>t.offset):void 0}),_?i(rt,{layer:"under",annotations:_,xAt:e.locate,yAt:e.valueScale,width:e.innerWidth,height:e.innerHeight,bandwidth:e.bandwidth}):null,D?i(wt,{from:D.from,to:D.to,width:e.innerWidth,height:e.innerHeight,orientation:L,live:v.dragging!==null,label:We}):null,E!==null?i("rect",{x:e.vertical?e.categoryPositions[E]:0,y:e.vertical?0:e.categoryPositions[E],width:e.vertical?e.bandwidth:e.innerWidth,height:e.vertical?e.innerHeight:e.bandwidth,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,F.under?.(e.plot),i(rn,{bars:e.bars,patterns:Be,patternBaseId:ne}),e.lines.length>0?i(on,{lines:e.lines}):null,i("line",{x1:e.vertical?0:e.baseline,y1:e.vertical?e.baseline:0,x2:e.vertical?e.innerWidth:e.baseline,y2:e.vertical?e.baseline:e.innerHeight,className:"stroke-gray-300 dark:stroke-gray-600",strokeWidth:1,shapeRendering:"crispEdges"}),_?i(rt,{annotations:_,xAt:e.locate,yAt:e.valueScale,width:e.innerWidth,height:e.innerHeight,bandwidth:e.bandwidth}):null,F.over?.(e.plot),Ie?.map(t=>{let r=e.valueScale(t.value),a=r<nn?r+12:r-4;return ue("g",{children:[i("line",{x1:e.vertical?0:r,y1:e.vertical?r:0,x2:e.vertical?e.innerWidth:r,y2:e.vertical?r:e.innerHeight,stroke:t.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:t.dashed===!1?void 0:"4 4"}),t.label?i("text",{x:e.vertical?e.innerWidth:r+4,y:e.vertical?a:8,textAnchor:e.vertical?"end":"start",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:t.label}):null]},`${t.value}-${t.label??""}`)})]}),i("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:(e.vertical?f.hidden:P?.hidden)?null:i(ot,{orientation:"bottom",ticks:e.vertical?e.categoryTicks:e.valueTicks,length:e.innerWidth,label:e.vertical?f.label:P?.label,size:xe})}),i("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:(e.vertical?P?.hidden:f.hidden)?null:i(ot,{orientation:"left",ticks:e.vertical?e.valueTicks:e.categoryTicks,length:e.innerHeight,showLine:!1,label:e.vertical?P?.label:f.label,size:xe})})]}),Y&&ae&&z!==!1?i(Tt,{x:ae.x,y:ae.y,containerWidth:C,children:typeof z=="function"?z(Y):i(It,{title:Y.xLabel,points:Y.points})}):null]})}function Dn({data:C,series:b,x:n,y:h,height:f=260,width:P,size:V="md",grid:xe="y",legend:L,tooltip:W=!0,tableView:A=!1,emphasis:T,title:K,description:te,loading:ke=!1,emptyState:we,error:Se=!1,errorState:Ie,onRetry:_,actions:De,onPointClick:Be,orientation:ne="vertical",stack:Pe="none",diverging:R,bins:X,curve:We="linear",barSize:He,sort:re="none",showValues:z=!1,referenceLines:he,annotations:Le,overlay:H,patterns:G=!1,legendToggle:oe=!0,brush:de=!1,onBrush:me,brushLabel:u,sync:Ne=!0,margin:$e,locale:I,plotLabel:p,className:e,...fe}){let ge=xt(),[Ae,v]=ze(()=>new Set),Oe=Ct(),w=X!==void 0&&X!==!1,x=w||typeof R!="string"?null:R,U=!w&&typeof R=="number"?R:0,N=M(()=>{let l=x===null?null:at([0,Math.max(1,b.length-1)],{center:Math.max(0,b.findIndex(o=>o.key===x)),symmetric:!1});return b.map((o,s)=>({...o,slot:s,hidden:o.hidden||Ae.has(o.key),color:l&&!o.color&&!T?o.key===x?Dt:l(s):Wt(o,s,T)}))},[b,Ae,T,x]),E=M(()=>l=>_t(l,I),[I]),S=M(()=>{if(!w)return null;b.length>1&&!Ue&&(Ue=!0,console.warn("[@synertech/ui] BarChart was given `bins` and more than one series. A histogram counts a single field \u2014 the extra series are ignored. Facet the chart, or draw the distributions side by side."));let l=b[0]?.key??"count",o=n.format?c=>n.format(c,0):c=>E(c),s=Gt(C.map(c=>ve(c,n.key)),X);return{rows:s.map(c=>({[n.key]:c.from,[l]:c.count})),labels:s.map(c=>`${o(c.from)}\u2013${o(c.to)}`)}},[w,X,C,n.key,n.format,b,E]),D=M(()=>{if(S)return S.rows;if(re==="none")return C;let l=N.filter(s=>!s.hidden).map(s=>s.key),o=s=>l.reduce((c,Z)=>c+(ve(s,Z)??0),0);return[...C].sort((s,c)=>re==="asc"?o(s)-o(c):o(c)-o(s))},[S,C,re,N]),F=!w&&Pe==="percent",Re=M(()=>F?{domain:x===null?[0,100]:[-100,100],...h}:h,[F,x,h]),Y=M(()=>{let l=h?.format??(F?o=>Xt(o,{locale:I,alreadyScaled:!0,maximumFractionDigits:0}):E);return x===null?l:o=>l(Math.abs(o))},[h?.format,F,I,E,x]),be=M(()=>S?(l,o)=>S.labels[o]??"":n.format??(l=>zt(l,I)),[S,n.format,I]),ae=M(()=>S?{...n,scale:"category"}:n,[S,n]),t=ee(l=>{v(o=>{let s=new Set(o);return s.has(l)?s.delete(l):s.add(l),s})},[]),r=ne==="vertical"?Le:void 0;Le&&ne!=="vertical"&&!Fe&&(Fe=!0,console.warn("[@synertech/ui] BarChart was given `annotations` and a horizontal orientation. Annotations are read on the category axis, which runs up the side there: they are ignored. Use `referenceLines` for a threshold on the value axis."));let a=L===void 0?b.length>=2:L!==!1,g=typeof L=="string"?L:"bottom",k=N.filter(l=>!l.hidden),d=k.length,$=M(()=>{if(w||R===void 0||R===!1||x!==null||d!==1)return null;let l=Ge(D,k.map(s=>s.key)),o=Qt([...l,U],{domain:h?.domain,includeZero:h?.includeZero??U===0,ticks:h?.ticks??5});return at(o,{center:U})},[w,R,x,d,k,D,U,h]);return i(Bt,{title:K,description:te,height:f,width:P,size:V,loading:ke,empty:D.length===0||d===0,emptyState:we,error:Se,errorState:Ie,onRetry:_,actions:De,tableView:A,legendPosition:g,legend:$?i(Et,{scale:$,label:h?.label,format:Y,size:V,locale:I}):a?i(Lt,{items:Ht(N,T,G),position:g,marker:"rect",size:V,onToggle:oe?t:void 0}):void 0,table:A?i(Vt,{data:D,series:N,xKey:ae.key,xLabel:n.label??n.key,formatX:be,formatValue:E,caption:typeof K=="string"?K:void 0}):void 0,className:e,...fe,children:({width:l})=>i(an,{width:l,height:f,data:D,resolvedSeries:N,x:ae,y:Re,grid:xe,size:V,orientation:ne,stack:w?"none":Pe,center:U,centerKey:x,valueColors:$,binned:w,curve:We,barSize:He,showValues:z,referenceLines:he,annotations:r,annotationsLabel:ge.chartAnnotations,patterns:G&&$===null,patternBaseId:Oe,overlay:H,brush:de,onBrush:me,brushLabel:u??ge.chartBrush,syncEnabled:Ne,margin:$e,tooltip:W,onPointClick:Be,plotLabel:p,formatValue:Y,formatRaw:E,formatX:be})})}export{Dn as BarChart,In as resetBarChartWarnings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var h=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var i=(a,r)=>{for(var e in r)h(a,e,{get:r[e],enumerable:!0})},s=(a,r,e,B)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of n(r))!p.call(a,t)&&t!==e&&h(a,t,{get:()=>r[t],enumerable:!(B=C(r,t))||B.enumerable});return a};var f=a=>s(h({},"__esModule",{value:!0}),a);var m={};i(m,{BarChart:()=>o.BarChart,resetBarChartWarnings:()=>o.resetBarChartWarnings});module.exports=f(m);var o=require("./BarChart.cjs");0&&(module.exports={BarChart,resetBarChartWarnings});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BarChart as t,resetBarChartWarnings as e}from"./BarChart.js";export{t as BarChart,e as resetBarChartWarnings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var se=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Ie=(m,o)=>{for(var d in o)se(m,d,{get:o[d],enumerable:!0})},ze=(m,o,d,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Ve(o))!De.call(m,n)&&n!==d&&se(m,n,{get:()=>o[n],enumerable:!(a=Xe(o,n))||a.enumerable});return m};var Ge=m=>ze(se({},"__esModule",{value:!0}),m);var _e={};Ie(_e,{BoxPlot:()=>Ue});module.exports=Ge(_e);var f=require("react"),ue=require("../../lib/i18n.cjs"),me=require("../chart/ChartAxis.cjs"),Ce=require("../chart/ChartContainer.cjs"),ke=require("../chart/ChartGrid.cjs"),ve=require("../chart/ChartTooltip.cjs"),Ne=require("../chart/palette.cjs"),Pe=require("../chart/utils/cartesian.cjs"),w=require("../chart/utils/data.cjs"),J=require("../chart/utils/format.cjs"),Be=require("../chart/utils/path.cjs"),Te=require("../chart/utils/quantile.cjs"),we=require("../chart/utils/scales.cjs"),Se=require("../table/Table.cjs"),Le=require("../table/TableBody.cjs"),z=require("../table/TableCell.cjs"),Re=require("../table/TableHeader.cjs"),B=require("../table/TableHeaderCell.cjs"),Me=require("../table/TableRow.cjs"),t=require("react/jsx-runtime"),qe=40,Ke=3,F=4,ce="text-right [font-variant-numeric:tabular-nums]",Oe=(0,f.memo)(function({boxes:o,color:d}){return(0,t.jsx)("g",{children:o.map(a=>(0,t.jsxs)("g",{children:[(0,t.jsx)("g",{stroke:d,strokeWidth:1.5,strokeLinecap:"round",children:a.whiskers.map(n=>(0,t.jsx)("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2},n.key))}),a.body?(0,t.jsx)("path",{d:a.body,fill:d}):null,a.median?(0,t.jsx)("line",{x1:a.median.x1,y1:a.median.y1,x2:a.median.x2,y2:a.median.y2,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"}):null,a.mean?(0,t.jsx)("path",{d:`M${a.mean.cx},${a.mean.cy-F} L${a.mean.cx+F},${a.mean.cy} L${a.mean.cx},${a.mean.cy+F} L${a.mean.cx-F},${a.mean.cy} Z`,strokeWidth:1.5,stroke:d,className:"fill-white dark:fill-gray-800"}):null,a.outliers.map(n=>(0,t.jsx)("circle",{cx:n.cx,cy:n.cy,r:Ke,fill:d,strokeWidth:1.5,className:"stroke-white dark:stroke-gray-800"},n.key))]},a.key))})});function Qe({width:m,height:o,data:d,boxes:a,x:n,y:N,grid:M,size:G,orientation:S,boxSize:q,showOutliers:K,showMean:E,color:O,referenceLines:ee,margin:W,tooltip:L,plotLabel:te,formatValue:A,formatX:H,onBoxClick:X}){let[h,$]=(0,f.useState)(null),Q=(0,ue.useUILabels)(),e=(0,f.useMemo)(()=>{let r=S==="vertical",i=a.flatMap(c=>c.stats===null?[]:[c.stats.min,c.stats.max,...E&&c.mean!==null?[c.mean]:[]]),p=(0,Pe.buildCartesianGeometry)({width:m,height:o,data:d,x:n,y:N,bounds:i.length===0?null:[Math.min(...i),Math.max(...i)],margin:W,orientation:S,placement:"band",formatValue:A,formatX:H,defaultIncludeZero:!1}),{valueScale:x,bandwidth:C,categoryPositions:k,innerWidth:D,innerHeight:I}=p,P=Math.min(q??qe,C),l=P*.5,g=(c,b)=>r?{x:c,y:b}:{x:b,y:c},U=a.map((c,b)=>{let v=k[b]+(C-P)/2,u=v+P/2;if(c.stats===null)return{key:`${b}`,body:"",median:null,whiskers:[],outliers:[],mean:null,top:k[b],height:C};let{q1:y,q3:T,median:_,lower:Y,upper:Ae,outliers:He}=c.stats,de=x(y),he=x(T),ge=Math.min(de,he),ye=Math.abs(he-de),$e=(0,Be.buildBarPath)({...r?{x:v,y:ge,width:P,height:Math.max(1,ye)}:{x:ge,y:v,width:Math.max(1,ye),height:P},radius:2,round:"none"}),j=x(_),Ee=r?{x1:v,y1:j,x2:v+P,y2:j}:{x1:j,y1:v,x2:j,y2:v+P},le=[];for(let[R,oe,Z]of[["lower",Y,y],["upper",Ae,T]]){let ie=x(oe),We=x(Z),fe=g(u,ie),pe=g(u,We);le.push({key:`${R}-stem`,x1:pe.x,y1:pe.y,x2:fe.x,y2:fe.y});let xe=g(u-l/2,ie),be=g(u+l/2,ie);le.push({key:`${R}-cap`,x1:xe.x,y1:xe.y,x2:be.x,y2:be.y})}return{key:`${b}`,body:$e,median:Ee,whiskers:le,outliers:K?He.map((R,oe)=>{let Z=g(u,x(R));return{key:`${oe}`,cx:Z.x,cy:Z.y}}):[],mean:E&&c.mean!==null?(()=>{let R=g(u,x(c.mean));return{cx:R.x,cy:R.y}})():null,top:k[b],height:C}});return{vertical:r,rendered:U,categoryPositions:k,categoryCenters:p.categoryCenters,bandwidth:C,categoryTicks:p.categoryTicks,valueTicks:p.valueTicks,valueScale:x,innerWidth:D,innerHeight:I,margin:p.margin}},[a,d,n,N,m,o,W,S,q,K,E,A,H]),ae=(0,f.useCallback)(r=>{if(L===!1||a.length===0)return;let i=r.currentTarget.getBoundingClientRect(),p=e.vertical?r.clientX-i.left-e.margin.left:r.clientY-i.top-e.margin.top;$((0,we.nearestIndex)(e.categoryCenters,p))},[L,a.length,e.vertical,e.margin,e.categoryCenters]),re=(0,f.useCallback)(r=>{if(a.length===0)return;let i=a.length-1,p=h??0,x=e.vertical?"ArrowRight":"ArrowDown",C=e.vertical?"ArrowLeft":"ArrowUp",k=r.key===x?Math.min(i,p+1):r.key===C?Math.max(0,p-1):r.key==="Home"?0:r.key==="End"?i:r.key==="Escape"?null:void 0;k!==void 0&&(r.preventDefault(),$(k))},[a.length,h,e.vertical]),ne=(0,f.useCallback)(()=>{!X||h===null||X(a[h])},[X,h,a]),s=h===null?null:a[h],V=h===null||s===null||s.stats===null?null:e.vertical?{x:e.margin.left+e.categoryCenters[h],y:e.margin.top+e.valueScale(s.stats.q3)}:{x:e.margin.left+e.valueScale(s.stats.q3),y:e.margin.top+e.categoryCenters[h]};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("svg",{width:m,height:o,role:"img","aria-label":te??a.map(r=>r.label).join(", "),tabIndex:0,className:"touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",onPointerMove:ae,onPointerLeave:()=>$(null),onKeyDown:re,onBlur:()=>$(null),onClick:ne,children:[(0,t.jsxs)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[(0,t.jsx)(ke.ChartGrid,{width:e.innerWidth,height:e.innerHeight,horizontal:e.vertical&&(M==="y"||M==="both")?e.valueTicks.map(r=>r.offset):void 0,vertical:!e.vertical&&(M==="y"||M==="both")?e.valueTicks.map(r=>r.offset):void 0}),h!==null?(0,t.jsx)("rect",{x:e.vertical?e.categoryPositions[h]:0,y:e.vertical?0:e.categoryPositions[h],width:e.vertical?e.bandwidth:e.innerWidth,height:e.vertical?e.innerHeight:e.bandwidth,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,ee?.map(r=>{let i=e.valueScale(r.value);return(0,t.jsxs)("g",{children:[(0,t.jsx)("line",{x1:e.vertical?0:i,y1:e.vertical?i:0,x2:e.vertical?e.innerWidth:i,y2:e.vertical?i:e.innerHeight,stroke:r.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:r.dashed===!1?void 0:"4 4"}),r.label?(0,t.jsx)("text",{x:e.vertical?e.innerWidth:i+4,y:e.vertical?i-4:8,textAnchor:e.vertical?"end":"start",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:r.label}):null]},`${r.value}-${r.label??""}`)}),(0,t.jsx)(Oe,{boxes:e.rendered,color:O})]}),(0,t.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:(e.vertical?n.hidden:N?.hidden)?null:(0,t.jsx)(me.ChartAxis,{orientation:"bottom",ticks:e.vertical?e.categoryTicks:e.valueTicks,length:e.innerWidth,label:e.vertical?n.label:N?.label,size:G})}),(0,t.jsx)("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:(e.vertical?N?.hidden:n.hidden)?null:(0,t.jsx)(me.ChartAxis,{orientation:"left",ticks:e.vertical?e.valueTicks:e.categoryTicks,length:e.innerHeight,showLine:!1,label:e.vertical?N?.label:n.label,size:G})})]}),s&&s.stats&&V&&L!==!1?(0,t.jsx)(ve.ChartTooltip,{x:V.x,y:V.y,containerWidth:m,children:typeof L=="function"?L(s):(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:s.label}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_auto] gap-x-3 gap-y-0.5",children:[[["Max",s.stats.max],["Q3",s.stats.q3],[Q.chartMedian,s.stats.median],["Q1",s.stats.q1],["Min",s.stats.min]].map(([r,i])=>(0,t.jsxs)("div",{className:"contents",children:[(0,t.jsx)("dt",{className:"text-gray-500 dark:text-gray-400",children:r}),(0,t.jsx)("dd",{className:"justify-self-end font-medium text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:A(i)})]},r)),(0,t.jsxs)("div",{className:"contents",children:[(0,t.jsx)("dt",{className:"text-gray-500 dark:text-gray-400",children:Q.chartCount}),(0,t.jsx)("dd",{className:"justify-self-end font-medium text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:s.stats.count})]})]})]})}):null]})}function Ue({data:m,x:o,y:d,values:a,quantiles:n,whisker:N=1.5,orientation:M="vertical",boxSize:G,showOutliers:S=!0,showMean:q=!1,color:K,referenceLines:E,height:O=280,width:ee,size:W="md",grid:L="y",tooltip:te=!0,tableView:A=!1,title:H,description:X,loading:h=!1,emptyState:$,error:Q=!1,errorState:e,onRetry:ae,actions:re,margin:ne,locale:s,plotLabel:V,format:r,onBoxClick:i,className:p,...x}){let C=(0,ue.useUILabels)(),k=(0,f.useMemo)(()=>d?.format??r??(l=>(0,J.formatAuto)(l,s)),[d?.format,r,s]),D=(0,f.useMemo)(()=>o.format??(l=>(0,J.formatXValue)(l,s)),[o.format,s]),I=(0,f.useMemo)(()=>m.map((l,g)=>{let U=(0,w.readXValue)(l,o.key,g),c=a?(()=>{let u=l[a];return Array.isArray(u)?u.map(y=>typeof y=="number"?y:Number(y)).filter(y=>Number.isFinite(y)):null})():null,b=null,v=null;if(c!==null)b=(0,Te.boxStats)(c,N),v=c.length===0?null:c.reduce((u,y)=>u+y,0)/c.length;else if(n){let u=(0,w.readNumber)(l,n.q1),y=(0,w.readNumber)(l,n.median),T=(0,w.readNumber)(l,n.q3);if(u!==null&&y!==null&&T!==null){let _=n.min?(0,w.readNumber)(l,n.min)??u:u,Y=n.max?(0,w.readNumber)(l,n.max)??T:T;b={count:0,min:_,max:Y,q1:u,median:y,q3:T,iqr:T-u,lower:_,upper:Y,outliers:[]}}}return{index:g,x:U,label:D(U,g),stats:b,mean:v,datum:l}}),[m,o.key,a,n,N,D]),P=I.filter(l=>l.stats!==null);return(0,t.jsx)(Ce.ChartContainer,{title:H,description:X,height:O,width:ee,size:W,loading:h,empty:P.length===0,emptyState:$,error:Q,errorState:e,onRetry:ae,actions:re,tableView:A,table:A?(0,t.jsx)("div",{className:"w-full overflow-x-auto",children:(0,t.jsxs)(Se.Table,{children:[typeof H=="string"?(0,t.jsx)("caption",{className:"sr-only",children:H}):null,(0,t.jsxs)(Re.TableHeader,{children:[(0,t.jsx)(B.TableHeaderCell,{children:o.label??o.key}),a?(0,t.jsx)(B.TableHeaderCell,{className:"text-right",children:C.chartCount}):null,(0,t.jsx)(B.TableHeaderCell,{className:"text-right",children:"Min"}),(0,t.jsx)(B.TableHeaderCell,{className:"text-right",children:"Q1"}),(0,t.jsx)(B.TableHeaderCell,{className:"text-right",children:C.chartMedian}),(0,t.jsx)(B.TableHeaderCell,{className:"text-right",children:"Q3"}),(0,t.jsx)(B.TableHeaderCell,{className:"text-right",children:"Max"}),a&&S?(0,t.jsx)(B.TableHeaderCell,{className:"text-right",children:C.chartOutliers}):null]}),(0,t.jsx)(Le.TableBody,{children:I.map(l=>(0,t.jsxs)(Me.TableRow,{clickable:!1,children:[(0,t.jsx)(z.TableCell,{className:"font-medium text-gray-900 dark:text-gray-100",children:l.label}),a?(0,t.jsx)(z.TableCell,{className:ce,children:l.stats?.count??"\u2014"}):null,["min","q1","median","q3","max"].map(g=>(0,t.jsx)(z.TableCell,{className:ce,children:l.stats===null?"\u2014":k(l.stats[g])},g)),a&&S?(0,t.jsx)(z.TableCell,{className:ce,children:l.stats===null||l.stats.outliers.length===0?"\u2014":l.stats.outliers.map(k).join(", ")}):null]},l.index))})]})}):void 0,className:p,...x,children:({width:l})=>(0,t.jsx)(Qe,{width:l,height:O,data:m,boxes:I,x:o,y:d,grid:L,size:W,orientation:M,boxSize:G,showOutliers:S,showMean:q,color:K??(0,Ne.getSeriesColor)(0),referenceLines:E,margin:ne,tooltip:te,plotLabel:V,formatValue:k,formatX:D,onBoxClick:i})})}0&&(module.exports={BoxPlot});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{memo as Be,useCallback as se,useMemo as J,useState as Te}from"react";import{useUILabels as be}from"../../lib/i18n.js";import{ChartAxis as xe}from"../chart/ChartAxis.js";import{ChartContainer as we}from"../chart/ChartContainer.js";import{ChartGrid as Se}from"../chart/ChartGrid.js";import{ChartTooltip as Le}from"../chart/ChartTooltip.js";import{getSeriesColor as Re}from"../chart/palette.js";import{buildCartesianGeometry as Me}from"../chart/utils/cartesian.js";import{readNumber as I,readXValue as Ae}from"../chart/utils/data.js";import{formatAuto as He,formatXValue as $e}from"../chart/utils/format.js";import{buildBarPath as Ee}from"../chart/utils/path.js";import{boxStats as We}from"../chart/utils/quantile.js";import{nearestIndex as Xe}from"../chart/utils/scales.js";import{Table as Ve}from"../table/Table.js";import{TableBody as De}from"../table/TableBody.js";import{TableCell as Z}from"../table/TableCell.js";import{TableHeader as Ie}from"../table/TableHeader.js";import{TableHeaderCell as T}from"../table/TableHeaderCell.js";import{TableRow as ze}from"../table/TableRow.js";import{Fragment as Qe,jsx as a,jsxs as p}from"react/jsx-runtime";var Ge=40,qe=3,F=4,ce="text-right [font-variant-numeric:tabular-nums]",Ke=Be(function({boxes:u,color:x}){return a("g",{children:u.map(t=>p("g",{children:[a("g",{stroke:x,strokeWidth:1.5,strokeLinecap:"round",children:t.whiskers.map(l=>a("line",{x1:l.x1,y1:l.y1,x2:l.x2,y2:l.y2},l.key))}),t.body?a("path",{d:t.body,fill:x}):null,t.median?a("line",{x1:t.median.x1,y1:t.median.y1,x2:t.median.x2,y2:t.median.y2,strokeWidth:2,className:"stroke-white dark:stroke-gray-800"}):null,t.mean?a("path",{d:`M${t.mean.cx},${t.mean.cy-F} L${t.mean.cx+F},${t.mean.cy} L${t.mean.cx},${t.mean.cy+F} L${t.mean.cx-F},${t.mean.cy} Z`,strokeWidth:1.5,stroke:x,className:"fill-white dark:fill-gray-800"}):null,t.outliers.map(l=>a("circle",{cx:l.cx,cy:l.cy,r:qe,fill:x,strokeWidth:1.5,className:"stroke-white dark:stroke-gray-800"},l.key))]},t.key))})});function Oe({width:v,height:u,data:x,boxes:t,x:l,y:N,grid:R,size:z,orientation:w,boxSize:G,showOutliers:q,showMean:$,color:K,referenceLines:ee,margin:E,tooltip:S,plotLabel:te,formatValue:M,formatX:A,onBoxClick:W}){let[m,H]=Te(null),O=be(),e=J(()=>{let r=w==="vertical",o=t.flatMap(s=>s.stats===null?[]:[s.stats.min,s.stats.max,...$&&s.mean!==null?[s.mean]:[]]),g=Me({width:v,height:u,data:x,x:l,y:N,bounds:o.length===0?null:[Math.min(...o),Math.max(...o)],margin:E,orientation:w,placement:"band",formatValue:M,formatX:A,defaultIncludeZero:!1}),{valueScale:y,bandwidth:b,categoryPositions:C,innerWidth:V,innerHeight:D}=g,P=Math.min(G??Ge,b),n=P*.5,d=(s,f)=>r?{x:s,y:f}:{x:f,y:s},Q=t.map((s,f)=>{let k=C[f]+(b-P)/2,c=k+P/2;if(s.stats===null)return{key:`${f}`,body:"",median:null,whiskers:[],outliers:[],mean:null,top:C[f],height:b};let{q1:h,q3:B,median:U,lower:_,upper:Ce,outliers:ke}=s.stats,me=y(h),ue=y(B),de=Math.min(me,ue),he=Math.abs(ue-me),ve=Ee({...r?{x:k,y:de,width:P,height:Math.max(1,he)}:{x:de,y:k,width:Math.max(1,he),height:P},radius:2,round:"none"}),Y=y(U),Ne=r?{x1:k,y1:Y,x2:k+P,y2:Y}:{x1:Y,y1:k,x2:Y,y2:k+P},le=[];for(let[L,oe,j]of[["lower",_,h],["upper",Ce,B]]){let ie=y(oe),Pe=y(j),ge=d(c,ie),ye=d(c,Pe);le.push({key:`${L}-stem`,x1:ye.x,y1:ye.y,x2:ge.x,y2:ge.y});let fe=d(c-n/2,ie),pe=d(c+n/2,ie);le.push({key:`${L}-cap`,x1:fe.x,y1:fe.y,x2:pe.x,y2:pe.y})}return{key:`${f}`,body:ve,median:Ne,whiskers:le,outliers:q?ke.map((L,oe)=>{let j=d(c,y(L));return{key:`${oe}`,cx:j.x,cy:j.y}}):[],mean:$&&s.mean!==null?(()=>{let L=d(c,y(s.mean));return{cx:L.x,cy:L.y}})():null,top:C[f],height:b}});return{vertical:r,rendered:Q,categoryPositions:C,categoryCenters:g.categoryCenters,bandwidth:b,categoryTicks:g.categoryTicks,valueTicks:g.valueTicks,valueScale:y,innerWidth:V,innerHeight:D,margin:g.margin}},[t,x,l,N,v,u,E,w,G,q,$,M,A]),ae=se(r=>{if(S===!1||t.length===0)return;let o=r.currentTarget.getBoundingClientRect(),g=e.vertical?r.clientX-o.left-e.margin.left:r.clientY-o.top-e.margin.top;H(Xe(e.categoryCenters,g))},[S,t.length,e.vertical,e.margin,e.categoryCenters]),re=se(r=>{if(t.length===0)return;let o=t.length-1,g=m??0,y=e.vertical?"ArrowRight":"ArrowDown",b=e.vertical?"ArrowLeft":"ArrowUp",C=r.key===y?Math.min(o,g+1):r.key===b?Math.max(0,g-1):r.key==="Home"?0:r.key==="End"?o:r.key==="Escape"?null:void 0;C!==void 0&&(r.preventDefault(),H(C))},[t.length,m,e.vertical]),ne=se(()=>{!W||m===null||W(t[m])},[W,m,t]),i=m===null?null:t[m],X=m===null||i===null||i.stats===null?null:e.vertical?{x:e.margin.left+e.categoryCenters[m],y:e.margin.top+e.valueScale(i.stats.q3)}:{x:e.margin.left+e.valueScale(i.stats.q3),y:e.margin.top+e.categoryCenters[m]};return p(Qe,{children:[p("svg",{width:v,height:u,role:"img","aria-label":te??t.map(r=>r.label).join(", "),tabIndex:0,className:"touch-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",onPointerMove:ae,onPointerLeave:()=>H(null),onKeyDown:re,onBlur:()=>H(null),onClick:ne,children:[p("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:[a(Se,{width:e.innerWidth,height:e.innerHeight,horizontal:e.vertical&&(R==="y"||R==="both")?e.valueTicks.map(r=>r.offset):void 0,vertical:!e.vertical&&(R==="y"||R==="both")?e.valueTicks.map(r=>r.offset):void 0}),m!==null?a("rect",{x:e.vertical?e.categoryPositions[m]:0,y:e.vertical?0:e.categoryPositions[m],width:e.vertical?e.bandwidth:e.innerWidth,height:e.vertical?e.innerHeight:e.bandwidth,className:"fill-gray-400 dark:fill-gray-500",opacity:.12,"aria-hidden":"true"}):null,ee?.map(r=>{let o=e.valueScale(r.value);return p("g",{children:[a("line",{x1:e.vertical?0:o,y1:e.vertical?o:0,x2:e.vertical?e.innerWidth:o,y2:e.vertical?o:e.innerHeight,stroke:r.color??"var(--color-chart-muted)",strokeWidth:1,strokeDasharray:r.dashed===!1?void 0:"4 4"}),r.label?a("text",{x:e.vertical?e.innerWidth:o+4,y:e.vertical?o-4:8,textAnchor:e.vertical?"end":"start",className:"fill-gray-500 text-[10px] dark:fill-gray-400",children:r.label}):null]},`${r.value}-${r.label??""}`)}),a(Ke,{boxes:e.rendered,color:K})]}),a("g",{transform:`translate(${e.margin.left}, ${e.margin.top+e.innerHeight})`,children:(e.vertical?l.hidden:N?.hidden)?null:a(xe,{orientation:"bottom",ticks:e.vertical?e.categoryTicks:e.valueTicks,length:e.innerWidth,label:e.vertical?l.label:N?.label,size:z})}),a("g",{transform:`translate(${e.margin.left}, ${e.margin.top})`,children:(e.vertical?N?.hidden:l.hidden)?null:a(xe,{orientation:"left",ticks:e.vertical?e.valueTicks:e.categoryTicks,length:e.innerHeight,showLine:!1,label:e.vertical?N?.label:l.label,size:z})})]}),i&&i.stats&&X&&S!==!1?a(Le,{x:X.x,y:X.y,containerWidth:v,children:typeof S=="function"?S(i):p("div",{className:"flex flex-col gap-1",children:[a("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:i.label}),p("dl",{className:"grid grid-cols-[auto_auto] gap-x-3 gap-y-0.5",children:[[["Max",i.stats.max],["Q3",i.stats.q3],[O.chartMedian,i.stats.median],["Q1",i.stats.q1],["Min",i.stats.min]].map(([r,o])=>p("div",{className:"contents",children:[a("dt",{className:"text-gray-500 dark:text-gray-400",children:r}),a("dd",{className:"justify-self-end font-medium text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:M(o)})]},r)),p("div",{className:"contents",children:[a("dt",{className:"text-gray-500 dark:text-gray-400",children:O.chartCount}),a("dd",{className:"justify-self-end font-medium text-gray-900 [font-variant-numeric:tabular-nums] dark:text-gray-100",children:i.stats.count})]})]})]})}):null]})}function dt({data:v,x:u,y:x,values:t,quantiles:l,whisker:N=1.5,orientation:R="vertical",boxSize:z,showOutliers:w=!0,showMean:G=!1,color:q,referenceLines:$,height:K=280,width:ee,size:E="md",grid:S="y",tooltip:te=!0,tableView:M=!1,title:A,description:W,loading:m=!1,emptyState:H,error:O=!1,errorState:e,onRetry:ae,actions:re,margin:ne,locale:i,plotLabel:X,format:r,onBoxClick:o,className:g,...y}){let b=be(),C=J(()=>x?.format??r??(n=>He(n,i)),[x?.format,r,i]),V=J(()=>u.format??(n=>$e(n,i)),[u.format,i]),D=J(()=>v.map((n,d)=>{let Q=Ae(n,u.key,d),s=t?(()=>{let c=n[t];return Array.isArray(c)?c.map(h=>typeof h=="number"?h:Number(h)).filter(h=>Number.isFinite(h)):null})():null,f=null,k=null;if(s!==null)f=We(s,N),k=s.length===0?null:s.reduce((c,h)=>c+h,0)/s.length;else if(l){let c=I(n,l.q1),h=I(n,l.median),B=I(n,l.q3);if(c!==null&&h!==null&&B!==null){let U=l.min?I(n,l.min)??c:c,_=l.max?I(n,l.max)??B:B;f={count:0,min:U,max:_,q1:c,median:h,q3:B,iqr:B-c,lower:U,upper:_,outliers:[]}}}return{index:d,x:Q,label:V(Q,d),stats:f,mean:k,datum:n}}),[v,u.key,t,l,N,V]),P=D.filter(n=>n.stats!==null);return a(we,{title:A,description:W,height:K,width:ee,size:E,loading:m,empty:P.length===0,emptyState:H,error:O,errorState:e,onRetry:ae,actions:re,tableView:M,table:M?a("div",{className:"w-full overflow-x-auto",children:p(Ve,{children:[typeof A=="string"?a("caption",{className:"sr-only",children:A}):null,p(Ie,{children:[a(T,{children:u.label??u.key}),t?a(T,{className:"text-right",children:b.chartCount}):null,a(T,{className:"text-right",children:"Min"}),a(T,{className:"text-right",children:"Q1"}),a(T,{className:"text-right",children:b.chartMedian}),a(T,{className:"text-right",children:"Q3"}),a(T,{className:"text-right",children:"Max"}),t&&w?a(T,{className:"text-right",children:b.chartOutliers}):null]}),a(De,{children:D.map(n=>p(ze,{clickable:!1,children:[a(Z,{className:"font-medium text-gray-900 dark:text-gray-100",children:n.label}),t?a(Z,{className:ce,children:n.stats?.count??"\u2014"}):null,["min","q1","median","q3","max"].map(d=>a(Z,{className:ce,children:n.stats===null?"\u2014":C(n.stats[d])},d)),t&&w?a(Z,{className:ce,children:n.stats===null||n.stats.outliers.length===0?"\u2014":n.stats.outliers.map(C).join(", ")}):null]},n.index))})]})}):void 0,className:g,...y,children:({width:n})=>a(Oe,{width:n,height:K,data:v,boxes:D,x:u,y:x,grid:S,size:E,orientation:R,boxSize:z,showOutliers:w,showMean:G,color:q??Re(0),referenceLines:$,margin:ne,tooltip:te,plotLabel:X,formatValue:C,formatX:V,onBoxClick:o})})}export{dt as BoxPlot};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var B=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var m=(t,o)=>{for(var l in o)B(t,l,{get:o[l],enumerable:!0})},s=(t,o,l,P)=>{if(o&&typeof o=="object"||typeof o=="function")for(let x of p(o))!f.call(t,x)&&x!==l&&B(t,x,{get:()=>o[x],enumerable:!(P=r(o,x))||P.enumerable});return t};var y=t=>s(B({},"__esModule",{value:!0}),t);var a={};m(a,{BoxPlot:()=>e.BoxPlot});module.exports=y(a);var e=require("./BoxPlot.cjs");0&&(module.exports={BoxPlot});
|