rift-ds 1.31.0 → 1.32.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 +1 -1
- package/behaviors/chat-card.css +4 -1
- package/behaviors/deferComponent.d.ts +43 -0
- package/behaviors/deferComponent.js +35 -0
- package/bin/templates/blocks/components/blocks/AppShell.module.css +10 -1
- package/chat/ChatLauncher.d.ts +9 -1
- package/chat/ChatLauncher.js +51 -33
- package/chat/ChatWidget.css +13 -4
- package/chat/ChatWidget.js +15 -15
- package/chat/deferredChatWidget.d.ts +10 -0
- package/chat/deferredChatWidget.js +10 -0
- package/chat/index.d.ts +1 -0
- package/chat/index.js +2 -0
- package/chat/registry.json.d.ts +2 -1
- package/chat/registry.json.js +1 -1
- package/components/Accordion/Accordion.css +8 -0
- package/components/AgentPlan/AgentPlan.css +8 -0
- package/components/AgentRail/AgentRail.css +3 -3
- package/components/AiButton/AiButton.css +19 -0
- package/components/AiButton/AiButton.d.ts +10 -1
- package/components/AiButton/AiButton.js +6 -1
- package/components/ArtifactPanel/ArtifactPanel.js +5 -5
- package/components/Attachment/AttachmentViewer.js +7 -7
- package/components/BentoTile/BentoTile.css +1 -1
- package/components/BentoTile/BentoTile.js +5 -5
- package/components/Button/Button.css +28 -1
- package/components/Button/Button.d.ts +7 -2
- package/components/Button/Button.js +7 -3
- package/components/ChatHeader/ChatHeader.d.ts +1 -1
- package/components/ChatThread/ChatThread.css +1 -1
- package/components/Chip/Chip.css +26 -0
- package/components/CircularButton/CircularButton.d.ts +16 -96
- package/components/CircularButton/CircularButton.js +11 -94
- package/components/Combobox/Combobox.css +12 -0
- package/components/CommandPalette/CommandPalette.css +1 -1
- package/components/CommandPalette/CommandPalette.js +3 -3
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.css +9 -0
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.d.ts +10 -2
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.js +7 -2
- package/components/Composer/Composer.css +3 -3
- package/components/Composer/Composer.js +9 -9
- package/components/ContextMenu/ContextMenu.css +24 -0
- package/components/DataTable/DataTable.css +2 -2
- package/components/DataTable/DataTable.js +15 -15
- package/components/DateInput/DateInput.css +20 -0
- package/components/DescriptionList/DescriptionListCopy.d.ts +1 -1
- package/components/DescriptionList/DescriptionListCopy.js +3 -3
- package/components/Dialog/Dialog.css +1 -1
- package/components/Dialog/Dialog.js +3 -3
- package/components/DocumentChip/DocumentChip.css +12 -0
- package/components/DocumentViewer/DocumentViewer.js +10 -10
- package/components/Drawer/Drawer.css +1 -1
- package/components/Drawer/Drawer.js +3 -3
- package/components/Dropdown/Dropdown.css +30 -0
- package/components/DropdownMenu/DropdownMenu.css +24 -0
- package/components/FileInput/FileInput.css +9 -0
- package/components/FilterBar/FilterBar.css +12 -0
- package/components/{CircularButton/CircularButton.css → IconButton/IconButton.css} +91 -81
- package/components/IconButton/IconButton.d.ts +108 -0
- package/components/IconButton/IconButton.js +101 -0
- package/components/Input/Input.css +53 -0
- package/components/Input/Input.js +3 -3
- package/components/MaskedInput/MaskedInput.js +3 -3
- package/components/ModelPicker/ModelPicker.css +12 -1
- package/components/NavList/NavList.css +1 -1
- package/components/Pagination/Pagination.css +1 -1
- package/components/QuestionCard/QuestionCard.js +3 -3
- package/components/RadioButton/RadioButton.css +14 -12
- package/components/RichDropdown/RichDropdown.css +7 -0
- package/components/SegmentedControl/SegmentedControl.css +16 -5
- package/components/SegmentedControl/SegmentedControl.js +7 -4
- package/components/SiteHeader/SiteHeader.css +12 -5
- package/components/SiteHeader/SiteHeader.js +3 -3
- package/components/SourceTrail/SourceTrail.css +8 -0
- package/components/SplitButton/SplitButton.css +14 -14
- package/components/SplitButton/SplitButton.js +3 -3
- package/components/TableToolbar/TableToolbar.css +2 -2
- package/components/TableToolbar/TableToolbar.js +36 -37
- package/components/ThreadPanel/ThreadPanel.css +8 -0
- package/components/ThreadTabs/ThreadTabs.css +7 -0
- package/components/TimePicker/TimePicker.css +12 -0
- package/components/ToolCall/ToolCall.css +8 -0
- package/components/Tooltip/Tooltip.js +3 -2
- package/components/WorldMap/WorldMap.js +5 -5
- package/components/registry.d.ts +3 -1
- package/components/registry.json +19 -10
- package/components/registry.json.d.ts +19 -10
- package/components/registry.json.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/package.json +6 -2
|
@@ -8,6 +8,7 @@ import { AgentStatusMark } from "../AgentStatus/AgentStatus.js";
|
|
|
8
8
|
import { PromptSuggestions } from "../PromptSuggestions/PromptSuggestions.js";
|
|
9
9
|
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
10
10
|
import { StreamingText } from "../StreamingText/StreamingText.js";
|
|
11
|
+
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
11
12
|
import { MOTION_FEEDBACK_RESET_MS, MOTION_SUMMARY_THINK_MS, MOTION_SUMMARY_REVEAL_MS, MOTION_HOVER_EXIT_GRACE_MS, MOTION_HOVER_SHOW_DELAY_MS } from "../../tokens/motion.js";
|
|
12
13
|
import "../../behaviors/visually-hidden.css";
|
|
13
14
|
import "./AiButton.css";
|
|
@@ -27,6 +28,8 @@ const AiButton = React.forwardRef(
|
|
|
27
28
|
label = "Ask AI",
|
|
28
29
|
icon = "auto_awesome",
|
|
29
30
|
iconOnly = false,
|
|
31
|
+
tooltip,
|
|
32
|
+
tooltipPosition = "top",
|
|
30
33
|
size = "default",
|
|
31
34
|
disabled,
|
|
32
35
|
state: status,
|
|
@@ -187,7 +190,7 @@ const AiButton = React.forwardRef(
|
|
|
187
190
|
) }),
|
|
188
191
|
/* @__PURE__ */ jsx("span", { className: iconOnly ? "ds-visually-hidden" : `${baseClass}__text`, children: label })
|
|
189
192
|
] });
|
|
190
|
-
const
|
|
193
|
+
const bareControl = href && !disabled ? /* @__PURE__ */ jsx(
|
|
191
194
|
Link,
|
|
192
195
|
{
|
|
193
196
|
...rest,
|
|
@@ -215,6 +218,8 @@ const AiButton = React.forwardRef(
|
|
|
215
218
|
children: content
|
|
216
219
|
}
|
|
217
220
|
);
|
|
221
|
+
const tooltipContent = !iconOnly || summary || tooltip === false ? null : tooltip ?? label;
|
|
222
|
+
const control = tooltipContent ? /* @__PURE__ */ jsx(Tooltip, { content: tooltipContent, position: tooltipPosition, children: bareControl }) : bareControl;
|
|
218
223
|
const announcer = status !== void 0 ? /* @__PURE__ */ jsx("span", { className: "ds-visually-hidden", role: "status", children: { ...DEFAULT_STATUS_LABELS, ...statusLabels }[status] }) : null;
|
|
219
224
|
const requestPanel = request ? /* @__PURE__ */ jsx(
|
|
220
225
|
"aside",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import React, { useId, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
5
5
|
import { CodeBlock } from "../CodeBlock/CodeBlock.js";
|
|
6
6
|
import { SegmentedControl } from "../SegmentedControl/SegmentedControl.js";
|
|
7
7
|
import "./ArtifactPanel.css";
|
|
@@ -80,22 +80,22 @@ const ArtifactPanel = React.forwardRef(
|
|
|
80
80
|
),
|
|
81
81
|
actions,
|
|
82
82
|
onExpandedChange && /* @__PURE__ */ jsx(
|
|
83
|
-
|
|
83
|
+
IconButton,
|
|
84
84
|
{
|
|
85
85
|
icon: expanded ? "collapse_content" : "expand_content",
|
|
86
86
|
variant: "tertiary",
|
|
87
|
-
|
|
87
|
+
label: expanded ? collapseLabel : expandLabel,
|
|
88
88
|
tooltipPosition: "bottom",
|
|
89
89
|
"aria-pressed": expanded,
|
|
90
90
|
onClick: () => onExpandedChange(!expanded)
|
|
91
91
|
}
|
|
92
92
|
),
|
|
93
93
|
onClose && /* @__PURE__ */ jsx(
|
|
94
|
-
|
|
94
|
+
IconButton,
|
|
95
95
|
{
|
|
96
96
|
icon: "close",
|
|
97
97
|
variant: "tertiary",
|
|
98
|
-
|
|
98
|
+
label: closeLabel,
|
|
99
99
|
tooltipPosition: "bottom",
|
|
100
100
|
onClick: onClose
|
|
101
101
|
}
|
|
@@ -3,7 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useId, useRef, useState } from "react";
|
|
4
4
|
import ReactDOM from "react-dom";
|
|
5
5
|
import { Button } from "../Button/Button.js";
|
|
6
|
-
import {
|
|
6
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
7
7
|
import { formatBytes } from "./fileTypes.js";
|
|
8
8
|
import { DocumentViewer } from "../DocumentViewer/DocumentViewer.js";
|
|
9
9
|
import { renderTypeMark } from "./typeMark.js";
|
|
@@ -181,12 +181,12 @@ const AttachmentViewer = React.forwardRef(
|
|
|
181
181
|
}
|
|
182
182
|
),
|
|
183
183
|
dismissible && /* @__PURE__ */ jsx(
|
|
184
|
-
|
|
184
|
+
IconButton,
|
|
185
185
|
{
|
|
186
186
|
icon: "close",
|
|
187
187
|
variant: "tertiary",
|
|
188
188
|
size: "compact",
|
|
189
|
-
|
|
189
|
+
label: closeLabel,
|
|
190
190
|
tooltip: false,
|
|
191
191
|
onClick: () => onOpenChange(false)
|
|
192
192
|
}
|
|
@@ -195,26 +195,26 @@ const AttachmentViewer = React.forwardRef(
|
|
|
195
195
|
/* @__PURE__ */ jsx("div", { className: `${baseClass}__stage`, children: stage }),
|
|
196
196
|
total > 1 && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__footer`, children: [
|
|
197
197
|
/* @__PURE__ */ jsx(
|
|
198
|
-
|
|
198
|
+
IconButton,
|
|
199
199
|
{
|
|
200
200
|
icon: "chevron_left",
|
|
201
201
|
variant: "secondary",
|
|
202
202
|
tone: "neutral",
|
|
203
203
|
size: "compact",
|
|
204
|
-
|
|
204
|
+
label: previousLabel,
|
|
205
205
|
tooltip: false,
|
|
206
206
|
onClick: () => step(-1)
|
|
207
207
|
}
|
|
208
208
|
),
|
|
209
209
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__position`, "aria-live": "polite", children: positionText }),
|
|
210
210
|
/* @__PURE__ */ jsx(
|
|
211
|
-
|
|
211
|
+
IconButton,
|
|
212
212
|
{
|
|
213
213
|
icon: "chevron_right",
|
|
214
214
|
variant: "secondary",
|
|
215
215
|
tone: "neutral",
|
|
216
216
|
size: "compact",
|
|
217
|
-
|
|
217
|
+
label: nextLabel,
|
|
218
218
|
tooltip: false,
|
|
219
219
|
onClick: () => step(1)
|
|
220
220
|
}
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
|
|
365
365
|
/* The handle sits on the content inset, centred on the heading's first
|
|
366
366
|
line, so it reads as part of the heading row whatever the type scale.
|
|
367
|
-
32px is
|
|
367
|
+
32px is IconButton's compact size. */
|
|
368
368
|
.ds-bento-tile__toggle {
|
|
369
369
|
position: absolute;
|
|
370
370
|
top: calc(var(--_inset) + (var(--font-heading-2-line-height) - 32px) / 2);
|
|
@@ -3,7 +3,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useState, useRef, useId, useCallback, useLayoutEffect } from "react";
|
|
4
4
|
import ReactDOM, { flushSync } from "react-dom";
|
|
5
5
|
import "./BentoTile.css";
|
|
6
|
-
import {
|
|
6
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
7
7
|
import { ShaderField } from "../ShaderField/ShaderField.js";
|
|
8
8
|
import { BentoTileArt } from "./BentoTileArt.js";
|
|
9
9
|
import { useMounted } from "../../behaviors/useMounted.js";
|
|
@@ -192,14 +192,14 @@ const BentoTile = React.forwardRef(
|
|
|
192
192
|
expandable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
193
193
|
/* @__PURE__ */ jsx("span", { className: `${base}__hit`, onClick: openOverlay, "aria-hidden": "true" }),
|
|
194
194
|
/* @__PURE__ */ jsx(
|
|
195
|
-
|
|
195
|
+
IconButton,
|
|
196
196
|
{
|
|
197
197
|
ref: triggerRef,
|
|
198
198
|
icon: "open_in_full",
|
|
199
199
|
variant: awake ? "primary" : "secondary",
|
|
200
200
|
tone: awake ? void 0 : "neutral",
|
|
201
201
|
size: "compact",
|
|
202
|
-
|
|
202
|
+
label,
|
|
203
203
|
tooltip: false,
|
|
204
204
|
"aria-haspopup": "dialog",
|
|
205
205
|
"aria-expanded": open,
|
|
@@ -276,14 +276,14 @@ function BentoTileOverlay({ title, titleId, panelName, toggleName, closeLabel, o
|
|
|
276
276
|
style: { viewTransitionName: panelName },
|
|
277
277
|
children: [
|
|
278
278
|
/* @__PURE__ */ jsx(
|
|
279
|
-
|
|
279
|
+
IconButton,
|
|
280
280
|
{
|
|
281
281
|
ref: closeRef,
|
|
282
282
|
icon: "close_fullscreen",
|
|
283
283
|
variant: "secondary",
|
|
284
284
|
tone: "neutral",
|
|
285
285
|
size: "compact",
|
|
286
|
-
|
|
286
|
+
label: closeLabel,
|
|
287
287
|
tooltip: false,
|
|
288
288
|
className: "ds-bento-tile-overlay__close",
|
|
289
289
|
onClick: onClose,
|
|
@@ -64,6 +64,33 @@
|
|
|
64
64
|
padding-block: 0;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/* ============================================
|
|
68
|
+
ICON SIDE PADDING
|
|
69
|
+
An icon's box carries its own side bearing, so
|
|
70
|
+
beside a label the icon's edge reads one step
|
|
71
|
+
wider than the text's at the same padding. The
|
|
72
|
+
icon side takes the step below: 20 → 16 at
|
|
73
|
+
default, 12 → 8 at compact. The spinner in the
|
|
74
|
+
leading slot counts as an icon. An icon-only
|
|
75
|
+
button keeps its even padding.
|
|
76
|
+
============================================ */
|
|
77
|
+
|
|
78
|
+
.ds-button--icon-start {
|
|
79
|
+
padding-inline-start: var(--padding-400);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ds-button--icon-end {
|
|
83
|
+
padding-inline-end: var(--padding-400);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ds-button--compact.ds-button--icon-start {
|
|
87
|
+
padding-inline-start: var(--padding-200);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ds-button--compact.ds-button--icon-end {
|
|
91
|
+
padding-inline-end: var(--padding-200);
|
|
92
|
+
}
|
|
93
|
+
|
|
67
94
|
.ds-button--compact .ds-button__icon {
|
|
68
95
|
/* Figma: compact icons are 20px (vs 24px default). */
|
|
69
96
|
--icon-size: var(--ds-button-icon-size, var(--icon-size-500));
|
|
@@ -558,7 +585,7 @@
|
|
|
558
585
|
|
|
559
586
|
/* The spinner is a box, not a glyph: left inline in the icon slot, it sits
|
|
560
587
|
on the text baseline and the strut's descender pushes it above centre.
|
|
561
|
-
Flex centres it geometrically — the same fix as
|
|
588
|
+
Flex centres it geometrically — the same fix as IconButton's loading
|
|
562
589
|
icon. */
|
|
563
590
|
.ds-button--loading .ds-button__icon {
|
|
564
591
|
display: inline-flex;
|
|
@@ -36,6 +36,12 @@ type ButtonOwnProps = {
|
|
|
36
36
|
tone?: 'default' | 'neutral' | 'destructive';
|
|
37
37
|
/** Button size */
|
|
38
38
|
size?: 'default' | 'compact';
|
|
39
|
+
/**
|
|
40
|
+
* Draws the button holding only its icon, on an even box. The label stays
|
|
41
|
+
* as its accessible name. For an icon action that also names itself on
|
|
42
|
+
* hover, use IconButton, which wears a tooltip.
|
|
43
|
+
*/
|
|
44
|
+
iconOnly?: boolean;
|
|
39
45
|
/** Whether the button is disabled */
|
|
40
46
|
disabled?: boolean;
|
|
41
47
|
/**
|
|
@@ -93,8 +99,7 @@ type ButtonOwnProps = {
|
|
|
93
99
|
/**
|
|
94
100
|
* Legacy toggle for showing the text label.
|
|
95
101
|
*
|
|
96
|
-
* @deprecated
|
|
97
|
-
* an icon-only button will simply omit `label`.
|
|
102
|
+
* @deprecated Use `iconOnly`, the spelling the button family shares.
|
|
98
103
|
*/
|
|
99
104
|
text?: boolean;
|
|
100
105
|
};
|
|
@@ -33,6 +33,7 @@ const Button = React.forwardRef(
|
|
|
33
33
|
variant,
|
|
34
34
|
tone,
|
|
35
35
|
size = "default",
|
|
36
|
+
iconOnly = false,
|
|
36
37
|
disabled,
|
|
37
38
|
loading,
|
|
38
39
|
glass,
|
|
@@ -45,7 +46,7 @@ const Button = React.forwardRef(
|
|
|
45
46
|
priority,
|
|
46
47
|
state,
|
|
47
48
|
icon,
|
|
48
|
-
text = true,
|
|
49
|
+
text: textProp = true,
|
|
49
50
|
...rest
|
|
50
51
|
}, ref) => {
|
|
51
52
|
const baseClass = "ds-button";
|
|
@@ -57,10 +58,13 @@ const Button = React.forwardRef(
|
|
|
57
58
|
);
|
|
58
59
|
}
|
|
59
60
|
const label = labelProp ?? childText ?? "Button";
|
|
61
|
+
const text = textProp && !iconOnly;
|
|
60
62
|
const resolvedVariant = resolveButtonCell(variant ?? priority ?? "primary", tone);
|
|
61
63
|
const isDisabled = disabled ?? state === "disabled";
|
|
62
64
|
const resolvedState = state ?? (isDisabled ? "disabled" : "default");
|
|
63
65
|
const isLoading = Boolean(loading);
|
|
66
|
+
const spinnerSize = size === "compact" ? "sm" : "md";
|
|
67
|
+
const leftIcon = isLoading ? /* @__PURE__ */ jsx(Spinner, { size: spinnerSize, tone: "inherit" }) : iconLeft || icon;
|
|
64
68
|
const classes = [
|
|
65
69
|
baseClass,
|
|
66
70
|
`${baseClass}--${resolvedVariant}`,
|
|
@@ -68,11 +72,11 @@ const Button = React.forwardRef(
|
|
|
68
72
|
`${baseClass}--${size}`,
|
|
69
73
|
isLoading && `${baseClass}--loading`,
|
|
70
74
|
glass && `${baseClass}--glass`,
|
|
75
|
+
text && label && leftIcon && `${baseClass}--icon-start`,
|
|
76
|
+
text && label && iconRight && `${baseClass}--icon-end`,
|
|
71
77
|
className
|
|
72
78
|
].filter(Boolean).join(" ");
|
|
73
79
|
const iconClass = "material-symbols-rounded";
|
|
74
|
-
const spinnerSize = size === "compact" ? "sm" : "md";
|
|
75
|
-
const leftIcon = isLoading ? /* @__PURE__ */ jsx(Spinner, { size: spinnerSize, tone: "inherit" }) : iconLeft || icon;
|
|
76
80
|
const renderIcon = (iconProp, position) => {
|
|
77
81
|
const positionClass = position === "right" ? ` ${baseClass}__icon--right` : "";
|
|
78
82
|
if (typeof iconProp === "string") {
|
|
@@ -8,7 +8,7 @@ type ChatHeaderOwnProps = {
|
|
|
8
8
|
*/
|
|
9
9
|
title?: React.ReactNode;
|
|
10
10
|
/**
|
|
11
|
-
* Trailing controls: a new-chat
|
|
11
|
+
* Trailing controls: a new-chat IconButton, a view switcher, a close
|
|
12
12
|
* button. The slot only lays them out — each control owns its behaviour.
|
|
13
13
|
*/
|
|
14
14
|
actions?: React.ReactNode;
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
display: flex;
|
|
124
124
|
align-items: center;
|
|
125
125
|
justify-content: center;
|
|
126
|
-
/* The send button's exact footprint —
|
|
126
|
+
/* The send button's exact footprint — IconButton's default size,
|
|
127
127
|
a raw value there too (icon-button sizes are not on a token scale). */
|
|
128
128
|
width: 40px;
|
|
129
129
|
height: 40px;
|
package/components/Chip/Chip.css
CHANGED
|
@@ -73,6 +73,32 @@
|
|
|
73
73
|
padding: var(--padding-050) var(--padding-200); /* 2px 8px */
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/* ============================================
|
|
77
|
+
ICON SIDE PADDING
|
|
78
|
+
Button's rule: beside the label an icon's box
|
|
79
|
+
carries its own side bearing, so a side that
|
|
80
|
+
holds the leading icon or the remove glyph
|
|
81
|
+
takes the step below the text side (12 → 8,
|
|
82
|
+
large 20 → 16). Compact stays at 8, the floor: closer, the glyph
|
|
83
|
+
sits in the pill's cap.
|
|
84
|
+
============================================ */
|
|
85
|
+
|
|
86
|
+
.ds-chip:has(.ds-chip__icon) {
|
|
87
|
+
padding-inline-start: var(--padding-200);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ds-chip:has(.ds-chip__remove) {
|
|
91
|
+
padding-inline-end: var(--padding-200);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.ds-chip--large:has(.ds-chip__icon) {
|
|
95
|
+
padding-inline-start: var(--padding-400);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ds-chip--large:has(.ds-chip__remove) {
|
|
99
|
+
padding-inline-end: var(--padding-400);
|
|
100
|
+
}
|
|
101
|
+
|
|
76
102
|
/* ============================================
|
|
77
103
|
ICON (leading)
|
|
78
104
|
============================================ */
|
|
@@ -1,103 +1,23 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
variant?: 'primary' | 'secondary' | 'tertiary' | 'neutral';
|
|
13
|
-
/**
|
|
14
|
-
* Colour, independent of emphasis: `default` carries the action colour,
|
|
15
|
-
* `neutral` the greys, `destructive` the danger colour. Tertiary is
|
|
16
|
-
* already grey, so `neutral` leaves it unchanged; a tertiary
|
|
17
|
-
* `destructive` takes the outlined look, since a danger action needs a
|
|
18
|
-
* visible edge.
|
|
19
|
-
*/
|
|
20
|
-
tone?: 'default' | 'neutral' | 'destructive';
|
|
21
|
-
/**
|
|
22
|
-
* Legacy alias for `variant`.
|
|
23
|
-
*
|
|
24
|
-
* @deprecated Use `variant` instead.
|
|
25
|
-
*/
|
|
26
|
-
priority?: 'primary' | 'secondary' | 'tertiary';
|
|
27
|
-
/** Whether the button is disabled */
|
|
28
|
-
disabled?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Documentation-only interaction state.
|
|
31
|
-
*
|
|
32
|
-
* @deprecated Use `disabled` for the disabled state.
|
|
33
|
-
*
|
|
34
|
-
* Documentation-only affordance for rendering a *static* interaction state in
|
|
35
|
-
* Storybook and the showcase site. Real hover/active styling comes from CSS
|
|
36
|
-
* pseudo-classes and needs no prop — for docs, prefer
|
|
37
|
-
* `className="ds-circular-button--hover"`.
|
|
38
|
-
*/
|
|
39
|
-
state?: 'default' | 'hover' | 'active' | 'disabled';
|
|
40
|
-
/** Button size */
|
|
41
|
-
size?: 'default' | 'compact';
|
|
42
|
-
/**
|
|
43
|
-
* Shows a spinner in place of the icon and blocks interaction while an
|
|
44
|
-
* async action runs. Keeps the variant's full-colour appearance (unlike
|
|
45
|
-
* the disabled state) and sets `aria-busy` on the rendered element.
|
|
46
|
-
*/
|
|
47
|
-
loading?: boolean;
|
|
48
|
-
/** Accessible label — required, because the button has no visible text */
|
|
2
|
+
import { IconButtonProps } from '../IconButton/IconButton';
|
|
3
|
+
/**
|
|
4
|
+
* Props of the deprecated CircularButton: IconButton's, with the name under
|
|
5
|
+
* its old spelling.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Use `IconButtonProps`, whose `label` replaces `ariaLabel`.
|
|
8
|
+
*/
|
|
9
|
+
export interface CircularButtonProps extends Omit<IconButtonProps, 'label'> {
|
|
10
|
+
/** Accessible label, required because the button has no visible text. IconButton calls it `label`. */
|
|
49
11
|
ariaLabel: string;
|
|
50
|
-
/**
|
|
51
|
-
* The hover/focus tooltip. An icon-only control names itself: by default
|
|
52
|
-
* the button wears a Tooltip carrying `ariaLabel`. Pass a string to show
|
|
53
|
-
* different wording, or `false` to opt out — for a host that labels the
|
|
54
|
-
* control another way, or one that owns the button's box directly
|
|
55
|
-
* (SplitButton's trigger stretches to its sibling segment, which the
|
|
56
|
-
* tooltip wrapper would block).
|
|
57
|
-
*/
|
|
58
|
-
tooltip?: string | false;
|
|
59
|
-
/** Which side the tooltip opens on. `start` and `end` follow the reading direction. */
|
|
60
|
-
tooltipPosition?: 'top' | 'bottom' | 'left' | 'right' | 'start' | 'end';
|
|
61
|
-
/** Optional href — renders as <a> instead of <button> */
|
|
62
|
-
href?: string;
|
|
63
|
-
/** Optional target attribute for links */
|
|
64
|
-
target?: string;
|
|
65
|
-
/** Optional rel attribute for links */
|
|
66
|
-
rel?: string;
|
|
67
|
-
/** A mark on the button's top-end corner, as BottomNav draws one: a count (a notification bell's unread), or `true` for a dot with no number. */
|
|
68
|
-
badge?: number | string | true;
|
|
69
|
-
/** The highest count the badge spells out; a larger one reads "99+". Defaults to 99. */
|
|
70
|
-
badgeMax?: number;
|
|
71
|
-
/**
|
|
72
|
-
* Text read after `ariaLabel` while the button carries a badge, given the
|
|
73
|
-
* badge. Defaults to ", new" for a dot and ", 3 new" for a count; the
|
|
74
|
-
* leading comma and space are part of the text. The tooltip keeps
|
|
75
|
-
* `ariaLabel` alone.
|
|
76
|
-
*/
|
|
77
|
-
badgeLabel?: (badge: number | string | true) => string;
|
|
78
|
-
/** The BCP 47 locale a numeric badge is written in, such as `ar-EG`. Defaults to `en-US`. This component can render from a Server Component, so it takes the prop alone and reads no LocaleProvider. */
|
|
79
|
-
locale?: string;
|
|
80
|
-
/** Additional CSS classes */
|
|
81
|
-
className?: string;
|
|
82
|
-
/**
|
|
83
|
-
* The component the link renders with, such as Next.js's `Link`, so it
|
|
84
|
-
* navigates through the app's router; a plain `<a>` when unset. This
|
|
85
|
-
* component can render on the server, so it never reads a LinkProvider:
|
|
86
|
-
* pass the prop even under one.
|
|
87
|
-
*/
|
|
88
|
-
linkComponent?: LinkComponent;
|
|
89
|
-
};
|
|
90
|
-
export interface CircularButtonProps extends CircularButtonOwnProps, Omit<React.ComponentPropsWithoutRef<'button'>, keyof CircularButtonOwnProps | 'type'> {
|
|
91
12
|
}
|
|
92
13
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
14
|
+
* IconButton under its old name. It renders the same button, passes
|
|
15
|
+
* `ariaLabel` on as `label`, and adds the old `ds-circular-button` base
|
|
16
|
+
* class beside the new ones, so a rule written against the base still
|
|
17
|
+
* matches. The old modifier and element classes are gone: a rule written
|
|
18
|
+
* against one moves to its `ds-icon-button` twin.
|
|
98
19
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
20
|
+
* @deprecated Use `IconButton` with `label`. The button was renamed because
|
|
21
|
+
* its shape is the theme's: a square theme draws it square.
|
|
101
22
|
*/
|
|
102
23
|
export declare const CircularButton: React.ForwardRefExoticComponent<CircularButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
103
|
-
export {};
|
|
@@ -1,101 +1,18 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
5
|
-
import "./CircularButton.css";
|
|
6
|
-
import "../../fonts/material-symbols.css";
|
|
7
|
-
import { mirrorClass } from "../../behaviors/direction.js";
|
|
8
|
-
import { formatNumber, DEFAULT_LOCALE } from "../../behaviors/locale.js";
|
|
9
|
-
function resolveCircularButtonCell(variant, tone) {
|
|
10
|
-
const emphasis = variant === "neutral" ? "primary" : variant;
|
|
11
|
-
const resolvedTone = tone ?? (variant === "neutral" ? "neutral" : "default");
|
|
12
|
-
if (resolvedTone === "destructive") {
|
|
13
|
-
return emphasis === "primary" ? "primary-destructive" : "destructive";
|
|
14
|
-
}
|
|
15
|
-
if (resolvedTone === "neutral" && emphasis !== "tertiary") {
|
|
16
|
-
return emphasis === "primary" ? "neutral" : "secondary-neutral";
|
|
17
|
-
}
|
|
18
|
-
return emphasis;
|
|
19
|
-
}
|
|
3
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
20
4
|
const CircularButton = React.forwardRef(
|
|
21
|
-
({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
ariaLabel,
|
|
31
|
-
tooltip,
|
|
32
|
-
tooltipPosition = "top",
|
|
33
|
-
href,
|
|
34
|
-
target,
|
|
35
|
-
rel,
|
|
36
|
-
badge,
|
|
37
|
-
badgeMax = 99,
|
|
38
|
-
badgeLabel = defaultBadgeLabel,
|
|
39
|
-
locale = DEFAULT_LOCALE,
|
|
40
|
-
className = "",
|
|
41
|
-
linkComponent,
|
|
42
|
-
...rest
|
|
43
|
-
}, ref) => {
|
|
44
|
-
const baseClass = "ds-circular-button";
|
|
45
|
-
const Link = linkComponent ?? "a";
|
|
46
|
-
const resolvedVariant = resolveCircularButtonCell(variant ?? priority ?? "primary", tone);
|
|
47
|
-
const isDisabled = disabled ?? state === "disabled";
|
|
48
|
-
const resolvedState = state ?? (isDisabled ? "disabled" : "default");
|
|
49
|
-
const isLoading = Boolean(loading);
|
|
50
|
-
const classes = [
|
|
51
|
-
baseClass,
|
|
52
|
-
`${baseClass}--${resolvedVariant}`,
|
|
53
|
-
`${baseClass}--${resolvedState}`,
|
|
54
|
-
`${baseClass}--${size}`,
|
|
55
|
-
isLoading && `${baseClass}--loading`,
|
|
56
|
-
badge !== void 0 && `${baseClass}--badged`,
|
|
57
|
-
className
|
|
58
|
-
].filter(Boolean).join(" ");
|
|
59
|
-
const glyph = isLoading ? /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon`, "aria-hidden": "true", children: /* @__PURE__ */ jsx(Spinner, { size: size === "compact" ? "sm" : "md", tone: "inherit" }) }) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon${typeof icon === "string" ? ` material-symbols-rounded ${mirrorClass(icon)}` : ""}`, "aria-hidden": "true", children: icon });
|
|
60
|
-
const badgeText = badge === void 0 || badge === true ? null : typeof badge === "number" ? badge > badgeMax ? `${formatNumber(badgeMax, locale)}+` : formatNumber(badge, locale) : badge;
|
|
61
|
-
const children = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
62
|
-
glyph,
|
|
63
|
-
badge === true && /* @__PURE__ */ jsx("span", { className: `${baseClass}__badge ${baseClass}__badge--dot`, "aria-hidden": "true" }),
|
|
64
|
-
badgeText !== null && /* @__PURE__ */ jsx("span", { className: `${baseClass}__badge`, "aria-hidden": "true", children: badgeText })
|
|
65
|
-
] });
|
|
66
|
-
const accessibleName = badge === void 0 ? ariaLabel : `${ariaLabel}${badgeLabel(badge)}`;
|
|
67
|
-
const control = href && !isDisabled && !isLoading ? /* @__PURE__ */ jsx(
|
|
68
|
-
Link,
|
|
69
|
-
{
|
|
70
|
-
...rest,
|
|
71
|
-
ref,
|
|
72
|
-
className: classes,
|
|
73
|
-
href,
|
|
74
|
-
target,
|
|
75
|
-
rel,
|
|
76
|
-
"aria-label": accessibleName,
|
|
77
|
-
children
|
|
78
|
-
}
|
|
79
|
-
) : /* @__PURE__ */ jsx(
|
|
80
|
-
"button",
|
|
81
|
-
{
|
|
82
|
-
...rest,
|
|
83
|
-
ref,
|
|
84
|
-
type: "button",
|
|
85
|
-
className: classes,
|
|
86
|
-
disabled: isDisabled || isLoading,
|
|
87
|
-
"aria-busy": isLoading || void 0,
|
|
88
|
-
"aria-label": accessibleName,
|
|
89
|
-
children
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
const tooltipContent = tooltip === false ? null : tooltip ?? ariaLabel;
|
|
93
|
-
if (!tooltipContent) return control;
|
|
94
|
-
return /* @__PURE__ */ jsx(Tooltip, { content: tooltipContent, position: tooltipPosition, children: control });
|
|
95
|
-
}
|
|
5
|
+
({ ariaLabel, className, ...rest }, ref) => /* @__PURE__ */ jsx(
|
|
6
|
+
IconButton,
|
|
7
|
+
{
|
|
8
|
+
...rest,
|
|
9
|
+
ref,
|
|
10
|
+
label: ariaLabel,
|
|
11
|
+
className: ["ds-circular-button", className].filter(Boolean).join(" ")
|
|
12
|
+
}
|
|
13
|
+
)
|
|
96
14
|
);
|
|
97
15
|
CircularButton.displayName = "CircularButton";
|
|
98
|
-
const defaultBadgeLabel = (badge) => badge === true ? ", new" : `, ${badge} new`;
|
|
99
16
|
export {
|
|
100
17
|
CircularButton
|
|
101
18
|
};
|
|
@@ -391,3 +391,15 @@
|
|
|
391
391
|
.ds-combobox .material-symbols-rounded {
|
|
392
392
|
color: inherit;
|
|
393
393
|
}
|
|
394
|
+
|
|
395
|
+
/* Icon side padding, Button's rule: a glyph's box carries its own side
|
|
396
|
+
bearing, so a side that holds one takes the step below the text side. The
|
|
397
|
+
control always leads with the search glyph and ends on the chevron
|
|
398
|
+
(16 → 12, compact 12 → 8). A chip's 8px is already the floor. */
|
|
399
|
+
.ds-combobox__control {
|
|
400
|
+
padding-inline: var(--padding-300);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.ds-combobox--compact .ds-combobox__control {
|
|
404
|
+
padding-inline: var(--padding-200);
|
|
405
|
+
}
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
color: var(--color-input-text-placeholder);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/* The close is the library's
|
|
117
|
+
/* The close is the library's IconButton (tertiary, compact); the
|
|
118
118
|
header only seats it. */
|
|
119
119
|
.ds-command-palette__close {
|
|
120
120
|
flex-shrink: 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import React, { useState, useRef, useCallback, useId, useMemo, useEffect } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
5
5
|
import ReactDOM from "react-dom";
|
|
6
6
|
import { Kbd } from "../Kbd/Kbd.js";
|
|
7
7
|
import "./CommandPalette.css";
|
|
@@ -182,14 +182,14 @@ const CommandPalette = React.forwardRef(({
|
|
|
182
182
|
}
|
|
183
183
|
),
|
|
184
184
|
/* @__PURE__ */ jsx(
|
|
185
|
-
|
|
185
|
+
IconButton,
|
|
186
186
|
{
|
|
187
187
|
className: `${baseClass}__close`,
|
|
188
188
|
icon: "close",
|
|
189
189
|
variant: "tertiary",
|
|
190
190
|
size: "compact",
|
|
191
191
|
tooltip: false,
|
|
192
|
-
|
|
192
|
+
label: closeLabel,
|
|
193
193
|
onClick: () => onOpenChange(false)
|
|
194
194
|
}
|
|
195
195
|
)
|
|
@@ -98,3 +98,12 @@
|
|
|
98
98
|
border-color: var(--color-bg-container-border);
|
|
99
99
|
background-color: var(--color-bg-container-secondary);
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
/* Icon side padding, Button's rule: the search glyph leads and the keycaps
|
|
103
|
+
end the field, and each box carries its own side bearing, so both ends
|
|
104
|
+
take the step below a text edge (12 → 8). Compact is already at
|
|
105
|
+
8, the floor: closer, the glyph sits in the pill's cap. The icon-only
|
|
106
|
+
circle keeps its centred glyph. */
|
|
107
|
+
.ds-command-palette-trigger:not(.ds-command-palette-trigger--icon-only) {
|
|
108
|
+
padding-inline: var(--padding-200);
|
|
109
|
+
}
|