@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,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as RadixAvatar from "@radix-ui/react-avatar";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/cn.js";
|
|
6
|
+
const avatarVariants = cva("inline-flex shrink-0 items-center justify-center overflow-hidden align-middle", {
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: "h-7 w-7 text-xs",
|
|
10
|
+
md: "h-9 w-9 text-sm",
|
|
11
|
+
lg: "h-14 w-14 text-lg",
|
|
12
|
+
xl: "h-24 w-24 text-2xl"
|
|
13
|
+
},
|
|
14
|
+
radius: {
|
|
15
|
+
none: "rounded-none",
|
|
16
|
+
small: "rounded-[0.25rem]",
|
|
17
|
+
medium: "rounded-[0.5rem]",
|
|
18
|
+
large: "rounded-[0.75rem]",
|
|
19
|
+
full: "rounded-full",
|
|
20
|
+
inherit: "rounded-[var(--radius-panel)]",
|
|
21
|
+
concentric: "rounded-panel-inner"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: { size: "md", radius: "full" }
|
|
25
|
+
});
|
|
26
|
+
const FALLBACK_TONE = {
|
|
27
|
+
neutral: { soft: "bg-surface-hover text-fg-muted", solid: "bg-fg text-canvas" },
|
|
28
|
+
brand: { soft: "bg-brand/15 text-brand-text", solid: "bg-brand-solid text-brand-fg" },
|
|
29
|
+
success: { soft: "bg-success/15 text-success", solid: "bg-success text-success-fg" },
|
|
30
|
+
warning: { soft: "bg-warning/15 text-warning", solid: "bg-warning text-warning-fg" },
|
|
31
|
+
danger: { soft: "bg-danger/15 text-danger", solid: "bg-danger text-danger-fg" }
|
|
32
|
+
};
|
|
33
|
+
function Avatar({
|
|
34
|
+
src,
|
|
35
|
+
alt,
|
|
36
|
+
fallback,
|
|
37
|
+
fallbackIcon,
|
|
38
|
+
color = "neutral",
|
|
39
|
+
variant = "soft",
|
|
40
|
+
size,
|
|
41
|
+
radius,
|
|
42
|
+
className
|
|
43
|
+
}) {
|
|
44
|
+
return /* @__PURE__ */ jsxs(RadixAvatar.Root, { className: cn(avatarVariants({ size, radius }), className), children: [
|
|
45
|
+
/* @__PURE__ */ jsx(RadixAvatar.Image, { src, alt: alt ?? "", className: "h-full w-full object-cover" }),
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
RadixAvatar.Fallback,
|
|
48
|
+
{
|
|
49
|
+
delayMs: src ? 200 : 0,
|
|
50
|
+
className: cn("flex h-full w-full items-center justify-center font-semibold", FALLBACK_TONE[color][variant]),
|
|
51
|
+
children: fallback || fallbackIcon || /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", className: cn("h-1/2 w-1/2", color === "neutral" ? "text-fg-subtle" : "text-inherit"), stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
52
|
+
/* @__PURE__ */ jsx("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }),
|
|
53
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "7", r: "4" })
|
|
54
|
+
] })
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
Avatar,
|
|
61
|
+
avatarVariants
|
|
62
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "Backdrop",
|
|
3
|
+
description: "A decorative background that fills its parent: soft mesh, aurora, grid or dots, all drawn from theme tokens. Free and static; for animated shaders see the FX pages.",
|
|
4
|
+
features: [
|
|
5
|
+
"Free variants: mesh, aurora, grid, dots. Colour follows the brand and the theme, so no hex values",
|
|
6
|
+
"Unknown variant names fall back to mesh",
|
|
7
|
+
"Pure CSS, no canvas, no motion, so it is safe under prefers-reduced-motion",
|
|
8
|
+
"Fills the nearest positioned parent; keep real content above it with relative"
|
|
9
|
+
],
|
|
10
|
+
accessibility: ["Decorative: aria-hidden, never receives pointer events", "Keep text contrast against the surface, not against the backdrop"],
|
|
11
|
+
keyboard: "Not interactive.",
|
|
12
|
+
usage: {
|
|
13
|
+
bestPractices: [
|
|
14
|
+
{ guidance: true, description: "Use one backdrop per screen, on a sign-in panel, hero or empty state." },
|
|
15
|
+
{ guidance: false, description: "Do not put a backdrop behind dense data such as tables or forms." }
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
examples: [
|
|
19
|
+
{ title: "Panel background", code: '<Box className="relative overflow-hidden"><Backdrop variant="mesh" /><Box className="relative">\u2026</Box></Box>' }
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
docs
|
|
24
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
const BACKDROP_FREE_VARIANTS = ["mesh", "aurora", "grid", "dots"];
|
|
5
|
+
const registry = /* @__PURE__ */ new Map();
|
|
6
|
+
function registerBackdrop(name, renderer) {
|
|
7
|
+
registry.set(name, renderer);
|
|
8
|
+
}
|
|
9
|
+
const lines = (size) => ({
|
|
10
|
+
backgroundImage: `linear-gradient(to right, color-mix(in srgb, currentColor 9%, transparent) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in srgb, currentColor 9%, transparent) 1px, transparent 1px)`,
|
|
11
|
+
backgroundSize: `${size} ${size}`,
|
|
12
|
+
maskImage: "radial-gradient(ellipse at center, black 30%, transparent 75%)",
|
|
13
|
+
WebkitMaskImage: "radial-gradient(ellipse at center, black 30%, transparent 75%)"
|
|
14
|
+
});
|
|
15
|
+
const dots = () => ({
|
|
16
|
+
backgroundImage: "radial-gradient(color-mix(in srgb, currentColor 22%, transparent) 1.2px, transparent 1.2px)",
|
|
17
|
+
backgroundSize: "22px 22px",
|
|
18
|
+
maskImage: "radial-gradient(ellipse at center, black 25%, transparent 75%)",
|
|
19
|
+
WebkitMaskImage: "radial-gradient(ellipse at center, black 25%, transparent 75%)"
|
|
20
|
+
});
|
|
21
|
+
function Mesh() {
|
|
22
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23
|
+
/* @__PURE__ */ jsx("div", { className: "absolute -left-1/4 -top-1/4 h-3/4 w-3/4 rounded-full bg-brand opacity-25 blur-3xl" }),
|
|
24
|
+
/* @__PURE__ */ jsx("div", { className: "absolute -bottom-1/3 -right-1/4 h-3/4 w-3/4 rounded-full bg-brand opacity-20 blur-3xl" }),
|
|
25
|
+
/* @__PURE__ */ jsx("div", { className: "absolute left-1/3 top-1/3 h-1/2 w-1/2 rounded-full bg-fg opacity-[0.07] blur-3xl" })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
function Aurora() {
|
|
29
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx("div", { className: "absolute -inset-x-1/4 top-0 h-2/3 -skew-y-12 bg-gradient-to-r from-transparent via-brand to-transparent opacity-20 blur-3xl" }),
|
|
31
|
+
/* @__PURE__ */ jsx("div", { className: "absolute -inset-x-1/4 bottom-0 h-1/2 skew-y-12 bg-gradient-to-r from-brand via-transparent to-brand opacity-15 blur-3xl" })
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
function Backdrop({ variant = "mesh", className, params, ...props }) {
|
|
35
|
+
const Custom = registry.get(variant);
|
|
36
|
+
return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: cn("pointer-events-none absolute inset-0 overflow-hidden text-fg", className), ...props, children: Custom ? /* @__PURE__ */ jsx(Custom, { className: "absolute inset-0", params }) : variant === "aurora" ? /* @__PURE__ */ jsx(Aurora, {}) : variant === "grid" ? /* @__PURE__ */ jsx("div", { className: "absolute inset-0", style: lines("40px") }) : variant === "dots" ? /* @__PURE__ */ jsx("div", { className: "absolute inset-0", style: dots() }) : /* @__PURE__ */ jsx(Mesh, {}) });
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
BACKDROP_FREE_VARIANTS,
|
|
40
|
+
Backdrop,
|
|
41
|
+
registerBackdrop
|
|
42
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "Badge",
|
|
3
|
+
description: "A small label for status or counts, in the neutral, brand, success, warning or danger colours.",
|
|
4
|
+
features: [
|
|
5
|
+
"Colors: neutral, brand, success, warning, danger",
|
|
6
|
+
"Sizes: sm, md, lg",
|
|
7
|
+
"Supports radius escape hatch (radius='none|small|medium|large|full|inherit')",
|
|
8
|
+
"Defaults radius to inherit control radius (--radius-lg) per AGENTS.md rule"
|
|
9
|
+
],
|
|
10
|
+
accessibility: [
|
|
11
|
+
"Inline text status element",
|
|
12
|
+
"High contrast semantic background and border colors for accessibility"
|
|
13
|
+
],
|
|
14
|
+
usage: {
|
|
15
|
+
bestPractices: [
|
|
16
|
+
{
|
|
17
|
+
guidance: true,
|
|
18
|
+
description: "Use Badge for status tags, metadata counts, and status indicators."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
guidance: false,
|
|
22
|
+
description: "Do not use Badge as a clickable primary action button \u2014 reach for Button instead."
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
examples: [
|
|
27
|
+
{
|
|
28
|
+
title: "Success Status Badge",
|
|
29
|
+
code: '<Badge tone="success">Active</Badge>'
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
docs
|
|
35
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
const badgeVariants = cva(
|
|
5
|
+
"inline-flex items-center gap-1.5 font-medium transition-colors select-none",
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
surface: "bg-surface border border-hairline",
|
|
10
|
+
outline: "border border-hairline bg-transparent",
|
|
11
|
+
soft: "",
|
|
12
|
+
solid: "border border-transparent"
|
|
13
|
+
},
|
|
14
|
+
tone: {
|
|
15
|
+
neutral: "text-fg-subtle",
|
|
16
|
+
// Contrast-safe brand text (raw --brand fails on light surfaces).
|
|
17
|
+
brand: "text-brand-contrast",
|
|
18
|
+
success: "text-success",
|
|
19
|
+
warning: "text-warning",
|
|
20
|
+
danger: "text-danger"
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
sm: "px-2 py-0.5 text-[11px]",
|
|
24
|
+
md: "px-2.5 py-0.5 text-xs",
|
|
25
|
+
lg: "px-3 py-1 text-sm"
|
|
26
|
+
},
|
|
27
|
+
radius: {
|
|
28
|
+
none: "rounded-none",
|
|
29
|
+
small: "rounded-[0.25rem]",
|
|
30
|
+
medium: "rounded-[0.5rem]",
|
|
31
|
+
large: "rounded-[0.75rem]",
|
|
32
|
+
full: "rounded-full",
|
|
33
|
+
inherit: "rounded-[var(--radius-lg)]",
|
|
34
|
+
concentric: "rounded-panel-inner"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
compoundVariants: [
|
|
38
|
+
{ variant: "surface", tone: "neutral", class: "text-fg-subtle border-hairline" },
|
|
39
|
+
{ variant: "surface", tone: "brand", class: "text-brand-contrast border-hairline" },
|
|
40
|
+
{ variant: "surface", tone: "success", class: "text-success border-success/30" },
|
|
41
|
+
{ variant: "surface", tone: "warning", class: "text-warning border-warning/30" },
|
|
42
|
+
{ variant: "surface", tone: "danger", class: "text-danger border-danger/30" },
|
|
43
|
+
{ variant: "outline", tone: "neutral", class: "text-fg-subtle border-hairline" },
|
|
44
|
+
{ variant: "outline", tone: "brand", class: "text-brand-contrast border-brand/30" },
|
|
45
|
+
{ variant: "outline", tone: "success", class: "text-success border-success/30" },
|
|
46
|
+
{ variant: "outline", tone: "warning", class: "text-warning border-warning/30" },
|
|
47
|
+
{ variant: "outline", tone: "danger", class: "text-danger border-danger/30" },
|
|
48
|
+
{ variant: "soft", tone: "neutral", class: "bg-fg/[0.04] text-fg border border-fg/[0.08]" },
|
|
49
|
+
{ variant: "soft", tone: "brand", class: "bg-brand/[0.08] text-brand-contrast border border-brand/20" },
|
|
50
|
+
{ variant: "soft", tone: "success", class: "bg-success/[0.08] text-success border border-success/20" },
|
|
51
|
+
{ variant: "soft", tone: "warning", class: "bg-warning/[0.08] text-warning border border-warning/20" },
|
|
52
|
+
{ variant: "soft", tone: "danger", class: "bg-danger/[0.08] text-danger border border-danger/20" },
|
|
53
|
+
{ variant: "solid", tone: "neutral", class: "bg-fg text-canvas" },
|
|
54
|
+
{ variant: "solid", tone: "brand", class: "bg-brand-solid text-brand-fg" },
|
|
55
|
+
{ variant: "solid", tone: "success", class: "bg-success text-canvas" },
|
|
56
|
+
{ variant: "solid", tone: "warning", class: "bg-warning text-canvas" },
|
|
57
|
+
{ variant: "solid", tone: "danger", class: "bg-danger text-canvas" }
|
|
58
|
+
],
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
variant: "surface",
|
|
61
|
+
tone: "neutral",
|
|
62
|
+
size: "md",
|
|
63
|
+
radius: "inherit"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
function Badge({
|
|
68
|
+
className,
|
|
69
|
+
variant,
|
|
70
|
+
tone,
|
|
71
|
+
color,
|
|
72
|
+
size,
|
|
73
|
+
radius,
|
|
74
|
+
icon,
|
|
75
|
+
children,
|
|
76
|
+
...props
|
|
77
|
+
}) {
|
|
78
|
+
const resolvedTone = tone ?? color ?? "neutral";
|
|
79
|
+
const resolvedVariant = variant ?? (color ? color === "neutral" ? "surface" : "soft" : "surface");
|
|
80
|
+
return /* @__PURE__ */ jsxs(
|
|
81
|
+
"span",
|
|
82
|
+
{
|
|
83
|
+
className: cn(badgeVariants({ variant: resolvedVariant, tone: resolvedTone, size, radius }), className),
|
|
84
|
+
...props,
|
|
85
|
+
children: [
|
|
86
|
+
icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: icon }),
|
|
87
|
+
children
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
Badge,
|
|
94
|
+
badgeVariants
|
|
95
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "BarChart",
|
|
3
|
+
description: "Vertical or horizontal bars: single, grouped (two or more bars per category for comparison) or stacked.",
|
|
4
|
+
features: [
|
|
5
|
+
"orientation vertical or horizontal (long labels, rankings)",
|
|
6
|
+
"mode grouped for comparisons, stacked for composition",
|
|
7
|
+
"Round-number axis ticks and a shared hover tooltip",
|
|
8
|
+
"Legend for two or more series",
|
|
9
|
+
"No series needed for a single set of values: pass { label, value } and optionally a per-bar tone or color",
|
|
10
|
+
"Negative values (vertical), yMax, tickCount, yFormat, showYAxis, showXAxis, showGrid, padding",
|
|
11
|
+
"xLabelEvery / xLabelEveryMobile / xLabels thin the axis labels; barRadius (none, sm, lg, floor), barGap, maxBarWidth"
|
|
12
|
+
],
|
|
13
|
+
accessibility: ["The chart has role=img with a label; keep the surrounding heading and values in text", "Colour is never the only signal: legends, labels and tooltips carry names and values"],
|
|
14
|
+
keyboard: "Hover to inspect values.",
|
|
15
|
+
usage: {
|
|
16
|
+
bestPractices: [
|
|
17
|
+
{ guidance: true, description: "Use grouped bars to compare periods or segments side by side; use horizontal for ranked lists." },
|
|
18
|
+
{ guidance: false, description: "Do not pass pre-formatted strings as values; keep numbers raw and format with yFormat." }
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
examples: [
|
|
22
|
+
{
|
|
23
|
+
title: "Single series",
|
|
24
|
+
code: `<BarChart data={[{ label: "Mon", value: 12 }, { label: "Tue", value: 18 }, { label: "Wed", value: 9 }]} yFormat="compact" />`
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
title: "Compare two periods",
|
|
28
|
+
code: `<BarChart
|
|
29
|
+
data={[
|
|
30
|
+
{ label: "Mon", thisWeek: 120, lastWeek: 98 },
|
|
31
|
+
{ label: "Tue", thisWeek: 132, lastWeek: 110 },
|
|
32
|
+
{ label: "Wed", thisWeek: 101, lastWeek: 121 },
|
|
33
|
+
{ label: "Thu", thisWeek: 134, lastWeek: 104 },
|
|
34
|
+
{ label: "Fri", thisWeek: 90, lastWeek: 88 },
|
|
35
|
+
]}
|
|
36
|
+
series={[
|
|
37
|
+
{ key: "thisWeek", name: "This week" },
|
|
38
|
+
{ key: "lastWeek", name: "Last week", tone: "neutral" },
|
|
39
|
+
]}
|
|
40
|
+
/>`
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: "Ranking",
|
|
44
|
+
code: `<BarChart
|
|
45
|
+
orientation="horizontal"
|
|
46
|
+
data={[
|
|
47
|
+
{ label: "/pricing", visitors: 4200 },
|
|
48
|
+
{ label: "/docs/getting-started", visitors: 3100 },
|
|
49
|
+
{ label: "/blog/launch", visitors: 1800 },
|
|
50
|
+
{ label: "/changelog", visitors: 950 },
|
|
51
|
+
]}
|
|
52
|
+
series={[{ key: "visitors", name: "Visitors" }]}
|
|
53
|
+
/>`
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
docs
|
|
59
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { cn } from "../../lib/cn.js";
|
|
5
|
+
import {
|
|
6
|
+
BAR_RADIUS,
|
|
7
|
+
ChartDataTable,
|
|
8
|
+
ChartLegend,
|
|
9
|
+
ChartTooltip,
|
|
10
|
+
DEFAULT_SERIES,
|
|
11
|
+
SeriesPatterns,
|
|
12
|
+
chartKeyProps,
|
|
13
|
+
datumColor,
|
|
14
|
+
patternBase,
|
|
15
|
+
seriesFill,
|
|
16
|
+
makeFormatter,
|
|
17
|
+
niceScale,
|
|
18
|
+
xLabelClass,
|
|
19
|
+
xLabelState,
|
|
20
|
+
useSize
|
|
21
|
+
} from "../../lib/chart-kit.js";
|
|
22
|
+
function BarChart({
|
|
23
|
+
data,
|
|
24
|
+
series = DEFAULT_SERIES,
|
|
25
|
+
orientation = "vertical",
|
|
26
|
+
mode = "grouped",
|
|
27
|
+
height = 260,
|
|
28
|
+
showLegend = true,
|
|
29
|
+
showGrid = true,
|
|
30
|
+
showYAxis = true,
|
|
31
|
+
showXAxis = true,
|
|
32
|
+
xLabelEvery,
|
|
33
|
+
xLabelEveryMobile,
|
|
34
|
+
xLabels,
|
|
35
|
+
tickCount = 4,
|
|
36
|
+
yMax,
|
|
37
|
+
padding: paddingProp,
|
|
38
|
+
barRadius = "sm",
|
|
39
|
+
barGap,
|
|
40
|
+
maxBarWidth,
|
|
41
|
+
yFormat,
|
|
42
|
+
yPrefix,
|
|
43
|
+
ySuffix,
|
|
44
|
+
title,
|
|
45
|
+
description,
|
|
46
|
+
patterns = true,
|
|
47
|
+
className,
|
|
48
|
+
...props
|
|
49
|
+
}) {
|
|
50
|
+
const ref = useRef(null);
|
|
51
|
+
const { width } = useSize(ref, height);
|
|
52
|
+
const [hover, setHover] = useState(null);
|
|
53
|
+
const fmt = makeFormatter({ yFormat, yPrefix, ySuffix });
|
|
54
|
+
const horizontal = orientation === "horizontal";
|
|
55
|
+
const descId = useId();
|
|
56
|
+
const name = title ?? "Bar chart";
|
|
57
|
+
const single = series === DEFAULT_SERIES;
|
|
58
|
+
const pat = patterns && series.length > 1 ? patternBase(descId) : null;
|
|
59
|
+
const longest = Math.max(...data.map((d) => String(d.label).length), 1);
|
|
60
|
+
const PAD = {
|
|
61
|
+
top: 12,
|
|
62
|
+
right: 16,
|
|
63
|
+
bottom: showXAxis || horizontal ? 28 : 4,
|
|
64
|
+
left: horizontal ? Math.min(160, Math.max(56, longest * 6.4 + 16)) : showYAxis ? 44 : 8,
|
|
65
|
+
...paddingProp
|
|
66
|
+
};
|
|
67
|
+
const innerW = Math.max(width - PAD.left - PAD.right, 40);
|
|
68
|
+
const innerH = Math.max(height - PAD.top - PAD.bottom, 40);
|
|
69
|
+
const scale = useMemo(() => {
|
|
70
|
+
const vals = data.flatMap((d) => series.map((s) => Number(d[s.key] ?? 0)));
|
|
71
|
+
const stackedMax = Math.max(0, ...data.map((d) => series.reduce((n, s) => n + Math.max(Number(d[s.key] ?? 0), 0), 0)));
|
|
72
|
+
const top = mode === "stacked" ? stackedMax : Math.max(0, ...vals);
|
|
73
|
+
const low = horizontal || mode === "stacked" ? 0 : Math.min(0, ...vals);
|
|
74
|
+
const intervals = Math.max(Math.floor(tickCount), 1);
|
|
75
|
+
const abs = Math.max(top, -low);
|
|
76
|
+
const nice = niceScale(yMax ?? abs, intervals);
|
|
77
|
+
const hi = yMax ?? nice.max;
|
|
78
|
+
if (low >= 0) {
|
|
79
|
+
const ticks = yMax !== void 0 ? Array.from({ length: intervals + 1 }, (_, i) => yMax / intervals * i) : nice.ticks;
|
|
80
|
+
return { lo: 0, hi, ticks };
|
|
81
|
+
}
|
|
82
|
+
return { lo: -hi, hi, ticks: [...nice.ticks.slice(1).map((t) => -t).reverse(), ...nice.ticks] };
|
|
83
|
+
}, [data, series, mode, tickCount, yMax, horizontal]);
|
|
84
|
+
const span = scale.hi - scale.lo || 1;
|
|
85
|
+
const along = (v) => horizontal ? PAD.left + (v - scale.lo) / span * innerW : PAD.top + innerH - (v - scale.lo) / span * innerH;
|
|
86
|
+
const zero = along(0);
|
|
87
|
+
const slot = (horizontal ? innerH : innerW) / Math.max(data.length, 1);
|
|
88
|
+
const groupW = Math.min(
|
|
89
|
+
barGap !== void 0 ? Math.max(slot - barGap, 1) : slot * (single ? 0.55 : 0.7),
|
|
90
|
+
(maxBarWidth ?? 56) * (mode === "grouped" ? series.length : 1)
|
|
91
|
+
);
|
|
92
|
+
const barW = mode === "grouped" ? Math.max(groupW / series.length - (series.length > 1 ? 2 : 0), 3) : groupW;
|
|
93
|
+
const rx = BAR_RADIUS[barRadius] ?? BAR_RADIUS.sm;
|
|
94
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-3", className), ...props, children: [
|
|
95
|
+
showLegend && series.length > 1 && /* @__PURE__ */ jsx(ChartLegend, { series, patterns: pat }),
|
|
96
|
+
description && /* @__PURE__ */ jsx("p", { id: descId, className: "sr-only", children: description }),
|
|
97
|
+
/* @__PURE__ */ jsxs(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
ref,
|
|
101
|
+
className: "relative w-full rounded-[var(--radius-lg)]",
|
|
102
|
+
style: { height },
|
|
103
|
+
...chartKeyProps({ name, descriptionId: description ? descId : void 0, count: data.length, hover, setHover, vertical: horizontal }),
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsxs("svg", { width, height, onPointerLeave: () => setHover(null), "aria-hidden": "true", children: [
|
|
106
|
+
pat && /* @__PURE__ */ jsx(SeriesPatterns, { base: pat, colors: series.map((s, si) => datumColor({}, s, si)) }),
|
|
107
|
+
scale.ticks.map((t) => {
|
|
108
|
+
const pos = along(t);
|
|
109
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
110
|
+
showGrid && (horizontal ? /* @__PURE__ */ jsx("line", { x1: pos, x2: pos, y1: PAD.top, y2: PAD.top + innerH, stroke: "rgb(var(--hairline))", strokeDasharray: "3 4" }) : /* @__PURE__ */ jsx("line", { x1: PAD.left, x2: width - PAD.right, y1: pos, y2: pos, stroke: "rgb(var(--hairline))", strokeDasharray: "3 4" })),
|
|
111
|
+
showYAxis && (horizontal ? /* @__PURE__ */ jsx("text", { x: pos, y: height - 6, textAnchor: "middle", className: "fill-fg-subtle text-[11px]", children: fmt(t) }) : /* @__PURE__ */ jsx("text", { x: PAD.left - 8, y: pos + 4, textAnchor: "end", className: "fill-fg-subtle text-[11px]", children: fmt(t) }))
|
|
112
|
+
] }, t);
|
|
113
|
+
}),
|
|
114
|
+
data.map((d, i) => {
|
|
115
|
+
const center = (horizontal ? PAD.top : PAD.left) + slot * (i + 0.5);
|
|
116
|
+
let run = 0;
|
|
117
|
+
const state = xLabelState(String(d.label), i, { xLabelEvery, xLabelEveryMobile, xLabels });
|
|
118
|
+
return /* @__PURE__ */ jsxs("g", { onPointerEnter: () => setHover(i), opacity: hover === null || hover === i ? 1 : 0.55, children: [
|
|
119
|
+
/* @__PURE__ */ jsx("rect", { x: horizontal ? PAD.left : center - slot / 2, y: horizontal ? center - slot / 2 : PAD.top, width: horizontal ? innerW : slot, height: horizontal ? slot : innerH, fill: "transparent" }),
|
|
120
|
+
series.map((s, si) => {
|
|
121
|
+
const v = Number(d[s.key] ?? 0);
|
|
122
|
+
const from = mode === "stacked" ? run : 0;
|
|
123
|
+
const to = mode === "stacked" ? run + v : v;
|
|
124
|
+
if (mode === "stacked") run += v;
|
|
125
|
+
const a0 = along(from), a1 = along(to);
|
|
126
|
+
const lo = Math.min(a0, a1), len = Math.abs(a1 - a0);
|
|
127
|
+
const cross = mode === "grouped" ? center - groupW / 2 + si * (groupW / series.length) + (series.length > 1 ? 1 : 0) : center - barW / 2;
|
|
128
|
+
const last = mode === "grouped" || si === series.length - 1;
|
|
129
|
+
const attrs = horizontal ? { x: lo, y: cross, width: len, height: barW } : { x: cross, y: lo, width: barW, height: len };
|
|
130
|
+
const fill = single ? datumColor(d, s, i) : seriesFill(pat, si, datumColor({}, s, si));
|
|
131
|
+
return /* @__PURE__ */ jsx("rect", { ...attrs, style: { rx: last ? rx : "0px" }, fill }, s.key);
|
|
132
|
+
}),
|
|
133
|
+
horizontal ? /* @__PURE__ */ jsx("text", { x: PAD.left - 8, y: center + 4, textAnchor: "end", className: "fill-fg-muted text-[11px]", children: d.label }) : showXAxis && state !== "hide" && /* @__PURE__ */ jsx("text", { x: center, y: height - 8, textAnchor: "middle", className: cn("fill-fg-subtle text-[11px]", xLabelClass(state)), children: d.label })
|
|
134
|
+
] }, i);
|
|
135
|
+
}),
|
|
136
|
+
scale.lo < 0 && !horizontal && /* @__PURE__ */ jsx("line", { x1: PAD.left, x2: width - PAD.right, y1: zero, y2: zero, stroke: "rgb(var(--hairline-strong))" })
|
|
137
|
+
] }),
|
|
138
|
+
hover !== null && /* @__PURE__ */ jsx(ChartTooltip, { left: horizontal ? PAD.left + innerW / 2 : PAD.left + slot * (hover + 0.5), top: horizontal ? PAD.top + slot * (hover + 0.5) : 8, width, title: String(data[hover].name ?? data[hover].label), rows: series.map((s, si) => ({ name: s.name, value: fmt(Number(data[hover][s.key] ?? 0), true), color: single ? datumColor(data[hover], s, hover) : datumColor({}, s, si), index: si, patterns: pat })) })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
ChartDataTable,
|
|
144
|
+
{
|
|
145
|
+
caption: name,
|
|
146
|
+
columns: ["Category", ...series.map((x) => x.name)],
|
|
147
|
+
rows: data.map((d) => [String(d.name ?? d.label), ...series.map((x) => fmt(Number(d[x.key] ?? 0), true))])
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] });
|
|
151
|
+
}
|
|
152
|
+
export {
|
|
153
|
+
BarChart
|
|
154
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "BlockPreview",
|
|
3
|
+
internal: true,
|
|
4
|
+
description: "Internal: the frame Shavin's own sites use to show a block, with device widths, a code view, the CLI install command and an Open in Studio link.",
|
|
5
|
+
features: [
|
|
6
|
+
"Desktop, tablet and mobile widths; children read the current one from DeviceContext",
|
|
7
|
+
"Code view of the block source with copy, plus a copyable `npx @shavin/cli add` command",
|
|
8
|
+
"Open in Studio link built from studioKey (or studioUrl; the old builderKey and builderUrl still work)",
|
|
9
|
+
"MiniBlockPreview and MiniPreviewFrame: scaled thumbnails for galleries, with an error boundary (SafeMiniPreview)"
|
|
10
|
+
],
|
|
11
|
+
notes: [
|
|
12
|
+
"Used by the docs, website, community and Studio apps. It links to studio.shavin.cc and Shavin's CLI, so it is not meant for customer apps.",
|
|
13
|
+
"Previews render inline in the host page: a block's links and fixed or absolutely positioned elements can affect the page around it. Community blocks should move to a sandboxed iframe before this is trusted with third-party code."
|
|
14
|
+
],
|
|
15
|
+
accessibility: [
|
|
16
|
+
`Toolbar controls are native buttons; the code view's close button is labelled "Close"`,
|
|
17
|
+
"The live preview is the block itself, so its accessibility is the block's own"
|
|
18
|
+
],
|
|
19
|
+
keyboard: "Tab through the toolbar (device widths, code, copy, Studio link) and activate with Enter or Space.",
|
|
20
|
+
usage: {
|
|
21
|
+
bestPractices: [
|
|
22
|
+
{
|
|
23
|
+
guidance: true,
|
|
24
|
+
description: "Use it only inside Shavin's own apps to present blocks from the catalogue."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
guidance: false,
|
|
28
|
+
description: "Do not use BlockPreview in product UI or render untrusted community code in it; it does not isolate the preview from the page."
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
examples: [
|
|
33
|
+
{
|
|
34
|
+
title: "Block in a preview frame",
|
|
35
|
+
code: `<BlockPreview
|
|
36
|
+
title="Pricing card"
|
|
37
|
+
command="npx @shavin/cli add pricing-card"
|
|
38
|
+
code={'<Card><Heading size="md">Pro</Heading><Text color="muted">$24 per month</Text></Card>'}
|
|
39
|
+
layout="centered"
|
|
40
|
+
>
|
|
41
|
+
<Card className="w-72">
|
|
42
|
+
<Heading size="md">Pro</Heading>
|
|
43
|
+
<Text color="muted">$24 per month</Text>
|
|
44
|
+
</Card>
|
|
45
|
+
</BlockPreview>`
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
docs
|
|
51
|
+
};
|