@flikk/ui 1.0.0-beta.30 → 1.0.0-beta.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +375 -5
- package/dist/components/ai/AgentRequest/AgentRequest.animations.d.ts +25 -0
- package/dist/components/ai/AgentRequest/AgentRequest.animations.js +81 -0
- package/dist/components/ai/AgentRequest/AgentRequest.d.ts +3 -0
- package/dist/components/ai/AgentRequest/AgentRequest.js +435 -0
- package/dist/components/ai/AgentRequest/AgentRequest.theme.d.ts +2 -0
- package/dist/components/ai/AgentRequest/AgentRequest.theme.js +106 -0
- package/dist/components/ai/AgentRequest/AgentRequest.types.d.ts +241 -0
- package/dist/components/ai/AgentRequest/index.d.ts +3 -0
- package/dist/components/ai/AgentStatus/AgentStatus.d.ts +3 -0
- package/dist/components/ai/AgentStatus/AgentStatus.js +144 -0
- package/dist/components/ai/AgentStatus/AgentStatus.theme.d.ts +2 -0
- package/dist/components/ai/AgentStatus/AgentStatus.theme.js +37 -0
- package/dist/components/ai/AgentStatus/AgentStatus.types.d.ts +116 -0
- package/dist/components/ai/AgentStatus/index.d.ts +3 -0
- package/dist/components/ai/CodeBlock/CodeBlock.js +3 -3
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +2 -2
- package/dist/components/ai/PromptInput/PromptInput.js +13 -14
- package/dist/components/ai/PromptInput/PromptInput.theme.js +3 -3
- package/dist/components/ai/PromptInput/VoiceRecorder.js +3 -3
- package/dist/components/ai/PromptSuggestion/PromptSuggestion.theme.js +2 -2
- package/dist/components/ai/Reasoning/Reasoning.d.ts +5 -0
- package/dist/components/ai/Reasoning/Reasoning.js +40 -0
- package/dist/components/ai/Reasoning/Reasoning.theme.d.ts +6 -0
- package/dist/components/ai/Reasoning/Reasoning.theme.js +36 -0
- package/dist/components/ai/Reasoning/Reasoning.types.d.ts +73 -0
- package/dist/components/ai/Reasoning/ReasoningTrace.d.ts +11 -0
- package/dist/components/ai/Reasoning/ReasoningTrace.js +84 -0
- package/dist/components/ai/Reasoning/index.d.ts +3 -0
- package/dist/components/ai/SourceCitation/SourceCitation.d.ts +4 -0
- package/dist/components/ai/SourceCitation/SourceCitation.js +29 -0
- package/dist/components/ai/SourceCitation/SourceCitation.theme.d.ts +2 -0
- package/dist/components/ai/SourceCitation/SourceCitation.theme.js +23 -0
- package/dist/components/ai/SourceCitation/SourceCitation.types.d.ts +55 -0
- package/dist/components/ai/SourceCitation/index.d.ts +3 -0
- package/dist/components/ai/StreamingResponse/AnimatedText.d.ts +7 -0
- package/dist/components/ai/StreamingResponse/AnimatedText.js +8 -7
- package/dist/components/ai/StreamingResponse/ErrorDisplay.js +2 -2
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.d.ts +5 -0
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.js +4 -4
- package/dist/components/ai/StreamingResponse/StreamingCursor.d.ts +2 -2
- package/dist/components/ai/StreamingResponse/StreamingCursor.js +10 -7
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.d.ts +10 -0
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.js +59 -33
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +14 -10
- package/dist/components/ai/StreamingResponse/StreamingResponse.theme.js +3 -1
- package/dist/components/ai/StreamingResponse/StreamingResponse.types.d.ts +33 -2
- package/dist/components/ai/StreamingResponse/StreamingSurface.d.ts +13 -0
- package/dist/components/ai/StreamingResponse/StreamingSurface.js +38 -0
- package/dist/components/ai/StreamingResponse/WordAnimationContext.d.ts +5 -0
- package/dist/components/ai/StreamingResponse/WordAnimationContext.js +5 -4
- package/dist/components/ai/StreamingResponse/index.d.ts +4 -2
- package/dist/components/ai/TokenCounter/TokenCounter.js +2 -2
- package/dist/components/ai/TokenCounter/TokenCounter.theme.js +1 -1
- package/dist/components/ai/index.d.ts +6 -2
- package/dist/components/ai/index.js +10 -3
- package/dist/components/ai/shared/StatusIndicator.d.ts +8 -0
- package/dist/components/ai/shared/StatusIndicator.js +34 -0
- package/dist/components/canvas/BaseNode.js +1 -1
- package/dist/components/canvas/CanvasToolbar.js +2 -3
- package/dist/components/canvas/Edge.js +2 -2
- package/dist/components/canvas/NodeControls.js +2 -3
- package/dist/components/canvas/NodeRenderer.js +4 -4
- package/dist/components/charts/ActivityRings/ActivityRings.js +4 -4
- package/dist/components/charts/ActivityRings/ActivityRings.theme.js +1 -1
- package/dist/components/charts/AreaChart/AreaChart.js +24 -35
- package/dist/components/charts/AreaChart/AreaChart.theme.d.ts +1 -6
- package/dist/components/charts/AreaChart/AreaChart.theme.js +10 -22
- package/dist/components/charts/AreaChart/AreaChart.types.d.ts +18 -11
- package/dist/components/charts/AreaChart/AreaChart.types.js +10 -3
- package/dist/components/charts/AreaChart/index.d.ts +1 -1
- package/dist/components/charts/BarChart/BarChart.js +13 -32
- package/dist/components/charts/BarChart/BarChart.types.d.ts +20 -16
- package/dist/components/charts/BarChart/BarChart.types.js +11 -4
- package/dist/components/charts/ComboChart/BarRenderer.js +10 -7
- package/dist/components/charts/ComboChart/BarRenderer.types.d.ts +1 -1
- package/dist/components/charts/ComboChart/ComboChart.js +11 -24
- package/dist/components/charts/ComboChart/ComboChart.types.d.ts +15 -13
- package/dist/components/charts/ComboChart/ComboChart.types.js +14 -2
- package/dist/components/charts/ComboChart/ComboChartCanvas.js +1 -1
- package/dist/components/charts/ComboChart/LineRenderer.js +16 -11
- package/dist/components/charts/ComboChart/LineRenderer.types.d.ts +1 -1
- package/dist/components/charts/DonutChart/DonutChart.theme.js +4 -4
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.theme.js +1 -1
- package/dist/components/charts/Heatmap/Heatmap.js +49 -42
- package/dist/components/charts/Heatmap/Heatmap.theme.d.ts +6 -2
- package/dist/components/charts/Heatmap/Heatmap.theme.js +20 -8
- package/dist/components/charts/Heatmap/Heatmap.types.d.ts +49 -82
- package/dist/components/charts/Heatmap/HeatmapCell.js +30 -81
- package/dist/components/charts/Heatmap/HeatmapLegend.d.ts +7 -6
- package/dist/components/charts/Heatmap/HeatmapLegend.js +6 -6
- package/dist/components/charts/Heatmap/index.d.ts +1 -1
- package/dist/components/charts/Heatmap/utils/heatmapUtils.d.ts +7 -12
- package/dist/components/charts/Heatmap/utils/heatmapUtils.js +16 -61
- package/dist/components/charts/Heatmap/utils/heatmapUtils.test.d.ts +1 -0
- package/dist/components/charts/HorizontalBarChart/HorizontalBarChart.d.ts +16 -0
- package/dist/components/charts/HorizontalBarChart/HorizontalBarChart.js +237 -0
- package/dist/components/charts/HorizontalBarChart/HorizontalBarChart.types.d.ts +62 -0
- package/dist/components/charts/HorizontalBarChart/HorizontalBarChart.types.js +21 -0
- package/dist/components/charts/HorizontalBarChart/index.d.ts +3 -0
- package/dist/components/charts/LineChart/LineChart.js +11 -28
- package/dist/components/charts/LineChart/LineChart.types.d.ts +11 -14
- package/dist/components/charts/LineChart/LineChart.types.js +11 -3
- package/dist/components/charts/LollipopChart/LollipopChart.d.ts +3 -0
- package/dist/components/charts/LollipopChart/LollipopChart.js +361 -0
- package/dist/components/charts/LollipopChart/LollipopChart.types.d.ts +42 -0
- package/dist/components/charts/LollipopChart/LollipopChart.types.js +12 -0
- package/dist/components/charts/LollipopChart/index.d.ts +3 -0
- package/dist/components/charts/RadarChart/RadarChart.js +1 -1
- package/dist/components/charts/StackedBarChart/StackedBarChart.js +151 -133
- package/dist/components/charts/StackedBarChart/StackedBarChart.types.d.ts +20 -18
- package/dist/components/charts/StackedBarChart/StackedBarChart.types.js +10 -4
- package/dist/components/charts/hooks/useChartAccessibility.d.ts +1 -1
- package/dist/components/charts/hooks/useChartAccessibility.js +12 -6
- package/dist/components/charts/hooks/useTooltipPosition.js +18 -6
- package/dist/components/charts/index.d.ts +10 -8
- package/dist/components/charts/index.js +8 -4
- package/dist/components/charts/shared/ChartAxis/CategoryYAxis.d.ts +14 -0
- package/dist/components/charts/shared/ChartAxis/CategoryYAxis.js +35 -0
- package/dist/components/charts/shared/ChartAxis/ChartAxis.types.d.ts +69 -8
- package/dist/components/charts/shared/ChartAxis/ValueXAxis.d.ts +14 -0
- package/dist/components/charts/shared/ChartAxis/ValueXAxis.js +64 -0
- package/dist/components/charts/shared/ChartAxis/XAxis.js +1 -1
- package/dist/components/charts/shared/ChartAxis/YAxis.js +2 -2
- package/dist/components/charts/shared/ChartAxis/index.d.ts +3 -1
- package/dist/components/charts/shared/ChartGrid/HorizontalGrid.d.ts +0 -2
- package/dist/components/charts/shared/ChartGrid/HorizontalGrid.js +1 -1
- package/dist/components/charts/shared/ChartGrid/VerticalGrid.d.ts +29 -0
- package/dist/components/charts/shared/ChartGrid/VerticalGrid.js +26 -0
- package/dist/components/charts/shared/ChartGrid/index.d.ts +2 -0
- package/dist/components/charts/shared/ChartMarker/ChartMarker.js +7 -1
- package/dist/components/charts/shared/ChartText/ChartText.theme.js +1 -1
- package/dist/components/charts/shared/index.d.ts +1 -1
- package/dist/components/charts/theme/chart.theme.js +21 -26
- package/dist/components/charts/types/chart.types.d.ts +9 -5
- package/dist/components/charts/types/chart.types.js +1 -7
- package/dist/components/charts/utils/animation-utils.d.ts +12 -7
- package/dist/components/charts/utils/animation-utils.js +19 -21
- package/dist/components/charts/utils/bar-emphasis.d.ts +32 -3
- package/dist/components/charts/utils/bar-emphasis.js +24 -8
- package/dist/components/charts/utils/index.d.ts +1 -0
- package/dist/components/charts/utils/series-color.d.ts +7 -0
- package/dist/components/charts/utils/series-color.js +20 -0
- package/dist/components/core/Accordion/Accordion.theme.js +3 -3
- package/dist/components/core/Accordion/AccordionTrigger.js +2 -2
- package/dist/components/core/Alert/Alert.animations.d.ts +11 -3
- package/dist/components/core/Alert/Alert.animations.js +30 -8
- package/dist/components/core/Alert/Alert.js +23 -9
- package/dist/components/core/Alert/Alert.theme.js +1 -1
- package/dist/components/core/Alert/Alert.types.d.ts +4 -2
- package/dist/components/core/AlertDialog/AlertDialog.js +2 -2
- package/dist/components/core/Avatar/Avatar.js +50 -42
- package/dist/components/core/Avatar/Avatar.theme.d.ts +8 -4
- package/dist/components/core/Avatar/Avatar.theme.js +64 -8
- package/dist/components/core/Avatar/Avatar.types.d.ts +13 -2
- package/dist/components/core/Avatar/index.d.ts +1 -1
- package/dist/components/core/AvatarGroup/AvatarGroup.js +6 -8
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.d.ts +1 -2
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +2 -6
- package/dist/components/core/AvatarGroup/AvatarGroup.types.d.ts +0 -6
- package/dist/components/core/AvatarGroup/index.d.ts +1 -1
- package/dist/components/core/Badge/Badge.animations.d.ts +0 -5
- package/dist/components/core/Badge/Badge.animations.js +5 -82
- package/dist/components/core/Badge/Badge.d.ts +7 -4
- package/dist/components/core/Badge/Badge.js +33 -65
- package/dist/components/core/Badge/Badge.theme.js +26 -24
- package/dist/components/core/Badge/Badge.types.d.ts +18 -34
- package/dist/components/core/Breadcrumbs/Breadcrumbs.theme.d.ts +1 -4
- package/dist/components/core/Breadcrumbs/Breadcrumbs.theme.js +6 -6
- package/dist/components/core/Button/Button.js +14 -58
- package/dist/components/core/Button/Button.theme.d.ts +2 -0
- package/dist/components/core/Button/Button.theme.js +35 -22
- package/dist/components/core/Button/Button.types.d.ts +26 -13
- package/dist/components/core/Button/index.d.ts +0 -2
- package/dist/components/core/Calendar/Calendar.js +20 -5
- package/dist/components/core/Calendar/Calendar.theme.js +15 -23
- package/dist/components/core/Calendar/Calendar.types.d.ts +0 -1
- package/dist/components/core/Calendar/CalendarMini/CalendarMini.js +3 -3
- package/dist/components/core/Calendar/CalendarMini/CalendarMini.theme.js +2 -2
- package/dist/components/core/Card/Card.js +7 -2
- package/dist/components/core/Card/Card.theme.js +40 -4
- package/dist/components/core/Card/Card.types.d.ts +20 -0
- package/dist/components/core/Card/CardBody.js +9 -1
- package/dist/components/core/Card/CardContext.d.ts +13 -0
- package/dist/components/core/Card/CardContext.js +14 -0
- package/dist/components/core/Card/CardFooter.js +1 -1
- package/dist/components/core/Card/CardHeader.js +4 -1
- package/dist/components/core/CommandPalette/CommandPalette.js +5 -4
- package/dist/components/core/CommandPalette/CommandPalette.theme.js +3 -7
- package/dist/components/core/CommandPalette/CommandPalette.types.d.ts +2 -0
- package/dist/components/core/ContextMenu/ContextMenu.theme.js +4 -3
- package/dist/components/core/ContextMenu/ContextMenu.types.d.ts +8 -1
- package/dist/components/core/ContextMenu/ContextMenuItem.js +2 -2
- package/dist/components/core/ContextMenu/ContextMenuSub.d.ts +11 -1
- package/dist/components/core/ContextMenu/ContextMenuSub.js +35 -22
- package/dist/components/core/ContextMenu/ContextMenuSubBody.js +14 -3
- package/dist/components/core/ContextMenu/ContextMenuSubTrigger.js +22 -9
- package/dist/components/core/DragDrop/DragDrop.theme.js +2 -2
- package/dist/components/core/Drawer/Drawer.theme.js +7 -4
- package/dist/components/core/Drawer/DrawerHeader.js +2 -3
- package/dist/components/core/Dropdown/Dropdown.theme.js +3 -1
- package/dist/components/core/Dropdown/DropdownItem.js +2 -2
- package/dist/components/core/Dropdown/DropdownMenu.js +22 -7
- package/dist/components/core/Dropdown/DropdownTrigger.js +16 -5
- package/dist/components/core/HeroCard/HeroCard.theme.js +5 -2
- package/dist/components/core/Kbd/Kbd.theme.js +4 -2
- package/dist/components/core/Link/Link.js +7 -5
- package/dist/components/core/Masonry/Masonry.theme.js +1 -1
- package/dist/components/core/MenuItem/MenuItem.js +2 -1
- package/dist/components/core/MenuItem/MenuItem.theme.js +13 -1
- package/dist/components/core/Message/Message.js +4 -2
- package/dist/components/core/Message/Message.theme.js +8 -10
- package/dist/components/core/Message/MessageAudio.js +2 -2
- package/dist/components/core/Message/MessageFile.js +2 -2
- package/dist/components/core/Message/MessageLink.js +2 -2
- package/dist/components/core/Message/MessageStatusIndicator.js +5 -5
- package/dist/components/core/Modal/Modal.animations.d.ts +1 -1
- package/dist/components/core/Modal/Modal.animations.js +50 -11
- package/dist/components/core/Modal/Modal.d.ts +1 -1
- package/dist/components/core/Modal/Modal.js +6 -2
- package/dist/components/core/Modal/Modal.theme.js +9 -4
- package/dist/components/core/Modal/ModalHeader.js +2 -3
- package/dist/components/core/ModalStack/ModalStackModal.js +4 -2
- package/dist/components/core/NavItem/NavItem.js +8 -7
- package/dist/components/core/NavItem/NavItem.theme.js +1 -1
- package/dist/components/core/OfflineIndicator/OfflineIndicator.animations.d.ts +22 -0
- package/dist/components/core/OfflineIndicator/OfflineIndicator.animations.js +54 -0
- package/dist/components/core/OfflineIndicator/OfflineIndicator.js +23 -24
- package/dist/components/core/OfflineIndicator/OfflineIndicator.theme.js +27 -6
- package/dist/components/core/OfflineIndicator/OfflineIndicator.types.d.ts +17 -0
- package/dist/components/core/PageHeading/PageHeading.theme.js +1 -1
- package/dist/components/core/PageHeading/PageHeadingBackButton.js +2 -2
- package/dist/components/core/Pagination/Pagination.js +3 -3
- package/dist/components/core/Pagination/Pagination.theme.js +5 -5
- package/dist/components/core/Pill/Pill.js +5 -2
- package/dist/components/core/Pill/Pill.theme.js +9 -5
- package/dist/components/core/Popover/PopoverBody.js +16 -5
- package/dist/components/core/Progress/Progress.d.ts +0 -25
- package/dist/components/core/Progress/Progress.js +79 -11
- package/dist/components/core/Progress/Progress.theme.js +17 -0
- package/dist/components/core/Progress/Progress.types.d.ts +47 -1
- package/dist/components/core/Rating/Rating.js +4 -5
- package/dist/components/core/Rating/Rating.theme.js +2 -2
- package/dist/components/core/Rating/Rating.types.d.ts +3 -2
- package/dist/components/core/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.theme.js +1 -1
- package/dist/components/core/Segmented/Segmented.theme.js +10 -7
- package/dist/components/core/Segmented/SegmentedContext.js +1 -0
- package/dist/components/core/Sidebar/Sidebar.js +5 -2
- package/dist/components/core/Sidebar/Sidebar.theme.js +2 -2
- package/dist/components/core/Sidebar/Sidebar.types.d.ts +4 -2
- package/dist/components/core/Sidebar/SidebarContent.js +1 -1
- package/dist/components/core/Sidebar/SidebarHeader.js +3 -3
- package/dist/components/core/Sidebar/SidebarMobileTrigger.js +2 -2
- package/dist/components/core/Sidebar/SidebarSearch.js +4 -4
- package/dist/components/core/Sidebar/SidebarToggle.js +3 -3
- package/dist/components/core/Sidebar/SidebarUserProfile.js +3 -3
- package/dist/components/core/Sortable/Sortable.js +2 -2
- package/dist/components/core/Sortable/Sortable.theme.js +1 -1
- package/dist/components/core/Tabs/Tabs.theme.js +1 -1
- package/dist/components/core/Tag/Tag.js +2 -2
- package/dist/components/core/Tag/Tag.theme.js +5 -3
- package/dist/components/core/Toast/Toast.js +3 -3
- package/dist/components/core/Toast/Toast.types.d.ts +1 -1
- package/dist/components/core/Toast/ToastProvider.js +1 -1
- package/dist/components/core/Toast/useToast.js +5 -5
- package/dist/components/core/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.js +42 -10
- package/dist/components/core/Tooltip/Tooltip.types.d.ts +25 -0
- package/dist/components/core/Tree/Tree.js +2 -2
- package/dist/components/core/Tree/Tree.theme.js +1 -1
- package/dist/components/core/index.d.ts +0 -2
- package/dist/components/core/index.js +0 -4
- package/dist/components/core/shared/ChartTooltip/ChartTooltip.animations.d.ts +4 -0
- package/dist/components/core/shared/ChartTooltip/ChartTooltip.animations.js +20 -0
- package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.js +1 -1
- package/dist/components/core/shared/Ripple.d.ts +16 -0
- package/dist/components/core/shared/Ripple.js +141 -0
- package/dist/components/core/shared/interaction.animations.d.ts +51 -0
- package/dist/components/core/shared/interaction.animations.js +59 -0
- package/dist/components/data-display/Feed/Feed.js +2 -2
- package/dist/components/data-display/GanttChart/GanttChart.theme.js +7 -7
- package/dist/components/data-display/GanttChart/GanttChartPanel.js +2 -2
- package/dist/components/data-display/GanttChart/GanttTableGroupRow.js +3 -3
- package/dist/components/data-display/GanttChart/GanttTaskBar.js +1 -1
- package/dist/components/data-display/GanttChart/GanttTaskContextMenu.js +2 -2
- package/dist/components/data-display/GanttChart/GanttTimelineHeader.js +1 -1
- package/dist/components/data-display/GanttChart/GanttToolbar.js +2 -3
- package/dist/components/data-display/KPI/KPI.js +12 -21
- package/dist/components/data-display/KPI/KPI.theme.js +8 -4
- package/dist/components/data-display/Metric/Metric.js +2 -2
- package/dist/components/data-display/Metric/Metric.theme.js +25 -8
- package/dist/components/data-display/Metric/Metric.types.d.ts +1 -1
- package/dist/components/data-display/Table/Table.theme.js +11 -11
- package/dist/components/data-display/Table/TableActions.js +2 -2
- package/dist/components/data-display/Table/TableActionsMenu.js +1 -1
- package/dist/components/data-display/Table/TableColumnManager.js +2 -3
- package/dist/components/data-display/Table/TableContext.js +1 -0
- package/dist/components/data-display/Table/TableDeclarative.js +3 -3
- package/dist/components/data-display/Table/TableFilter.js +13 -6
- package/dist/components/data-display/Table/TableHeader.js +3 -3
- package/dist/components/data-display/Table/TableRow.js +2 -2
- package/dist/components/data-display/Table/TableSelectionHeader.js +4 -4
- package/dist/components/data-display/Timeline/Timeline.theme.js +1 -1
- package/dist/components/data-display/Timeline/TimelineMarker.js +2 -2
- package/dist/components/effects/CustomCursor/CustomCursor.d.ts +1 -1
- package/dist/components/effects/CustomCursor/CustomCursor.js +3 -3
- package/dist/components/effects/CustomCursor/CustomCursor.theme.js +4 -4
- package/dist/components/effects/DotPattern/DotPattern.js +6 -0
- package/dist/components/effects/DotPattern/DotPattern.types.d.ts +4 -2
- package/dist/components/effects/MeshGradient/MeshGradient.utils.d.ts +1 -1
- package/dist/components/effects/MeshGradient/MeshGradient.utils.js +1 -1
- package/dist/components/effects/Neumorphic/InsetCircleButton.js +1 -1
- package/dist/components/effects/Overlay/Overlay.js +7 -3
- package/dist/components/effects/index.d.ts +0 -32
- package/dist/components/effects/index.js +0 -16
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.d.ts +0 -2
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.js +1 -93
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.types.d.ts +0 -10
- package/dist/components/effects/shared/ShaderCanvas/index.d.ts +1 -1
- package/dist/components/effects/shared/index.d.ts +1 -3
- package/dist/components/effects/shared/shaderNoise.glsl.d.ts +1 -1
- package/dist/components/effects/shared/shaderNoise.glsl.js +2 -11
- package/dist/components/forms/Checkbox/Checkbox.js +2 -1
- package/dist/components/forms/Checkbox/Checkbox.theme.js +3 -3
- package/dist/components/forms/ColorPicker/ColorPickerEyeDropper.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerGradient.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerHeader.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerImage.js +3 -3
- package/dist/components/forms/ColorPicker/ColorPickerInput.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerPresets.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerSavedColors.js +2 -2
- package/dist/components/forms/Combobox/Combobox.js +5 -3
- package/dist/components/forms/Combobox/Combobox.theme.js +2 -2
- package/dist/components/forms/DatePicker/DatePicker.animations.js +16 -25
- package/dist/components/forms/DatePicker/DatePicker.theme.js +2 -2
- package/dist/components/forms/DatePicker/DatePickerBody.js +1 -1
- package/dist/components/forms/DatePicker/DatePickerTrigger.js +2 -2
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +4 -4
- package/dist/components/forms/DateRangePicker/DateRangePickerBody.js +1 -1
- package/dist/components/forms/DateRangePicker/DateRangePickerContext.js +1 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerPresets.js +2 -2
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.js +2 -2
- package/dist/components/forms/FileUpload/FileUpload.js +4 -4
- package/dist/components/forms/FileUpload/FileUpload.theme.js +7 -3
- package/dist/components/forms/FileUpload/FileUploadProgress.js +7 -7
- package/dist/components/forms/FileUpload/FileUploadProgress.theme.js +1 -1
- package/dist/components/forms/Input/Input.js +6 -7
- package/dist/components/forms/Input/Input.theme.js +19 -15
- package/dist/components/forms/InputAddress/InputAddress.js +10 -3
- package/dist/components/forms/InputAddress/InputAddress.types.d.ts +2 -2
- package/dist/components/forms/InputCounter/InputCounter.js +3 -3
- package/dist/components/forms/InputOTP/InputOTP.d.ts +3 -12
- package/dist/components/forms/InputOTP/InputOTP.js +140 -151
- package/dist/components/forms/InputOTP/InputOTP.theme.d.ts +5 -1
- package/dist/components/forms/InputOTP/InputOTP.theme.js +40 -5
- package/dist/components/forms/InputOTP/InputOTP.types.d.ts +45 -2
- package/dist/components/forms/InputOTP/index.d.ts +1 -1
- package/dist/components/forms/InputTag/InputTag.js +5 -5
- package/dist/components/forms/InputTag/InputTag.theme.js +1 -2
- package/dist/components/forms/Mention/Mention.theme.js +3 -5
- package/dist/components/forms/Radio/Radio.js +3 -2
- package/dist/components/forms/Radio/Radio.theme.js +3 -3
- package/dist/components/forms/RichTextEditor/RichTextEditor.d.ts +12 -16
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +165 -1681
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.d.ts +12 -56
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +60 -118
- package/dist/components/forms/RichTextEditor/RichTextEditor.types.d.ts +62 -126
- package/dist/components/forms/RichTextEditor/RichTextLinkField.d.ts +18 -0
- package/dist/components/forms/RichTextEditor/RichTextLinkField.js +46 -0
- package/dist/components/forms/RichTextEditor/RichTextToolbar.d.ts +15 -0
- package/dist/components/forms/RichTextEditor/RichTextToolbar.js +93 -0
- package/dist/components/forms/RichTextEditor/editorCommands.d.ts +50 -0
- package/dist/components/forms/RichTextEditor/editorCommands.js +58 -0
- package/dist/components/forms/RichTextEditor/editorState.d.ts +19 -0
- package/dist/components/forms/RichTextEditor/editorState.js +103 -0
- package/dist/components/forms/RichTextEditor/index.d.ts +5 -3
- package/dist/components/forms/RichTextEditor/sanitizeHtml.d.ts +38 -0
- package/dist/components/forms/RichTextEditor/sanitizeHtml.js +179 -0
- package/dist/components/forms/RichTextEditor/sanitizeHtml.test.d.ts +1 -0
- package/dist/components/forms/Select/Select.d.ts +5 -1
- package/dist/components/forms/Select/Select.js +14 -13
- package/dist/components/forms/Select/Select.theme.js +4 -4
- package/dist/components/forms/Select/Select.types.d.ts +74 -8
- package/dist/components/forms/Select/useSelectState.d.ts +9 -3
- package/dist/components/forms/Select/useSelectState.js +4 -1
- package/dist/components/forms/SelectableCard/SelectableCard.animations.d.ts +1 -2
- package/dist/components/forms/SelectableCard/SelectableCard.animations.js +6 -7
- package/dist/components/forms/SelectableCard/SelectableCard.js +3 -2
- package/dist/components/forms/SelectableCard/SelectableCard.theme.js +1 -1
- package/dist/components/forms/Signature/Signature.js +1 -1
- package/dist/components/forms/Slider/Slider.js +24 -11
- package/dist/components/forms/Slider/Slider.theme.js +9 -3
- package/dist/components/forms/Switch/Switch.theme.js +3 -3
- package/dist/components/forms/TimePicker/TimePicker.theme.js +7 -8
- package/dist/components/forms/TimePicker/TimePickerContent.js +1 -1
- package/dist/components/forms/TimePicker/TimePickerTrigger.js +3 -3
- package/dist/components/forms/forms.theme.js +38 -13
- package/dist/components/forms/index.js +2 -1
- package/dist/components/generative/FormShell.d.ts +22 -0
- package/dist/components/generative/FormShell.js +102 -0
- package/dist/components/generative/GenerativeView.d.ts +52 -1
- package/dist/components/generative/GenerativeView.js +203 -11
- package/dist/components/generative/actions.d.ts +5 -0
- package/dist/components/generative/ai-sdk/index.d.ts +1 -0
- package/dist/components/generative/ai-sdk/index.js +1 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.d.ts +52 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.js +73 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.test.d.ts +1 -0
- package/dist/components/generative/fieldBinding.d.ts +31 -0
- package/dist/components/generative/fieldBinding.js +33 -0
- package/dist/components/generative/fieldBinding.test.d.ts +1 -0
- package/dist/components/generative/formScope.d.ts +71 -0
- package/dist/components/generative/formScope.js +135 -0
- package/dist/components/generative/index.d.ts +4 -0
- package/dist/components/generative/index.js +4 -0
- package/dist/components/generative/registry.d.ts +2 -0
- package/dist/components/generative/registry.js +197 -4
- package/dist/components/generative/resolvers.js +16 -16
- package/dist/components/generative/schema.generated.js +2522 -328
- package/dist/components/generative/toToolResult.d.ts +21 -0
- package/dist/components/generative/toToolResult.js +15 -0
- package/dist/components/generative/toToolResult.test.d.ts +1 -0
- package/dist/components/generative/validate.d.ts +10 -1
- package/dist/components/generative/validate.js +126 -11
- package/dist/components/layout/Grid/Grid.js +1 -0
- package/dist/components/layout/Section/Section.theme.js +1 -1
- package/dist/components/layout/Stack/Stack.js +1 -0
- package/dist/generative.schema.json +2522 -328
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useElapsedTime.d.ts +28 -0
- package/dist/hooks/useElapsedTime.js +37 -0
- package/dist/hooks/useSelectPortal.d.ts +10 -2
- package/dist/hooks/useSelectPortal.js +6 -3
- package/dist/index.js +2 -5
- package/dist/registry.json +3262 -2464
- package/dist/shadcn-compat.css +6 -6
- package/dist/styles/theme.test.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/dist/test/render.d.ts +17 -0
- package/dist/theme.css +5 -1
- package/dist/themes/ember.css +131 -0
- package/dist/themes/iris.css +94 -0
- package/dist/themes/jade.css +139 -0
- package/dist/themes/precision.css +232 -0
- package/dist/tools.json +2557 -328
- package/dist/utils/colorUtils.d.ts +6 -6
- package/dist/utils/colorUtils.js +8 -8
- package/dist/utils/index.d.ts +0 -1
- package/package.json +39 -6
- package/src/global.scss +32 -28
- package/src/styles/theme.css +547 -176
- package/src/styles/theme.test.ts +119 -0
- package/tailwind.preset.cjs +66 -38
- package/dist/components/charts/FunnelChart/FunnelChart.animations.d.ts +0 -35
- package/dist/components/charts/FunnelChart/FunnelChart.animations.js +0 -59
- package/dist/components/charts/FunnelChart/FunnelChart.d.ts +0 -8
- package/dist/components/charts/FunnelChart/FunnelChart.js +0 -410
- package/dist/components/charts/FunnelChart/FunnelChart.theme.d.ts +0 -2
- package/dist/components/charts/FunnelChart/FunnelChart.theme.js +0 -12
- package/dist/components/charts/FunnelChart/FunnelChart.types.d.ts +0 -105
- package/dist/components/charts/FunnelChart/index.d.ts +0 -4
- package/dist/components/charts/ScatterPlot/ScatterPlot.d.ts +0 -9
- package/dist/components/charts/ScatterPlot/ScatterPlot.js +0 -207
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.d.ts +0 -18
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.js +0 -42
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.d.ts +0 -65
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.js +0 -12
- package/dist/components/charts/ScatterPlot/index.d.ts +0 -3
- package/dist/components/core/Button/Button.ripple.d.ts +0 -71
- package/dist/components/core/Button/Button.ripple.js +0 -236
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.d.ts +0 -4
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.theme.d.ts +0 -12
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.types.d.ts +0 -23
- package/dist/components/core/Calendar/CalendarEvent/index.d.ts +0 -2
- package/dist/components/core/CardStack/CardStack.animations.d.ts +0 -47
- package/dist/components/core/CardStack/CardStack.d.ts +0 -3
- package/dist/components/core/CardStack/CardStack.js +0 -187
- package/dist/components/core/CardStack/CardStack.theme.d.ts +0 -6
- package/dist/components/core/CardStack/CardStack.theme.js +0 -33
- package/dist/components/core/CardStack/CardStack.types.d.ts +0 -139
- package/dist/components/core/CardStack/index.d.ts +0 -7
- package/dist/components/core/Carousel/Carousel.d.ts +0 -3
- package/dist/components/core/Carousel/Carousel.js +0 -83
- package/dist/components/core/Carousel/Carousel.theme.d.ts +0 -10
- package/dist/components/core/Carousel/Carousel.theme.js +0 -20
- package/dist/components/core/Carousel/Carousel.types.d.ts +0 -113
- package/dist/components/core/Carousel/CarouselBody.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselBody.js +0 -59
- package/dist/components/core/Carousel/CarouselContext.d.ts +0 -3
- package/dist/components/core/Carousel/CarouselContext.js +0 -13
- package/dist/components/core/Carousel/CarouselItem.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselItem.js +0 -11
- package/dist/components/core/Carousel/CarouselNext.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselNext.js +0 -16
- package/dist/components/core/Carousel/CarouselPrevious.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselPrevious.js +0 -16
- package/dist/components/core/Carousel/index.d.ts +0 -3
- package/dist/components/core/Pill/Pill.animations.d.ts +0 -32
- package/dist/components/core/Pill/Pill.animations.js +0 -16
- package/dist/components/effects/ColorPanels/ColorPanels.d.ts +0 -8
- package/dist/components/effects/ColorPanels/ColorPanels.js +0 -66
- package/dist/components/effects/ColorPanels/ColorPanels.shaders.d.ts +0 -12
- package/dist/components/effects/ColorPanels/ColorPanels.shaders.js +0 -218
- package/dist/components/effects/ColorPanels/ColorPanels.types.d.ts +0 -29
- package/dist/components/effects/ColorPanels/ColorPanels.types.js +0 -3
- package/dist/components/effects/ColorPanels/index.d.ts +0 -2
- package/dist/components/effects/FlutedGlass/FlutedGlass.d.ts +0 -9
- package/dist/components/effects/FlutedGlass/FlutedGlass.js +0 -80
- package/dist/components/effects/FlutedGlass/FlutedGlass.shaders.d.ts +0 -12
- package/dist/components/effects/FlutedGlass/FlutedGlass.shaders.js +0 -335
- package/dist/components/effects/FlutedGlass/FlutedGlass.types.d.ts +0 -61
- package/dist/components/effects/FlutedGlass/FlutedGlass.types.js +0 -16
- package/dist/components/effects/FlutedGlass/index.d.ts +0 -3
- package/dist/components/effects/GlassEffect/GlassEffect.d.ts +0 -15
- package/dist/components/effects/GlassEffect/GlassEffect.js +0 -38
- package/dist/components/effects/GlassEffect/GlassEffect.types.d.ts +0 -19
- package/dist/components/effects/GlassEffect/index.d.ts +0 -2
- package/dist/components/effects/GlassSurface/GlassSurface.d.ts +0 -8
- package/dist/components/effects/GlassSurface/GlassSurface.js +0 -250
- package/dist/components/effects/GlassSurface/GlassSurface.types.d.ts +0 -66
- package/dist/components/effects/GlassSurface/index.d.ts +0 -2
- package/dist/components/effects/GodRays/GodRays.d.ts +0 -8
- package/dist/components/effects/GodRays/GodRays.js +0 -68
- package/dist/components/effects/GodRays/GodRays.shaders.d.ts +0 -10
- package/dist/components/effects/GodRays/GodRays.shaders.js +0 -128
- package/dist/components/effects/GodRays/GodRays.types.d.ts +0 -25
- package/dist/components/effects/GodRays/GodRays.types.js +0 -3
- package/dist/components/effects/GodRays/index.d.ts +0 -2
- package/dist/components/effects/GridPattern/GridPattern.d.ts +0 -18
- package/dist/components/effects/GridPattern/GridPattern.js +0 -65
- package/dist/components/effects/GridPattern/GridPattern.types.d.ts +0 -47
- package/dist/components/effects/GridPattern/index.d.ts +0 -2
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.d.ts +0 -10
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.js +0 -78
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.shaders.d.ts +0 -22
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.shaders.js +0 -239
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.types.d.ts +0 -52
- package/dist/components/effects/HalftoneCmyk/index.d.ts +0 -2
- package/dist/components/effects/HalftoneDots/HalftoneDots.d.ts +0 -9
- package/dist/components/effects/HalftoneDots/HalftoneDots.js +0 -68
- package/dist/components/effects/HalftoneDots/HalftoneDots.shaders.d.ts +0 -13
- package/dist/components/effects/HalftoneDots/HalftoneDots.shaders.js +0 -296
- package/dist/components/effects/HalftoneDots/HalftoneDots.types.d.ts +0 -43
- package/dist/components/effects/HalftoneDots/HalftoneDots.types.js +0 -12
- package/dist/components/effects/HalftoneDots/index.d.ts +0 -3
- package/dist/components/effects/ImageDithering/ImageDithering.d.ts +0 -9
- package/dist/components/effects/ImageDithering/ImageDithering.js +0 -68
- package/dist/components/effects/ImageDithering/ImageDithering.shaders.d.ts +0 -12
- package/dist/components/effects/ImageDithering/ImageDithering.shaders.js +0 -117
- package/dist/components/effects/ImageDithering/ImageDithering.types.d.ts +0 -30
- package/dist/components/effects/ImageDithering/ImageDithering.types.js +0 -8
- package/dist/components/effects/ImageDithering/index.d.ts +0 -3
- package/dist/components/effects/MagneticElement/MagneticElement.d.ts +0 -30
- package/dist/components/effects/MagneticElement/MagneticElement.js +0 -111
- package/dist/components/effects/MagneticElement/MagneticElement.types.d.ts +0 -44
- package/dist/components/effects/MagneticElement/index.d.ts +0 -2
- package/dist/components/effects/Metaballs/Metaballs.d.ts +0 -8
- package/dist/components/effects/Metaballs/Metaballs.js +0 -59
- package/dist/components/effects/Metaballs/Metaballs.shaders.d.ts +0 -10
- package/dist/components/effects/Metaballs/Metaballs.shaders.js +0 -102
- package/dist/components/effects/Metaballs/Metaballs.types.d.ts +0 -16
- package/dist/components/effects/Metaballs/Metaballs.types.js +0 -3
- package/dist/components/effects/Metaballs/index.d.ts +0 -2
- package/dist/components/effects/PaperTexture/PaperTexture.d.ts +0 -9
- package/dist/components/effects/PaperTexture/PaperTexture.js +0 -61
- package/dist/components/effects/PaperTexture/PaperTexture.shaders.d.ts +0 -22
- package/dist/components/effects/PaperTexture/PaperTexture.shaders.js +0 -145
- package/dist/components/effects/PaperTexture/PaperTexture.types.d.ts +0 -19
- package/dist/components/effects/PaperTexture/index.d.ts +0 -2
- package/dist/components/effects/PulsingBorder/PulsingBorder.d.ts +0 -27
- package/dist/components/effects/PulsingBorder/PulsingBorder.js +0 -174
- package/dist/components/effects/PulsingBorder/PulsingBorder.shaders.d.ts +0 -14
- package/dist/components/effects/PulsingBorder/PulsingBorder.shaders.js +0 -258
- package/dist/components/effects/PulsingBorder/PulsingBorder.types.d.ts +0 -75
- package/dist/components/effects/PulsingBorder/PulsingBorder.types.js +0 -3
- package/dist/components/effects/PulsingBorder/index.d.ts +0 -2
- package/dist/components/effects/SmokeRing/SmokeRing.d.ts +0 -8
- package/dist/components/effects/SmokeRing/SmokeRing.js +0 -62
- package/dist/components/effects/SmokeRing/SmokeRing.shaders.d.ts +0 -14
- package/dist/components/effects/SmokeRing/SmokeRing.shaders.js +0 -130
- package/dist/components/effects/SmokeRing/SmokeRing.types.d.ts +0 -22
- package/dist/components/effects/SmokeRing/SmokeRing.types.js +0 -3
- package/dist/components/effects/SmokeRing/index.d.ts +0 -2
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.d.ts +0 -9
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.js +0 -59
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.shaders.d.ts +0 -14
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.shaders.js +0 -129
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.types.d.ts +0 -23
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.types.js +0 -3
- package/dist/components/effects/StaticGradientMesh/index.d.ts +0 -2
- package/dist/components/effects/Water/Water.d.ts +0 -9
- package/dist/components/effects/Water/Water.js +0 -65
- package/dist/components/effects/Water/Water.shaders.d.ts +0 -11
- package/dist/components/effects/Water/Water.shaders.js +0 -123
- package/dist/components/effects/Water/Water.types.d.ts +0 -25
- package/dist/components/effects/Water/index.d.ts +0 -2
- package/dist/components/effects/shared/bayerMatrices.glsl.d.ts +0 -10
- package/dist/components/effects/shared/bayerMatrices.glsl.js +0 -44
- package/dist/components/effects/shared/imageUV.glsl.d.ts +0 -12
- package/dist/components/effects/shared/imageUV.glsl.js +0 -26
- package/dist/components/forms/RichTextEditor/RichTextEditor.animations.d.ts +0 -7
- package/dist/components/forms/RichTextEditor/RichTextEditor.animations.js +0 -32
- package/dist/utils/calendarUtils.d.ts +0 -60
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.theme.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.theme.js +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.types.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltipContent.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/index.d.ts +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Process raw heatmap data and calculate necessary values
|
|
2
|
+
* Process raw heatmap data and calculate necessary values.
|
|
3
|
+
* `minValue`/`maxValue` are the flat family-standard bounds; either may be
|
|
4
|
+
* omitted, in which case it is derived from the data.
|
|
3
5
|
*/
|
|
4
|
-
function processHeatmapData(data,
|
|
6
|
+
function processHeatmapData(data, minValue, maxValue) {
|
|
5
7
|
// Extract unique categories preserving the order they appear in the data
|
|
6
8
|
const xCategories = [];
|
|
7
9
|
const yCategories = [];
|
|
8
|
-
// Preserve order by iterating through data and collecting unique values
|
|
9
10
|
data.forEach(point => {
|
|
10
11
|
if (!xCategories.includes(point.x)) {
|
|
11
12
|
xCategories.push(point.x);
|
|
@@ -14,18 +15,18 @@ function processHeatmapData(data, valueRange) {
|
|
|
14
15
|
yCategories.push(point.y);
|
|
15
16
|
}
|
|
16
17
|
});
|
|
17
|
-
// Calculate value range if not provided
|
|
18
18
|
const values = data.map(d => d.value).filter(v => v !== null);
|
|
19
19
|
const calculatedMin = Math.min(...values);
|
|
20
20
|
const calculatedMax = Math.max(...values);
|
|
21
|
-
const
|
|
21
|
+
const resolvedMin = minValue !== null && minValue !== void 0 ? minValue : calculatedMin;
|
|
22
|
+
const resolvedMax = maxValue !== null && maxValue !== void 0 ? maxValue : calculatedMax;
|
|
22
23
|
return {
|
|
23
24
|
data,
|
|
24
25
|
xCategories,
|
|
25
26
|
yCategories,
|
|
26
|
-
valueRange:
|
|
27
|
-
minValue:
|
|
28
|
-
maxValue:
|
|
27
|
+
valueRange: [resolvedMin, resolvedMax],
|
|
28
|
+
minValue: resolvedMin,
|
|
29
|
+
maxValue: resolvedMax,
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
@@ -56,11 +57,14 @@ function createGridMatrix(data, xCategories, yCategories) {
|
|
|
56
57
|
}));
|
|
57
58
|
}
|
|
58
59
|
/**
|
|
59
|
-
*
|
|
60
|
+
* Default tooltip content for a data point. `label` is the series label from
|
|
61
|
+
* `config[key].label` — the family contract every other chart already honours.
|
|
60
62
|
*/
|
|
61
|
-
function getDefaultTooltipContent(data) {
|
|
63
|
+
function getDefaultTooltipContent(data, label) {
|
|
62
64
|
const value = data.value !== null ? data.value.toString() : 'No data';
|
|
63
|
-
return
|
|
65
|
+
return label
|
|
66
|
+
? `${data.x} · ${data.y} — ${label}: ${value}`
|
|
67
|
+
: `${data.x}, ${data.y}: ${value}`;
|
|
64
68
|
}
|
|
65
69
|
/**
|
|
66
70
|
* Format axis labels with common patterns
|
|
@@ -117,54 +121,5 @@ function formatAxisLabel(value, type = 'default') {
|
|
|
117
121
|
}
|
|
118
122
|
return String(value);
|
|
119
123
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Generate sample heatmap data for testing/examples
|
|
122
|
-
*/
|
|
123
|
-
function generateSampleData(type = 'weekly') {
|
|
124
|
-
const data = [];
|
|
125
|
-
switch (type) {
|
|
126
|
-
case 'weekly':
|
|
127
|
-
const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
|
128
|
-
const weeks = Array.from({ length: 12 }, (_, i) => `Week ${i + 1}`);
|
|
129
|
-
weeks.forEach(week => {
|
|
130
|
-
days.forEach(day => {
|
|
131
|
-
data.push({
|
|
132
|
-
x: day,
|
|
133
|
-
y: week,
|
|
134
|
-
value: Math.floor(Math.random() * 20),
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
break;
|
|
139
|
-
case 'monthly':
|
|
140
|
-
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
|
141
|
-
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
142
|
-
const years = ['2022', '2023', '2024'];
|
|
143
|
-
years.forEach(year => {
|
|
144
|
-
months.forEach(month => {
|
|
145
|
-
data.push({
|
|
146
|
-
x: month,
|
|
147
|
-
y: year,
|
|
148
|
-
value: Math.floor(Math.random() * 100),
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
break;
|
|
153
|
-
case 'hourly':
|
|
154
|
-
const hours = Array.from({ length: 24 }, (_, i) => i);
|
|
155
|
-
const daysOfWeek = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
|
156
|
-
daysOfWeek.forEach(day => {
|
|
157
|
-
hours.forEach(hour => {
|
|
158
|
-
data.push({
|
|
159
|
-
x: hour,
|
|
160
|
-
y: day,
|
|
161
|
-
value: Math.floor(Math.random() * 50),
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
return data;
|
|
168
|
-
}
|
|
169
124
|
|
|
170
|
-
export { calculateIntensity, createGridMatrix, formatAxisLabel,
|
|
125
|
+
export { calculateIntensity, createGridMatrix, formatAxisLabel, getDefaultTooltipContent, processHeatmapData };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { HorizontalBarChartProps } from "./HorizontalBarChart.types";
|
|
3
|
+
/**
|
|
4
|
+
* HorizontalBarChart — categories run down the left, values extend to the right.
|
|
5
|
+
*
|
|
6
|
+
* Conventionally a "bar chart" in strict statistical usage (where vertical bars are a
|
|
7
|
+
* "column chart"); most libraries expose it as an orientation. Here it is its own
|
|
8
|
+
* component: it shares BarChart's data model but none of its axis wiring, because the
|
|
9
|
+
* value/category axes are swapped.
|
|
10
|
+
*
|
|
11
|
+
* 🔴 Axis vocabulary: `CategoryYAxis` (categories, vertical) + `ValueXAxis` (values,
|
|
12
|
+
* horizontal) + `VerticalGrid`. Do NOT reach for XAxis/YAxis — those are the CATEGORY-
|
|
13
|
+
* bottom / VALUE-left pair a column chart needs; the axis family splits by what an axis
|
|
14
|
+
* measures, not which way it points.
|
|
15
|
+
*/
|
|
16
|
+
export declare const HorizontalBarChart: React.FC<HorizontalBarChartProps>;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useRef, useId, useState, useEffect, useMemo } from 'react';
|
|
4
|
+
import { useReducedMotion, motion } from 'motion/react';
|
|
5
|
+
import { cn } from '../../../utils/cn.js';
|
|
6
|
+
import { useTooltipPosition } from '../hooks/useTooltipPosition.js';
|
|
7
|
+
import { useChartAccessibility } from '../hooks/useChartAccessibility.js';
|
|
8
|
+
import { useChartValidation } from '../hooks/useChartValidation.js';
|
|
9
|
+
import { useChartDimensions } from '../hooks/useChartDimensions.js';
|
|
10
|
+
import { ChartErrorBoundary } from '../shared/ChartErrorBoundary/ChartErrorBoundary.js';
|
|
11
|
+
import { CategoryYAxis } from '../shared/ChartAxis/CategoryYAxis.js';
|
|
12
|
+
import { ValueXAxis } from '../shared/ChartAxis/ValueXAxis.js';
|
|
13
|
+
import { VerticalGrid } from '../shared/ChartGrid/VerticalGrid.js';
|
|
14
|
+
import { ChartTooltip } from '../../core/shared/ChartTooltip/ChartTooltip.js';
|
|
15
|
+
import { resolveLegendPosition, ChartLegend } from '../shared/ChartLegend/ChartLegend.js';
|
|
16
|
+
import { HORIZONTAL_BAR_CHART_DEFAULTS } from './HorizontalBarChart.types.js';
|
|
17
|
+
import { X_AXIS_MARGIN } from '../types/chart.types.js';
|
|
18
|
+
import { barEntranceTransition, BAR_GROUP_STAGGER } from '../utils/animation-utils.js';
|
|
19
|
+
import { BarRingDef, BarGlowRing, barDimOpacity, deriveBarEmphasis, barStrokeStyle } from '../utils/bar-emphasis.js';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Bar with only its FAR end rounded — the end the bar grows toward. The baseline end
|
|
23
|
+
* stays square so bars sit flush against the zero line, exactly as BarChart's
|
|
24
|
+
* `createRoundedTopBarPath` keeps a column's base square and rounds its top.
|
|
25
|
+
*
|
|
26
|
+
* `grow` is the direction the bar extends from zero: "right" for positive values,
|
|
27
|
+
* "left" for negative ones (whose far end is on the left).
|
|
28
|
+
*/
|
|
29
|
+
const createRoundedEndBarPath = (x, y, width, height, radius, grow) => {
|
|
30
|
+
const r = Math.max(0, Math.min(radius, width, height / 2));
|
|
31
|
+
if (grow === "right") {
|
|
32
|
+
return `
|
|
33
|
+
M ${x},${y}
|
|
34
|
+
L ${x + width - r},${y}
|
|
35
|
+
Q ${x + width},${y} ${x + width},${y + r}
|
|
36
|
+
L ${x + width},${y + height - r}
|
|
37
|
+
Q ${x + width},${y + height} ${x + width - r},${y + height}
|
|
38
|
+
L ${x},${y + height}
|
|
39
|
+
Z
|
|
40
|
+
`.trim();
|
|
41
|
+
}
|
|
42
|
+
return `
|
|
43
|
+
M ${x + width},${y}
|
|
44
|
+
L ${x + r},${y}
|
|
45
|
+
Q ${x},${y} ${x},${y + r}
|
|
46
|
+
L ${x},${y + height - r}
|
|
47
|
+
Q ${x},${y + height} ${x + r},${y + height}
|
|
48
|
+
L ${x + width},${y + height}
|
|
49
|
+
Z
|
|
50
|
+
`.trim();
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* HorizontalBarChart — categories run down the left, values extend to the right.
|
|
54
|
+
*
|
|
55
|
+
* Conventionally a "bar chart" in strict statistical usage (where vertical bars are a
|
|
56
|
+
* "column chart"); most libraries expose it as an orientation. Here it is its own
|
|
57
|
+
* component: it shares BarChart's data model but none of its axis wiring, because the
|
|
58
|
+
* value/category axes are swapped.
|
|
59
|
+
*
|
|
60
|
+
* 🔴 Axis vocabulary: `CategoryYAxis` (categories, vertical) + `ValueXAxis` (values,
|
|
61
|
+
* horizontal) + `VerticalGrid`. Do NOT reach for XAxis/YAxis — those are the CATEGORY-
|
|
62
|
+
* bottom / VALUE-left pair a column chart needs; the axis family splits by what an axis
|
|
63
|
+
* measures, not which way it points.
|
|
64
|
+
*/
|
|
65
|
+
const HorizontalBarChart = ({ data, config, className, width = "100%", height = 400, title, description, enableKeyboardNavigation = true, showGrid = HORIZONTAL_BAR_CHART_DEFAULTS.showGrid, showXAxis = HORIZONTAL_BAR_CHART_DEFAULTS.showXAxis, showYAxis = HORIZONTAL_BAR_CHART_DEFAULTS.showYAxis, legend, minValue: propMinValue, maxValue: propMaxValue, barRadius, radius, // @deprecated — mapped to barRadius below, same cascade as BarChart
|
|
66
|
+
gap = HORIZONTAL_BAR_CHART_DEFAULTS.gap, categoryGap = HORIZONTAL_BAR_CHART_DEFAULTS.categoryGap, categoryWidth = HORIZONTAL_BAR_CHART_DEFAULTS.categoryWidth, colors, showAnimation = HORIZONTAL_BAR_CHART_DEFAULTS.showAnimation, showValidationWarnings = process.env.NODE_ENV === "development", darkMode = false, valueFormatter, }) => {
|
|
67
|
+
var _a;
|
|
68
|
+
const containerRef = useRef(null);
|
|
69
|
+
const { dimensions, measured } = useChartDimensions(containerRef);
|
|
70
|
+
const shouldReduceMotion = useReducedMotion();
|
|
71
|
+
// Sanitised for SVG url(#…) refs, matching LollipopChart — useId's format is a React
|
|
72
|
+
// implementation detail and has historically contained characters that break a
|
|
73
|
+
// fragment reference.
|
|
74
|
+
const chartId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
|
|
75
|
+
const [hoveredKey, setHoveredKey] = useState(null);
|
|
76
|
+
// Entrance runs once; afterwards `barEntranceTransition` drops the staggered opacity
|
|
77
|
+
// delay so hover/data updates respond immediately instead of re-queueing behind it.
|
|
78
|
+
const [hasAnimated, setHasAnimated] = useState(false);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
setHasAnimated(true);
|
|
81
|
+
}, [shouldReduceMotion, showAnimation]);
|
|
82
|
+
const isMobile = typeof window !== "undefined" &&
|
|
83
|
+
("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
84
|
+
const { tooltipData, tooltipRef, handleMouseEnter, handleMouseMove, handleMouseLeave } = useTooltipPosition({ containerRef, isMobile });
|
|
85
|
+
const { isValid, sanitizedData, safeScale } = useChartValidation(data, config, {
|
|
86
|
+
autoSanitize: true,
|
|
87
|
+
// Wired, not decorative: ESLint caught this prop destructured-but-unread on the
|
|
88
|
+
// first draft — i.e. the exact dead-prop pattern the chart family is full of.
|
|
89
|
+
logWarnings: showValidationWarnings,
|
|
90
|
+
});
|
|
91
|
+
const seriesKeys = useMemo(() => Object.keys(config), [config]);
|
|
92
|
+
const { chartAccessibilityProps, descriptionProps, focusedElementIndex, isKeyboardMode, } = useChartAccessibility({
|
|
93
|
+
chartType: "bar",
|
|
94
|
+
data: sanitizedData,
|
|
95
|
+
config,
|
|
96
|
+
title,
|
|
97
|
+
description,
|
|
98
|
+
enableKeyboardNavigation,
|
|
99
|
+
});
|
|
100
|
+
const resolvedRadius = (_a = barRadius !== null && barRadius !== void 0 ? barRadius : radius) !== null && _a !== void 0 ? _a : HORIZONTAL_BAR_CHART_DEFAULTS.barRadius;
|
|
101
|
+
const seriesColor = (key, index) => { var _a, _b, _c; return (_c = (_a = colors === null || colors === void 0 ? void 0 : colors[index % colors.length]) !== null && _a !== void 0 ? _a : (_b = config[key]) === null || _b === void 0 ? void 0 : _b.color) !== null && _c !== void 0 ? _c : "var(--color-primary)"; };
|
|
102
|
+
// Category labels live on the LEFT, so their width is the left margin. Unlike a
|
|
103
|
+
// bottom axis (which uses the shared X_AXIS_MARGIN so side-by-side charts align),
|
|
104
|
+
// this is caller-controlled — no constant can know how wide "United Kingdom" is.
|
|
105
|
+
const margin = useMemo(() => ({
|
|
106
|
+
top: 8,
|
|
107
|
+
right: 16,
|
|
108
|
+
bottom: showXAxis ? X_AXIS_MARGIN : 8,
|
|
109
|
+
left: showYAxis ? categoryWidth : 8,
|
|
110
|
+
}), [showXAxis, showYAxis, categoryWidth]);
|
|
111
|
+
const innerWidth = Math.max(0, dimensions.width - margin.left - margin.right);
|
|
112
|
+
const innerHeight = Math.max(0, dimensions.height - margin.top - margin.bottom);
|
|
113
|
+
// 🔴 Range via safeScale.calculateRange, exactly as BarChart does — NOT a hand-rolled
|
|
114
|
+
// min/max. It returns a *nice* range, which the axis's Heckbert tick generation then
|
|
115
|
+
// lands on exactly. A raw data max (e.g. 1280) desyncs the two: generateNiceTicks
|
|
116
|
+
// emits 0…2000 while the scale still divides by 1280, so the upper ticks position
|
|
117
|
+
// past the end of the axis. `includeZero` keeps every bar on a shared baseline.
|
|
118
|
+
const { min: minValue, max: maxValue } = safeScale.calculateRange({
|
|
119
|
+
minValue: propMinValue,
|
|
120
|
+
maxValue: propMaxValue,
|
|
121
|
+
includeZero: true,
|
|
122
|
+
});
|
|
123
|
+
const range = maxValue - minValue;
|
|
124
|
+
const scaleX = (value) => range > 0 ? ((value - minValue) / range) * innerWidth : 0;
|
|
125
|
+
// Where value 0 sits — bars grow right from here (or left, for negatives).
|
|
126
|
+
const zeroX = margin.left + scaleX(0);
|
|
127
|
+
const categoryCount = sanitizedData.length;
|
|
128
|
+
const totalCategoryGap = Math.max(0, (categoryCount - 1) * categoryGap);
|
|
129
|
+
const categoryHeight = categoryCount > 0
|
|
130
|
+
? Math.max(0, (innerHeight - totalCategoryGap) / categoryCount)
|
|
131
|
+
: 0;
|
|
132
|
+
// Each series gets a row inside its category band.
|
|
133
|
+
const barHeight = seriesKeys.length > 0
|
|
134
|
+
? Math.max(0, (categoryHeight - gap * (seriesKeys.length - 1)) / seriesKeys.length)
|
|
135
|
+
: 0;
|
|
136
|
+
const legendPosition = resolveLegendPosition(legend, config);
|
|
137
|
+
const legendItems = useMemo(() => seriesKeys.map((key, index) => {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
return ({
|
|
140
|
+
key,
|
|
141
|
+
label: (_b = (_a = config[key]) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : key,
|
|
142
|
+
color: seriesColor(key, index),
|
|
143
|
+
});
|
|
144
|
+
}),
|
|
145
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
146
|
+
[seriesKeys, config, colors]);
|
|
147
|
+
const formatValue = (value) => valueFormatter ? valueFormatter(value) : String(value);
|
|
148
|
+
if (!isValid || categoryCount === 0) {
|
|
149
|
+
return (jsx("div", { ref: containerRef, className: cn("flex items-center justify-center", darkMode && "dark", className), style: { width, height }, children: jsx("span", { className: "text-sm text-[var(--color-text-muted)]", children: "Invalid Chart Data" }) }));
|
|
150
|
+
}
|
|
151
|
+
return (jsx(ChartErrorBoundary, { children: jsxs("div", { ref: containerRef, className: cn("relative flex flex-col", darkMode && "dark", className), style: { width, height }, ...chartAccessibilityProps, children: [description && jsx("span", { ...descriptionProps }), legendPosition === "top" && (jsx(ChartLegend, { items: legendItems, className: "shrink-0 pb-2" })), jsx("div", { className: "relative min-h-0 flex-1", children: jsxs("svg", { width: "100%", height: "100%", viewBox: `0 0 ${dimensions.width} ${dimensions.height}`,
|
|
152
|
+
// The hover glow ring bleeds past the plot box, so it must not be clipped.
|
|
153
|
+
style: { overflow: "visible" }, children: [jsx("defs", { children: seriesKeys.map((key, index) => (jsx(BarRingDef, { ringId: `${chartId}-hbar-ring-${index}`, color: seriesColor(key, index) }, key))) }), jsx(VerticalGrid, { show: showGrid && measured, x: margin.left, y: margin.top, width: innerWidth, height: innerHeight, lineCount: 5 }), jsx(CategoryYAxis, { show: showYAxis && measured, data: sanitizedData, x: margin.left, y: margin.top, height: innerHeight, categoryHeight: categoryHeight, categoryGap: categoryGap, maxLabelWidth: Math.max(0, categoryWidth - 16) }), jsx(ValueXAxis, { show: showXAxis && measured, min: minValue, max: maxValue, x: margin.left, y: margin.top + innerHeight, width: innerWidth }), measured && (jsx("g", { className: "chart-hbars", children: sanitizedData.map((item, categoryIndex) => {
|
|
154
|
+
const bandY = margin.top + categoryIndex * (categoryHeight + categoryGap);
|
|
155
|
+
return (jsx("g", { children: seriesKeys.map((key, seriesIndex) => {
|
|
156
|
+
const rawValue = item[key];
|
|
157
|
+
const isNull = rawValue === null ||
|
|
158
|
+
rawValue === undefined ||
|
|
159
|
+
!(typeof rawValue === "number" && isFinite(rawValue));
|
|
160
|
+
if (isNull)
|
|
161
|
+
return null;
|
|
162
|
+
const value = rawValue;
|
|
163
|
+
const barY = bandY + seriesIndex * (barHeight + gap);
|
|
164
|
+
const valueX = margin.left + scaleX(value);
|
|
165
|
+
const barX = Math.min(zeroX, valueX);
|
|
166
|
+
const barWidth = Math.abs(valueX - zeroX);
|
|
167
|
+
const fillColor = seriesColor(key, seriesIndex);
|
|
168
|
+
const hoverKey = `${categoryIndex}-${key}`;
|
|
169
|
+
const isHovered = hoveredKey === hoverKey;
|
|
170
|
+
const isFocused = isKeyboardMode && focusedElementIndex === categoryIndex;
|
|
171
|
+
const { isEmphasized, shouldReduceOpacity } = deriveBarEmphasis({
|
|
172
|
+
isHovered,
|
|
173
|
+
isFocused,
|
|
174
|
+
isAnyBarHovered: hoveredKey !== null,
|
|
175
|
+
// Fills are flat, but hover still gets BarChart's premium
|
|
176
|
+
// response: glow ring + colored stroke + the stronger dim.
|
|
177
|
+
isGradientVariant: false,
|
|
178
|
+
premiumEmphasis: true,
|
|
179
|
+
});
|
|
180
|
+
const stroke = barStrokeStyle({
|
|
181
|
+
isFocused,
|
|
182
|
+
isEmphasized,
|
|
183
|
+
isGradientVariant: false,
|
|
184
|
+
fillColor,
|
|
185
|
+
// No resting hairline: these bars read as flat shapes. The
|
|
186
|
+
// focus/emphasis strokes still apply, so keyboard focus and
|
|
187
|
+
// hover stay visible.
|
|
188
|
+
showRestingStroke: false,
|
|
189
|
+
});
|
|
190
|
+
const pathD = createRoundedEndBarPath(barX, barY, barWidth, barHeight, resolvedRadius, value >= 0 ? "right" : "left");
|
|
191
|
+
return (jsxs(React__default.Fragment, { children: [jsx(BarGlowRing, { show: isEmphasized, pathD: pathD, color: fillColor, barWidth: barHeight, filter: `url(#${chartId}-hbar-ring-${seriesIndex})` }), jsx(motion.g, { style: {
|
|
192
|
+
cursor: "pointer",
|
|
193
|
+
transformBox: "fill-box",
|
|
194
|
+
originX: value >= 0 ? 0 : 1,
|
|
195
|
+
originY: 0.5,
|
|
196
|
+
}, initial: showAnimation && !shouldReduceMotion
|
|
197
|
+
? { scaleX: 0, opacity: 0 }
|
|
198
|
+
: { scaleX: 1, opacity: 1 }, animate: {
|
|
199
|
+
scaleX: 1,
|
|
200
|
+
opacity: barDimOpacity(shouldReduceOpacity, true),
|
|
201
|
+
}, transition: barEntranceTransition(categoryIndex * BAR_GROUP_STAGGER, hasAnimated), onMouseEnter: (e) => {
|
|
202
|
+
var _a, _b;
|
|
203
|
+
setHoveredKey(hoverKey);
|
|
204
|
+
handleMouseEnter(e, {
|
|
205
|
+
category: ((_a = item.name) !== null && _a !== void 0 ? _a : `Category ${categoryIndex + 1}`).toString(),
|
|
206
|
+
series: [
|
|
207
|
+
{
|
|
208
|
+
key,
|
|
209
|
+
label: ((_b = config[key]) === null || _b === void 0 ? void 0 : _b.label) || key,
|
|
210
|
+
value: formatValue(value),
|
|
211
|
+
color: fillColor,
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
}, {
|
|
215
|
+
x: valueX,
|
|
216
|
+
y: barY + barHeight / 2,
|
|
217
|
+
dimensions,
|
|
218
|
+
});
|
|
219
|
+
}, onMouseMove: (e) => handleMouseMove(e, {
|
|
220
|
+
x: valueX,
|
|
221
|
+
y: barY + barHeight / 2,
|
|
222
|
+
dimensions,
|
|
223
|
+
}), onMouseLeave: () => {
|
|
224
|
+
setHoveredKey(null);
|
|
225
|
+
handleMouseLeave();
|
|
226
|
+
}, children: jsx("path", { d: pathD, fill: fillColor, stroke: stroke.stroke, strokeWidth: stroke.strokeWidth, strokeOpacity: stroke.strokeOpacity, strokeLinejoin: "round",
|
|
227
|
+
// 🔴 Matches BarChart. Required here specifically: the
|
|
228
|
+
// parent <motion.g> carries a scaleX transform, so
|
|
229
|
+
// without this the stroke is scaled with the bar and the
|
|
230
|
+
// hover outline renders far heavier than BarChart's.
|
|
231
|
+
vectorEffect: "non-scaling-stroke" }) })] }, key));
|
|
232
|
+
}) }, categoryIndex));
|
|
233
|
+
}) }))] }) }), legendPosition === "bottom" && (jsx(ChartLegend, { items: legendItems, className: "shrink-0 pt-2" })), jsx(ChartTooltip, { tooltipRef: tooltipRef, content: tooltipData === null || tooltipData === void 0 ? void 0 : tooltipData.content, active: !!tooltipData, position: tooltipData ? { x: tooltipData.x, y: tooltipData.y } : { x: 0, y: 0 } })] }) }));
|
|
234
|
+
};
|
|
235
|
+
HorizontalBarChart.displayName = "HorizontalBarChart";
|
|
236
|
+
|
|
237
|
+
export { HorizontalBarChart };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { BaseChartProps, StandardChartDisplayProps, StandardVisualProps } from "../types/chart.types";
|
|
2
|
+
/**
|
|
3
|
+
* Visual props that actually apply to a horizontal bar chart.
|
|
4
|
+
*
|
|
5
|
+
* 🔴 Narrowed with `Omit` on purpose — see the note on `StandardVisualProps`.
|
|
6
|
+
* Kept: `barRadius` (+ its deprecated `radius` alias) and `gap`.
|
|
7
|
+
* Dropped: dot radius, stroke width, and the line/area/stacked-only props.
|
|
8
|
+
*/
|
|
9
|
+
export type HorizontalBarVisualProps = Omit<StandardVisualProps, "dotRadius" | "strokeWidth" | "curved" | "curveType" | "showDots" | "fillOpacity" | "showStroke" | "stacked">;
|
|
10
|
+
/**
|
|
11
|
+
* 🔴 `variant` is Omitted, not inherited: these bars are flat, single-colour shapes —
|
|
12
|
+
* there is no gradient/minimal treatment to select. Leaving the inherited prop in place
|
|
13
|
+
* would publish a control that silently does nothing (and would reach the generative
|
|
14
|
+
* schema, where an LLM would emit it). Add it back only alongside an implementation.
|
|
15
|
+
*/
|
|
16
|
+
export interface HorizontalBarChartProps extends BaseChartProps, Omit<StandardChartDisplayProps, "variant">, HorizontalBarVisualProps {
|
|
17
|
+
/** Gap between category rows. */
|
|
18
|
+
categoryGap?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Width reserved for the category labels running down the left. Category names are
|
|
21
|
+
* arbitrary ("United Kingdom"), so unlike a bottom axis there is no shared constant
|
|
22
|
+
* that can know how much room they need — hence a prop rather than `X_AXIS_MARGIN`.
|
|
23
|
+
* @default 120
|
|
24
|
+
*/
|
|
25
|
+
categoryWidth?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Custom color palette for bar series, applied in order and cycled if there are more
|
|
28
|
+
* series than colors. Any valid CSS color, including CSS variables.
|
|
29
|
+
* @example ['var(--color-primary)', 'var(--color-success)']
|
|
30
|
+
*/
|
|
31
|
+
colors?: string[];
|
|
32
|
+
/** Whether to play the staggered grow-from-left entrance on mount. */
|
|
33
|
+
showAnimation?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Log data-validation warnings to the console.
|
|
36
|
+
* @default true in development
|
|
37
|
+
*/
|
|
38
|
+
showValidationWarnings?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Force dark mode styling for the chart. Use when placing the chart on a dark
|
|
41
|
+
* background while the page is in light mode.
|
|
42
|
+
*/
|
|
43
|
+
darkMode?: boolean;
|
|
44
|
+
/** Formats the value shown in the tooltip. */
|
|
45
|
+
valueFormatter?: (value: number) => string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 🔴 Picks explicitly rather than spreading `...CHART_DEFAULTS` — the spread pulled in a
|
|
49
|
+
* default for every other chart's props, so this object advertised values
|
|
50
|
+
* HorizontalBarChart never reads. List only what the component actually consumes.
|
|
51
|
+
*/
|
|
52
|
+
export declare const HORIZONTAL_BAR_CHART_DEFAULTS: {
|
|
53
|
+
readonly showGrid: true;
|
|
54
|
+
readonly showXAxis: true;
|
|
55
|
+
readonly showYAxis: true;
|
|
56
|
+
readonly enableKeyboardNavigation: true;
|
|
57
|
+
readonly barRadius: 32;
|
|
58
|
+
readonly gap: 4;
|
|
59
|
+
readonly categoryGap: 16;
|
|
60
|
+
readonly categoryWidth: 120;
|
|
61
|
+
readonly showAnimation: true;
|
|
62
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CHART_DEFAULTS } from '../types/chart.types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 🔴 Picks explicitly rather than spreading `...CHART_DEFAULTS` — the spread pulled in a
|
|
5
|
+
* default for every other chart's props, so this object advertised values
|
|
6
|
+
* HorizontalBarChart never reads. List only what the component actually consumes.
|
|
7
|
+
*/
|
|
8
|
+
const HORIZONTAL_BAR_CHART_DEFAULTS = {
|
|
9
|
+
showGrid: CHART_DEFAULTS.showGrid,
|
|
10
|
+
showXAxis: CHART_DEFAULTS.showXAxis,
|
|
11
|
+
showYAxis: CHART_DEFAULTS.showYAxis,
|
|
12
|
+
enableKeyboardNavigation: CHART_DEFAULTS.enableKeyboardNavigation,
|
|
13
|
+
barRadius: CHART_DEFAULTS.barRadius,
|
|
14
|
+
gap: CHART_DEFAULTS.gap,
|
|
15
|
+
categoryGap: CHART_DEFAULTS.categoryGap,
|
|
16
|
+
categoryWidth: 120,
|
|
17
|
+
// Not in CHART_DEFAULTS — declared here, as BarChart does.
|
|
18
|
+
showAnimation: true,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { HORIZONTAL_BAR_CHART_DEFAULTS };
|
|
@@ -9,7 +9,7 @@ import { useChartDimensions } from '../hooks/useChartDimensions.js';
|
|
|
9
9
|
import { XAxis } from '../shared/ChartAxis/XAxis.js';
|
|
10
10
|
import { YAxis } from '../shared/ChartAxis/YAxis.js';
|
|
11
11
|
import { HorizontalGrid } from '../shared/ChartGrid/HorizontalGrid.js';
|
|
12
|
-
import { ChartTooltip } from '
|
|
12
|
+
import { ChartTooltip } from '../../core/shared/ChartTooltip/ChartTooltip.js';
|
|
13
13
|
import { resolveLegendPosition, ChartLegend } from '../shared/ChartLegend/ChartLegend.js';
|
|
14
14
|
import { ChartMarker } from '../shared/ChartMarker/ChartMarker.js';
|
|
15
15
|
import { ChartCrosshair } from '../shared/ChartCrosshair/ChartCrosshair.js';
|
|
@@ -18,39 +18,22 @@ import { generateCurvePath } from '../utils/path-utils.js';
|
|
|
18
18
|
import { LINE_CHART_DEFAULTS } from './LineChart.types.js';
|
|
19
19
|
import { X_AXIS_MARGIN } from '../types/chart.types.js';
|
|
20
20
|
import { RISE_FROM_BASELINE, riseTransition, SCALE_FROM_CENTER, dotEntranceTransition, HALO_FADE_TRANSITION } from '../utils/animation-utils.js';
|
|
21
|
+
import { resolveSeriesColor } from '../utils/series-color.js';
|
|
22
|
+
import { chartTheme } from '../theme/chart.theme.js';
|
|
21
23
|
|
|
22
|
-
//
|
|
24
|
+
// Categorical chart-N tokens, decoupled from the semantic status colors
|
|
23
25
|
const getSeriesColorClass = (index) => {
|
|
24
26
|
const colors = [
|
|
25
|
-
"stroke-[var(--color-
|
|
26
|
-
"stroke-[var(--color-
|
|
27
|
-
"stroke-[var(--color-
|
|
28
|
-
"stroke-[var(--color-
|
|
27
|
+
"stroke-[var(--color-chart-1)]",
|
|
28
|
+
"stroke-[var(--color-chart-2)]",
|
|
29
|
+
"stroke-[var(--color-chart-3)]",
|
|
30
|
+
"stroke-[var(--color-chart-4)]",
|
|
31
|
+
"stroke-[var(--color-chart-5)]",
|
|
29
32
|
];
|
|
30
33
|
return colors[index % colors.length];
|
|
31
34
|
};
|
|
32
35
|
// Get color value for SVG elements and tooltips
|
|
33
|
-
const getSeriesFillColor = (index, key, config) =>
|
|
34
|
-
var _a;
|
|
35
|
-
if (key && config && ((_a = config[key]) === null || _a === void 0 ? void 0 : _a.color)) {
|
|
36
|
-
const customColor = config[key].color;
|
|
37
|
-
if (!customColor.startsWith("var(") &&
|
|
38
|
-
!customColor.startsWith("#") &&
|
|
39
|
-
!customColor.startsWith("rgb") &&
|
|
40
|
-
!customColor.startsWith("hsl") &&
|
|
41
|
-
customColor.includes("-")) {
|
|
42
|
-
return `var(--color-${customColor})`;
|
|
43
|
-
}
|
|
44
|
-
return customColor;
|
|
45
|
-
}
|
|
46
|
-
const colorVars = [
|
|
47
|
-
"var(--color-primary)",
|
|
48
|
-
"var(--color-warning)",
|
|
49
|
-
"var(--color-success)",
|
|
50
|
-
"var(--color-danger)",
|
|
51
|
-
];
|
|
52
|
-
return colorVars[index % colorVars.length];
|
|
53
|
-
};
|
|
36
|
+
const getSeriesFillColor = (index, key, config) => resolveSeriesColor(index, key, config, chartTheme.baseStyle.colors.series);
|
|
54
37
|
const LineChart = ({ data, config,
|
|
55
38
|
// Standardized display props with defaults
|
|
56
39
|
showGrid = LINE_CHART_DEFAULTS.showGrid, showXAxis = LINE_CHART_DEFAULTS.showXAxis, showYAxis = LINE_CHART_DEFAULTS.showYAxis, legend, minValue: propMinValue, maxValue: propMaxValue,
|
|
@@ -302,7 +285,7 @@ className, title, description, enableKeyboardNavigation = LINE_CHART_DEFAULTS.en
|
|
|
302
285
|
// lowest point), so the line grows UP from the x-axis.
|
|
303
286
|
style: RISE_FROM_BASELINE, children: [jsx("rect", { x: margin.left, y: margin.top, width: innerWidth, height: innerHeight, fill: "none", stroke: "none", style: { pointerEvents: "none" } }), jsx("path", { d: targetPath, fill: "none", strokeWidth: strokeWidth, strokeLinecap: "round",
|
|
304
287
|
// Constant stroke width through the scaleY rise (no squash).
|
|
305
|
-
vectorEffect: "non-scaling-stroke", className: cn("transition-all duration-
|
|
288
|
+
vectorEffect: "non-scaling-stroke", className: cn("transition-all duration-[var(--motion-duration-base)]", colorClass), style: { stroke: (_a = config[key]) === null || _a === void 0 ? void 0 : _a.color },
|
|
306
289
|
// Soft series-colored glow instead of a hard black drop shadow.
|
|
307
290
|
filter: `url(#${getSeriesGlowId(keyIndex)})` })] }, shouldReduceMotion ? "line-static" : dataSignature), showDots &&
|
|
308
291
|
data.map((item, dataIndex) => {
|
|
@@ -9,25 +9,22 @@ export interface LineChartProps extends BaseChartProps, Omit<StandardChartDispla
|
|
|
9
9
|
curveType?: 'linear' | 'monotone';
|
|
10
10
|
showDots?: boolean;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Default values using centralized defaults.
|
|
14
|
+
*
|
|
15
|
+
* 🔴 Picks explicitly rather than spreading `...CHART_DEFAULTS` — the spread pulled in a
|
|
16
|
+
* default for every other chart's props, so this object advertised values LineChart
|
|
17
|
+
* never reads. List only what the component actually consumes.
|
|
18
|
+
*/
|
|
12
19
|
export declare const LINE_CHART_DEFAULTS: {
|
|
20
|
+
readonly showGrid: true;
|
|
21
|
+
readonly showXAxis: true;
|
|
22
|
+
readonly showYAxis: true;
|
|
23
|
+
readonly enableKeyboardNavigation: true;
|
|
13
24
|
readonly color: undefined;
|
|
14
25
|
readonly dotRadius: 3;
|
|
15
|
-
readonly radius: 3;
|
|
16
26
|
readonly strokeWidth: 2;
|
|
17
27
|
readonly curved: true;
|
|
18
28
|
readonly curveType: import("..").CurveType;
|
|
19
29
|
readonly showDots: false;
|
|
20
|
-
readonly showGrid: true;
|
|
21
|
-
readonly showXAxis: true;
|
|
22
|
-
readonly showYAxis: true;
|
|
23
|
-
readonly barRadius: 32;
|
|
24
|
-
readonly cellRadius: 4;
|
|
25
|
-
readonly gap: 4;
|
|
26
|
-
readonly categoryGap: 16;
|
|
27
|
-
readonly fillOpacity: 0.3;
|
|
28
|
-
readonly showStroke: true;
|
|
29
|
-
readonly orientation: "vertical" | "horizontal";
|
|
30
|
-
readonly stacked: false;
|
|
31
|
-
readonly variant: import("..").ChartVariant;
|
|
32
|
-
readonly enableKeyboardNavigation: true;
|
|
33
30
|
};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { CHART_DEFAULTS } from '../types/chart.types.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Default values using centralized defaults.
|
|
5
|
+
*
|
|
6
|
+
* 🔴 Picks explicitly rather than spreading `...CHART_DEFAULTS` — the spread pulled in a
|
|
7
|
+
* default for every other chart's props, so this object advertised values LineChart
|
|
8
|
+
* never reads. List only what the component actually consumes.
|
|
9
|
+
*/
|
|
4
10
|
const LINE_CHART_DEFAULTS = {
|
|
5
|
-
|
|
11
|
+
showGrid: CHART_DEFAULTS.showGrid,
|
|
12
|
+
showXAxis: CHART_DEFAULTS.showXAxis,
|
|
13
|
+
showYAxis: CHART_DEFAULTS.showYAxis,
|
|
14
|
+
enableKeyboardNavigation: CHART_DEFAULTS.enableKeyboardNavigation,
|
|
6
15
|
color: undefined, // Defaults to auto-cycling through semantic colors
|
|
7
16
|
dotRadius: CHART_DEFAULTS.dotRadius, // 20 - For dot markers
|
|
8
|
-
radius: CHART_DEFAULTS.dotRadius, // @deprecated - kept for backward compatibility
|
|
9
17
|
strokeWidth: CHART_DEFAULTS.strokeWidth,
|
|
10
18
|
curved: CHART_DEFAULTS.curved,
|
|
11
19
|
curveType: CHART_DEFAULTS.curveType,
|