rift-ds 1.36.0 → 1.37.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/matchParts.d.ts +9 -0
- package/behaviors/matchParts.js +10 -0
- package/behaviors/useLayer.d.ts +2 -2
- package/bin/templates/blocks/app/landing/page.module.css +50 -0
- package/bin/templates/blocks/app/landing/page.tsx +157 -0
- package/bin/templates/blocks/app/pricing/page.module.css +15 -0
- package/bin/templates/blocks/app/pricing/page.tsx +173 -0
- package/bin/templates/blocks/components/blocks/MarketingShell.module.css +66 -0
- package/bin/templates/blocks/components/blocks/MarketingShell.tsx +141 -0
- package/bin/templates/blocks/components/blocks/emberScene.ts +1 -1
- package/bin/templates/blocks/registry.json +24 -0
- package/chat/AssistantTurn.js +5 -20
- package/components/Chart/ActiveReporter.d.ts +32 -0
- package/components/Chart/ActiveReporter.js +31 -0
- package/components/Chart/AreaChart.d.ts +7 -1
- package/components/Chart/AreaChart.js +8 -3
- package/components/Chart/BarChart.d.ts +12 -0
- package/components/Chart/BarChart.js +8 -3
- package/components/Chart/ComboChart.d.ts +7 -1
- package/components/Chart/ComboChart.js +8 -3
- package/components/Chart/LineChart.d.ts +7 -1
- package/components/Chart/LineChart.js +8 -3
- package/components/Chart/StackedBarChart.d.ts +7 -1
- package/components/Chart/StackedBarChart.js +8 -3
- package/components/Combobox/Combobox.css +26 -0
- package/components/Combobox/Combobox.d.ts +10 -0
- package/components/Combobox/Combobox.js +10 -0
- package/components/CommandPalette/CommandPalette.css +26 -0
- package/components/CommandPalette/CommandPalette.d.ts +2 -1
- package/components/CommandPalette/CommandPalette.js +21 -4
- package/components/Drawer/Drawer.css +49 -7
- package/components/Drawer/Drawer.d.ts +17 -1
- package/components/Drawer/Drawer.js +27 -5
- package/components/Dropdown/Dropdown.css +40 -0
- package/components/Dropdown/Dropdown.d.ts +7 -0
- package/components/Dropdown/Dropdown.js +23 -38
- package/components/Instructions/Instructions.css +21 -0
- package/components/Instructions/Instructions.d.ts +5 -2
- package/components/Instructions/Instructions.js +1 -1
- package/components/Mention/Mention.js +6 -6
- package/components/NavList/NavList.d.ts +2 -0
- package/components/NavList/NavList.js +1 -0
- package/components/ShaderScene/ShaderScene.d.ts +3 -2
- package/components/ShaderScene/assemble.js +13 -5
- package/components/ShaderScene/renderer.d.ts +2 -2
- package/components/ShaderScene/types.d.ts +2 -1
- package/components/registry.json +3 -3
- package/components/registry.json.d.ts +3 -3
- package/components/registry.json.js +1 -1
- package/markdown/index.d.ts +8 -0
- package/markdown/index.js +10 -0
- package/markdown/mappers.d.ts +31 -0
- package/markdown/mappers.js +43 -0
- package/package.json +7 -2
- package/tokens/presets/contrast.css +8 -0
- package/tokens/presets/forest.css +8 -0
- package/tokens/presets/plum.css +18 -5
- package/tokens/presets/warm.css +10 -5
- package/tokens/presets/zest.css +22 -5
- package/tokens/values.json.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* ============================================
|
|
2
2
|
DRAWER COMPONENT
|
|
3
|
-
Edge-anchored modal
|
|
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(-
|
|
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(
|
|
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(-
|
|
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(
|
|
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(-
|
|
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(
|
|
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({
|
|
41
|
-
|
|
42
|
-
|
|
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__ */
|
|
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__ */
|
|
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
|
-
/**
|
|
6
|
-
|
|
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
|
|
44
|
-
|
|
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
|
-
|
|
48
|
-
/* @__PURE__ */ jsx("span", { className: "ds-mention-menu__match", children:
|
|
49
|
-
|
|
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,
|
|
@@ -87,8 +87,9 @@ export interface ShaderSceneProps extends ShaderSceneOwnProps, Omit<React.Compon
|
|
|
87
87
|
*
|
|
88
88
|
* Every scene but the ocean and the sky is a night scene: it adds light over a dark
|
|
89
89
|
* ground. On a light page each computes its light against a dark ground of
|
|
90
|
-
* its own and lays it onto the page as
|
|
91
|
-
*
|
|
90
|
+
* its own and lays it onto the page as colour, its brightest marks as a
|
|
91
|
+
* deepened ink of the scene's lead colour, so it reads as a dawn on paper
|
|
92
|
+
* rather than a dark block, and a crest or a beam stays visible on white. The ocean paints both: a turquoise shallow
|
|
92
93
|
* over a light page ground, deep moonlit water over a dark one. The sky does
|
|
93
94
|
* too: a golden hour over a light ground, the last of a sunset under a night sky
|
|
94
95
|
* over a dark one. Nothing here
|
|
@@ -50,16 +50,24 @@ void main() {
|
|
|
50
50
|
vec2 uv = gl_FragCoord.xy / u_size;
|
|
51
51
|
vec3 lin = scene(uv, u_time);
|
|
52
52
|
/* A night scene on a light page: the light it adds over its own dark
|
|
53
|
-
ground is laid onto the page as
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
ground is laid onto the page as colour, so a horizon reads as a dawn
|
|
54
|
+
on paper rather than a dark block on it, and the brightest marks
|
|
55
|
+
(a crest, a beam) read as ink rather than vanishing into the white. */
|
|
56
56
|
if (u_lightMode > 0.5) {
|
|
57
57
|
vec3 light = max(lin - u_ground, vec3(0.0));
|
|
58
58
|
float peak = max(light.r, max(light.g, light.b));
|
|
59
59
|
vec3 hue = light / max(peak, 1e-4);
|
|
60
60
|
vec3 pastel = mix(hue, vec3(1.0), 0.3);
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
/* Most of the light is laid on as ink rather than tint: its hue
|
|
62
|
+
resaturated, leaning to the scene's lead colour and deepened, so a
|
|
63
|
+
bright crest darkens against the paper instead of washing out to
|
|
64
|
+
white on it. */
|
|
65
|
+
float hueGrey = dot(hue, vec3(1.0 / 3.0));
|
|
66
|
+
vec3 lead = u_col[0] / max(max(u_col[0].r, max(u_col[0].g, u_col[0].b)), 1e-4);
|
|
67
|
+
vec3 rich = mix(clamp(hueGrey + (hue - hueGrey) * 3.0, 0.0, 1.0), lead, 0.6) * 0.5;
|
|
68
|
+
vec3 tint = mix(u_page * pastel, u_page * rich, 0.8);
|
|
69
|
+
float strength = clamp(pow(dot(light, vec3(0.2126, 0.7152, 0.0722)) * 8.0, 0.7), 0.0, 0.9);
|
|
70
|
+
lin = mix(u_page, tint, strength);
|
|
63
71
|
}
|
|
64
72
|
${call("light", "lin")}
|
|
65
73
|
vec3 srgb = pow(max(lin, vec3(0.0)), vec3(1.0 / 2.2));
|
|
@@ -5,7 +5,7 @@ export type Colours = {
|
|
|
5
5
|
ground: Rgb;
|
|
6
6
|
/** The page's own ground, which the passes fade to. */
|
|
7
7
|
page: Rgb;
|
|
8
|
-
/** A night scene on a light page, laid on as
|
|
8
|
+
/** A night scene on a light page, laid on as colour and ink. */
|
|
9
9
|
lightMode: boolean;
|
|
10
10
|
colours: Rgb[];
|
|
11
11
|
};
|
|
@@ -14,7 +14,7 @@ export declare function readColours(host: HTMLElement, tokens: string[]): Colour
|
|
|
14
14
|
/**
|
|
15
15
|
* A scene's colours for a surface: read from the cascade. A night-only
|
|
16
16
|
* scene on a light page computes its light against a dark ground of its
|
|
17
|
-
* own, and the shader lays that light onto the page as
|
|
17
|
+
* own, and the shader lays that light onto the page as colour and ink
|
|
18
18
|
* (u_lightMode), so its masks still fade to the page and the theme stays
|
|
19
19
|
* light.
|
|
20
20
|
*/
|
|
@@ -38,7 +38,8 @@ export type ShaderSceneSource = {
|
|
|
38
38
|
/**
|
|
39
39
|
* `dark` for a scene that only adds light and so only reads on a dark
|
|
40
40
|
* ground. On a light page its light is computed against a near-black
|
|
41
|
-
* ground of its own and laid onto the page as
|
|
41
|
+
* ground of its own and laid onto the page as colour, its brightest
|
|
42
|
+
* marks as a deepened ink of the scene's first colour. A scene
|
|
42
43
|
* without it paints for both modes itself, from the page ground
|
|
43
44
|
* (`u_ground`).
|
|
44
45
|
*/
|
package/components/registry.json
CHANGED
|
@@ -738,10 +738,10 @@
|
|
|
738
738
|
"name": "Drawer",
|
|
739
739
|
"label": "Drawer",
|
|
740
740
|
"slug": "drawer",
|
|
741
|
-
"description": "An edge-anchored
|
|
741
|
+
"description": "An edge-anchored panel that slides in from any side, modal by default or resting beside a live page, for filter panels, detail views, and mobile navigation.",
|
|
742
742
|
"category": "overlays",
|
|
743
743
|
"client": true,
|
|
744
|
-
"pattern": "dialog"
|
|
744
|
+
"partPatterns": [{ "pattern": "dialog", "part": "modal drawer, the default" }]
|
|
745
745
|
},
|
|
746
746
|
{
|
|
747
747
|
"name": "Dropdown",
|
|
@@ -1489,7 +1489,7 @@
|
|
|
1489
1489
|
"client": true,
|
|
1490
1490
|
"pattern": "combobox",
|
|
1491
1491
|
"alternatives": [
|
|
1492
|
-
{ "name": "Dropdown", "when": "
|
|
1492
|
+
{ "name": "Dropdown", "when": "a label is enough to choose by, with an icon, a second line or a trailing value at most" }
|
|
1493
1493
|
]
|
|
1494
1494
|
},
|
|
1495
1495
|
{
|
|
@@ -738,10 +738,10 @@ declare const _default: {
|
|
|
738
738
|
"name": "Drawer",
|
|
739
739
|
"label": "Drawer",
|
|
740
740
|
"slug": "drawer",
|
|
741
|
-
"description": "An edge-anchored
|
|
741
|
+
"description": "An edge-anchored panel that slides in from any side, modal by default or resting beside a live page, for filter panels, detail views, and mobile navigation.",
|
|
742
742
|
"category": "overlays",
|
|
743
743
|
"client": true,
|
|
744
|
-
"pattern": "dialog"
|
|
744
|
+
"partPatterns": [{ "pattern": "dialog", "part": "modal drawer, the default" }]
|
|
745
745
|
},
|
|
746
746
|
{
|
|
747
747
|
"name": "Dropdown",
|
|
@@ -1489,7 +1489,7 @@ declare const _default: {
|
|
|
1489
1489
|
"client": true,
|
|
1490
1490
|
"pattern": "combobox",
|
|
1491
1491
|
"alternatives": [
|
|
1492
|
-
{ "name": "Dropdown", "when": "
|
|
1492
|
+
{ "name": "Dropdown", "when": "a label is enough to choose by, with an icon, a second line or a trailing value at most" }
|
|
1493
1493
|
]
|
|
1494
1494
|
},
|
|
1495
1495
|
{
|