@filipgutica/design-system 1.0.29 → 1.0.30
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/language/DESIGN.md +16 -2
- package/language/ui-sdk.css +150 -5
- package/package.json +1 -1
package/language/DESIGN.md
CHANGED
|
@@ -186,8 +186,22 @@ Each depth tier has one token. [`tokens.css`](tokens.css) holds every shadow val
|
|
|
186
186
|
- [Toggle button](components.md#toggle-button): a `Toggle` whose first child is an empty `ToggleIcon`, drawn as the switch track, then a `<span>` with the label and an optional `<small>` description. `data-size="sm"` or `"lg"` goes on the `Toggle`.
|
|
187
187
|
- [Select](components.md#select): `Select`, `SelectTrigger` with `SelectValue`, `SelectContent`, and `SelectItem`, inside a `Field` for the label and error. `data-size="sm"` or `"lg"` goes on the trigger. The item draws the check, so `SelectItemIndicator` is optional.
|
|
188
188
|
- [Dialog](components.md#dialog): `DialogBackdrop` and `DialogContent`. The content holds a `<header>` (a `<div>` with `DialogTitle` and `DialogDescription`, then an icon `DialogClose` with an `aria-label`), the body in one element, and an optional `<footer>` whose actions are `Button`s, such as `<DialogClose render={<Button data-variant="secondary" />}>`. On phones it is a bottom sheet.
|
|
189
|
-
-
|
|
190
|
-
-
|
|
189
|
+
- [Segmented control](components.md#segmented-control): a horizontal `SegmentedControl` with its `SegmentedControlIndicator` first, then the `SegmentedControlItem`s. `data-size="sm"` or `"lg"` and `data-icon-only` go on the control. ui-sdk owns the keyboard model: a radio group with arrow keys between options.
|
|
190
|
+
- [Tabs](components.md#tabs): `Tabs` with a horizontal `TabsList` (its `TabsIndicator` first, then the `TabsTab`s) and a `TabsPanel` for each tab. The list scrolls when it overflows.
|
|
191
|
+
- [Slider](components.md#slider): a horizontal `Slider` with `SliderValue` and `SliderControl` > `SliderTrack` > `SliderIndicator` and `SliderThumb`, inside a `Field` for its label. `data-size="sm"` or `"lg"` goes on the `Slider`.
|
|
192
|
+
- [Progress](components.md#progress): `Progress` with a value, `ProgressLabel`, `ProgressValue`, and `ProgressTrack` > `ProgressIndicator`.
|
|
193
|
+
- [Drawer](components.md#drawer): `Drawer` with `side="left"` or `"right"`, `DrawerBackdrop`, and `DrawerContent` holding a `<header>` (`DrawerTitle`, then an icon `DrawerClose` with an `aria-label`) and the body in one element.
|
|
194
|
+
- [Overflow menu](components.md#overflow-menu): `Menu`, `MenuTrigger`, `MenuContent`, `MenuItem`, `MenuSeparator`, and `MenuItemIcon`. Supply the More SVG as the trigger's child and an item-specific `aria-label`; use `align="end"` on `MenuContent` (its default 4px offset matches `--space-1`). Render each `MenuItem` as a button with `render={<button type="button" />}`; for disabled items, pass both `disabled` and `render={<button type="button" disabled />}` so the native button and ui-sdk agree. `destructive` on the last item draws the danger text through ui-sdk's `data-destructive`; separate it with `MenuSeparator`. `data-open`, `data-highlighted`, and `data-disabled` come from ui-sdk, not the app. `MenuItemIcon` wraps an app-supplied 16px SVG.
|
|
195
|
+
- Beta.5 keyboard limitation: ui-sdk highlights disabled items instead of skipping them. With a native disabled button, focus stays on the preceding item and Down Arrow stops there; Up Arrow, Home, and End still reach the items after it. Use the plain-HTML recipe when disabled-item skipping is required; this stylesheet cannot correct ui-sdk's navigation.
|
|
196
|
+
- At tablet width and below, the menu trigger and items, unsized buttons, inputs, select triggers, toggle buttons, segmented options, tabs, sliders, and choice and switch rows grow to `--control-lg` for touch, as the catalogue's do.
|
|
197
|
+
- Where ui-sdk drives a behaviour, it differs from the spec:
|
|
198
|
+
- The segmented thumb and the tab fill glide with both edges together over 260ms, without the stretch, because ui-sdk does not say which way a choice moved before it moves them.
|
|
199
|
+
- A glide runs while the pointer or focus is in the control, so a re-measure then, such as on a resize, glides too.
|
|
200
|
+
- While focus is in a segmented control or tab list, its labels fade over 260ms, hover included, so a choice's labels cross-fade with the glide.
|
|
201
|
+
- ui-sdk times the drawer's slide, and under reduced motion it fades the drawer over 150ms instead of showing it at once.
|
|
202
|
+
- The progress indicator animates its width, not a transform.
|
|
203
|
+
- Under reduced motion, a scrolling tab list's clipped edges do not fade: a scroll-driven animation draws the fade, and the `tokens.css` base stops every animation.
|
|
204
|
+
- Any other ui-sdk component or part is unsupported: it renders unstyled. That includes `InputGroup`, `InputClear`, a mixed (indeterminate) checkbox, a `Toggle` with an icon, `ToggleGroup`, the switch choice card, the select's search, groups, and clear button, `presentation="sheet"` or `"auto"` on a select, dialog, or menu (ui-sdk places the sheet, and its panel is not drawn), a `DialogClose` outside the dialog's `<header>` that is not rendered as a `Button`, `AlertDialog`, the dialog [viewer](components.md#viewer), vertical segmented controls, tabs, and sliders, an indeterminate progress, and a drawer from the top or bottom (ui-sdk places it, and its panel is not drawn). Unsupported menu parts include `MenuGroup` and group labels, checkbox/radio items and their indicators and groups, submenus (triggers and content), shortcuts, context triggers, and the pending state of an item, which ui-sdk marks with `data-pending` and `aria-disabled` but not `data-disabled`. Use the owning library's component or the [`components.html`](components.html) recipe, or add a spec and its `ui-sdk.css` rules first. Do not style an unsupported part on a page.
|
|
191
205
|
- This file owns the look and the load order. The ui-sdk skill and the docs in the installed `@ui-sdk/*` package own which component to use, composition, `render`, ARIA, and the agent bridge. `interface-design` owns states and copy. The repository's own testing rules apply, not the ui-sdk skill's `test.fails` advice.
|
|
192
206
|
- To let an agent operate the page, create the bridge with `createAgent()` before the app renders; the agent reads with `snapshot()` and acts with `act()`. The app decides whether to expose it, through `createAgent` or WebMCP, and which actions to allow.
|
|
193
207
|
|
package/language/ui-sdk.css
CHANGED
|
@@ -173,17 +173,145 @@
|
|
|
173
173
|
[data-slot="dialog-content"][data-presentation="dialog"] > footer { justify-content: flex-end; gap: var(--space-2); border-top: 1px solid var(--color-border-subtle); background: var(--color-surface); }
|
|
174
174
|
[data-slot="dialog-title"] { margin: 0; font-size: 1.125rem; font-weight: var(--weight-semibold); letter-spacing: -0.02em; }
|
|
175
175
|
[data-slot="dialog-description"] { margin: var(--space-1) 0 0; color: var(--color-muted); }
|
|
176
|
-
/* The header's close button is a quiet action. A Close rendered as a Button is drawn as that button. */
|
|
177
|
-
[data-slot="dialog-content"] > header > [data-slot="dialog-close"] { display: inline-flex; flex: none; align-items: center; justify-content: center; width: var(--control-lg); min-height: var(--control-lg); padding: 0; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--color-muted); font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
176
|
+
/* The header's close button, in a dialog or a drawer, is a quiet action. A Close rendered as a Button is drawn as that button. */
|
|
177
|
+
:is([data-slot="dialog-content"], [data-slot="drawer-content"]) > header > :is([data-slot="dialog-close"], [data-slot="drawer-close"]) { display: inline-flex; flex: none; align-items: center; justify-content: center; width: var(--control-lg); min-height: var(--control-lg); padding: 0; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--color-muted); font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
178
178
|
@media (hover: hover) {
|
|
179
|
-
[data-slot="dialog-content"] > header > [data-slot="dialog-close"]:hover { color: var(--color-text); background: color-mix(in srgb, currentColor 6%, transparent); }
|
|
179
|
+
:is([data-slot="dialog-content"], [data-slot="drawer-content"]) > header > :is([data-slot="dialog-close"], [data-slot="drawer-close"]):hover { color: var(--color-text); background: color-mix(in srgb, currentColor 6%, transparent); }
|
|
180
180
|
}
|
|
181
|
-
[data-slot="dialog-content"] > header > [data-slot="dialog-close"]:active { background: color-mix(in srgb, currentColor 12%, transparent); }
|
|
181
|
+
:is([data-slot="dialog-content"], [data-slot="drawer-content"]) > header > :is([data-slot="dialog-close"], [data-slot="drawer-close"]):active { background: color-mix(in srgb, currentColor 12%, transparent); }
|
|
182
182
|
/* Phones: the dialog becomes a bottom sheet with rounded top corners. */
|
|
183
183
|
@media (max-width: 640px) {
|
|
184
184
|
[data-slot="dialog-content"][data-presentation="dialog"] { width: 100%; margin: auto 0 0; border-radius: var(--radius-panel) var(--radius-panel) 0 0; }
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
/* ---------- Segmented control ---------- */
|
|
188
|
+
/* An undivided sunk track; the indicator is the raised thumb, inset 2px inside the checked item, from the
|
|
189
|
+
position ui-sdk measures. Horizontal only. */
|
|
190
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] { --item: var(--control-md); position: relative; display: inline-flex; flex: none; border: 1px solid transparent; border-radius: var(--radius-control); background: var(--color-well); box-shadow: var(--shadow-sink); isolation: isolate; }
|
|
191
|
+
[data-slot="segmented-control"][data-orientation="horizontal"][data-size="sm"] { --item: var(--control-sm); font-size: var(--text-sm); }
|
|
192
|
+
[data-slot="segmented-control"][data-orientation="horizontal"][data-size="lg"] { --item: var(--control-lg); font-size: var(--text-lg); }
|
|
193
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"] { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--item); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-control); background: transparent; color: var(--color-muted); font: inherit; cursor: pointer; }
|
|
194
|
+
[data-slot="segmented-control"][data-orientation="horizontal"][data-icon-only] > [data-slot="segmented-control-item"] { width: var(--item); padding: 0; }
|
|
195
|
+
/* The hover thumb sits behind the label and under the indicator, inside the control's stacking context. */
|
|
196
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"]::before { content: ""; position: absolute; inset: 2px; z-index: -2; border-radius: var(--radius-control); pointer-events: none; }
|
|
197
|
+
@media (hover: hover) {
|
|
198
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"]:hover:not([data-disabled], [data-checked]) { color: var(--color-text); }
|
|
199
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"]:hover:not([data-disabled], [data-checked])::before { background: color-mix(in srgb, var(--color-control-thumb) 45%, transparent); }
|
|
200
|
+
}
|
|
201
|
+
/* The checked label reads at 4.5:1 on its thumb, and an icon at 3:1 (--color-segmented-current-text). */
|
|
202
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"][data-checked] { color: var(--color-segmented-current-text); }
|
|
203
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"][data-disabled] { opacity: 0.58; cursor: not-allowed; }
|
|
204
|
+
/* The thumb is the option's sibling, so a disabled checked option dims it too. */
|
|
205
|
+
[data-slot="segmented-control"][data-orientation="horizontal"]:has(> [data-slot="segmented-control-item"][data-checked][data-disabled]) > [data-slot="segmented-control-indicator"] { opacity: 0.58; }
|
|
206
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-indicator"] { position: absolute; z-index: -1; top: calc(var(--segmented-control-indicator-top) + 2px); left: calc(var(--segmented-control-indicator-left) + 2px); width: calc(var(--segmented-control-indicator-width) - 4px); height: calc(var(--segmented-control-indicator-height) - 4px); border-radius: var(--radius-control); background: var(--color-control-thumb); box-shadow: var(--shadow-raise); pointer-events: none; }
|
|
207
|
+
|
|
208
|
+
/* ---------- Tabs ---------- */
|
|
209
|
+
/* The list scrolls, so it clips on every side: the padding keeps the selected tab's shadow whole. The indicator
|
|
210
|
+
is the selected tab's lifted fill, from the position ui-sdk measures. Horizontal only. */
|
|
211
|
+
/* The fill takes its left edge and width: ui-sdk measures --active-tab-right from the end of the scrolled content. */
|
|
212
|
+
[data-slot="tabs-list"][data-orientation="horizontal"] { position: relative; display: flex; width: max-content; max-width: 100%; overflow-x: auto; padding: var(--space-1); isolation: isolate; }
|
|
213
|
+
[data-slot="tabs-list"][data-orientation="horizontal"] > [data-slot="tabs-tab"] { position: relative; flex: none; min-height: var(--control-md); padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-inline); background: transparent; color: var(--color-muted); font: var(--weight-medium) var(--text-md) / var(--leading) var(--font-ui); white-space: nowrap; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
214
|
+
@media (hover: hover) {
|
|
215
|
+
[data-slot="tabs-list"][data-orientation="horizontal"] > [data-slot="tabs-tab"]:hover:not([data-disabled], [data-selected]) { background: var(--color-row-hover); color: var(--color-text); }
|
|
216
|
+
}
|
|
217
|
+
[data-slot="tabs-list"][data-orientation="horizontal"] > [data-slot="tabs-tab"][data-selected] { color: var(--color-nav-current-text); }
|
|
218
|
+
[data-slot="tabs-list"][data-orientation="horizontal"] > [data-slot="tabs-tab"][data-disabled] { opacity: 0.58; cursor: not-allowed; }
|
|
219
|
+
[data-slot="tabs-list"][data-orientation="horizontal"] > [data-slot="tabs-indicator"] { position: absolute; z-index: -1; top: var(--active-tab-top); left: var(--active-tab-left); width: var(--active-tab-width); height: var(--active-tab-height); border-radius: var(--radius-inline); background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); pointer-events: none; }
|
|
220
|
+
[data-slot="tabs"][data-orientation="horizontal"] > [data-slot="tabs-panel"] { padding-top: var(--space-3); }
|
|
221
|
+
/* A clipped edge fades over 24px. The list's own scroll position drives the two fade widths, so a list that
|
|
222
|
+
does not scroll has no fade. The tokens.css base stops every animation under reduced motion, which would
|
|
223
|
+
pin the fade at its end, so a reduced-motion reader sees clipped edges without the fade. */
|
|
224
|
+
@supports (animation-timeline: scroll()) { @media (prefers-reduced-motion: no-preference) {
|
|
225
|
+
[data-slot="tabs-list"][data-orientation="horizontal"] { mask-image: linear-gradient(to right, transparent, #000 var(--tab-fade-start), #000 calc(100% - var(--tab-fade-end)), transparent); animation: ui-sdk-tab-fade auto linear both; animation-timeline: scroll(self inline); }
|
|
226
|
+
} }
|
|
227
|
+
@keyframes ui-sdk-tab-fade { 0% { --tab-fade-start: 0px; --tab-fade-end: 24px; } 1%, 99% { --tab-fade-start: 24px; --tab-fade-end: 24px; } 100% { --tab-fade-start: 24px; --tab-fade-end: 0px; } }
|
|
228
|
+
|
|
229
|
+
/* ---------- Slider ---------- */
|
|
230
|
+
/* A 6px track with the accent range and a ringed round thumb; the value follows the track. Horizontal only. */
|
|
231
|
+
[data-slot="slider"][data-orientation="horizontal"] { --thumb: 18px; display: flex; align-items: center; gap: var(--space-3); width: 100%; min-width: 0; }
|
|
232
|
+
[data-slot="slider"][data-orientation="horizontal"][data-size="sm"] { --thumb: 16px; }
|
|
233
|
+
[data-slot="slider"][data-orientation="horizontal"][data-size="lg"] { --thumb: 20px; }
|
|
234
|
+
[data-slot="slider"][data-orientation="horizontal"] > [data-slot="slider-value"] { order: 1; min-width: 4ch; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
|
|
235
|
+
/* ui-sdk centres the thumb on the value's point of the track, so the control's inline padding keeps the thumb
|
|
236
|
+
inside it at both ends, as a native range does. */
|
|
237
|
+
[data-slot="slider"][data-orientation="horizontal"] > [data-slot="slider-control"] { display: flex; flex: 1; align-items: center; min-width: 0; height: var(--control-md); padding-inline: calc(var(--thumb) / 2); cursor: pointer; }
|
|
238
|
+
[data-slot="slider"][data-orientation="horizontal"][data-size="sm"] > [data-slot="slider-control"] { height: var(--control-sm); }
|
|
239
|
+
[data-slot="slider"][data-orientation="horizontal"][data-size="lg"] > [data-slot="slider-control"] { height: var(--control-lg); }
|
|
240
|
+
[data-slot="slider"][data-orientation="horizontal"] [data-slot="slider-track"] { flex: 1; height: 6px; border-radius: var(--radius-pill); background: var(--color-surface-muted); }
|
|
241
|
+
[data-slot="slider"][data-orientation="horizontal"] [data-slot="slider-indicator"] { border-radius: inherit; background: var(--color-accent); }
|
|
242
|
+
[data-slot="slider"][data-orientation="horizontal"] [data-slot="slider-thumb"] { box-sizing: border-box; width: var(--thumb); height: var(--thumb); border: 2px solid var(--color-accent); border-radius: 50%; background: var(--color-surface-raised); }
|
|
243
|
+
[data-slot="slider"][data-orientation="horizontal"][data-dragging] :is([data-slot="slider-control"], [data-slot="slider-thumb"]) { cursor: grabbing; }
|
|
244
|
+
[data-slot="slider"][data-orientation="horizontal"][data-disabled] { opacity: 0.58; }
|
|
245
|
+
[data-slot="slider"][data-orientation="horizontal"][data-disabled] :is([data-slot="slider-control"], [data-slot="slider-thumb"]) { cursor: not-allowed; }
|
|
246
|
+
|
|
247
|
+
/* ---------- Progress ---------- */
|
|
248
|
+
/* A 9px track with a hairline edge holding the accent indicator. ui-sdk sizes the indicator with an inline
|
|
249
|
+
width. An indeterminate progress (no value) is unsupported. */
|
|
250
|
+
[data-slot="progress"]:not([data-indeterminate]) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-3); }
|
|
251
|
+
[data-slot="progress"]:not([data-indeterminate]) > [data-slot="progress-value"] { color: var(--color-muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
|
|
252
|
+
[data-slot="progress"]:not([data-indeterminate]) > [data-slot="progress-track"] { grid-column: 1 / -1; height: 9px; overflow: hidden; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-pill); background: var(--color-surface-muted); }
|
|
253
|
+
[data-slot="progress"]:not([data-indeterminate]) [data-slot="progress-indicator"] { height: 100%; border-radius: inherit; background: var(--color-accent); transition: width var(--duration-fast) var(--ease-out); }
|
|
254
|
+
|
|
255
|
+
/* ---------- Drawer ---------- */
|
|
256
|
+
/* A full-height floating layer with square corners on the left or right edge; ui-sdk places and slides it.
|
|
257
|
+
The content holds a <header> (the title, then the close button) and a body that scrolls on its own.
|
|
258
|
+
A top or bottom sheet is unsupported. */
|
|
259
|
+
[data-slot="drawer-backdrop"] { position: fixed; inset: 0; background: var(--color-overlay); }
|
|
260
|
+
[data-slot="drawer-content"]:is([data-side="left"], [data-side="right"]) { display: flex; flex-direction: column; width: min(calc(var(--sidebar) + var(--space-12)), calc(100vw - var(--space-12))); height: 100%; overflow: hidden; border: 1px solid transparent; background: var(--color-surface-raised); color: var(--color-text); box-shadow: var(--shadow-dialog); }
|
|
261
|
+
[data-slot="drawer-content"]:is([data-side="left"], [data-side="right"]) > header { display: flex; flex: none; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border-subtle); }
|
|
262
|
+
[data-slot="drawer-content"]:is([data-side="left"], [data-side="right"]) > :not(header) { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: var(--space-4); }
|
|
263
|
+
[data-slot="drawer-content"]:is([data-side="left"], [data-side="right"]) > header > [data-slot="drawer-title"] { margin: 0; font-size: var(--text-md); font-weight: var(--weight-medium); letter-spacing: 0; }
|
|
264
|
+
|
|
265
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
266
|
+
/* Motion answers the reader: a glide runs only while the pointer or focus is in the control, so ui-sdk's
|
|
267
|
+
first measurement after mount places the thumb at once. A re-measure while the pointer or focus is in
|
|
268
|
+
the control, such as on a resize, glides too; nothing in the markup tells it from a change of choice.
|
|
269
|
+
ui-sdk does not say which way a choice moved before it moves the thumb (a tab's direction attribute
|
|
270
|
+
arrives a frame late), so both edges glide together over 260ms, without the spec's stretch. */
|
|
271
|
+
[data-slot="segmented-control"][data-orientation="horizontal"]:is(:hover, :focus-within) > [data-slot="segmented-control-indicator"] { transition: left 260ms ease, width 260ms ease; }
|
|
272
|
+
[data-slot="tabs-list"][data-orientation="horizontal"]:is(:hover, :focus-within) > [data-slot="tabs-indicator"] { transition: left 260ms ease, width 260ms ease; }
|
|
273
|
+
/* Hover fades a label over --duration-fast. While focus is in the control, the labels cross-fade over 260ms
|
|
274
|
+
with the glide, hover included. A click focuses the option in Chromium and Firefox; where a click does not
|
|
275
|
+
focus a button (Safari on macOS), a clicked choice's labels fade over --duration-fast. */
|
|
276
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"] { transition: color var(--duration-fast) var(--ease-out); }
|
|
277
|
+
[data-slot="segmented-control"][data-orientation="horizontal"]:focus-within > [data-slot="segmented-control-item"] { transition: color 260ms ease; }
|
|
278
|
+
[data-slot="tabs-list"][data-orientation="horizontal"]:focus-within > [data-slot="tabs-tab"] { transition: background-color var(--duration-fast) var(--ease-out), color 260ms ease; }
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* ---------- Menu ---------- */
|
|
282
|
+
/* MenuTrigger is the overflow quiet action; the app supplies the More SVG. Submenu triggers
|
|
283
|
+
share its slot but have role="menuitem", and nested content shares MenuContent's slot. */
|
|
284
|
+
[data-slot="menu-trigger"]:not([role="menuitem"]) { display: inline-flex; align-items: center; justify-content: center; width: var(--control-sm); height: var(--control-sm); border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--color-muted); font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
|
|
285
|
+
[data-slot="menu-trigger"]:not([role="menuitem"])[data-open] { background: color-mix(in srgb, currentColor 6%, transparent); }
|
|
286
|
+
[data-slot="menu-trigger"]:not([role="menuitem"]) > svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
|
|
287
|
+
@media (hover: hover) {
|
|
288
|
+
[data-slot="menu-trigger"]:not([role="menuitem"]):hover:not([data-disabled]) { color: var(--color-text); background: color-mix(in srgb, currentColor 6%, transparent); }
|
|
289
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-item"]:hover:not([data-disabled]) { background: var(--color-row-hover); }
|
|
290
|
+
}
|
|
291
|
+
[data-slot="menu-trigger"]:not([role="menuitem"]):active:not([data-disabled]) { background: color-mix(in srgb, currentColor 12%, transparent); }
|
|
292
|
+
[data-slot="menu-trigger"]:not([role="menuitem"])[data-disabled] { opacity: 0.58; cursor: not-allowed; }
|
|
293
|
+
/* ui-sdk positions the layer and supplies its 4px gap; align="end" matches the recipe.
|
|
294
|
+
No animation: the menu opens and closes at once. The rules draw only data-presentation="popover";
|
|
295
|
+
a sheet is unsupported. */
|
|
296
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) { z-index: 3; display: grid; min-width: 180px; padding: var(--space-1); border: 1px solid transparent; border-radius: var(--radius-panel); background: var(--color-surface-raised); box-shadow: var(--shadow-dialog); color: var(--color-text); font: inherit; }
|
|
297
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-item"] { display: flex; align-items: center; gap: var(--space-2); min-height: var(--row); padding: 0 var(--space-3); border: 1px solid transparent; border-radius: calc(var(--radius-panel) - var(--space-1)); background: transparent; color: var(--color-text); font: inherit; text-align: start; cursor: pointer; }
|
|
298
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-item"][data-destructive] { color: light-dark(color-mix(in srgb, var(--color-error) 75%, var(--color-status-ink)), color-mix(in srgb, var(--color-error) 85%, var(--color-status-ink))); }
|
|
299
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-item"]:is(:focus-visible, [data-highlighted]):not([data-disabled]) { background: var(--color-row-hover); }
|
|
300
|
+
/* An inset ring, as the catalogue's menu rows draw, so it stays inside the menu. */
|
|
301
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-item"]:focus-visible { outline-offset: calc(var(--focus-width) * -1); }
|
|
302
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-item"][data-disabled] { opacity: 0.58; cursor: not-allowed; }
|
|
303
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-separator"] { margin: var(--space-1) calc(var(--space-1) * -1); border-top: 1px solid var(--color-border-subtle); }
|
|
304
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-item"] > [data-slot="menu-item-icon"] { display: inline-flex; flex: none; }
|
|
305
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-item"] > [data-slot="menu-item-icon"] > svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
|
|
306
|
+
@media (max-width: 800px) {
|
|
307
|
+
[data-slot="menu-trigger"]:not([role="menuitem"]) { width: var(--control-lg); height: var(--control-lg); }
|
|
308
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-item"] { min-height: var(--control-lg); }
|
|
309
|
+
}
|
|
310
|
+
@media (forced-colors: active) {
|
|
311
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-item"]:is(:focus-visible, [data-highlighted]):not([data-disabled]) { forced-color-adjust: none; background: Highlight; color: HighlightText; }
|
|
312
|
+
[data-slot="menu-content"][data-presentation="popover"]:not([data-nested]) > [data-slot="menu-separator"] { border-top-color: CanvasText; }
|
|
313
|
+
}
|
|
314
|
+
|
|
187
315
|
/* ---------- Focus ---------- */
|
|
188
316
|
/* One ring for every role, over the control's own raise or sink; the base draws the same ring, and this pins it. */
|
|
189
317
|
/* It goes on the visible part of a composite control: the switch track and the radio card. */
|
|
@@ -191,9 +319,14 @@
|
|
|
191
319
|
outline-color rules below still win. */
|
|
192
320
|
:is([data-slot="button"], [data-slot="checkbox"], [data-slot="radio"], [data-slot="switch"]):focus-visible,
|
|
193
321
|
[data-slot="toggle"]:not([data-orientation]):has(> [data-slot="toggle-icon"]:empty):focus-visible,
|
|
194
|
-
[data-slot="dialog-content"] > header > [data-slot="dialog-close"]:focus-visible,
|
|
322
|
+
:is([data-slot="dialog-content"], [data-slot="drawer-content"]) > header > :is([data-slot="dialog-close"], [data-slot="drawer-close"]):focus-visible,
|
|
195
323
|
[data-slot="dialog-content"][data-presentation="dialog"]:focus-visible,
|
|
196
324
|
[data-slot="card"]:has(> [data-slot="radio"]:focus-visible) { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
|
|
325
|
+
/* The slider's hidden range input takes focus, so the ring goes on the thumb around it. */
|
|
326
|
+
[data-slot="slider"][data-orientation="horizontal"] [data-slot="slider-thumb"]:has(:focus-visible) { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
|
|
327
|
+
/* Inset: a segmented option's ring hugs its thumb instead of crossing into the next option, and the tab list
|
|
328
|
+
scrolls, which would clip an outer ring. */
|
|
329
|
+
:is([data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"], [data-slot="tabs-list"][data-orientation="horizontal"] > [data-slot="tabs-tab"]):focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
|
|
197
330
|
/* The card draws the ring, so the radio inside it does not. */
|
|
198
331
|
[data-slot="card"] > [data-slot="radio"]:focus-visible { outline: none; }
|
|
199
332
|
|
|
@@ -204,6 +337,9 @@
|
|
|
204
337
|
[data-slot="label"]:not([data-size]):has(> :is([data-slot="checkbox"], [data-slot="radio"], [data-slot="switch"])) { min-height: var(--control-lg); }
|
|
205
338
|
[data-slot="toggle"]:not([data-size], [data-orientation]):has(> [data-slot="toggle-icon"]:empty) { min-height: var(--control-lg); }
|
|
206
339
|
[data-slot="select-trigger"]:not([data-size]) { height: var(--control-lg); }
|
|
340
|
+
[data-slot="segmented-control"][data-orientation="horizontal"]:not([data-size]) { --item: var(--control-lg); }
|
|
341
|
+
[data-slot="tabs-list"][data-orientation="horizontal"] > [data-slot="tabs-tab"] { min-height: var(--control-lg); }
|
|
342
|
+
[data-slot="slider"][data-orientation="horizontal"]:not([data-size]) > [data-slot="slider-control"] { height: var(--control-lg); }
|
|
207
343
|
}
|
|
208
344
|
|
|
209
345
|
@media (forced-colors: active) {
|
|
@@ -219,5 +355,14 @@
|
|
|
219
355
|
:is([data-slot="switch"][data-checked], [data-slot="toggle"][data-pressed]:not([data-orientation]) > [data-slot="toggle-icon"]:empty:first-child) { border-color: Highlight; background: Highlight; }
|
|
220
356
|
[data-slot="switch-thumb"][data-checked], [data-slot="toggle"][data-pressed]:not([data-orientation]) > [data-slot="toggle-icon"]:empty:first-child::after { background: HighlightText; }
|
|
221
357
|
[data-slot="switch"]:focus-visible { outline-color: CanvasText; }
|
|
358
|
+
/* The checked segmented option draws Highlight behind HighlightText; both opt out, so its ring takes CanvasText. */
|
|
359
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-indicator"] { forced-color-adjust: none; background: Highlight; }
|
|
360
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"][data-checked] { forced-color-adjust: none; color: HighlightText; }
|
|
361
|
+
[data-slot="segmented-control"][data-orientation="horizontal"] > [data-slot="segmented-control-item"][data-checked]:focus-visible { outline-color: CanvasText; }
|
|
362
|
+
/* The fill drops, so the selected tab takes a system border; the padding absorbs it. */
|
|
363
|
+
[data-slot="tabs-list"][data-orientation="horizontal"] > [data-slot="tabs-indicator"] { display: none; }
|
|
364
|
+
[data-slot="tabs-list"][data-orientation="horizontal"] > [data-slot="tabs-tab"][data-selected] { border: 2px solid Highlight; padding: calc(var(--space-2) - 2px) calc(var(--space-3) - 2px); }
|
|
365
|
+
/* Value marks: only the mark opts out of adjustment and redraws in the system highlight. */
|
|
366
|
+
:is([data-slot="slider"][data-orientation="horizontal"] [data-slot="slider-indicator"], [data-slot="progress"]:not([data-indeterminate]) [data-slot="progress-indicator"]) { forced-color-adjust: none; background: Highlight; }
|
|
222
367
|
}
|
|
223
368
|
}
|