@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,36 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "Popover",
|
|
3
|
+
description: "A panel that opens when the user clicks a trigger, for short forms or extra detail. It stays on screen near edges and closes on Escape or a click outside.",
|
|
4
|
+
features: [
|
|
5
|
+
"Components: Popover, PopoverTrigger, PopoverAnchor, PopoverContent",
|
|
6
|
+
"Uses data-panel attribute for translucent surface styling",
|
|
7
|
+
"Configurable align, sideOffset, collisionPadding, and avoidCollisions"
|
|
8
|
+
],
|
|
9
|
+
accessibility: [
|
|
10
|
+
"Focus trapped automatically inside popover content while open",
|
|
11
|
+
"ESC key dismisses popover and returns focus to trigger",
|
|
12
|
+
"Supports aria-haspopup and aria-expanded attributes"
|
|
13
|
+
],
|
|
14
|
+
keyboard: "Escape to dismiss popover, Tab to cycle focusable items",
|
|
15
|
+
usage: {
|
|
16
|
+
bestPractices: [
|
|
17
|
+
{
|
|
18
|
+
guidance: true,
|
|
19
|
+
description: "Set align='start' and collisionPadding=8 for standard floating popovers."
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
guidance: false,
|
|
23
|
+
description: "Do not use Popover for simple hover labels \u2014 reach for Tooltip instead."
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
examples: [
|
|
28
|
+
{
|
|
29
|
+
title: "Basic Popover",
|
|
30
|
+
code: "<Popover><PopoverTrigger asChild><Button>Open Popover</Button></PopoverTrigger><PopoverContent><Text>Popover Content</Text></PopoverContent></Popover>"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
docs
|
|
36
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
+
import { cn } from "../../lib/cn.js";
|
|
5
|
+
import { usePortalContainer } from "../../lib/portal-container.js";
|
|
6
|
+
const Popover = PopoverPrimitive.Root;
|
|
7
|
+
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
8
|
+
const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
9
|
+
function PopoverContent({
|
|
10
|
+
className,
|
|
11
|
+
children,
|
|
12
|
+
align = "start",
|
|
13
|
+
sideOffset = 6,
|
|
14
|
+
avoidCollisions = true,
|
|
15
|
+
collisionPadding = 8,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
const portalContainer = usePortalContainer();
|
|
19
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx(
|
|
20
|
+
PopoverPrimitive.Content,
|
|
21
|
+
{
|
|
22
|
+
"data-panel": true,
|
|
23
|
+
align,
|
|
24
|
+
sideOffset,
|
|
25
|
+
avoidCollisions,
|
|
26
|
+
collisionPadding,
|
|
27
|
+
className: cn(
|
|
28
|
+
"animate-rise origin-[var(--radix-popover-content-transform-origin)] z-[var(--z-floating)] w-72 rounded-[var(--radius-panel)] border border-hairline p-4 shadow-panel focus:outline-none",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...props,
|
|
32
|
+
children
|
|
33
|
+
}
|
|
34
|
+
) });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
Popover,
|
|
38
|
+
PopoverAnchor,
|
|
39
|
+
PopoverContent,
|
|
40
|
+
PopoverTrigger
|
|
41
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "Progress",
|
|
3
|
+
description: "A bar that shows how far a task has got, or a moving bar when the end isn't known. It can show a label and the percentage, or run as a thin bar across the top of the page.",
|
|
4
|
+
features: [
|
|
5
|
+
"Variants: bar (standard track) and top-bar (fixed top-of-viewport page loader)",
|
|
6
|
+
"Sizes: sm (6px) and md (10px)",
|
|
7
|
+
"Supports numeric percentage text indicators and custom valueFormat functions",
|
|
8
|
+
"Label placement options: top header row or right side-by-side"
|
|
9
|
+
],
|
|
10
|
+
accessibility: [
|
|
11
|
+
"Built on native ARIA progressbar pattern (role='progressbar')",
|
|
12
|
+
"Communicates aria-valuenow, aria-valuemin, and aria-valuemax to screen readers"
|
|
13
|
+
],
|
|
14
|
+
usage: {
|
|
15
|
+
bestPractices: [
|
|
16
|
+
{
|
|
17
|
+
guidance: true,
|
|
18
|
+
description: "Use Progress for file upload progress, step wizard completion, or page loading bars."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
guidance: false,
|
|
22
|
+
description: "Do not use Progress for interactive slider input controls \u2014 reach for Slider instead."
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
examples: [
|
|
27
|
+
{
|
|
28
|
+
title: "File Upload Progress Bar",
|
|
29
|
+
code: '<Progress value={65} showValue label="Uploading document..." labelPosition="top" />'
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
docs
|
|
35
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as RadixProgress from "@radix-ui/react-progress";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/cn.js";
|
|
6
|
+
import { Text } from "../Text/index.js";
|
|
7
|
+
const progressVariants = cva("relative w-full overflow-hidden", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
bar: "rounded-[var(--radius-lg)] bg-fg/10",
|
|
11
|
+
"top-bar": "fixed top-0 left-0 right-0 z-[100] h-0.5 bg-transparent rounded-none"
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
sm: "h-1.5",
|
|
15
|
+
md: "h-2.5"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: { variant: "bar", size: "md" }
|
|
19
|
+
});
|
|
20
|
+
function Progress({
|
|
21
|
+
value,
|
|
22
|
+
indeterminate,
|
|
23
|
+
showValue = false,
|
|
24
|
+
valueFormat,
|
|
25
|
+
label,
|
|
26
|
+
labelPosition = "right",
|
|
27
|
+
"aria-label": ariaLabel,
|
|
28
|
+
variant = "bar",
|
|
29
|
+
size = "md",
|
|
30
|
+
className
|
|
31
|
+
}) {
|
|
32
|
+
const isIndeterminate = indeterminate || value == null;
|
|
33
|
+
const isTopBar = variant === "top-bar";
|
|
34
|
+
const formattedValue = typeof value === "number" ? valueFormat ? valueFormat(value) : `${Math.round(value)}%` : null;
|
|
35
|
+
const hasTopHeader = labelPosition === "top" && (label || showValue && formattedValue);
|
|
36
|
+
const hasRightValue = labelPosition === "right" && showValue && formattedValue && !isTopBar;
|
|
37
|
+
const track = isIndeterminate ? /* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
role: "progressbar",
|
|
41
|
+
"aria-label": ariaLabel ?? label ?? "Loading progress",
|
|
42
|
+
className: cn(progressVariants({ variant, size }), isTopBar ? "h-0.5" : "", !hasRightValue && className),
|
|
43
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-full w-full rounded-[var(--radius-lg)] bg-brand/20 overflow-hidden relative", children: /* @__PURE__ */ jsx("div", { className: "h-full w-full bg-brand-solid animate-progress-indeterminate rounded-[var(--radius-lg)]" }) })
|
|
44
|
+
}
|
|
45
|
+
) : /* @__PURE__ */ jsx(
|
|
46
|
+
RadixProgress.Root,
|
|
47
|
+
{
|
|
48
|
+
value,
|
|
49
|
+
"aria-label": ariaLabel ?? label ?? "Progress",
|
|
50
|
+
className: cn(progressVariants({ variant, size }), isTopBar ? "h-0.5" : "", !hasRightValue && className),
|
|
51
|
+
children: /* @__PURE__ */ jsx(
|
|
52
|
+
RadixProgress.Indicator,
|
|
53
|
+
{
|
|
54
|
+
className: "h-full rounded-[var(--radius-lg)] bg-brand-solid transition-transform duration-300 ease-out",
|
|
55
|
+
style: { transform: `translateX(-${100 - (value ?? 0)}%)` }
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
if (isTopBar) {
|
|
61
|
+
return track;
|
|
62
|
+
}
|
|
63
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", hasRightValue && className), children: [
|
|
64
|
+
hasTopHeader && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 mb-1.5", children: [
|
|
65
|
+
label ? /* @__PURE__ */ jsx(Text, { size: "xs", color: "muted", weight: "medium", children: label }) : /* @__PURE__ */ jsx("span", {}),
|
|
66
|
+
showValue && formattedValue && /* @__PURE__ */ jsx(Text, { size: "xs", color: "muted", className: "font-mono", children: formattedValue })
|
|
67
|
+
] }),
|
|
68
|
+
hasRightValue ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 w-full", children: [
|
|
69
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: track }),
|
|
70
|
+
/* @__PURE__ */ jsx(Text, { size: "xs", color: "muted", className: "shrink-0 font-mono min-w-[3.5ch] text-right", children: formattedValue })
|
|
71
|
+
] }) : track
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
Progress,
|
|
76
|
+
progressVariants
|
|
77
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "RadioGroup",
|
|
3
|
+
description: "Pick one option from a small set, shown as radio buttons or as selectable cards.",
|
|
4
|
+
features: [
|
|
5
|
+
"Variants: default (standard radio buttons) and cards (selectable card grid)",
|
|
6
|
+
"Supports radius escape hatch (radius='none|small|medium|large|full|inherit')",
|
|
7
|
+
"Defaults to rounded-full for radio buttons per AGENTS.md convention"
|
|
8
|
+
],
|
|
9
|
+
accessibility: [
|
|
10
|
+
"Built on native ARIA radio group pattern (role='radiogroup')",
|
|
11
|
+
"Arrow keys navigate between radio choices within the group",
|
|
12
|
+
"Space key selects focused radio option"
|
|
13
|
+
],
|
|
14
|
+
keyboard: "Up/Down or Left/Right arrows to cycle options in group, Space to select",
|
|
15
|
+
usage: {
|
|
16
|
+
bestPractices: [
|
|
17
|
+
{
|
|
18
|
+
guidance: true,
|
|
19
|
+
description: "Use RadioGroup for mutually exclusive choices when all options should be visible at once."
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
guidance: false,
|
|
23
|
+
description: "Do not use RadioGroup if options exceed 6 \u2014 reach for Select instead."
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
examples: [
|
|
28
|
+
{
|
|
29
|
+
title: "Radio Button Group",
|
|
30
|
+
code: '<RadioGroup defaultValue="monthly"><Radio value="monthly" label="Monthly Billing" /><Radio value="annual" label="Annual Billing" /></RadioGroup>'
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
docs
|
|
36
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import * as RadixRadioGroup from "@radix-ui/react-radio-group";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "../../lib/cn.js";
|
|
7
|
+
import { hitAreaClass } from "../../lib/hit-area.js";
|
|
8
|
+
const RadioGroupContext = createContext({
|
|
9
|
+
variant: "default",
|
|
10
|
+
radius: "inherit"
|
|
11
|
+
});
|
|
12
|
+
const ringRadiusVariants = cva(
|
|
13
|
+
"hit-area-touch flex h-5 w-5 shrink-0 items-center justify-center border border-border-control bg-surface transition data-[state=checked]:border-brand-text disabled:cursor-not-allowed disabled:opacity-50",
|
|
14
|
+
{
|
|
15
|
+
variants: {
|
|
16
|
+
radius: {
|
|
17
|
+
none: "rounded-none",
|
|
18
|
+
small: "rounded-[0.25rem]",
|
|
19
|
+
medium: "rounded-[0.5rem]",
|
|
20
|
+
large: "rounded-[0.75rem]",
|
|
21
|
+
full: "rounded-full",
|
|
22
|
+
inherit: "rounded-full",
|
|
23
|
+
concentric: "rounded-panel-inner"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: { radius: "inherit" }
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
const dotRadiusVariants = cva("h-2.5 w-2.5 bg-brand-solid", {
|
|
30
|
+
variants: {
|
|
31
|
+
radius: {
|
|
32
|
+
none: "rounded-none",
|
|
33
|
+
small: "rounded-[0.15rem]",
|
|
34
|
+
medium: "rounded-[0.3rem]",
|
|
35
|
+
large: "rounded-[0.45rem]",
|
|
36
|
+
full: "rounded-full",
|
|
37
|
+
inherit: "rounded-full",
|
|
38
|
+
concentric: "rounded-panel-inner"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: { radius: "inherit" }
|
|
42
|
+
});
|
|
43
|
+
const cardRadiusVariants = cva(
|
|
44
|
+
"flex items-center gap-3 border p-3 text-sm text-fg transition border-hairline data-[state=checked]:border-brand-text data-[state=checked]:bg-brand/5",
|
|
45
|
+
{
|
|
46
|
+
variants: {
|
|
47
|
+
radius: {
|
|
48
|
+
none: "rounded-none",
|
|
49
|
+
small: "rounded-[0.25rem]",
|
|
50
|
+
medium: "rounded-[0.5rem]",
|
|
51
|
+
large: "rounded-[0.75rem]",
|
|
52
|
+
full: "rounded-full",
|
|
53
|
+
inherit: "rounded-[var(--radius-panel)]",
|
|
54
|
+
concentric: "rounded-panel-inner"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
defaultVariants: { radius: "inherit" }
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
function RadioGroup({
|
|
61
|
+
variant = "default",
|
|
62
|
+
radius = "inherit",
|
|
63
|
+
hitArea,
|
|
64
|
+
disabled,
|
|
65
|
+
className,
|
|
66
|
+
children,
|
|
67
|
+
...props
|
|
68
|
+
}) {
|
|
69
|
+
return /* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { variant, radius, disabled, hitArea }, children: /* @__PURE__ */ jsx(
|
|
70
|
+
RadixRadioGroup.Root,
|
|
71
|
+
{
|
|
72
|
+
className: cn(
|
|
73
|
+
variant === "cards" ? "grid gap-2 sm:grid-cols-2" : "flex flex-col gap-2",
|
|
74
|
+
className
|
|
75
|
+
),
|
|
76
|
+
disabled,
|
|
77
|
+
...props,
|
|
78
|
+
children
|
|
79
|
+
}
|
|
80
|
+
) });
|
|
81
|
+
}
|
|
82
|
+
function Radio({
|
|
83
|
+
value,
|
|
84
|
+
label,
|
|
85
|
+
description,
|
|
86
|
+
disabled: itemDisabled,
|
|
87
|
+
radius: itemRadius,
|
|
88
|
+
variant: itemVariant,
|
|
89
|
+
hitArea: itemHitArea,
|
|
90
|
+
className,
|
|
91
|
+
children,
|
|
92
|
+
"aria-label": ariaLabel
|
|
93
|
+
}) {
|
|
94
|
+
const ctx = useContext(RadioGroupContext);
|
|
95
|
+
const effectiveVariant = itemVariant ?? ctx.variant;
|
|
96
|
+
const effectiveRadius = itemRadius ?? ctx.radius;
|
|
97
|
+
const isDisabled = itemDisabled ?? ctx.disabled;
|
|
98
|
+
const hitArea = itemHitArea ?? ctx.hitArea;
|
|
99
|
+
if (effectiveVariant === "cards") {
|
|
100
|
+
return (
|
|
101
|
+
// The card IS the Radix radio (a button), so Space, arrows and role="radio" all work.
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
RadixRadioGroup.Item,
|
|
104
|
+
{
|
|
105
|
+
value,
|
|
106
|
+
disabled: isDisabled,
|
|
107
|
+
className: cn(
|
|
108
|
+
cardRadiusVariants({ radius: effectiveRadius }),
|
|
109
|
+
"w-full text-left",
|
|
110
|
+
isDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-surface-hover data-[state=checked]:hover:bg-brand/5",
|
|
111
|
+
className
|
|
112
|
+
),
|
|
113
|
+
children: children || /* @__PURE__ */ jsxs("span", { className: "flex flex-col gap-0.5 min-w-0", children: [
|
|
114
|
+
label && /* @__PURE__ */ jsx("span", { className: "font-semibold text-fg", children: label }),
|
|
115
|
+
description && /* @__PURE__ */ jsx("span", { className: "text-xs text-fg-muted", children: description })
|
|
116
|
+
] })
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return /* @__PURE__ */ jsxs("label", { className: cn("flex items-center gap-2 select-none", isDisabled ? "cursor-not-allowed" : "cursor-pointer", className), children: [
|
|
122
|
+
/* @__PURE__ */ jsx(RadixRadioGroup.Item, { value, disabled: isDisabled, "aria-label": ariaLabel, className: cn(ringRadiusVariants({ radius: effectiveRadius }), hitAreaClass(hitArea, "touch", "Radio")), children: /* @__PURE__ */ jsx(RadixRadioGroup.Indicator, { className: dotRadiusVariants({ radius: effectiveRadius }) }) }),
|
|
123
|
+
children || label && /* @__PURE__ */ jsx("span", { className: cn("text-sm text-fg", isDisabled && "opacity-50"), children: label })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
Radio,
|
|
128
|
+
RadioGroup,
|
|
129
|
+
cardRadiusVariants,
|
|
130
|
+
dotRadiusVariants,
|
|
131
|
+
ringRadiusVariants
|
|
132
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useRef, useState } from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/cn.js";
|
|
6
|
+
const cell = cva(
|
|
7
|
+
"flex flex-1 items-center justify-center border font-medium tabular-nums transition-colors duration-150 first:rounded-l-[var(--radius-lg)] last:rounded-r-[var(--radius-lg)] -ml-px first:ml-0 focus-visible:z-10",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
size: { sm: "h-8 min-w-7 text-xs", md: "h-10 min-w-8 text-sm", lg: "h-12 min-w-9 text-base" },
|
|
11
|
+
band: { detractor: "", passive: "", promoter: "" },
|
|
12
|
+
selected: { true: "z-10", false: "border-hairline bg-surface text-fg hover:bg-surface-hover" }
|
|
13
|
+
},
|
|
14
|
+
compoundVariants: [
|
|
15
|
+
{ selected: true, band: "detractor", class: "border-danger bg-danger text-danger-fg" },
|
|
16
|
+
{ selected: true, band: "passive", class: "border-warning bg-warning text-warning-fg" },
|
|
17
|
+
{ selected: true, band: "promoter", class: "border-success bg-success text-success-fg" }
|
|
18
|
+
],
|
|
19
|
+
defaultVariants: { size: "md", selected: false }
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
const bandOf = (n) => n <= 6 ? "detractor" : n <= 8 ? "passive" : "promoter";
|
|
23
|
+
function NpsScale({ value, defaultValue = null, onValueChange, lowLabel = "Not at all likely", highLabel = "Extremely likely", size = "md", readOnly, disabled, label = "How likely are you to recommend us, from 0 to 10?", className, ...props }) {
|
|
24
|
+
const [inner, setInner] = useState(defaultValue);
|
|
25
|
+
const refs = useRef([]);
|
|
26
|
+
const current = value !== void 0 ? value : inner;
|
|
27
|
+
const inert = readOnly || disabled;
|
|
28
|
+
const anchorsId = useId();
|
|
29
|
+
function pick(n) {
|
|
30
|
+
if (inert) return;
|
|
31
|
+
const v = Math.min(10, Math.max(0, n));
|
|
32
|
+
if (value === void 0) setInner(v);
|
|
33
|
+
onValueChange?.(v);
|
|
34
|
+
refs.current[v]?.focus();
|
|
35
|
+
}
|
|
36
|
+
function onKeyDown(e) {
|
|
37
|
+
if (inert) return;
|
|
38
|
+
const base = current ?? 0;
|
|
39
|
+
const next = { ArrowRight: base + 1, ArrowUp: base + 1, ArrowLeft: base - 1, ArrowDown: base - 1, Home: 0, End: 10 };
|
|
40
|
+
if (e.key in next) {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
pick(next[e.key]);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", disabled && "opacity-50", className), ...props, children: [
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
role: "radiogroup",
|
|
50
|
+
"aria-label": label,
|
|
51
|
+
"aria-describedby": anchorsId,
|
|
52
|
+
"aria-disabled": disabled || void 0,
|
|
53
|
+
"aria-readonly": readOnly || void 0,
|
|
54
|
+
onKeyDown,
|
|
55
|
+
className: "flex w-full",
|
|
56
|
+
children: Array.from({ length: 11 }).map((_, n) => {
|
|
57
|
+
const selected = current === n;
|
|
58
|
+
return /* @__PURE__ */ jsx(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
ref: (el) => {
|
|
62
|
+
refs.current[n] = el;
|
|
63
|
+
},
|
|
64
|
+
type: "button",
|
|
65
|
+
role: "radio",
|
|
66
|
+
"aria-checked": selected,
|
|
67
|
+
"aria-label": String(n),
|
|
68
|
+
tabIndex: selected || current === null && n === 0 ? 0 : -1,
|
|
69
|
+
disabled,
|
|
70
|
+
onClick: () => pick(n),
|
|
71
|
+
className: cn(cell({ size, band: bandOf(n), selected }), inert && "cursor-default"),
|
|
72
|
+
children: n
|
|
73
|
+
},
|
|
74
|
+
n
|
|
75
|
+
);
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ jsxs("div", { id: anchorsId, className: "flex items-center justify-between text-xs text-fg-subtle", children: [
|
|
80
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "0, " }),
|
|
82
|
+
lowLabel,
|
|
83
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "." })
|
|
84
|
+
] }),
|
|
85
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
86
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "10, " }),
|
|
87
|
+
highLabel
|
|
88
|
+
] })
|
|
89
|
+
] })
|
|
90
|
+
] });
|
|
91
|
+
}
|
|
92
|
+
function calculateNps(scores) {
|
|
93
|
+
const total = scores.length;
|
|
94
|
+
const promoters = scores.filter((s) => s >= 9).length;
|
|
95
|
+
const detractors = scores.filter((s) => s <= 6).length;
|
|
96
|
+
const passives = total - promoters - detractors;
|
|
97
|
+
return { score: total ? Math.round((promoters - detractors) / total * 100) : 0, promoters, passives, detractors, total };
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
NpsScale,
|
|
101
|
+
calculateNps
|
|
102
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "Rating",
|
|
3
|
+
description: "Collect and show ratings. Rating is a star rating (read only average or input, half stars). NpsScale is the 0 to 10 Net Promoter question with band colours. SentimentRating is one-tap feedback as thumbs or five faces. RatingSummary is the average with a 5 to 1 breakdown, optionally filterable.",
|
|
4
|
+
features: [
|
|
5
|
+
"Rating: max, precision full or half, fractional display (4.6 fills 60% of the fifth star), readOnly, showValue, count, tone brand | warning | success, sizes sm | md | lg",
|
|
6
|
+
"NpsScale: 0 to 10, detractor / passive / promoter colours, lowLabel and highLabel, and calculateNps(scores) for the score",
|
|
7
|
+
"SentimentRating: variant thumbs (1 up, -1 down) or faces (1 to 5)",
|
|
8
|
+
"RatingSummary: counts per star level (1 star first), derived average and total, optional onSelect to filter reviews",
|
|
9
|
+
"All inputs are controlled (value, onValueChange) or uncontrolled (defaultValue)"
|
|
10
|
+
],
|
|
11
|
+
accessibility: [
|
|
12
|
+
"Rating read only is role=img labelled '4.5 out of 5'; interactive is a single slider with aria-valuenow and aria-valuetext",
|
|
13
|
+
"NpsScale and SentimentRating are radiogroups with a roving tab stop and arrow-key selection",
|
|
14
|
+
"Colour is never the only signal: values, labels and numbers are always in text"
|
|
15
|
+
],
|
|
16
|
+
keyboard: "Rating: Arrow keys change the value by the step, Home sets 0, End sets max. NpsScale: Arrow keys move, Home is 0, End is 10. SentimentRating: Arrow keys move between options.",
|
|
17
|
+
usage: {
|
|
18
|
+
bestPractices: [
|
|
19
|
+
{ guidance: true, description: "Use Rating readOnly with `value`, `showValue` and `count` on product cards and review lists." },
|
|
20
|
+
{ guidance: true, description: "Pass raw counts to RatingSummary and let it compute the average, so the number and the bars never disagree." },
|
|
21
|
+
{ guidance: false, description: "Do not build stars from Icon by hand; Rating handles fractions, hover and keyboard." },
|
|
22
|
+
{ guidance: false, description: "Do not use NpsScale for satisfaction questions. NPS is the 0 to 10 recommend question; use Rating or SentimentRating otherwise." }
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
examples: [
|
|
26
|
+
{ title: "Average on a product", code: "<Rating readOnly value={4.6} showValue count={34} />" },
|
|
27
|
+
{ title: "Collect a rating with half stars", code: '<Rating precision="half" size="lg" onValueChange={(v) => save(v)} />' },
|
|
28
|
+
{ title: "NPS question", code: '<NpsScale lowLabel="Not likely" highLabel="Very likely" onValueChange={(n) => send(n)} />' },
|
|
29
|
+
{ title: "Thumbs feedback", code: "<SentimentRating onValueChange={(v) => save(v)} />" },
|
|
30
|
+
{ title: "Review summary", code: '<RatingSummary counts={[2, 1, 4, 20, 55]} noun="reviews" />' }
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
docs
|
|
35
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/cn.js";
|
|
6
|
+
import { Icon } from "../Icon/index.js";
|
|
7
|
+
const toneClass = cva("", {
|
|
8
|
+
variants: {
|
|
9
|
+
tone: { brand: "text-brand-text", warning: "text-warning", success: "text-success" }
|
|
10
|
+
},
|
|
11
|
+
defaultVariants: { tone: "brand" }
|
|
12
|
+
});
|
|
13
|
+
const sizeClass = cva("", {
|
|
14
|
+
variants: {
|
|
15
|
+
size: { sm: "gap-0.5 text-xs", md: "gap-1 text-sm", lg: "gap-1.5 text-base" }
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: { size: "md" }
|
|
18
|
+
});
|
|
19
|
+
const STAR_SIZE = { sm: "sm", md: "md", lg: "lg" };
|
|
20
|
+
const clamp = (n, lo, hi) => Math.min(hi, Math.max(lo, n));
|
|
21
|
+
function Rating({ value, defaultValue = 0, onValueChange, max = 5, precision = "full", readOnly, disabled, showValue, count, label = "Rating", tone, size = "md", className, ...props }) {
|
|
22
|
+
const [inner, setInner] = useState(defaultValue);
|
|
23
|
+
const [hover, setHover] = useState(null);
|
|
24
|
+
const id = useId();
|
|
25
|
+
const current = value ?? inner;
|
|
26
|
+
const shown = hover ?? current;
|
|
27
|
+
const step = precision === "half" ? 0.5 : 1;
|
|
28
|
+
const interactive = !readOnly && !disabled;
|
|
29
|
+
const px = STAR_SIZE[size ?? "md"];
|
|
30
|
+
function commit(next) {
|
|
31
|
+
const v = clamp(next, 0, max);
|
|
32
|
+
if (value === void 0) setInner(v);
|
|
33
|
+
onValueChange?.(v);
|
|
34
|
+
}
|
|
35
|
+
function valueAt(e, index) {
|
|
36
|
+
if (precision !== "half") return index + 1;
|
|
37
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
38
|
+
return index + (e.clientX - r.left < r.width / 2 ? 0.5 : 1);
|
|
39
|
+
}
|
|
40
|
+
function onKeyDown(e) {
|
|
41
|
+
if (!interactive) return;
|
|
42
|
+
const keys = { ArrowRight: current + step, ArrowUp: current + step, ArrowLeft: current - step, ArrowDown: current - step, PageUp: current + 1, PageDown: current - 1, Home: 0, End: max };
|
|
43
|
+
if (e.key in keys) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
commit(keys[e.key]);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const stars = /* @__PURE__ */ jsx("span", { className: cn("relative inline-flex items-center", sizeClass({ size }), toneClass({ tone })), "aria-hidden": true, children: Array.from({ length: max }).map((_, i) => {
|
|
49
|
+
const fill = clamp(shown - i, 0, 1);
|
|
50
|
+
return /* @__PURE__ */ jsxs(
|
|
51
|
+
"span",
|
|
52
|
+
{
|
|
53
|
+
"data-star": i + 1,
|
|
54
|
+
className: cn("relative inline-flex", interactive && "cursor-pointer transition-transform duration-150 hover:scale-110"),
|
|
55
|
+
onPointerMove: interactive ? (e) => setHover(valueAt(e, i)) : void 0,
|
|
56
|
+
onPointerLeave: interactive ? () => setHover(null) : void 0,
|
|
57
|
+
onClick: interactive ? (e) => commit(valueAt(e, i)) : void 0,
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsx(Icon, { name: "star", size: px, color: "inherit", className: "text-fg-subtle/50" }),
|
|
60
|
+
/* @__PURE__ */ jsx("span", { "data-fill": true, className: "absolute inset-y-0 left-0 overflow-hidden", style: { width: `${fill * 100}%` }, children: /* @__PURE__ */ jsx(Icon, { name: "star", size: px, color: "inherit", className: "fill-current" }) })
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
i
|
|
64
|
+
);
|
|
65
|
+
}) });
|
|
66
|
+
const meta = (showValue || count !== void 0) && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-baseline gap-1 text-fg-muted tabular-nums", children: [
|
|
67
|
+
showValue && /* @__PURE__ */ jsx("span", { className: "font-medium text-fg", children: Number.isInteger(current) ? current : current.toFixed(1) }),
|
|
68
|
+
count !== void 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
69
|
+
"(",
|
|
70
|
+
count.toLocaleString("en"),
|
|
71
|
+
")"
|
|
72
|
+
] })
|
|
73
|
+
] });
|
|
74
|
+
const valueText = `${Number.isInteger(current) ? current : current.toFixed(1)} out of ${max} stars`;
|
|
75
|
+
const { "aria-labelledby": labelledBy, "aria-describedby": describedBy, ...rest } = props;
|
|
76
|
+
if (!interactive && !disabled) {
|
|
77
|
+
return /* @__PURE__ */ jsxs(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
role: "img",
|
|
81
|
+
"aria-label": valueText,
|
|
82
|
+
className: cn("inline-flex items-center gap-2", className),
|
|
83
|
+
...props,
|
|
84
|
+
children: [
|
|
85
|
+
stars,
|
|
86
|
+
meta
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("inline-flex items-center gap-2", disabled && "opacity-50", className), ...rest, children: [
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
id,
|
|
96
|
+
role: "slider",
|
|
97
|
+
tabIndex: disabled ? -1 : 0,
|
|
98
|
+
"aria-label": labelledBy ? void 0 : label,
|
|
99
|
+
"aria-labelledby": labelledBy,
|
|
100
|
+
"aria-describedby": describedBy,
|
|
101
|
+
"aria-disabled": disabled || void 0,
|
|
102
|
+
"aria-valuemin": 0,
|
|
103
|
+
"aria-valuemax": max,
|
|
104
|
+
"aria-valuenow": current,
|
|
105
|
+
"aria-valuetext": valueText,
|
|
106
|
+
onKeyDown,
|
|
107
|
+
className: "inline-flex min-h-6 items-center rounded-[var(--radius-lg)]",
|
|
108
|
+
children: stars
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
meta
|
|
112
|
+
] });
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
Rating
|
|
116
|
+
};
|