@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,398 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
4
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
5
|
+
import { announce } from "../../lib/announce.js";
|
|
6
|
+
import { useClientLocale } from "../../lib/useClientLocale.js";
|
|
7
|
+
function sameDay(a, b) {
|
|
8
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
9
|
+
}
|
|
10
|
+
const DEFAULT_TOKENS = {
|
|
11
|
+
brand: "rgb(var(--brand))",
|
|
12
|
+
brandFg: "rgb(var(--brand-fg))",
|
|
13
|
+
brandSolid: "rgb(var(--brand-solid))",
|
|
14
|
+
field: "rgb(var(--bg-surface-hover))",
|
|
15
|
+
elevated: "rgb(var(--bg-elevated))",
|
|
16
|
+
border: "rgb(var(--hairline))",
|
|
17
|
+
hover: "rgb(var(--bg-surface-hover))",
|
|
18
|
+
fg: "rgb(var(--fg))",
|
|
19
|
+
fgMuted: "rgb(var(--fg-muted))",
|
|
20
|
+
fgSubtle: "rgb(var(--fg-subtle))",
|
|
21
|
+
radius: "var(--radius-lg)",
|
|
22
|
+
popupRadius: "var(--radius-panel)",
|
|
23
|
+
cellRadius: "var(--radius-lg)",
|
|
24
|
+
font: "inherit"
|
|
25
|
+
};
|
|
26
|
+
const POP_W = 288;
|
|
27
|
+
const WEEKDAYS = [
|
|
28
|
+
["S", "Sunday"],
|
|
29
|
+
["M", "Monday"],
|
|
30
|
+
["T", "Tuesday"],
|
|
31
|
+
["W", "Wednesday"],
|
|
32
|
+
["T", "Thursday"],
|
|
33
|
+
["F", "Friday"],
|
|
34
|
+
["S", "Saturday"]
|
|
35
|
+
];
|
|
36
|
+
function addDays(d, n) {
|
|
37
|
+
const r = new Date(d);
|
|
38
|
+
r.setDate(r.getDate() + n);
|
|
39
|
+
return r;
|
|
40
|
+
}
|
|
41
|
+
function DatePicker({
|
|
42
|
+
value,
|
|
43
|
+
onChange,
|
|
44
|
+
dateOnly = false,
|
|
45
|
+
tokens,
|
|
46
|
+
className = "",
|
|
47
|
+
id,
|
|
48
|
+
locale,
|
|
49
|
+
"aria-label": ariaLabel,
|
|
50
|
+
"aria-labelledby": ariaLabelledBy,
|
|
51
|
+
"aria-describedby": ariaDescribedBy,
|
|
52
|
+
"aria-invalid": ariaInvalid,
|
|
53
|
+
"aria-required": ariaRequired
|
|
54
|
+
}) {
|
|
55
|
+
const t = { ...DEFAULT_TOKENS, ...tokens };
|
|
56
|
+
const vars = {
|
|
57
|
+
"--dp-brand": t.brand,
|
|
58
|
+
"--dp-brand-fg": t.brandFg,
|
|
59
|
+
"--dp-brand-solid": t.brandSolid,
|
|
60
|
+
"--dp-field": t.field,
|
|
61
|
+
"--dp-elevated": t.elevated,
|
|
62
|
+
"--dp-border": t.border,
|
|
63
|
+
"--dp-hover": t.hover,
|
|
64
|
+
"--dp-fg": t.fg,
|
|
65
|
+
"--dp-fg-muted": t.fgMuted,
|
|
66
|
+
"--dp-fg-subtle": t.fgSubtle,
|
|
67
|
+
"--dp-radius": t.radius,
|
|
68
|
+
"--dp-popup-radius": t.popupRadius,
|
|
69
|
+
"--dp-cell-radius": t.cellRadius,
|
|
70
|
+
"--dp-font": t.font
|
|
71
|
+
};
|
|
72
|
+
const dateLocale = useClientLocale(locale);
|
|
73
|
+
const [open, setOpen] = useState(false);
|
|
74
|
+
const [view, setView] = useState(() => new Date(value));
|
|
75
|
+
const [focusDay, setFocusDay] = useState(() => new Date(value));
|
|
76
|
+
const [draft, setDraft] = useState(null);
|
|
77
|
+
const [invalid, setInvalid] = useState(false);
|
|
78
|
+
const gridRef = useRef(null);
|
|
79
|
+
const pendingFocus = useRef(false);
|
|
80
|
+
const monthId = useId();
|
|
81
|
+
function onOpenChange(next) {
|
|
82
|
+
if (next) {
|
|
83
|
+
setDraft(null);
|
|
84
|
+
setView(new Date(value));
|
|
85
|
+
setFocusDay(new Date(value));
|
|
86
|
+
}
|
|
87
|
+
setOpen(next);
|
|
88
|
+
}
|
|
89
|
+
const label = value.toLocaleString(dateLocale, {
|
|
90
|
+
weekday: "short",
|
|
91
|
+
day: "numeric",
|
|
92
|
+
month: "short",
|
|
93
|
+
year: "numeric",
|
|
94
|
+
...dateOnly ? {} : { hour: "numeric", minute: "2-digit" }
|
|
95
|
+
});
|
|
96
|
+
function pickDay(d) {
|
|
97
|
+
setDraft(null);
|
|
98
|
+
setFocusDay(d);
|
|
99
|
+
const next = new Date(value);
|
|
100
|
+
next.setFullYear(d.getFullYear(), d.getMonth(), d.getDate());
|
|
101
|
+
onChange(next);
|
|
102
|
+
if (dateOnly) setOpen(false);
|
|
103
|
+
}
|
|
104
|
+
function setTime(h, m) {
|
|
105
|
+
const next = new Date(value);
|
|
106
|
+
next.setHours(h, m, 0, 0);
|
|
107
|
+
onChange(next);
|
|
108
|
+
}
|
|
109
|
+
function commitDraft() {
|
|
110
|
+
if (draft === null) return;
|
|
111
|
+
const cleaned = draft.trim().replace(/^[A-Za-z]+,\s*/, "");
|
|
112
|
+
const d = new Date(cleaned);
|
|
113
|
+
if (!isNaN(d.getTime())) {
|
|
114
|
+
const next = new Date(value);
|
|
115
|
+
next.setFullYear(d.getFullYear(), d.getMonth(), d.getDate());
|
|
116
|
+
onChange(next);
|
|
117
|
+
setInvalid(false);
|
|
118
|
+
} else if (cleaned !== label) {
|
|
119
|
+
setInvalid(true);
|
|
120
|
+
announce("Date not recognised; kept the previous date");
|
|
121
|
+
}
|
|
122
|
+
setDraft(null);
|
|
123
|
+
}
|
|
124
|
+
function moveFocus(d) {
|
|
125
|
+
if (d.getFullYear() !== view.getFullYear() || d.getMonth() !== view.getMonth()) {
|
|
126
|
+
setView(new Date(d.getFullYear(), d.getMonth(), 1));
|
|
127
|
+
}
|
|
128
|
+
pendingFocus.current = true;
|
|
129
|
+
setFocusDay(d);
|
|
130
|
+
}
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
if (!pendingFocus.current) return;
|
|
133
|
+
pendingFocus.current = false;
|
|
134
|
+
gridRef.current?.querySelector('[tabindex="0"]')?.focus();
|
|
135
|
+
}, [focusDay, view]);
|
|
136
|
+
function onGridKeyDown(e) {
|
|
137
|
+
const from = focusDay;
|
|
138
|
+
let next = null;
|
|
139
|
+
switch (e.key) {
|
|
140
|
+
case "ArrowLeft":
|
|
141
|
+
next = addDays(from, -1);
|
|
142
|
+
break;
|
|
143
|
+
case "ArrowRight":
|
|
144
|
+
next = addDays(from, 1);
|
|
145
|
+
break;
|
|
146
|
+
case "ArrowUp":
|
|
147
|
+
next = addDays(from, -7);
|
|
148
|
+
break;
|
|
149
|
+
case "ArrowDown":
|
|
150
|
+
next = addDays(from, 7);
|
|
151
|
+
break;
|
|
152
|
+
case "Home":
|
|
153
|
+
next = addDays(from, -from.getDay());
|
|
154
|
+
break;
|
|
155
|
+
case "End":
|
|
156
|
+
next = addDays(from, 6 - from.getDay());
|
|
157
|
+
break;
|
|
158
|
+
case "PageUp":
|
|
159
|
+
case "PageDown": {
|
|
160
|
+
const dir = e.key === "PageUp" ? -1 : 1;
|
|
161
|
+
const t2 = e.shiftKey ? new Date(from.getFullYear() + dir, from.getMonth(), 1) : new Date(from.getFullYear(), from.getMonth() + dir, 1);
|
|
162
|
+
const last = new Date(t2.getFullYear(), t2.getMonth() + 1, 0).getDate();
|
|
163
|
+
next = new Date(t2.getFullYear(), t2.getMonth(), Math.min(from.getDate(), last));
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (!next) return;
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
moveFocus(next);
|
|
170
|
+
}
|
|
171
|
+
const today = /* @__PURE__ */ new Date();
|
|
172
|
+
const firstDow = new Date(view.getFullYear(), view.getMonth(), 1).getDay();
|
|
173
|
+
const daysInMonth = new Date(view.getFullYear(), view.getMonth() + 1, 0).getDate();
|
|
174
|
+
const cells = [
|
|
175
|
+
...Array.from({ length: firstDow }, () => null),
|
|
176
|
+
...Array.from(
|
|
177
|
+
{ length: daysInMonth },
|
|
178
|
+
(_, i) => new Date(view.getFullYear(), view.getMonth(), i + 1)
|
|
179
|
+
)
|
|
180
|
+
];
|
|
181
|
+
while (cells.length % 7 !== 0) cells.push(null);
|
|
182
|
+
const weeks = Array.from({ length: cells.length / 7 }, (_, w) => cells.slice(w * 7, w * 7 + 7));
|
|
183
|
+
const focusInView = focusDay.getFullYear() === view.getFullYear() && focusDay.getMonth() === view.getMonth();
|
|
184
|
+
const tabbable = focusInView ? focusDay.getDate() : 1;
|
|
185
|
+
const fieldStyle = {
|
|
186
|
+
background: "var(--dp-field)",
|
|
187
|
+
border: tokens?.border ? "1px solid var(--dp-border)" : "1px solid rgb(var(--border-control))",
|
|
188
|
+
borderRadius: "var(--dp-radius)",
|
|
189
|
+
color: "var(--dp-fg)"
|
|
190
|
+
};
|
|
191
|
+
return /* @__PURE__ */ jsxs(PopoverPrimitive.Root, { open, onOpenChange, children: [
|
|
192
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Anchor, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
style: {
|
|
196
|
+
...vars,
|
|
197
|
+
background: "var(--dp-field)",
|
|
198
|
+
// Field boundary uses the 3:1 control token unless the caller overrides `border`.
|
|
199
|
+
border: tokens?.border ? "1px solid var(--dp-border)" : "1px solid rgb(var(--border-control))",
|
|
200
|
+
borderRadius: "var(--dp-radius)",
|
|
201
|
+
fontFamily: "var(--dp-font)",
|
|
202
|
+
color: "var(--dp-fg)"
|
|
203
|
+
},
|
|
204
|
+
className: `focus-ring-within flex w-full items-center gap-1 px-3 py-2 text-sm ${className}`,
|
|
205
|
+
children: [
|
|
206
|
+
/* @__PURE__ */ jsx(
|
|
207
|
+
"input",
|
|
208
|
+
{
|
|
209
|
+
id,
|
|
210
|
+
value: draft ?? label,
|
|
211
|
+
onChange: (e) => {
|
|
212
|
+
setDraft(e.target.value);
|
|
213
|
+
setInvalid(false);
|
|
214
|
+
},
|
|
215
|
+
onFocus: () => setDraft(label),
|
|
216
|
+
onBlur: commitDraft,
|
|
217
|
+
onKeyDown: (e) => {
|
|
218
|
+
if (e.key === "Enter") {
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
commitDraft();
|
|
221
|
+
e.target.blur();
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
className: "-my-2 w-full bg-transparent py-2 outline-none",
|
|
225
|
+
style: { color: "var(--dp-fg)" },
|
|
226
|
+
"aria-label": ariaLabelledBy ? void 0 : ariaLabel ?? "Date",
|
|
227
|
+
"aria-labelledby": ariaLabelledBy,
|
|
228
|
+
"aria-describedby": ariaDescribedBy,
|
|
229
|
+
"aria-invalid": invalid || ariaInvalid === true || ariaInvalid === "true" || void 0,
|
|
230
|
+
"aria-required": ariaRequired === true || ariaRequired === "true" || void 0
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
234
|
+
"button",
|
|
235
|
+
{
|
|
236
|
+
type: "button",
|
|
237
|
+
"aria-label": "Choose date",
|
|
238
|
+
className: "-m-1.5 shrink-0 rounded-[var(--radius-lg)] p-1.5",
|
|
239
|
+
style: { color: "var(--dp-fg-muted)" },
|
|
240
|
+
children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", className: "h-4 w-4", "aria-hidden": "true", children: [
|
|
241
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "4.5", width: "18", height: "17", rx: "2.5", stroke: "currentColor", strokeWidth: "1.6" }),
|
|
242
|
+
/* @__PURE__ */ jsx("path", { d: "M3 9h18M8 2.5v4M16 2.5v4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
|
|
243
|
+
] })
|
|
244
|
+
}
|
|
245
|
+
) })
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
) }),
|
|
249
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
250
|
+
PopoverPrimitive.Content,
|
|
251
|
+
{
|
|
252
|
+
"data-panel": true,
|
|
253
|
+
align: "start",
|
|
254
|
+
sideOffset: 6,
|
|
255
|
+
collisionPadding: 8,
|
|
256
|
+
"aria-labelledby": monthId,
|
|
257
|
+
onOpenAutoFocus: (e) => {
|
|
258
|
+
e.preventDefault();
|
|
259
|
+
gridRef.current?.querySelector('[tabindex="0"]')?.focus();
|
|
260
|
+
},
|
|
261
|
+
style: {
|
|
262
|
+
...vars,
|
|
263
|
+
width: POP_W,
|
|
264
|
+
borderRadius: "var(--dp-popup-radius)",
|
|
265
|
+
fontFamily: "var(--dp-font)",
|
|
266
|
+
color: "var(--dp-fg)"
|
|
267
|
+
},
|
|
268
|
+
className: "animate-rise z-[var(--z-floating)] p-3 shadow-panel border border-hairline",
|
|
269
|
+
children: [
|
|
270
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
271
|
+
/* @__PURE__ */ jsx(
|
|
272
|
+
"button",
|
|
273
|
+
{
|
|
274
|
+
type: "button",
|
|
275
|
+
"aria-label": "Previous month",
|
|
276
|
+
onClick: () => setView(new Date(view.getFullYear(), view.getMonth() - 1, 1)),
|
|
277
|
+
className: "flex h-7 w-7 items-center justify-center rounded-[var(--radius-lg)]",
|
|
278
|
+
style: { color: "var(--dp-fg-muted)" },
|
|
279
|
+
children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u2039" })
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
/* @__PURE__ */ jsx("span", { id: monthId, className: "text-sm font-medium", "aria-live": "polite", children: view.toLocaleString(dateLocale, { month: "long", year: "numeric" }) }),
|
|
283
|
+
/* @__PURE__ */ jsx(
|
|
284
|
+
"button",
|
|
285
|
+
{
|
|
286
|
+
type: "button",
|
|
287
|
+
"aria-label": "Next month",
|
|
288
|
+
onClick: () => setView(new Date(view.getFullYear(), view.getMonth() + 1, 1)),
|
|
289
|
+
className: "flex h-7 w-7 items-center justify-center rounded-[var(--radius-lg)]",
|
|
290
|
+
style: { color: "var(--dp-fg-muted)" },
|
|
291
|
+
children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u203A" })
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
] }),
|
|
295
|
+
/* @__PURE__ */ jsxs("div", { ref: gridRef, role: "grid", "aria-labelledby": monthId, onKeyDown: onGridKeyDown, className: "flex flex-col gap-0.5", children: [
|
|
296
|
+
/* @__PURE__ */ jsx("div", { role: "row", className: "grid grid-cols-7 gap-0.5 text-center", children: WEEKDAYS.map(([short, long]) => /* @__PURE__ */ jsx(
|
|
297
|
+
"div",
|
|
298
|
+
{
|
|
299
|
+
role: "columnheader",
|
|
300
|
+
"aria-label": long,
|
|
301
|
+
className: "py-1 text-xs font-medium",
|
|
302
|
+
style: { color: "var(--dp-fg-subtle)" },
|
|
303
|
+
children: short
|
|
304
|
+
},
|
|
305
|
+
long
|
|
306
|
+
)) }),
|
|
307
|
+
weeks.map((week, w) => /* @__PURE__ */ jsx("div", { role: "row", className: "grid grid-cols-7 gap-0.5 text-center", children: week.map((d, i) => {
|
|
308
|
+
if (d === null) return /* @__PURE__ */ jsx("div", { role: "gridcell", className: "aspect-square" }, `b${i}`);
|
|
309
|
+
const selected = sameDay(d, value);
|
|
310
|
+
const isToday = sameDay(d, today);
|
|
311
|
+
return /* @__PURE__ */ jsx("div", { role: "gridcell", "aria-selected": selected, children: /* @__PURE__ */ jsx(
|
|
312
|
+
"button",
|
|
313
|
+
{
|
|
314
|
+
type: "button",
|
|
315
|
+
tabIndex: d.getDate() === tabbable ? 0 : -1,
|
|
316
|
+
"aria-current": isToday ? "date" : void 0,
|
|
317
|
+
"aria-label": d.toLocaleDateString(dateLocale, { weekday: "long", month: "long", day: "numeric", year: "numeric" }),
|
|
318
|
+
onClick: () => pickDay(d),
|
|
319
|
+
onFocus: () => setFocusDay(d),
|
|
320
|
+
className: `aspect-square w-full text-xs transition ${selected ? "" : "hover:bg-[var(--dp-hover)]"}`,
|
|
321
|
+
style: {
|
|
322
|
+
borderRadius: "var(--dp-cell-radius)",
|
|
323
|
+
...selected ? {
|
|
324
|
+
background: "var(--dp-brand-solid)",
|
|
325
|
+
color: "var(--dp-brand-fg)",
|
|
326
|
+
fontWeight: 600
|
|
327
|
+
} : isToday ? {
|
|
328
|
+
color: "var(--dp-brand)",
|
|
329
|
+
fontWeight: 600,
|
|
330
|
+
boxShadow: "inset 0 0 0 1.5px color-mix(in srgb, var(--dp-brand) 45%, transparent)"
|
|
331
|
+
} : { color: "var(--dp-fg)" }
|
|
332
|
+
},
|
|
333
|
+
children: d.getDate()
|
|
334
|
+
}
|
|
335
|
+
) }, d.toISOString());
|
|
336
|
+
}) }, w))
|
|
337
|
+
] }),
|
|
338
|
+
!dateOnly && /* @__PURE__ */ jsxs(
|
|
339
|
+
"div",
|
|
340
|
+
{
|
|
341
|
+
role: "group",
|
|
342
|
+
"aria-label": "Time",
|
|
343
|
+
className: "mt-3 flex items-center gap-2 pt-3",
|
|
344
|
+
style: { borderTop: "1px solid var(--dp-border)" },
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-xs", style: { color: "var(--dp-fg-muted)" }, children: "Time" }),
|
|
347
|
+
/* @__PURE__ */ jsx(
|
|
348
|
+
"input",
|
|
349
|
+
{
|
|
350
|
+
type: "number",
|
|
351
|
+
min: 0,
|
|
352
|
+
max: 23,
|
|
353
|
+
"aria-label": "Hours",
|
|
354
|
+
value: value.getHours(),
|
|
355
|
+
onChange: (e) => setTime(Number(e.target.value || 0), value.getMinutes()),
|
|
356
|
+
className: "w-14 px-2 py-1 text-sm",
|
|
357
|
+
style: fieldStyle
|
|
358
|
+
}
|
|
359
|
+
),
|
|
360
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { color: "var(--dp-fg-muted)" }, children: ":" }),
|
|
361
|
+
/* @__PURE__ */ jsx(
|
|
362
|
+
"input",
|
|
363
|
+
{
|
|
364
|
+
type: "number",
|
|
365
|
+
min: 0,
|
|
366
|
+
max: 59,
|
|
367
|
+
step: 5,
|
|
368
|
+
"aria-label": "Minutes",
|
|
369
|
+
value: value.getMinutes(),
|
|
370
|
+
onChange: (e) => setTime(value.getHours(), Number(e.target.value || 0)),
|
|
371
|
+
className: "w-14 px-2 py-1 text-sm",
|
|
372
|
+
style: fieldStyle
|
|
373
|
+
}
|
|
374
|
+
),
|
|
375
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
376
|
+
"button",
|
|
377
|
+
{
|
|
378
|
+
type: "button",
|
|
379
|
+
className: "ml-auto px-3 py-1 text-xs font-medium",
|
|
380
|
+
style: {
|
|
381
|
+
background: "var(--dp-brand-solid)",
|
|
382
|
+
color: "var(--dp-brand-fg)",
|
|
383
|
+
borderRadius: "var(--dp-cell-radius)"
|
|
384
|
+
},
|
|
385
|
+
children: "Done"
|
|
386
|
+
}
|
|
387
|
+
) })
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
)
|
|
391
|
+
]
|
|
392
|
+
}
|
|
393
|
+
) })
|
|
394
|
+
] });
|
|
395
|
+
}
|
|
396
|
+
export {
|
|
397
|
+
DatePicker
|
|
398
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "Dialog",
|
|
3
|
+
description: "Modal dialog on Radix Dialog: a titled panel with body and footer slots, focus trapping, Escape and backdrop dismiss, and entry/exit animation.",
|
|
4
|
+
features: [
|
|
5
|
+
"Open it from a trigger (`trigger`), control it (`open` + `onOpenChange`), or render it to show it (`onClose` fires after the exit animation)",
|
|
6
|
+
"Sizes: sm (384px), md (448px), lg (672px)",
|
|
7
|
+
"title and description accept any node; DialogClose closes it from a footer button",
|
|
8
|
+
"layout: default (left title row + close button, hairlines), centered (centred title and description, no hairlines, footer centred) or bare (title above content, no header row). divided turns the hairlines on or off; footerAlign sets start/center/end/between/stretch",
|
|
9
|
+
"Pick the layout from the moment: forms and settings use default; invites, success and confirmations use centered; pickers and composers that lead with their content use bare divided={false}",
|
|
10
|
+
"dismissible={false} keeps backdrop clicks from closing it"
|
|
11
|
+
],
|
|
12
|
+
accessibility: [
|
|
13
|
+
"Radix Dialog: focus is trapped inside while open and returns to the trigger on close; the page behind is inert and does not scroll",
|
|
14
|
+
"title names the dialog and description describes it (role=dialog, aria-labelledby, aria-describedby)",
|
|
15
|
+
'The close button is labelled "Close"'
|
|
16
|
+
],
|
|
17
|
+
keyboard: "Escape closes the dialog. Tab and Shift+Tab move focus within it.",
|
|
18
|
+
usage: {
|
|
19
|
+
bestPractices: [
|
|
20
|
+
{
|
|
21
|
+
guidance: true,
|
|
22
|
+
description: "Give every dialog a clear title and one primary action in the footer."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
guidance: true,
|
|
26
|
+
description: "Build bigger flows (settings, profile, onboarding) by composing Dialog with Tabs, forms and Grid inside the body."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
guidance: false,
|
|
30
|
+
description: "Do not use Dialog for confirmations of destructive actions; use AlertDialog, which requires an explicit choice."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
guidance: false,
|
|
34
|
+
description: "Do not use Dialog for quick non-blocking notifications \u2014 reach for Toast instead."
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
examples: [
|
|
39
|
+
{
|
|
40
|
+
title: "Centered, no dividers",
|
|
41
|
+
description: "For a short moment with one decision. Stretch the footer so the buttons fill the row.",
|
|
42
|
+
code: `<Dialog
|
|
43
|
+
open={open}
|
|
44
|
+
onOpenChange={setOpen}
|
|
45
|
+
layout="centered"
|
|
46
|
+
title="Invite your team"
|
|
47
|
+
description="Teammates get edit access to this workspace."
|
|
48
|
+
footerAlign="stretch"
|
|
49
|
+
footer={
|
|
50
|
+
<>
|
|
51
|
+
<Button variant="outline" onClick={() => setOpen(false)}>Not now</Button>
|
|
52
|
+
<Button onClick={() => setOpen(false)}>Send invites</Button>
|
|
53
|
+
</>
|
|
54
|
+
}
|
|
55
|
+
/>`
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: "Bare form",
|
|
59
|
+
description: "No header row or hairlines; the form leads, the footer sits below it.",
|
|
60
|
+
code: `<Dialog open={open} onOpenChange={setOpen} layout="bare" size="md" title="New project" footer={<Button>Create</Button>}>
|
|
61
|
+
<TextField label="Project name" />
|
|
62
|
+
</Dialog>`
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: "Opened from a trigger",
|
|
66
|
+
code: `<Dialog
|
|
67
|
+
trigger={<Button>Export data</Button>}
|
|
68
|
+
title="Export data"
|
|
69
|
+
description="Download every project as a CSV file."
|
|
70
|
+
footer={
|
|
71
|
+
<DialogClose asChild>
|
|
72
|
+
<Button>Export</Button>
|
|
73
|
+
</DialogClose>
|
|
74
|
+
}
|
|
75
|
+
/>`
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: "Controlled",
|
|
79
|
+
description: "Keep the open state yourself when something else needs to open or close the dialog.",
|
|
80
|
+
code: `function RenameProject() {
|
|
81
|
+
const [open, setOpen] = useState(false);
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
<Button variant="soft" onClick={() => setOpen(true)}>Rename project</Button>
|
|
85
|
+
<Dialog
|
|
86
|
+
open={open}
|
|
87
|
+
onOpenChange={setOpen}
|
|
88
|
+
size="md"
|
|
89
|
+
title="Rename project"
|
|
90
|
+
footer={
|
|
91
|
+
<>
|
|
92
|
+
<Button variant="ghost" onClick={() => setOpen(false)}>Cancel</Button>
|
|
93
|
+
<Button onClick={() => setOpen(false)}>Save</Button>
|
|
94
|
+
</>
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
<TextField label="Project name" defaultValue="Website redesign" />
|
|
98
|
+
</Dialog>
|
|
99
|
+
</>
|
|
100
|
+
);
|
|
101
|
+
}`
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
docs
|
|
107
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import * as RadixDialog from "@radix-ui/react-dialog";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "../../lib/cn.js";
|
|
7
|
+
import { useReturnFocus } from "../../lib/useReturnFocus.js";
|
|
8
|
+
const modalPanelVariants = cva(
|
|
9
|
+
"animate-modal-in w-full overflow-hidden rounded-[var(--radius-panel)] border border-hairline shadow-modal focus:outline-none",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
sm: "max-w-sm",
|
|
14
|
+
md: "max-w-md",
|
|
15
|
+
lg: "max-w-2xl"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: { size: "sm" }
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
const panelVariants = modalPanelVariants;
|
|
22
|
+
const footerAlignClass = {
|
|
23
|
+
start: "justify-start",
|
|
24
|
+
center: "justify-center",
|
|
25
|
+
end: "justify-end",
|
|
26
|
+
between: "justify-between",
|
|
27
|
+
stretch: "[&>*]:flex-1"
|
|
28
|
+
};
|
|
29
|
+
function Dialog({
|
|
30
|
+
title,
|
|
31
|
+
description,
|
|
32
|
+
open: openProp,
|
|
33
|
+
defaultOpen,
|
|
34
|
+
onOpenChange,
|
|
35
|
+
trigger,
|
|
36
|
+
onClose,
|
|
37
|
+
children,
|
|
38
|
+
footer,
|
|
39
|
+
size,
|
|
40
|
+
dismissible = true,
|
|
41
|
+
layout = "default",
|
|
42
|
+
divided,
|
|
43
|
+
footerAlign = "end"
|
|
44
|
+
}) {
|
|
45
|
+
const hasRules = divided ?? layout === "default";
|
|
46
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen ?? !trigger);
|
|
47
|
+
const controlled = openProp !== void 0;
|
|
48
|
+
const open = controlled ? openProp : uncontrolledOpen;
|
|
49
|
+
const setOpen = useCallback(
|
|
50
|
+
(next) => {
|
|
51
|
+
if (!controlled) setUncontrolledOpen(next);
|
|
52
|
+
onOpenChange?.(next);
|
|
53
|
+
},
|
|
54
|
+
[controlled, onOpenChange]
|
|
55
|
+
);
|
|
56
|
+
const close = useCallback(() => setOpen(false), [setOpen]);
|
|
57
|
+
const returnFocus = useReturnFocus(open, Boolean(trigger));
|
|
58
|
+
const desc = description;
|
|
59
|
+
return /* @__PURE__ */ jsxs(RadixDialog.Root, { open, onOpenChange: setOpen, children: [
|
|
60
|
+
trigger && /* @__PURE__ */ jsx(RadixDialog.Trigger, { asChild: true, children: trigger }),
|
|
61
|
+
/* @__PURE__ */ jsxs(RadixDialog.Portal, { children: [
|
|
62
|
+
/* @__PURE__ */ jsx(RadixDialog.Overlay, { className: "animate-overlay fixed inset-0 z-[80]" }),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
RadixDialog.Content,
|
|
65
|
+
{
|
|
66
|
+
className: "animate-modal-wrap fixed inset-0 z-[80] flex items-center justify-center p-4",
|
|
67
|
+
...desc ? {} : { "aria-describedby": void 0 },
|
|
68
|
+
onPointerDownOutside: (e) => !dismissible && e.preventDefault(),
|
|
69
|
+
onCloseAutoFocus: returnFocus,
|
|
70
|
+
onClick: (e) => {
|
|
71
|
+
if (dismissible && e.target === e.currentTarget) close();
|
|
72
|
+
},
|
|
73
|
+
onAnimationEnd: (e) => {
|
|
74
|
+
if (!open && e.target === e.currentTarget) onClose?.();
|
|
75
|
+
},
|
|
76
|
+
children: /* @__PURE__ */ jsxs("div", { "data-panel": true, className: panelVariants({ size }), children: [
|
|
77
|
+
layout === "default" ? /* @__PURE__ */ jsxs("div", { className: cn("flex items-start gap-3 px-5 py-4", hasRules && "border-b border-hairline"), children: [
|
|
78
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
79
|
+
/* @__PURE__ */ jsx(RadixDialog.Title, { className: "font-subheading text-lg font-semibold tracking-tight", children: title }),
|
|
80
|
+
desc && /* @__PURE__ */ jsx(RadixDialog.Description, { className: "mt-0.5 text-sm text-fg-muted", children: desc })
|
|
81
|
+
] }),
|
|
82
|
+
/* @__PURE__ */ jsx(CloseButton, { onClose: close, className: "-mr-1.5 -mt-0.5" })
|
|
83
|
+
] }) : /* @__PURE__ */ jsxs(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
className: cn(
|
|
87
|
+
"relative px-6 pt-6",
|
|
88
|
+
layout === "centered" && "text-center",
|
|
89
|
+
hasRules && "border-b border-hairline pb-4",
|
|
90
|
+
!children && !hasRules && "pb-2"
|
|
91
|
+
),
|
|
92
|
+
children: [
|
|
93
|
+
layout === "bare" && /* @__PURE__ */ jsx(CloseButton, { onClose: close, className: "absolute right-4 top-4" }),
|
|
94
|
+
/* @__PURE__ */ jsx(RadixDialog.Title, { className: cn("font-subheading text-lg font-semibold tracking-tight", layout === "bare" && "pr-8"), children: title }),
|
|
95
|
+
desc && /* @__PURE__ */ jsx(RadixDialog.Description, { className: "mt-1 text-sm text-fg-muted", children: desc })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
children && /* @__PURE__ */ jsx("div", { className: layout === "default" ? "p-5" : cn("px-6 pb-2", hasRules ? "py-5" : "pt-4"), children }),
|
|
100
|
+
footer && /* @__PURE__ */ jsx(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
className: cn(
|
|
104
|
+
"flex gap-2",
|
|
105
|
+
layout === "default" ? "px-5 py-3" : "px-6 pb-6 pt-4",
|
|
106
|
+
hasRules && "border-t border-hairline",
|
|
107
|
+
hasRules && layout !== "default" && "pt-4",
|
|
108
|
+
layout === "centered" && footerAlign === "end" ? footerAlignClass.center : footerAlignClass[footerAlign]
|
|
109
|
+
),
|
|
110
|
+
children: footer
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] })
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] })
|
|
117
|
+
] });
|
|
118
|
+
}
|
|
119
|
+
const DialogClose = RadixDialog.Close;
|
|
120
|
+
function CloseButton({
|
|
121
|
+
onClose,
|
|
122
|
+
className
|
|
123
|
+
}) {
|
|
124
|
+
return /* @__PURE__ */ jsx(
|
|
125
|
+
"button",
|
|
126
|
+
{
|
|
127
|
+
type: "button",
|
|
128
|
+
onClick: onClose,
|
|
129
|
+
"aria-label": "Close",
|
|
130
|
+
className: cn(
|
|
131
|
+
"shrink-0 rounded-[var(--radius-lg)] p-1.5 text-fg-muted transition hover:bg-surface-hover hover:text-fg active:scale-[0.97]",
|
|
132
|
+
className
|
|
133
|
+
),
|
|
134
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", className: "h-4 w-4", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M6 6l12 12M18 6 6 18", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" }) })
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
CloseButton,
|
|
140
|
+
Dialog,
|
|
141
|
+
DialogClose,
|
|
142
|
+
modalPanelVariants
|
|
143
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const docs = {
|
|
2
|
+
name: "DonutChart",
|
|
3
|
+
description: "A share-of-total ring with a centre readout and a legend with each slice's count and percentage.",
|
|
4
|
+
features: [
|
|
5
|
+
"Hover a slice or legend row to read its share in the centre",
|
|
6
|
+
"size and thickness in px; centerLabel and centerValue",
|
|
7
|
+
"Slice colours from tone or colour, otherwise a theme palette"
|
|
8
|
+
],
|
|
9
|
+
accessibility: ["The chart has role=img with a label; keep the surrounding heading and values in text", "Colour is never the only signal: legends, labels and tooltips carry names and values"],
|
|
10
|
+
keyboard: "Hover to inspect values.",
|
|
11
|
+
usage: {
|
|
12
|
+
bestPractices: [
|
|
13
|
+
{ guidance: true, description: "Use a DonutChart for up to six parts of one whole. For more, use a horizontal BarChart." },
|
|
14
|
+
{ guidance: false, description: "Do not pass pre-formatted strings as values; keep numbers raw and format with yFormat." }
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
examples: [
|
|
18
|
+
{
|
|
19
|
+
"title": "Plan mix",
|
|
20
|
+
"code": '<DonutChart centerLabel="Accounts" data={[{ label: "Free", value: 640 }, { label: "Team", value: 210, tone: "success" }]} />'
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
docs
|
|
26
|
+
};
|