rift-ds 1.36.0 → 1.37.1

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.
Files changed (67) hide show
  1. package/README.md +1 -1
  2. package/behaviors/matchParts.d.ts +9 -0
  3. package/behaviors/matchParts.js +10 -0
  4. package/behaviors/useLayer.d.ts +2 -2
  5. package/behaviors/whenProgramLinked.d.ts +26 -0
  6. package/behaviors/whenProgramLinked.js +22 -0
  7. package/bin/templates/blocks/app/landing/page.module.css +50 -0
  8. package/bin/templates/blocks/app/landing/page.tsx +157 -0
  9. package/bin/templates/blocks/app/pricing/page.module.css +15 -0
  10. package/bin/templates/blocks/app/pricing/page.tsx +173 -0
  11. package/bin/templates/blocks/components/blocks/MarketingShell.module.css +66 -0
  12. package/bin/templates/blocks/components/blocks/MarketingShell.tsx +141 -0
  13. package/bin/templates/blocks/components/blocks/emberScene.ts +1 -1
  14. package/bin/templates/blocks/registry.json +24 -0
  15. package/chat/AssistantTurn.js +5 -20
  16. package/components/Chart/ActiveReporter.d.ts +32 -0
  17. package/components/Chart/ActiveReporter.js +31 -0
  18. package/components/Chart/AreaChart.d.ts +7 -1
  19. package/components/Chart/AreaChart.js +8 -3
  20. package/components/Chart/BarChart.d.ts +12 -0
  21. package/components/Chart/BarChart.js +8 -3
  22. package/components/Chart/ComboChart.d.ts +7 -1
  23. package/components/Chart/ComboChart.js +8 -3
  24. package/components/Chart/LineChart.d.ts +7 -1
  25. package/components/Chart/LineChart.js +8 -3
  26. package/components/Chart/StackedBarChart.d.ts +7 -1
  27. package/components/Chart/StackedBarChart.js +8 -3
  28. package/components/Combobox/Combobox.css +26 -0
  29. package/components/Combobox/Combobox.d.ts +10 -0
  30. package/components/Combobox/Combobox.js +10 -0
  31. package/components/CommandPalette/CommandPalette.css +26 -0
  32. package/components/CommandPalette/CommandPalette.d.ts +2 -1
  33. package/components/CommandPalette/CommandPalette.js +21 -4
  34. package/components/Drawer/Drawer.css +49 -7
  35. package/components/Drawer/Drawer.d.ts +17 -1
  36. package/components/Drawer/Drawer.js +27 -5
  37. package/components/Dropdown/Dropdown.css +40 -0
  38. package/components/Dropdown/Dropdown.d.ts +7 -0
  39. package/components/Dropdown/Dropdown.js +23 -38
  40. package/components/Instructions/Instructions.css +21 -0
  41. package/components/Instructions/Instructions.d.ts +5 -2
  42. package/components/Instructions/Instructions.js +1 -1
  43. package/components/Mention/Mention.js +6 -6
  44. package/components/NavList/NavList.d.ts +2 -0
  45. package/components/NavList/NavList.js +1 -0
  46. package/components/ShaderField/useShaderField.js +63 -27
  47. package/components/ShaderScene/ShaderScene.d.ts +3 -2
  48. package/components/ShaderScene/ShaderScene.js +135 -95
  49. package/components/ShaderScene/assemble.js +13 -5
  50. package/components/ShaderScene/renderer.d.ts +17 -5
  51. package/components/ShaderScene/renderer.js +45 -14
  52. package/components/ShaderScene/types.d.ts +2 -1
  53. package/components/SiteHeader/SiteHeader.css +15 -0
  54. package/components/registry.json +3 -3
  55. package/components/registry.json.d.ts +3 -3
  56. package/components/registry.json.js +1 -1
  57. package/markdown/index.d.ts +8 -0
  58. package/markdown/index.js +10 -0
  59. package/markdown/mappers.d.ts +31 -0
  60. package/markdown/mappers.js +43 -0
  61. package/package.json +7 -2
  62. package/tokens/presets/contrast.css +8 -0
  63. package/tokens/presets/forest.css +8 -0
  64. package/tokens/presets/plum.css +18 -5
  65. package/tokens/presets/warm.css +10 -5
  66. package/tokens/presets/zest.css +22 -5
  67. package/tokens/values.json.js +1 -1
@@ -250,6 +250,32 @@
250
250
  white-space: nowrap;
251
251
  }
252
252
 
253
+ /* While a query narrows the list, the typed part of each row's text holds
254
+ full strength and the labels step back, the way a mention menu marks a
255
+ match, so a row whose name holds the query reads strongest. Colour
256
+ carries it as well as weight, because a theme may set both paragraph
257
+ weights the same. A destructive row keeps its own colour. */
258
+ .ds-command-palette--filtered .ds-command-palette__command-label {
259
+ color: var(--color-text-secondary);
260
+ }
261
+
262
+ .ds-command-palette__match {
263
+ font-weight: var(--font-paragraph-sm-emphasis-weight);
264
+ color: var(--color-text-primary);
265
+ }
266
+
267
+ .ds-command-palette__command-label .ds-command-palette__match {
268
+ font-weight: inherit;
269
+ }
270
+
271
+ .ds-command-palette--filtered .ds-command-palette__command--destructive .ds-command-palette__command-label {
272
+ color: var(--color-action-destructive-text-secondary);
273
+ }
274
+
275
+ .ds-command-palette__command--destructive .ds-command-palette__command-label .ds-command-palette__match {
276
+ color: inherit;
277
+ }
278
+
253
279
  /* ============================================
254
280
  SHORTCUT KEYS
255
281
  ============================================ */
@@ -90,7 +90,8 @@ export interface CommandPaletteProps extends CommandPaletteOwnProps, Omit<React.
90
90
  }
91
91
  /**
92
92
  * CommandPalette component — a modal Cmd+K launcher that searches a grouped
93
- * command list. Filtering matches labels, descriptions, and keywords; the
93
+ * command list. Filtering matches labels, descriptions, and keywords, and the
94
+ * part of a row's text that holds what was typed is drawn stronger; the
94
95
  * arrow keys move a highlight that stays in view, and Enter runs the command.
95
96
  */
96
97
  export declare const CommandPalette: React.ForwardRefExoticComponent<CommandPaletteProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
3
  import React, { useState, useRef, useCallback, useId, useMemo, useEffect } from "react";
4
4
  import { IconButton } from "../IconButton/IconButton.js";
5
5
  import ReactDOM from "react-dom";
@@ -10,9 +10,19 @@ import { useMounted } from "../../behaviors/useMounted.js";
10
10
  import { useLayer } from "../../behaviors/useLayer.js";
11
11
  import { useFocusScope } from "../../behaviors/useFocusScope.js";
12
12
  import { useScrollLock } from "../../behaviors/useScrollLock.js";
13
+ import { matchParts } from "../../behaviors/matchParts.js";
13
14
  import { useShortcut } from "../../behaviors/shortcuts.js";
14
15
  import { mirrorClass } from "../../behaviors/direction.js";
15
16
  const DEFAULT_HOTKEY_KEYS = ["meta+k", "ctrl+k"];
17
+ const renderMatch = (text, query) => {
18
+ const parts = matchParts(text, query);
19
+ if (!parts) return text;
20
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
21
+ parts[0],
22
+ /* @__PURE__ */ jsx("span", { className: "ds-command-palette__match", children: parts[1] }),
23
+ parts[2]
24
+ ] });
25
+ };
16
26
  const CommandPalette = React.forwardRef(({
17
27
  open,
18
28
  onOpenChange,
@@ -138,7 +148,14 @@ const CommandPalette = React.forwardRef(({
138
148
  const listboxId = `${generatedId}-listbox`;
139
149
  const activeCommand = flatCommands[activeIndex];
140
150
  const activeDescendantId = activeCommand && !loading ? `${generatedId}-command-${activeCommand.id}` : void 0;
141
- const classes = [baseClass, open ? `${baseClass}--open` : "", className].filter(Boolean).join(" ");
151
+ const classes = [
152
+ baseClass,
153
+ open ? `${baseClass}--open` : "",
154
+ // Under manualFiltering the host chose the rows by its own test, so a
155
+ // row may not hold the query at all: the labels keep full strength.
156
+ !manualFiltering && query.trim() !== "" ? `${baseClass}--filtered` : "",
157
+ className
158
+ ].filter(Boolean).join(" ");
142
159
  let commandIndex = 0;
143
160
  const palette = /* @__PURE__ */ jsxs("div", { className: classes, children: [
144
161
  /* @__PURE__ */ jsx(
@@ -243,8 +260,8 @@ const CommandPalette = React.forwardRef(({
243
260
  }
244
261
  ),
245
262
  /* @__PURE__ */ jsxs("span", { className: `${baseClass}__command-text`, children: [
246
- /* @__PURE__ */ jsx("span", { className: `${baseClass}__command-label`, children: command.label }),
247
- command.description && /* @__PURE__ */ jsx("span", { className: `${baseClass}__command-description`, children: command.description })
263
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__command-label`, children: renderMatch(command.label, query) }),
264
+ command.description && /* @__PURE__ */ jsx("span", { className: `${baseClass}__command-description`, children: renderMatch(command.description, query) })
248
265
  ] }),
249
266
  command.keys ? /* @__PURE__ */ jsx("span", { className: `${baseClass}__shortcut`, children: /* @__PURE__ */ jsx(Kbd, { keys: command.keys, keyLabels, size: "compact" }) }) : command.shortcut && command.shortcut.length > 0 && /* @__PURE__ */ jsx("span", { className: `${baseClass}__shortcut`, children: command.shortcut.map((key, i) => /* @__PURE__ */ jsx(Kbd, { size: "compact", children: key }, i)) }),
250
267
  command.trailing && /* @__PURE__ */ jsx("span", { className: `${baseClass}__trailing`, children: command.trailing })
@@ -1,6 +1,6 @@
1
1
  /* ============================================
2
2
  DRAWER COMPONENT
3
- Edge-anchored modal panel that slides in
3
+ Edge-anchored panel, modal by default, that slides in
4
4
  ============================================ */
5
5
 
6
6
  @layer rift.tokens, rift.preset, rift.components;
@@ -15,6 +15,9 @@
15
15
  visibility: hidden; /* keeps panel controls out of the tab order when closed */
16
16
  pointer-events: none;
17
17
  transition: visibility var(--motion-duration-slow) var(--motion-ease-standard);
18
+ /* How far the closed panel rests off its edge: its own size, plus the
19
+ float gap when it is held off the edge. */
20
+ --ds-drawer-offset: 100%;
18
21
  }
19
22
 
20
23
  .ds-drawer--open {
@@ -97,43 +100,58 @@
97
100
  .ds-drawer--left .ds-drawer__panel {
98
101
  height: 100%;
99
102
  border-right: var(--border-025) solid var(--color-bg-container-border); /* ds-allow(physical): a left drawer sits on the screen's left edge */
100
- transform: translateX(-100%); /* ds-allow(physical): it slides in from the screen's left edge */
103
+ transform: translateX(calc(-1 * var(--ds-drawer-offset))); /* ds-allow(physical): it slides in from the screen's left edge */
101
104
  }
102
105
 
103
106
  .ds-drawer--right .ds-drawer__panel {
104
107
  height: 100%;
105
108
  border-left: var(--border-025) solid var(--color-bg-container-border); /* ds-allow(physical): a right drawer sits on the screen's right edge */
106
- transform: translateX(100%); /* ds-allow(physical): it slides in from the screen's right edge */
109
+ transform: translateX(var(--ds-drawer-offset)); /* ds-allow(physical): it slides in from the screen's right edge */
107
110
  }
108
111
 
109
112
  .ds-drawer--start .ds-drawer__panel {
110
113
  height: 100%;
111
114
  border-inline-end: var(--border-025) solid var(--color-bg-container-border);
112
- transform: translateX(calc(-100% * var(--ds-inline-sign, 1)));
115
+ transform: translateX(calc(-1 * var(--ds-drawer-offset) * var(--ds-inline-sign, 1)));
113
116
  }
114
117
 
115
118
  .ds-drawer--end .ds-drawer__panel {
116
119
  height: 100%;
117
120
  border-inline-start: var(--border-025) solid var(--color-bg-container-border);
118
- transform: translateX(calc(100% * var(--ds-inline-sign, 1)));
121
+ transform: translateX(calc(var(--ds-drawer-offset) * var(--ds-inline-sign, 1)));
119
122
  }
120
123
 
121
124
  .ds-drawer--top .ds-drawer__panel {
122
125
  width: 100%;
123
126
  border-bottom: var(--border-025) solid var(--color-bg-container-border);
124
- transform: translateY(-100%);
127
+ transform: translateY(calc(-1 * var(--ds-drawer-offset)));
125
128
  }
126
129
 
127
130
  .ds-drawer--bottom .ds-drawer__panel {
128
131
  width: 100%;
129
132
  border-top: var(--border-025) solid var(--color-bg-container-border);
130
- transform: translateY(100%);
133
+ transform: translateY(var(--ds-drawer-offset));
131
134
  }
132
135
 
133
136
  .ds-drawer--open .ds-drawer__panel {
134
137
  transform: translate(0, 0);
135
138
  }
136
139
 
140
+ /* ============================================
141
+ NON-MODAL
142
+ The page beside the panel stays live: the
143
+ root lets every press through and only the
144
+ panel takes them. No scrim is rendered.
145
+ ============================================ */
146
+
147
+ .ds-drawer--non-modal.ds-drawer--open {
148
+ pointer-events: none;
149
+ }
150
+
151
+ .ds-drawer--non-modal.ds-drawer--open .ds-drawer__panel {
152
+ pointer-events: auto;
153
+ }
154
+
137
155
  /* ============================================
138
156
  SIZES — measured along the slide axis
139
157
  ============================================ */
@@ -177,6 +195,30 @@
177
195
  max-height: 75vh;
178
196
  }
179
197
 
198
+ /* ============================================
199
+ FLOATING
200
+ The raised edge of the floating app shell
201
+ (src/behaviors/shell.css): held off every
202
+ edge by the float gap, a hairline all round,
203
+ the shell radius and the floating shadow.
204
+ After SIZES, so its width cap outranks theirs;
205
+ border-box, so a size is the whole card and
206
+ the card fits inside the gap.
207
+ ============================================ */
208
+
209
+ .ds-drawer--floating {
210
+ padding: var(--padding-500); /* 20px, the same step as the shell's float gap */
211
+ --ds-drawer-offset: calc(100% + var(--padding-500));
212
+ }
213
+
214
+ .ds-drawer.ds-drawer--floating .ds-drawer__panel {
215
+ box-sizing: border-box;
216
+ max-width: 100%;
217
+ border: var(--border-025) solid var(--color-bg-container-border);
218
+ border-radius: var(--radius-600);
219
+ box-shadow: var(--shadow-floating);
220
+ }
221
+
180
222
  /* ============================================
181
223
  HEADER
182
224
  ============================================ */
@@ -32,6 +32,21 @@ type DrawerOwnProps = {
32
32
  size?: 'sm' | 'md' | 'lg';
33
33
  /** Whether ESC, scrim click, and the close button can dismiss */
34
34
  dismissible?: boolean;
35
+ /**
36
+ * Whether the drawer takes over the page. `true` (the default) draws the
37
+ * scrim, traps focus, locks scroll and makes the page behind inert. `false`
38
+ * leaves the page live beside the panel, for a detail view that follows a
39
+ * list: no scrim, no trap, and a press outside never closes it. Focus still
40
+ * moves into the panel on open; on close it returns to the opener only if
41
+ * it is still inside the panel.
42
+ */
43
+ modal?: boolean;
44
+ /**
45
+ * How the panel meets the edge. `flush` (the default) runs to the edge with
46
+ * a hairline on the side facing the page; `floating` holds the panel off
47
+ * every edge as a raised, rounded card.
48
+ */
49
+ layout?: 'flush' | 'floating';
35
50
  /** Accessible name of the close button. */
36
51
  closeLabel?: string;
37
52
  /** Additional CSS classes — applied to the portal container, not the panel */
@@ -43,7 +58,8 @@ export interface DrawerProps extends DrawerOwnProps, Omit<React.ComponentPropsWi
43
58
  * Drawer component — an edge-anchored panel that slides in over the page.
44
59
  * Shares Dialog's modal semantics (focus trap, focus restore, scroll lock,
45
60
  * ESC/scrim dismissal) but is anchored to a viewport edge, which suits
46
- * filter panels, detail views, and mobile navigation.
61
+ * filter panels, detail views, and mobile navigation. With `modal={false}`
62
+ * it rests beside a page that stays live.
47
63
  *
48
64
  * Renders through a portal into `document.body`. The forwarded ref and any
49
65
  * unrecognised props target the **panel** (the `role="dialog"` element), not the
@@ -23,6 +23,8 @@ const Drawer = React.forwardRef(
23
23
  side = "right",
24
24
  size = "md",
25
25
  dismissible = true,
26
+ modal = true,
27
+ layout = "flush",
26
28
  closeLabel = "Close drawer",
27
29
  className = "",
28
30
  ...rest
@@ -37,9 +39,27 @@ const Drawer = React.forwardRef(
37
39
  else if (ref) ref.current = node;
38
40
  };
39
41
  const mounted = useMounted();
40
- const layer = useLayer({ open, dismissOnEscape: dismissible, onDismiss: () => onOpenChange(false) });
41
- useFocusScope(panelRef, { active: open });
42
- useScrollLock(open);
42
+ const layer = useLayer({
43
+ open,
44
+ dismissOnEscape: dismissible,
45
+ onDismiss: () => onOpenChange(false),
46
+ passive: !modal,
47
+ getElements: modal ? void 0 : () => [panelRef.current]
48
+ });
49
+ useFocusScope(panelRef, {
50
+ active: open,
51
+ trap: modal,
52
+ inertOutside: modal,
53
+ // The page stays live beside a non-modal drawer, so by the time it
54
+ // closes focus may already be where the reader put it. Only a focus
55
+ // still inside the panel goes back to the opener.
56
+ restoreFocus: modal ? true : () => {
57
+ const active = document.activeElement;
58
+ if (!(active instanceof HTMLElement) || active === document.body) return null;
59
+ return panelRef.current?.contains(active) ? null : active;
60
+ }
61
+ });
62
+ useScrollLock(open && modal);
43
63
  const handleScrimClick = () => {
44
64
  if (dismissible && layer.ownsPress()) onOpenChange(false);
45
65
  };
@@ -47,11 +67,13 @@ const Drawer = React.forwardRef(
47
67
  baseClass,
48
68
  `${baseClass}--${side}`,
49
69
  `${baseClass}--${size}`,
70
+ layout === "floating" ? `${baseClass}--floating` : "",
71
+ modal ? "" : `${baseClass}--non-modal`,
50
72
  open ? `${baseClass}--open` : "",
51
73
  className
52
74
  ].filter(Boolean).join(" ");
53
75
  const drawer = /* @__PURE__ */ jsxs("div", { className: classes, "data-state": open ? "open" : "closed", children: [
54
- /* @__PURE__ */ jsx("div", { className: `${baseClass}__scrim`, onClick: handleScrimClick }),
76
+ modal && /* @__PURE__ */ jsx("div", { className: `${baseClass}__scrim`, onClick: handleScrimClick }),
55
77
  /* @__PURE__ */ jsxs(
56
78
  "div",
57
79
  {
@@ -60,7 +82,7 @@ const Drawer = React.forwardRef(
60
82
  "data-state": open ? "open" : "closed",
61
83
  ref: setPanelRef,
62
84
  role: "dialog",
63
- "aria-modal": "true",
85
+ "aria-modal": modal ? "true" : void 0,
64
86
  "aria-labelledby": titleId,
65
87
  "aria-describedby": description ? descId : rest["aria-describedby"],
66
88
  tabIndex: -1,
@@ -226,6 +226,46 @@
226
226
  align-items: center;
227
227
  gap: var(--gap-100);
228
228
  min-width: 0;
229
+ flex: 1;
230
+ }
231
+
232
+ /* The rich row, shared with Combobox's: a label over a tertiary second
233
+ line, and a secondary value at the row's end before the chosen mark. A
234
+ row with a second line gives its leading mark the wider gap. */
235
+ .ds-dropdown__option-content:has(.ds-dropdown__option-text) {
236
+ gap: var(--gap-200);
237
+ }
238
+
239
+ .ds-dropdown__option-text {
240
+ display: flex;
241
+ flex-direction: column;
242
+ gap: var(--gap-050);
243
+ min-width: 0;
244
+ }
245
+
246
+ .ds-dropdown__option-description {
247
+ font-family: var(--font-paragraph-sm-family);
248
+ font-size: var(--font-paragraph-sm-size);
249
+ font-weight: var(--font-paragraph-sm-weight);
250
+ line-height: var(--font-paragraph-sm-line-height);
251
+ letter-spacing: var(--font-paragraph-sm-letter-spacing);
252
+ color: var(--color-text-tertiary);
253
+ }
254
+
255
+ .ds-dropdown__option-trailing {
256
+ flex-shrink: 0;
257
+ margin-inline-start: var(--gap-400);
258
+ font-family: var(--font-paragraph-sm-family);
259
+ font-size: var(--font-paragraph-sm-size);
260
+ font-weight: var(--font-paragraph-sm-weight);
261
+ line-height: var(--font-paragraph-sm-line-height);
262
+ letter-spacing: var(--font-paragraph-sm-letter-spacing);
263
+ font-variant-numeric: tabular-nums;
264
+ color: var(--color-text-secondary);
265
+ }
266
+
267
+ .ds-dropdown__option-trailing + .ds-chosen-mark {
268
+ margin-inline-start: var(--gap-200);
229
269
  }
230
270
 
231
271
  .ds-dropdown__option-icon {
@@ -17,6 +17,13 @@ export interface DropdownOption {
17
17
  * or custom element (ReactNode).
18
18
  */
19
19
  icon?: string | React.ReactNode;
20
+ /** A second line under the label, in the option row only: an account number, a person's email. */
21
+ description?: string;
22
+ /**
23
+ * Content at the end of the option row, before the chosen mark: a balance,
24
+ * a count, a Badge. Shown in the row only, never on the closed trigger.
25
+ */
26
+ trailing?: React.ReactNode;
20
27
  /** Whether this option is disabled */
21
28
  disabled?: boolean;
22
29
  }
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
3
  import React, { useState, useId, useRef, useEffect } from "react";
4
4
  import { useAnchoredPosition } from "../../behaviors/useAnchoredPosition.js";
5
5
  import { useLayer } from "../../behaviors/useLayer.js";
@@ -188,6 +188,24 @@ const Dropdown = React.forwardRef(
188
188
  focusedEl?.scrollIntoView({ block: "nearest" });
189
189
  }
190
190
  }, [focusedIndex, isOpen, inputId]);
191
+ const renderOptionBody = (option) => /* @__PURE__ */ jsxs(Fragment, { children: [
192
+ /* @__PURE__ */ jsxs("span", { className: `${baseClass}__option-content`, children: [
193
+ option.icon && (typeof option.icon === "string" ? /* @__PURE__ */ jsx(
194
+ "span",
195
+ {
196
+ className: `${baseClass}__option-icon material-symbols-rounded ${mirrorClass(option.icon)}`,
197
+ "aria-hidden": "true",
198
+ children: option.icon
199
+ }
200
+ ) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__option-icon`, "aria-hidden": "true", children: option.icon })),
201
+ option.description ? /* @__PURE__ */ jsxs("span", { className: `${baseClass}__option-text`, children: [
202
+ /* @__PURE__ */ jsx("span", { children: option.label }),
203
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__option-description`, children: option.description })
204
+ ] }) : option.label
205
+ ] }),
206
+ option.trailing != null && option.trailing !== false && /* @__PURE__ */ jsx("span", { className: `${baseClass}__option-trailing`, children: option.trailing }),
207
+ option.value === value && /* @__PURE__ */ jsx(ChosenMark, {})
208
+ ] });
191
209
  const activeOptionId = isOpen && focusedIndex >= 0 && flatOptions[focusedIndex] ? `${inputId}-option-${focusedIndex}` : void 0;
192
210
  return /* @__PURE__ */ jsxs(
193
211
  Field,
@@ -265,7 +283,7 @@ const Dropdown = React.forwardRef(
265
283
  "aria-label": group.label,
266
284
  children: group.options.map((option) => {
267
285
  const myIndex = flatIndex++;
268
- return /* @__PURE__ */ jsxs(
286
+ return /* @__PURE__ */ jsx(
269
287
  "li",
270
288
  {
271
289
  id: `${inputId}-option-${myIndex}`,
@@ -280,27 +298,7 @@ const Dropdown = React.forwardRef(
280
298
  "aria-selected": option.value === value,
281
299
  "aria-disabled": option.disabled,
282
300
  onClick: () => !option.disabled && handleSelect(option.value),
283
- children: [
284
- /* @__PURE__ */ jsxs("span", { className: `${baseClass}__option-content`, children: [
285
- option.icon && (typeof option.icon === "string" ? /* @__PURE__ */ jsx(
286
- "span",
287
- {
288
- className: `${baseClass}__option-icon material-symbols-rounded ${mirrorClass(option.icon)}`,
289
- "aria-hidden": "true",
290
- children: option.icon
291
- }
292
- ) : /* @__PURE__ */ jsx(
293
- "span",
294
- {
295
- className: `${baseClass}__option-icon`,
296
- "aria-hidden": "true",
297
- children: option.icon
298
- }
299
- )),
300
- option.label
301
- ] }),
302
- option.value === value && /* @__PURE__ */ jsx(ChosenMark, {})
303
- ]
301
+ children: renderOptionBody(option)
304
302
  },
305
303
  option.value
306
304
  );
@@ -309,7 +307,7 @@ const Dropdown = React.forwardRef(
309
307
  ),
310
308
  groupIdx < groups.length - 1 && /* @__PURE__ */ jsx("li", { className: `${baseClass}__separator`, role: "separator" })
311
309
  ] }, `group-${groupIdx}`));
312
- })() : options.map((option, index) => /* @__PURE__ */ jsxs(
310
+ })() : options.map((option, index) => /* @__PURE__ */ jsx(
313
311
  "li",
314
312
  {
315
313
  id: `${inputId}-option-${index}`,
@@ -324,20 +322,7 @@ const Dropdown = React.forwardRef(
324
322
  "aria-selected": option.value === value,
325
323
  "aria-disabled": option.disabled,
326
324
  onClick: () => !option.disabled && handleSelect(option.value),
327
- children: [
328
- /* @__PURE__ */ jsxs("span", { className: `${baseClass}__option-content`, children: [
329
- option.icon && (typeof option.icon === "string" ? /* @__PURE__ */ jsx(
330
- "span",
331
- {
332
- className: `${baseClass}__option-icon material-symbols-rounded ${mirrorClass(option.icon)}`,
333
- "aria-hidden": "true",
334
- children: option.icon
335
- }
336
- ) : /* @__PURE__ */ jsx("span", { className: `${baseClass}__option-icon`, "aria-hidden": "true", children: option.icon })),
337
- option.label
338
- ] }),
339
- option.value === value && /* @__PURE__ */ jsx(ChosenMark, {})
340
- ]
325
+ children: renderOptionBody(option)
341
326
  },
342
327
  option.value
343
328
  ))
@@ -137,6 +137,27 @@
137
137
  margin: 0;
138
138
  }
139
139
 
140
+ /* A description given as markup holds blocks (a code block, a figure, a
141
+ list): they stack on the step's own rhythm and never widen the step. */
142
+ div.ds-instructions__description {
143
+ min-width: 0;
144
+ }
145
+
146
+ /* A vertical step's content takes the room beside its badge, so a block a
147
+ description holds (a code block) runs the step's width, one step like
148
+ the next, in place of each shrinking to its own text. */
149
+ .ds-instructions--vertical .ds-instructions__content {
150
+ flex: 1 1 0;
151
+ }
152
+
153
+ div.ds-instructions__description > * {
154
+ margin-block: 0;
155
+ }
156
+
157
+ div.ds-instructions__description > * + * {
158
+ margin-block-start: var(--gap-200); /* 8px */
159
+ }
160
+
140
161
  /* ============================================
141
162
  HORIZONTAL LAYOUT
142
163
  ============================================ */
@@ -2,8 +2,11 @@ import { default as React } from 'react';
2
2
  export interface InstructionStep {
3
3
  /** Step label/title */
4
4
  label: string;
5
- /** Optional step description */
6
- description?: string;
5
+ /**
6
+ * What the step says under its label. Plain text is set as a paragraph;
7
+ * markup (a code block, a figure, a list) is set as a block the step holds.
8
+ */
9
+ description?: React.ReactNode;
7
10
  /** Optional custom icon — Material Symbol name (string) or custom element (ReactNode); defaults to step number */
8
11
  icon?: string | React.ReactNode;
9
12
  }
@@ -26,7 +26,7 @@ const Instructions = React.forwardRef(
26
26
  ] }),
27
27
  /* @__PURE__ */ jsxs("div", { className: `${baseClass}__content`, children: [
28
28
  /* @__PURE__ */ jsx("p", { className: `${baseClass}__label`, children: step.label }),
29
- step.description && /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, children: step.description })
29
+ step.description != null && step.description !== false && step.description !== "" && (typeof step.description === "string" || typeof step.description === "number" ? /* @__PURE__ */ jsx("p", { className: `${baseClass}__description`, children: step.description }) : /* @__PURE__ */ jsx("div", { className: `${baseClass}__description`, children: step.description }))
30
30
  ] })
31
31
  ] }, idx)) })
32
32
  ] });
@@ -6,6 +6,7 @@ import "./Mention.css";
6
6
  import { splitMentions, mentionOptionId, mentionListboxId } from "./mentions.js";
7
7
  import { filterMentionItems, getMentionQuery, insertMention } from "./mentions.js";
8
8
  import { mirrorClass } from "../../behaviors/direction.js";
9
+ import { matchParts } from "../../behaviors/matchParts.js";
9
10
  const Mention = React.forwardRef(
10
11
  ({ trigger = "@", className = "", children, ...rest }, ref) => /* @__PURE__ */ jsxs(
11
12
  "span",
@@ -40,13 +41,12 @@ const MentionText = React.forwardRef(
40
41
  );
41
42
  MentionText.displayName = "MentionText";
42
43
  const renderLabel = (label, query) => {
43
- const needle = query.trim().toLowerCase();
44
- const at = needle === "" ? -1 : label.toLowerCase().indexOf(needle);
45
- if (at < 0) return label;
44
+ const parts = matchParts(label, query);
45
+ if (!parts) return label;
46
46
  return /* @__PURE__ */ jsxs(Fragment, { children: [
47
- label.slice(0, at),
48
- /* @__PURE__ */ jsx("span", { className: "ds-mention-menu__match", children: label.slice(at, at + needle.length) }),
49
- label.slice(at + needle.length)
47
+ parts[0],
48
+ /* @__PURE__ */ jsx("span", { className: "ds-mention-menu__match", children: parts[1] }),
49
+ parts[2]
50
50
  ] });
51
51
  };
52
52
  const MentionMenu = React.forwardRef(
@@ -23,6 +23,8 @@ export interface NavListItem {
23
23
  current?: boolean;
24
24
  /** A short tag after the label, such as "New" or "Beta", drawn as a neutral Badge. */
25
25
  badge?: string;
26
+ /** Icon before the label — Material Symbol name (string) or custom element (ReactNode) */
27
+ icon?: string | React.ReactNode;
26
28
  }
27
29
  /**
28
30
  * A titled section of rows: a heading over its items, the way a long
@@ -127,6 +127,7 @@ const NavList = React.forwardRef(
127
127
  variant: "tertiary",
128
128
  size: level === 1 && size === "default" ? "default" : "compact",
129
129
  label: item.label,
130
+ iconLeft: item.icon,
130
131
  iconRight: item.badge ? /* @__PURE__ */ jsx(Badge, { className: `${baseClass}__badge`, label: item.badge, variant: "neutral" }) : void 0,
131
132
  href: item.href,
132
133
  linkComponent,