rift-ds 1.0.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/LICENSE +21 -0
- package/README.md +107 -0
- package/behaviors/focusable.d.ts +26 -0
- package/behaviors/focusable.js +18 -0
- package/behaviors/useFocusScope.d.ts +38 -0
- package/behaviors/useFocusScope.js +82 -0
- package/behaviors/useLayer.d.ts +43 -0
- package/behaviors/useLayer.js +55 -0
- package/behaviors/useMounted.d.ts +7 -0
- package/behaviors/useMounted.js +14 -0
- package/behaviors/useScrollLock.d.ts +55 -0
- package/behaviors/useScrollLock.js +59 -0
- package/bin/rift-ds.mjs +82 -0
- package/charts.d.ts +16 -0
- package/charts.js +24 -0
- package/components/Accordion/Accordion.css +119 -0
- package/components/Accordion/Accordion.d.ts +24 -0
- package/components/Accordion/Accordion.js +76 -0
- package/components/AgentPlan/AgentPlan.css +251 -0
- package/components/AgentPlan/AgentPlan.d.ts +41 -0
- package/components/AgentPlan/AgentPlan.js +100 -0
- package/components/AgentRail/AgentRail.css +282 -0
- package/components/AgentRail/AgentRail.d.ts +72 -0
- package/components/AgentRail/AgentRail.js +101 -0
- package/components/AgentStatus/AgentStatus.css +511 -0
- package/components/AgentStatus/AgentStatus.d.ts +41 -0
- package/components/AgentStatus/AgentStatus.js +86 -0
- package/components/AgentStatus/AgentStatusPatterns.d.ts +17 -0
- package/components/AgentStatus/AgentStatusPatterns.js +20 -0
- package/components/AiButton/AiButton.css +559 -0
- package/components/AiButton/AiButton.d.ts +79 -0
- package/components/AiButton/AiButton.js +183 -0
- package/components/Alert/Alert.css +261 -0
- package/components/Alert/Alert.d.ts +25 -0
- package/components/Alert/Alert.js +53 -0
- package/components/AlertDialog/AlertDialog.css +133 -0
- package/components/AlertDialog/AlertDialog.d.ts +29 -0
- package/components/AlertDialog/AlertDialog.js +98 -0
- package/components/AnchorNav/AnchorNav.css +137 -0
- package/components/AnchorNav/AnchorNav.d.ts +40 -0
- package/components/AnchorNav/AnchorNav.js +135 -0
- package/components/AnimatedNumber/AnimatedNumber.css +31 -0
- package/components/AnimatedNumber/AnimatedNumber.d.ts +36 -0
- package/components/AnimatedNumber/AnimatedNumber.js +55 -0
- package/components/AppLayout/AppLayout.css +52 -0
- package/components/AppLayout/AppLayout.d.ts +33 -0
- package/components/AppLayout/AppLayout.js +47 -0
- package/components/AppSidebar/AppSidebar.css +592 -0
- package/components/AppSidebar/AppSidebar.d.ts +90 -0
- package/components/AppSidebar/AppSidebar.js +295 -0
- package/components/Avatar/Avatar.css +133 -0
- package/components/Avatar/Avatar.d.ts +20 -0
- package/components/Avatar/Avatar.js +58 -0
- package/components/Avatar/demoAvatars.d.ts +18 -0
- package/components/Avatar/demoAvatars.js +16 -0
- package/components/AvatarGroup/AvatarGroup.css +61 -0
- package/components/AvatarGroup/AvatarGroup.d.ts +32 -0
- package/components/AvatarGroup/AvatarGroup.js +31 -0
- package/components/Badge/Badge.css +67 -0
- package/components/Badge/Badge.d.ts +13 -0
- package/components/Badge/Badge.js +15 -0
- package/components/Banner/Banner.css +110 -0
- package/components/Banner/Banner.d.ts +36 -0
- package/components/Banner/Banner.js +59 -0
- package/components/Breadcrumb/Breadcrumb.css +100 -0
- package/components/Breadcrumb/Breadcrumb.d.ts +25 -0
- package/components/Breadcrumb/Breadcrumb.js +40 -0
- package/components/Button/Button.css +473 -0
- package/components/Button/Button.d.ts +73 -0
- package/components/Button/Button.js +91 -0
- package/components/ButtonGroup/ButtonGroup.css +39 -0
- package/components/ButtonGroup/ButtonGroup.d.ts +13 -0
- package/components/ButtonGroup/ButtonGroup.js +30 -0
- package/components/Card/Card.css +190 -0
- package/components/Card/Card.d.ts +48 -0
- package/components/Card/Card.js +113 -0
- package/components/CardStack/CardStack.css +106 -0
- package/components/CardStack/CardStack.d.ts +44 -0
- package/components/CardStack/CardStack.js +140 -0
- package/components/Carousel/Carousel.css +121 -0
- package/components/Carousel/Carousel.d.ts +25 -0
- package/components/Carousel/Carousel.js +160 -0
- package/components/Chart/AreaChart.d.ts +40 -0
- package/components/Chart/AreaChart.js +101 -0
- package/components/Chart/BarChart.d.ts +36 -0
- package/components/Chart/BarChart.js +107 -0
- package/components/Chart/Chart.css +224 -0
- package/components/Chart/ComboChart.d.ts +40 -0
- package/components/Chart/ComboChart.js +142 -0
- package/components/Chart/LineChart.d.ts +36 -0
- package/components/Chart/LineChart.js +91 -0
- package/components/Chart/PieChart.d.ts +36 -0
- package/components/Chart/PieChart.js +93 -0
- package/components/Chart/RadarChart.d.ts +36 -0
- package/components/Chart/RadarChart.js +92 -0
- package/components/Chart/RadialChart.d.ts +43 -0
- package/components/Chart/RadialChart.js +114 -0
- package/components/Chart/ScatterChart.d.ts +38 -0
- package/components/Chart/ScatterChart.js +99 -0
- package/components/Chart/StackedBarChart.d.ts +36 -0
- package/components/Chart/StackedBarChart.js +98 -0
- package/components/Chart/Treemap.d.ts +35 -0
- package/components/Chart/Treemap.js +95 -0
- package/components/Chart/palette.d.ts +1 -0
- package/components/Chart/palette.js +17 -0
- package/components/ChatHeader/ChatHeader.css +35 -0
- package/components/ChatHeader/ChatHeader.d.ts +30 -0
- package/components/ChatHeader/ChatHeader.js +17 -0
- package/components/ChatMarker/ChatMarker.css +61 -0
- package/components/ChatMarker/ChatMarker.d.ts +22 -0
- package/components/ChatMarker/ChatMarker.js +18 -0
- package/components/ChatMessage/ChatMessage.css +326 -0
- package/components/ChatMessage/ChatMessage.d.ts +74 -0
- package/components/ChatMessage/ChatMessage.js +71 -0
- package/components/ChatThread/ChatThread.css +171 -0
- package/components/ChatThread/ChatThread.d.ts +41 -0
- package/components/ChatThread/ChatThread.js +175 -0
- package/components/Checkbox/Checkbox.css +183 -0
- package/components/Checkbox/Checkbox.d.ts +81 -0
- package/components/Checkbox/Checkbox.js +176 -0
- package/components/Chip/Chip.css +231 -0
- package/components/Chip/Chip.d.ts +27 -0
- package/components/Chip/Chip.js +80 -0
- package/components/CircularButton/CircularButton.css +263 -0
- package/components/CircularButton/CircularButton.d.ts +68 -0
- package/components/CircularButton/CircularButton.js +72 -0
- package/components/CodeBlock/CodeBlock.css +189 -0
- package/components/CodeBlock/CodeBlock.d.ts +23 -0
- package/components/CodeBlock/CodeBlock.js +96 -0
- package/components/CodeDiff/CodeDiff.css +175 -0
- package/components/CodeDiff/CodeDiff.d.ts +58 -0
- package/components/CodeDiff/CodeDiff.js +114 -0
- package/components/ColorPicker/ColorPicker.css +278 -0
- package/components/ColorPicker/ColorPicker.d.ts +50 -0
- package/components/ColorPicker/ColorPicker.js +349 -0
- package/components/ColourSwatch/ColourSwatch.css +88 -0
- package/components/ColourSwatch/ColourSwatch.d.ts +34 -0
- package/components/ColourSwatch/ColourSwatch.js +42 -0
- package/components/Combobox/Combobox.css +384 -0
- package/components/Combobox/Combobox.d.ts +93 -0
- package/components/Combobox/Combobox.js +331 -0
- package/components/CommandPalette/CommandPalette.css +342 -0
- package/components/CommandPalette/CommandPalette.d.ts +62 -0
- package/components/CommandPalette/CommandPalette.js +247 -0
- package/components/Composer/Composer.css +427 -0
- package/components/Composer/Composer.d.ts +97 -0
- package/components/Composer/Composer.js +146 -0
- package/components/ContactCard/ContactCard.css +132 -0
- package/components/ContactCard/ContactCard.d.ts +24 -0
- package/components/ContactCard/ContactCard.js +79 -0
- package/components/ContextMenu/ContextMenu.css +258 -0
- package/components/ContextMenu/ContextMenu.d.ts +26 -0
- package/components/ContextMenu/ContextMenu.js +387 -0
- package/components/ContributionGraph/ContributionGraph.css +169 -0
- package/components/ContributionGraph/ContributionGraph.d.ts +34 -0
- package/components/ContributionGraph/ContributionGraph.js +149 -0
- package/components/DataTable/DataTable.css +109 -0
- package/components/DataTable/DataTable.d.ts +81 -0
- package/components/DataTable/DataTable.js +236 -0
- package/components/DateInput/DateInput.css +127 -0
- package/components/DateInput/DateInput.d.ts +44 -0
- package/components/DateInput/DateInput.js +82 -0
- package/components/DatePicker/DatePicker.css +198 -0
- package/components/DatePicker/DatePicker.d.ts +29 -0
- package/components/DatePicker/DatePicker.js +196 -0
- package/components/Dialog/Dialog.css +178 -0
- package/components/Dialog/Dialog.d.ts +39 -0
- package/components/Dialog/Dialog.js +99 -0
- package/components/Divider/Divider.css +100 -0
- package/components/Divider/Divider.d.ts +18 -0
- package/components/Divider/Divider.js +31 -0
- package/components/DocumentChip/DocumentChip.css +190 -0
- package/components/DocumentChip/DocumentChip.d.ts +41 -0
- package/components/DocumentChip/DocumentChip.js +78 -0
- package/components/Drawer/Drawer.css +262 -0
- package/components/Drawer/Drawer.d.ts +41 -0
- package/components/Drawer/Drawer.js +101 -0
- package/components/Dropdown/Dropdown.css +288 -0
- package/components/Dropdown/Dropdown.d.ts +85 -0
- package/components/Dropdown/Dropdown.js +308 -0
- package/components/DropdownMenu/DropdownMenu.css +301 -0
- package/components/DropdownMenu/DropdownMenu.d.ts +42 -0
- package/components/DropdownMenu/DropdownMenu.js +371 -0
- package/components/EmptyState/EmptyState.css +136 -0
- package/components/EmptyState/EmptyState.d.ts +27 -0
- package/components/EmptyState/EmptyState.js +32 -0
- package/components/EntityCard/EntityCard.css +69 -0
- package/components/EntityCard/EntityCard.d.ts +19 -0
- package/components/EntityCard/EntityCard.js +26 -0
- package/components/EventCalendar/EventCalendar.css +363 -0
- package/components/EventCalendar/EventCalendar.d.ts +59 -0
- package/components/EventCalendar/EventCalendar.js +230 -0
- package/components/Field/Field.css +80 -0
- package/components/Field/Field.d.ts +57 -0
- package/components/Field/Field.js +70 -0
- package/components/Field/FieldContext.d.ts +42 -0
- package/components/Field/FieldContext.js +8 -0
- package/components/Figure/Figure.css +71 -0
- package/components/Figure/Figure.d.ts +17 -0
- package/components/Figure/Figure.js +26 -0
- package/components/FileInput/FileInput.css +281 -0
- package/components/FileInput/FileInput.d.ts +54 -0
- package/components/FileInput/FileInput.js +205 -0
- package/components/FilterBar/FilterBar.css +202 -0
- package/components/FilterBar/FilterBar.d.ts +55 -0
- package/components/FilterBar/FilterBar.js +249 -0
- package/components/FunnelChart/FunnelChart.css +17 -0
- package/components/FunnelChart/FunnelChart.d.ts +51 -0
- package/components/FunnelChart/FunnelChart.js +96 -0
- package/components/GanttChart/GanttChart.css +326 -0
- package/components/GanttChart/GanttChart.d.ts +82 -0
- package/components/GanttChart/GanttChart.js +202 -0
- package/components/Gauge/Gauge.css +120 -0
- package/components/Gauge/Gauge.d.ts +64 -0
- package/components/Gauge/Gauge.js +111 -0
- package/components/Globe/Globe.css +155 -0
- package/components/Globe/Globe.d.ts +103 -0
- package/components/Globe/Globe.js +416 -0
- package/components/HoverCard/HoverCard.css +125 -0
- package/components/HoverCard/HoverCard.d.ts +29 -0
- package/components/HoverCard/HoverCard.js +83 -0
- package/components/ImageCompare/ImageCompare.css +112 -0
- package/components/ImageCompare/ImageCompare.d.ts +40 -0
- package/components/ImageCompare/ImageCompare.js +134 -0
- package/components/Input/Input.css +150 -0
- package/components/Input/Input.d.ts +45 -0
- package/components/Input/Input.js +99 -0
- package/components/Instructions/Instructions.css +216 -0
- package/components/Instructions/Instructions.d.ts +29 -0
- package/components/Instructions/Instructions.js +32 -0
- package/components/InterruptCard/InterruptCard.css +164 -0
- package/components/InterruptCard/InterruptCard.d.ts +54 -0
- package/components/InterruptCard/InterruptCard.js +57 -0
- package/components/Kbd/Kbd.css +28 -0
- package/components/Kbd/Kbd.d.ts +19 -0
- package/components/Kbd/Kbd.js +14 -0
- package/components/LegendTile/LegendTile.css +60 -0
- package/components/LegendTile/LegendTile.d.ts +30 -0
- package/components/LegendTile/LegendTile.js +21 -0
- package/components/Lightbox/Lightbox.css +210 -0
- package/components/Lightbox/Lightbox.d.ts +45 -0
- package/components/Lightbox/Lightbox.js +109 -0
- package/components/LinkList/LinkList.css +71 -0
- package/components/LinkList/LinkList.d.ts +24 -0
- package/components/LinkList/LinkList.js +42 -0
- package/components/MapCallout/MapCallout.css +46 -0
- package/components/MapCallout/MapCallout.d.ts +29 -0
- package/components/MapCallout/MapCallout.js +17 -0
- package/components/MapLegend/MapLegend.css +88 -0
- package/components/MapLegend/MapLegend.d.ts +40 -0
- package/components/MapLegend/MapLegend.js +68 -0
- package/components/MessageActions/MessageActions.css +85 -0
- package/components/MessageActions/MessageActions.d.ts +38 -0
- package/components/MessageActions/MessageActions.js +40 -0
- package/components/MessageCard/MessageCard.css +163 -0
- package/components/MessageCard/MessageCard.d.ts +35 -0
- package/components/MessageCard/MessageCard.js +30 -0
- package/components/Meter/Meter.css +98 -0
- package/components/Meter/Meter.d.ts +36 -0
- package/components/Meter/Meter.js +48 -0
- package/components/ModelPicker/ModelPicker.css +243 -0
- package/components/ModelPicker/ModelPicker.d.ts +60 -0
- package/components/ModelPicker/ModelPicker.js +261 -0
- package/components/MotionSwatch/MotionSwatch.css +176 -0
- package/components/MotionSwatch/MotionSwatch.d.ts +25 -0
- package/components/MotionSwatch/MotionSwatch.js +74 -0
- package/components/Nav/Nav.css +51 -0
- package/components/Nav/Nav.d.ts +19 -0
- package/components/Nav/Nav.js +26 -0
- package/components/NavList/NavList.css +155 -0
- package/components/NavList/NavList.d.ts +56 -0
- package/components/NavList/NavList.js +100 -0
- package/components/NotificationCenter/NotificationCenter.css +279 -0
- package/components/NotificationCenter/NotificationCenter.d.ts +72 -0
- package/components/NotificationCenter/NotificationCenter.js +145 -0
- package/components/NumberInput/NumberInput.css +163 -0
- package/components/NumberInput/NumberInput.d.ts +44 -0
- package/components/NumberInput/NumberInput.js +147 -0
- package/components/Pagination/Pagination.css +126 -0
- package/components/Pagination/Pagination.d.ts +22 -0
- package/components/Pagination/Pagination.js +84 -0
- package/components/Panel/Panel.css +26 -0
- package/components/Panel/Panel.d.ts +22 -0
- package/components/Panel/Panel.js +19 -0
- package/components/PinInput/PinInput.css +92 -0
- package/components/PinInput/PinInput.d.ts +46 -0
- package/components/PinInput/PinInput.js +161 -0
- package/components/Popover/Popover.css +118 -0
- package/components/Popover/Popover.d.ts +22 -0
- package/components/Popover/Popover.js +113 -0
- package/components/ProgressBar/ProgressBar.css +60 -0
- package/components/ProgressBar/ProgressBar.d.ts +16 -0
- package/components/ProgressBar/ProgressBar.js +27 -0
- package/components/PromptSuggestions/PromptSuggestions.css +264 -0
- package/components/PromptSuggestions/PromptSuggestions.d.ts +68 -0
- package/components/PromptSuggestions/PromptSuggestions.js +87 -0
- package/components/Prose/Prose.css +269 -0
- package/components/Prose/Prose.d.ts +21 -0
- package/components/Prose/Prose.js +14 -0
- package/components/Quote/Quote.css +78 -0
- package/components/Quote/Quote.d.ts +18 -0
- package/components/Quote/Quote.js +26 -0
- package/components/RadioButton/RadioButton.css +151 -0
- package/components/RadioButton/RadioButton.d.ts +90 -0
- package/components/RadioButton/RadioButton.js +138 -0
- package/components/Rating/Rating.css +74 -0
- package/components/Rating/Rating.d.ts +41 -0
- package/components/Rating/Rating.js +124 -0
- package/components/Reasoning/Reasoning.css +291 -0
- package/components/Reasoning/Reasoning.d.ts +55 -0
- package/components/Reasoning/Reasoning.js +99 -0
- package/components/RichDropdown/RichDropdown.css +239 -0
- package/components/RichDropdown/RichDropdown.d.ts +78 -0
- package/components/RichDropdown/RichDropdown.js +227 -0
- package/components/SectionTitle/SectionTitle.css +45 -0
- package/components/SectionTitle/SectionTitle.d.ts +12 -0
- package/components/SectionTitle/SectionTitle.js +22 -0
- package/components/SegmentedControl/SegmentedControl.css +231 -0
- package/components/SegmentedControl/SegmentedControl.d.ts +44 -0
- package/components/SegmentedControl/SegmentedControl.js +240 -0
- package/components/SelectionCard/SelectionCard.css +255 -0
- package/components/SelectionCard/SelectionCard.d.ts +36 -0
- package/components/SelectionCard/SelectionCard.js +102 -0
- package/components/ShaderField/ShaderField.css +24 -0
- package/components/ShaderField/ShaderField.d.ts +68 -0
- package/components/ShaderField/ShaderField.js +55 -0
- package/components/ShaderField/field.glsl.d.ts +39 -0
- package/components/ShaderField/field.glsl.js +178 -0
- package/components/ShaderField/useShaderField.d.ts +103 -0
- package/components/ShaderField/useShaderField.js +410 -0
- package/components/Skeleton/Skeleton.css +81 -0
- package/components/Skeleton/Skeleton.d.ts +16 -0
- package/components/Skeleton/Skeleton.js +30 -0
- package/components/Slider/Slider.css +104 -0
- package/components/Slider/Slider.d.ts +48 -0
- package/components/Slider/Slider.js +86 -0
- package/components/SourceChip/SourceChip.css +111 -0
- package/components/SourceChip/SourceChip.d.ts +32 -0
- package/components/SourceChip/SourceChip.js +31 -0
- package/components/SourceTrail/SourceTrail.css +209 -0
- package/components/SourceTrail/SourceTrail.d.ts +49 -0
- package/components/SourceTrail/SourceTrail.js +108 -0
- package/components/SpacingSwatch/SpacingSwatch.css +108 -0
- package/components/SpacingSwatch/SpacingSwatch.d.ts +20 -0
- package/components/SpacingSwatch/SpacingSwatch.js +50 -0
- package/components/Sparkline/Sparkline.css +76 -0
- package/components/Sparkline/Sparkline.d.ts +51 -0
- package/components/Sparkline/Sparkline.js +116 -0
- package/components/Spinner/Spinner.css +84 -0
- package/components/Spinner/Spinner.d.ts +14 -0
- package/components/Spinner/Spinner.js +42 -0
- package/components/SplitButton/SplitButton.css +93 -0
- package/components/SplitButton/SplitButton.d.ts +43 -0
- package/components/SplitButton/SplitButton.js +67 -0
- package/components/SplitPane/SplitPane.css +106 -0
- package/components/SplitPane/SplitPane.d.ts +36 -0
- package/components/SplitPane/SplitPane.js +130 -0
- package/components/Stat/Stat.css +121 -0
- package/components/Stat/Stat.d.ts +22 -0
- package/components/Stat/Stat.js +36 -0
- package/components/StatusDot/StatusDot.css +104 -0
- package/components/StatusDot/StatusDot.d.ts +34 -0
- package/components/StatusDot/StatusDot.js +23 -0
- package/components/Stepper/Stepper.css +216 -0
- package/components/Stepper/Stepper.d.ts +41 -0
- package/components/Stepper/Stepper.js +61 -0
- package/components/StreamingText/StreamingText.css +40 -0
- package/components/StreamingText/StreamingText.d.ts +62 -0
- package/components/StreamingText/StreamingText.js +49 -0
- package/components/StreamingText/useStreamReveal.d.ts +70 -0
- package/components/StreamingText/useStreamReveal.js +121 -0
- package/components/Swatch/Swatch.css +52 -0
- package/components/Swatch/Swatch.d.ts +34 -0
- package/components/Swatch/Swatch.js +44 -0
- package/components/Table/Table.css +223 -0
- package/components/Table/Table.d.ts +53 -0
- package/components/Table/Table.js +65 -0
- package/components/Tabs/Tabs.css +140 -0
- package/components/Tabs/Tabs.d.ts +28 -0
- package/components/Tabs/Tabs.js +78 -0
- package/components/TagInput/TagInput.css +169 -0
- package/components/TagInput/TagInput.d.ts +43 -0
- package/components/TagInput/TagInput.js +137 -0
- package/components/Textarea/Textarea.css +109 -0
- package/components/Textarea/Textarea.d.ts +43 -0
- package/components/Textarea/Textarea.js +86 -0
- package/components/ThreadPanel/ThreadPanel.css +862 -0
- package/components/ThreadPanel/ThreadPanel.d.ts +175 -0
- package/components/ThreadPanel/ThreadPanel.js +466 -0
- package/components/ThreadTabs/ThreadTabs.css +252 -0
- package/components/ThreadTabs/ThreadTabs.d.ts +54 -0
- package/components/ThreadTabs/ThreadTabs.js +201 -0
- package/components/TimePicker/TimePicker.css +230 -0
- package/components/TimePicker/TimePicker.d.ts +46 -0
- package/components/TimePicker/TimePicker.js +250 -0
- package/components/Timeline/Timeline.css +366 -0
- package/components/Timeline/Timeline.d.ts +67 -0
- package/components/Timeline/Timeline.js +73 -0
- package/components/Toast/Toast.css +363 -0
- package/components/Toast/Toast.d.ts +63 -0
- package/components/Toast/Toast.js +215 -0
- package/components/ToggleGroup/ToggleGroup.css +110 -0
- package/components/ToggleGroup/ToggleGroup.d.ts +50 -0
- package/components/ToggleGroup/ToggleGroup.js +73 -0
- package/components/ToggleSwitch/ToggleSwitch.css +172 -0
- package/components/ToggleSwitch/ToggleSwitch.d.ts +43 -0
- package/components/ToggleSwitch/ToggleSwitch.js +76 -0
- package/components/ToolCall/ToolCall.css +234 -0
- package/components/ToolCall/ToolCall.d.ts +43 -0
- package/components/ToolCall/ToolCall.js +90 -0
- package/components/Toolbar/Toolbar.css +56 -0
- package/components/Toolbar/Toolbar.d.ts +35 -0
- package/components/Toolbar/Toolbar.js +62 -0
- package/components/Tooltip/Tooltip.css +175 -0
- package/components/Tooltip/Tooltip.d.ts +22 -0
- package/components/Tooltip/Tooltip.js +74 -0
- package/components/TreeView/TreeView.css +119 -0
- package/components/TreeView/TreeView.d.ts +45 -0
- package/components/TreeView/TreeView.js +232 -0
- package/components/TypographySwatch/TypographySwatch.css +81 -0
- package/components/TypographySwatch/TypographySwatch.d.ts +24 -0
- package/components/TypographySwatch/TypographySwatch.js +40 -0
- package/components/UsageCard/UsageCard.css +30 -0
- package/components/UsageCard/UsageCard.d.ts +48 -0
- package/components/UsageCard/UsageCard.js +54 -0
- package/components/Waveform/Waveform.css +97 -0
- package/components/Waveform/Waveform.d.ts +44 -0
- package/components/Waveform/Waveform.js +46 -0
- package/components/WorldMap/WorldMap.css +234 -0
- package/components/WorldMap/WorldMap.d.ts +113 -0
- package/components/WorldMap/WorldMap.js +427 -0
- package/components/WorldMap/land.d.ts +14 -0
- package/components/WorldMap/land.js +4 -0
- package/components/registry.d.ts +79 -0
- package/components/registry.js +13 -0
- package/components/registry.json +1153 -0
- package/components/registry.json.d.ts +1156 -0
- package/components/registry.json.js +11 -0
- package/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.woff2 +0 -0
- package/fonts/material-symbols.css +94 -0
- package/fonts/presets/dm-sans-300-700-latin-ext.woff2 +0 -0
- package/fonts/presets/dm-sans-300-700-latin.woff2 +0 -0
- package/fonts/presets/fraunces-300-700-latin-ext.woff2 +0 -0
- package/fonts/presets/fraunces-300-700-latin.woff2 +0 -0
- package/fonts/presets/ibm-plex-mono-300-latin-ext.woff2 +0 -0
- package/fonts/presets/ibm-plex-mono-300-latin.woff2 +0 -0
- package/fonts/presets/ibm-plex-mono-400-latin-ext.woff2 +0 -0
- package/fonts/presets/ibm-plex-mono-400-latin.woff2 +0 -0
- package/fonts/presets/ibm-plex-mono-500-latin-ext.woff2 +0 -0
- package/fonts/presets/ibm-plex-mono-500-latin.woff2 +0 -0
- package/fonts/presets/ibm-plex-mono-600-latin-ext.woff2 +0 -0
- package/fonts/presets/ibm-plex-mono-600-latin.woff2 +0 -0
- package/fonts/presets/ibm-plex-mono-700-latin-ext.woff2 +0 -0
- package/fonts/presets/ibm-plex-mono-700-latin.woff2 +0 -0
- package/fonts/presets/ibm-plex-sans-300-700-latin-ext.woff2 +0 -0
- package/fonts/presets/ibm-plex-sans-300-700-latin.woff2 +0 -0
- package/fonts/presets/inter-300-700-latin-ext.woff2 +0 -0
- package/fonts/presets/inter-300-700-latin.woff2 +0 -0
- package/fonts/presets/inter-tight-300-900-latin-ext.woff2 +0 -0
- package/fonts/presets/inter-tight-300-900-latin.woff2 +0 -0
- package/fonts/presets/lora-400-700-latin-ext.woff2 +0 -0
- package/fonts/presets/lora-400-700-latin.woff2 +0 -0
- package/fonts/presets/montserrat-300-700-latin-ext.woff2 +0 -0
- package/fonts/presets/montserrat-300-700-latin.woff2 +0 -0
- package/fonts/presets/poppins-300-latin-ext.woff2 +0 -0
- package/fonts/presets/poppins-300-latin.woff2 +0 -0
- package/fonts/presets/poppins-400-latin-ext.woff2 +0 -0
- package/fonts/presets/poppins-400-latin.woff2 +0 -0
- package/fonts/presets/poppins-500-latin-ext.woff2 +0 -0
- package/fonts/presets/poppins-500-latin.woff2 +0 -0
- package/fonts/presets/poppins-600-latin-ext.woff2 +0 -0
- package/fonts/presets/poppins-600-latin.woff2 +0 -0
- package/fonts/presets/poppins-700-latin-ext.woff2 +0 -0
- package/fonts/presets/poppins-700-latin.woff2 +0 -0
- package/fonts/presets/source-sans-3-300-700-latin-ext.woff2 +0 -0
- package/fonts/presets/source-sans-3-300-700-latin.woff2 +0 -0
- package/fonts/presets/space-grotesk-300-700-latin-ext.woff2 +0 -0
- package/fonts/presets/space-grotesk-300-700-latin.woff2 +0 -0
- package/fonts/presets/work-sans-300-700-latin-ext.woff2 +0 -0
- package/fonts/presets/work-sans-300-700-latin.woff2 +0 -0
- package/index.d.ts +132 -0
- package/index.js +277 -0
- package/package.json +87 -0
- package/tokens/motion.d.ts +44 -0
- package/tokens/motion.js +32 -0
- package/tokens/presets/contrast.css +316 -0
- package/tokens/presets/coral.css +356 -0
- package/tokens/presets/forest.css +334 -0
- package/tokens/presets/gold.css +303 -0
- package/tokens/presets/mono.css +286 -0
- package/tokens/presets/pink.css +349 -0
- package/tokens/presets/presets.css +17 -0
- package/tokens/presets/terminal.css +378 -0
- package/tokens/presets/violet.css +314 -0
- package/tokens/presets/warm.css +320 -0
- package/tokens/presets/zest.css +359 -0
- package/tokens/registry.d.ts +22 -0
- package/tokens/registry.js +14 -0
- package/tokens/registry.json +276 -0
- package/tokens/registry.json.d.ts +279 -0
- package/tokens/registry.json.js +8 -0
- package/tokens/tokens-dark.css +186 -0
- package/tokens/tokens-light.css +276 -0
- package/tokens/tokens-motion.css +72 -0
- package/tokens/tokens-primitives.css +213 -0
- package/tokens/tokens-typography.css +210 -0
- package/tokens/tokens.css +11 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/** A single step in a Stepper flow. */
|
|
3
|
+
export type StepperStep = {
|
|
4
|
+
/** Step label shown beside or below the indicator */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Optional supporting line rendered under the label */
|
|
7
|
+
description?: string;
|
|
8
|
+
};
|
|
9
|
+
/** Props owned by Stepper itself — everything else falls through to the `<ol>`. */
|
|
10
|
+
type StepperOwnProps = {
|
|
11
|
+
/** Ordered list of steps in the flow */
|
|
12
|
+
steps: StepperStep[];
|
|
13
|
+
/**
|
|
14
|
+
* Index of the active step. Steps before it render as complete (check
|
|
15
|
+
* icon), steps after it as upcoming (step number). Pass `steps.length`
|
|
16
|
+
* to mark the whole flow complete.
|
|
17
|
+
*/
|
|
18
|
+
activeStep: number;
|
|
19
|
+
/**
|
|
20
|
+
* Callback with the clicked step's index. When provided, completed steps
|
|
21
|
+
* and the active step become buttons so the reader can revisit an earlier
|
|
22
|
+
* stage; upcoming steps stay non-interactive either way.
|
|
23
|
+
*/
|
|
24
|
+
onStepClick?: (index: number) => void;
|
|
25
|
+
/** Layout direction */
|
|
26
|
+
orientation?: 'horizontal' | 'vertical';
|
|
27
|
+
/** Additional CSS classes */
|
|
28
|
+
className?: string;
|
|
29
|
+
};
|
|
30
|
+
export interface StepperProps extends StepperOwnProps, Omit<React.ComponentPropsWithoutRef<'ol'>, keyof StepperOwnProps> {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Stepper component — step-by-step progress indicator for wizards and
|
|
34
|
+
* multi-stage flows. Renders an ordered list of steps with CSS-drawn
|
|
35
|
+
* connectors: completed steps show a check, the active step carries
|
|
36
|
+
* `aria-current="step"`, and upcoming steps show their number.
|
|
37
|
+
*
|
|
38
|
+
* Forwards a ref to the `<ol>` and spreads unrecognised props onto it.
|
|
39
|
+
*/
|
|
40
|
+
export declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<HTMLOListElement>>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import "./Stepper.css";
|
|
5
|
+
import "../../fonts/material-symbols.css";
|
|
6
|
+
const Stepper = React.forwardRef(
|
|
7
|
+
({
|
|
8
|
+
steps,
|
|
9
|
+
activeStep,
|
|
10
|
+
onStepClick,
|
|
11
|
+
orientation = "horizontal",
|
|
12
|
+
className = "",
|
|
13
|
+
...rest
|
|
14
|
+
}, ref) => {
|
|
15
|
+
const baseClass = "ds-stepper";
|
|
16
|
+
const classes = [
|
|
17
|
+
baseClass,
|
|
18
|
+
orientation === "vertical" && `${baseClass}--vertical`,
|
|
19
|
+
className
|
|
20
|
+
].filter(Boolean).join(" ");
|
|
21
|
+
return /* @__PURE__ */ jsx("ol", { ...rest, ref, className: classes, children: steps.map((step, index) => {
|
|
22
|
+
const status = index < activeStep ? "complete" : index === activeStep ? "active" : "upcoming";
|
|
23
|
+
const interactive = Boolean(onStepClick) && status !== "upcoming";
|
|
24
|
+
const indicator = /* @__PURE__ */ jsx("span", { className: `${baseClass}__indicator`, "aria-hidden": "true", children: status === "complete" ? /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", children: "check" }) : index + 1 });
|
|
25
|
+
const text = /* @__PURE__ */ jsxs("span", { className: `${baseClass}__text`, children: [
|
|
26
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: step.label }),
|
|
27
|
+
step.description && /* @__PURE__ */ jsx("span", { className: `${baseClass}__description`, children: step.description })
|
|
28
|
+
] });
|
|
29
|
+
return /* @__PURE__ */ jsxs(
|
|
30
|
+
"li",
|
|
31
|
+
{
|
|
32
|
+
className: `${baseClass}__step ${baseClass}__step--${status}`,
|
|
33
|
+
"aria-current": status === "active" ? "step" : void 0,
|
|
34
|
+
children: [
|
|
35
|
+
interactive ? /* @__PURE__ */ jsxs(
|
|
36
|
+
"button",
|
|
37
|
+
{
|
|
38
|
+
type: "button",
|
|
39
|
+
className: `${baseClass}__content`,
|
|
40
|
+
onClick: () => onStepClick?.(index),
|
|
41
|
+
children: [
|
|
42
|
+
indicator,
|
|
43
|
+
text
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
) : /* @__PURE__ */ jsxs("span", { className: `${baseClass}__content`, children: [
|
|
47
|
+
indicator,
|
|
48
|
+
text
|
|
49
|
+
] }),
|
|
50
|
+
index < steps.length - 1 && /* @__PURE__ */ jsx("span", { className: `${baseClass}__connector`, "aria-hidden": "true" })
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
index
|
|
54
|
+
);
|
|
55
|
+
}) });
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
Stepper.displayName = "Stepper";
|
|
59
|
+
export {
|
|
60
|
+
Stepper
|
|
61
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
STREAMING TEXT COMPONENT
|
|
3
|
+
Progressive reveal for text arriving in
|
|
4
|
+
chunks, with a blinking cursor. Inherits the
|
|
5
|
+
surrounding typography — the reveal is not a
|
|
6
|
+
text style of its own.
|
|
7
|
+
============================================ */
|
|
8
|
+
|
|
9
|
+
/* Base */
|
|
10
|
+
|
|
11
|
+
.ds-streaming-text {
|
|
12
|
+
white-space: pre-wrap;
|
|
13
|
+
overflow-wrap: break-word;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Cursor */
|
|
17
|
+
|
|
18
|
+
.ds-streaming-text__cursor {
|
|
19
|
+
display: inline-block;
|
|
20
|
+
width: 0.55em;
|
|
21
|
+
height: 1em;
|
|
22
|
+
margin-left: 0.1em;
|
|
23
|
+
vertical-align: text-bottom;
|
|
24
|
+
border-radius: var(--radius-050);
|
|
25
|
+
background-color: currentColor;
|
|
26
|
+
animation: ds-streaming-text-blink var(--motion-duration-loop-spin) var(--motion-ease-standard)
|
|
27
|
+
infinite;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@keyframes ds-streaming-text-blink {
|
|
31
|
+
0%,
|
|
32
|
+
45% {
|
|
33
|
+
opacity: 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
55%,
|
|
37
|
+
100% {
|
|
38
|
+
opacity: 0.15;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type { StreamReveal, StreamRevealOptions, UseStreamRevealOptions, } from './useStreamReveal';
|
|
3
|
+
export { createStreamReveal, useStreamReveal } from './useStreamReveal';
|
|
4
|
+
/** Props owned by StreamingText itself — everything else falls through to the root span. */
|
|
5
|
+
type StreamingTextOwnProps = {
|
|
6
|
+
/**
|
|
7
|
+
* The text received so far. Grow it across renders as chunks arrive; the
|
|
8
|
+
* reveal animates through the appended part. A value that does not extend
|
|
9
|
+
* the previous one is treated as a new message and reveals from the start.
|
|
10
|
+
*/
|
|
11
|
+
text: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the source is still producing text. Keeps the cursor visible
|
|
14
|
+
* between chunks, when the reveal has caught up but more may arrive.
|
|
15
|
+
*/
|
|
16
|
+
streaming?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Slowest the reveal ever runs, in characters per second — the pace a
|
|
19
|
+
* thin trickle of chunks types at. Defaults to MOTION_STREAM_FLOOR_CPS.
|
|
20
|
+
*/
|
|
21
|
+
floorCps?: number;
|
|
22
|
+
/**
|
|
23
|
+
* However much text is waiting, it is fully on screen within this long,
|
|
24
|
+
* in milliseconds — the rate rises with the backlog. Defaults to
|
|
25
|
+
* MOTION_STREAM_DRAIN_MS.
|
|
26
|
+
*/
|
|
27
|
+
drainMs?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The retired interval between reveal steps; when set, its equivalent
|
|
30
|
+
* rate becomes the reveal's floor.
|
|
31
|
+
* @deprecated The reveal is frame-driven now — pace it with `floorCps`
|
|
32
|
+
* and `drainMs` instead.
|
|
33
|
+
*/
|
|
34
|
+
charIntervalMs?: number;
|
|
35
|
+
/** Shows the blinking cursor while streaming or revealing. */
|
|
36
|
+
cursor?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Fires once when the reveal catches up with `text` after `streaming` has
|
|
39
|
+
* ended — the moment the message is fully on screen.
|
|
40
|
+
*/
|
|
41
|
+
onRevealComplete?: () => void;
|
|
42
|
+
/** Additional CSS classes */
|
|
43
|
+
className?: string;
|
|
44
|
+
};
|
|
45
|
+
export interface StreamingTextProps extends StreamingTextOwnProps, Omit<React.ComponentPropsWithoutRef<'span'>, keyof StreamingTextOwnProps | 'children'> {
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* StreamingText — the reveal for text that arrives in chunks: an LLM
|
|
49
|
+
* response typing itself out, with a cursor that blinks while more is
|
|
50
|
+
* coming. Feed it the accumulated text on every render and it animates
|
|
51
|
+
* through what was appended from a frame loop that spends real elapsed
|
|
52
|
+
* time: a thin trickle types at the floor rate, and however much lands at
|
|
53
|
+
* once is on screen within the drain window. Under
|
|
54
|
+
* `prefers-reduced-motion` the reveal is skipped and each chunk appears
|
|
55
|
+
* whole. Announcement is the container's job — pair it with an
|
|
56
|
+
* `aria-live` region when the surrounding UI does not already announce
|
|
57
|
+
* the message. When the streamed text needs its own renderer (markdown
|
|
58
|
+
* through a parser), pace it with `useStreamReveal` or
|
|
59
|
+
* `createStreamReveal` from this folder instead — the same engine without
|
|
60
|
+
* the span.
|
|
61
|
+
*/
|
|
62
|
+
export declare const StreamingText: React.ForwardRefExoticComponent<StreamingTextProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { useRef, useEffect } from "react";
|
|
4
|
+
import { useStreamReveal } from "./useStreamReveal.js";
|
|
5
|
+
import { createStreamReveal } from "./useStreamReveal.js";
|
|
6
|
+
import "./StreamingText.css";
|
|
7
|
+
const StreamingText = React.forwardRef(
|
|
8
|
+
({
|
|
9
|
+
text,
|
|
10
|
+
streaming = false,
|
|
11
|
+
floorCps,
|
|
12
|
+
drainMs,
|
|
13
|
+
charIntervalMs,
|
|
14
|
+
cursor = true,
|
|
15
|
+
onRevealComplete,
|
|
16
|
+
className = "",
|
|
17
|
+
...rest
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const baseClass = "ds-streaming-text";
|
|
20
|
+
const { visible, caughtUp } = useStreamReveal(text, {
|
|
21
|
+
// The legacy interval's equivalent rate: one character per step.
|
|
22
|
+
floorCps: charIntervalMs != null ? 1e3 / charIntervalMs : floorCps,
|
|
23
|
+
drainMs
|
|
24
|
+
});
|
|
25
|
+
const completed = useRef(false);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!caughtUp) {
|
|
28
|
+
completed.current = false;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!streaming && text.length > 0 && !completed.current) {
|
|
32
|
+
completed.current = true;
|
|
33
|
+
onRevealComplete?.();
|
|
34
|
+
}
|
|
35
|
+
}, [caughtUp, streaming, text, onRevealComplete]);
|
|
36
|
+
const showCursor = cursor && (streaming || !caughtUp);
|
|
37
|
+
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
38
|
+
return /* @__PURE__ */ jsxs("span", { ...rest, ref, className: classes, children: [
|
|
39
|
+
visible,
|
|
40
|
+
showCursor && /* @__PURE__ */ jsx("span", { className: `${baseClass}__cursor`, "aria-hidden": "true" })
|
|
41
|
+
] });
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
StreamingText.displayName = "StreamingText";
|
|
45
|
+
export {
|
|
46
|
+
StreamingText,
|
|
47
|
+
createStreamReveal,
|
|
48
|
+
useStreamReveal
|
|
49
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface StreamRevealOptions {
|
|
2
|
+
/** Receives the visible slice each time the reveal moves it. */
|
|
3
|
+
onUpdate: (visible: string) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Slowest the reveal ever runs, in characters per second. Defaults to
|
|
6
|
+
* MOTION_STREAM_FLOOR_CPS.
|
|
7
|
+
*/
|
|
8
|
+
floorCps?: number;
|
|
9
|
+
/**
|
|
10
|
+
* However much text is waiting, it is fully on screen within this long,
|
|
11
|
+
* in milliseconds. Defaults to MOTION_STREAM_DRAIN_MS.
|
|
12
|
+
*/
|
|
13
|
+
drainMs?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Whether appended text is paced at all. Pass false (or a function
|
|
16
|
+
* returning false — it is read on every append) to show each chunk
|
|
17
|
+
* whole: the reduced-motion path.
|
|
18
|
+
*/
|
|
19
|
+
paced?: boolean | (() => boolean);
|
|
20
|
+
}
|
|
21
|
+
export interface StreamReveal {
|
|
22
|
+
/** Text the source produced since the last call — paced onto the screen. */
|
|
23
|
+
append: (chunk: string) => void;
|
|
24
|
+
/** Everything that has arrived, on screen now — for stops and aborts. */
|
|
25
|
+
flush: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Replace what has arrived wholesale and show it immediately, unpaced —
|
|
28
|
+
* for text that is not the stream speaking (a notice, an error), or to
|
|
29
|
+
* seed text that should not animate.
|
|
30
|
+
*/
|
|
31
|
+
showWhole: (text: string) => void;
|
|
32
|
+
/** Drop everything and reveal `text` as a new message, from zero. */
|
|
33
|
+
restart: (text: string) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves once the reveal has caught up with everything that arrived —
|
|
36
|
+
* immediately when it already has.
|
|
37
|
+
*/
|
|
38
|
+
drained: () => Promise<void>;
|
|
39
|
+
/** Stop the frame loop. Nothing more is revealed until the next append. */
|
|
40
|
+
cancel: () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a reveal for one streamed message. The caller owns rendering:
|
|
44
|
+
* `onUpdate` fires with the visible slice, at most once per frame.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createStreamReveal(options: StreamRevealOptions): StreamReveal;
|
|
47
|
+
export interface UseStreamRevealOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Slowest the reveal ever runs, in characters per second. Defaults to
|
|
50
|
+
* MOTION_STREAM_FLOOR_CPS.
|
|
51
|
+
*/
|
|
52
|
+
floorCps?: number;
|
|
53
|
+
/**
|
|
54
|
+
* However much text is waiting, it is fully on screen within this long,
|
|
55
|
+
* in milliseconds. Defaults to MOTION_STREAM_DRAIN_MS.
|
|
56
|
+
*/
|
|
57
|
+
drainMs?: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The declarative face of the engine, for React surfaces: feed it the
|
|
61
|
+
* accumulated text on every render and read back the paced slice. Text
|
|
62
|
+
* present on mount shows whole; a value that does not extend the previous
|
|
63
|
+
* one is a new message and reveals from zero. Checks
|
|
64
|
+
* `prefers-reduced-motion` itself, since no CSS guard can see a frame
|
|
65
|
+
* loop, and shows each chunk whole under it.
|
|
66
|
+
*/
|
|
67
|
+
export declare function useStreamReveal(text: string, { floorCps, drainMs }?: UseStreamRevealOptions): {
|
|
68
|
+
visible: string;
|
|
69
|
+
caughtUp: boolean;
|
|
70
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useRef, useEffect } from "react";
|
|
3
|
+
import { MOTION_STREAM_FLOOR_CPS, MOTION_STREAM_DRAIN_MS } from "../../tokens/motion.js";
|
|
4
|
+
function createStreamReveal(options) {
|
|
5
|
+
let arrived = "";
|
|
6
|
+
let revealed = 0;
|
|
7
|
+
let rafId = null;
|
|
8
|
+
let lastFrame = 0;
|
|
9
|
+
let resolvers = [];
|
|
10
|
+
const isPaced = () => {
|
|
11
|
+
const paced = options.paced;
|
|
12
|
+
return typeof paced === "function" ? paced() : paced !== false;
|
|
13
|
+
};
|
|
14
|
+
const settle = () => {
|
|
15
|
+
const pending = resolvers;
|
|
16
|
+
resolvers = [];
|
|
17
|
+
for (const resolve of pending) resolve();
|
|
18
|
+
};
|
|
19
|
+
const cancel = () => {
|
|
20
|
+
if (rafId != null) cancelAnimationFrame(rafId);
|
|
21
|
+
rafId = null;
|
|
22
|
+
lastFrame = 0;
|
|
23
|
+
};
|
|
24
|
+
const schedule = () => {
|
|
25
|
+
if (rafId == null) rafId = requestAnimationFrame(frame);
|
|
26
|
+
};
|
|
27
|
+
function frame(now) {
|
|
28
|
+
rafId = null;
|
|
29
|
+
const seconds = lastFrame === 0 ? 0 : (now - lastFrame) / 1e3;
|
|
30
|
+
lastFrame = now;
|
|
31
|
+
const backlog = arrived.length - revealed;
|
|
32
|
+
if (backlog > 0 && seconds > 0) {
|
|
33
|
+
const floorCps = options.floorCps ?? MOTION_STREAM_FLOOR_CPS;
|
|
34
|
+
const drainMs = options.drainMs ?? MOTION_STREAM_DRAIN_MS;
|
|
35
|
+
const cps = Math.max(floorCps, backlog / (drainMs / 1e3));
|
|
36
|
+
revealed = Math.min(arrived.length, revealed + Math.max(1, Math.round(cps * seconds)));
|
|
37
|
+
options.onUpdate(arrived.slice(0, revealed));
|
|
38
|
+
}
|
|
39
|
+
if (revealed < arrived.length) schedule();
|
|
40
|
+
else {
|
|
41
|
+
lastFrame = 0;
|
|
42
|
+
settle();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const flush = () => {
|
|
46
|
+
cancel();
|
|
47
|
+
if (revealed < arrived.length) {
|
|
48
|
+
revealed = arrived.length;
|
|
49
|
+
options.onUpdate(arrived);
|
|
50
|
+
}
|
|
51
|
+
settle();
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
append: (chunk) => {
|
|
55
|
+
if (chunk === "") return;
|
|
56
|
+
arrived += chunk;
|
|
57
|
+
if (isPaced()) schedule();
|
|
58
|
+
else flush();
|
|
59
|
+
},
|
|
60
|
+
flush,
|
|
61
|
+
showWhole: (text) => {
|
|
62
|
+
cancel();
|
|
63
|
+
arrived = text;
|
|
64
|
+
revealed = text.length;
|
|
65
|
+
options.onUpdate(text);
|
|
66
|
+
settle();
|
|
67
|
+
},
|
|
68
|
+
restart: (text) => {
|
|
69
|
+
cancel();
|
|
70
|
+
arrived = text;
|
|
71
|
+
revealed = 0;
|
|
72
|
+
options.onUpdate("");
|
|
73
|
+
if (arrived === "") return;
|
|
74
|
+
if (isPaced()) schedule();
|
|
75
|
+
else flush();
|
|
76
|
+
},
|
|
77
|
+
drained: () => revealed >= arrived.length ? Promise.resolve() : new Promise((resolve) => {
|
|
78
|
+
resolvers.push(resolve);
|
|
79
|
+
schedule();
|
|
80
|
+
}),
|
|
81
|
+
cancel
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function useStreamReveal(text, { floorCps, drainMs } = {}) {
|
|
85
|
+
const [revealedText, setRevealedText] = useState(text);
|
|
86
|
+
const engineRef = useRef(null);
|
|
87
|
+
const floorCpsRef = useRef(floorCps);
|
|
88
|
+
const drainMsRef = useRef(drainMs);
|
|
89
|
+
const previous = useRef(text);
|
|
90
|
+
useEffect(() => () => engineRef.current?.cancel(), []);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
floorCpsRef.current = floorCps;
|
|
93
|
+
drainMsRef.current = drainMs;
|
|
94
|
+
}, [floorCps, drainMs]);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (engineRef.current === null) {
|
|
97
|
+
engineRef.current = createStreamReveal({
|
|
98
|
+
onUpdate: setRevealedText,
|
|
99
|
+
paced: () => !window.matchMedia("(prefers-reduced-motion: reduce)").matches,
|
|
100
|
+
get floorCps() {
|
|
101
|
+
return floorCpsRef.current;
|
|
102
|
+
},
|
|
103
|
+
get drainMs() {
|
|
104
|
+
return drainMsRef.current;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
engineRef.current.showWhole(previous.current);
|
|
108
|
+
}
|
|
109
|
+
if (text === previous.current) return;
|
|
110
|
+
const engine = engineRef.current;
|
|
111
|
+
if (text.startsWith(previous.current)) engine.append(text.slice(previous.current.length));
|
|
112
|
+
else engine.restart(text);
|
|
113
|
+
previous.current = text;
|
|
114
|
+
}, [text]);
|
|
115
|
+
const visible = text.startsWith(revealedText) ? revealedText : "";
|
|
116
|
+
return { visible, caughtUp: visible.length >= text.length };
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
createStreamReveal,
|
|
120
|
+
useStreamReveal
|
|
121
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
SWATCH COMPONENT
|
|
3
|
+
Clickable colour tile for palettes and pickers
|
|
4
|
+
============================================ */
|
|
5
|
+
|
|
6
|
+
/* Base */
|
|
7
|
+
|
|
8
|
+
.ds-swatch {
|
|
9
|
+
width: 24px;
|
|
10
|
+
height: 24px;
|
|
11
|
+
padding: 0;
|
|
12
|
+
border: none;
|
|
13
|
+
border-radius: var(--radius-pill);
|
|
14
|
+
background-color: var(--ds-swatch-color);
|
|
15
|
+
/* A hairline inset keeps very light colours visible on the white floor */
|
|
16
|
+
box-shadow: inset 0 0 0 var(--border-025) var(--color-bg-container-border);
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
transition: box-shadow var(--motion-duration-base) var(--motion-ease-standard);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Sizes */
|
|
23
|
+
|
|
24
|
+
.ds-swatch--compact {
|
|
25
|
+
width: 20px;
|
|
26
|
+
height: 20px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Shapes */
|
|
30
|
+
|
|
31
|
+
.ds-swatch--square {
|
|
32
|
+
border-radius: var(--radius-200);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* States */
|
|
36
|
+
|
|
37
|
+
.ds-swatch--selected {
|
|
38
|
+
box-shadow:
|
|
39
|
+
inset 0 0 0 var(--border-025) var(--color-bg-container-border),
|
|
40
|
+
0 0 0 var(--border-050) var(--color-bg-page-primary),
|
|
41
|
+
0 0 0 calc(var(--border-050) * 2) var(--color-text-primary);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ds-swatch:focus-visible {
|
|
45
|
+
outline: var(--border-050) solid var(--color-input-border-selected);
|
|
46
|
+
outline-offset: var(--border-050);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ds-swatch--disabled {
|
|
50
|
+
opacity: 0.4;
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/** Props owned by Swatch itself — everything else falls through to the <button>. */
|
|
3
|
+
type SwatchOwnProps = {
|
|
4
|
+
/** The colour this swatch shows — any valid CSS colour, typically a hex value */
|
|
5
|
+
value: string;
|
|
6
|
+
/**
|
|
7
|
+
* Accessible name for the swatch. Defaults to the colour value, which is
|
|
8
|
+
* meaningful but terse — prefer a human name ("Teal 07") when you have one.
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Selected state — renders the selection ring and sets aria-pressed */
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
/** Swatch size */
|
|
14
|
+
size?: 'default' | 'compact';
|
|
15
|
+
/** Corner treatment — circle matches the site's preset grids; square suits picker triggers */
|
|
16
|
+
shape?: 'circle' | 'square';
|
|
17
|
+
/** Whether the swatch is disabled */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Additional CSS classes */
|
|
20
|
+
className?: string;
|
|
21
|
+
};
|
|
22
|
+
export interface SwatchProps extends SwatchOwnProps, Omit<React.ComponentPropsWithoutRef<'button'>, keyof SwatchOwnProps | 'type'> {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A clickable colour tile — the building block for preset palettes and
|
|
26
|
+
* picker triggers. Renders a `<button>` whose background is the `value`
|
|
27
|
+
* colour; `selected` draws the theme-aware selection ring.
|
|
28
|
+
*
|
|
29
|
+
* Purely presentational (no hooks), so it can be rendered from a Server
|
|
30
|
+
* Component; interactivity arrives through the native `onClick` you pass.
|
|
31
|
+
* Forwards a ref to the `<button>` and spreads unrecognised props onto it.
|
|
32
|
+
*/
|
|
33
|
+
export declare const Swatch: React.ForwardRefExoticComponent<SwatchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import "./Swatch.css";
|
|
4
|
+
const Swatch = React.forwardRef(
|
|
5
|
+
({
|
|
6
|
+
value,
|
|
7
|
+
label,
|
|
8
|
+
selected = false,
|
|
9
|
+
size = "default",
|
|
10
|
+
shape = "circle",
|
|
11
|
+
disabled = false,
|
|
12
|
+
className = "",
|
|
13
|
+
style,
|
|
14
|
+
...rest
|
|
15
|
+
}, ref) => {
|
|
16
|
+
const baseClass = "ds-swatch";
|
|
17
|
+
const classes = [
|
|
18
|
+
baseClass,
|
|
19
|
+
size === "compact" ? `${baseClass}--compact` : "",
|
|
20
|
+
shape === "square" ? `${baseClass}--square` : "",
|
|
21
|
+
selected ? `${baseClass}--selected` : "",
|
|
22
|
+
disabled ? `${baseClass}--disabled` : "",
|
|
23
|
+
className
|
|
24
|
+
].filter(Boolean).join(" ");
|
|
25
|
+
const swatchStyle = { ...style, "--ds-swatch-color": value };
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
...rest,
|
|
30
|
+
ref,
|
|
31
|
+
type: "button",
|
|
32
|
+
className: classes,
|
|
33
|
+
style: swatchStyle,
|
|
34
|
+
disabled,
|
|
35
|
+
"aria-pressed": selected,
|
|
36
|
+
"aria-label": rest["aria-label"] ?? label ?? value
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
Swatch.displayName = "Swatch";
|
|
42
|
+
export {
|
|
43
|
+
Swatch
|
|
44
|
+
};
|