@shavin/ui 0.0.0-stage → 0.1.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/CHANGELOG.md +94 -0
- package/LICENSE +21 -0
- package/README.md +81 -2
- package/components.json +15771 -0
- package/dist/authoring/types.js +0 -0
- package/dist/icons.d.ts +20 -0
- package/dist/icons.js +6 -0
- package/dist/index.d.ts +3325 -0
- package/dist/index.js +531 -0
- package/dist/inspector/FindingPopover.js +252 -0
- package/dist/inspector/Highlight.js +76 -0
- package/dist/inspector/Inspector.js +420 -0
- package/dist/inspector/InspectorRoot.js +75 -0
- package/dist/inspector/IssuesLayer.js +134 -0
- package/dist/inspector/IssuesList.js +174 -0
- package/dist/inspector/SettingsPanel.js +89 -0
- package/dist/inspector/ShavinMark.js +22 -0
- package/dist/inspector/Toolbar.js +202 -0
- package/dist/inspector/barPlacement.js +117 -0
- package/dist/inspector/env.js +59 -0
- package/dist/inspector/geometry.js +44 -0
- package/dist/inspector/ignored.js +52 -0
- package/dist/inspector/index.js +7 -0
- package/dist/inspector/journalClient.js +57 -0
- package/dist/inspector/journalState.js +36 -0
- package/dist/inspector/pin.js +43 -0
- package/dist/inspector/placement.js +96 -0
- package/dist/inspector/prompt.js +63 -0
- package/dist/inspector/scheme.js +56 -0
- package/dist/inspector/settings.js +54 -0
- package/dist/inspector/strings.js +67 -0
- package/dist/inspector/targets.js +31 -0
- package/dist/inspector/theme/ThemeControls.js +351 -0
- package/dist/inspector/theme/ThemePanel.js +32 -0
- package/dist/inspector/theme/useThemeController.js +560 -0
- package/dist/inspector/usePhone.js +32 -0
- package/dist/inspector/useSelectTool.js +82 -0
- package/dist/inspector/useTimeouts.js +22 -0
- package/dist/inspector/useTrackedRect.js +39 -0
- package/dist/lib/announce.js +47 -0
- package/dist/lib/bridge.js +43 -0
- package/dist/lib/buttonState.js +81 -0
- package/dist/lib/chart-kit.js +226 -0
- package/dist/lib/cn.js +8 -0
- package/dist/lib/color-space.js +315 -0
- package/dist/lib/concentric.js +85 -0
- package/dist/lib/hit-area.js +25 -0
- package/dist/lib/inspector/collect.js +299 -0
- package/dist/lib/inspector/color.js +58 -0
- package/dist/lib/inspector/console-capture.js +96 -0
- package/dist/lib/inspector/index.js +8 -0
- package/dist/lib/inspector/rules.js +232 -0
- package/dist/lib/inspector/run.js +35 -0
- package/dist/lib/inspector/schema.js +110 -0
- package/dist/lib/inspector/selector.js +103 -0
- package/dist/lib/inspector/tokens.js +34 -0
- package/dist/lib/media-overlay-presets.js +284 -0
- package/dist/lib/media-overlays.js +381 -0
- package/dist/lib/meta.js +70 -0
- package/dist/lib/motion-gsap.js +25 -0
- package/dist/lib/motion-runtime.js +283 -0
- package/dist/lib/neutral-tint.js +108 -0
- package/dist/lib/portal-container.js +12 -0
- package/dist/lib/scroll-edges.js +41 -0
- package/dist/lib/surface.js +6 -0
- package/dist/lib/syntax.js +115 -0
- package/dist/lib/theme-presets.d.ts +1 -0
- package/dist/lib/theme-presets.js +759 -0
- package/dist/lib/useClientLocale.js +11 -0
- package/dist/lib/useFieldErrorAnnouncement.js +15 -0
- package/dist/lib/useReducedMotion.js +17 -0
- package/dist/lib/useResizable.js +313 -0
- package/dist/lib/useReturnFocus.js +24 -0
- package/dist/lib/useSlidingIndicator.js +56 -0
- package/dist/panels.d.ts +37 -0
- package/dist/panels.js +19 -0
- package/dist/primitives/Accordion/Accordion.doc.js +37 -0
- package/dist/primitives/Accordion/Accordion.js +87 -0
- package/dist/primitives/Accordion/index.js +2 -0
- package/dist/primitives/ActionBar/ActionBar.doc.js +37 -0
- package/dist/primitives/ActionBar/ActionBar.js +126 -0
- package/dist/primitives/ActionBar/index.js +2 -0
- package/dist/primitives/AlertDialog/AlertDialog.doc.js +54 -0
- package/dist/primitives/AlertDialog/AlertDialog.js +113 -0
- package/dist/primitives/AlertDialog/index.js +2 -0
- package/dist/primitives/AppShell/AppShell.doc.js +81 -0
- package/dist/primitives/AppShell/AppShell.js +178 -0
- package/dist/primitives/AppShell/frame-context.js +10 -0
- package/dist/primitives/AppShell/index.js +2 -0
- package/dist/primitives/AspectRatio/AspectRatio.doc.js +34 -0
- package/dist/primitives/AspectRatio/AspectRatio.js +5 -0
- package/dist/primitives/AspectRatio/index.js +2 -0
- package/dist/primitives/Avatar/Avatar.doc.js +40 -0
- package/dist/primitives/Avatar/Avatar.js +62 -0
- package/dist/primitives/Avatar/index.js +2 -0
- package/dist/primitives/Backdrop/Backdrop.doc.js +24 -0
- package/dist/primitives/Backdrop/Backdrop.js +42 -0
- package/dist/primitives/Backdrop/index.js +2 -0
- package/dist/primitives/Badge/Badge.doc.js +35 -0
- package/dist/primitives/Badge/Badge.js +95 -0
- package/dist/primitives/Badge/index.js +2 -0
- package/dist/primitives/BarChart/BarChart.doc.js +59 -0
- package/dist/primitives/BarChart/BarChart.js +154 -0
- package/dist/primitives/BarChart/index.js +2 -0
- package/dist/primitives/BlockPreview/BlockPreview.doc.js +51 -0
- package/dist/primitives/BlockPreview/BlockPreview.js +485 -0
- package/dist/primitives/BlockPreview/index.js +8 -0
- package/dist/primitives/Blockquote/Blockquote.doc.js +25 -0
- package/dist/primitives/Blockquote/Blockquote.js +19 -0
- package/dist/primitives/Blockquote/index.js +2 -0
- package/dist/primitives/BottomNav/BottomNav.doc.js +37 -0
- package/dist/primitives/BottomNav/BottomNav.js +54 -0
- package/dist/primitives/BottomNav/index.js +2 -0
- package/dist/primitives/Box/Box.doc.js +45 -0
- package/dist/primitives/Box/Box.js +51 -0
- package/dist/primitives/Box/index.js +2 -0
- package/dist/primitives/Breadcrumbs/Breadcrumbs.doc.js +35 -0
- package/dist/primitives/Breadcrumbs/Breadcrumbs.js +40 -0
- package/dist/primitives/Breadcrumbs/index.js +2 -0
- package/dist/primitives/Button/Button.doc.js +80 -0
- package/dist/primitives/Button/Button.js +132 -0
- package/dist/primitives/Button/index.js +2 -0
- package/dist/primitives/Calendar/Calendar.doc.js +36 -0
- package/dist/primitives/Calendar/Calendar.js +502 -0
- package/dist/primitives/Calendar/index.js +2 -0
- package/dist/primitives/Callout/Callout.doc.js +34 -0
- package/dist/primitives/Callout/Callout.js +63 -0
- package/dist/primitives/Callout/index.js +2 -0
- package/dist/primitives/Card/Card.doc.js +46 -0
- package/dist/primitives/Card/Card.js +159 -0
- package/dist/primitives/Card/index.js +2 -0
- package/dist/primitives/Carousel/Carousel.doc.js +61 -0
- package/dist/primitives/Carousel/Carousel.js +369 -0
- package/dist/primitives/Carousel/index.js +1 -0
- package/dist/primitives/ChatBubble/ChatBubble.doc.js +37 -0
- package/dist/primitives/ChatBubble/ChatBubble.js +120 -0
- package/dist/primitives/ChatBubble/index.js +2 -0
- package/dist/primitives/Checkbox/Checkbox.doc.js +36 -0
- package/dist/primitives/Checkbox/Checkbox.js +57 -0
- package/dist/primitives/Checkbox/index.js +2 -0
- package/dist/primitives/CheckboxCards/CheckboxCards.doc.js +35 -0
- package/dist/primitives/CheckboxCards/CheckboxCards.js +47 -0
- package/dist/primitives/CheckboxCards/index.js +2 -0
- package/dist/primitives/CheckboxGroup/CheckboxGroup.doc.js +35 -0
- package/dist/primitives/CheckboxGroup/CheckboxGroup.js +40 -0
- package/dist/primitives/CheckboxGroup/index.js +2 -0
- package/dist/primitives/Code/Code.doc.js +22 -0
- package/dist/primitives/Code/Code.js +17 -0
- package/dist/primitives/Code/index.js +2 -0
- package/dist/primitives/CodeBlock/CodeBlock.doc.js +36 -0
- package/dist/primitives/CodeBlock/CodeBlock.js +205 -0
- package/dist/primitives/CodeBlock/index.js +2 -0
- package/dist/primitives/CodeEditor/CodeEditor.doc.js +53 -0
- package/dist/primitives/CodeEditor/CodeEditor.js +204 -0
- package/dist/primitives/CodeEditor/index.js +4 -0
- package/dist/primitives/ColorPicker/ColorPicker.doc.js +37 -0
- package/dist/primitives/ColorPicker/ColorPicker.js +776 -0
- package/dist/primitives/ColorPicker/index.js +2 -0
- package/dist/primitives/Combobox/Combobox.doc.js +36 -0
- package/dist/primitives/Combobox/Combobox.js +199 -0
- package/dist/primitives/Combobox/index.js +2 -0
- package/dist/primitives/Container/Container.doc.js +46 -0
- package/dist/primitives/Container/Container.js +54 -0
- package/dist/primitives/Container/index.js +2 -0
- package/dist/primitives/ContextMenu/ContextMenu.doc.js +36 -0
- package/dist/primitives/ContextMenu/ContextMenu.js +59 -0
- package/dist/primitives/ContextMenu/index.js +2 -0
- package/dist/primitives/DataList/DataList.doc.js +34 -0
- package/dist/primitives/DataList/DataList.js +35 -0
- package/dist/primitives/DataList/index.js +2 -0
- package/dist/primitives/DatePicker/DatePicker.doc.js +36 -0
- package/dist/primitives/DatePicker/DatePicker.js +398 -0
- package/dist/primitives/DatePicker/index.js +2 -0
- package/dist/primitives/Dialog/Dialog.doc.js +107 -0
- package/dist/primitives/Dialog/Dialog.js +143 -0
- package/dist/primitives/Dialog/index.js +2 -0
- package/dist/primitives/DonutChart/DonutChart.doc.js +26 -0
- package/dist/primitives/DonutChart/DonutChart.js +71 -0
- package/dist/primitives/DonutChart/index.js +2 -0
- package/dist/primitives/Drawer/Drawer.doc.js +44 -0
- package/dist/primitives/Drawer/Drawer.js +158 -0
- package/dist/primitives/Drawer/index.js +2 -0
- package/dist/primitives/Dropdown/Dropdown.doc.js +40 -0
- package/dist/primitives/Dropdown/Dropdown.js +146 -0
- package/dist/primitives/Dropdown/index.js +2 -0
- package/dist/primitives/Emphasis/Emphasis.doc.js +28 -0
- package/dist/primitives/Emphasis/Emphasis.js +25 -0
- package/dist/primitives/Emphasis/index.js +2 -0
- package/dist/primitives/EmptyState/EmptyState.doc.js +76 -0
- package/dist/primitives/EmptyState/EmptyState.js +118 -0
- package/dist/primitives/EmptyState/index.js +2 -0
- package/dist/primitives/FileOutput/FileOutput.doc.js +26 -0
- package/dist/primitives/FileOutput/FileOutput.js +55 -0
- package/dist/primitives/FileOutput/index.js +2 -0
- package/dist/primitives/Flex/Flex.doc.js +58 -0
- package/dist/primitives/Flex/Flex.js +98 -0
- package/dist/primitives/Flex/index.js +2 -0
- package/dist/primitives/FormErrorSummary/FormErrorSummary.doc.js +39 -0
- package/dist/primitives/FormErrorSummary/FormErrorSummary.js +61 -0
- package/dist/primitives/FormErrorSummary/index.js +2 -0
- package/dist/primitives/FormField/FormField.doc.js +68 -0
- package/dist/primitives/FormField/FormField.js +149 -0
- package/dist/primitives/FormField/index.js +2 -0
- package/dist/primitives/FunnelChart/FunnelChart.doc.js +45 -0
- package/dist/primitives/FunnelChart/FunnelChart.js +54 -0
- package/dist/primitives/FunnelChart/index.js +2 -0
- package/dist/primitives/Grid/Grid.doc.js +57 -0
- package/dist/primitives/Grid/Grid.js +122 -0
- package/dist/primitives/Grid/index.js +2 -0
- package/dist/primitives/Heading/Heading.doc.js +46 -0
- package/dist/primitives/Heading/Heading.js +80 -0
- package/dist/primitives/Heading/index.js +2 -0
- package/dist/primitives/Heatmap/Heatmap.doc.js +49 -0
- package/dist/primitives/Heatmap/Heatmap.js +42 -0
- package/dist/primitives/Heatmap/index.js +2 -0
- package/dist/primitives/HoverCard/HoverCard.doc.js +36 -0
- package/dist/primitives/HoverCard/HoverCard.js +39 -0
- package/dist/primitives/HoverCard/index.js +2 -0
- package/dist/primitives/Icon/Icon.doc.js +49 -0
- package/dist/primitives/Icon/Icon.js +214 -0
- package/dist/primitives/Icon/buckets/lucide-a.js +214 -0
- package/dist/primitives/Icon/buckets/lucide-b.js +298 -0
- package/dist/primitives/Icon/buckets/lucide-c.js +524 -0
- package/dist/primitives/Icon/buckets/lucide-d.js +110 -0
- package/dist/primitives/Icon/buckets/lucide-e.js +50 -0
- package/dist/primitives/Icon/buckets/lucide-f.js +264 -0
- package/dist/primitives/Icon/buckets/lucide-g.js +108 -0
- package/dist/primitives/Icon/buckets/lucide-h.js +112 -0
- package/dist/primitives/Icon/buckets/lucide-i.js +46 -0
- package/dist/primitives/Icon/buckets/lucide-j.js +6 -0
- package/dist/primitives/Icon/buckets/lucide-k.js +18 -0
- package/dist/primitives/Icon/buckets/lucide-l.js +162 -0
- package/dist/primitives/Icon/buckets/lucide-m.js +266 -0
- package/dist/primitives/Icon/buckets/lucide-n.js +34 -0
- package/dist/primitives/Icon/buckets/lucide-o.js +20 -0
- package/dist/primitives/Icon/buckets/lucide-p.js +216 -0
- package/dist/primitives/Icon/buckets/lucide-q.js +6 -0
- package/dist/primitives/Icon/buckets/lucide-r.js +140 -0
- package/dist/primitives/Icon/buckets/lucide-s.js +490 -0
- package/dist/primitives/Icon/buckets/lucide-t.js +204 -0
- package/dist/primitives/Icon/buckets/lucide-u.js +84 -0
- package/dist/primitives/Icon/buckets/lucide-v.js +46 -0
- package/dist/primitives/Icon/buckets/lucide-w.js +82 -0
- package/dist/primitives/Icon/buckets/lucide-x.js +6 -0
- package/dist/primitives/Icon/buckets/lucide-z.js +36 -0
- package/dist/primitives/Icon/buckets/phosphor-a.js +250 -0
- package/dist/primitives/Icon/buckets/phosphor-b.js +158 -0
- package/dist/primitives/Icon/buckets/phosphor-c.js +320 -0
- package/dist/primitives/Icon/buckets/phosphor-d.js +90 -0
- package/dist/primitives/Icon/buckets/phosphor-e.js +52 -0
- package/dist/primitives/Icon/buckets/phosphor-f.js +162 -0
- package/dist/primitives/Icon/buckets/phosphor-g.js +92 -0
- package/dist/primitives/Icon/buckets/phosphor-h.js +88 -0
- package/dist/primitives/Icon/buckets/phosphor-i.js +26 -0
- package/dist/primitives/Icon/buckets/phosphor-j.js +8 -0
- package/dist/primitives/Icon/buckets/phosphor-k.js +8 -0
- package/dist/primitives/Icon/buckets/phosphor-l.js +84 -0
- package/dist/primitives/Icon/buckets/phosphor-m.js +110 -0
- package/dist/primitives/Icon/buckets/phosphor-n.js +100 -0
- package/dist/primitives/Icon/buckets/phosphor-o.js +14 -0
- package/dist/primitives/Icon/buckets/phosphor-p.js +166 -0
- package/dist/primitives/Icon/buckets/phosphor-q.js +10 -0
- package/dist/primitives/Icon/buckets/phosphor-r.js +46 -0
- package/dist/primitives/Icon/buckets/phosphor-s.js +254 -0
- package/dist/primitives/Icon/buckets/phosphor-t.js +152 -0
- package/dist/primitives/Icon/buckets/phosphor-u.js +38 -0
- package/dist/primitives/Icon/buckets/phosphor-v.js +22 -0
- package/dist/primitives/Icon/buckets/phosphor-w.js +48 -0
- package/dist/primitives/Icon/buckets/phosphor-x.js +4 -0
- package/dist/primitives/Icon/buckets/phosphor-y.js +8 -0
- package/dist/primitives/Icon/icon-display-names.generated.js +4 -0
- package/dist/primitives/Icon/icon-loaders.generated.js +70 -0
- package/dist/primitives/Icon/icon-names-material.generated.js +4 -0
- package/dist/primitives/Icon/icon-names.js +11 -0
- package/dist/primitives/Icon/index.js +7 -0
- package/dist/primitives/IconButton/IconButton.doc.js +43 -0
- package/dist/primitives/IconButton/IconButton.js +98 -0
- package/dist/primitives/IconButton/index.js +2 -0
- package/dist/primitives/IconPicker/IconPicker.doc.js +52 -0
- package/dist/primitives/IconPicker/IconPicker.js +193 -0
- package/dist/primitives/IconPicker/index.js +2 -0
- package/dist/primitives/IconPicker/registry.js +98 -0
- package/dist/primitives/Image/Image.doc.js +40 -0
- package/dist/primitives/Image/Image.js +76 -0
- package/dist/primitives/Image/index.js +2 -0
- package/dist/primitives/Inset/Inset.doc.js +34 -0
- package/dist/primitives/Inset/Inset.js +51 -0
- package/dist/primitives/Inset/index.js +2 -0
- package/dist/primitives/Kbd/Kbd.doc.js +22 -0
- package/dist/primitives/Kbd/Kbd.js +17 -0
- package/dist/primitives/Kbd/index.js +2 -0
- package/dist/primitives/LineChart/LineChart.doc.js +61 -0
- package/dist/primitives/LineChart/LineChart.js +146 -0
- package/dist/primitives/LineChart/index.js +2 -0
- package/dist/primitives/Link/Link.doc.js +45 -0
- package/dist/primitives/Link/Link.js +37 -0
- package/dist/primitives/Link/index.js +2 -0
- package/dist/primitives/List/List.doc.js +35 -0
- package/dist/primitives/List/List.js +35 -0
- package/dist/primitives/List/index.js +2 -0
- package/dist/primitives/Menu/Menu.doc.js +37 -0
- package/dist/primitives/Menu/Menu.js +117 -0
- package/dist/primitives/Menu/index.js +2 -0
- package/dist/primitives/Murmur/Murmur.doc.js +32 -0
- package/dist/primitives/Murmur/Murmur.js +85 -0
- package/dist/primitives/Murmur/engine.js +163 -0
- package/dist/primitives/Murmur/index.js +12 -0
- package/dist/primitives/Pagination/Pagination.doc.js +37 -0
- package/dist/primitives/Pagination/Pagination.js +183 -0
- package/dist/primitives/Pagination/index.js +2 -0
- package/dist/primitives/PanelGroup/PanelGroup.doc.js +41 -0
- package/dist/primitives/PanelGroup/PanelGroup.js +142 -0
- package/dist/primitives/PanelGroup/index.js +2 -0
- package/dist/primitives/Popover/Popover.doc.js +36 -0
- package/dist/primitives/Popover/Popover.js +41 -0
- package/dist/primitives/Popover/index.js +2 -0
- package/dist/primitives/Progress/Progress.doc.js +35 -0
- package/dist/primitives/Progress/Progress.js +77 -0
- package/dist/primitives/Progress/index.js +2 -0
- package/dist/primitives/RadioGroup/RadioGroup.doc.js +36 -0
- package/dist/primitives/RadioGroup/RadioGroup.js +132 -0
- package/dist/primitives/RadioGroup/index.js +2 -0
- package/dist/primitives/Rating/NpsScale.js +102 -0
- package/dist/primitives/Rating/Rating.doc.js +35 -0
- package/dist/primitives/Rating/Rating.js +116 -0
- package/dist/primitives/Rating/RatingSummary.js +50 -0
- package/dist/primitives/Rating/SentimentRating.js +81 -0
- package/dist/primitives/Rating/index.js +5 -0
- package/dist/primitives/Reasoning/Reasoning.doc.js +28 -0
- package/dist/primitives/Reasoning/Reasoning.js +73 -0
- package/dist/primitives/Reasoning/index.js +2 -0
- package/dist/primitives/Resizable/Resizable.doc.js +50 -0
- package/dist/primitives/Resizable/ResizeHandle.js +185 -0
- package/dist/primitives/Resizable/index.js +2 -0
- package/dist/primitives/Row/Row.doc.js +36 -0
- package/dist/primitives/Row/Row.js +53 -0
- package/dist/primitives/Row/index.js +2 -0
- package/dist/primitives/ScrollArea/ScrollArea.doc.js +35 -0
- package/dist/primitives/ScrollArea/ScrollArea.js +50 -0
- package/dist/primitives/ScrollArea/index.js +2 -0
- package/dist/primitives/Section/Section.doc.js +64 -0
- package/dist/primitives/Section/Section.js +76 -0
- package/dist/primitives/Section/index.js +2 -0
- package/dist/primitives/SegmentedControl/SegmentedControl.doc.js +75 -0
- package/dist/primitives/SegmentedControl/SegmentedControl.js +160 -0
- package/dist/primitives/SegmentedControl/index.js +2 -0
- package/dist/primitives/Select/Select.doc.js +42 -0
- package/dist/primitives/Select/Select.js +180 -0
- package/dist/primitives/Select/index.js +2 -0
- package/dist/primitives/Separator/Separator.doc.js +34 -0
- package/dist/primitives/Separator/Separator.js +84 -0
- package/dist/primitives/Separator/index.js +2 -0
- package/dist/primitives/ShavinDevTools/DevToolsPanel.js +2050 -0
- package/dist/primitives/ShavinDevTools/ShavinDevTools.doc.js +44 -0
- package/dist/primitives/ShavinDevTools/ShavinDevTools.js +15 -0
- package/dist/primitives/ShavinDevTools/index.js +8 -0
- package/dist/primitives/ShavinDevTools/types.js +0 -0
- package/dist/primitives/Sidebar/Sidebar.doc.js +39 -0
- package/dist/primitives/Sidebar/Sidebar.js +295 -0
- package/dist/primitives/Sidebar/index.js +2 -0
- package/dist/primitives/Skeleton/Skeleton.doc.js +38 -0
- package/dist/primitives/Skeleton/Skeleton.js +36 -0
- package/dist/primitives/Skeleton/index.js +2 -0
- package/dist/primitives/Slider/Slider.doc.js +45 -0
- package/dist/primitives/Slider/Slider.js +406 -0
- package/dist/primitives/Slider/index.js +2 -0
- package/dist/primitives/Sortable/Sortable.doc.js +35 -0
- package/dist/primitives/Sortable/Sortable.js +179 -0
- package/dist/primitives/Sortable/index.js +2 -0
- package/dist/primitives/Sparkline/Sparkline.doc.js +25 -0
- package/dist/primitives/Sparkline/Sparkline.js +46 -0
- package/dist/primitives/Sparkline/index.js +2 -0
- package/dist/primitives/Spinner/Spinner.doc.js +35 -0
- package/dist/primitives/Spinner/Spinner.js +162 -0
- package/dist/primitives/Spinner/index.js +2 -0
- package/dist/primitives/Spotlight/Spotlight.doc.js +36 -0
- package/dist/primitives/Spotlight/Spotlight.js +139 -0
- package/dist/primitives/Spotlight/index.js +2 -0
- package/dist/primitives/Stepper/Stepper.doc.js +46 -0
- package/dist/primitives/Stepper/Stepper.js +235 -0
- package/dist/primitives/Stepper/index.js +2 -0
- package/dist/primitives/Switch/Switch.doc.js +36 -0
- package/dist/primitives/Switch/Switch.js +54 -0
- package/dist/primitives/Switch/index.js +2 -0
- package/dist/primitives/Table/Table.doc.js +47 -0
- package/dist/primitives/Table/Table.js +63 -0
- package/dist/primitives/Table/index.js +2 -0
- package/dist/primitives/Tabs/Tabs.doc.js +53 -0
- package/dist/primitives/Tabs/Tabs.js +275 -0
- package/dist/primitives/Tabs/index.js +2 -0
- package/dist/primitives/Text/Text.doc.js +35 -0
- package/dist/primitives/Text/Text.js +67 -0
- package/dist/primitives/Text/index.js +2 -0
- package/dist/primitives/TextArea/TextArea.doc.js +35 -0
- package/dist/primitives/TextArea/TextArea.js +45 -0
- package/dist/primitives/TextArea/index.js +2 -0
- package/dist/primitives/TextField/TextField.doc.js +41 -0
- package/dist/primitives/TextField/TextField.js +290 -0
- package/dist/primitives/TextField/index.js +2 -0
- package/dist/primitives/ThemeProvider/ScopedThemeProvider.js +71 -0
- package/dist/primitives/ThemeProvider/ThemeProvider.doc.js +61 -0
- package/dist/primitives/ThemeProvider/ThemeProvider.js +143 -0
- package/dist/primitives/ThemeProvider/clientTheme.js +47 -0
- package/dist/primitives/ThemeProvider/index.js +3 -0
- package/dist/primitives/ThemeProvider/themeContext.js +11 -0
- package/dist/primitives/ThemeSwitcher/ThemeSwitcher.doc.js +49 -0
- package/dist/primitives/ThemeSwitcher/ThemeSwitcher.js +323 -0
- package/dist/primitives/ThemeSwitcher/index.js +2 -0
- package/dist/primitives/TimePicker/TimePicker.doc.js +36 -0
- package/dist/primitives/TimePicker/TimePicker.js +368 -0
- package/dist/primitives/TimePicker/index.js +2 -0
- package/dist/primitives/Toast/Toast.doc.js +65 -0
- package/dist/primitives/Toast/Toast.js +304 -0
- package/dist/primitives/Toast/index.js +2 -0
- package/dist/primitives/ToolCall/ToolCall.doc.js +29 -0
- package/dist/primitives/ToolCall/ToolCall.js +75 -0
- package/dist/primitives/ToolCall/index.js +2 -0
- package/dist/primitives/Tooltip/Tooltip.doc.js +37 -0
- package/dist/primitives/Tooltip/Tooltip.js +55 -0
- package/dist/primitives/Tooltip/index.js +2 -0
- package/dist/primitives/TopBar/TopBar.doc.js +34 -0
- package/dist/primitives/TopBar/TopBar.js +8 -0
- package/dist/primitives/TopBar/index.js +2 -0
- package/dist/primitives/Video/PauseToggle.js +49 -0
- package/dist/primitives/Video/Video.doc.js +47 -0
- package/dist/primitives/Video/Video.js +104 -0
- package/dist/primitives/Video/index.js +1 -0
- package/dist/primitives/VoiceInput/VoiceInput.doc.js +38 -0
- package/dist/primitives/VoiceInput/VoiceInput.js +96 -0
- package/dist/primitives/VoiceInput/index.js +2 -0
- package/dist/primitives/WiseOwlLogo/WiseOwlLogo.doc.js +38 -0
- package/dist/primitives/WiseOwlLogo/WiseOwlLogo.js +82 -0
- package/dist/primitives/WiseOwlLogo/index.js +2 -0
- package/dist/primitives/WiseOwlLogo/paths.js +10 -0
- package/dist/server.d.ts +256 -0
- package/dist/server.js +22 -0
- package/dist/styles/base-oklch.css +124 -0
- package/dist/styles/base-oklch.d.ts +2 -0
- package/dist/styles/base.css +124 -0
- package/dist/styles/base.d.ts +2 -0
- package/dist/styles/brand-preset.d.ts +22 -0
- package/dist/styles/brand-preset.js +13 -0
- package/dist/styles/brand-theme-v4-oklch.css +2 -0
- package/dist/styles/brand-theme-v4-oklch.d.ts +2 -0
- package/dist/styles/brand-theme-v4.css +2 -0
- package/dist/styles/brand-theme-v4.d.ts +2 -0
- package/dist/styles/brand-tokens-oklch.css +6 -0
- package/dist/styles/brand-tokens-oklch.d.ts +2 -0
- package/dist/styles/brand-tokens.css +6 -0
- package/dist/styles/brand-tokens.d.ts +2 -0
- package/dist/styles/global-oklch.css +1329 -0
- package/dist/styles/global-oklch.d.ts +2 -0
- package/dist/styles/global.css +1329 -0
- package/dist/styles/global.d.ts +2 -0
- package/dist/styles/theme-v4-oklch.css +22 -0
- package/dist/styles/theme-v4-oklch.d.ts +2 -0
- package/dist/styles/theme-v4.css +22 -0
- package/dist/styles/theme-v4.d.ts +2 -0
- package/dist/styles/tokens-oklch.css +1204 -0
- package/dist/styles/tokens-oklch.d.ts +2 -0
- package/dist/styles/tokens.css +1204 -0
- package/dist/styles/tokens.d.ts +2 -0
- package/dist/tailwind-preset.cjs +155 -0
- package/dist/tailwind-preset.d.ts +112 -0
- package/dist/tailwind-preset.js +133 -0
- package/dist/theme-presets-BVWZ_TxX.d.ts +514 -0
- package/global-oklch.css +3 -0
- package/package.json +169 -4
- package/styles.css +3 -0
- package/tailwind-preset.ts +140 -0
- package/tokens.json +423 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
function useTimeouts() {
|
|
3
|
+
const pending = React.useRef(/* @__PURE__ */ new Set());
|
|
4
|
+
React.useEffect(() => {
|
|
5
|
+
const ids = pending.current;
|
|
6
|
+
return () => {
|
|
7
|
+
if (typeof window !== "undefined") for (const id of ids) window.clearTimeout(id);
|
|
8
|
+
ids.clear();
|
|
9
|
+
};
|
|
10
|
+
}, []);
|
|
11
|
+
return React.useCallback((fn, ms) => {
|
|
12
|
+
if (typeof window === "undefined") return;
|
|
13
|
+
const id = window.setTimeout(() => {
|
|
14
|
+
pending.current.delete(id);
|
|
15
|
+
fn();
|
|
16
|
+
}, ms);
|
|
17
|
+
pending.current.add(id);
|
|
18
|
+
}, []);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
useTimeouts
|
|
22
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
const same = (a, b) => a === b || !!a && !!b && a.x === b.x && a.y === b.y && a.w === b.w && a.h === b.h;
|
|
3
|
+
function useTrackedRect(el) {
|
|
4
|
+
const [rect, setRect] = useState(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (!el || !el.isConnected) {
|
|
7
|
+
setRect(null);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
let frame = 0;
|
|
11
|
+
const read = () => {
|
|
12
|
+
frame = 0;
|
|
13
|
+
if (!el.isConnected) return setRect(null);
|
|
14
|
+
const r = el.getBoundingClientRect();
|
|
15
|
+
const next = { x: r.x, y: r.y, w: r.width, h: r.height };
|
|
16
|
+
setRect((prev) => same(prev, next) ? prev : next);
|
|
17
|
+
};
|
|
18
|
+
const schedule = () => {
|
|
19
|
+
if (!frame) frame = requestAnimationFrame(read);
|
|
20
|
+
};
|
|
21
|
+
read();
|
|
22
|
+
window.addEventListener("scroll", schedule, { capture: true, passive: true });
|
|
23
|
+
window.addEventListener("resize", schedule, { passive: true });
|
|
24
|
+
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(schedule) : null;
|
|
25
|
+
ro?.observe(el);
|
|
26
|
+
const poll = window.setInterval(schedule, 500);
|
|
27
|
+
return () => {
|
|
28
|
+
if (frame) cancelAnimationFrame(frame);
|
|
29
|
+
window.removeEventListener("scroll", schedule, { capture: true });
|
|
30
|
+
window.removeEventListener("resize", schedule);
|
|
31
|
+
ro?.disconnect();
|
|
32
|
+
window.clearInterval(poll);
|
|
33
|
+
};
|
|
34
|
+
}, [el]);
|
|
35
|
+
return rect;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
useTrackedRect
|
|
39
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const regions = {};
|
|
3
|
+
function region(politeness) {
|
|
4
|
+
if (typeof document === "undefined") return null;
|
|
5
|
+
const existing = regions[politeness];
|
|
6
|
+
if (existing?.isConnected) return existing;
|
|
7
|
+
const el = document.createElement("div");
|
|
8
|
+
el.setAttribute("aria-live", politeness);
|
|
9
|
+
el.setAttribute("aria-atomic", "true");
|
|
10
|
+
el.setAttribute("role", politeness === "assertive" ? "alert" : "status");
|
|
11
|
+
el.setAttribute("data-shavin-announcer", politeness);
|
|
12
|
+
Object.assign(el.style, {
|
|
13
|
+
position: "absolute",
|
|
14
|
+
width: "1px",
|
|
15
|
+
height: "1px",
|
|
16
|
+
margin: "-1px",
|
|
17
|
+
padding: "0",
|
|
18
|
+
overflow: "hidden",
|
|
19
|
+
clip: "rect(0 0 0 0)",
|
|
20
|
+
whiteSpace: "nowrap",
|
|
21
|
+
border: "0"
|
|
22
|
+
});
|
|
23
|
+
document.body.appendChild(el);
|
|
24
|
+
regions[politeness] = el;
|
|
25
|
+
return el;
|
|
26
|
+
}
|
|
27
|
+
function announce(message, politeness = "polite") {
|
|
28
|
+
const el = region(politeness);
|
|
29
|
+
const text = message.replace(/\s+/g, " ").trim();
|
|
30
|
+
if (!el || !text) return;
|
|
31
|
+
el.textContent = "";
|
|
32
|
+
window.setTimeout(() => {
|
|
33
|
+
el.textContent = text;
|
|
34
|
+
}, 50);
|
|
35
|
+
}
|
|
36
|
+
let fieldErrorsSilencedUntil = 0;
|
|
37
|
+
function silenceFieldErrorAnnouncements(ms = 1e3) {
|
|
38
|
+
fieldErrorsSilencedUntil = Date.now() + ms;
|
|
39
|
+
}
|
|
40
|
+
function fieldErrorAnnouncementsSilenced() {
|
|
41
|
+
return Date.now() < fieldErrorsSilencedUntil;
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
announce,
|
|
45
|
+
fieldErrorAnnouncementsSilenced,
|
|
46
|
+
silenceFieldErrorAnnouncements
|
|
47
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const DEFAULT_BRIDGE_PORT = 7036;
|
|
2
|
+
const BRIDGE_HOST = "127.0.0.1";
|
|
3
|
+
function envBridgePort() {
|
|
4
|
+
try {
|
|
5
|
+
const p = typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_SHAVIN_BRIDGE_PORT : void 0;
|
|
6
|
+
if (p) {
|
|
7
|
+
const n = Number(p);
|
|
8
|
+
if (Number.isFinite(n)) return n;
|
|
9
|
+
}
|
|
10
|
+
} catch {
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
const meta = typeof import.meta !== "undefined" ? import.meta.env : void 0;
|
|
14
|
+
const p = meta?.VITE_SHAVIN_BRIDGE_PORT;
|
|
15
|
+
if (p) {
|
|
16
|
+
const n = Number(p);
|
|
17
|
+
if (Number.isFinite(n)) return n;
|
|
18
|
+
}
|
|
19
|
+
} catch {
|
|
20
|
+
}
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
23
|
+
function resolveBridgePort(explicit) {
|
|
24
|
+
if (typeof explicit === "number" && Number.isFinite(explicit)) return explicit;
|
|
25
|
+
return envBridgePort() ?? DEFAULT_BRIDGE_PORT;
|
|
26
|
+
}
|
|
27
|
+
function bridgeOrigin(port) {
|
|
28
|
+
return `http://${BRIDGE_HOST}:${resolveBridgePort(port)}`;
|
|
29
|
+
}
|
|
30
|
+
function bridgeUrl(path, port) {
|
|
31
|
+
return `${bridgeOrigin(port)}${path.startsWith("/") ? path : `/${path}`}`;
|
|
32
|
+
}
|
|
33
|
+
function bridgeDashboardUrl(port) {
|
|
34
|
+
return `http://localhost:${resolveBridgePort(port)}/`;
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
BRIDGE_HOST,
|
|
38
|
+
DEFAULT_BRIDGE_PORT,
|
|
39
|
+
bridgeDashboardUrl,
|
|
40
|
+
bridgeOrigin,
|
|
41
|
+
bridgeUrl,
|
|
42
|
+
resolveBridgePort
|
|
43
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
useEffect,
|
|
5
|
+
useId,
|
|
6
|
+
useLayoutEffect,
|
|
7
|
+
useRef,
|
|
8
|
+
useState
|
|
9
|
+
} from "react";
|
|
10
|
+
import { announce } from "./announce.js";
|
|
11
|
+
import { Tooltip } from "../primitives/Tooltip/Tooltip.js";
|
|
12
|
+
const useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
13
|
+
function useButtonState({
|
|
14
|
+
disabled,
|
|
15
|
+
loading,
|
|
16
|
+
loadingLabel,
|
|
17
|
+
disabledReason,
|
|
18
|
+
onClick,
|
|
19
|
+
onPointerDown,
|
|
20
|
+
"aria-describedby": describedBy,
|
|
21
|
+
style,
|
|
22
|
+
ref
|
|
23
|
+
}) {
|
|
24
|
+
const inert = loading ? "loading" : disabledReason ? "reason" : disabled ? "disabled" : void 0;
|
|
25
|
+
const reasonId = useId();
|
|
26
|
+
const [tipOpen, setTipOpen] = useState(false);
|
|
27
|
+
const lastPointer = useRef("mouse");
|
|
28
|
+
const node = useRef(null);
|
|
29
|
+
const width = useRef(null);
|
|
30
|
+
useIsoLayoutEffect(() => {
|
|
31
|
+
if (!loading && node.current) width.current = node.current.offsetWidth;
|
|
32
|
+
});
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (loading && loadingLabel) announce(loadingLabel, "polite");
|
|
35
|
+
}, [loading, loadingLabel]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!tipOpen || lastPointer.current !== "touch") return;
|
|
38
|
+
const t = window.setTimeout(() => setTipOpen(false), 4e3);
|
|
39
|
+
return () => window.clearTimeout(t);
|
|
40
|
+
}, [tipOpen]);
|
|
41
|
+
const ariaInert = inert === "loading" || inert === "reason";
|
|
42
|
+
const setRef = (el) => {
|
|
43
|
+
node.current = el;
|
|
44
|
+
if (typeof ref === "function") ref(el);
|
|
45
|
+
else if (ref) ref.current = el;
|
|
46
|
+
};
|
|
47
|
+
const buttonProps = {
|
|
48
|
+
ref: setRef,
|
|
49
|
+
disabled: inert === "disabled" ? true : void 0,
|
|
50
|
+
"aria-disabled": ariaInert ? true : void 0,
|
|
51
|
+
"aria-busy": inert === "loading" ? true : void 0,
|
|
52
|
+
"data-inert": inert,
|
|
53
|
+
"data-loading": inert === "loading" ? "" : void 0,
|
|
54
|
+
"aria-describedby": inert === "reason" ? [describedBy, reasonId].filter(Boolean).join(" ") : describedBy,
|
|
55
|
+
style: inert === "loading" && loadingLabel && width.current ? { minWidth: width.current, ...style } : style,
|
|
56
|
+
onPointerDown: (e) => {
|
|
57
|
+
lastPointer.current = e.pointerType;
|
|
58
|
+
onPointerDown?.(e);
|
|
59
|
+
},
|
|
60
|
+
onClick: (e) => {
|
|
61
|
+
if (ariaInert) {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
if (inert === "reason" && lastPointer.current === "touch") {
|
|
65
|
+
setTipOpen(true);
|
|
66
|
+
announce(disabledReason, "polite");
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
onClick?.(e);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const wrap = (button) => inert === "reason" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
+
/* @__PURE__ */ jsx(Tooltip, { content: disabledReason, open: tipOpen, onOpenChange: setTipOpen, children: button }),
|
|
75
|
+
/* @__PURE__ */ jsx("span", { id: reasonId, hidden: true, children: disabledReason })
|
|
76
|
+
] }) : button;
|
|
77
|
+
return { inert, buttonProps, wrap };
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
useButtonState
|
|
81
|
+
};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { CONCENTRIC_FLOOR } from "./concentric.js";
|
|
5
|
+
const BAR_RADIUS = {
|
|
6
|
+
none: "0px",
|
|
7
|
+
sm: "var(--radius-sm)",
|
|
8
|
+
lg: "var(--radius-lg)",
|
|
9
|
+
floor: CONCENTRIC_FLOOR
|
|
10
|
+
};
|
|
11
|
+
function compactNumber(n) {
|
|
12
|
+
const abs = Math.abs(n);
|
|
13
|
+
const units = [[1e9, "b"], [1e6, "m"], [1e3, "k"]];
|
|
14
|
+
for (const [size, suffix] of units) {
|
|
15
|
+
if (abs >= size) return `${Number((n / size).toFixed(1))}${suffix}`;
|
|
16
|
+
}
|
|
17
|
+
return String(Number(n.toFixed(1)));
|
|
18
|
+
}
|
|
19
|
+
function formatChartValue(value, format = "number", prefix, suffix, precise = false) {
|
|
20
|
+
let body;
|
|
21
|
+
if (precise) body = value.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
22
|
+
else if (format === "number") body = String(Math.round(value));
|
|
23
|
+
else if (format === "percent") body = String(Number(value.toFixed(1)));
|
|
24
|
+
else body = compactNumber(value);
|
|
25
|
+
const pre = prefix ?? (format === "currency" ? "$" : "");
|
|
26
|
+
const suf = suffix ?? (format === "percent" ? "%" : "");
|
|
27
|
+
return `${pre}${body}${suf}`;
|
|
28
|
+
}
|
|
29
|
+
const DEFAULT_SERIES = [{ key: "value", name: "Value" }];
|
|
30
|
+
function xLabelState(label, i, { xLabelEvery = 1, xLabelEveryMobile, xLabels }) {
|
|
31
|
+
if (xLabels && xLabels.length) return xLabels.includes(label) ? "show" : "hide";
|
|
32
|
+
const desktop = i % Math.max(Math.floor(xLabelEvery), 1) === 0;
|
|
33
|
+
if (xLabelEveryMobile && xLabelEveryMobile > 0) {
|
|
34
|
+
const mobile = i % Math.floor(xLabelEveryMobile) === 0;
|
|
35
|
+
if (desktop && mobile) return "show";
|
|
36
|
+
if (desktop) return "desktop";
|
|
37
|
+
return mobile ? "mobile" : "hide";
|
|
38
|
+
}
|
|
39
|
+
return desktop ? "show" : "hide";
|
|
40
|
+
}
|
|
41
|
+
const xLabelClass = (state) => state === "desktop" ? "max-md:hidden" : state === "mobile" ? "md:hidden" : void 0;
|
|
42
|
+
function datumColor(d, s, i) {
|
|
43
|
+
return d.tone && TONES[d.tone] || d.color || seriesColor(s, i);
|
|
44
|
+
}
|
|
45
|
+
const TONES = {
|
|
46
|
+
brand: "rgb(var(--brand))",
|
|
47
|
+
success: "rgb(var(--success))",
|
|
48
|
+
danger: "rgb(var(--danger))",
|
|
49
|
+
warning: "rgb(var(--warning))",
|
|
50
|
+
neutral: "rgb(var(--fg-muted) / 0.4)"
|
|
51
|
+
};
|
|
52
|
+
const SERIES_PALETTE = [
|
|
53
|
+
"rgb(var(--brand))",
|
|
54
|
+
"rgb(var(--success))",
|
|
55
|
+
"rgb(var(--warning))",
|
|
56
|
+
"rgb(var(--fg-muted) / 0.7)",
|
|
57
|
+
"rgb(var(--brand) / 0.5)",
|
|
58
|
+
"rgb(var(--danger))"
|
|
59
|
+
];
|
|
60
|
+
function seriesColor(s, i) {
|
|
61
|
+
return s.tone && TONES[s.tone] || s.color || SERIES_PALETTE[i % SERIES_PALETTE.length];
|
|
62
|
+
}
|
|
63
|
+
function toneColor(tone, i = 0) {
|
|
64
|
+
return tone && TONES[tone] || SERIES_PALETTE[i % SERIES_PALETTE.length];
|
|
65
|
+
}
|
|
66
|
+
function niceScale(max, intervals = 4) {
|
|
67
|
+
const safe = max > 0 ? max : 1;
|
|
68
|
+
const rough = safe / intervals;
|
|
69
|
+
const pow = Math.pow(10, Math.floor(Math.log10(rough)));
|
|
70
|
+
const frac = rough / pow;
|
|
71
|
+
const step = (frac <= 1 ? 1 : frac <= 2 ? 2 : frac <= 2.5 ? 2.5 : frac <= 5 ? 5 : 10) * pow;
|
|
72
|
+
const top = step * Math.ceil(safe / step - 1e-9);
|
|
73
|
+
const ticks = [];
|
|
74
|
+
for (let v = 0; v <= top + step / 2; v += step) ticks.push(Number(v.toFixed(10)));
|
|
75
|
+
return { max: top, ticks };
|
|
76
|
+
}
|
|
77
|
+
function useSize(ref, fallbackHeight = 260) {
|
|
78
|
+
const [size, setSize] = useState({ width: 400, height: fallbackHeight });
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const el = ref.current;
|
|
81
|
+
if (!el) return;
|
|
82
|
+
const ro = new ResizeObserver((entries) => {
|
|
83
|
+
const r = entries[0]?.contentRect;
|
|
84
|
+
if (r) setSize({ width: r.width || 400, height: r.height || fallbackHeight });
|
|
85
|
+
});
|
|
86
|
+
ro.observe(el);
|
|
87
|
+
return () => ro.disconnect();
|
|
88
|
+
}, [ref, fallbackHeight]);
|
|
89
|
+
return size;
|
|
90
|
+
}
|
|
91
|
+
function useStableRef() {
|
|
92
|
+
return useRef(null);
|
|
93
|
+
}
|
|
94
|
+
function makeFormatter({ yFormat = "number", yPrefix, ySuffix }) {
|
|
95
|
+
return (v, precise = false) => formatChartValue(v, yFormat, yPrefix, ySuffix, precise);
|
|
96
|
+
}
|
|
97
|
+
const PATTERNS = 6;
|
|
98
|
+
const DASHES = [void 0, "6 4", "2 3", "8 3 2 3"];
|
|
99
|
+
const SHAPES = ["circle", "square", "triangle", "diamond"];
|
|
100
|
+
function patternBase(id) {
|
|
101
|
+
return `chp${id.replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
102
|
+
}
|
|
103
|
+
function seriesFill(base, i, color) {
|
|
104
|
+
return base && i % PATTERNS ? `url(#${base}-${i})` : color;
|
|
105
|
+
}
|
|
106
|
+
function seriesDash(on, i) {
|
|
107
|
+
return on ? DASHES[i % DASHES.length] : void 0;
|
|
108
|
+
}
|
|
109
|
+
function SeriesPatterns({ base, colors }) {
|
|
110
|
+
const ink = { stroke: "rgb(var(--bg-surface))", strokeOpacity: 0.6, strokeWidth: 1.5 };
|
|
111
|
+
return /* @__PURE__ */ jsx("defs", { children: colors.map((color, i) => {
|
|
112
|
+
const k = i % PATTERNS;
|
|
113
|
+
if (!k) return null;
|
|
114
|
+
return /* @__PURE__ */ jsxs("pattern", { id: `${base}-${i}`, width: 6, height: 6, patternUnits: "userSpaceOnUse", children: [
|
|
115
|
+
/* @__PURE__ */ jsx("rect", { width: 6, height: 6, fill: color }),
|
|
116
|
+
k === 1 && /* @__PURE__ */ jsx("path", { d: "M-1 1 l2 -2 M0 6 l6 -6 M5 7 l2 -2", ...ink }),
|
|
117
|
+
k === 2 && /* @__PURE__ */ jsx("circle", { cx: 3, cy: 3, r: 1.3, fill: "rgb(var(--bg-surface))", fillOpacity: 0.65 }),
|
|
118
|
+
k === 3 && /* @__PURE__ */ jsx("path", { d: "M-1 1 l2 -2 M0 6 l6 -6 M5 7 l2 -2 M-1 5 l2 2 M0 0 l6 6 M5 -1 l2 2", ...ink, strokeWidth: 1 }),
|
|
119
|
+
k === 4 && /* @__PURE__ */ jsx("path", { d: "M0 1.5 h6 M0 4.5 h6", ...ink }),
|
|
120
|
+
k === 5 && /* @__PURE__ */ jsx("path", { d: "M1.5 0 v6 M4.5 0 v6", ...ink })
|
|
121
|
+
] }, i);
|
|
122
|
+
}) });
|
|
123
|
+
}
|
|
124
|
+
function SeriesMarker({ i, cx, cy, r, shaped = true, ...rest }) {
|
|
125
|
+
const shape = shaped ? SHAPES[i % SHAPES.length] : "circle";
|
|
126
|
+
const p = rest;
|
|
127
|
+
if (shape === "square") return /* @__PURE__ */ jsx("rect", { x: cx - r * 0.9, y: cy - r * 0.9, width: r * 1.8, height: r * 1.8, ...p });
|
|
128
|
+
if (shape === "triangle") return /* @__PURE__ */ jsx("polygon", { points: `${cx},${cy - r * 1.15} ${cx + r * 1.1},${cy + r * 0.8} ${cx - r * 1.1},${cy + r * 0.8}`, ...p });
|
|
129
|
+
if (shape === "diamond") return /* @__PURE__ */ jsx("polygon", { points: `${cx},${cy - r * 1.2} ${cx + r * 1.2},${cy} ${cx},${cy + r * 1.2} ${cx - r * 1.2},${cy}`, ...p });
|
|
130
|
+
return /* @__PURE__ */ jsx("circle", { cx, cy, r, ...p });
|
|
131
|
+
}
|
|
132
|
+
function ChartSwatch({ color, index, patterns, kind = "fill", size = 10 }) {
|
|
133
|
+
if (kind === "line") {
|
|
134
|
+
return /* @__PURE__ */ jsxs("svg", { width: 18, height: size, "aria-hidden": "true", className: "shrink-0 overflow-visible", children: [
|
|
135
|
+
/* @__PURE__ */ jsx("line", { x1: 1, x2: 17, y1: size / 2, y2: size / 2, stroke: color, strokeWidth: 2, strokeDasharray: seriesDash(!!patterns, index), strokeLinecap: "round" }),
|
|
136
|
+
/* @__PURE__ */ jsx(SeriesMarker, { i: index, shaped: !!patterns, cx: 9, cy: size / 2, r: 3, fill: "rgb(var(--bg-surface))", stroke: color, strokeWidth: 1.5 })
|
|
137
|
+
] });
|
|
138
|
+
}
|
|
139
|
+
return /* @__PURE__ */ jsx("svg", { width: size, height: size, "aria-hidden": "true", className: "shrink-0 rounded-[2px]", children: /* @__PURE__ */ jsx("rect", { width: size, height: size, fill: seriesFill(patterns, index, color) }) });
|
|
140
|
+
}
|
|
141
|
+
function ChartLegend({ series, patterns = null, kind = "fill" }) {
|
|
142
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1", children: series.map((s, i) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 text-xs text-fg-muted", children: [
|
|
143
|
+
/* @__PURE__ */ jsx(ChartSwatch, { color: seriesColor(s, i), index: i, patterns, kind, size: kind === "line" ? 10 : 8 }),
|
|
144
|
+
s.name
|
|
145
|
+
] }, s.key)) });
|
|
146
|
+
}
|
|
147
|
+
function ChartTooltip({ left, top = 8, title, rows, width }) {
|
|
148
|
+
const flip = left > width * 0.62;
|
|
149
|
+
return /* @__PURE__ */ jsxs(
|
|
150
|
+
"div",
|
|
151
|
+
{
|
|
152
|
+
className: "pointer-events-none absolute z-10 min-w-32 rounded-[var(--radius-lg)] border border-hairline bg-surface px-3 py-2 shadow-panel",
|
|
153
|
+
style: { left: flip ? void 0 : left + 12, right: flip ? width - left + 12 : void 0, top },
|
|
154
|
+
"data-panel": true,
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ jsx("div", { className: "mb-1 text-xs font-medium text-fg", children: title }),
|
|
157
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: rows.map(({ name, value, ...swatch }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4 text-xs", children: [
|
|
158
|
+
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 text-fg-muted", children: [
|
|
159
|
+
/* @__PURE__ */ jsx(ChartSwatch, { ...swatch, size: swatch.kind === "line" ? 10 : 8 }),
|
|
160
|
+
name
|
|
161
|
+
] }),
|
|
162
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium tabular-nums text-fg", children: value })
|
|
163
|
+
] }, name)) })
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
function ChartDataTable({ caption, columns, rows }) {
|
|
169
|
+
return /* @__PURE__ */ jsxs("table", { className: "sr-only", children: [
|
|
170
|
+
/* @__PURE__ */ jsx("caption", { children: caption }),
|
|
171
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((c) => /* @__PURE__ */ jsx("th", { scope: "col", children: c }, c)) }) }),
|
|
172
|
+
/* @__PURE__ */ jsx("tbody", { children: rows.map((r, i) => /* @__PURE__ */ jsx("tr", { children: r.map((cell, j) => j === 0 ? /* @__PURE__ */ jsx("th", { scope: "row", children: cell }, j) : /* @__PURE__ */ jsx("td", { children: cell }, j)) }, i)) })
|
|
173
|
+
] });
|
|
174
|
+
}
|
|
175
|
+
function chartKeyProps({ name, descriptionId, count, hover, setHover, vertical = false }) {
|
|
176
|
+
return {
|
|
177
|
+
tabIndex: count > 0 ? 0 : -1,
|
|
178
|
+
role: "group",
|
|
179
|
+
"aria-roledescription": "chart",
|
|
180
|
+
"aria-label": `${name}. Use the arrow keys to read each value.`,
|
|
181
|
+
"aria-describedby": descriptionId,
|
|
182
|
+
onFocus: () => {
|
|
183
|
+
if (hover === null) setHover(0);
|
|
184
|
+
},
|
|
185
|
+
onBlur: () => setHover(null),
|
|
186
|
+
onKeyDown: (e) => {
|
|
187
|
+
const prev = vertical ? "ArrowUp" : "ArrowLeft";
|
|
188
|
+
const next = vertical ? "ArrowDown" : "ArrowRight";
|
|
189
|
+
const at = hover ?? 0;
|
|
190
|
+
let to = null;
|
|
191
|
+
if (e.key === next) to = Math.min(count - 1, at + 1);
|
|
192
|
+
else if (e.key === prev) to = Math.max(0, at - 1);
|
|
193
|
+
else if (e.key === "Home") to = 0;
|
|
194
|
+
else if (e.key === "End") to = count - 1;
|
|
195
|
+
else if (e.key === "Escape") to = null;
|
|
196
|
+
else return;
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
setHover(to);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export {
|
|
203
|
+
BAR_RADIUS,
|
|
204
|
+
ChartDataTable,
|
|
205
|
+
ChartLegend,
|
|
206
|
+
ChartSwatch,
|
|
207
|
+
ChartTooltip,
|
|
208
|
+
DEFAULT_SERIES,
|
|
209
|
+
SERIES_PALETTE,
|
|
210
|
+
SeriesMarker,
|
|
211
|
+
SeriesPatterns,
|
|
212
|
+
chartKeyProps,
|
|
213
|
+
datumColor,
|
|
214
|
+
formatChartValue,
|
|
215
|
+
makeFormatter,
|
|
216
|
+
niceScale,
|
|
217
|
+
patternBase,
|
|
218
|
+
seriesColor,
|
|
219
|
+
seriesDash,
|
|
220
|
+
seriesFill,
|
|
221
|
+
toneColor,
|
|
222
|
+
useSize,
|
|
223
|
+
useStableRef,
|
|
224
|
+
xLabelClass,
|
|
225
|
+
xLabelState
|
|
226
|
+
};
|