viewkitjs 0.22.0 → 0.24.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/CHANGELOG.md +38 -0
- package/package.json +2 -4
- package/views/dist/contract.d.ts +6 -289
- package/views/dist/contract.js +1 -96
- package/views/dist/controls/atoms.d.ts +8 -0
- package/views/dist/controls/atoms.js +8 -0
- package/views/dist/controls/button/tokens.d.ts +351 -0
- package/views/dist/controls/button/tokens.js +90 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +28 -0
- package/views/dist/controls/checkbox/checkbox.js +15 -0
- package/views/dist/controls/checkbox/looks.d.ts +3 -0
- package/views/dist/controls/checkbox/looks.js +8 -0
- package/views/dist/controls/checkbox/map-checkbox.d.ts +2 -0
- package/views/dist/controls/checkbox/map-checkbox.js +5 -0
- package/views/dist/controls/checkbox/tokens.d.ts +131 -0
- package/views/dist/controls/checkbox/tokens.js +35 -0
- package/views/dist/controls/checkbox.css +133 -0
- package/views/dist/controls/controls.d.ts +12 -3
- package/views/dist/controls/controls.js +13 -1
- package/views/dist/controls/field/field.d.ts +94 -0
- package/views/dist/controls/field/field.js +46 -0
- package/views/dist/controls/field/looks.d.ts +13 -0
- package/views/dist/controls/field/looks.js +22 -0
- package/views/dist/controls/field/tokens.d.ts +75 -0
- package/views/dist/controls/field/tokens.js +21 -0
- package/views/dist/controls/field.css +98 -0
- package/views/dist/controls/glass-button/glass-button.d.ts +40 -0
- package/views/dist/controls/glass-button/glass-button.js +16 -0
- package/views/dist/controls/glass-button/looks.d.ts +4 -0
- package/views/dist/controls/glass-button/looks.js +4 -0
- package/views/dist/controls/glass-button/tokens.d.ts +127 -0
- package/views/dist/controls/glass-button/tokens.js +34 -0
- package/views/dist/controls/glass-button.css +111 -0
- package/views/dist/controls/grip/grip.d.ts +14 -0
- package/views/dist/controls/grip/grip.js +9 -0
- package/views/dist/controls/index.d.ts +32 -0
- package/views/dist/controls/index.js +31 -0
- package/views/dist/controls/inline-input/inline-input.d.ts +14 -0
- package/views/dist/controls/inline-input/inline-input.js +10 -0
- package/views/dist/controls/inline-input/looks.d.ts +3 -0
- package/views/dist/controls/inline-input/looks.js +16 -0
- package/views/dist/controls/inline-input/tokens.d.ts +79 -0
- package/views/dist/controls/inline-input/tokens.js +22 -0
- package/views/dist/controls/inline-input.css +78 -0
- package/views/dist/controls/input/autofill.d.ts +25 -0
- package/views/dist/controls/input/autofill.js +17 -0
- package/views/dist/controls/input/input.d.ts +119 -0
- package/views/dist/controls/input/input.js +127 -0
- package/views/dist/controls/input/looks.d.ts +41 -0
- package/views/dist/controls/input/looks.js +48 -0
- package/views/dist/controls/input/map-input.d.ts +2 -0
- package/views/dist/controls/input/map-input.js +5 -0
- package/views/dist/controls/input/tokens.d.ts +171 -0
- package/views/dist/controls/input/tokens.js +45 -0
- package/views/dist/controls/input.css +381 -0
- package/views/dist/controls/internal/anchor.d.ts +16 -0
- package/views/dist/controls/internal/anchor.js +8 -0
- package/views/dist/controls/internal/close-reason.d.ts +5 -0
- package/views/dist/controls/internal/close-reason.js +2 -0
- package/views/dist/controls/internal/hold.d.ts +25 -0
- package/views/dist/controls/internal/hold.js +81 -0
- package/views/dist/controls/internal/icons.d.ts +8 -0
- package/views/dist/controls/internal/icons.js +65 -0
- package/views/dist/controls/internal/popup-host.d.ts +7 -0
- package/views/dist/controls/internal/popup-host.js +10 -0
- package/views/dist/controls/internal/read-token.d.ts +6 -0
- package/views/dist/controls/internal/read-token.js +11 -0
- package/views/dist/controls/internal/reorder.d.ts +44 -0
- package/views/dist/controls/internal/reorder.js +83 -0
- package/views/dist/controls/internal/scroll.d.ts +11 -0
- package/views/dist/controls/internal/scroll.js +14 -0
- package/views/dist/controls/kbd/kbd.d.ts +13 -0
- package/views/dist/controls/kbd/kbd.js +10 -0
- package/views/dist/controls/kbd/looks.d.ts +4 -0
- package/views/dist/controls/kbd/looks.js +4 -0
- package/views/dist/controls/kbd/tokens.d.ts +47 -0
- package/views/dist/controls/kbd/tokens.js +14 -0
- package/views/dist/controls/kbd.css +46 -0
- package/views/dist/controls/list/tokens.d.ts +139 -0
- package/views/dist/controls/list/tokens.js +37 -0
- package/views/dist/controls/list.css +188 -0
- package/views/dist/controls/menu-list/keys.d.ts +7 -0
- package/views/dist/controls/menu-list/keys.js +29 -0
- package/views/dist/controls/menu-list/looks.d.ts +4 -0
- package/views/dist/controls/menu-list/looks.js +20 -0
- package/views/dist/controls/menu-list/menu-list.d.ts +196 -0
- package/views/dist/controls/menu-list/menu-list.js +346 -0
- package/views/dist/controls/menu-list/tokens.d.ts +187 -0
- package/views/dist/controls/menu-list/tokens.js +49 -0
- package/views/dist/controls/menu-list.css +259 -0
- package/views/dist/controls/number-field/number-field.d.ts +48 -0
- package/views/dist/controls/number-field/number-field.js +34 -0
- package/views/dist/controls/number-field/tokens.d.ts +47 -0
- package/views/dist/controls/number-field/tokens.js +14 -0
- package/views/dist/controls/number-field.css +54 -0
- package/views/dist/controls/option/atom-tag.d.ts +6 -0
- package/views/dist/controls/option/atom-tag.js +6 -0
- package/views/dist/controls/option/looks.d.ts +7 -0
- package/views/dist/controls/option/looks.js +21 -0
- package/views/dist/controls/option/option.d.ts +35 -0
- package/views/dist/controls/option/option.js +32 -0
- package/views/dist/controls/option/tokens.d.ts +223 -0
- package/views/dist/controls/option/tokens.js +58 -0
- package/views/dist/controls/option.css +92 -0
- package/views/dist/controls/phone-header/header-bar.d.ts +18 -0
- package/views/dist/controls/phone-header/header-bar.js +9 -0
- package/views/dist/controls/phone-header/looks.d.ts +4 -0
- package/views/dist/controls/phone-header/looks.js +4 -0
- package/views/dist/controls/phone-header/soft-edge.d.ts +5 -0
- package/views/dist/controls/phone-header/soft-edge.js +3 -0
- package/views/dist/controls/phone-header/tokens.d.ts +59 -0
- package/views/dist/controls/phone-header/tokens.js +17 -0
- package/views/dist/controls/phone-header.css +51 -0
- package/views/dist/controls/popover/looks.d.ts +4 -0
- package/views/dist/controls/popover/looks.js +10 -0
- package/views/dist/controls/popover/map-popover.d.ts +3 -0
- package/views/dist/controls/popover/map-popover.js +5 -0
- package/views/dist/controls/popover/popover.d.ts +74 -0
- package/views/dist/controls/popover/popover.js +106 -0
- package/views/dist/controls/popover/tokens.d.ts +83 -0
- package/views/dist/controls/popover/tokens.js +23 -0
- package/views/dist/controls/popover.css +94 -0
- package/views/dist/controls/scrollbar/scrollbar.d.ts +10 -0
- package/views/dist/controls/scrollbar/scrollbar.js +143 -0
- package/views/dist/controls/scrollbar/tokens.d.ts +43 -0
- package/views/dist/controls/scrollbar/tokens.js +13 -0
- package/views/dist/controls/scrollbar.css +47 -0
- package/views/dist/controls/sheet/bottom-sheet.d.ts +98 -0
- package/views/dist/controls/sheet/bottom-sheet.js +375 -0
- package/views/dist/controls/sheet/forms.d.ts +38 -0
- package/views/dist/controls/sheet/forms.js +26 -0
- package/views/dist/controls/sheet/looks.d.ts +4 -0
- package/views/dist/controls/sheet/looks.js +10 -0
- package/views/dist/controls/sheet/map-sheet.d.ts +3 -0
- package/views/dist/controls/sheet/map-sheet.js +12 -0
- package/views/dist/controls/sheet/spring.d.ts +22 -0
- package/views/dist/controls/sheet/spring.js +48 -0
- package/views/dist/controls/sheet/tokens.d.ts +143 -0
- package/views/dist/controls/sheet/tokens.js +38 -0
- package/views/dist/controls/sheet.css +223 -0
- package/views/dist/controls/spinner/tokens.d.ts +55 -0
- package/views/dist/controls/spinner/tokens.js +16 -0
- package/views/dist/controls/status/atom-status-badge.d.ts +10 -0
- package/views/dist/controls/status/atom-status-badge.js +13 -0
- package/views/dist/controls/status/looks.d.ts +4 -0
- package/views/dist/controls/status/looks.js +22 -0
- package/views/dist/controls/status/marks.d.ts +26 -0
- package/views/dist/controls/status/marks.js +73 -0
- package/views/dist/controls/status/status.d.ts +43 -0
- package/views/dist/controls/status/status.js +26 -0
- package/views/dist/controls/status/tokens.d.ts +407 -0
- package/views/dist/controls/status/tokens.js +104 -0
- package/views/dist/controls/status.css +164 -0
- package/views/dist/controls/switch/looks.d.ts +4 -0
- package/views/dist/controls/switch/looks.js +19 -0
- package/views/dist/controls/switch/switch.d.ts +15 -0
- package/views/dist/controls/switch/switch.js +11 -0
- package/views/dist/controls/switch/tokens.d.ts +139 -0
- package/views/dist/controls/switch/tokens.js +37 -0
- package/views/dist/controls/switch.css +169 -0
- package/views/dist/controls/tag/atom-cell-more.d.ts +3 -0
- package/views/dist/controls/tag/atom-cell-more.js +5 -0
- package/views/dist/controls/tag/looks.d.ts +4 -0
- package/views/dist/controls/tag/looks.js +4 -0
- package/views/dist/controls/tag/tag.d.ts +25 -0
- package/views/dist/controls/tag/tag.js +19 -0
- package/views/dist/controls/tag/tokens.d.ts +63 -0
- package/views/dist/controls/tag/tokens.js +18 -0
- package/views/dist/controls/tag.css +81 -0
- package/views/dist/controls/toggle/looks.d.ts +3 -0
- package/views/dist/controls/toggle/looks.js +12 -0
- package/views/dist/controls/toggle/toggle.d.ts +47 -0
- package/views/dist/controls/toggle/toggle.js +23 -0
- package/views/dist/controls/toggle/tokens.d.ts +55 -0
- package/views/dist/controls/toggle/tokens.js +16 -0
- package/views/dist/controls/toggle.css +67 -0
- package/views/dist/controls/tokens.d.ts +16 -0
- package/views/dist/controls/tokens.js +49 -0
- package/views/dist/controls/tooltip/looks.d.ts +4 -0
- package/views/dist/controls/tooltip/looks.js +4 -0
- package/views/dist/controls/tooltip/map-tooltip.d.ts +3 -0
- package/views/dist/controls/tooltip/map-tooltip.js +5 -0
- package/views/dist/controls/tooltip/tokens.d.ts +75 -0
- package/views/dist/controls/tooltip/tokens.js +21 -0
- package/views/dist/controls/tooltip/tooltip.d.ts +54 -0
- package/views/dist/controls/tooltip/tooltip.js +78 -0
- package/views/dist/controls/tooltip.css +94 -0
- package/views/dist/grid/chrome/GridTable.js +21 -19
- package/views/dist/grid/chrome/grid-caret-keys.d.ts +7 -0
- package/views/dist/grid/chrome/grid-caret-keys.js +22 -0
- package/views/dist/grid/chrome/grid-row-window.js +3 -0
- package/views/dist/grid/chrome/useGridColumnLayout.d.ts +4 -1
- package/views/dist/grid/chrome/useGridColumnLayout.js +17 -2
- package/views/dist/grid/chrome/useGridFittedWidths.d.ts +32 -0
- package/views/dist/grid/chrome/useGridFittedWidths.js +59 -0
- package/views/dist/grid/chrome/useGridKeyboard.js +3 -0
- package/views/dist/looks/index.d.ts +16 -0
- package/views/dist/looks/index.js +16 -0
- package/views/dist/looks/looks.d.ts +10 -9
- package/views/dist/looks/pieces.js +38 -2
- package/views/dist/model/column-schema.d.ts +3 -2
- package/views/dist/model/column-state.d.ts +11 -1
- package/views/dist/model/column-state.js +8 -2
- package/views/dist/styles.css +2362 -7
- package/views/dist/styles.unlayered.css +2362 -7
- package/views/docs/contract.md +5 -97
- package/views/docs/controls/button.md +93 -0
- package/views/docs/controls/checkbox.md +38 -0
- package/views/docs/controls/field.md +26 -0
- package/views/docs/controls/glass-button.md +37 -0
- package/views/docs/controls/inline-input.md +27 -0
- package/views/docs/controls/input.md +48 -0
- package/views/docs/controls/kbd.md +17 -0
- package/views/docs/controls/list.md +40 -0
- package/views/docs/controls/menu-list.md +52 -0
- package/views/docs/controls/number-field.md +17 -0
- package/views/docs/controls/option.md +61 -0
- package/views/docs/controls/phone-header.md +20 -0
- package/views/docs/controls/popover.md +26 -0
- package/views/docs/controls/scrollbar.md +16 -0
- package/views/docs/controls/sheet.md +41 -0
- package/views/docs/controls/spinner.md +19 -0
- package/views/docs/controls/status.md +107 -0
- package/views/docs/controls/switch.md +40 -0
- package/views/docs/controls/tag.md +21 -0
- package/views/docs/controls/toggle.md +19 -0
- package/views/docs/controls/tooltip.md +24 -0
- package/views/docs/getting-started.md +1 -1
- package/views/docs/reference/controls.md +213 -2
- package/views/docs/reference/looks.md +70 -3
- package/views/docs/reference/views.md +7 -2
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/* THE LIST: what floats over the page with rows in it, a select's list and a menu's panel. Every value is one of ViewKit's
|
|
2
|
+
public names, the Outright token each stands for listed in list/tokens.ts. Base UI marks
|
|
3
|
+
the popup data-open, data-starting-style and data-ending-style, and a row data-highlighted (under the
|
|
4
|
+
pointer or the keyboard), data-selected or data-checked, and data-disabled; a row drawn standing still
|
|
5
|
+
on a sheet takes data-force="hover".
|
|
6
|
+
|
|
7
|
+
The rules sit in the components layer, so a utility class still wins. */
|
|
8
|
+
@layer components {
|
|
9
|
+
|
|
10
|
+
/* ── The list's options (a select's options, which name them): set on the
|
|
11
|
+
frame around a list as custom properties, which every list inside it reads, the Select's list and the Menu's panel whole, and
|
|
12
|
+
the Picker on a computer whole, its rows and its Popover's panel. Each value chooses a token. Unset, a list draws as built.
|
|
13
|
+
data-list-smoothing smooth · round the smooth outline, or round
|
|
14
|
+
data-list-edge subtle · outline · none border-subtle, border, or none; the dividers wear its colour,
|
|
15
|
+
border-subtle with none (Mihai, 14 Nov 2026)
|
|
16
|
+
data-list-shadow none · xs · sm · md · lg · xl the shadow tokens' steps
|
|
17
|
+
data-list-padding 0 · 2 · 4 · 6 · 8 its rows' inset; at 0 they run edge to edge, square
|
|
18
|
+
data-list-rows 28 · 30 · … · 40, by 2 a row's height on a computer; the phone's stays 44
|
|
19
|
+
data-list-highlight fill · brand the overlay's hover, or the brand's tint
|
|
20
|
+
data-list-row-corners input · 0 · xs … xl · full a row's corners: the Input box's, or a step of their own, the rows alone
|
|
21
|
+
data-list-intensity 1 · 2 · 3 how strong the highlight is
|
|
22
|
+
data-list-dividers words · rows · full a line between groups: inset (the default) from
|
|
23
|
+
where a row's content starts (its mark, or its words), as far in at the end,
|
|
24
|
+
as wide as the rows, or edge to edge; every line inside a floating surface
|
|
25
|
+
alike, the popup line's, the Date editor's and the Values editor's
|
|
26
|
+
Its corners follow the Input's (Mihai, 14 Nov 2026): a row takes the Input box's corners whatever the padding, and the panel the
|
|
27
|
+
box's plus its padding, so the two curves run alike; a Pill box's rows are round at their ends, its panel 2xl and the padding.
|
|
28
|
+
Row corners moves the rows alone: the panel keeps the box's corners and its padding (Mihai, 14 Nov 2026). ── */
|
|
29
|
+
[data-input-radius="xs"] { --list-box-r: var(--vk-radius-xs); --list-box-pill: 0; }
|
|
30
|
+
[data-input-radius="sm"] { --list-box-r: var(--vk-radius-sm); --list-box-pill: 0; }
|
|
31
|
+
[data-input-radius="md"] { --list-box-r: var(--vk-radius-md); --list-box-pill: 0; }
|
|
32
|
+
[data-input-radius="lg"] { --list-box-r: var(--vk-radius-lg); --list-box-pill: 0; }
|
|
33
|
+
[data-input-radius="xl"] { --list-box-r: var(--vk-radius-xl); --list-box-pill: 0; }
|
|
34
|
+
[data-input-radius="2xl"] { --list-box-r: var(--vk-radius-2xl); --list-box-pill: 0; }
|
|
35
|
+
/* A Pill box's rows are pills, and its panel keeps its 2xl (--list-box-pill says so, under the list's Smooth). */
|
|
36
|
+
[data-input-radius="full"] { --list-box-r: var(--vk-radius-2xl); --list-box-pill: 1; }
|
|
37
|
+
[data-list-edge="outline"] { --list-edge: var(--vk-border); --list-sep-colour: var(--vk-border); }
|
|
38
|
+
[data-list-edge="none"] { --list-edge: transparent; }
|
|
39
|
+
[data-list-shadow="none"] { --list-shadow: none; }
|
|
40
|
+
[data-list-shadow="xs"] { --list-shadow: var(--vk-shadow-xs); }
|
|
41
|
+
[data-list-shadow="sm"] { --list-shadow: var(--vk-shadow-sm); }
|
|
42
|
+
[data-list-shadow="lg"] { --list-shadow: var(--vk-shadow-lg); }
|
|
43
|
+
[data-list-shadow="xl"] { --list-shadow: var(--vk-shadow-xl); }
|
|
44
|
+
[data-list-padding="0"] { --list-pad: 0px; --list-row-corners: 0px; --list-row-corners-pill: 0; }
|
|
45
|
+
[data-list-padding="2"] { --list-pad: calc(var(--vk-spacing) * 0.5); }
|
|
46
|
+
[data-list-padding="6"] { --list-pad: calc(var(--vk-spacing) * 1.5); }
|
|
47
|
+
[data-list-padding="8"] { --list-pad: calc(var(--vk-spacing) * 2); }
|
|
48
|
+
[data-list-rows="28"] { --list-row-h: calc(var(--vk-spacing) * 7); --list-row-pad: var(--vk-spacing); }
|
|
49
|
+
[data-list-rows="30"] { --list-row-h: calc(var(--vk-spacing) * 7.5); }
|
|
50
|
+
[data-list-rows="34"] { --list-row-h: calc(var(--vk-spacing) * 8.5); }
|
|
51
|
+
[data-list-rows="36"] { --list-row-h: calc(var(--vk-spacing) * 9); }
|
|
52
|
+
[data-list-rows="38"] { --list-row-h: calc(var(--vk-spacing) * 9.5); }
|
|
53
|
+
[data-list-rows="40"] { --list-row-h: calc(var(--vk-spacing) * 10); }
|
|
54
|
+
[data-list-highlight="brand"] { --list-highlight: var(--list-hl-brand, var(--vk-brand-subtlest)); }
|
|
55
|
+
/* The Dividers as two numbers on the frame, so the nearest frame's pick wins, for every line that reaches by them:
|
|
56
|
+
--dividers-words 1 where a line stands in by a row's 8 (Inset), --dividers-rows 1 where it stands in by what its holder pads. */
|
|
57
|
+
[data-list-dividers="words"] { --dividers-words: 1; --dividers-rows: 1; }
|
|
58
|
+
[data-list-dividers="rows"] { --list-sep-inset: 0px; --dividers-words: 0; --dividers-rows: 1; }
|
|
59
|
+
[data-list-dividers="full"] { --list-sep-inset: calc(-1 * var(--list-pad, var(--vk-spacing))); --dividers-words: 0; --dividers-rows: 0; }
|
|
60
|
+
[data-list-row-corners="0"] { --list-row-r: 0px; --list-row-pill: 0; }
|
|
61
|
+
[data-list-row-corners="xs"] { --list-row-r: var(--vk-radius-xs); --list-row-pill: 0; }
|
|
62
|
+
[data-list-row-corners="sm"] { --list-row-r: var(--vk-radius-sm); --list-row-pill: 0; }
|
|
63
|
+
[data-list-row-corners="md"] { --list-row-r: var(--vk-radius-md); --list-row-pill: 0; }
|
|
64
|
+
[data-list-row-corners="lg"] { --list-row-r: var(--vk-radius-lg); --list-row-pill: 0; }
|
|
65
|
+
[data-list-row-corners="xl"] { --list-row-r: var(--vk-radius-xl); --list-row-pill: 0; }
|
|
66
|
+
[data-list-row-corners="full"] { --list-row-r: var(--vk-radius-full); --list-row-pill: 1; }
|
|
67
|
+
[data-list-intensity="2"] { --list-hl-grey: var(--vk-overlay-pressed); --list-hl-brand: var(--vk-brand-subtler); }
|
|
68
|
+
[data-list-intensity="3"] { --list-hl-grey: var(--vk-overlay-selected); --list-hl-brand: var(--vk-brand-subtler-hovered); }
|
|
69
|
+
|
|
70
|
+
/* ── The panel: on the overlay's ground, a soft edge, the Input box's corners and its padding round them, 4px in; it fades in and drops 4px ─ */
|
|
71
|
+
/* Its lines' colour, --divider-colour, its Edge's (border-subtle with none): what it holds draws its lines in it. */
|
|
72
|
+
.o-list {
|
|
73
|
+
--list-row-corners-in: var(--list-row-corners, var(--list-row-r, var(--list-box-r, var(--vk-radius-lg))));
|
|
74
|
+
--divider-colour: var(--list-sep-colour, var(--vk-border-subtle));
|
|
75
|
+
box-sizing: border-box; display: grid; padding: var(--list-pad, var(--vk-spacing));
|
|
76
|
+
border: var(--vk-border-width) solid var(--list-edge, var(--vk-border-subtle)); border-radius: calc(min(var(--list-box-r, var(--vk-radius-lg)), var(--vk-radius-2xl)) + var(--list-pad, var(--vk-spacing)));
|
|
77
|
+
background-color: var(--vk-overlay); box-shadow: var(--list-shadow, var(--vk-shadow-md)); color: var(--vk-fg); outline: none;
|
|
78
|
+
transition: opacity var(--vk-duration-fast) var(--vk-ease-out), translate var(--vk-duration-fast) var(--vk-ease-out);
|
|
79
|
+
}
|
|
80
|
+
.o-list:is([data-starting-style], [data-ending-style]) { opacity: 0; translate: 0 calc(var(--vk-spacing) * -1); }
|
|
81
|
+
.o-list-positioner { z-index: var(--vk-layer-popup); outline: none; }
|
|
82
|
+
|
|
83
|
+
/* ── A row: 32px, the radius's corners, text-sm; under the pointer or the keyboard the overlay's hover ─ */
|
|
84
|
+
.o-list-row {
|
|
85
|
+
display: flex; align-items: center; gap: calc(var(--vk-spacing) * 2); box-sizing: border-box; width: 100%; min-height: var(--list-row-h, calc(var(--vk-spacing) * 8));
|
|
86
|
+
margin: 0; padding: var(--list-row-pad, calc(var(--vk-spacing) * 1.25)) calc(var(--vk-spacing) * 2); border: 0; border-radius: var(--list-row-rad, var(--vk-radius-lg));
|
|
87
|
+
background-color: transparent; color: var(--vk-fg); font: inherit; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm));
|
|
88
|
+
text-align: left; cursor: pointer; outline: none; user-select: none; -webkit-tap-highlight-color: transparent;
|
|
89
|
+
}
|
|
90
|
+
/* Inside a list's panel its corners are the Input box's (square at padding 0); elsewhere (the Picker's, in its shell) the radius's. */
|
|
91
|
+
.o-list .o-list-row { --list-row-rad: var(--list-row-corners-in); --list-row-pill-in: var(--list-row-corners-pill, var(--list-row-pill, var(--list-box-pill, 0))); }
|
|
92
|
+
.o-list-row:is([data-highlighted], [data-popup-open], [data-force="hover"]) { background-color: var(--list-highlight, var(--list-hl-grey, var(--vk-overlay-hovered))); }
|
|
93
|
+
/* A row that can't be picked: greyed, no fill under the pointer. */
|
|
94
|
+
.o-list-row[data-disabled] { color: var(--vk-fg-disabled); cursor: not-allowed; }
|
|
95
|
+
.o-list-row[data-disabled] :is(.o-list-line, .o-list-you) { color: var(--vk-fg-disabled); }
|
|
96
|
+
.o-list-row[data-disabled]:is([data-highlighted], [data-force="hover"]) { background-color: transparent; }
|
|
97
|
+
.o-list-text { flex: 1; min-width: 0; display: grid; gap: var(--vk-border-width); }
|
|
98
|
+
.o-list-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
99
|
+
.o-list-line { font-size: var(--vk-font-size-xs); line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs)); color: var(--vk-fg-subtle); }
|
|
100
|
+
.o-list-you { margin-left: calc(var(--vk-spacing) * 1); font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtle); }
|
|
101
|
+
/* The chosen row's tick, at the end. */
|
|
102
|
+
.o-list-tick { flex: none; width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); fill: none; stroke: var(--vk-fg); stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
|
|
103
|
+
.o-list-row:is([data-selected], [data-checked], [aria-selected="true"], [aria-checked="true"]) .o-list-tick { visibility: visible; }
|
|
104
|
+
/* Several at once: the Checkbox's own box before each row (CheckboxMark, checkbox.css). */
|
|
105
|
+
/* A row that only clears, and one that creates: their icon and words quieter. */
|
|
106
|
+
.o-list-row.o-list-clear .o-list-main { color: var(--vk-fg-subtle); }
|
|
107
|
+
.o-list-plus { flex: none; width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); fill: none; stroke: var(--vk-fg-subtle); stroke-linecap: round; }
|
|
108
|
+
|
|
109
|
+
/* ── A heading over a group, and a line between groups, in the colour of the surface it stands in ───────────────────────────────────────────── */
|
|
110
|
+
.o-list-heading { margin: 0; padding: calc(var(--vk-spacing) * 2) calc(var(--vk-spacing) * 2) calc(var(--vk-spacing) * 1); font-size: var(--vk-font-size-xs); line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs)); font-weight: var(--vk-font-weight-medium); color: var(--vk-fg-subtle); }
|
|
111
|
+
/* In a Popover it stands in from the Popover's padding, which may not be the list's: Full width reaches its edge, inside it. */
|
|
112
|
+
.o-popover .o-list-sep { margin-inline: calc(var(--vk-spacing) * 2 * var(--dividers-words, 1) - (1 - var(--dividers-rows, 1)) * var(--divider-reach, 0px)); }
|
|
113
|
+
.o-list-sep { height: var(--vk-border-width); margin: calc(var(--vk-spacing) * 1) var(--list-sep-inset, calc(var(--vk-spacing) * 2)); border: 0; background-color: var(--divider-colour, var(--list-sep-colour, var(--vk-border-subtle))); }
|
|
114
|
+
|
|
115
|
+
/* ── On the phone a row is 44px, so a finger finds it ──────────────────────────────────────────────── */
|
|
116
|
+
@media (width < 640px) {
|
|
117
|
+
.o-list-row:where(:not([data-computer-host], [data-computer-host] *)) { min-height: calc(var(--vk-spacing) * 11); }
|
|
118
|
+
}
|
|
119
|
+
@container o-phone (width < 640px) {
|
|
120
|
+
.o-list-row { min-height: calc(var(--vk-spacing) * 11); }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* ── Corner smoothing: the list's own (data-list-smoothing; Smooth, with nothing set, or Round), never the token. Under
|
|
124
|
+
Smooth the panel and each row are drawn with the smooth outline (smooth.css) in every browser that knows shape(); one
|
|
125
|
+
that doesn't keeps the corners above, and Round paints them as before. A row's side is its height (32, or the list's Row height;
|
|
126
|
+
44 on a phone), its round part fitted to it as a control's is (side / 3.4, Mihai, 16 Nov 2026), so the whole bend fits; a row
|
|
127
|
+
of a Pill box or at Row corners Full is a pill, drawn at no smoothing (--list-row-pill-in, set beside the corners it
|
|
128
|
+
follows, as its corners are). Nothing stands outside a
|
|
129
|
+
row, so it is clipped itself, its highlight with it. The panel casts a shadow, so its edge (::before, over its border box) and
|
|
130
|
+
ground (::after, over its padding box, its corner a line smaller) are layers inside it, clipped as the Popover's are, its shadow on itself; its corners follow its rows' (outer follows inner): the
|
|
131
|
+
Input box's corners fitted to a row, plus the padding, so the two curves run alike (13.4 at the defaults), eased on its own
|
|
132
|
+
shortest side, one row; a Pill box's panel keeps its 2xl and the padding, held to half that side. The amount is set on what
|
|
133
|
+
draws the outline (the panel, a row), never declared as the token. ── */
|
|
134
|
+
@supports (clip-path: shape(evenodd from 0 0, curve by 1px 1px with 1px 0 / 1px 0, close, move to 0 0, hline to 1px, close)) and (width: calc(tan(atan2(1px, 1px)) * 1px)) {
|
|
135
|
+
.o-list, .o-list-row, .o-popover { --list-row-side: var(--list-row-h, calc(var(--vk-spacing) * 8)); }
|
|
136
|
+
@media (width < 640px) { .o-list:where(:not([data-computer-host], [data-computer-host] *)), .o-list-row:where(:not([data-computer-host], [data-computer-host] *)), .o-popover:where(:not([data-computer-host], [data-computer-host] *)) { --list-row-side: calc(var(--vk-spacing) * 11); } }
|
|
137
|
+
@container o-phone (width < 640px) { .o-list, .o-list-row, .o-popover { --list-row-side: calc(var(--vk-spacing) * 11); } }
|
|
138
|
+
.o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *),
|
|
139
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"]), [data-list-smoothing="round"] *) {
|
|
140
|
+
--list-box-cap: min(var(--list-box-r, var(--vk-radius-lg)), var(--vk-radius-2xl));
|
|
141
|
+
--list-k: calc(1 - var(--list-box-pill, 0));
|
|
142
|
+
--list-box-fit: min(var(--list-box-cap), var(--list-row-side) / 3.4);
|
|
143
|
+
--list-panel-r: calc(var(--list-box-cap) + (var(--list-box-fit) - var(--list-box-cap)) * var(--list-k) + var(--list-pad, var(--vk-spacing)));
|
|
144
|
+
--list-panel-side: calc(var(--list-row-side) + var(--list-pad, var(--vk-spacing)) * 2 + var(--vk-border-width) * 2);
|
|
145
|
+
}
|
|
146
|
+
/* The panel itself; the Picker's in its Popover draws the same panel from the same numbers. */
|
|
147
|
+
.o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *) {
|
|
148
|
+
--smooth-amount: initial; --smooth-t: min(var(--list-panel-r), var(--list-panel-side) / 2); --smooth-side: var(--list-panel-side);
|
|
149
|
+
position: relative; isolation: isolate; border-radius: var(--smooth-t); border-color: transparent; background-color: transparent;
|
|
150
|
+
}
|
|
151
|
+
.o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *)::before,
|
|
152
|
+
.o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *)::after {
|
|
153
|
+
content: ""; position: absolute; inset: calc(var(--vk-border-width) * -1); z-index: -1; pointer-events: none; border-radius: inherit;
|
|
154
|
+
}
|
|
155
|
+
.o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *)::before { background-color: var(--vk-overlay); background-image: linear-gradient(var(--list-edge, var(--vk-border-subtle)), var(--list-edge, var(--vk-border-subtle))); clip-path: shape(var(--smooth-outline)); }
|
|
156
|
+
.o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *)::after {
|
|
157
|
+
--smooth-t: max(0px, min(var(--list-panel-r), var(--list-panel-side) / 2) - var(--vk-border-width));
|
|
158
|
+
inset: 0; border-radius: calc(min(var(--list-panel-r), var(--list-panel-side) / 2) - var(--vk-border-width)); background-color: var(--vk-overlay); clip-path: shape(var(--smooth-outline));
|
|
159
|
+
}
|
|
160
|
+
/* At padding 0 its rows run to its edge, square: the first and the last row it holds take its corner a line in on their outer
|
|
161
|
+
side, and what the Select's list holds (the Picker, its rows scrolling) is cut by its outline a line in, as hiding what
|
|
162
|
+
overflows cut it at its round corner before. */
|
|
163
|
+
[data-list-padding="0"] .o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *) > .o-list-row:first-child:not(:last-child),
|
|
164
|
+
[data-list-padding="0"] .o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *) > .o-menu-list-scroll > .o-list-row:first-child:not(:last-child) {
|
|
165
|
+
--smooth-t: max(0px, min(var(--list-panel-r), var(--list-panel-side) / 2) - var(--vk-border-width)); --smooth-b: var(--list-row-fit);
|
|
166
|
+
}
|
|
167
|
+
[data-list-padding="0"] .o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *) > .o-list-row:last-child:not(:first-child),
|
|
168
|
+
[data-list-padding="0"] .o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *) > .o-menu-list-scroll > .o-list-row:last-child:not(:first-child) {
|
|
169
|
+
--smooth-b: max(0px, min(var(--list-panel-r), var(--list-panel-side) / 2) - var(--vk-border-width));
|
|
170
|
+
}
|
|
171
|
+
[data-list-padding="0"] .o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *) > .o-list-row:only-child,
|
|
172
|
+
[data-list-padding="0"] .o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *) > .o-menu-list-scroll > .o-list-row:only-child {
|
|
173
|
+
--smooth-t: max(0px, min(var(--list-panel-r), var(--list-panel-side) / 2) - var(--vk-border-width));
|
|
174
|
+
}
|
|
175
|
+
[data-list-padding="0"] .o-list:not([data-list-smoothing="round"], [data-list-smoothing="round"] *) > .o-picker {
|
|
176
|
+
--smooth-amount: initial; --smooth-t: max(0px, min(var(--list-panel-r), var(--list-panel-side) / 2) - var(--vk-border-width));
|
|
177
|
+
--smooth-side: calc(var(--list-panel-side) - var(--vk-border-width) * 2); clip-path: shape(var(--smooth-outline));
|
|
178
|
+
}
|
|
179
|
+
.o-list-row:not([data-list-smoothing="round"] *) {
|
|
180
|
+
--smooth-amount: calc(0.7 * (1 - var(--list-row-pill-in, 0)));
|
|
181
|
+
--list-row-fit: min(var(--list-row-rad, var(--vk-radius-lg)) + var(--list-row-pill-in, 0) * 1000px, var(--list-row-side) / (2 + 2 * var(--smooth-amount)));
|
|
182
|
+
--smooth-t: var(--list-row-fit); --smooth-side: var(--list-row-side);
|
|
183
|
+
clip-path: shape(var(--smooth-outline));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@media (prefers-reduced-motion: reduce) { .o-list { transition: none; } }
|
|
188
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The row a key goes to from `at` (−1: none yet) among `count` rows, skipping those `off` says can't be used: ↓ and ↑ the
|
|
2
|
+
* next and the one before, wrapping; Home and End the first and the last; null for any other key, or when none can be used. */
|
|
3
|
+
export declare function rowFor(key: string, at: number, count: number, off: (i: number) => boolean): number | null;
|
|
4
|
+
/** The next row whose name starts with `typed`, ignoring case, round to `at` itself; null when none. One letter (or one letter
|
|
5
|
+
* typed again, "ss") looks from the row after `at`, so each press steps on; a longer word looks from `at`, so it stays put
|
|
6
|
+
* while it still fits. */
|
|
7
|
+
export declare function rowStarting(names: string[], at: number, typed: string, off: (i: number) => boolean): number | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function rowFor(key, at, count, off) {
|
|
2
|
+
const on = (i) => !off(i);
|
|
3
|
+
if (key === "Home" || key === "End") {
|
|
4
|
+
const order = [...Array(count).keys()];
|
|
5
|
+
return (key === "Home" ? order : order.reverse()).find(on) ?? null;
|
|
6
|
+
}
|
|
7
|
+
const step = key === "ArrowDown" ? 1 : key === "ArrowUp" ? -1 : 0;
|
|
8
|
+
if (!step || count <= 0)
|
|
9
|
+
return null;
|
|
10
|
+
let i = at < 0 ? (step > 0 ? -1 : count) : at;
|
|
11
|
+
for (let n = 0; n < count; n++) {
|
|
12
|
+
i = (i + step + count) % count;
|
|
13
|
+
if (on(i))
|
|
14
|
+
return i;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
export function rowStarting(names, at, typed, off) {
|
|
19
|
+
const word = typed.toLowerCase(), one = [...word].every((c) => c === word[0]), find = one ? word[0] : word;
|
|
20
|
+
if (!find)
|
|
21
|
+
return null;
|
|
22
|
+
const count = names.length, from = one ? at + 1 : Math.max(at, 0);
|
|
23
|
+
for (let n = 0; n < count; n++) {
|
|
24
|
+
const i = (((from + n) % count) + count) % count;
|
|
25
|
+
if (!off(i) && names[i].toLowerCase().startsWith(find))
|
|
26
|
+
return i;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PieceLooks } from "../../looks/looks.js";
|
|
2
|
+
export type MenuListLookOptionId = "rows" | "lines" | "height" | "corners" | "close" | "tiles";
|
|
3
|
+
/** The menu list's options and looks. */
|
|
4
|
+
export declare const MENU_LIST_LOOKS: PieceLooks<MenuListLookOptionId, Exclude<MenuListLookOptionId, "close" | "tiles">>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const options = [
|
|
2
|
+
{ id: "rows", name: "Rows", device: "phone", def: "card", values: [{ id: "plain", name: "Plain" }, { id: "card", name: "Card" }, { id: "joined", name: "Joined" }, { id: "words", name: "Words" }] },
|
|
3
|
+
{ id: "lines", name: "Lines", device: "phone", def: "inset", unless: ["rows", "joined"], values: [{ id: "none", name: "None" }, { id: "full", name: "Full width" }, { id: "inset", name: "Inset" }] },
|
|
4
|
+
{ id: "height", name: "Row height", device: "phone", def: "52", kind: "steps", values: ["48", "52", "56"].map((id) => ({ id, name: id })) },
|
|
5
|
+
{ id: "corners", name: "Corners", device: "phone", def: "xl", kind: "steps", values: ["lg", "xl", "2xl"].map((id) => ({ id, name: id })) },
|
|
6
|
+
{ id: "close", name: "Close row", device: "phone", def: "hidden", unless: ["rows", "words"], values: [{ id: "hidden", name: "Hidden" }, { id: "shown", name: "Shown" }] },
|
|
7
|
+
{ id: "tiles", name: "Tiles", device: "phone", def: "card", unless: ["rows", "words"], values: [{ id: "card", name: "Card" }, { id: "wide", name: "Wide" }, { id: "circle", name: "Circle" }, { id: "colour", name: "Colour" }] },
|
|
8
|
+
];
|
|
9
|
+
export const MENU_LIST_LOOKS = {
|
|
10
|
+
id: "menu-list",
|
|
11
|
+
name: "Menu list",
|
|
12
|
+
options,
|
|
13
|
+
looks: [
|
|
14
|
+
{ id: "stack", name: "Stack", device: "phone", picks: { rows: "card", lines: "inset", height: "52", corners: "xl" } },
|
|
15
|
+
{ id: "card", name: "Card", device: "phone", picks: { rows: "card", lines: "full", height: "52", corners: "xl" } },
|
|
16
|
+
{ id: "plain", name: "Plain", device: "phone", picks: { rows: "plain", lines: "none", height: "52", corners: "xl" } },
|
|
17
|
+
{ id: "joined", name: "Joined", device: "phone", picks: { rows: "joined", lines: "none", height: "56", corners: "2xl" } },
|
|
18
|
+
{ id: "words", name: "Words", device: "phone", picks: { rows: "words", lines: "full", height: "56", corners: "2xl" } },
|
|
19
|
+
],
|
|
20
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type MenuListLookOptionId } from "./looks.js";
|
|
3
|
+
/** A choice: its value, its name, and its mark (a stage's glyph, a person's face, an icon). */
|
|
4
|
+
export interface MenuChoice {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
mark?: React.ReactNode;
|
|
8
|
+
/** What it reads as, in words, quiet at its end before its tick: a date style's sample ("14/11/2026"). */
|
|
9
|
+
detail?: string;
|
|
10
|
+
}
|
|
11
|
+
/** A row of the menu, in the order it shows: what's done most first, related rows between lines, the one
|
|
12
|
+
* that takes something away last. */
|
|
13
|
+
export type MenuEntry =
|
|
14
|
+
/** An action: its icon and name, its keys when a shortcut works (["⌘", "L"]); `danger` when it takes
|
|
15
|
+
* something away; `disabled` says why it can't be used, as its tooltip. A name that opens something
|
|
16
|
+
* else before it acts ends in "…". */
|
|
17
|
+
MenuAction
|
|
18
|
+
/** A place to go: its icon and name, where it goes; `external` when it leaves the app, which opens it in
|
|
19
|
+
* a new tab and draws an arrow after it. `render` is the app's own link (Next's Link, a router's, with
|
|
20
|
+
* its own href): the row is drawn as it, so a press moves within the app instead of loading a page. */
|
|
21
|
+
| {
|
|
22
|
+
kind: "link";
|
|
23
|
+
icon: React.ReactNode;
|
|
24
|
+
label: string;
|
|
25
|
+
href?: string;
|
|
26
|
+
render?: React.ReactElement;
|
|
27
|
+
external?: boolean;
|
|
28
|
+
onSelect?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
29
|
+
}
|
|
30
|
+
/** A tick: something shown or kept or not ("Won and lost deals"); a box before its name, and the menu
|
|
31
|
+
* stays open, so several can be ticked in turn. `icon`, its mark before its name, is drawn where its tick is the Switch: a
|
|
32
|
+
* column's type, in a list of columns. */
|
|
33
|
+
| {
|
|
34
|
+
kind: "check";
|
|
35
|
+
label: string;
|
|
36
|
+
icon?: React.ReactNode;
|
|
37
|
+
checked?: boolean;
|
|
38
|
+
defaultChecked?: boolean;
|
|
39
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
40
|
+
disabled?: string;
|
|
41
|
+
}
|
|
42
|
+
/** A choice one level in: what it sets and what it is now; its choices open against the menu's edge. `detail` says what it is
|
|
43
|
+
* now in words of its own, in place of its choice's name (a colour's "Blue" while Automatic is ticked). */
|
|
44
|
+
| {
|
|
45
|
+
kind: "choices";
|
|
46
|
+
icon: React.ReactNode;
|
|
47
|
+
label: string;
|
|
48
|
+
value: string;
|
|
49
|
+
choices: MenuChoice[];
|
|
50
|
+
onChoose?: (value: string) => void;
|
|
51
|
+
detail?: string;
|
|
52
|
+
}
|
|
53
|
+
/** Actions one level in ("Share", then Copy link, Email it): they open against the menu's edge. `detail`, quiet at its end, says
|
|
54
|
+
* what it holds (a field's parts: "2"). */
|
|
55
|
+
| {
|
|
56
|
+
kind: "actions";
|
|
57
|
+
icon: React.ReactNode;
|
|
58
|
+
label: string;
|
|
59
|
+
entries: MenuEntry[];
|
|
60
|
+
detail?: string;
|
|
61
|
+
/** What it holds is in force (Customize's Filter, "1"; its Sort, "Amount +1"): its detail in the brand. */
|
|
62
|
+
inForce?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** Choices in the menu itself, under a heading ("Group deals by"). */
|
|
65
|
+
| {
|
|
66
|
+
kind: "pick";
|
|
67
|
+
heading?: string;
|
|
68
|
+
value: string;
|
|
69
|
+
choices: MenuChoice[];
|
|
70
|
+
onChoose?: (value: string) => void;
|
|
71
|
+
}
|
|
72
|
+
/** Rows under a heading of their own ("Show"), set apart from the rest by it. */
|
|
73
|
+
| {
|
|
74
|
+
kind: "group";
|
|
75
|
+
heading: string;
|
|
76
|
+
entries: MenuEntry[];
|
|
77
|
+
} | {
|
|
78
|
+
kind: "separator";
|
|
79
|
+
};
|
|
80
|
+
type MenuAction = {
|
|
81
|
+
kind?: "action";
|
|
82
|
+
icon: React.ReactNode;
|
|
83
|
+
label: string;
|
|
84
|
+
keys?: string[];
|
|
85
|
+
danger?: boolean;
|
|
86
|
+
disabled?: string;
|
|
87
|
+
onSelect?: () => void;
|
|
88
|
+
/** How many it holds, at its end in the quietest colour (a tab's count under More), or a Spinner while that loads. */
|
|
89
|
+
count?: React.ReactNode;
|
|
90
|
+
};
|
|
91
|
+
/** What its rows stand on, as worn around `el`. */
|
|
92
|
+
export declare const menuListRowsOf: (el: Element | null) => string;
|
|
93
|
+
/** The sheet its rows want, from what an app picked, which only the frame around `el` wears: Plain and Words float, as YouTube's and
|
|
94
|
+
* Apple's do; a card or a tile stands edge to edge, as Instagram's, Obsidian's and Gemini's do. */
|
|
95
|
+
export declare const sheetFormOf: (el: Element | null) => "floating" | "edge";
|
|
96
|
+
/** Whether a Close row stands over its rows, as an app picked for the frame around `el`: never under Words, which stands on
|
|
97
|
+
* no sheet. */
|
|
98
|
+
export declare const menuListCloseOf: (el: Element | null) => boolean;
|
|
99
|
+
/** One of its options as worn around `frame`, kept up to date as an app changes it. */
|
|
100
|
+
export declare function useMenuListOption(frame: HTMLElement | null, id: MenuListLookOptionId): string;
|
|
101
|
+
/** What its rows stand on, as worn around `frame`, kept up to date as an app changes it. */
|
|
102
|
+
export declare const useMenuListRows: (frame: HTMLElement | null) => string;
|
|
103
|
+
/** What scrolls in a menu's panel: its rows, alone, when the panel is taller than the room on screen, the Scrollbar over
|
|
104
|
+
* them: the menu's panel and each level in. Not the menu list's rows in a panel that is no menu (`.o-menu-rows`). */
|
|
105
|
+
export declare const MenuScroll: ({ children }: {
|
|
106
|
+
children: React.ReactNode;
|
|
107
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
108
|
+
/** A menu's rows on a computer, every kind of entry, each level in with its own panel beside it. Placed only inside a Base UI Menu or
|
|
109
|
+
* ContextMenu popup: the menu that opens them keeps its own root, trigger, portal and panel, and hands them its pick host. */
|
|
110
|
+
export declare function MenuListRows({ entries, host }: {
|
|
111
|
+
entries: MenuEntry[];
|
|
112
|
+
host?: HTMLElement;
|
|
113
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
114
|
+
/** The menu standing open in the page, for a page that shows what it looks like: the same rows, still.
|
|
115
|
+
* `open` names a row one level in (a choice or actions row, by its label) to show with its rows open
|
|
116
|
+
* beside it, and `on` a row to show as under the pointer (its label, or "<row one level in>/<row>"). */
|
|
117
|
+
export declare function MenuListShown({ entries, label, open, on, className }: {
|
|
118
|
+
entries: MenuEntry[];
|
|
119
|
+
label: string;
|
|
120
|
+
open?: string;
|
|
121
|
+
on?: string[];
|
|
122
|
+
className?: string;
|
|
123
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
124
|
+
export interface MenuListPanelRowsProps {
|
|
125
|
+
/** What it acts on, to a screen reader. */
|
|
126
|
+
label: string;
|
|
127
|
+
/** Its rows, in the Menu's order. */
|
|
128
|
+
entries: MenuListEntry[];
|
|
129
|
+
/** A row one level in (a choice or actions row) was pressed: what it opens is its holder's to show, in place. */
|
|
130
|
+
onOpen?: (entry: MenuListEntry) => void;
|
|
131
|
+
/** How a tick is drawn: the tick box before its name, as in a menu (the default), the Switch at its end, or an eye at its end,
|
|
132
|
+
* crossed while it is off. */
|
|
133
|
+
ticks?: "box" | "switch" | "eye";
|
|
134
|
+
/** A row with a grip moved, handed on as it is made: its place and the place it moved to, counted among the rows with a grip. */
|
|
135
|
+
onMove?: (from: number, to: number) => void;
|
|
136
|
+
className?: string;
|
|
137
|
+
}
|
|
138
|
+
/** A menu's rows on a computer standing in a panel that is no menu (the Pane, a Popover): the same rows, pressed and keyed by
|
|
139
|
+
* code of their own (keys.ts: ↑ ↓ wrapping, Home, End, a typed letter; Enter and Space press, → presses a row one level in),
|
|
140
|
+
* a row one level in handed to its holder, which shows what it opens in place. It draws no panel: its holder's is round it.
|
|
141
|
+
* Its rows are one tab stop, as a menu's are; the pointer lights the row under it, and moves the focus there only while the
|
|
142
|
+
* focus is already in it, so it never takes the focus from its holder's other controls. */
|
|
143
|
+
export declare function MenuListPanelRows({ label, entries, onOpen, ticks, onMove, className }: MenuListPanelRowsProps): import("react/jsx-runtime").JSX.Element;
|
|
144
|
+
export declare function tilesOf(entries: MenuEntry[], allRows?: boolean): {
|
|
145
|
+
tiles?: MenuListTile[];
|
|
146
|
+
entries: MenuEntry[];
|
|
147
|
+
};
|
|
148
|
+
/** A row: one of a menu's entries, with a line under its name and something of its own on its right. */
|
|
149
|
+
export type MenuListEntry = MenuEntry & {
|
|
150
|
+
/** A line under its name, quieter. A row that can't be used shows why there, as a phone has no tooltip. */
|
|
151
|
+
note?: React.ReactNode;
|
|
152
|
+
/** What stands on its right: a count, a Tag. Left out, a Menu action's own `count` stands there. */
|
|
153
|
+
end?: React.ReactNode;
|
|
154
|
+
/** A grip at its start: the row is put in order by it, on a computer by the grip, the pointer or ↑ ↓ on it, on a phone
|
|
155
|
+
* by a hold, then a drag. The rows with a grip stand one after another; a row with none stays where it is. */
|
|
156
|
+
grip?: boolean;
|
|
157
|
+
};
|
|
158
|
+
/** One of the few things done most, as a tile. */
|
|
159
|
+
export interface MenuListTile {
|
|
160
|
+
icon: React.ReactNode;
|
|
161
|
+
label: string;
|
|
162
|
+
disabled?: boolean;
|
|
163
|
+
onSelect?: () => void;
|
|
164
|
+
}
|
|
165
|
+
/** A name and its value, as one row standing alone: the choices row with no arrow and no list round it, at the list's own
|
|
166
|
+
* height and inset (menu-list.css), which what holds it may set (`--menu-list-row`, `--menu-list-inset`). Pressing it is its
|
|
167
|
+
* holder's: the Date editor's time row on a phone opens the time's wheels. */
|
|
168
|
+
export declare function MenuListRow({ label, value, onSelect, className }: {
|
|
169
|
+
label: string;
|
|
170
|
+
value: React.ReactNode;
|
|
171
|
+
onSelect?: () => void;
|
|
172
|
+
className?: string;
|
|
173
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
174
|
+
export interface MenuListProps {
|
|
175
|
+
/** What it acts on, to a screen reader. */
|
|
176
|
+
label: string;
|
|
177
|
+
/** Its rows, in the Menu's order: what's done most first, the one that takes something away last. A separator, a group or a pick
|
|
178
|
+
* starts a new section. */
|
|
179
|
+
entries: MenuListEntry[];
|
|
180
|
+
/** The few done most, as tiles over its rows. */
|
|
181
|
+
tiles?: MenuListTile[];
|
|
182
|
+
/** A row that goes one level in was pressed: what it opens is the sheet's to show, in a step of its own. */
|
|
183
|
+
onOpen?: (entry: MenuListEntry) => void;
|
|
184
|
+
/** A Close row over everything else, as Obsidian's has: an app's say, read off the frame (`menuListCloseOf`), handed by the sheet
|
|
185
|
+
* that holds it. What closing does is the sheet's. */
|
|
186
|
+
onClose?: () => void;
|
|
187
|
+
/** A row with a grip moved, handed on as it is made: its place and the place it moved to, counted among the rows with a grip. */
|
|
188
|
+
onMove?: (from: number, to: number) => void;
|
|
189
|
+
/** How a tick is drawn: the Switch (the default), or an eye at its end, crossed while it is off. */
|
|
190
|
+
ticks?: "switch" | "eye";
|
|
191
|
+
className?: string;
|
|
192
|
+
}
|
|
193
|
+
/** What you can do with something, as rows you press: tiles if it has them, then its rows in sections. Pour it into a Sheet; it owns
|
|
194
|
+
* no way of opening or closing. No search: a menu long enough to need one is a wrong menu. */
|
|
195
|
+
export declare function MenuList({ label, entries, tiles, onOpen, onClose, onMove, ticks, className }: MenuListProps): import("react/jsx-runtime").JSX.Element;
|
|
196
|
+
export {};
|