@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,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
function useClientLocale(locale) {
|
|
4
|
+
const [mounted, setMounted] = useState(false);
|
|
5
|
+
useEffect(() => setMounted(true), []);
|
|
6
|
+
if (locale) return locale;
|
|
7
|
+
return mounted ? void 0 : "en-US";
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
useClientLocale
|
|
11
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { announce, fieldErrorAnnouncementsSilenced } from "./announce.js";
|
|
4
|
+
function useFieldErrorAnnouncement(error, enabled = true) {
|
|
5
|
+
const prev = useRef(void 0);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const had = Boolean(prev.current);
|
|
8
|
+
prev.current = error;
|
|
9
|
+
if (!error || had || !enabled || fieldErrorAnnouncementsSilenced()) return;
|
|
10
|
+
announce(error, "polite");
|
|
11
|
+
}, [error, enabled]);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
useFieldErrorAnnouncement
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
function useReducedMotion() {
|
|
4
|
+
const [reduced, setReduced] = useState(false);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
7
|
+
const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
8
|
+
setReduced(mq.matches);
|
|
9
|
+
const on = (e) => setReduced(e.matches);
|
|
10
|
+
mq.addEventListener?.("change", on);
|
|
11
|
+
return () => mq.removeEventListener?.("change", on);
|
|
12
|
+
}, []);
|
|
13
|
+
return reduced;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
useReducedMotion
|
|
17
|
+
};
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useLayoutEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
useState
|
|
8
|
+
} from "react";
|
|
9
|
+
const ALL_EDGES = ["top", "right", "bottom", "left", "top-left", "top-right", "bottom-left", "bottom-right"];
|
|
10
|
+
function resolveResizeEdges(edges) {
|
|
11
|
+
if (!edges) return [];
|
|
12
|
+
if (edges === true || edges === "both") return ["right", "bottom", "bottom-right"];
|
|
13
|
+
if (edges === "x") return ["left", "right"];
|
|
14
|
+
if (edges === "y") return ["top", "bottom"];
|
|
15
|
+
const list = Array.isArray(edges) ? edges : [edges];
|
|
16
|
+
return ALL_EDGES.filter((e) => list.includes(e));
|
|
17
|
+
}
|
|
18
|
+
function edgeAxes(edge) {
|
|
19
|
+
return {
|
|
20
|
+
x: edge.includes("right") ? 1 : edge.includes("left") ? -1 : 0,
|
|
21
|
+
y: edge.includes("bottom") ? 1 : edge.includes("top") ? -1 : 0
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function trackResizeThumb(handle, edge, clientX, clientY) {
|
|
25
|
+
const axes = edgeAxes(edge);
|
|
26
|
+
if (axes.x && axes.y) return;
|
|
27
|
+
const rect = handle.getBoundingClientRect();
|
|
28
|
+
const along = axes.x ? (clientY - rect.top) / (handle.offsetHeight ? rect.height / handle.offsetHeight : 1) : (clientX - rect.left) / (handle.offsetWidth ? rect.width / handle.offsetWidth : 1);
|
|
29
|
+
handle.style.setProperty("--resize-thumb", `${Math.round(along)}px`);
|
|
30
|
+
}
|
|
31
|
+
function resizeCursor(edge) {
|
|
32
|
+
if (edge === "left" || edge === "right") return "ew-resize";
|
|
33
|
+
if (edge === "top" || edge === "bottom") return "ns-resize";
|
|
34
|
+
return edge === "top-left" || edge === "bottom-right" ? "nwse-resize" : "nesw-resize";
|
|
35
|
+
}
|
|
36
|
+
const clamp = (value, min, max) => Math.min(max ?? Infinity, Math.max(min ?? 0, value));
|
|
37
|
+
const storageKey = (key) => `shavin:resize:${key}`;
|
|
38
|
+
function readStored(key) {
|
|
39
|
+
try {
|
|
40
|
+
const raw = window.localStorage.getItem(storageKey(key));
|
|
41
|
+
const parsed = raw ? JSON.parse(raw) : null;
|
|
42
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
43
|
+
const out = {};
|
|
44
|
+
if (typeof parsed.width === "number") out.width = parsed.width;
|
|
45
|
+
if (typeof parsed.height === "number") out.height = parsed.height;
|
|
46
|
+
return out.width !== void 0 || out.height !== void 0 ? out : null;
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function writeStored(key, size) {
|
|
52
|
+
try {
|
|
53
|
+
if (size) window.localStorage.setItem(storageKey(key), JSON.stringify(size));
|
|
54
|
+
else window.localStorage.removeItem(storageKey(key));
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function cornerRadius(value, width, height) {
|
|
59
|
+
const first = value.trim().split(/\s+/)[0] ?? "0";
|
|
60
|
+
const n = parseFloat(first);
|
|
61
|
+
if (!Number.isFinite(n)) return 0;
|
|
62
|
+
return first.endsWith("%") ? n / 100 * Math.min(width, height) : n;
|
|
63
|
+
}
|
|
64
|
+
function readRadii(el, width, height) {
|
|
65
|
+
const cs = getComputedStyle(el);
|
|
66
|
+
const cap = Math.min(width, height) / 2;
|
|
67
|
+
const r = (v) => Math.round(Math.min(cap, cornerRadius(v, width, height)) * 10) / 10;
|
|
68
|
+
return {
|
|
69
|
+
topLeft: r(cs.borderTopLeftRadius),
|
|
70
|
+
topRight: r(cs.borderTopRightRadius),
|
|
71
|
+
bottomRight: r(cs.borderBottomRightRadius),
|
|
72
|
+
bottomLeft: r(cs.borderBottomLeftRadius)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const sameRadii = (a, b) => !!a && a.topLeft === b.topLeft && a.topRight === b.topRight && a.bottomRight === b.bottomRight && a.bottomLeft === b.bottomLeft;
|
|
76
|
+
const useIsoLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
77
|
+
function useResizable(options = {}) {
|
|
78
|
+
const { edges: edgesOption, minWidth, maxWidth, minHeight, maxHeight, step = 16, disabled, persistKey } = options;
|
|
79
|
+
const edgeKey = Array.isArray(edgesOption) ? edgesOption.join(",") : String(edgesOption ?? "");
|
|
80
|
+
const edges = useMemo(() => resolveResizeEdges(edgesOption), [edgeKey]);
|
|
81
|
+
const enabled = edges.length > 0 && !disabled;
|
|
82
|
+
const elementRef = useRef(null);
|
|
83
|
+
const [node, setNode] = useState(null);
|
|
84
|
+
const ref = useCallback((el) => {
|
|
85
|
+
elementRef.current = el;
|
|
86
|
+
setNode(el);
|
|
87
|
+
}, []);
|
|
88
|
+
const [size, setSize] = useState(null);
|
|
89
|
+
const [measured, setMeasured] = useState(null);
|
|
90
|
+
const [radii, setRadii] = useState(null);
|
|
91
|
+
const [activeEdge, setActiveEdge] = useState(null);
|
|
92
|
+
const optionsRef = useRef(options);
|
|
93
|
+
optionsRef.current = options;
|
|
94
|
+
const sizeRef = useRef(size);
|
|
95
|
+
sizeRef.current = size;
|
|
96
|
+
const endDragRef = useRef(null);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (!persistKey) return;
|
|
99
|
+
const stored = readStored(persistKey);
|
|
100
|
+
if (stored) setSize(stored);
|
|
101
|
+
}, [persistKey]);
|
|
102
|
+
useIsoLayoutEffect(() => {
|
|
103
|
+
if (!enabled || !node) return;
|
|
104
|
+
const update = () => {
|
|
105
|
+
const next = { width: node.offsetWidth, height: node.offsetHeight };
|
|
106
|
+
setMeasured((prev) => prev && prev.width === next.width && prev.height === next.height ? prev : next);
|
|
107
|
+
const nextRadii = readRadii(node, next.width, next.height);
|
|
108
|
+
setRadii((prev) => sameRadii(prev, nextRadii) ? prev : nextRadii);
|
|
109
|
+
};
|
|
110
|
+
update();
|
|
111
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
112
|
+
const observer = new ResizeObserver(update);
|
|
113
|
+
observer.observe(node);
|
|
114
|
+
return () => observer.disconnect();
|
|
115
|
+
}, [enabled, node]);
|
|
116
|
+
useEffect(() => () => endDragRef.current?.(), []);
|
|
117
|
+
const computeSize = useCallback(
|
|
118
|
+
(start, dx, dy, edge, applySnap) => {
|
|
119
|
+
const o = optionsRef.current;
|
|
120
|
+
const axes = edgeAxes(edge);
|
|
121
|
+
const round = (v) => applySnap && o.snap ? Math.round(v / o.snap) * o.snap : v;
|
|
122
|
+
let width = axes.x ? round(start.width + axes.x * dx) : void 0;
|
|
123
|
+
let height = axes.y ? round(start.height + axes.y * dy) : void 0;
|
|
124
|
+
if (o.lockAspectRatio && start.height > 0) {
|
|
125
|
+
const ratio = start.width / start.height;
|
|
126
|
+
if (width !== void 0 && (height === void 0 || Math.abs(dx) >= Math.abs(dy))) height = width / ratio;
|
|
127
|
+
else if (height !== void 0) width = height * ratio;
|
|
128
|
+
}
|
|
129
|
+
const next = {};
|
|
130
|
+
if (width !== void 0) next.width = Math.round(clamp(width, o.minWidth, o.maxWidth));
|
|
131
|
+
if (height !== void 0) next.height = Math.round(clamp(height, o.minHeight, o.maxHeight));
|
|
132
|
+
return next;
|
|
133
|
+
},
|
|
134
|
+
[]
|
|
135
|
+
);
|
|
136
|
+
const commit = useCallback((next, final) => {
|
|
137
|
+
const merged = { ...sizeRef.current, ...next };
|
|
138
|
+
sizeRef.current = merged;
|
|
139
|
+
setSize(merged);
|
|
140
|
+
const el = elementRef.current;
|
|
141
|
+
const full = {
|
|
142
|
+
width: merged.width ?? el?.offsetWidth ?? 0,
|
|
143
|
+
height: merged.height ?? el?.offsetHeight ?? 0
|
|
144
|
+
};
|
|
145
|
+
const o = optionsRef.current;
|
|
146
|
+
o.onResize?.(full);
|
|
147
|
+
if (final) {
|
|
148
|
+
if (o.persistKey) writeStored(o.persistKey, merged);
|
|
149
|
+
o.onResizeEnd?.(full);
|
|
150
|
+
}
|
|
151
|
+
}, []);
|
|
152
|
+
const reset = useCallback(() => {
|
|
153
|
+
sizeRef.current = null;
|
|
154
|
+
setSize(null);
|
|
155
|
+
if (optionsRef.current.persistKey) writeStored(optionsRef.current.persistKey, null);
|
|
156
|
+
}, []);
|
|
157
|
+
const startDrag = useCallback(
|
|
158
|
+
(edge, event) => {
|
|
159
|
+
const el = elementRef.current;
|
|
160
|
+
if (!el || event.button !== 0) return;
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
event.stopPropagation();
|
|
163
|
+
const rect = el.getBoundingClientRect();
|
|
164
|
+
const scaleX = el.offsetWidth ? rect.width / el.offsetWidth : 1;
|
|
165
|
+
const scaleY = el.offsetHeight ? rect.height / el.offsetHeight : 1;
|
|
166
|
+
const start = { width: el.offsetWidth, height: el.offsetHeight };
|
|
167
|
+
const startX = event.clientX;
|
|
168
|
+
const startY = event.clientY;
|
|
169
|
+
const handle = event.currentTarget;
|
|
170
|
+
trackResizeThumb(handle, edge, startX, startY);
|
|
171
|
+
const overlay = document.createElement("div");
|
|
172
|
+
overlay.setAttribute("data-shavin-resize-overlay", "");
|
|
173
|
+
Object.assign(overlay.style, { position: "fixed", inset: "0", zIndex: "2147483647", cursor: resizeCursor(edge) });
|
|
174
|
+
document.body.appendChild(overlay);
|
|
175
|
+
const prevUserSelect = document.body.style.userSelect;
|
|
176
|
+
document.body.style.userSelect = "none";
|
|
177
|
+
let frame = 0;
|
|
178
|
+
let pending = null;
|
|
179
|
+
const flush = () => {
|
|
180
|
+
frame = 0;
|
|
181
|
+
if (pending) commit(pending, false);
|
|
182
|
+
};
|
|
183
|
+
const onMove = (e) => {
|
|
184
|
+
trackResizeThumb(handle, edge, e.clientX, e.clientY);
|
|
185
|
+
pending = computeSize(start, (e.clientX - startX) / scaleX, (e.clientY - startY) / scaleY, edge, true);
|
|
186
|
+
if (!frame) frame = requestAnimationFrame(flush);
|
|
187
|
+
};
|
|
188
|
+
const end = () => {
|
|
189
|
+
window.removeEventListener("pointermove", onMove);
|
|
190
|
+
window.removeEventListener("pointerup", end);
|
|
191
|
+
window.removeEventListener("pointercancel", end);
|
|
192
|
+
if (frame) cancelAnimationFrame(frame);
|
|
193
|
+
overlay.remove();
|
|
194
|
+
document.body.style.userSelect = prevUserSelect;
|
|
195
|
+
handle.style.removeProperty("--resize-thumb");
|
|
196
|
+
endDragRef.current = null;
|
|
197
|
+
setActiveEdge(null);
|
|
198
|
+
if (pending) commit(pending, true);
|
|
199
|
+
};
|
|
200
|
+
window.addEventListener("pointermove", onMove);
|
|
201
|
+
window.addEventListener("pointerup", end);
|
|
202
|
+
window.addEventListener("pointercancel", end);
|
|
203
|
+
endDragRef.current = end;
|
|
204
|
+
setActiveEdge(edge);
|
|
205
|
+
},
|
|
206
|
+
[commit, computeSize]
|
|
207
|
+
);
|
|
208
|
+
const onKey = useCallback(
|
|
209
|
+
(edge, event) => {
|
|
210
|
+
const el = elementRef.current;
|
|
211
|
+
if (!el) return;
|
|
212
|
+
const o = optionsRef.current;
|
|
213
|
+
const axes = edgeAxes(edge);
|
|
214
|
+
const start = { width: el.offsetWidth, height: el.offsetHeight };
|
|
215
|
+
const amount = (o.step ?? 16) * (event.shiftKey ? 4 : 1);
|
|
216
|
+
let next = null;
|
|
217
|
+
switch (event.key) {
|
|
218
|
+
// Arrows move the focused edge in their direction: ArrowRight grows a right
|
|
219
|
+
// edge and shrinks a left one.
|
|
220
|
+
case "ArrowLeft":
|
|
221
|
+
case "ArrowRight":
|
|
222
|
+
if (axes.x) next = computeSize(start, event.key === "ArrowRight" ? amount : -amount, 0, edge, false);
|
|
223
|
+
break;
|
|
224
|
+
case "ArrowUp":
|
|
225
|
+
case "ArrowDown":
|
|
226
|
+
if (axes.y) next = computeSize(start, 0, event.key === "ArrowDown" ? amount : -amount, edge, false);
|
|
227
|
+
break;
|
|
228
|
+
case "Home":
|
|
229
|
+
next = {};
|
|
230
|
+
if (axes.x && o.minWidth !== void 0) next.width = o.minWidth;
|
|
231
|
+
if (axes.y && o.minHeight !== void 0) next.height = o.minHeight;
|
|
232
|
+
break;
|
|
233
|
+
case "End":
|
|
234
|
+
next = {};
|
|
235
|
+
if (axes.x && o.maxWidth !== void 0) next.width = o.maxWidth;
|
|
236
|
+
if (axes.y && o.maxHeight !== void 0) next.height = o.maxHeight;
|
|
237
|
+
break;
|
|
238
|
+
case "Enter":
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
reset();
|
|
241
|
+
return;
|
|
242
|
+
default:
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (!next || next.width === void 0 && next.height === void 0) return;
|
|
246
|
+
event.preventDefault();
|
|
247
|
+
commit(next, true);
|
|
248
|
+
},
|
|
249
|
+
[commit, computeSize, reset]
|
|
250
|
+
);
|
|
251
|
+
const getHandleProps = useCallback(
|
|
252
|
+
(edge) => {
|
|
253
|
+
const axes = edgeAxes(edge);
|
|
254
|
+
const horizontal = axes.x !== 0;
|
|
255
|
+
const corner = axes.x !== 0 && axes.y !== 0;
|
|
256
|
+
return {
|
|
257
|
+
role: "separator",
|
|
258
|
+
tabIndex: 0,
|
|
259
|
+
"aria-label": corner ? "Resize" : horizontal ? "Resize width" : "Resize height",
|
|
260
|
+
// A separator between left/right content is a vertical line.
|
|
261
|
+
"aria-orientation": corner ? void 0 : horizontal ? "vertical" : "horizontal",
|
|
262
|
+
"aria-valuenow": horizontal ? measured?.width : measured?.height,
|
|
263
|
+
"aria-valuemin": horizontal ? minWidth : minHeight,
|
|
264
|
+
"aria-valuemax": horizontal ? maxWidth : maxHeight,
|
|
265
|
+
"data-edge": edge,
|
|
266
|
+
"data-resizing": activeEdge === edge ? "" : void 0,
|
|
267
|
+
onPointerDown: (e) => startDrag(edge, e),
|
|
268
|
+
onKeyDown: (e) => onKey(edge, e),
|
|
269
|
+
onDoubleClick: reset
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
[activeEdge, maxHeight, maxWidth, measured, minHeight, minWidth, onKey, reset, startDrag]
|
|
273
|
+
);
|
|
274
|
+
const style = useMemo(() => {
|
|
275
|
+
if (!enabled) return {};
|
|
276
|
+
const s = {};
|
|
277
|
+
if (size?.width !== void 0) s.width = size.width;
|
|
278
|
+
if (size?.height !== void 0) s.height = size.height;
|
|
279
|
+
if (minWidth !== void 0) s.minWidth = minWidth;
|
|
280
|
+
if (maxWidth !== void 0) s.maxWidth = maxWidth;
|
|
281
|
+
if (minHeight !== void 0) s.minHeight = minHeight;
|
|
282
|
+
if (maxHeight !== void 0) s.maxHeight = maxHeight;
|
|
283
|
+
return s;
|
|
284
|
+
}, [enabled, size, minWidth, maxWidth, minHeight, maxHeight]);
|
|
285
|
+
return {
|
|
286
|
+
ref,
|
|
287
|
+
enabled,
|
|
288
|
+
edges: enabled ? edges : [],
|
|
289
|
+
size,
|
|
290
|
+
measured,
|
|
291
|
+
radii,
|
|
292
|
+
style,
|
|
293
|
+
isResizing: activeEdge !== null,
|
|
294
|
+
activeEdge,
|
|
295
|
+
getHandleProps,
|
|
296
|
+
reset
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function useMergedRef(...refs) {
|
|
300
|
+
return useCallback((value) => {
|
|
301
|
+
for (const r of refs) {
|
|
302
|
+
if (typeof r === "function") r(value);
|
|
303
|
+
else if (r) r.current = value;
|
|
304
|
+
}
|
|
305
|
+
}, refs);
|
|
306
|
+
}
|
|
307
|
+
export {
|
|
308
|
+
resizeCursor,
|
|
309
|
+
resolveResizeEdges,
|
|
310
|
+
trackResizeThumb,
|
|
311
|
+
useMergedRef,
|
|
312
|
+
useResizable
|
|
313
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useLayoutEffect, useRef } from "react";
|
|
3
|
+
function useReturnFocus(open, hasTrigger = false) {
|
|
4
|
+
const previous = useRef(null);
|
|
5
|
+
useLayoutEffect(() => {
|
|
6
|
+
if (open && typeof document !== "undefined") {
|
|
7
|
+
previous.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
8
|
+
}
|
|
9
|
+
}, [open]);
|
|
10
|
+
return useCallback(
|
|
11
|
+
(event) => {
|
|
12
|
+
if (hasTrigger) return;
|
|
13
|
+
const el = previous.current;
|
|
14
|
+
if (el && el.isConnected && el !== document.body) {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
el.focus();
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
[hasTrigger]
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
useReturnFocus
|
|
24
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
function useSlidingIndicator({
|
|
4
|
+
enabled,
|
|
5
|
+
orientation = "horizontal",
|
|
6
|
+
activeSelector
|
|
7
|
+
}) {
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
const indicatorRef = useRef(null);
|
|
10
|
+
const [state, setState] = useState({ pos: 0, size: 0, on: false, ready: false });
|
|
11
|
+
const horizontal = orientation !== "vertical";
|
|
12
|
+
const measure = useCallback(() => {
|
|
13
|
+
const root = ref.current;
|
|
14
|
+
if (!root) return;
|
|
15
|
+
const el = root.querySelector(activeSelector);
|
|
16
|
+
if (!el) {
|
|
17
|
+
setState((s) => ({ ...s, on: false }));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const ind = indicatorRef.current;
|
|
21
|
+
const base = ind ? horizontal ? ind.offsetLeft : ind.offsetTop : 0;
|
|
22
|
+
setState((s) => ({
|
|
23
|
+
pos: (horizontal ? el.offsetLeft : el.offsetTop) - base,
|
|
24
|
+
size: horizontal ? el.offsetWidth : el.offsetHeight,
|
|
25
|
+
on: true,
|
|
26
|
+
ready: s.on || s.ready
|
|
27
|
+
}));
|
|
28
|
+
}, [horizontal, activeSelector]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!enabled) return;
|
|
31
|
+
const root = ref.current;
|
|
32
|
+
if (!root) return;
|
|
33
|
+
measure();
|
|
34
|
+
const ro = new ResizeObserver(() => measure());
|
|
35
|
+
const observeAll = () => {
|
|
36
|
+
ro.disconnect();
|
|
37
|
+
ro.observe(root);
|
|
38
|
+
for (const child of Array.from(root.children)) ro.observe(child);
|
|
39
|
+
};
|
|
40
|
+
observeAll();
|
|
41
|
+
const mo = new MutationObserver(() => {
|
|
42
|
+
observeAll();
|
|
43
|
+
measure();
|
|
44
|
+
});
|
|
45
|
+
mo.observe(root, { attributes: true, childList: true, subtree: true, attributeFilter: ["data-state"] });
|
|
46
|
+
return () => {
|
|
47
|
+
mo.disconnect();
|
|
48
|
+
ro.disconnect();
|
|
49
|
+
};
|
|
50
|
+
}, [enabled, measure]);
|
|
51
|
+
const transitionClass = state.ready ? "transition-[transform,width,height] duration-200 ease-[cubic-bezier(0.4,0,0.2,1)] motion-reduce:transition-none" : "";
|
|
52
|
+
return { ref, indicatorRef, pos: state.pos, size: state.size, on: state.on, transitionClass };
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
useSlidingIndicator
|
|
56
|
+
};
|
package/dist/panels.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { PanelProps as PanelProps$1, GroupProps, LayoutStorage, SeparatorProps } from 'react-resizable-panels';
|
|
4
|
+
export { GroupImperativeHandle, PanelImperativeHandle, Layout as PanelLayout, LayoutStorage as PanelLayoutStorage, useGroupRef, usePanelRef } from 'react-resizable-panels';
|
|
5
|
+
import { VariantProps } from 'class-variance-authority';
|
|
6
|
+
|
|
7
|
+
interface PanelGroupProps extends GroupProps {
|
|
8
|
+
/** Split direction: "horizontal" puts panels side by side, "vertical" stacks them. Default "horizontal". */
|
|
9
|
+
orientation?: "horizontal" | "vertical";
|
|
10
|
+
/** Remember the layout under this key (saved after the user resizes). Panels need stable `id`s. */
|
|
11
|
+
persistKey?: string;
|
|
12
|
+
/** Where `persistKey` saves the layout. Default localStorage. For SSR without a layout jump, read the layout from a cookie on the server and pass it as `defaultLayout`. */
|
|
13
|
+
storage?: LayoutStorage;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Panes that trade space with each other. Import from "@shavin/ui/panels".
|
|
17
|
+
* For a single element that resizes itself, use the `resizable` prop on Box / Flex / Card.
|
|
18
|
+
*/
|
|
19
|
+
declare function PanelGroup({ persistKey, storage, defaultLayout, onLayoutChanged, groupRef, elementRef, className, onPointerMove, ...props }: PanelGroupProps): React.JSX.Element;
|
|
20
|
+
interface PanelProps extends PanelProps$1 {
|
|
21
|
+
/** Stable id; required for `persistKey` and imperative APIs. */
|
|
22
|
+
id?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* One pane of a PanelGroup. Sizes: numbers are px, unitless strings are %, or use "px", "%", "rem", "vh", "vw".
|
|
26
|
+
*/
|
|
27
|
+
declare function Panel({ className, ...props }: PanelProps): React.JSX.Element;
|
|
28
|
+
declare const panelHandleVariants: (props?: ({
|
|
29
|
+
variant?: "line" | "grip" | "invisible" | null | undefined;
|
|
30
|
+
color?: "brand" | "neutral" | "brand-subtle" | null | undefined;
|
|
31
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
32
|
+
interface PanelHandleProps extends Omit<SeparatorProps, "color">, VariantProps<typeof panelHandleVariants> {
|
|
33
|
+
}
|
|
34
|
+
/** Resize handle between two Panels. Must be a direct child of PanelGroup. */
|
|
35
|
+
declare function PanelHandle({ variant, color, className, ...props }: PanelHandleProps): React.JSX.Element;
|
|
36
|
+
|
|
37
|
+
export { Panel, PanelGroup, type PanelGroupProps, PanelHandle, type PanelHandleProps, type PanelProps, panelHandleVariants };
|
package/dist/panels.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
PanelGroup,
|
|
4
|
+
Panel,
|
|
5
|
+
PanelHandle,
|
|
6
|
+
panelHandleVariants
|
|
7
|
+
} from "./primitives/PanelGroup/PanelGroup.js";
|
|
8
|
+
import {
|
|
9
|
+
usePanelRef,
|
|
10
|
+
useGroupRef
|
|
11
|
+
} from "react-resizable-panels";
|
|
12
|
+
export {
|
|
13
|
+
Panel,
|
|
14
|
+
PanelGroup,
|
|
15
|
+
PanelHandle,
|
|
16
|
+
panelHandleVariants,
|
|
17
|
+
useGroupRef,
|
|
18
|
+
usePanelRef
|
|
19
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "Accordion",
|
|
3
|
+
description: "Sections that expand and collapse under a heading. Allow one open at a time or several, in default, outline or ghost styles.",
|
|
4
|
+
features: [
|
|
5
|
+
"Variants: default (divided list), outline, ghost",
|
|
6
|
+
"Supports type='single' and type='multiple' modes",
|
|
7
|
+
"ChevronDown indicator rotates 180 degrees when open per AGENTS.md rule",
|
|
8
|
+
"Uses panel radius --radius-panel for container geometry"
|
|
9
|
+
],
|
|
10
|
+
accessibility: [
|
|
11
|
+
"Built on WAI-ARIA Disclosure & Accordion pattern with role='region'",
|
|
12
|
+
"Keyboard navigation via Arrow keys, Home, and End",
|
|
13
|
+
"Space/Enter toggles expand/collapse state"
|
|
14
|
+
],
|
|
15
|
+
keyboard: "Up/Down arrows to move focus, Space/Enter to expand panel",
|
|
16
|
+
usage: {
|
|
17
|
+
bestPractices: [
|
|
18
|
+
{
|
|
19
|
+
guidance: true,
|
|
20
|
+
description: "Use Accordion for grouping secondary FAQs, settings sections, or dense collapsible details."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
guidance: false,
|
|
24
|
+
description: "Do not use ChevronRight for accordion triggers \u2014 use ChevronDown with 180deg rotation per section 4 convention."
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
examples: [
|
|
29
|
+
{
|
|
30
|
+
title: "Collapsible FAQ Accordion",
|
|
31
|
+
code: '<Accordion type="single" collapsible><AccordionItem value="1"><AccordionTrigger>What is @shavin/ui?</AccordionTrigger><AccordionContent>Enterprise React design system engine.</AccordionContent></AccordionItem></Accordion>'
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
docs
|
|
37
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import * as RadixAccordion from "@radix-ui/react-accordion";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "../../lib/cn.js";
|
|
7
|
+
const accordionVariants = cva("w-full", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "divide-y divide-hairline border-y border-hairline",
|
|
11
|
+
outline: "space-y-2",
|
|
12
|
+
ghost: "space-y-0.5"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "default"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const Accordion = forwardRef(
|
|
20
|
+
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
21
|
+
RadixAccordion.Root,
|
|
22
|
+
{
|
|
23
|
+
ref,
|
|
24
|
+
className: cn(accordionVariants({ variant }), className),
|
|
25
|
+
...props
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
Accordion.displayName = "Accordion";
|
|
30
|
+
const AccordionItem = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
31
|
+
RadixAccordion.Item,
|
|
32
|
+
{
|
|
33
|
+
ref,
|
|
34
|
+
className: cn("transition-colors", className),
|
|
35
|
+
...props
|
|
36
|
+
}
|
|
37
|
+
));
|
|
38
|
+
AccordionItem.displayName = "AccordionItem";
|
|
39
|
+
const AccordionTrigger = forwardRef(({ className, children, headingLevel = 3, ...props }, ref) => {
|
|
40
|
+
const HeadingTag = `h${headingLevel}`;
|
|
41
|
+
return /* @__PURE__ */ jsx(RadixAccordion.Header, { asChild: true, children: /* @__PURE__ */ jsx(HeadingTag, { className: "flex", children: /* @__PURE__ */ jsxs(
|
|
42
|
+
RadixAccordion.Trigger,
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
className: cn(
|
|
46
|
+
"flex flex-1 items-center justify-between py-3 text-sm font-medium text-fg transition cursor-pointer hover:text-fg [&[data-state=open]>svg]:rotate-180",
|
|
47
|
+
className
|
|
48
|
+
),
|
|
49
|
+
...props,
|
|
50
|
+
children: [
|
|
51
|
+
children,
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
"svg",
|
|
54
|
+
{
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
className: "h-4 w-4 shrink-0 text-fg-subtle transition-transform duration-200",
|
|
57
|
+
fill: "none",
|
|
58
|
+
stroke: "currentColor",
|
|
59
|
+
strokeWidth: "1.8",
|
|
60
|
+
strokeLinecap: "round",
|
|
61
|
+
strokeLinejoin: "round",
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "6 9 12 15 18 9" })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
) }) });
|
|
69
|
+
});
|
|
70
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
71
|
+
const AccordionContent = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
72
|
+
RadixAccordion.Content,
|
|
73
|
+
{
|
|
74
|
+
ref,
|
|
75
|
+
className: "shavin-accordion-content overflow-hidden text-sm",
|
|
76
|
+
...props,
|
|
77
|
+
children: /* @__PURE__ */ jsx("div", { className: cn("pt-0 pb-4 text-fg-muted", className), children })
|
|
78
|
+
}
|
|
79
|
+
));
|
|
80
|
+
AccordionContent.displayName = "AccordionContent";
|
|
81
|
+
export {
|
|
82
|
+
Accordion,
|
|
83
|
+
AccordionContent,
|
|
84
|
+
AccordionItem,
|
|
85
|
+
AccordionTrigger,
|
|
86
|
+
accordionVariants
|
|
87
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "ActionBar",
|
|
3
|
+
description: "Floating action bar pill for canvas tools, block insertion, and rich editor controls with searchable popovers.",
|
|
4
|
+
features: [
|
|
5
|
+
"Searchable action group popovers opening above the toolbar",
|
|
6
|
+
"Keyword alias filtering per action item",
|
|
7
|
+
"Uses panel radius --radius-panel for container bar geometry and control radius --radius-lg for action triggers",
|
|
8
|
+
"Single active popover state handling"
|
|
9
|
+
],
|
|
10
|
+
accessibility: [
|
|
11
|
+
"Renders native <div role='toolbar'> container",
|
|
12
|
+
"Auto-focuses search input when action group popover opens",
|
|
13
|
+
"Enter key triggers top filtered action match; Escape dismisses popover"
|
|
14
|
+
],
|
|
15
|
+
keyboard: "Type to search options, Enter to select top match, Escape to dismiss",
|
|
16
|
+
usage: {
|
|
17
|
+
bestPractices: [
|
|
18
|
+
{
|
|
19
|
+
guidance: true,
|
|
20
|
+
description: "Use ActionBar for canvas editing tools (e.g. Add Component, Theme Switcher, Zoom Controls)."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
guidance: false,
|
|
24
|
+
description: "Do not use ActionBar for primary page navigation \u2014 reach for TopBar or Tabs instead."
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
examples: [
|
|
29
|
+
{
|
|
30
|
+
title: "Canvas Action Bar",
|
|
31
|
+
code: '<ActionBar groups={[{ key: "add", label: "Add Block", items: [{ value: "hero", label: "Hero Section" }, { value: "pricing", label: "Pricing Table" }] }]} onAction={() => {}} />'
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
docs
|
|
37
|
+
};
|