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,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useId, useCallback } from "react";
|
|
4
|
+
import ReactDOM from "react-dom";
|
|
5
|
+
import { Button } from "../Button/Button.js";
|
|
6
|
+
import "./AlertDialog.css";
|
|
7
|
+
import "../../fonts/material-symbols.css";
|
|
8
|
+
import { useMounted } from "../../behaviors/useMounted.js";
|
|
9
|
+
import { useLayer } from "../../behaviors/useLayer.js";
|
|
10
|
+
import { useFocusScope } from "../../behaviors/useFocusScope.js";
|
|
11
|
+
import { useScrollLock } from "../../behaviors/useScrollLock.js";
|
|
12
|
+
const AlertDialog = ({
|
|
13
|
+
open,
|
|
14
|
+
onOpenChange,
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
confirmLabel = "Confirm",
|
|
18
|
+
cancelLabel = "Cancel",
|
|
19
|
+
onConfirm,
|
|
20
|
+
onCancel,
|
|
21
|
+
variant = "default",
|
|
22
|
+
className = ""
|
|
23
|
+
}) => {
|
|
24
|
+
const panelRef = useRef(null);
|
|
25
|
+
const titleId = useId();
|
|
26
|
+
const descId = useId();
|
|
27
|
+
const baseClass = "ds-alert-dialog";
|
|
28
|
+
const mounted = useMounted();
|
|
29
|
+
const handleCancel = useCallback(() => {
|
|
30
|
+
onCancel?.();
|
|
31
|
+
onOpenChange(false);
|
|
32
|
+
}, [onCancel, onOpenChange]);
|
|
33
|
+
const handleConfirm = useCallback(() => {
|
|
34
|
+
onConfirm?.();
|
|
35
|
+
onOpenChange(false);
|
|
36
|
+
}, [onConfirm, onOpenChange]);
|
|
37
|
+
useLayer({ open, onDismiss: handleCancel });
|
|
38
|
+
useFocusScope(panelRef, {
|
|
39
|
+
active: open,
|
|
40
|
+
initialFocus: () => panelRef.current?.querySelector(`.${baseClass}__actions button:first-child`) ?? null
|
|
41
|
+
});
|
|
42
|
+
useScrollLock(open);
|
|
43
|
+
const variantClass = variant !== "default" ? `${baseClass}--${variant}` : "";
|
|
44
|
+
const openClass = open ? `${baseClass}--open` : "";
|
|
45
|
+
const containerClasses = [baseClass, variantClass, openClass, className].filter(Boolean).join(" ");
|
|
46
|
+
const dialog = /* @__PURE__ */ jsxs("div", { className: containerClasses, children: [
|
|
47
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__backdrop`, onClick: handleCancel }),
|
|
48
|
+
/* @__PURE__ */ jsxs(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: `${baseClass}__panel`,
|
|
52
|
+
ref: panelRef,
|
|
53
|
+
role: "alertdialog",
|
|
54
|
+
"aria-modal": "true",
|
|
55
|
+
"aria-labelledby": titleId,
|
|
56
|
+
"aria-describedby": description ? descId : void 0,
|
|
57
|
+
tabIndex: -1,
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
className: `${baseClass}__icon material-symbols-rounded`,
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
children: variant === "destructive" ? "warning" : "info"
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsx("h2", { className: `${baseClass}__title`, id: titleId, children: title })
|
|
69
|
+
] }),
|
|
70
|
+
description && /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, id: descId, children: description }),
|
|
71
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__actions`, children: [
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
Button,
|
|
74
|
+
{
|
|
75
|
+
label: cancelLabel,
|
|
76
|
+
priority: "tertiary",
|
|
77
|
+
onClick: handleCancel
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
Button,
|
|
82
|
+
{
|
|
83
|
+
label: confirmLabel,
|
|
84
|
+
priority: variant === "destructive" ? "destructive" : "primary",
|
|
85
|
+
onClick: handleConfirm
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
] });
|
|
93
|
+
if (!mounted) return null;
|
|
94
|
+
return ReactDOM.createPortal(dialog, document.body);
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
AlertDialog
|
|
98
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
ANCHOR NAV
|
|
3
|
+
"On this page" list of anchor links with a
|
|
4
|
+
position indicator riding the left rail.
|
|
5
|
+
============================================ */
|
|
6
|
+
.ds-anchor-nav {
|
|
7
|
+
font-family: var(--font-family-primary);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ds-anchor-nav__header {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: var(--gap-100);
|
|
14
|
+
margin: 0 0 var(--gap-200);
|
|
15
|
+
font-size: var(--font-paragraph-emphasis-size);
|
|
16
|
+
font-weight: var(--font-paragraph-emphasis-weight);
|
|
17
|
+
line-height: var(--font-paragraph-emphasis-line-height);
|
|
18
|
+
color: var(--color-text-primary);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ds-anchor-nav__icon {
|
|
22
|
+
--icon-size: var(--icon-size-500);
|
|
23
|
+
color: var(--color-icon-primary);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ds-anchor-nav__list {
|
|
27
|
+
list-style: none;
|
|
28
|
+
margin: 0;
|
|
29
|
+
padding: 0;
|
|
30
|
+
border-left: var(--border-025) solid var(--color-divider);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ds-anchor-nav__link {
|
|
34
|
+
display: block;
|
|
35
|
+
padding: var(--padding-150) 0 var(--padding-150) var(--padding-400);
|
|
36
|
+
/* Sits over the list rail; turns into the indicator when active */
|
|
37
|
+
margin-left: calc(var(--border-025) * -1);
|
|
38
|
+
border-left: var(--border-050) solid transparent;
|
|
39
|
+
font-size: var(--font-paragraph-size);
|
|
40
|
+
font-weight: var(--font-paragraph-weight);
|
|
41
|
+
line-height: var(--font-paragraph-line-height);
|
|
42
|
+
color: var(--color-text-tertiary);
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
transition:
|
|
45
|
+
color var(--motion-duration-fast) var(--motion-ease-standard),
|
|
46
|
+
border-color var(--motion-duration-fast) var(--motion-ease-standard);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ds-anchor-nav__link:hover {
|
|
50
|
+
color: var(--color-text-primary);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ds-anchor-nav__link:focus-visible {
|
|
54
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
55
|
+
outline-offset: -2px;
|
|
56
|
+
border-radius: var(--radius-050);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ds-anchor-nav__link--active {
|
|
60
|
+
color: var(--color-text-primary);
|
|
61
|
+
font-weight: var(--font-paragraph-emphasis-weight);
|
|
62
|
+
border-left-color: var(--color-text-primary);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ============================================
|
|
66
|
+
FLOATING VARIANT
|
|
67
|
+
Collapsed to a minimap of short lines; the
|
|
68
|
+
full panel expands over it on hover, focus
|
|
69
|
+
or tap. The caller positions the nav itself
|
|
70
|
+
(typically fixed on the right page edge).
|
|
71
|
+
============================================ */
|
|
72
|
+
.ds-anchor-nav--floating {
|
|
73
|
+
position: relative;
|
|
74
|
+
display: inline-block;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ds-anchor-nav__lines {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
align-items: flex-end;
|
|
81
|
+
gap: var(--gap-200);
|
|
82
|
+
/* A comfortable hover/tap target around the thin lines */
|
|
83
|
+
padding: var(--padding-200);
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ds-anchor-nav__line {
|
|
88
|
+
/* One line per section: bespoke minimap geometry, specced in design.md */
|
|
89
|
+
width: 16px;
|
|
90
|
+
height: var(--border-050);
|
|
91
|
+
border-radius: var(--radius-pill);
|
|
92
|
+
background-color: var(--color-divider);
|
|
93
|
+
transition:
|
|
94
|
+
width var(--motion-duration-fast) var(--motion-ease-standard),
|
|
95
|
+
background-color var(--motion-duration-fast) var(--motion-ease-standard);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ds-anchor-nav__line--active {
|
|
99
|
+
width: 24px;
|
|
100
|
+
background-color: var(--color-text-primary);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.ds-anchor-nav__panel {
|
|
104
|
+
position: absolute;
|
|
105
|
+
z-index: 10;
|
|
106
|
+
top: 50%;
|
|
107
|
+
right: 0;
|
|
108
|
+
min-width: 200px;
|
|
109
|
+
max-width: 280px;
|
|
110
|
+
/* A long list scrolls inside the panel rather than past the viewport */
|
|
111
|
+
max-height: 70vh;
|
|
112
|
+
overflow-y: auto;
|
|
113
|
+
padding: var(--padding-400);
|
|
114
|
+
border: var(--border-025) solid var(--color-bg-container-border);
|
|
115
|
+
border-radius: var(--radius-200);
|
|
116
|
+
/* Page background, not container: the container fill is semi-transparent
|
|
117
|
+
in dark mode, and a floating panel must not show text through itself */
|
|
118
|
+
background-color: var(--color-bg-page-primary);
|
|
119
|
+
box-shadow: var(--shadow-floating);
|
|
120
|
+
|
|
121
|
+
/* Hidden by default — but never visibility: hidden, because the links must
|
|
122
|
+
stay focusable so tabbing into the nav expands it via :focus-within */
|
|
123
|
+
opacity: 0;
|
|
124
|
+
pointer-events: none;
|
|
125
|
+
transform: translate(var(--gap-050), -50%);
|
|
126
|
+
transition:
|
|
127
|
+
opacity var(--motion-duration-fast) var(--motion-ease-standard),
|
|
128
|
+
transform var(--motion-duration-fast) var(--motion-ease-standard);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.ds-anchor-nav--floating:hover .ds-anchor-nav__panel,
|
|
132
|
+
.ds-anchor-nav--floating:focus-within .ds-anchor-nav__panel,
|
|
133
|
+
.ds-anchor-nav--open .ds-anchor-nav__panel {
|
|
134
|
+
opacity: 1;
|
|
135
|
+
pointer-events: auto;
|
|
136
|
+
transform: translate(0, -50%);
|
|
137
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface AnchorNavItem {
|
|
3
|
+
/** The id of the element the item jumps to (rendered as `href="#id"`) */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Link text */
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
type AnchorNavOwnProps = {
|
|
9
|
+
/** The on-page sections to list, in document order */
|
|
10
|
+
items: AnchorNavItem[];
|
|
11
|
+
/** Visual form: `list` renders the inline "On this page" rail; `floating` collapses to a stack of short lines that expands into a panel on hover, keyboard focus, or tap, so it can ride a page edge without taking column width */
|
|
12
|
+
variant?: 'list' | 'floating';
|
|
13
|
+
/** Header text above the list; pass an empty string to render no header */
|
|
14
|
+
title?: string;
|
|
15
|
+
/** Icon beside the header — Material Symbol name (string) or custom element (ReactNode); pass an empty string for none */
|
|
16
|
+
icon?: string | React.ReactNode;
|
|
17
|
+
/** Controlled active item id — set it to drive the highlight yourself and skip scroll tracking */
|
|
18
|
+
activeId?: string;
|
|
19
|
+
/** Fires when the tracked (or clicked) active item changes */
|
|
20
|
+
onActiveChange?: (id: string) => void;
|
|
21
|
+
/** Distance in px from the viewport top at which a section counts as current, e.g. a sticky header's height */
|
|
22
|
+
offset?: number;
|
|
23
|
+
};
|
|
24
|
+
export interface AnchorNavProps extends AnchorNavOwnProps, Omit<React.ComponentPropsWithoutRef<'nav'>, keyof AnchorNavOwnProps> {
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* An "On this page" list of anchor links that tracks the reader's position.
|
|
28
|
+
*
|
|
29
|
+
* Uncontrolled by default: a scroll listener marks the last section whose top
|
|
30
|
+
* has passed `offset` as current. Pass `activeId` to control the highlight
|
|
31
|
+
* instead (no listener is attached). The active link carries
|
|
32
|
+
* `aria-current="location"`.
|
|
33
|
+
*
|
|
34
|
+
* The `floating` variant collapses the list to a minimap of short lines and
|
|
35
|
+
* expands the full panel on hover or keyboard focus (the links stay focusable
|
|
36
|
+
* while collapsed, so tabbing in opens it). A tap opens it where hover
|
|
37
|
+
* doesn't exist; Escape or a click elsewhere closes it again.
|
|
38
|
+
*/
|
|
39
|
+
export declare const AnchorNav: React.ForwardRefExoticComponent<AnchorNavProps & React.RefAttributes<HTMLElement>>;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React, { useRef, useImperativeHandle, useState, useCallback, useEffect } from "react";
|
|
4
|
+
import "./AnchorNav.css";
|
|
5
|
+
const AnchorNav = React.forwardRef(
|
|
6
|
+
({
|
|
7
|
+
items,
|
|
8
|
+
variant = "list",
|
|
9
|
+
title = "On this page",
|
|
10
|
+
icon = "toc",
|
|
11
|
+
activeId,
|
|
12
|
+
onActiveChange,
|
|
13
|
+
offset = 96,
|
|
14
|
+
className,
|
|
15
|
+
onKeyDown,
|
|
16
|
+
...rest
|
|
17
|
+
}, ref) => {
|
|
18
|
+
const navRef = useRef(null);
|
|
19
|
+
useImperativeHandle(ref, () => navRef.current);
|
|
20
|
+
const floating = variant === "floating";
|
|
21
|
+
const [open, setOpen] = useState(false);
|
|
22
|
+
const isControlled = activeId !== void 0;
|
|
23
|
+
const [trackedId, setTrackedId] = useState(void 0);
|
|
24
|
+
const currentId = isControlled ? activeId : trackedId;
|
|
25
|
+
const onActiveChangeRef = useRef(onActiveChange);
|
|
26
|
+
onActiveChangeRef.current = onActiveChange;
|
|
27
|
+
const setActive = useCallback(
|
|
28
|
+
(id) => {
|
|
29
|
+
setTrackedId((prev) => {
|
|
30
|
+
if (id !== void 0 && id !== prev) onActiveChangeRef.current?.(id);
|
|
31
|
+
return id;
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
[]
|
|
35
|
+
);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (isControlled || items.length === 0) return;
|
|
38
|
+
let frame = 0;
|
|
39
|
+
const measure = () => {
|
|
40
|
+
frame = 0;
|
|
41
|
+
let current = items[0]?.id;
|
|
42
|
+
for (const item of items) {
|
|
43
|
+
const el = document.getElementById(item.id);
|
|
44
|
+
if (!el) continue;
|
|
45
|
+
if (el.getBoundingClientRect().top <= offset + 1) current = item.id;
|
|
46
|
+
}
|
|
47
|
+
setActive(current);
|
|
48
|
+
};
|
|
49
|
+
const schedule = () => {
|
|
50
|
+
if (frame === 0) frame = window.requestAnimationFrame(measure);
|
|
51
|
+
};
|
|
52
|
+
measure();
|
|
53
|
+
window.addEventListener("scroll", schedule, { passive: true });
|
|
54
|
+
window.addEventListener("resize", schedule);
|
|
55
|
+
return () => {
|
|
56
|
+
window.removeEventListener("scroll", schedule);
|
|
57
|
+
window.removeEventListener("resize", schedule);
|
|
58
|
+
if (frame !== 0) window.cancelAnimationFrame(frame);
|
|
59
|
+
};
|
|
60
|
+
}, [isControlled, items, offset, setActive]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!open) return;
|
|
63
|
+
const onPointerDown = (event) => {
|
|
64
|
+
if (navRef.current && !navRef.current.contains(event.target)) setOpen(false);
|
|
65
|
+
};
|
|
66
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
67
|
+
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
68
|
+
}, [open]);
|
|
69
|
+
const handleKeyDown = (event) => {
|
|
70
|
+
onKeyDown?.(event);
|
|
71
|
+
if (floating && event.key === "Escape") {
|
|
72
|
+
setOpen(false);
|
|
73
|
+
const focused = document.activeElement;
|
|
74
|
+
if (focused instanceof HTMLElement && navRef.current?.contains(focused)) focused.blur();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const classes = [
|
|
78
|
+
"ds-anchor-nav",
|
|
79
|
+
floating && "ds-anchor-nav--floating",
|
|
80
|
+
floating && open && "ds-anchor-nav--open",
|
|
81
|
+
className
|
|
82
|
+
].filter(Boolean).join(" ");
|
|
83
|
+
const header = title ? /* @__PURE__ */ jsxs("p", { className: "ds-anchor-nav__header", children: [
|
|
84
|
+
icon && (typeof icon === "string" ? /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded ds-anchor-nav__icon", "aria-hidden": "true", children: icon }) : /* @__PURE__ */ jsx("span", { className: "ds-anchor-nav__icon", "aria-hidden": "true", children: icon })),
|
|
85
|
+
title
|
|
86
|
+
] }) : null;
|
|
87
|
+
const list = /* @__PURE__ */ jsx("ul", { className: "ds-anchor-nav__list", children: items.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
88
|
+
"a",
|
|
89
|
+
{
|
|
90
|
+
href: `#${item.id}`,
|
|
91
|
+
className: item.id === currentId ? "ds-anchor-nav__link ds-anchor-nav__link--active" : "ds-anchor-nav__link",
|
|
92
|
+
"aria-current": item.id === currentId ? "location" : void 0,
|
|
93
|
+
onClick: (event) => {
|
|
94
|
+
if (!isControlled) setActive(item.id);
|
|
95
|
+
else onActiveChangeRef.current?.(item.id);
|
|
96
|
+
if (floating) {
|
|
97
|
+
setOpen(false);
|
|
98
|
+
event.currentTarget.blur();
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
children: item.label
|
|
102
|
+
}
|
|
103
|
+
) }, item.id)) });
|
|
104
|
+
return /* @__PURE__ */ jsx(
|
|
105
|
+
"nav",
|
|
106
|
+
{
|
|
107
|
+
ref: navRef,
|
|
108
|
+
"aria-label": title || "On this page",
|
|
109
|
+
className: classes,
|
|
110
|
+
...rest,
|
|
111
|
+
onKeyDown: handleKeyDown,
|
|
112
|
+
children: floating ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
+
/* @__PURE__ */ jsx("div", { className: "ds-anchor-nav__lines", "aria-hidden": "true", onClick: () => setOpen(true), children: items.map((item) => /* @__PURE__ */ jsx(
|
|
114
|
+
"span",
|
|
115
|
+
{
|
|
116
|
+
className: item.id === currentId ? "ds-anchor-nav__line ds-anchor-nav__line--active" : "ds-anchor-nav__line"
|
|
117
|
+
},
|
|
118
|
+
item.id
|
|
119
|
+
)) }),
|
|
120
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-anchor-nav__panel", children: [
|
|
121
|
+
header,
|
|
122
|
+
list
|
|
123
|
+
] })
|
|
124
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
125
|
+
header,
|
|
126
|
+
list
|
|
127
|
+
] })
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
AnchorNav.displayName = "AnchorNav";
|
|
133
|
+
export {
|
|
134
|
+
AnchorNav
|
|
135
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
ANIMATED NUMBER COMPONENT
|
|
3
|
+
A number that counts to its value
|
|
4
|
+
============================================ */
|
|
5
|
+
|
|
6
|
+
/* Base — inherits the surrounding type entirely: the component is a number
|
|
7
|
+
inside someone else's composition (a Stat, a table cell, a sentence), so
|
|
8
|
+
it owns no face, size, or colour of its own. */
|
|
9
|
+
|
|
10
|
+
.ds-animated-number {
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* Tabular figures: every digit the same width, so the layout holds still
|
|
15
|
+
while the digits roll. */
|
|
16
|
+
.ds-animated-number__value {
|
|
17
|
+
font-variant-numeric: tabular-nums;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Visually hidden settled value — what a screen reader gets instead of the
|
|
21
|
+
rolling digits. */
|
|
22
|
+
.ds-animated-number__sr {
|
|
23
|
+
position: absolute;
|
|
24
|
+
width: 1px;
|
|
25
|
+
height: 1px;
|
|
26
|
+
margin: -1px;
|
|
27
|
+
padding: 0;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
clip-path: inset(50%);
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/** Props owned by AnimatedNumber itself — everything else falls through to the root span. */
|
|
3
|
+
type AnimatedNumberOwnProps = {
|
|
4
|
+
/** The number to display. Changing it tweens the display from the previous value. */
|
|
5
|
+
value: number;
|
|
6
|
+
/** Decimal places shown throughout the tween and at rest. Ignored when `format` is set. */
|
|
7
|
+
decimals?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Formats the displayed number — currency, units, compact notation. Called
|
|
10
|
+
* on every animation frame, so keep it pure and cheap.
|
|
11
|
+
*/
|
|
12
|
+
format?: (value: number) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Tween length in ms. Defaults to the shared `MOTION_COUNT_UP_MS` constant;
|
|
15
|
+
* an animation pace, so the tween is skipped entirely under reduced motion.
|
|
16
|
+
*/
|
|
17
|
+
duration?: number;
|
|
18
|
+
/** Counts up from zero on first render. Turn off to arrive settled and animate only on later changes. */
|
|
19
|
+
animateOnMount?: boolean;
|
|
20
|
+
/** Additional CSS classes */
|
|
21
|
+
className?: string;
|
|
22
|
+
};
|
|
23
|
+
export interface AnimatedNumberProps extends AnimatedNumberOwnProps, Omit<React.ComponentPropsWithoutRef<'span'>, keyof AnimatedNumberOwnProps | 'children'> {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* AnimatedNumber — a number that counts to its value. On mount it counts up
|
|
27
|
+
* from zero; when `value` changes it tweens from the previous value, easing
|
|
28
|
+
* out so the landing reads as arrival rather than a stop. The digits sit on
|
|
29
|
+
* tabular figures so the layout never jitters while they roll.
|
|
30
|
+
*
|
|
31
|
+
* Screen readers hear only the settled value: the rolling digits are
|
|
32
|
+
* `aria-hidden` behind a visually hidden span carrying the target.
|
|
33
|
+
* Under `prefers-reduced-motion` the tween is skipped and the value snaps.
|
|
34
|
+
*/
|
|
35
|
+
export declare const AnimatedNumber: React.ForwardRefExoticComponent<AnimatedNumberProps & React.RefAttributes<HTMLSpanElement>>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { useState, useRef, useEffect } from "react";
|
|
4
|
+
import "./AnimatedNumber.css";
|
|
5
|
+
import { MOTION_COUNT_UP_MS } from "../../tokens/motion.js";
|
|
6
|
+
const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
7
|
+
const prefersReducedMotion = () => typeof window !== "undefined" && window.matchMedia(REDUCED_MOTION_QUERY).matches;
|
|
8
|
+
const easeOutCubic = (t) => 1 - Math.pow(1 - t, 3);
|
|
9
|
+
const AnimatedNumber = React.forwardRef(
|
|
10
|
+
({
|
|
11
|
+
value,
|
|
12
|
+
decimals = 0,
|
|
13
|
+
format,
|
|
14
|
+
duration = MOTION_COUNT_UP_MS,
|
|
15
|
+
animateOnMount = true,
|
|
16
|
+
className = "",
|
|
17
|
+
...rest
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const baseClass = "ds-animated-number";
|
|
20
|
+
const [display, setDisplay] = useState(animateOnMount ? 0 : value);
|
|
21
|
+
const displayRef = useRef(display);
|
|
22
|
+
displayRef.current = display;
|
|
23
|
+
const frameRef = useRef(0);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const from = displayRef.current;
|
|
26
|
+
if (from === value) return;
|
|
27
|
+
if (prefersReducedMotion() || duration <= 0) {
|
|
28
|
+
setDisplay(value);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const start = performance.now();
|
|
32
|
+
const tick = (now) => {
|
|
33
|
+
const t = Math.min((now - start) / duration, 1);
|
|
34
|
+
const eased = easeOutCubic(t);
|
|
35
|
+
setDisplay(t >= 1 ? value : from + (value - from) * eased);
|
|
36
|
+
if (t < 1) frameRef.current = requestAnimationFrame(tick);
|
|
37
|
+
};
|
|
38
|
+
frameRef.current = requestAnimationFrame(tick);
|
|
39
|
+
return () => cancelAnimationFrame(frameRef.current);
|
|
40
|
+
}, [value, duration]);
|
|
41
|
+
const fmt = format ?? ((n) => n.toLocaleString(void 0, {
|
|
42
|
+
minimumFractionDigits: decimals,
|
|
43
|
+
maximumFractionDigits: decimals
|
|
44
|
+
}));
|
|
45
|
+
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
46
|
+
return /* @__PURE__ */ jsxs("span", { ...rest, ref, className: classes, children: [
|
|
47
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__value`, "aria-hidden": "true", children: fmt(display) }),
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__sr`, children: fmt(value) })
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
AnimatedNumber.displayName = "AnimatedNumber";
|
|
53
|
+
export {
|
|
54
|
+
AnimatedNumber
|
|
55
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
APP LAYOUT — full-page template
|
|
3
|
+
Sidebar rail on the left, centered content area
|
|
4
|
+
============================================ */
|
|
5
|
+
|
|
6
|
+
.ds-app-layout {
|
|
7
|
+
display: flex;
|
|
8
|
+
min-height: 100vh;
|
|
9
|
+
background-color: var(--color-bg-page-primary);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* ============================================
|
|
13
|
+
MAIN CONTENT AREA
|
|
14
|
+
============================================ */
|
|
15
|
+
.ds-app-layout__main {
|
|
16
|
+
flex: 1;
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
margin-left: 64px;
|
|
20
|
+
padding: var(--padding-1000) var(--padding-500);
|
|
21
|
+
transition: margin-left var(--motion-duration-slow) var(--motion-ease-emphasized);
|
|
22
|
+
min-width: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ds-app-layout--expanded .ds-app-layout__main {
|
|
26
|
+
margin-left: 280px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* ============================================
|
|
30
|
+
CENTERED CONTENT WRAPPER
|
|
31
|
+
============================================ */
|
|
32
|
+
.ds-app-layout__content {
|
|
33
|
+
width: 100%;
|
|
34
|
+
max-width: 1120px;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
gap: var(--gap-1000);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ============================================
|
|
41
|
+
RESPONSIVE
|
|
42
|
+
============================================ */
|
|
43
|
+
@media (max-width: 768px) {
|
|
44
|
+
.ds-app-layout__main {
|
|
45
|
+
margin-left: 0;
|
|
46
|
+
padding: var(--padding-500) var(--padding-400);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ds-app-layout--expanded .ds-app-layout__main {
|
|
50
|
+
margin-left: 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AppSidebarSection, AppSidebarProfile } from '../AppSidebar/AppSidebar';
|
|
3
|
+
export interface AppLayoutProps {
|
|
4
|
+
/** Sidebar navigation sections */
|
|
5
|
+
sections: AppSidebarSection[];
|
|
6
|
+
/** Sidebar profile */
|
|
7
|
+
profile?: AppSidebarProfile;
|
|
8
|
+
/** Active nav item key */
|
|
9
|
+
activeKey?: string;
|
|
10
|
+
/** Active sub-item key */
|
|
11
|
+
activeSubKey?: string;
|
|
12
|
+
/** Whether sidebar starts expanded */
|
|
13
|
+
defaultExpanded?: boolean;
|
|
14
|
+
/** Logo text next to icon */
|
|
15
|
+
logoText?: string;
|
|
16
|
+
/** Custom logo element */
|
|
17
|
+
logo?: React.ReactNode;
|
|
18
|
+
/** Page content — centred in the main area */
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Colour scheme: 'dark' pins the layout to the dark theme (the historical
|
|
22
|
+
* behaviour and the default); 'inherit' drops the pin so the layout
|
|
23
|
+
* follows the surrounding data-theme like any other component.
|
|
24
|
+
*/
|
|
25
|
+
theme?: 'dark' | 'inherit';
|
|
26
|
+
/** Additional CSS classes on outer wrapper */
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* AppLayout — full-page template with a collapsible sidebar
|
|
31
|
+
* and a centred content area.
|
|
32
|
+
*/
|
|
33
|
+
export declare const AppLayout: ({ sections, profile, activeKey, activeSubKey, defaultExpanded, logoText, logo, children, theme, className, }: AppLayoutProps) => React.JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useCallback } from "react";
|
|
4
|
+
import { AppSidebar } from "../AppSidebar/AppSidebar.js";
|
|
5
|
+
import "./AppLayout.css";
|
|
6
|
+
const AppLayout = ({
|
|
7
|
+
sections,
|
|
8
|
+
profile,
|
|
9
|
+
activeKey,
|
|
10
|
+
activeSubKey,
|
|
11
|
+
defaultExpanded = true,
|
|
12
|
+
logoText,
|
|
13
|
+
logo,
|
|
14
|
+
children,
|
|
15
|
+
theme = "dark",
|
|
16
|
+
className = ""
|
|
17
|
+
}) => {
|
|
18
|
+
const baseClass = "ds-app-layout";
|
|
19
|
+
const [expanded, setExpanded] = useState(defaultExpanded);
|
|
20
|
+
const handleExpandedChange = useCallback((next) => {
|
|
21
|
+
setExpanded(next);
|
|
22
|
+
}, []);
|
|
23
|
+
const classes = [
|
|
24
|
+
baseClass,
|
|
25
|
+
expanded ? `${baseClass}--expanded` : "",
|
|
26
|
+
className
|
|
27
|
+
].filter(Boolean).join(" ");
|
|
28
|
+
return /* @__PURE__ */ jsxs("div", { className: classes, "data-theme": theme === "dark" ? "dark" : void 0, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
AppSidebar,
|
|
31
|
+
{
|
|
32
|
+
sections,
|
|
33
|
+
profile,
|
|
34
|
+
activeKey,
|
|
35
|
+
activeSubKey,
|
|
36
|
+
expanded,
|
|
37
|
+
onExpandedChange: handleExpandedChange,
|
|
38
|
+
logoText,
|
|
39
|
+
logo
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ jsx("main", { className: `${baseClass}__main`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__content`, children }) })
|
|
43
|
+
] });
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
AppLayout
|
|
47
|
+
};
|