rift-ds 1.9.0 → 1.11.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/README.md +3 -3
- package/behaviors/useFocusScope.d.ts +12 -6
- package/behaviors/useFocusScope.js +12 -2
- package/behaviors/useLayer.d.ts +39 -15
- package/behaviors/useLayer.js +23 -11
- package/bin/templates/chat/app/api/chat/route.ts +3 -0
- package/chat/AssistantTurn.d.ts +18 -1
- package/chat/AssistantTurn.js +25 -5
- package/chat/ChatAgentPane.d.ts +22 -4
- package/chat/ChatAgentPane.js +20 -6
- package/chat/ChatArtifactPane.d.ts +16 -1
- package/chat/ChatArtifactPane.js +12 -10
- package/chat/ChatLauncher.d.ts +12 -5
- package/chat/ChatLauncher.js +3 -1
- package/chat/ChatProvider.d.ts +5 -4
- package/chat/ChatProvider.js +1 -1
- package/chat/ChatTabs.d.ts +6 -1
- package/chat/ChatTabs.js +3 -2
- package/chat/ChatThreads.d.ts +19 -4
- package/chat/ChatThreads.js +22 -3
- package/chat/ChatWidget.css +5 -4
- package/chat/ChatWidget.d.ts +119 -5
- package/chat/ChatWidget.js +159 -70
- package/chat/DemoWelcome.js +17 -5
- package/chat/FollowupSuggestions.d.ts +10 -4
- package/chat/FollowupSuggestions.js +13 -5
- package/chat/ResponseActions.d.ts +14 -0
- package/chat/ResponseActions.js +15 -6
- package/chat/TurnQuestion.d.ts +24 -0
- package/chat/TurnQuestion.js +46 -0
- package/chat/demo-card-components.js +2 -1
- package/chat/demo-script.js +256 -50
- package/chat/followups.d.ts +2 -2
- package/chat/followups.js +1 -0
- package/chat/index.d.ts +3 -2
- package/chat/index.js +11 -0
- package/chat/queries.d.ts +2 -2
- package/chat/queries.js +3 -2
- package/chat/questions.d.ts +97 -0
- package/chat/questions.js +140 -0
- package/chat/registry.json.d.ts +3 -2
- package/chat/registry.json.js +1 -1
- package/chat/server.d.ts +19 -0
- package/chat/server.js +45 -1
- package/chat/sim.d.ts +12 -1
- package/chat/sim.js +19 -3
- package/chat/threads.d.ts +17 -0
- package/chat/threads.js +22 -14
- package/chat/types.d.ts +58 -1
- package/chat/types.js +1 -0
- package/chat/useChat.d.ts +24 -3
- package/chat/useChat.js +42 -4
- package/components/Accordion/Accordion.d.ts +18 -3
- package/components/Accordion/Accordion.js +71 -69
- package/components/AgentPlan/AgentPlan.d.ts +16 -0
- package/components/AgentPlan/AgentPlan.js +8 -3
- package/components/AgentRail/AgentRail.d.ts +24 -4
- package/components/AgentRail/AgentRail.js +13 -6
- package/components/AgentStatus/AgentStatus.css +1 -0
- package/components/AiButton/AiButton.css +3 -1
- package/components/AiButton/AiButton.d.ts +7 -1
- package/components/AiButton/AiButton.js +6 -3
- package/components/Alert/Alert.d.ts +15 -4
- package/components/Alert/Alert.js +46 -40
- package/components/AlertDialog/AlertDialog.css +1 -1
- package/components/AlertDialog/AlertDialog.d.ts +21 -5
- package/components/AlertDialog/AlertDialog.js +34 -15
- package/components/AnchorNav/AnchorNav.css +1 -1
- package/components/AnchorNav/AnchorNav.d.ts +4 -1
- package/components/AnchorNav/AnchorNav.js +8 -8
- package/components/AppLayout/AppLayout.d.ts +10 -2
- package/components/AppLayout/AppLayout.js +55 -42
- package/components/AppSidebar/AppSidebar.css +9 -9
- package/components/AppSidebar/AppSidebar.d.ts +27 -2
- package/components/AppSidebar/AppSidebar.js +30 -15
- package/components/ArtifactPanel/ArtifactPanel.d.ts +3 -0
- package/components/ArtifactPanel/ArtifactPanel.js +6 -5
- package/components/Attachment/Attachment.css +4 -1
- package/components/Attachment/AttachmentGroup.d.ts +6 -0
- package/components/Attachment/AttachmentGroup.js +10 -1
- package/components/Attachment/AttachmentTile.d.ts +2 -0
- package/components/Attachment/AttachmentTile.js +3 -2
- package/components/Attachment/AttachmentViewer.js +4 -4
- package/components/Attachment/fileTypes.d.ts +8 -0
- package/components/Avatar/Avatar.css +3 -3
- package/components/Avatar/Avatar.d.ts +11 -3
- package/components/Avatar/Avatar.js +56 -51
- package/components/AvatarGroup/AvatarGroup.css +3 -3
- package/components/AvatarGroup/AvatarGroup.d.ts +6 -3
- package/components/AvatarGroup/AvatarGroup.js +5 -2
- package/components/Badge/Badge.d.ts +9 -2
- package/components/Badge/Badge.js +10 -10
- package/components/Banner/Banner.d.ts +2 -0
- package/components/Banner/Banner.js +2 -1
- package/components/BentoTile/BentoTile.css +527 -0
- package/components/BentoTile/BentoTile.d.ts +64 -0
- package/components/BentoTile/BentoTile.js +303 -0
- package/components/BentoTile/BentoTileArt.d.ts +28 -0
- package/components/BentoTile/BentoTileArt.js +19 -0
- package/components/BottomNav/BottomNav.css +3 -3
- package/components/BottomNav/BottomNav.d.ts +6 -0
- package/components/BottomNav/BottomNav.js +3 -1
- package/components/Breadcrumb/Breadcrumb.d.ts +16 -5
- package/components/Breadcrumb/Breadcrumb.js +32 -33
- package/components/Button/Button.css +123 -20
- package/components/Button/Button.d.ts +18 -3
- package/components/Button/Button.js +19 -2
- package/components/ButtonGroup/ButtonGroup.d.ts +17 -3
- package/components/ButtonGroup/ButtonGroup.js +24 -24
- package/components/CardStack/CardStack.d.ts +5 -0
- package/components/CardStack/CardStack.js +3 -7
- package/components/Carousel/Carousel.d.ts +33 -3
- package/components/Carousel/Carousel.js +178 -137
- package/components/Chart/AreaChart.d.ts +11 -3
- package/components/Chart/AreaChart.js +20 -11
- package/components/Chart/BarChart.d.ts +11 -3
- package/components/Chart/BarChart.js +19 -9
- package/components/Chart/Chart.css +1 -0
- package/components/Chart/ComboChart.d.ts +11 -3
- package/components/Chart/ComboChart.js +21 -11
- package/components/Chart/LineChart.d.ts +11 -3
- package/components/Chart/LineChart.js +19 -10
- package/components/Chart/PieChart.d.ts +11 -3
- package/components/Chart/PieChart.js +18 -9
- package/components/Chart/RadarChart.d.ts +11 -3
- package/components/Chart/RadarChart.js +20 -11
- package/components/Chart/RadialChart.d.ts +11 -3
- package/components/Chart/RadialChart.js +18 -9
- package/components/Chart/ScatterChart.d.ts +11 -3
- package/components/Chart/ScatterChart.js +23 -11
- package/components/Chart/StackedBarChart.d.ts +11 -3
- package/components/Chart/StackedBarChart.js +19 -10
- package/components/Chart/Treemap.d.ts +13 -3
- package/components/Chart/Treemap.js +23 -13
- package/components/Chart/palette.d.ts +9 -0
- package/components/Chart/palette.js +8 -1
- package/components/Chart/useChartAnimation.d.ts +42 -0
- package/components/Chart/useChartAnimation.js +32 -0
- package/components/ChatMessage/ChatMessage.css +1 -0
- package/components/ChatThread/ChatThread.css +21 -0
- package/components/ChatThread/ChatThread.d.ts +12 -1
- package/components/ChatThread/ChatThread.js +48 -1
- package/components/Checkbox/Checkbox.d.ts +12 -2
- package/components/Checkbox/Checkbox.js +13 -3
- package/components/Chip/Chip.css +24 -1
- package/components/Chip/Chip.d.ts +28 -7
- package/components/Chip/Chip.js +80 -64
- package/components/CircularButton/CircularButton.css +127 -1
- package/components/CircularButton/CircularButton.d.ts +18 -4
- package/components/CircularButton/CircularButton.js +14 -2
- package/components/CodeBlock/CodeBlock.d.ts +24 -3
- package/components/CodeBlock/CodeBlock.js +93 -80
- package/components/CodeDiff/CodeDiff.d.ts +30 -4
- package/components/CodeDiff/CodeDiff.js +64 -20
- package/components/ColorPicker/ColorPicker.css +1 -1
- package/components/ColorPicker/ColorPicker.d.ts +18 -0
- package/components/ColorPicker/ColorPicker.js +27 -21
- package/components/ColourSwatch/ColourSwatch.css +1 -1
- package/components/Combobox/Combobox.css +2 -1
- package/components/Combobox/Combobox.d.ts +26 -8
- package/components/Combobox/Combobox.js +30 -17
- package/components/CommandPalette/CommandPalette.css +13 -1
- package/components/CommandPalette/CommandPalette.d.ts +27 -4
- package/components/CommandPalette/CommandPalette.js +108 -70
- package/components/Composer/Composer.css +2 -1
- package/components/Composer/Composer.d.ts +10 -0
- package/components/Composer/Composer.js +7 -0
- package/components/ContactCard/ContactCard.css +1 -1
- package/components/ContactCard/ContactCard.d.ts +34 -5
- package/components/ContactCard/ContactCard.js +72 -58
- package/components/ContextMenu/ContextMenu.css +4 -4
- package/components/ContextMenu/ContextMenu.js +7 -10
- package/components/ContributionGraph/ContributionGraph.d.ts +37 -3
- package/components/ContributionGraph/ContributionGraph.js +32 -31
- package/components/DataTable/DataTable.d.ts +29 -0
- package/components/DataTable/DataTable.js +15 -10
- package/components/DateInput/DateInput.js +2 -2
- package/components/DatePicker/DatePicker.css +19 -4
- package/components/DatePicker/DatePicker.d.ts +31 -0
- package/components/DatePicker/DatePicker.js +145 -61
- package/components/Dialog/Dialog.css +1 -1
- package/components/Dialog/Dialog.d.ts +2 -0
- package/components/Dialog/Dialog.js +4 -3
- package/components/Divider/Divider.d.ts +10 -2
- package/components/Divider/Divider.js +56 -25
- package/components/DocumentChip/DocumentChip.d.ts +3 -1
- package/components/DocumentChip/DocumentChip.js +3 -2
- package/components/Drawer/Drawer.css +2 -1
- package/components/Drawer/Drawer.d.ts +2 -0
- package/components/Drawer/Drawer.js +4 -3
- package/components/Dropdown/Dropdown.css +1 -1
- package/components/Dropdown/Dropdown.d.ts +9 -2
- package/components/Dropdown/Dropdown.js +26 -16
- package/components/DropdownMenu/DropdownMenu.css +5 -5
- package/components/DropdownMenu/DropdownMenu.d.ts +13 -4
- package/components/DropdownMenu/DropdownMenu.js +41 -22
- package/components/EmptyState/EmptyState.d.ts +12 -4
- package/components/EmptyState/EmptyState.js +30 -26
- package/components/EntityCard/EntityCard.d.ts +7 -2
- package/components/EntityCard/EntityCard.js +19 -21
- package/components/EventCalendar/EventCalendar.d.ts +28 -0
- package/components/EventCalendar/EventCalendar.js +29 -27
- package/components/Figure/Figure.d.ts +14 -5
- package/components/Figure/Figure.js +19 -21
- package/components/FileInput/FileInput.d.ts +6 -0
- package/components/FileInput/FileInput.js +9 -9
- package/components/FilterBar/FilterBar.css +3 -3
- package/components/FilterBar/FilterBar.d.ts +6 -1
- package/components/FilterBar/FilterBar.js +15 -11
- package/components/FunnelChart/FunnelChart.d.ts +13 -1
- package/components/FunnelChart/FunnelChart.js +8 -1
- package/components/GanttChart/GanttChart.css +1 -1
- package/components/GanttChart/GanttChart.d.ts +19 -2
- package/components/GanttChart/GanttChart.js +17 -8
- package/components/Gauge/Gauge.d.ts +4 -1
- package/components/Globe/Globe.css +23 -0
- package/components/Globe/Globe.d.ts +19 -2
- package/components/Globe/Globe.js +66 -19
- package/components/HoverCard/HoverCard.css +1 -1
- package/components/HoverCard/HoverCard.d.ts +4 -1
- package/components/HoverCard/HoverCard.js +26 -15
- package/components/ImageCompare/ImageCompare.d.ts +4 -0
- package/components/ImageCompare/ImageCompare.js +4 -2
- package/components/Input/Input.js +2 -2
- package/components/Inspector/Inspector.css +55 -38
- package/components/Inspector/InspectorDropdown.d.ts +6 -1
- package/components/Inspector/InspectorDropdown.js +2 -0
- package/components/Inspector/InspectorSegmentedControl.d.ts +4 -3
- package/components/Inspector/InspectorSegmentedControl.js +63 -11
- package/components/Inspector/InspectorToggleSwitch.d.ts +4 -3
- package/components/Inspector/InspectorToggleSwitch.js +35 -2
- package/components/Instructions/Instructions.css +1 -1
- package/components/Instructions/Instructions.d.ts +16 -5
- package/components/Instructions/Instructions.js +31 -26
- package/components/InterruptCard/InterruptCard.d.ts +13 -2
- package/components/InterruptCard/InterruptCard.js +9 -7
- package/components/Lightbox/Lightbox.css +1 -1
- package/components/Lightbox/Lightbox.d.ts +8 -0
- package/components/Lightbox/Lightbox.js +10 -6
- package/components/LinkList/LinkList.css +2 -2
- package/components/LinkList/LinkList.d.ts +11 -2
- package/components/LinkList/LinkList.js +40 -36
- package/components/Mention/Mention.d.ts +4 -1
- package/components/MessageActions/MessageActions.css +8 -0
- package/components/MessageActions/MessageActions.d.ts +2 -0
- package/components/MessageActions/MessageActions.js +2 -1
- package/components/MessageCard/MessageCard.d.ts +4 -1
- package/components/Meter/Meter.d.ts +5 -1
- package/components/ModelPicker/ModelPicker.css +2 -2
- package/components/ModelPicker/ModelPicker.d.ts +12 -1
- package/components/ModelPicker/ModelPicker.js +27 -16
- package/components/MotionSwatch/MotionSwatch.d.ts +3 -1
- package/components/MotionSwatch/MotionSwatch.js +2 -1
- package/components/Nav/Nav.d.ts +2 -2
- package/components/Nav/Nav.js +17 -21
- package/components/NavList/NavList.d.ts +4 -0
- package/components/NavList/NavList.js +3 -1
- package/components/NotificationCenter/NotificationCenter.css +1 -1
- package/components/NotificationCenter/NotificationCenter.d.ts +48 -5
- package/components/NotificationCenter/NotificationCenter.js +32 -15
- package/components/NumberInput/NumberInput.d.ts +4 -0
- package/components/NumberInput/NumberInput.js +4 -2
- package/components/Pagination/Pagination.d.ts +33 -7
- package/components/Pagination/Pagination.js +67 -55
- package/components/PinInput/PinInput.d.ts +6 -0
- package/components/PinInput/PinInput.js +3 -1
- package/components/Popover/Popover.css +1 -1
- package/components/Popover/Popover.d.ts +21 -5
- package/components/Popover/Popover.js +102 -97
- package/components/ProgressBar/ProgressBar.d.ts +10 -3
- package/components/ProgressBar/ProgressBar.js +34 -22
- package/components/PromptSuggestions/PromptSuggestions.css +67 -0
- package/components/PromptSuggestions/PromptSuggestions.d.ts +10 -0
- package/components/PromptSuggestions/PromptSuggestions.js +41 -26
- package/components/QuestionCard/QuestionCard.css +358 -0
- package/components/QuestionCard/QuestionCard.d.ts +138 -0
- package/components/QuestionCard/QuestionCard.js +378 -0
- package/components/Quote/Quote.d.ts +8 -3
- package/components/Quote/Quote.js +18 -21
- package/components/RadioButton/RadioButton.d.ts +6 -1
- package/components/RadioButton/RadioButton.js +7 -2
- package/components/Rating/Rating.d.ts +6 -0
- package/components/Rating/Rating.js +4 -2
- package/components/Reasoning/Reasoning.css +1 -0
- package/components/Reasoning/Reasoning.d.ts +7 -1
- package/components/Reasoning/Reasoning.js +4 -1
- package/components/RichDropdown/RichDropdown.css +1 -1
- package/components/RichDropdown/RichDropdown.d.ts +3 -1
- package/components/RichDropdown/RichDropdown.js +20 -15
- package/components/SectionTitle/SectionTitle.d.ts +15 -3
- package/components/SectionTitle/SectionTitle.js +15 -17
- package/components/SegmentedControl/SegmentedControl.css +3 -2
- package/components/SegmentedControl/SegmentedControl.d.ts +49 -7
- package/components/SegmentedControl/SegmentedControl.js +248 -223
- package/components/SelectionCard/SelectionCard.d.ts +7 -1
- package/components/SelectionCard/SelectionCard.js +16 -2
- package/components/ShaderField/ShaderField.js +2 -1
- package/components/ShaderField/useShaderField.js +3 -2
- package/components/SidebarPanel/SidebarPanel.d.ts +6 -1
- package/components/SidebarPanel/SidebarPanel.js +2 -1
- package/components/Skeleton/Skeleton.d.ts +12 -3
- package/components/Skeleton/Skeleton.js +53 -19
- package/components/Slider/Slider.d.ts +11 -2
- package/components/Slider/Slider.js +11 -6
- package/components/SourceChip/SourceChip.css +1 -1
- package/components/SourceChip/SourceChip.d.ts +5 -2
- package/components/SourceChip/SourceChip.js +14 -13
- package/components/SourceTrail/SourceTrail.d.ts +15 -0
- package/components/SourceTrail/SourceTrail.js +10 -4
- package/components/Sparkline/Sparkline.d.ts +4 -3
- package/components/Sparkline/Sparkline.js +2 -1
- package/components/Spinner/Spinner.d.ts +21 -4
- package/components/Spinner/Spinner.js +38 -37
- package/components/SplitButton/SplitButton.d.ts +10 -1
- package/components/SplitButton/SplitButton.js +13 -3
- package/components/Stat/Stat.d.ts +7 -2
- package/components/Stat/Stat.js +30 -25
- package/components/StatusDot/StatusDot.css +1 -0
- package/components/Stepper/Stepper.css +13 -0
- package/components/Stepper/Stepper.d.ts +6 -0
- package/components/Stepper/Stepper.js +2 -0
- package/components/StreamingText/StreamingText.d.ts +4 -4
- package/components/StreamingText/StreamingText.js +3 -2
- package/components/Tabs/Tabs.d.ts +41 -6
- package/components/Tabs/Tabs.js +99 -69
- package/components/TagInput/TagInput.d.ts +2 -0
- package/components/TagInput/TagInput.js +7 -2
- package/components/Textarea/Textarea.d.ts +6 -1
- package/components/Textarea/Textarea.js +11 -5
- package/components/ThreadPanel/ThreadPanel.css +1 -1
- package/components/ThreadPanel/ThreadPanel.d.ts +11 -4
- package/components/ThreadPanel/ThreadPanel.js +3 -1
- package/components/ThreadTabs/ThreadTabs.d.ts +7 -2
- package/components/ThreadTabs/ThreadTabs.js +1 -1
- package/components/TimePicker/TimePicker.css +1 -1
- package/components/TimePicker/TimePicker.d.ts +14 -1
- package/components/TimePicker/TimePicker.js +22 -17
- package/components/Timeline/Timeline.css +2 -2
- package/components/Timeline/Timeline.d.ts +11 -2
- package/components/Timeline/Timeline.js +37 -26
- package/components/Toast/Toast.css +2 -2
- package/components/Toast/Toast.d.ts +24 -6
- package/components/Toast/Toast.js +50 -41
- package/components/ToggleGroup/ToggleGroup.css +3 -2
- package/components/ToggleGroup/ToggleGroup.d.ts +26 -4
- package/components/ToggleGroup/ToggleGroup.js +12 -5
- package/components/ToggleSwitch/ToggleSwitch.d.ts +6 -1
- package/components/ToggleSwitch/ToggleSwitch.js +7 -2
- package/components/ToolCall/ToolCall.js +1 -1
- package/components/Tooltip/Tooltip.css +5 -5
- package/components/Tooltip/Tooltip.d.ts +15 -4
- package/components/Tooltip/Tooltip.js +80 -61
- package/components/TopAppBar/TopAppBar.css +1 -1
- package/components/TopAppBar/TopAppBar.d.ts +9 -1
- package/components/TopAppBar/TopAppBar.js +3 -1
- package/components/TypographySwatch/TypographySwatch.css +1 -1
- package/components/UsageCard/UsageCard.d.ts +4 -1
- package/components/Waveform/Waveform.css +1 -0
- package/components/Waveform/Waveform.d.ts +1 -1
- package/components/WorldMap/WorldMap.d.ts +12 -0
- package/components/WorldMap/WorldMap.js +11 -5
- package/components/registry.json +44 -19
- package/components/registry.json.d.ts +44 -19
- package/components/registry.json.js +1 -1
- package/index.d.ts +3 -0
- package/index.js +7 -0
- package/package.json +5 -1
- package/tokens/breakpoints.d.ts +60 -0
- package/tokens/breakpoints.js +92 -0
- package/tokens/motion.d.ts +14 -0
- package/tokens/motion.js +15 -1
- package/tokens/registry.d.ts +1 -1
- package/tokens/registry.json +21 -0
- package/tokens/registry.json.d.ts +21 -0
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +7 -0
- package/tokens/tokens-light.css +41 -0
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
|
|
117
117
|
/* Align dot markers with the title's line box */
|
|
118
118
|
.ds-timeline--vertical .ds-timeline__marker {
|
|
119
|
-
margin-top: 6px;
|
|
119
|
+
margin-top: 6px; /* ds-allow(spacing): centres the dot on the title's first line box */
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
.ds-timeline--vertical .ds-timeline__marker--badge,
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
|
|
316
316
|
.ds-timeline__role-bullets {
|
|
317
317
|
margin: 0;
|
|
318
|
-
padding-left:
|
|
318
|
+
padding-left: var(--padding-500);
|
|
319
319
|
list-style: disc;
|
|
320
320
|
display: flex;
|
|
321
321
|
flex-direction: column;
|
|
@@ -54,14 +54,23 @@ export interface TimelineCompanyProps {
|
|
|
54
54
|
variant: 'company';
|
|
55
55
|
/** Ordered list of company/tool entries */
|
|
56
56
|
items: TimelineCompany[];
|
|
57
|
+
/** Text shown in place of the end date for a role marked `present` */
|
|
58
|
+
presentLabel?: string;
|
|
57
59
|
/** Additional CSS classes */
|
|
58
60
|
className?: string;
|
|
59
61
|
}
|
|
60
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Timeline props: one of the two variants' own props, plus the native `<ol>`
|
|
64
|
+
* attributes, which reach the list in both variants.
|
|
65
|
+
*/
|
|
66
|
+
export type TimelineProps = (TimelineDefaultProps | TimelineCompanyProps) & Omit<React.ComponentPropsWithoutRef<'ol'>, keyof TimelineDefaultProps | keyof TimelineCompanyProps | 'children'>;
|
|
61
67
|
/**
|
|
62
68
|
* Timeline component — an ordered sequence of steps or events with
|
|
63
69
|
* connected markers. Vertical for histories and process narratives,
|
|
64
70
|
* horizontal for compact steppers. The `company` variant groups one or
|
|
65
71
|
* more roles under a logo marker for résumé/pipeline histories.
|
|
72
|
+
*
|
|
73
|
+
* The forwarded ref and any unrecognised props target the `<ol>` in both
|
|
74
|
+
* variants.
|
|
66
75
|
*/
|
|
67
|
-
export declare const Timeline:
|
|
76
|
+
export declare const Timeline: React.ForwardRefExoticComponent<TimelineProps & React.RefAttributes<HTMLOListElement>>;
|
|
@@ -1,40 +1,50 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
2
|
+
import React from "react";
|
|
3
3
|
import "./Timeline.css";
|
|
4
4
|
import "../../fonts/material-symbols.css";
|
|
5
5
|
const BASE_CLASS = "ds-timeline";
|
|
6
|
-
const renderRoleDates = (role) => {
|
|
6
|
+
const renderRoleDates = (role, presentLabel) => {
|
|
7
7
|
if (!role.start) return null;
|
|
8
8
|
return /* @__PURE__ */ jsxs("span", { className: `${BASE_CLASS}__role-dates`, children: [
|
|
9
9
|
role.start,
|
|
10
10
|
" –",
|
|
11
11
|
" ",
|
|
12
|
-
role.present ? /* @__PURE__ */ jsx("span", { className: `${BASE_CLASS}__present`, children:
|
|
12
|
+
role.present ? /* @__PURE__ */ jsx("span", { className: `${BASE_CLASS}__present`, children: presentLabel }) : role.end
|
|
13
13
|
] });
|
|
14
14
|
};
|
|
15
|
-
const CompanyTimeline = (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/* @__PURE__ */ jsxs("
|
|
20
|
-
/* @__PURE__ */ jsx("span", { className: `${BASE_CLASS}
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
15
|
+
const CompanyTimeline = React.forwardRef(
|
|
16
|
+
// `variant` is the discriminant, not an <ol> attribute, so it is held back from the spread.
|
|
17
|
+
({ variant: _variant, items, presentLabel = "Present", className = "", ...rest }, ref) => {
|
|
18
|
+
const classes = [BASE_CLASS, `${BASE_CLASS}--vertical`, `${BASE_CLASS}--company`, className].filter(Boolean).join(" ");
|
|
19
|
+
return /* @__PURE__ */ jsx("ol", { ...rest, ref, className: classes, children: items.map((company, index) => /* @__PURE__ */ jsxs("li", { className: `${BASE_CLASS}__item`, children: [
|
|
20
|
+
/* @__PURE__ */ jsx("span", { className: `${BASE_CLASS}__marker ${BASE_CLASS}__marker--logo`, "aria-hidden": "true", children: company.logo }),
|
|
21
|
+
/* @__PURE__ */ jsxs("div", { className: `${BASE_CLASS}__content`, children: [
|
|
22
|
+
/* @__PURE__ */ jsx("span", { className: `${BASE_CLASS}__company-name`, children: company.name }),
|
|
23
|
+
/* @__PURE__ */ jsx("div", { className: `${BASE_CLASS}__roles`, children: company.roles.map((role, roleIndex) => /* @__PURE__ */ jsxs("div", { className: `${BASE_CLASS}__role`, children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("div", { className: `${BASE_CLASS}__role-header`, children: [
|
|
25
|
+
/* @__PURE__ */ jsx("h3", { className: `${BASE_CLASS}__role-title`, children: role.title }),
|
|
26
|
+
renderRoleDates(role, presentLabel)
|
|
27
|
+
] }),
|
|
28
|
+
role.subtitle && /* @__PURE__ */ jsx("p", { className: `${BASE_CLASS}__role-subtitle`, children: role.subtitle }),
|
|
29
|
+
role.description && /* @__PURE__ */ jsx("p", { className: `${BASE_CLASS}__role-description`, children: role.description }),
|
|
30
|
+
role.bullets && role.bullets.length > 0 && /* @__PURE__ */ jsx("ul", { className: `${BASE_CLASS}__role-bullets`, children: role.bullets.map((bullet, bulletIndex) => /* @__PURE__ */ jsx("li", { children: bullet }, bulletIndex)) })
|
|
31
|
+
] }, `${role.title}-${roleIndex}`)) })
|
|
32
|
+
] })
|
|
33
|
+
] }, `${company.name}-${index}`)) });
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
CompanyTimeline.displayName = "CompanyTimeline";
|
|
37
|
+
const Timeline = React.forwardRef(({
|
|
38
|
+
orientation = "vertical",
|
|
39
|
+
numbered = false,
|
|
40
|
+
presentLabel = "Present",
|
|
41
|
+
className = "",
|
|
42
|
+
...props
|
|
43
|
+
}, ref) => {
|
|
34
44
|
if (props.variant === "company") {
|
|
35
|
-
return /* @__PURE__ */ jsx(CompanyTimeline, { ...props });
|
|
45
|
+
return /* @__PURE__ */ jsx(CompanyTimeline, { ...props, presentLabel, className, ref });
|
|
36
46
|
}
|
|
37
|
-
const {
|
|
47
|
+
const { variant: _variant, items, ...rest } = props;
|
|
38
48
|
const classes = [
|
|
39
49
|
BASE_CLASS,
|
|
40
50
|
`${BASE_CLASS}--${orientation}`,
|
|
@@ -53,7 +63,7 @@ const Timeline = (props) => {
|
|
|
53
63
|
}
|
|
54
64
|
return null;
|
|
55
65
|
};
|
|
56
|
-
return /* @__PURE__ */ jsx("ol", { className: classes, children: items.map((item, index) => /* @__PURE__ */ jsxs("li", { className: `${BASE_CLASS}__item`, children: [
|
|
66
|
+
return /* @__PURE__ */ jsx("ol", { ...rest, ref, className: classes, children: items.map((item, index) => /* @__PURE__ */ jsxs("li", { className: `${BASE_CLASS}__item`, children: [
|
|
57
67
|
/* @__PURE__ */ jsx(
|
|
58
68
|
"span",
|
|
59
69
|
{
|
|
@@ -67,7 +77,8 @@ const Timeline = (props) => {
|
|
|
67
77
|
item.description && /* @__PURE__ */ jsx("div", { className: `${BASE_CLASS}__description`, children: item.description })
|
|
68
78
|
] })
|
|
69
79
|
] }, `${item.title}-${index}`)) });
|
|
70
|
-
};
|
|
80
|
+
});
|
|
81
|
+
Timeline.displayName = "Timeline";
|
|
71
82
|
export {
|
|
72
83
|
Timeline
|
|
73
84
|
};
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
.ds-toast-container {
|
|
19
19
|
position: fixed;
|
|
20
|
-
z-index: var(--ds-toast-z,
|
|
20
|
+
z-index: var(--ds-toast-z, var(--layer-toast));
|
|
21
21
|
display: flex;
|
|
22
22
|
flex-direction: column;
|
|
23
23
|
gap: var(--gap-200); /* 8px */
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
height: 3px;
|
|
171
171
|
width: 100%;
|
|
172
172
|
transform-origin: left;
|
|
173
|
-
animation: ds-toast-progress linear forwards;
|
|
173
|
+
animation: ds-toast-progress var(--motion-ease-linear) forwards;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/* ============================================
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
2
|
export interface ToastData {
|
|
3
3
|
/** Unique ID (auto-generated if not provided) */
|
|
4
4
|
id?: string;
|
|
@@ -22,6 +22,10 @@ export interface ToastProviderProps {
|
|
|
22
22
|
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
|
|
23
23
|
/** Maximum number of visible toasts */
|
|
24
24
|
maxToasts?: number;
|
|
25
|
+
/** Accessible name of the toast stack's region landmark */
|
|
26
|
+
regionLabel?: string;
|
|
27
|
+
/** Accessible name of every toast's dismiss button */
|
|
28
|
+
dismissLabel?: string;
|
|
25
29
|
}
|
|
26
30
|
export interface ToastContextValue {
|
|
27
31
|
/** Add a toast */
|
|
@@ -41,23 +45,37 @@ export declare const useToast: () => ToastContextValue;
|
|
|
41
45
|
* toast context. Renders a fixed container that stacks
|
|
42
46
|
* toast notifications.
|
|
43
47
|
*/
|
|
44
|
-
export declare const ToastProvider: ({ children, position, maxToasts, }: ToastProviderProps) =>
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
export declare const ToastProvider: ({ children, position, maxToasts, regionLabel, dismissLabel, }: ToastProviderProps) => React.JSX.Element;
|
|
49
|
+
/** Props owned by the standalone Toast itself — everything else falls through to its `role="status"` `<div>`. */
|
|
50
|
+
type ToastOwnProps = {
|
|
51
|
+
/**
|
|
52
|
+
* Toast title text.
|
|
53
|
+
* Note: this shadows the native `title` tooltip attribute, which Toast does not expose.
|
|
54
|
+
*/
|
|
47
55
|
title?: string;
|
|
48
56
|
/** Toast description / body text */
|
|
49
57
|
description?: string;
|
|
50
58
|
/** Toast variant */
|
|
51
59
|
variant?: 'info' | 'positive' | 'warning' | 'error' | 'neutral';
|
|
52
|
-
/** Whether the toast can be manually dismissed */
|
|
60
|
+
/** Whether the toast can be manually dismissed. The dismiss button renders only when `onDismiss` is also given */
|
|
53
61
|
dismissible?: boolean;
|
|
54
62
|
/** Custom icon override — Material Symbol name (string) or custom element (ReactNode) */
|
|
55
63
|
icon?: string | React.ReactNode;
|
|
64
|
+
/** Fires when the dismiss button is pressed. The button renders only when this is given (and `dismissible` is not false); the host owns removing the toast */
|
|
65
|
+
onDismiss?: () => void;
|
|
66
|
+
/** Accessible name of the dismiss button */
|
|
67
|
+
dismissLabel?: string;
|
|
56
68
|
/** Additional CSS classes */
|
|
57
69
|
className?: string;
|
|
70
|
+
};
|
|
71
|
+
export interface ToastProps extends ToastOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof ToastOwnProps | 'role' | 'children'> {
|
|
58
72
|
}
|
|
59
73
|
/**
|
|
60
74
|
* Standalone Toast component for static display.
|
|
61
75
|
* For dynamic toast notifications, use ToastProvider + useToast.
|
|
76
|
+
*
|
|
77
|
+
* The forwarded ref and any unrecognised props target the `role="status"`
|
|
78
|
+
* `<div>`.
|
|
62
79
|
*/
|
|
63
|
-
export declare const Toast:
|
|
80
|
+
export declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useSyncExternalStore, useCallback, useContext, createContext, useRef, useEffect } from "react";
|
|
3
|
+
import React, { useState, useSyncExternalStore, useCallback, useContext, createContext, useRef, useEffect } from "react";
|
|
4
4
|
import { MOTION_AUTO_DISMISS_MS, MOTION_EXIT_SYNC_MS } from "../../tokens/motion.js";
|
|
5
5
|
import ReactDOM from "react-dom";
|
|
6
6
|
import "./Toast.css";
|
|
@@ -31,6 +31,7 @@ const ToastItem = ({
|
|
|
31
31
|
dismissible,
|
|
32
32
|
icon,
|
|
33
33
|
duration,
|
|
34
|
+
dismissLabel,
|
|
34
35
|
onDismiss
|
|
35
36
|
}) => {
|
|
36
37
|
const [exiting, setExiting] = useState(false);
|
|
@@ -87,7 +88,7 @@ const ToastItem = ({
|
|
|
87
88
|
type: "button",
|
|
88
89
|
className: `${baseClass}__dismiss`,
|
|
89
90
|
onClick: handleDismiss,
|
|
90
|
-
"aria-label":
|
|
91
|
+
"aria-label": dismissLabel,
|
|
91
92
|
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", "aria-hidden": "true", children: "close" })
|
|
92
93
|
}
|
|
93
94
|
),
|
|
@@ -108,7 +109,9 @@ const ToastItem = ({
|
|
|
108
109
|
const ToastProvider = ({
|
|
109
110
|
children,
|
|
110
111
|
position = "bottom-right",
|
|
111
|
-
maxToasts = 5
|
|
112
|
+
maxToasts = 5,
|
|
113
|
+
regionLabel = "Notifications",
|
|
114
|
+
dismissLabel = "Dismiss notification"
|
|
112
115
|
}) => {
|
|
113
116
|
const [toasts, setToasts] = useState([]);
|
|
114
117
|
const mounted = useSyncExternalStore(emptySubscribe, () => true, () => false);
|
|
@@ -149,7 +152,7 @@ const ToastProvider = ({
|
|
|
149
152
|
{
|
|
150
153
|
className: containerClasses,
|
|
151
154
|
role: "region",
|
|
152
|
-
"aria-label":
|
|
155
|
+
"aria-label": regionLabel,
|
|
153
156
|
"aria-live": "polite",
|
|
154
157
|
children: toasts.map((t) => /* @__PURE__ */ jsx(
|
|
155
158
|
ToastItem,
|
|
@@ -161,6 +164,7 @@ const ToastProvider = ({
|
|
|
161
164
|
dismissible: t.dismissible ?? true,
|
|
162
165
|
icon: t.icon,
|
|
163
166
|
duration: t.duration ?? MOTION_AUTO_DISMISS_MS,
|
|
167
|
+
dismissLabel,
|
|
164
168
|
onDismiss: dismiss
|
|
165
169
|
},
|
|
166
170
|
t.id
|
|
@@ -171,43 +175,48 @@ const ToastProvider = ({
|
|
|
171
175
|
)
|
|
172
176
|
] });
|
|
173
177
|
};
|
|
174
|
-
const Toast = (
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
178
|
+
const Toast = React.forwardRef(
|
|
179
|
+
({
|
|
180
|
+
title,
|
|
181
|
+
description,
|
|
182
|
+
variant = "info",
|
|
183
|
+
dismissible = true,
|
|
184
|
+
icon,
|
|
185
|
+
onDismiss,
|
|
186
|
+
dismissLabel = "Dismiss notification",
|
|
187
|
+
className = "",
|
|
188
|
+
...rest
|
|
189
|
+
}, ref) => {
|
|
190
|
+
const baseClass = "ds-toast";
|
|
191
|
+
const iconName = icon || defaultIcons[variant];
|
|
192
|
+
const classes = [baseClass, `${baseClass}--${variant}`, className].filter(Boolean).join(" ");
|
|
193
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: classes, role: "status", children: [
|
|
194
|
+
/* @__PURE__ */ jsx(
|
|
195
|
+
"span",
|
|
196
|
+
{
|
|
197
|
+
className: `${baseClass}__icon${typeof iconName === "string" ? " material-symbols-rounded" : ""}`,
|
|
198
|
+
"aria-hidden": "true",
|
|
199
|
+
children: iconName
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__content`, children: [
|
|
203
|
+
title && /* @__PURE__ */ jsx("p", { className: `${baseClass}__title`, children: title }),
|
|
204
|
+
description && /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, children: description })
|
|
205
|
+
] }),
|
|
206
|
+
dismissible && onDismiss && /* @__PURE__ */ jsx(
|
|
207
|
+
"button",
|
|
208
|
+
{
|
|
209
|
+
type: "button",
|
|
210
|
+
className: `${baseClass}__dismiss`,
|
|
211
|
+
onClick: () => onDismiss(),
|
|
212
|
+
"aria-label": dismissLabel,
|
|
213
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", "aria-hidden": "true", children: "close" })
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
] });
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
Toast.displayName = "Toast";
|
|
211
220
|
export {
|
|
212
221
|
Toast,
|
|
213
222
|
ToastProvider,
|
|
@@ -63,9 +63,10 @@
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/* ============================================
|
|
66
|
-
NEUTRAL
|
|
66
|
+
NEUTRAL TONE (tone="neutral"; the legacy
|
|
67
|
+
variant="neutral" keeps this class)
|
|
67
68
|
Active items fill grey instead of the action
|
|
68
|
-
|
|
69
|
+
colour — for sets where the selection should
|
|
69
70
|
not carry the action colour's weight.
|
|
70
71
|
============================================ */
|
|
71
72
|
|
|
@@ -11,13 +11,32 @@ export interface ToggleGroupItem {
|
|
|
11
11
|
type ToggleGroupOwnProps = {
|
|
12
12
|
/** Available items */
|
|
13
13
|
items: ToggleGroupItem[];
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Currently active value(s), controlled. Leave undefined to let the group
|
|
16
|
+
* keep its own selection, seeded from `defaultValue`.
|
|
17
|
+
*/
|
|
15
18
|
value?: string | string[];
|
|
16
|
-
/**
|
|
19
|
+
/** Active value(s) on first render when uncontrolled (`value` undefined). */
|
|
20
|
+
defaultValue?: string | string[];
|
|
21
|
+
/**
|
|
22
|
+
* Allow multiple selection, where each item toggles on or off. Without it
|
|
23
|
+
* exactly one item is active once chosen, and pressing it again keeps it.
|
|
24
|
+
*/
|
|
17
25
|
multiple?: boolean;
|
|
18
26
|
/** Component size */
|
|
19
27
|
size?: 'default' | 'compact';
|
|
20
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Colour of active items: `default` takes the action colour, `neutral`
|
|
30
|
+
* fills them grey, for a set whose selection should not carry the action
|
|
31
|
+
* colour's weight.
|
|
32
|
+
*/
|
|
33
|
+
tone?: 'default' | 'neutral';
|
|
34
|
+
/**
|
|
35
|
+
* Legacy name for `tone`, from before colour moved onto its own prop:
|
|
36
|
+
* `primary` is `tone="default"`.
|
|
37
|
+
*
|
|
38
|
+
* @deprecated Use `tone` instead.
|
|
39
|
+
*/
|
|
21
40
|
variant?: 'primary' | 'neutral';
|
|
22
41
|
/** Whether the whole group is disabled */
|
|
23
42
|
disabled?: boolean;
|
|
@@ -41,7 +60,10 @@ type ToggleGroupOwnProps = {
|
|
|
41
60
|
export interface ToggleGroupProps extends ToggleGroupOwnProps, Omit<React.ComponentPropsWithoutRef<'div'>, keyof ToggleGroupOwnProps> {
|
|
42
61
|
}
|
|
43
62
|
/**
|
|
44
|
-
* ToggleGroup is a set of
|
|
63
|
+
* ToggleGroup is a set of pressable buttons. By default it is single
|
|
64
|
+
* selection: pressing an item makes it the one active item, and pressing the
|
|
65
|
+
* active item again keeps it active. With `multiple`, each item toggles on or
|
|
66
|
+
* off independently.
|
|
45
67
|
*
|
|
46
68
|
* Forwards a ref to the wrapping group element and spreads unrecognised props
|
|
47
69
|
* onto it.
|
|
@@ -5,10 +5,12 @@ import "./ToggleGroup.css";
|
|
|
5
5
|
const ToggleGroup = React.forwardRef(
|
|
6
6
|
({
|
|
7
7
|
items,
|
|
8
|
-
value
|
|
8
|
+
value,
|
|
9
|
+
defaultValue = [],
|
|
9
10
|
multiple = false,
|
|
10
11
|
size = "default",
|
|
11
|
-
|
|
12
|
+
tone,
|
|
13
|
+
variant,
|
|
12
14
|
disabled = false,
|
|
13
15
|
onValueChange,
|
|
14
16
|
onChange,
|
|
@@ -17,15 +19,20 @@ const ToggleGroup = React.forwardRef(
|
|
|
17
19
|
...rest
|
|
18
20
|
}, ref) => {
|
|
19
21
|
const baseClass = "ds-toggle-group";
|
|
22
|
+
const resolvedTone = tone ?? (variant === "neutral" ? "neutral" : "default");
|
|
20
23
|
const classes = [
|
|
21
24
|
baseClass,
|
|
22
25
|
`${baseClass}--${size}`,
|
|
23
|
-
`${baseClass}--${
|
|
26
|
+
`${baseClass}--${resolvedTone === "neutral" ? "neutral" : "primary"}`,
|
|
24
27
|
disabled ? `${baseClass}--disabled` : "",
|
|
25
28
|
className
|
|
26
29
|
].filter(Boolean).join(" ");
|
|
27
|
-
const
|
|
30
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
31
|
+
const isControlled = value !== void 0;
|
|
32
|
+
const currentValue = isControlled ? value : internalValue;
|
|
33
|
+
const activeValues = Array.isArray(currentValue) ? currentValue : [currentValue];
|
|
28
34
|
const emit = (next) => {
|
|
35
|
+
if (!isControlled) setInternalValue(next);
|
|
29
36
|
onValueChange?.(next);
|
|
30
37
|
onChange?.(next);
|
|
31
38
|
};
|
|
@@ -45,7 +52,7 @@ const ToggleGroup = React.forwardRef(
|
|
|
45
52
|
ref,
|
|
46
53
|
className: classes,
|
|
47
54
|
role: "group",
|
|
48
|
-
"aria-label":
|
|
55
|
+
"aria-label": rest["aria-label"] ?? ariaLabel,
|
|
49
56
|
children: items.map((item) => {
|
|
50
57
|
const isActive = activeValues.includes(item.value);
|
|
51
58
|
const btnClass = [`${baseClass}__item`, isActive ? `${baseClass}__item--active` : ""].filter(Boolean).join(" ");
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
/** Props owned by ToggleSwitch itself — everything else falls through to the <button>. */
|
|
3
3
|
type ToggleSwitchOwnProps = {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Whether the toggle is on, controlled. Leave undefined to let the switch
|
|
6
|
+
* keep its own state, seeded from `defaultChecked`.
|
|
7
|
+
*/
|
|
5
8
|
checked?: boolean;
|
|
9
|
+
/** Whether the toggle starts on when uncontrolled (`checked` undefined). Defaults to true, so an uncontrolled switch starts on unless this is false. */
|
|
10
|
+
defaultChecked?: boolean;
|
|
6
11
|
/** Label text displayed next to the toggle */
|
|
7
12
|
label?: string;
|
|
8
13
|
/** Whether to show the label */
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import React, { useId } from "react";
|
|
3
|
+
import React, { useState, useId } from "react";
|
|
4
4
|
import "./ToggleSwitch.css";
|
|
5
5
|
import "../../fonts/material-symbols.css";
|
|
6
6
|
const ToggleSwitch = React.forwardRef(
|
|
7
7
|
({
|
|
8
|
-
checked
|
|
8
|
+
checked: checkedProp,
|
|
9
|
+
defaultChecked = true,
|
|
9
10
|
label = "Toggle",
|
|
10
11
|
showLabel = true,
|
|
11
12
|
helperText,
|
|
@@ -20,6 +21,9 @@ const ToggleSwitch = React.forwardRef(
|
|
|
20
21
|
...rest
|
|
21
22
|
}, ref) => {
|
|
22
23
|
const baseClass = "ds-toggle-switch";
|
|
24
|
+
const [internalChecked, setInternalChecked] = useState(defaultChecked);
|
|
25
|
+
const isControlled = checkedProp !== void 0;
|
|
26
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
23
27
|
const generatedId = useId();
|
|
24
28
|
const helperId = helperText ? `${generatedId}-helper` : void 0;
|
|
25
29
|
const describedBy = helperId ?? rest["aria-describedby"];
|
|
@@ -35,6 +39,7 @@ const ToggleSwitch = React.forwardRef(
|
|
|
35
39
|
const handleClick = (e) => {
|
|
36
40
|
onClick?.(e);
|
|
37
41
|
if (disabled) return;
|
|
42
|
+
if (!isControlled) setInternalChecked(!checked);
|
|
38
43
|
onCheckedChange?.(!checked);
|
|
39
44
|
onChange?.(!checked);
|
|
40
45
|
};
|
|
@@ -50,7 +50,7 @@ const ToolCall = React.forwardRef(
|
|
|
50
50
|
className
|
|
51
51
|
].filter(Boolean).join(" ");
|
|
52
52
|
const header = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53
|
-
/* @__PURE__ */ jsx("span", { className: `${baseClass}__indicator`, "aria-hidden": "true", children: status === "running" ? /* @__PURE__ */ jsx(Spinner, { size: "sm",
|
|
53
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__indicator`, "aria-hidden": "true", children: status === "running" ? /* @__PURE__ */ jsx(Spinner, { size: "sm", tone: "inherit" }) : /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", children: STATUS_ICONS[status] }) }),
|
|
54
54
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__name`, children: name }),
|
|
55
55
|
summary && /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary`, children: summary }),
|
|
56
56
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__status`, children: statusLabel ?? DEFAULT_STATUS_LABELS[status] }),
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
.ds-tooltip__panel {
|
|
16
16
|
position: absolute;
|
|
17
|
-
z-index:
|
|
17
|
+
z-index: var(--layer-floating);
|
|
18
18
|
padding: var(--padding-150) var(--padding-200); /* 6px 8px */
|
|
19
19
|
border-radius: var(--radius-100); /* 4px */
|
|
20
20
|
/* The floating surface, same recipe as Popover: page background (the
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
.ds-tooltip__panel--top .ds-tooltip__arrow {
|
|
143
143
|
bottom: -5px;
|
|
144
144
|
left: 50%;
|
|
145
|
-
margin-left: -4px;
|
|
145
|
+
margin-left: -4px; /* ds-allow(spacing): half the 8px arrow, centring it on the panel edge */
|
|
146
146
|
border-right: var(--border-025) solid var(--color-bg-container-border);
|
|
147
147
|
border-bottom: var(--border-025) solid var(--color-bg-container-border);
|
|
148
148
|
}
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
.ds-tooltip__panel--bottom .ds-tooltip__arrow {
|
|
152
152
|
top: -5px;
|
|
153
153
|
left: 50%;
|
|
154
|
-
margin-left: -4px;
|
|
154
|
+
margin-left: -4px; /* ds-allow(spacing): half the 8px arrow */
|
|
155
155
|
border-top: var(--border-025) solid var(--color-bg-container-border);
|
|
156
156
|
border-left: var(--border-025) solid var(--color-bg-container-border);
|
|
157
157
|
}
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
.ds-tooltip__panel--left .ds-tooltip__arrow {
|
|
161
161
|
right: -5px;
|
|
162
162
|
top: 50%;
|
|
163
|
-
margin-top: -4px;
|
|
163
|
+
margin-top: -4px; /* ds-allow(spacing): half the 8px arrow */
|
|
164
164
|
border-top: var(--border-025) solid var(--color-bg-container-border);
|
|
165
165
|
border-right: var(--border-025) solid var(--color-bg-container-border);
|
|
166
166
|
}
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
.ds-tooltip__panel--right .ds-tooltip__arrow {
|
|
170
170
|
left: -5px;
|
|
171
171
|
top: 50%;
|
|
172
|
-
margin-top: -4px;
|
|
172
|
+
margin-top: -4px; /* ds-allow(spacing): half the 8px arrow */
|
|
173
173
|
border-bottom: var(--border-025) solid var(--color-bg-container-border);
|
|
174
174
|
border-left: var(--border-025) solid var(--color-bg-container-border);
|
|
175
175
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
type TooltipOwnProps = {
|
|
3
3
|
/** Trigger element */
|
|
4
4
|
children?: ReactNode;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Tooltip text content. Replaces the native `content` attribute, which only
|
|
7
|
+
* means something on a `<meta>` element.
|
|
8
|
+
*/
|
|
6
9
|
content: string;
|
|
7
10
|
/** Preferred position */
|
|
8
11
|
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -12,11 +15,19 @@ export interface TooltipProps {
|
|
|
12
15
|
hideDelay?: number;
|
|
13
16
|
/** Additional CSS classes */
|
|
14
17
|
className?: string;
|
|
18
|
+
};
|
|
19
|
+
export interface TooltipProps extends TooltipOwnProps, Omit<React.ComponentPropsWithoutRef<'span'>, keyof TooltipOwnProps> {
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
17
22
|
* Tooltip component for contextual text labels.
|
|
18
23
|
* Appears on hover or focus with a short delay.
|
|
19
24
|
* Rides the system's floating surface — page background, hairline border,
|
|
20
25
|
* floating shadow — so the bubble stays light in light theme and dark in dark.
|
|
26
|
+
*
|
|
27
|
+
* A visible tooltip is a layer on the shared dismissal stack
|
|
28
|
+
* (src/behaviors/useLayer): Escape hides it wherever focus is (WCAG 1.4.13),
|
|
29
|
+
* and hides only it, so inside a Dialog the first Escape clears the tooltip
|
|
30
|
+
* and the second closes the Dialog.
|
|
21
31
|
*/
|
|
22
|
-
export declare const Tooltip:
|
|
32
|
+
export declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLSpanElement>>;
|
|
33
|
+
export {};
|