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,295 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { useState, useRef, useEffect, useCallback, useId } from "react";
|
|
4
|
+
import { useLayer } from "../../behaviors/useLayer.js";
|
|
5
|
+
import { useFocusScope } from "../../behaviors/useFocusScope.js";
|
|
6
|
+
import { useScrollLock } from "../../behaviors/useScrollLock.js";
|
|
7
|
+
import { Avatar } from "../Avatar/Avatar.js";
|
|
8
|
+
import "./AppSidebar.css";
|
|
9
|
+
import "../../fonts/material-symbols.css";
|
|
10
|
+
function DefaultLogo() {
|
|
11
|
+
return /* @__PURE__ */ jsxs(
|
|
12
|
+
"svg",
|
|
13
|
+
{
|
|
14
|
+
width: "24",
|
|
15
|
+
height: "24",
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
fill: "none",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsx("path", { d: "M12 1.5 V22.5", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
22
|
+
/* @__PURE__ */ jsx("path", { d: "M6.5 7 V12 L2 16.5", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
23
|
+
/* @__PURE__ */ jsx("path", { d: "M17.5 7 V12 L22 16.5", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
const AppSidebar = ({
|
|
29
|
+
sections,
|
|
30
|
+
profile,
|
|
31
|
+
activeKey,
|
|
32
|
+
activeSubKey,
|
|
33
|
+
defaultExpanded = false,
|
|
34
|
+
expanded: controlledExpanded,
|
|
35
|
+
onExpandedChange,
|
|
36
|
+
onProfileMore,
|
|
37
|
+
floating = false,
|
|
38
|
+
topSlot,
|
|
39
|
+
footerSlot,
|
|
40
|
+
className = "",
|
|
41
|
+
logo,
|
|
42
|
+
logoText = "Rift",
|
|
43
|
+
showMobileTrigger = true
|
|
44
|
+
}) => {
|
|
45
|
+
const baseClass = "ds-app-sidebar";
|
|
46
|
+
const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
|
|
47
|
+
const isExpanded = controlledExpanded ?? internalExpanded;
|
|
48
|
+
const onExpandedChangeRef = useRef(onExpandedChange);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
onExpandedChangeRef.current = onExpandedChange;
|
|
51
|
+
}, [onExpandedChange]);
|
|
52
|
+
const toggleExpanded = useCallback(() => {
|
|
53
|
+
const next = !isExpanded;
|
|
54
|
+
setInternalExpanded(next);
|
|
55
|
+
onExpandedChange?.(next);
|
|
56
|
+
}, [isExpanded, onExpandedChange]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const band = window.matchMedia("(min-width: 769px) and (max-width: 959px)");
|
|
59
|
+
const onChange = () => {
|
|
60
|
+
if (band.matches) {
|
|
61
|
+
setInternalExpanded(false);
|
|
62
|
+
onExpandedChangeRef.current?.(false);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
onChange();
|
|
66
|
+
band.addEventListener("change", onChange);
|
|
67
|
+
return () => band.removeEventListener("change", onChange);
|
|
68
|
+
}, []);
|
|
69
|
+
const [mobileOpen, setMobileOpen] = useState(false);
|
|
70
|
+
const drawerRef = useRef(null);
|
|
71
|
+
const drawerId = useId();
|
|
72
|
+
const closeMobile = useCallback(() => setMobileOpen(false), []);
|
|
73
|
+
useLayer({ open: mobileOpen, onDismiss: closeMobile });
|
|
74
|
+
useFocusScope(drawerRef, { active: mobileOpen });
|
|
75
|
+
useScrollLock(mobileOpen);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!mobileOpen) return;
|
|
78
|
+
const query = window.matchMedia("(min-width: 769px)");
|
|
79
|
+
const onChange = () => {
|
|
80
|
+
if (query.matches) setMobileOpen(false);
|
|
81
|
+
};
|
|
82
|
+
onChange();
|
|
83
|
+
query.addEventListener("change", onChange);
|
|
84
|
+
return () => query.removeEventListener("change", onChange);
|
|
85
|
+
}, [mobileOpen]);
|
|
86
|
+
const [openKeys, setOpenKeys] = useState(/* @__PURE__ */ new Set());
|
|
87
|
+
const toggleAccordion = useCallback((key) => {
|
|
88
|
+
setOpenKeys((prev) => {
|
|
89
|
+
const next = new Set(prev);
|
|
90
|
+
if (next.has(key)) {
|
|
91
|
+
next.delete(key);
|
|
92
|
+
} else {
|
|
93
|
+
next.add(key);
|
|
94
|
+
}
|
|
95
|
+
return next;
|
|
96
|
+
});
|
|
97
|
+
}, []);
|
|
98
|
+
const classes = [
|
|
99
|
+
baseClass,
|
|
100
|
+
// The drawer always shows the expanded layout: an icon rail inside
|
|
101
|
+
// a modal overlay would be all cost and no labels.
|
|
102
|
+
isExpanded || mobileOpen ? `${baseClass}--expanded` : "",
|
|
103
|
+
floating ? `${baseClass}--floating` : "",
|
|
104
|
+
mobileOpen ? `${baseClass}--mobile-open` : "",
|
|
105
|
+
className
|
|
106
|
+
].filter(Boolean).join(" ");
|
|
107
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
108
|
+
showMobileTrigger && /* @__PURE__ */ jsx(
|
|
109
|
+
"button",
|
|
110
|
+
{
|
|
111
|
+
type: "button",
|
|
112
|
+
className: `${baseClass}__mobile-trigger`,
|
|
113
|
+
"aria-label": "Open navigation",
|
|
114
|
+
"aria-expanded": mobileOpen,
|
|
115
|
+
"aria-controls": drawerId,
|
|
116
|
+
onClick: () => setMobileOpen(true),
|
|
117
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", "aria-hidden": "true", children: "menu" })
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
mobileOpen && /* @__PURE__ */ jsx("div", { className: `${baseClass}__scrim`, onClick: closeMobile, "aria-hidden": "true" }),
|
|
121
|
+
/* @__PURE__ */ jsxs("nav", { ref: drawerRef, id: drawerId, className: classes, "aria-label": "App navigation", children: [
|
|
122
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__top`, children: [
|
|
123
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__logo`, children: [
|
|
124
|
+
/* @__PURE__ */ jsxs(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
className: `${baseClass}__logo-inner`,
|
|
128
|
+
onClick: !isExpanded ? toggleExpanded : void 0,
|
|
129
|
+
role: !isExpanded ? "button" : void 0,
|
|
130
|
+
tabIndex: !isExpanded ? 0 : void 0,
|
|
131
|
+
"aria-label": !isExpanded ? "Expand sidebar" : void 0,
|
|
132
|
+
onKeyDown: !isExpanded ? (e) => {
|
|
133
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
toggleExpanded();
|
|
136
|
+
}
|
|
137
|
+
} : void 0,
|
|
138
|
+
style: !isExpanded ? { cursor: "pointer" } : void 0,
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__logo-icon`, children: logo || /* @__PURE__ */ jsx(DefaultLogo, {}) }),
|
|
141
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__logo-text`, children: logoText })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ jsx(
|
|
146
|
+
"button",
|
|
147
|
+
{
|
|
148
|
+
className: `${baseClass}__toggle`,
|
|
149
|
+
onClick: mobileOpen ? closeMobile : toggleExpanded,
|
|
150
|
+
"aria-label": mobileOpen ? "Close navigation" : isExpanded ? "Collapse sidebar" : "Expand sidebar",
|
|
151
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", children: mobileOpen ? "close" : isExpanded ? "left_panel_close" : "left_panel_open" })
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
] }),
|
|
155
|
+
topSlot && /* @__PURE__ */ jsx("div", { className: `${baseClass}__top-slot`, children: topSlot }),
|
|
156
|
+
sections.map((section, si) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__nav`, children: [
|
|
157
|
+
section.category && /* @__PURE__ */ jsx("div", { className: `${baseClass}__category`, children: section.category }),
|
|
158
|
+
section.items.map((item) => {
|
|
159
|
+
const hasChildren = item.children && item.children.length > 0;
|
|
160
|
+
const isOpen = openKeys.has(item.key);
|
|
161
|
+
const isActive = activeKey === item.key;
|
|
162
|
+
const isLink = Boolean(item.href) && !hasChildren;
|
|
163
|
+
const itemClasses = [
|
|
164
|
+
`${baseClass}__btn`,
|
|
165
|
+
isActive ? `${baseClass}__btn--active` : ""
|
|
166
|
+
].filter(Boolean).join(" ");
|
|
167
|
+
const itemContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
168
|
+
/* @__PURE__ */ jsxs("span", { className: `${baseClass}__btn-left`, children: [
|
|
169
|
+
/* @__PURE__ */ jsx(
|
|
170
|
+
"span",
|
|
171
|
+
{
|
|
172
|
+
className: `${baseClass}__btn-icon${typeof item.icon === "string" ? " material-symbols-rounded" : ""}`,
|
|
173
|
+
children: item.icon
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__btn-label`, children: item.label })
|
|
177
|
+
] }),
|
|
178
|
+
item.badge !== void 0 && /* @__PURE__ */ jsx("span", { className: `${baseClass}__btn-badge`, children: item.badge }),
|
|
179
|
+
hasChildren && /* @__PURE__ */ jsx(
|
|
180
|
+
"span",
|
|
181
|
+
{
|
|
182
|
+
className: [
|
|
183
|
+
`${baseClass}__btn-chevron material-symbols-rounded`,
|
|
184
|
+
isOpen ? `${baseClass}__btn-chevron--open` : ""
|
|
185
|
+
].filter(Boolean).join(" "),
|
|
186
|
+
children: "chevron_right"
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] });
|
|
190
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
191
|
+
isLink ? /* @__PURE__ */ jsx(
|
|
192
|
+
"a",
|
|
193
|
+
{
|
|
194
|
+
className: itemClasses,
|
|
195
|
+
href: item.href,
|
|
196
|
+
onClick: () => item.onClick?.(),
|
|
197
|
+
"aria-current": isActive ? "page" : void 0,
|
|
198
|
+
title: !isExpanded ? item.label : void 0,
|
|
199
|
+
children: itemContent
|
|
200
|
+
}
|
|
201
|
+
) : /* @__PURE__ */ jsx(
|
|
202
|
+
"button",
|
|
203
|
+
{
|
|
204
|
+
type: "button",
|
|
205
|
+
className: itemClasses,
|
|
206
|
+
onClick: () => {
|
|
207
|
+
if (hasChildren && isExpanded) {
|
|
208
|
+
toggleAccordion(item.key);
|
|
209
|
+
}
|
|
210
|
+
item.onClick?.();
|
|
211
|
+
},
|
|
212
|
+
"aria-expanded": hasChildren ? isOpen : void 0,
|
|
213
|
+
"aria-current": isActive ? "page" : void 0,
|
|
214
|
+
title: !isExpanded ? item.label : void 0,
|
|
215
|
+
children: itemContent
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
hasChildren && /* @__PURE__ */ jsx(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
className: [
|
|
222
|
+
`${baseClass}__sub-items`,
|
|
223
|
+
isOpen && isExpanded ? `${baseClass}__sub-items--open` : ""
|
|
224
|
+
].filter(Boolean).join(" "),
|
|
225
|
+
children: item.children.map((sub) => {
|
|
226
|
+
const subActive = activeSubKey === sub.key;
|
|
227
|
+
const subClasses = [
|
|
228
|
+
`${baseClass}__sub-btn`,
|
|
229
|
+
subActive ? `${baseClass}__sub-btn--active` : ""
|
|
230
|
+
].filter(Boolean).join(" ");
|
|
231
|
+
const subLabel = /* @__PURE__ */ jsx("span", { className: `${baseClass}__sub-label`, children: sub.label });
|
|
232
|
+
return /* @__PURE__ */ jsxs("div", { className: `${baseClass}__sub-item`, children: [
|
|
233
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__sub-line` }),
|
|
234
|
+
sub.href ? /* @__PURE__ */ jsx(
|
|
235
|
+
"a",
|
|
236
|
+
{
|
|
237
|
+
className: subClasses,
|
|
238
|
+
href: sub.href,
|
|
239
|
+
onClick: sub.onClick,
|
|
240
|
+
"aria-current": subActive ? "page" : void 0,
|
|
241
|
+
children: subLabel
|
|
242
|
+
}
|
|
243
|
+
) : /* @__PURE__ */ jsx(
|
|
244
|
+
"button",
|
|
245
|
+
{
|
|
246
|
+
type: "button",
|
|
247
|
+
className: subClasses,
|
|
248
|
+
onClick: sub.onClick,
|
|
249
|
+
"aria-current": subActive ? "page" : void 0,
|
|
250
|
+
children: subLabel
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
] }, sub.key);
|
|
254
|
+
})
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] }, item.key);
|
|
258
|
+
})
|
|
259
|
+
] }, si))
|
|
260
|
+
] }),
|
|
261
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__bottom`, children: [
|
|
262
|
+
footerSlot && /* @__PURE__ */ jsx("div", { className: `${baseClass}__footer-slot`, children: footerSlot }),
|
|
263
|
+
profile && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__profile`, children: [
|
|
264
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__profile-left`, children: [
|
|
265
|
+
/* @__PURE__ */ jsx(
|
|
266
|
+
Avatar,
|
|
267
|
+
{
|
|
268
|
+
className: `${baseClass}__avatar`,
|
|
269
|
+
size: "md",
|
|
270
|
+
name: profile.name,
|
|
271
|
+
src: profile.avatarUrl
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__profile-info`, children: [
|
|
275
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__profile-name`, children: profile.name }),
|
|
276
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__profile-email`, children: profile.email })
|
|
277
|
+
] })
|
|
278
|
+
] }),
|
|
279
|
+
/* @__PURE__ */ jsx(
|
|
280
|
+
"button",
|
|
281
|
+
{
|
|
282
|
+
className: `${baseClass}__profile-more`,
|
|
283
|
+
onClick: onProfileMore,
|
|
284
|
+
"aria-label": "Profile options",
|
|
285
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", children: "more_horiz" })
|
|
286
|
+
}
|
|
287
|
+
)
|
|
288
|
+
] })
|
|
289
|
+
] })
|
|
290
|
+
] })
|
|
291
|
+
] });
|
|
292
|
+
};
|
|
293
|
+
export {
|
|
294
|
+
AppSidebar
|
|
295
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
AVATAR COMPONENT
|
|
3
|
+
User profile image with initials fallback
|
|
4
|
+
============================================ */
|
|
5
|
+
|
|
6
|
+
.ds-avatar {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
border-radius: var(--radius-pill); /* 999px */
|
|
12
|
+
background-color: var(--color-bg-container-secondary);
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* ============================================
|
|
17
|
+
SIZES
|
|
18
|
+
============================================ */
|
|
19
|
+
|
|
20
|
+
.ds-avatar--sm {
|
|
21
|
+
width: 32px;
|
|
22
|
+
height: 32px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ds-avatar--md {
|
|
26
|
+
width: 40px;
|
|
27
|
+
height: 40px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ds-avatar--lg {
|
|
31
|
+
width: 56px;
|
|
32
|
+
height: 56px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* ============================================
|
|
36
|
+
IMAGE
|
|
37
|
+
============================================ */
|
|
38
|
+
|
|
39
|
+
.ds-avatar__image {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
object-fit: cover;
|
|
43
|
+
display: block;
|
|
44
|
+
border-radius: var(--radius-pill);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* ============================================
|
|
48
|
+
INITIALS FALLBACK
|
|
49
|
+
============================================ */
|
|
50
|
+
|
|
51
|
+
.ds-avatar__initials {
|
|
52
|
+
font-family: var(--font-paragraph-emphasis-family);
|
|
53
|
+
font-weight: var(--font-paragraph-emphasis-weight);
|
|
54
|
+
color: var(--color-text-primary);
|
|
55
|
+
line-height: 1;
|
|
56
|
+
user-select: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ds-avatar--sm .ds-avatar__initials {
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ds-avatar--md .ds-avatar__initials {
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.ds-avatar--lg .ds-avatar__initials {
|
|
68
|
+
font-size: 18px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* ============================================
|
|
72
|
+
ICON FALLBACK
|
|
73
|
+
============================================ */
|
|
74
|
+
|
|
75
|
+
.ds-avatar__icon {
|
|
76
|
+
color: var(--color-icon-secondary);
|
|
77
|
+
line-height: 1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ds-avatar--sm .ds-avatar__icon {
|
|
81
|
+
--icon-size: var(--icon-size-500);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ds-avatar--md .ds-avatar__icon {
|
|
85
|
+
--icon-size: var(--icon-size-600);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.ds-avatar--lg .ds-avatar__icon {
|
|
89
|
+
--icon-size: var(--icon-size-800);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* ============================================
|
|
93
|
+
STATUS INDICATOR
|
|
94
|
+
============================================ */
|
|
95
|
+
|
|
96
|
+
.ds-avatar__status {
|
|
97
|
+
position: absolute;
|
|
98
|
+
bottom: 0;
|
|
99
|
+
right: 0;
|
|
100
|
+
border-radius: var(--radius-pill);
|
|
101
|
+
border: 2px solid var(--color-bg-page-primary);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.ds-avatar--sm .ds-avatar__status {
|
|
105
|
+
width: 10px;
|
|
106
|
+
height: 10px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.ds-avatar--md .ds-avatar__status {
|
|
110
|
+
width: 12px;
|
|
111
|
+
height: 12px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.ds-avatar--lg .ds-avatar__status {
|
|
115
|
+
width: 14px;
|
|
116
|
+
height: 14px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.ds-avatar__status--online {
|
|
120
|
+
background-color: var(--color-status-positive-border);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.ds-avatar__status--away {
|
|
124
|
+
background-color: var(--color-status-warning-border);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.ds-avatar__status--offline {
|
|
128
|
+
background-color: var(--color-bg-container-border);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.ds-avatar__status--busy {
|
|
132
|
+
background-color: var(--color-status-error-border);
|
|
133
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface AvatarProps {
|
|
2
|
+
/** Image source URL */
|
|
3
|
+
src?: string;
|
|
4
|
+
/** Alt text for the image */
|
|
5
|
+
alt?: string;
|
|
6
|
+
/** User's name — used for initials fallback */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** Avatar size */
|
|
9
|
+
size?: 'sm' | 'md' | 'lg';
|
|
10
|
+
/** Online status indicator */
|
|
11
|
+
status?: 'online' | 'away' | 'offline' | 'busy';
|
|
12
|
+
/** Additional CSS classes */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Avatar component for user profile images.
|
|
17
|
+
* Falls back to initials derived from the name prop,
|
|
18
|
+
* or a person icon when neither image nor name is provided.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Avatar: ({ src, alt, name, size, status, className, }: AvatarProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import "./Avatar.css";
|
|
5
|
+
import "../../fonts/material-symbols.css";
|
|
6
|
+
const Avatar = ({
|
|
7
|
+
src,
|
|
8
|
+
alt,
|
|
9
|
+
name,
|
|
10
|
+
size = "md",
|
|
11
|
+
status,
|
|
12
|
+
className = ""
|
|
13
|
+
}) => {
|
|
14
|
+
const [imgError, setImgError] = useState(false);
|
|
15
|
+
const baseClass = "ds-avatar";
|
|
16
|
+
const sizeClass = `${baseClass}--${size}`;
|
|
17
|
+
const classes = [baseClass, sizeClass, className].filter(Boolean).join(" ");
|
|
18
|
+
const getInitials = (fullName) => {
|
|
19
|
+
const parts = fullName.trim().split(/\s+/);
|
|
20
|
+
if (parts.length === 1) return parts[0][0].toUpperCase();
|
|
21
|
+
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
22
|
+
};
|
|
23
|
+
const showImage = src && !imgError;
|
|
24
|
+
const showInitials = !showImage && name;
|
|
25
|
+
const showIcon = !showImage && !name;
|
|
26
|
+
const label = alt || name || "User avatar";
|
|
27
|
+
return /* @__PURE__ */ jsxs("span", { className: classes, role: "img", "aria-label": label, children: [
|
|
28
|
+
showImage && /* @__PURE__ */ jsx(
|
|
29
|
+
"img",
|
|
30
|
+
{
|
|
31
|
+
className: `${baseClass}__image`,
|
|
32
|
+
src,
|
|
33
|
+
alt: alt || name || "",
|
|
34
|
+
onError: () => setImgError(true)
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
showInitials && /* @__PURE__ */ jsx("span", { className: `${baseClass}__initials`, "aria-hidden": "true", children: getInitials(name) }),
|
|
38
|
+
showIcon && /* @__PURE__ */ jsx(
|
|
39
|
+
"span",
|
|
40
|
+
{
|
|
41
|
+
className: `${baseClass}__icon material-symbols-rounded`,
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
children: "person"
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
status && /* @__PURE__ */ jsx(
|
|
47
|
+
"span",
|
|
48
|
+
{
|
|
49
|
+
className: `${baseClass}__status ${baseClass}__status--${status}`,
|
|
50
|
+
role: "img",
|
|
51
|
+
"aria-label": status
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] });
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
Avatar
|
|
58
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-contained demo avatar portraits for docs and stories.
|
|
3
|
+
*
|
|
4
|
+
* The Avatar showcase (website page + Storybook stories) needs sample photos to
|
|
5
|
+
* demonstrate the image state. Pointing at a third-party host (e.g. pravatar.cc)
|
|
6
|
+
* made the docs depend on an external service — when it was rate-limited or
|
|
7
|
+
* blocked, every avatar rendered as a broken image with alt text bleeding
|
|
8
|
+
* through the circle. These inline SVG data URIs render the same everywhere with
|
|
9
|
+
* no network request, so the docs stay self-contained.
|
|
10
|
+
*
|
|
11
|
+
* The pigments are deliberately theme-frozen — the same face must read as the
|
|
12
|
+
* same person in light and dark — so they are literals, not tokens. The first
|
|
13
|
+
* portrait's background snapshots the brand teal primitive.
|
|
14
|
+
*/
|
|
15
|
+
/** Distinct demo portraits so multiple avatars in a row read as different people. */
|
|
16
|
+
export declare const demoAvatar1: string;
|
|
17
|
+
export declare const demoAvatar2: string;
|
|
18
|
+
export declare const demoAvatar3: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const portrait = (bg, accent) => {
|
|
2
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">
|
|
3
|
+
<rect width="96" height="96" fill="${bg}"/>
|
|
4
|
+
<circle cx="48" cy="38" r="17" fill="${accent}"/>
|
|
5
|
+
<path d="M18 84c0-16.6 13.4-30 30-30s30 13.4 30 30z" fill="${accent}"/>
|
|
6
|
+
</svg>`;
|
|
7
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
|
|
8
|
+
};
|
|
9
|
+
const demoAvatar1 = portrait("#0E6E8F", "#8FD3E8");
|
|
10
|
+
const demoAvatar2 = portrait("#C05B8B", "#F3C6DC");
|
|
11
|
+
const demoAvatar3 = portrait("#4E7A3A", "#C7E6B2");
|
|
12
|
+
export {
|
|
13
|
+
demoAvatar1,
|
|
14
|
+
demoAvatar2,
|
|
15
|
+
demoAvatar3
|
|
16
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
AVATAR GROUP COMPONENT
|
|
3
|
+
Overlapping avatar stack with a "+N" counter.
|
|
4
|
+
The pixel size ladder matches Avatar's sizes
|
|
5
|
+
so the counter circle sits flush in the row.
|
|
6
|
+
============================================ */
|
|
7
|
+
|
|
8
|
+
/* Base */
|
|
9
|
+
|
|
10
|
+
.ds-avatar-group {
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* Items — each avatar (and the counter) sits in a ring-bearing wrapper
|
|
16
|
+
so the overlaps stay legible on any surface. */
|
|
17
|
+
|
|
18
|
+
.ds-avatar-group__item {
|
|
19
|
+
position: relative;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
border-radius: var(--radius-pill);
|
|
22
|
+
box-shadow: 0 0 0 var(--border-050) var(--color-bg-page-primary);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ds-avatar-group__item + .ds-avatar-group__item {
|
|
26
|
+
margin-left: calc(var(--gap-200) * -1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Overflow counter */
|
|
30
|
+
|
|
31
|
+
.ds-avatar-group__overflow {
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
background-color: var(--color-bg-container-secondary);
|
|
36
|
+
color: var(--color-text-secondary);
|
|
37
|
+
font-family: var(--font-paragraph-emphasis-family);
|
|
38
|
+
font-weight: var(--font-paragraph-emphasis-weight);
|
|
39
|
+
line-height: 1;
|
|
40
|
+
user-select: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Sizes — matching Avatar's ladder */
|
|
44
|
+
|
|
45
|
+
.ds-avatar-group--sm .ds-avatar-group__overflow {
|
|
46
|
+
width: 32px;
|
|
47
|
+
height: 32px;
|
|
48
|
+
font-size: 12px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.ds-avatar-group--md .ds-avatar-group__overflow {
|
|
52
|
+
width: 40px;
|
|
53
|
+
height: 40px;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ds-avatar-group--lg .ds-avatar-group__overflow {
|
|
58
|
+
width: 56px;
|
|
59
|
+
height: 56px;
|
|
60
|
+
font-size: 18px;
|
|
61
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/** Props owned by AvatarGroup itself — everything else falls through to the root div. */
|
|
3
|
+
type AvatarGroupOwnProps = {
|
|
4
|
+
/** The avatars to stack, in display order — normally `Avatar` elements. */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** Avatars shown before the rest collapse into a "+N" counter. */
|
|
7
|
+
max?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Size applied to every avatar in the stack and to the overflow counter.
|
|
10
|
+
* Cloned onto the children so the group cannot render mixed sizes.
|
|
11
|
+
*/
|
|
12
|
+
size?: 'sm' | 'md' | 'lg';
|
|
13
|
+
/**
|
|
14
|
+
* Accessible label for the overflow counter. Defaults to "N more" —
|
|
15
|
+
* override it to localise or add context, e.g. "4 more reviewers".
|
|
16
|
+
*/
|
|
17
|
+
overflowLabel?: string;
|
|
18
|
+
/** Additional CSS classes */
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
export interface AvatarGroupProps extends AvatarGroupOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof AvatarGroupOwnProps> {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* AvatarGroup — an overlapping stack of avatars with a "+N" counter for the
|
|
25
|
+
* overflow, the "who's here" affordance in collaboration UIs. Purely
|
|
26
|
+
* presentational: it lays out the `Avatar` children it is given (forcing a
|
|
27
|
+
* uniform size onto them) and counts the rest, so it renders from a Server
|
|
28
|
+
* Component. Each avatar carries a page-coloured ring so the overlaps stay
|
|
29
|
+
* legible on any surface.
|
|
30
|
+
*/
|
|
31
|
+
export declare const AvatarGroup: React.ForwardRefExoticComponent<AvatarGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import "./AvatarGroup.css";
|
|
4
|
+
const AvatarGroup = React.forwardRef(
|
|
5
|
+
({ children, max = 5, size = "md", overflowLabel, className = "", ...rest }, ref) => {
|
|
6
|
+
const baseClass = "ds-avatar-group";
|
|
7
|
+
const classes = [baseClass, `${baseClass}--${size}`, className].filter(Boolean).join(" ");
|
|
8
|
+
const allChildren = React.Children.toArray(children);
|
|
9
|
+
const visible = allChildren.slice(0, Math.max(max, 0));
|
|
10
|
+
const overflow = allChildren.length - visible.length;
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, role: "group", children: [
|
|
12
|
+
visible.map((child, index) => /* @__PURE__ */ jsx("span", { className: `${baseClass}__item`, children: React.isValidElement(child) ? React.cloneElement(child, { size }) : child }, index)),
|
|
13
|
+
overflow > 0 && /* @__PURE__ */ jsx(
|
|
14
|
+
"span",
|
|
15
|
+
{
|
|
16
|
+
className: `${baseClass}__item ${baseClass}__overflow`,
|
|
17
|
+
role: "img",
|
|
18
|
+
"aria-label": overflowLabel ?? `${overflow} more`,
|
|
19
|
+
children: /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
|
|
20
|
+
"+",
|
|
21
|
+
overflow
|
|
22
|
+
] })
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
] });
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
AvatarGroup.displayName = "AvatarGroup";
|
|
29
|
+
export {
|
|
30
|
+
AvatarGroup
|
|
31
|
+
};
|