@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,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
4
|
+
import { cn } from "../../lib/cn.js";
|
|
5
|
+
import { getMurmurState, makeDots } from "./engine.js";
|
|
6
|
+
function Murmur({ state = "thinking", size = 24, level = 0, speed = 1, dots, dotSize = 0.4, label, className, style, ...props }) {
|
|
7
|
+
const canvas = useRef(null);
|
|
8
|
+
const live = useRef({ state, level, speed, dotSize });
|
|
9
|
+
live.current = { state, level, speed, dotSize };
|
|
10
|
+
const count = dots ?? Math.max(32, Math.min(200, Math.round(size * 1.8)));
|
|
11
|
+
const swarm = useMemo(() => makeDots(count), [count]);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const el = canvas.current;
|
|
14
|
+
const ctx = el?.getContext("2d");
|
|
15
|
+
if (!el || !ctx) return;
|
|
16
|
+
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
17
|
+
el.width = Math.round(size * dpr);
|
|
18
|
+
el.height = Math.round(size * dpr);
|
|
19
|
+
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
20
|
+
const out = { x: 0, y: 0, z: 0, size: 1, alpha: 1 };
|
|
21
|
+
let raf = 0;
|
|
22
|
+
let visible = true;
|
|
23
|
+
let color = "";
|
|
24
|
+
let colorAt = -1e9;
|
|
25
|
+
const start = performance.now();
|
|
26
|
+
const draw = (now) => {
|
|
27
|
+
if (now - colorAt > 500) {
|
|
28
|
+
color = getComputedStyle(el).color;
|
|
29
|
+
colorAt = now;
|
|
30
|
+
}
|
|
31
|
+
const { state: s, level: l, speed: sp, dotSize: ds } = live.current;
|
|
32
|
+
const fn = getMurmurState(s);
|
|
33
|
+
const frame = { t: reduced ? 0 : now - start, level: l, speed: sp };
|
|
34
|
+
const c = size / 2;
|
|
35
|
+
const R = c * 0.78;
|
|
36
|
+
const base = (0.3 + size * 0.022) * 0.8 * ds;
|
|
37
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
38
|
+
ctx.clearRect(0, 0, size, size);
|
|
39
|
+
ctx.fillStyle = color;
|
|
40
|
+
for (const d of swarm) {
|
|
41
|
+
fn(d, frame, out);
|
|
42
|
+
const persp = 1 / (1 - out.z * 0.3);
|
|
43
|
+
const depth = 0.55 + 0.45 * ((out.z + 1.2) / 2.4);
|
|
44
|
+
ctx.globalAlpha = Math.max(0, Math.min(1, out.alpha * depth));
|
|
45
|
+
ctx.beginPath();
|
|
46
|
+
ctx.arc(c + out.x * R * persp, c + out.y * R * persp, Math.max(0.25, base * out.size * persp), 0, Math.PI * 2);
|
|
47
|
+
ctx.fill();
|
|
48
|
+
}
|
|
49
|
+
ctx.globalAlpha = 1;
|
|
50
|
+
};
|
|
51
|
+
const loop = (now) => {
|
|
52
|
+
if (visible) draw(now);
|
|
53
|
+
raf = requestAnimationFrame(loop);
|
|
54
|
+
};
|
|
55
|
+
if (reduced) {
|
|
56
|
+
draw(performance.now());
|
|
57
|
+
} else {
|
|
58
|
+
raf = requestAnimationFrame(loop);
|
|
59
|
+
}
|
|
60
|
+
const io = typeof IntersectionObserver !== "undefined" ? new IntersectionObserver(([e]) => {
|
|
61
|
+
visible = e.isIntersecting;
|
|
62
|
+
}) : null;
|
|
63
|
+
io?.observe(el);
|
|
64
|
+
return () => {
|
|
65
|
+
cancelAnimationFrame(raf);
|
|
66
|
+
io?.disconnect();
|
|
67
|
+
};
|
|
68
|
+
}, [size, swarm, state]);
|
|
69
|
+
const name = label ?? state.charAt(0).toUpperCase() + state.slice(1);
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
"span",
|
|
72
|
+
{
|
|
73
|
+
role: name ? "img" : void 0,
|
|
74
|
+
"aria-label": name || void 0,
|
|
75
|
+
"aria-hidden": name ? void 0 : true,
|
|
76
|
+
className: cn("inline-flex shrink-0 align-middle text-brand-contrast", className),
|
|
77
|
+
style: { width: size, height: size, ...style },
|
|
78
|
+
...props,
|
|
79
|
+
children: /* @__PURE__ */ jsx("canvas", { ref: canvas, style: { width: size, height: size }, "aria-hidden": true })
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
Murmur
|
|
85
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
function rotateY(o, a) {
|
|
2
|
+
const c = Math.cos(a);
|
|
3
|
+
const s = Math.sin(a);
|
|
4
|
+
const x = o.x * c + o.z * s;
|
|
5
|
+
o.z = -o.x * s + o.z * c;
|
|
6
|
+
o.x = x;
|
|
7
|
+
}
|
|
8
|
+
function rotateX(o, a) {
|
|
9
|
+
const c = Math.cos(a);
|
|
10
|
+
const s = Math.sin(a);
|
|
11
|
+
const y = o.y * c - o.z * s;
|
|
12
|
+
o.z = o.y * s + o.z * c;
|
|
13
|
+
o.y = y;
|
|
14
|
+
}
|
|
15
|
+
function place(dot, o, radius = 1) {
|
|
16
|
+
o.x = dot.x * radius;
|
|
17
|
+
o.y = dot.y * radius;
|
|
18
|
+
o.z = dot.z * radius;
|
|
19
|
+
o.size = 1;
|
|
20
|
+
o.alpha = 1;
|
|
21
|
+
}
|
|
22
|
+
function makeDots(count) {
|
|
23
|
+
const golden = Math.PI * (3 - Math.sqrt(5));
|
|
24
|
+
let seed = 7;
|
|
25
|
+
const rand = () => {
|
|
26
|
+
seed = seed * 16807 % 2147483647;
|
|
27
|
+
return seed / 2147483647;
|
|
28
|
+
};
|
|
29
|
+
return Array.from({ length: count }, (_, i) => {
|
|
30
|
+
const y = 1 - i / Math.max(1, count - 1) * 2;
|
|
31
|
+
const r = Math.sqrt(1 - y * y);
|
|
32
|
+
const a = golden * i;
|
|
33
|
+
return { x: Math.cos(a) * r, y, z: Math.sin(a) * r, phase: rand() * Math.PI * 2, index: i / Math.max(1, count - 1) };
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const spin = (x, z, a) => {
|
|
37
|
+
const c = Math.cos(a), s = Math.sin(a);
|
|
38
|
+
return [x * c + z * s, -x * s + z * c];
|
|
39
|
+
};
|
|
40
|
+
const searching = (d, f, o) => {
|
|
41
|
+
const t = f.t / 1e3 * f.speed;
|
|
42
|
+
const [x, z] = spin(d.x, d.z, t * 0.6);
|
|
43
|
+
const sweep = (Math.sin(t * 2.2 - d.y * 3) + 1) / 2;
|
|
44
|
+
const r = 1 + 0.12 * sweep;
|
|
45
|
+
o.x = x * r;
|
|
46
|
+
o.y = d.y * r;
|
|
47
|
+
o.z = z * r;
|
|
48
|
+
o.size = 0.8 + sweep * 0.9;
|
|
49
|
+
o.alpha = 0.3 + sweep * 0.7;
|
|
50
|
+
};
|
|
51
|
+
const composing = (d, f, o) => {
|
|
52
|
+
const t = f.t / 1e3 * f.speed;
|
|
53
|
+
const [x, z] = spin(d.x, d.z, t * 0.25);
|
|
54
|
+
const bob = Math.sin(t * 3 + d.index * 18) * 0.08;
|
|
55
|
+
o.x = x;
|
|
56
|
+
o.y = d.y + bob;
|
|
57
|
+
o.z = z;
|
|
58
|
+
const lead = (Math.sin(t * 2 - d.index * 6) + 1) / 2;
|
|
59
|
+
o.size = 0.7 + lead * 0.8;
|
|
60
|
+
o.alpha = 0.35 + lead * 0.65;
|
|
61
|
+
};
|
|
62
|
+
const weaving = (d, f, o) => {
|
|
63
|
+
const t = f.t / 1e3 * f.speed;
|
|
64
|
+
const dir = d.index < 0.5 ? 1 : -1;
|
|
65
|
+
const [x, z] = spin(d.x, d.z, t * 0.9 * dir);
|
|
66
|
+
const wave = Math.sin(d.y * 6 + t * 2 * dir) * 0.1;
|
|
67
|
+
o.x = x * (1 + wave);
|
|
68
|
+
o.y = d.y;
|
|
69
|
+
o.z = z * (1 + wave);
|
|
70
|
+
o.size = 0.9 + Math.abs(wave) * 5;
|
|
71
|
+
o.alpha = 0.5 + 0.5 * Math.sin(t * 2 + d.phase);
|
|
72
|
+
};
|
|
73
|
+
const connecting = (d, f, o) => {
|
|
74
|
+
const t = f.t / 1e3 * f.speed;
|
|
75
|
+
const pulse = (Math.sin(t * 2.4) + 1) / 2;
|
|
76
|
+
const r = 0.55 + 0.5 * pulse;
|
|
77
|
+
const [x, z] = spin(d.x, d.z, t * 0.4);
|
|
78
|
+
o.x = x * r;
|
|
79
|
+
o.y = d.y * r;
|
|
80
|
+
o.z = z * r;
|
|
81
|
+
o.size = 0.8 + pulse * 0.8;
|
|
82
|
+
o.alpha = 0.4 + pulse * 0.6;
|
|
83
|
+
};
|
|
84
|
+
const orbiting = (d, f, o) => {
|
|
85
|
+
const t = f.t / 1e3 * f.speed;
|
|
86
|
+
const ang = d.index * Math.PI * 2 - Math.PI / 2;
|
|
87
|
+
const head = t * 2.4;
|
|
88
|
+
const lit = Math.pow(0.5 + 0.5 * Math.cos(ang - head), 6);
|
|
89
|
+
const r = 0.92 + 0.04 * Math.sin(t * 1.6);
|
|
90
|
+
o.x = Math.cos(ang) * r;
|
|
91
|
+
o.y = Math.sin(ang) * r;
|
|
92
|
+
o.z = 0;
|
|
93
|
+
o.size = 0.55 + lit * 0.9;
|
|
94
|
+
o.alpha = 0.25 + lit * 0.75;
|
|
95
|
+
};
|
|
96
|
+
const looping = (d, f, o) => {
|
|
97
|
+
const t = f.t / 1e3 * f.speed;
|
|
98
|
+
const s = d.index * Math.PI * 2;
|
|
99
|
+
const den = 1 + Math.sin(s) * Math.sin(s);
|
|
100
|
+
const behind = ((t * 0.32 - d.index) % 1 + 1) % 1;
|
|
101
|
+
const lit = Math.pow(1 - behind, 3);
|
|
102
|
+
o.x = Math.cos(s) / den;
|
|
103
|
+
o.y = Math.sin(s) * Math.cos(s) / den;
|
|
104
|
+
o.z = 0;
|
|
105
|
+
o.size = 0.45 + lit * 0.9;
|
|
106
|
+
o.alpha = 0.18 + lit * 0.82;
|
|
107
|
+
};
|
|
108
|
+
const twinkle = (d, t, rate) => 0.5 + 0.5 * Math.sin(t * rate + d.phase);
|
|
109
|
+
const BUILT_IN = {
|
|
110
|
+
/** Resting: slow turn, dim. */
|
|
111
|
+
idle(d, f, o) {
|
|
112
|
+
place(d, o);
|
|
113
|
+
rotateY(o, f.t * 2e-4 * f.speed);
|
|
114
|
+
o.size = 0.95;
|
|
115
|
+
o.alpha = 0.6;
|
|
116
|
+
},
|
|
117
|
+
/** The model is reasoning: a slow turn, a gentle breath and dots that twinkle. */
|
|
118
|
+
thinking(d, f, o) {
|
|
119
|
+
place(d, o, 1 + 0.05 * Math.sin(f.t * 15e-4 + d.phase * 0.5));
|
|
120
|
+
rotateY(o, f.t * 6e-4 * f.speed);
|
|
121
|
+
const k = twinkle(d, f.t, 3e-3 * f.speed);
|
|
122
|
+
o.size = 0.85 + 0.6 * k;
|
|
123
|
+
o.alpha = 0.6 + 0.4 * k;
|
|
124
|
+
},
|
|
125
|
+
/** A tool is running: faster, twisted by latitude and tumbling. */
|
|
126
|
+
working(d, f, o) {
|
|
127
|
+
place(d, o, 1 + 0.12 * Math.sin(f.t * 4e-3 * f.speed + d.phase));
|
|
128
|
+
rotateY(o, f.t * 16e-4 * f.speed + d.y * 1.8);
|
|
129
|
+
rotateX(o, Math.sin(f.t * 8e-4 * f.speed) * 0.5);
|
|
130
|
+
o.size = 1;
|
|
131
|
+
o.alpha = 0.9;
|
|
132
|
+
},
|
|
133
|
+
/** Voice input: rings travel up the sphere and swell with the live level. */
|
|
134
|
+
listening(d, f, o) {
|
|
135
|
+
place(d, o, 1 + (0.08 + 0.4 * f.level) * Math.sin(d.y * 5 - f.t * 8e-3 * f.speed));
|
|
136
|
+
rotateY(o, f.t * 4e-4 * f.speed);
|
|
137
|
+
o.size = 0.9 + f.level * 0.8;
|
|
138
|
+
o.alpha = 0.7 + 0.3 * Math.min(1, f.level * 1.5 + 0.2);
|
|
139
|
+
},
|
|
140
|
+
searching,
|
|
141
|
+
composing,
|
|
142
|
+
weaving,
|
|
143
|
+
connecting,
|
|
144
|
+
orbiting,
|
|
145
|
+
looping
|
|
146
|
+
};
|
|
147
|
+
const registry = new Map(Object.entries(BUILT_IN));
|
|
148
|
+
function registerMurmurState(name, fn) {
|
|
149
|
+
registry.set(name, fn);
|
|
150
|
+
}
|
|
151
|
+
function getMurmurState(name) {
|
|
152
|
+
return registry.get(name) ?? BUILT_IN.thinking;
|
|
153
|
+
}
|
|
154
|
+
const MURMUR_STATES = Object.keys(BUILT_IN);
|
|
155
|
+
export {
|
|
156
|
+
MURMUR_STATES,
|
|
157
|
+
getMurmurState,
|
|
158
|
+
makeDots,
|
|
159
|
+
place,
|
|
160
|
+
registerMurmurState,
|
|
161
|
+
rotateX,
|
|
162
|
+
rotateY
|
|
163
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./Murmur.js";
|
|
2
|
+
export * from "./Murmur.doc.js";
|
|
3
|
+
import { registerMurmurState, getMurmurState, makeDots, rotateX, rotateY, place, MURMUR_STATES } from "./engine.js";
|
|
4
|
+
export {
|
|
5
|
+
MURMUR_STATES,
|
|
6
|
+
getMurmurState,
|
|
7
|
+
makeDots,
|
|
8
|
+
place,
|
|
9
|
+
registerMurmurState,
|
|
10
|
+
rotateX,
|
|
11
|
+
rotateY
|
|
12
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "Pagination",
|
|
3
|
+
description: 'Moves between pages of a table, list or document. Shows page numbers, a compact previous and next with "Page 2 of 10", or cards linking to the previous and next article.',
|
|
4
|
+
features: [
|
|
5
|
+
"Variants: numeric (numbered pagination bar), simple ('Page X of Y'), cards (editorial Next/Previous cards)",
|
|
6
|
+
"Sizes: sm, md, lg",
|
|
7
|
+
"Supports auto-ellipsis calculation for large page counts (e.g. 1 2 3 ... 10)",
|
|
8
|
+
"Supports link href mode (prevHref, nextHref) or client-side callback mode (onPageChange)"
|
|
9
|
+
],
|
|
10
|
+
accessibility: [
|
|
11
|
+
"Built with native <nav aria-label='Pagination'> element",
|
|
12
|
+
"Applies aria-current='page' to active page number button",
|
|
13
|
+
"Disables prev/next controls on first/last pages with disabled opacity"
|
|
14
|
+
],
|
|
15
|
+
keyboard: "Tab to cycle through page buttons, Space/Enter to change page",
|
|
16
|
+
usage: {
|
|
17
|
+
bestPractices: [
|
|
18
|
+
{
|
|
19
|
+
guidance: true,
|
|
20
|
+
description: "Use variant='numeric' for data tables and search results; use variant='cards' for documentation portals."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
guidance: false,
|
|
24
|
+
description: "Do not display pagination controls if totalPages === 1."
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
examples: [
|
|
29
|
+
{
|
|
30
|
+
title: "Numeric Page Navigation",
|
|
31
|
+
code: "<Pagination page={1} totalPages={10} onPageChange={() => {}} />"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
docs
|
|
37
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/cn.js";
|
|
6
|
+
const paginationVariants = cva("flex items-center gap-1.5", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
numeric: "justify-center",
|
|
10
|
+
simple: "justify-between",
|
|
11
|
+
cards: "grid grid-cols-1 sm:grid-cols-2 gap-4 w-full"
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
sm: "text-xs",
|
|
15
|
+
md: "text-sm",
|
|
16
|
+
lg: "text-base"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
variant: "numeric",
|
|
21
|
+
size: "md"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
function Pagination({
|
|
25
|
+
page = 1,
|
|
26
|
+
totalPages = 1,
|
|
27
|
+
onPageChange,
|
|
28
|
+
variant = "numeric",
|
|
29
|
+
size,
|
|
30
|
+
prevLabel = "Previous",
|
|
31
|
+
nextLabel = "Next",
|
|
32
|
+
prevTitle,
|
|
33
|
+
nextTitle,
|
|
34
|
+
prevHref,
|
|
35
|
+
nextHref,
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}) {
|
|
39
|
+
const isFirst = page <= 1;
|
|
40
|
+
const isLast = page >= totalPages;
|
|
41
|
+
const pages = React.useMemo(() => {
|
|
42
|
+
if (totalPages <= 7) {
|
|
43
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
44
|
+
}
|
|
45
|
+
if (page <= 3) {
|
|
46
|
+
return [1, 2, 3, 4, "...", totalPages];
|
|
47
|
+
}
|
|
48
|
+
if (page >= totalPages - 2) {
|
|
49
|
+
return [1, "...", totalPages - 3, totalPages - 2, totalPages - 1, totalPages];
|
|
50
|
+
}
|
|
51
|
+
return [1, "...", page - 1, page, page + 1, "...", totalPages];
|
|
52
|
+
}, [page, totalPages]);
|
|
53
|
+
if (variant === "cards") {
|
|
54
|
+
return /* @__PURE__ */ jsxs("nav", { "aria-label": "Pagination", className: cn(paginationVariants({ variant, size }), className), ...props, children: [
|
|
55
|
+
prevTitle ? /* @__PURE__ */ jsxs(
|
|
56
|
+
"a",
|
|
57
|
+
{
|
|
58
|
+
href: prevHref || "#",
|
|
59
|
+
onClick: (e) => {
|
|
60
|
+
if (onPageChange && !prevHref) {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
onPageChange(page - 1);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
className: "group block rounded-[var(--radius-panel)] border border-hairline bg-surface-hover/60 hover:bg-surface-hover hover:border-hairline-strong p-4 transition cursor-pointer",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs font-medium text-fg-subtle group-hover:text-brand-text transition", children: [
|
|
68
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2190" }),
|
|
69
|
+
/* @__PURE__ */ jsx("span", { children: prevLabel })
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 text-base font-semibold text-fg group-hover:text-brand-text transition", children: prevTitle })
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
) : /* @__PURE__ */ jsx("div", {}),
|
|
75
|
+
nextTitle ? /* @__PURE__ */ jsxs(
|
|
76
|
+
"a",
|
|
77
|
+
{
|
|
78
|
+
href: nextHref || "#",
|
|
79
|
+
onClick: (e) => {
|
|
80
|
+
if (onPageChange && !nextHref) {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
onPageChange(page + 1);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
className: "group block rounded-[var(--radius-panel)] border border-hairline bg-surface-hover/60 hover:bg-surface-hover hover:border-hairline-strong p-4 transition cursor-pointer sm:text-right",
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 justify-end text-xs font-medium text-fg-subtle group-hover:text-brand-text transition sm:justify-end", children: [
|
|
88
|
+
/* @__PURE__ */ jsx("span", { children: nextLabel === "Next" ? "Up next" : nextLabel }),
|
|
89
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2192" })
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 text-base font-semibold text-fg group-hover:text-brand-text transition", children: nextTitle })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
) : /* @__PURE__ */ jsx("div", {})
|
|
95
|
+
] });
|
|
96
|
+
}
|
|
97
|
+
if (variant === "simple") {
|
|
98
|
+
return /* @__PURE__ */ jsxs("nav", { "aria-label": "Pagination", className: cn(paginationVariants({ variant, size }), className), ...props, children: [
|
|
99
|
+
/* @__PURE__ */ jsxs(
|
|
100
|
+
"button",
|
|
101
|
+
{
|
|
102
|
+
type: "button",
|
|
103
|
+
disabled: isFirst,
|
|
104
|
+
onClick: () => onPageChange?.(page - 1),
|
|
105
|
+
"aria-label": "Previous Page",
|
|
106
|
+
className: "flex items-center gap-1.5 rounded-[var(--radius-lg)] border border-hairline bg-surface px-3 py-1.5 text-xs font-medium text-fg transition hover:bg-surface-hover disabled:opacity-40 disabled:pointer-events-none cursor-pointer",
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2190" }),
|
|
109
|
+
/* @__PURE__ */ jsx("span", { children: prevLabel })
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-medium text-fg-muted", children: [
|
|
114
|
+
"Page ",
|
|
115
|
+
page,
|
|
116
|
+
" of ",
|
|
117
|
+
totalPages
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ jsxs(
|
|
120
|
+
"button",
|
|
121
|
+
{
|
|
122
|
+
type: "button",
|
|
123
|
+
disabled: isLast,
|
|
124
|
+
onClick: () => onPageChange?.(page + 1),
|
|
125
|
+
"aria-label": "Next Page",
|
|
126
|
+
className: "flex items-center gap-1.5 rounded-[var(--radius-lg)] border border-hairline bg-surface px-3 py-1.5 text-xs font-medium text-fg transition hover:bg-surface-hover disabled:opacity-40 disabled:pointer-events-none cursor-pointer",
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsx("span", { children: nextLabel }),
|
|
129
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2192" })
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] });
|
|
134
|
+
}
|
|
135
|
+
return /* @__PURE__ */ jsxs("nav", { "aria-label": "Pagination", className: cn(paginationVariants({ variant, size }), className), ...props, children: [
|
|
136
|
+
/* @__PURE__ */ jsx(
|
|
137
|
+
"button",
|
|
138
|
+
{
|
|
139
|
+
type: "button",
|
|
140
|
+
disabled: isFirst,
|
|
141
|
+
onClick: () => onPageChange?.(page - 1),
|
|
142
|
+
"aria-label": "Previous Page",
|
|
143
|
+
className: "flex h-8 w-8 items-center justify-center rounded-[var(--radius-lg)] border border-hairline bg-surface text-fg transition hover:bg-surface-hover disabled:opacity-40 disabled:pointer-events-none cursor-pointer",
|
|
144
|
+
children: /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2190" })
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
pages.map((p, idx) => {
|
|
148
|
+
if (typeof p === "string") {
|
|
149
|
+
return /* @__PURE__ */ jsx("span", { className: "px-1.5 text-xs text-fg-subtle select-none", children: p }, `ellipsis-${idx}`);
|
|
150
|
+
}
|
|
151
|
+
const isActive = p === page;
|
|
152
|
+
return /* @__PURE__ */ jsx(
|
|
153
|
+
"button",
|
|
154
|
+
{
|
|
155
|
+
type: "button",
|
|
156
|
+
"aria-current": isActive ? "page" : void 0,
|
|
157
|
+
onClick: () => onPageChange?.(p),
|
|
158
|
+
className: cn(
|
|
159
|
+
"flex h-8 min-w-[32px] items-center justify-center rounded-[var(--radius-lg)] px-2 text-xs font-medium transition cursor-pointer",
|
|
160
|
+
isActive ? "bg-brand-solid text-brand-fg font-semibold shadow-card" : "border border-hairline bg-surface text-fg hover:bg-surface-hover"
|
|
161
|
+
),
|
|
162
|
+
children: p
|
|
163
|
+
},
|
|
164
|
+
p
|
|
165
|
+
);
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ jsx(
|
|
168
|
+
"button",
|
|
169
|
+
{
|
|
170
|
+
type: "button",
|
|
171
|
+
disabled: isLast,
|
|
172
|
+
onClick: () => onPageChange?.(page + 1),
|
|
173
|
+
"aria-label": "Next Page",
|
|
174
|
+
className: "flex h-8 w-8 items-center justify-center rounded-[var(--radius-lg)] border border-hairline bg-surface text-fg transition hover:bg-surface-hover disabled:opacity-40 disabled:pointer-events-none cursor-pointer",
|
|
175
|
+
children: /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\u2192" })
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
] });
|
|
179
|
+
}
|
|
180
|
+
export {
|
|
181
|
+
Pagination,
|
|
182
|
+
paginationVariants
|
|
183
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "PanelGroup",
|
|
3
|
+
group: "layout",
|
|
4
|
+
description: 'Side-by-side or stacked panes the user resizes by dragging the divider between them, such as code, preview and terminal. It can remember the layout. Import it from "@shavin/ui/panels", not the root. For one element that resizes itself, use the resizable prop on Box, Flex or Card.',
|
|
5
|
+
features: [
|
|
6
|
+
'PanelGroup, Panel and PanelHandle from "@shavin/ui/panels"',
|
|
7
|
+
'orientation="horizontal" (side by side) or "vertical" (stacked); groups nest',
|
|
8
|
+
"Panel sizes in px (numbers) or %, rem, vh, vw (strings); minSize, maxSize, collapsible, collapsedSize",
|
|
9
|
+
"persistKey remembers the layout in localStorage; pass storage for cookies or server sync",
|
|
10
|
+
"PanelHandle looks: line (hairline divider), grip (pill), invisible; color: brand-subtle (default), brand, neutral; while dragging the grip follows the pointer along the divider and re-centres on release",
|
|
11
|
+
"usePanelRef / useGroupRef for collapse(), expand(), resize() and setLayout()"
|
|
12
|
+
],
|
|
13
|
+
accessibility: [
|
|
14
|
+
'PanelHandle is a focusable role="separator" with aria-valuenow, aria-valuemin, aria-valuemax and aria-controls',
|
|
15
|
+
"Arrow keys resize, Home / End jump to the bounds, Enter toggles a collapsible panel",
|
|
16
|
+
"Hit targets grow on touch screens"
|
|
17
|
+
],
|
|
18
|
+
usage: {
|
|
19
|
+
bestPractices: [
|
|
20
|
+
{ guidance: true, description: 'Import from "@shavin/ui/panels" so apps that never split panes do not bundle the panel engine.' },
|
|
21
|
+
{ guidance: true, description: "Give every Panel a stable id when using persistKey or the imperative refs." },
|
|
22
|
+
{ guidance: true, description: "Give the PanelGroup's parent a fixed height (h-full inside an app shell, or an explicit height)." },
|
|
23
|
+
{ guidance: false, description: "Do not use PanelGroup for a single sidebar next to flexible content; use Sidebar resizable or Box resizable." },
|
|
24
|
+
{ guidance: false, description: "Do not wrap PanelHandle in another element; it must be a direct child of PanelGroup." }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
examples: [
|
|
28
|
+
{
|
|
29
|
+
title: "Editor split",
|
|
30
|
+
description: "Three panes, the first collapsible, layout remembered",
|
|
31
|
+
code: '<PanelGroup orientation="horizontal" persistKey="editor" className="h-96"><Panel id="files" defaultSize="20%" minSize={160} collapsible><Box className="h-full p-4">Files</Box></Panel><PanelHandle /><Panel id="code" minSize="30%"><Box className="h-full p-4">Code</Box></Panel><PanelHandle variant="grip" /><Panel id="preview" defaultSize="35%"><Box className="h-full p-4">Preview</Box></Panel></PanelGroup>'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: "Nested vertical split",
|
|
35
|
+
code: '<PanelGroup className="h-96"><Panel id="main"><PanelGroup orientation="vertical"><Panel id="editor"><Box className="h-full p-4">Editor</Box></Panel><PanelHandle /><Panel id="terminal" defaultSize="30%" minSize={80}><Box className="h-full p-4">Terminal</Box></Panel></PanelGroup></Panel><PanelHandle /><Panel id="chat" defaultSize="30%"><Box className="h-full p-4">Chat</Box></Panel></PanelGroup>'
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
docs
|
|
41
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useRef } from "react";
|
|
3
|
+
import {
|
|
4
|
+
Group,
|
|
5
|
+
Panel as PanelPrimitive,
|
|
6
|
+
Separator
|
|
7
|
+
} from "react-resizable-panels";
|
|
8
|
+
import { cva } from "class-variance-authority";
|
|
9
|
+
import { cn } from "../../lib/cn.js";
|
|
10
|
+
const browserStorage = {
|
|
11
|
+
getItem: (key) => {
|
|
12
|
+
try {
|
|
13
|
+
return window.localStorage.getItem(key);
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setItem: (key, value) => {
|
|
19
|
+
try {
|
|
20
|
+
window.localStorage.setItem(key, value);
|
|
21
|
+
} catch {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const useIsoLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
26
|
+
function readLayout(storage, key) {
|
|
27
|
+
try {
|
|
28
|
+
const parsed = JSON.parse(storage.getItem(key) ?? "null");
|
|
29
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
30
|
+
return Object.values(parsed).every((v) => typeof v === "number") ? parsed : null;
|
|
31
|
+
} catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function slideGrips(group, clientX, clientY) {
|
|
36
|
+
for (const child of Array.from(group.children)) {
|
|
37
|
+
const el = child;
|
|
38
|
+
if (el.dataset.separator !== "active") continue;
|
|
39
|
+
const rect = el.getBoundingClientRect();
|
|
40
|
+
const along = el.getAttribute("aria-orientation") === "horizontal" ? clientX - rect.left : clientY - rect.top;
|
|
41
|
+
el.style.setProperty("--resize-thumb", `${Math.round(along)}px`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function centreGrips(group) {
|
|
45
|
+
for (const child of Array.from(group.children)) child.style.removeProperty("--resize-thumb");
|
|
46
|
+
}
|
|
47
|
+
function PanelGroup({
|
|
48
|
+
persistKey,
|
|
49
|
+
storage,
|
|
50
|
+
defaultLayout,
|
|
51
|
+
onLayoutChanged,
|
|
52
|
+
groupRef,
|
|
53
|
+
elementRef,
|
|
54
|
+
className,
|
|
55
|
+
onPointerMove,
|
|
56
|
+
...props
|
|
57
|
+
}) {
|
|
58
|
+
const handleRef = useRef(null);
|
|
59
|
+
const groupEl = useRef(null);
|
|
60
|
+
const setGroupEl = useCallback(
|
|
61
|
+
(el) => {
|
|
62
|
+
groupEl.current = el;
|
|
63
|
+
if (typeof elementRef === "function") elementRef(el);
|
|
64
|
+
else if (elementRef) elementRef.current = el;
|
|
65
|
+
},
|
|
66
|
+
[elementRef]
|
|
67
|
+
);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
const onUp = () => groupEl.current && centreGrips(groupEl.current);
|
|
70
|
+
document.addEventListener("pointerup", onUp);
|
|
71
|
+
document.addEventListener("pointercancel", onUp);
|
|
72
|
+
return () => {
|
|
73
|
+
document.removeEventListener("pointerup", onUp);
|
|
74
|
+
document.removeEventListener("pointercancel", onUp);
|
|
75
|
+
};
|
|
76
|
+
}, []);
|
|
77
|
+
const setGroupRef = useCallback(
|
|
78
|
+
(handle) => {
|
|
79
|
+
handleRef.current = handle;
|
|
80
|
+
if (typeof groupRef === "function") groupRef(handle);
|
|
81
|
+
else if (groupRef) groupRef.current = handle;
|
|
82
|
+
},
|
|
83
|
+
[groupRef]
|
|
84
|
+
);
|
|
85
|
+
const storageKey = persistKey ? `shavin:panels:${persistKey}` : null;
|
|
86
|
+
const store = storage ?? browserStorage;
|
|
87
|
+
useIsoLayoutEffect(() => {
|
|
88
|
+
if (!storageKey || defaultLayout) return;
|
|
89
|
+
const saved = readLayout(store, storageKey);
|
|
90
|
+
if (saved) handleRef.current?.setLayout(saved);
|
|
91
|
+
}, [storageKey]);
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
Group,
|
|
94
|
+
{
|
|
95
|
+
className: cn("h-full w-full", className),
|
|
96
|
+
defaultLayout,
|
|
97
|
+
groupRef: setGroupRef,
|
|
98
|
+
elementRef: setGroupEl,
|
|
99
|
+
resizeTargetMinimumSize: { coarse: 44, fine: 24 },
|
|
100
|
+
onPointerMove: (e) => {
|
|
101
|
+
slideGrips(e.currentTarget, e.clientX, e.clientY);
|
|
102
|
+
onPointerMove?.(e);
|
|
103
|
+
},
|
|
104
|
+
onLayoutChanged: (layout, meta) => {
|
|
105
|
+
if (storageKey && meta.isUserInteraction) store.setItem(storageKey, JSON.stringify(meta.requestedLayout ?? layout));
|
|
106
|
+
onLayoutChanged?.(layout, meta);
|
|
107
|
+
},
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function Panel({ className, ...props }) {
|
|
113
|
+
return /* @__PURE__ */ jsx(PanelPrimitive, { className: cn("min-h-0 min-w-0", className), ...props });
|
|
114
|
+
}
|
|
115
|
+
const panelHandleVariants = cva(
|
|
116
|
+
"relative flex-none focus-visible:outline-offset-0 transition-colors duration-150 [&[aria-orientation=vertical]]:w-px [&[aria-orientation=horizontal]]:h-px data-[separator=disabled]:opacity-50 before:pointer-events-none before:absolute before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:transition-[background-color,top,left] before:duration-150 data-[separator=active]:before:transition-[background-color] [&[aria-orientation=vertical]]:before:left-1/2 [&[aria-orientation=vertical]]:before:top-[clamp(12px,var(--resize-thumb,50%),calc(100%_-_12px))] [&[aria-orientation=horizontal]]:before:top-1/2 [&[aria-orientation=horizontal]]:before:left-[clamp(12px,var(--resize-thumb,50%),calc(100%_-_12px))]",
|
|
117
|
+
{
|
|
118
|
+
variants: {
|
|
119
|
+
variant: {
|
|
120
|
+
line: "bg-hairline",
|
|
121
|
+
grip: "bg-hairline before:bg-hairline-strong [&[aria-orientation=vertical]]:before:h-6 [&[aria-orientation=vertical]]:before:w-1 [&[aria-orientation=horizontal]]:before:h-1 [&[aria-orientation=horizontal]]:before:w-6",
|
|
122
|
+
invisible: "bg-transparent"
|
|
123
|
+
},
|
|
124
|
+
// Hover, focus and drag colours of the divider and the grip.
|
|
125
|
+
color: {
|
|
126
|
+
brand: "data-[separator=hover]:bg-brand data-[separator=active]:bg-brand data-[separator=focus]:bg-brand data-[separator=hover]:before:bg-brand data-[separator=active]:before:bg-brand data-[separator=focus]:before:bg-brand",
|
|
127
|
+
"brand-subtle": "data-[separator=hover]:bg-brand/40 data-[separator=active]:bg-brand/60 data-[separator=focus]:bg-brand/60 data-[separator=hover]:before:bg-brand/40 data-[separator=active]:before:bg-brand/60 data-[separator=focus]:before:bg-brand/60",
|
|
128
|
+
neutral: "data-[separator=hover]:bg-fg-subtle data-[separator=active]:bg-fg-muted data-[separator=focus]:bg-fg-muted data-[separator=hover]:before:bg-fg-subtle data-[separator=active]:before:bg-fg-muted data-[separator=focus]:before:bg-fg-muted"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
defaultVariants: { variant: "line", color: "brand-subtle" }
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
function PanelHandle({ variant, color, className, ...props }) {
|
|
135
|
+
return /* @__PURE__ */ jsx(Separator, { "aria-label": "Resize panels", className: cn(panelHandleVariants({ variant, color }), className), ...props });
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
Panel,
|
|
139
|
+
PanelGroup,
|
|
140
|
+
PanelHandle,
|
|
141
|
+
panelHandleVariants
|
|
142
|
+
};
|