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,259 @@
|
|
|
1
|
+
/* THE MENU LIST, on a phone and then, at the end, on a computer. Every value it draws with is one of ViewKit's public names, the
|
|
2
|
+
Outright token each stands for listed in menu-list/tokens.ts; this file only says which each part takes. Its options, a
|
|
3
|
+
phone's (menu-list/looks.ts), are data attributes on the frame around it, and each one only
|
|
4
|
+
chooses other tokens:
|
|
5
|
+
|
|
6
|
+
data-menu-list-rows plain · card · joined · words what its rows stand on
|
|
7
|
+
data-menu-list-lines none · full · inset the line between two rows
|
|
8
|
+
data-menu-list-height 48 · 52 · 56 how tall a row is
|
|
9
|
+
data-menu-list-corners lg · xl · 2xl which radius a card and a tile take
|
|
10
|
+
data-menu-list-tiles card · wide · circle · colour how a tile stands: its name inside a card, or under a wide tile, a grey
|
|
11
|
+
circle or a circle in a label colour by place
|
|
12
|
+
|
|
13
|
+
A fifth, data-menu-list-close (hidden · shown), is read by the Menu, not here: a Close row over its rows.
|
|
14
|
+
|
|
15
|
+
A phone has no pointer, so a row has no hover: it shows only its press, from the finger going down until it lifts.
|
|
16
|
+
|
|
17
|
+
The rules sit in the components layer, so a utility class still wins. */
|
|
18
|
+
@layer components {
|
|
19
|
+
|
|
20
|
+
.o-menu-list {
|
|
21
|
+
--menu-list-row: calc(var(--vk-spacing) * 13); --menu-list-corners: var(--vk-radius-xl); --menu-list-inset: calc(var(--vk-spacing) * 4);
|
|
22
|
+
display: grid; gap: calc(var(--vk-spacing) * 3); min-width: 0;
|
|
23
|
+
}
|
|
24
|
+
[data-menu-list-height="48"] .o-menu-list { --menu-list-row: calc(var(--vk-spacing) * 12); }
|
|
25
|
+
[data-menu-list-height="56"] .o-menu-list { --menu-list-row: calc(var(--vk-spacing) * 14); }
|
|
26
|
+
[data-menu-list-corners="lg"] .o-menu-list { --menu-list-corners: var(--vk-radius-lg); }
|
|
27
|
+
[data-menu-list-corners="2xl"] .o-menu-list { --menu-list-corners: var(--vk-radius-2xl); }
|
|
28
|
+
|
|
29
|
+
/* ── A section: rows that belong together, on a card ─────────────────────────────────────────────────────────────── */
|
|
30
|
+
.o-menu-list-section { display: grid; min-width: 0; overflow: hidden; border-radius: var(--menu-list-corners); background-color: var(--vk-overlay-card); }
|
|
31
|
+
|
|
32
|
+
/* ── A group or a pick under its heading: the list's heading over its card, as on a computer, at a phone's size: 14, 4 in
|
|
33
|
+
from the card's edge, 6 over the card. Under Plain, where nothing marks the card's edge, it stands where its
|
|
34
|
+
rows' icons start. Under Words the card floats on the dim, so its heading stands on the card's own ground, over its rows, centred
|
|
35
|
+
as they are, a line under it, as a phone's action sheet holds its title. ─────────────────────────────────────────────────── */
|
|
36
|
+
.o-menu-list-group { display: grid; gap: calc(var(--vk-spacing) * 1.5); min-width: 0; }
|
|
37
|
+
.o-menu-list-group > .o-list-heading { padding: 0 calc(var(--vk-spacing) * 1); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
|
|
38
|
+
[data-menu-list-rows="plain"] .o-menu-list-group > .o-list-heading { padding-inline: calc(var(--vk-spacing) * 2); }
|
|
39
|
+
[data-menu-list-rows="words"] .o-menu-list-group { gap: 0; overflow: hidden; border-radius: var(--vk-radius-2xl); background-color: var(--vk-overlay); box-shadow: var(--vk-shadow-2xl); }
|
|
40
|
+
[data-menu-list-rows="words"] .o-menu-list-group > .o-list-heading { padding: calc(var(--vk-spacing) * 3) calc(var(--vk-spacing) * 4); border-bottom: var(--vk-border-width) solid var(--vk-border); text-align: center; }
|
|
41
|
+
[data-menu-list-rows="words"] .o-menu-list-group > .o-menu-list-section { border-radius: 0; box-shadow: none; }
|
|
42
|
+
|
|
43
|
+
/* ── A row: an icon, its name, and on its right a value, an arrow, a tick or a switch ────────────────────────────── */
|
|
44
|
+
.o-menu-list-row {
|
|
45
|
+
--menu-list-line: var(--menu-list-inset, calc(var(--vk-spacing) * 4));
|
|
46
|
+
position: relative; display: flex; align-items: center; gap: calc(var(--vk-spacing) * 3); box-sizing: border-box; width: 100%; min-width: 0; min-height: var(--menu-list-row, calc(var(--vk-spacing) * 13));
|
|
47
|
+
margin: 0; padding: calc(var(--vk-spacing) * 1.5) var(--menu-list-inset, calc(var(--vk-spacing) * 4)); border: 0; background: none; color: var(--vk-fg);
|
|
48
|
+
font: inherit; font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); text-align: start; text-decoration: none;
|
|
49
|
+
cursor: pointer; outline: none; user-select: none; -webkit-tap-highlight-color: transparent;
|
|
50
|
+
}
|
|
51
|
+
.o-menu-list-row:has(> .o-menu-list-mark) { --menu-list-line: calc(var(--menu-list-inset) + var(--vk-spacing) * 8.5); }
|
|
52
|
+
/* A list holding a person's 32px face (the Avatar stack's people on a phone): every row's mark is 32 wide, the face whole
|
|
53
|
+
in it and an icon centred at its own 22, so every name stands 12px after it and the line starts at the words. The list sits in
|
|
54
|
+
:where(), so each rule weighs what it overrides and Full lines, below, still wins. */
|
|
55
|
+
:where(.o-menu-list:has(.o-menu-list-row > .o-menu-list-mark > :is(.o-avatar:not(.o-avatar-xs, .o-avatar-sm, .o-avatar-lg, .o-avatar-xl), .o-avatar-badged[data-size="32"]))) .o-menu-list-row:has(> .o-menu-list-mark) { --menu-list-line: calc(var(--menu-list-inset) + var(--vk-spacing) * 11); }
|
|
56
|
+
:where(.o-menu-list:has(.o-menu-list-row > .o-menu-list-mark > :is(.o-avatar:not(.o-avatar-xs, .o-avatar-sm, .o-avatar-lg, .o-avatar-xl), .o-avatar-badged[data-size="32"]))) .o-menu-list-row > .o-menu-list-mark { width: calc(var(--vk-spacing) * 8); }
|
|
57
|
+
:where(.o-menu-list:has(.o-menu-list-row > .o-menu-list-mark > :is(.o-avatar:not(.o-avatar-xs, .o-avatar-sm, .o-avatar-lg, .o-avatar-xl), .o-avatar-badged[data-size="32"]))) .o-menu-list-row > .o-menu-list-mark:has(> :is(.o-avatar:not(.o-avatar-xs, .o-avatar-sm, .o-avatar-lg, .o-avatar-xl), .o-avatar-badged[data-size="32"])) { height: calc(var(--vk-spacing) * 8); }
|
|
58
|
+
:where(.o-menu-list:has(.o-menu-list-row > .o-menu-list-mark > :is(.o-avatar:not(.o-avatar-xs, .o-avatar-sm, .o-avatar-lg, .o-avatar-xl), .o-avatar-badged[data-size="32"]))) .o-menu-list-row > .o-menu-list-mark > svg { width: calc(var(--vk-spacing) * 5.5); }
|
|
59
|
+
.o-menu-list-row:focus-visible { outline: var(--vk-focus-width) solid var(--vk-border-brand); outline-offset: calc(-1 * var(--vk-focus-width)); }
|
|
60
|
+
.o-menu-list-row:active:not(:disabled, [data-disabled]) { background-color: var(--vk-overlay-card-pressed); }
|
|
61
|
+
.o-menu-list-row.o-menu-list-danger { color: var(--vk-danger); }
|
|
62
|
+
.o-menu-list-row:is(:disabled, [data-disabled]) { color: var(--vk-fg-disabled); cursor: not-allowed; }
|
|
63
|
+
|
|
64
|
+
.o-menu-list-mark { flex: none; display: grid; place-items: center; width: calc(var(--vk-spacing) * 5.5); height: calc(var(--vk-spacing) * 5.5); }
|
|
65
|
+
.o-menu-list-mark > svg { width: 100%; height: 100%; }
|
|
66
|
+
.o-menu-list-name { flex: 1; display: grid; min-width: 0; }
|
|
67
|
+
.o-menu-list-name > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
68
|
+
.o-menu-list-name > .o-menu-list-note { font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); white-space: normal; color: var(--vk-fg-subtle); }
|
|
69
|
+
.o-menu-list-row:is(:disabled, [data-disabled]) .o-menu-list-note { color: var(--vk-fg-disabled); }
|
|
70
|
+
.o-menu-list-value { flex: none; max-width: calc(var(--vk-spacing) * 38); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); color: var(--vk-fg-subtle); }
|
|
71
|
+
/* What stands on its right, a count or a Tag: a phone's value size, the Menu's count's colour and figures. */
|
|
72
|
+
.o-menu-list-end { flex: none; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); color: var(--vk-fg-subtlest); font-variant-numeric: tabular-nums; }
|
|
73
|
+
/* A level's detail in force: in the brand. */
|
|
74
|
+
.o-menu-list-end[data-on] { color: var(--vk-fg-accent); }
|
|
75
|
+
/* A tick as an eye, at its end: 20, open while on, crossed and quieter while off, greyed on a row that can't be used. */
|
|
76
|
+
.o-menu-list-eye { flex: none; display: grid; place-items: center; color: var(--vk-fg-subtle); }
|
|
77
|
+
.o-menu-list-eye > svg { width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); }
|
|
78
|
+
.o-menu-list-eye:not([data-on]) { color: var(--vk-fg-subtlest); }
|
|
79
|
+
.o-menu-list-row:is(:disabled, [data-disabled]) > .o-menu-list-eye { color: var(--vk-fg-disabled); }
|
|
80
|
+
.o-menu-list-more { flex: none; width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); margin-right: calc(var(--vk-spacing) * -0.5); fill: none; stroke: var(--vk-fg-subtlest); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
81
|
+
.o-menu-list-tick { flex: none; width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
|
|
82
|
+
|
|
83
|
+
/* A row with a grip: the grip's dots at its start, 16, faint, as the grip draws them; the line starts at the words,
|
|
84
|
+
after the grip's 16 and the gap's 12, and with a mark after its 22 and 12 more. A row is held, then dragged ("Hold, then drag",
|
|
85
|
+
Mihai, 18 Nov 2026): nothing stops a swipe from scrolling before it is held, and a long press never opens the phone's own
|
|
86
|
+
callout on it. Held, it stands over the others on the overlay's ground with the shadow, as the sort editor's held rule does. */
|
|
87
|
+
.o-menu-list-grip { flex: none; width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--vk-fg-subtlest); }
|
|
88
|
+
.o-menu-list [data-drag-start] { -webkit-touch-callout: none; }
|
|
89
|
+
/* How long a finger rests on a row before it lifts, read by the script that lifts it. */
|
|
90
|
+
.o-menu-list-row { --menu-list-hold: var(--vk-hold-delay); }
|
|
91
|
+
.o-menu-list-grip[data-room] { visibility: hidden; }
|
|
92
|
+
.o-menu-list-row:has(> .o-menu-list-grip) { --menu-list-line: calc(var(--menu-list-inset) + var(--vk-spacing) * 7); }
|
|
93
|
+
.o-menu-list-row:has(> .o-menu-list-grip):has(> .o-menu-list-mark) { --menu-list-line: calc(var(--menu-list-inset) + var(--vk-spacing) * 15.5); }
|
|
94
|
+
.o-menu-list-row[data-lifted] { z-index: var(--vk-layer-popup); background-color: var(--vk-overlay); box-shadow: var(--vk-shadow-lg); }
|
|
95
|
+
.o-menu-list-row[data-lifted]::before, .o-menu-list-row[data-lifted] + .o-menu-list-row::before { opacity: 0; }
|
|
96
|
+
|
|
97
|
+
/* The line between two rows, starting at the words, which goes under a press, so a pressed row reads as one block. */
|
|
98
|
+
.o-menu-list-row + .o-menu-list-row::before { content: ""; position: absolute; top: 0; right: 0; left: var(--menu-list-line); height: var(--vk-border-width); background-color: var(--vk-border-overlay-card); }
|
|
99
|
+
.o-menu-list-row:active:not(:disabled, [data-disabled])::before, .o-menu-list-row:active:not(:disabled, [data-disabled]) + .o-menu-list-row::before { opacity: 0; }
|
|
100
|
+
|
|
101
|
+
/* Its lines the card's whole width, or none. */
|
|
102
|
+
[data-menu-list-lines="none"] .o-menu-list-row::before { display: none; }
|
|
103
|
+
|
|
104
|
+
/* Plain: on the sheet, no ground. A row keeps its own padding, and its press reaches a little past the page's line. */
|
|
105
|
+
[data-menu-list-rows="plain"] .o-menu-list-section { margin-inline: calc(var(--vk-spacing) * -2); overflow: visible; border-radius: 0; background-color: transparent; }
|
|
106
|
+
[data-menu-list-rows="plain"] :where(.o-menu-list) .o-menu-list-row { border-radius: var(--vk-radius-lg); }
|
|
107
|
+
[data-menu-list-rows="plain"] :where(.o-menu-list) .o-menu-list-row:active:not(:disabled, [data-disabled]) { background-color: var(--vk-overlay-pressed); }
|
|
108
|
+
|
|
109
|
+
/* Joined: each row a tile, a hair apart, its section's two ends rounded. */
|
|
110
|
+
[data-menu-list-rows="joined"] .o-menu-list-section { gap: calc(var(--vk-spacing) * 0.75); overflow: visible; border-radius: 0; background-color: transparent; }
|
|
111
|
+
[data-menu-list-rows="joined"] :where(.o-menu-list) .o-menu-list-row { border-radius: var(--vk-radius-sm); background-color: var(--vk-overlay-card); }
|
|
112
|
+
[data-menu-list-rows="joined"] :where(.o-menu-list) .o-menu-list-row:first-child { border-start-start-radius: var(--menu-list-corners); border-start-end-radius: var(--menu-list-corners); }
|
|
113
|
+
[data-menu-list-rows="joined"] :where(.o-menu-list) .o-menu-list-row:last-child { border-end-start-radius: var(--menu-list-corners); border-end-end-radius: var(--menu-list-corners); }
|
|
114
|
+
[data-menu-list-rows="joined"] :where(.o-menu-list) .o-menu-list-row::before { display: none; }
|
|
115
|
+
[data-menu-list-rows="joined"] :where(.o-menu-list) .o-menu-list-row:active:not(:disabled, [data-disabled]) { background-color: var(--vk-overlay-card-pressed); }
|
|
116
|
+
|
|
117
|
+
/* Words: centred, no icons, each section a card of its own on the sheet's ground. It stands on nothing, clear of the home bar: the
|
|
118
|
+
sheet round it gives up its ground, its shadow and its handle. */
|
|
119
|
+
[data-menu-list-rows="words"] .o-menu-list { gap: calc(var(--vk-spacing) * 2); }
|
|
120
|
+
[data-menu-list-rows="words"] .o-menu-list-section { border-radius: var(--vk-radius-2xl); background-color: var(--vk-overlay); box-shadow: var(--vk-shadow-2xl); }
|
|
121
|
+
[data-menu-list-rows="words"] :where(.o-menu-list) .o-menu-list-row { justify-content: center; text-align: center; font-weight: var(--vk-font-weight-medium); }
|
|
122
|
+
[data-menu-list-rows="words"] :where(.o-menu-list) .o-menu-list-row::before { background-color: var(--vk-border); }
|
|
123
|
+
[data-menu-list-rows="words"] :where(.o-menu-list) .o-menu-list-row:active:not(:disabled, [data-disabled]) { background-color: var(--vk-overlay-pressed); }
|
|
124
|
+
[data-menu-list-rows="words"] :where(.o-menu-list) :is(.o-menu-list-mark, .o-menu-list-more, .o-menu-list-value, .o-menu-list-end) { display: none; }
|
|
125
|
+
[data-menu-list-rows="words"] :where(.o-menu-list) .o-menu-list-name { flex: none; }
|
|
126
|
+
[data-menu-list-rows="words"] .o-sheet.o-sheet:has(.o-menu-list) { background-color: transparent; box-shadow: none; }
|
|
127
|
+
[data-menu-list-rows="words"] .o-sheet.o-sheet:has(.o-menu-list) > .o-sheet-cut { background-color: transparent; clip-path: none; overflow: visible; }
|
|
128
|
+
[data-menu-list-rows="words"] .o-sheet:has(.o-menu-list) .o-sheet-handle { display: none; }
|
|
129
|
+
[data-menu-list-rows="words"] .o-sheet:has(.o-menu-list) .o-sheet-body { padding: 0 0 max(calc(var(--vk-spacing) * 2), var(--sheet-home)); overflow: visible; }
|
|
130
|
+
|
|
131
|
+
[data-menu-list-lines="full"] .o-menu-list-row { --menu-list-line: 0px; }
|
|
132
|
+
|
|
133
|
+
/* ── The tiles: the few done most, side by side over its rows ────────────────────────────────────────────────────── */
|
|
134
|
+
.o-menu-list-tiles { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: calc(var(--vk-spacing) * 2); min-width: 0; }
|
|
135
|
+
.o-menu-list-tile {
|
|
136
|
+
display: grid; justify-items: center; align-content: center; gap: calc(var(--vk-spacing) * 1); box-sizing: border-box; min-width: 0; min-height: calc(var(--vk-spacing) * 19);
|
|
137
|
+
margin: 0; padding: calc(var(--vk-spacing) * 1); border: 0; border-radius: var(--menu-list-corners); background-color: var(--vk-overlay-card); color: var(--vk-fg);
|
|
138
|
+
font: inherit; font-size: var(--vk-font-size-xs); line-height: calc(var(--vk-spacing) * 4); text-align: center; cursor: pointer; outline: none; user-select: none; -webkit-tap-highlight-color: transparent;
|
|
139
|
+
}
|
|
140
|
+
.o-menu-list-tile:focus-visible { outline: var(--vk-focus-width) solid var(--vk-border-brand); outline-offset: calc(-1 * var(--vk-focus-width)); }
|
|
141
|
+
.o-menu-list-tile:active:not(:disabled, [data-disabled]) { background-color: var(--vk-overlay-card-pressed); }
|
|
142
|
+
.o-menu-list-tile:is(:disabled, [data-disabled]) { color: var(--vk-fg-disabled); cursor: not-allowed; }
|
|
143
|
+
/* Its other three ways (Mihai's picks, 16 Nov 2026): the tile stands clear and its mark
|
|
144
|
+
is its ground, the icon alone in it, the name 6 under it, two lines at most. Wide, after ClickUp: a grey tile 56 tall, as wide as its
|
|
145
|
+
column, at the Corners. Circle, after Google Maps: a grey circle 52. Colour, after WhatsApp's attach sheet: a circle 56 in a label colour
|
|
146
|
+
by place, blue, amber, purple and green, the icon in text-inverse. A press shows on the mark, each colour's own pressed shade; a tile that
|
|
147
|
+
can't be used stands on the neutral ground in the disabled ink. */
|
|
148
|
+
:is([data-menu-list-tiles="wide"], [data-menu-list-tiles="circle"], [data-menu-list-tiles="colour"]) .o-menu-list-tile {
|
|
149
|
+
align-content: start; gap: calc(var(--vk-spacing) * 1.5); min-height: 0; padding: 0; border-radius: 0; background-color: transparent;
|
|
150
|
+
}
|
|
151
|
+
:is([data-menu-list-tiles="wide"], [data-menu-list-tiles="circle"], [data-menu-list-tiles="colour"]) .o-menu-list-tile:active:not(:disabled, [data-disabled]) { background-color: transparent; }
|
|
152
|
+
:is([data-menu-list-tiles="wide"], [data-menu-list-tiles="circle"], [data-menu-list-tiles="colour"]) .o-menu-list-tile:focus-visible { outline: none; }
|
|
153
|
+
:is([data-menu-list-tiles="wide"], [data-menu-list-tiles="circle"], [data-menu-list-tiles="colour"]) .o-menu-list-tile:focus-visible > .o-menu-list-mark { outline: var(--vk-focus-width) solid var(--vk-border-brand); outline-offset: calc(-1 * var(--vk-focus-width)); }
|
|
154
|
+
:is([data-menu-list-tiles="wide"], [data-menu-list-tiles="circle"], [data-menu-list-tiles="colour"]) .o-menu-list-tile > .o-menu-list-mark { box-sizing: border-box; background-color: var(--vk-overlay-card); }
|
|
155
|
+
:is([data-menu-list-tiles="wide"], [data-menu-list-tiles="circle"], [data-menu-list-tiles="colour"]) .o-menu-list-tile > .o-menu-list-mark > svg { width: calc(var(--vk-spacing) * 6); height: calc(var(--vk-spacing) * 6); }
|
|
156
|
+
:is([data-menu-list-tiles="wide"], [data-menu-list-tiles="circle"], [data-menu-list-tiles="colour"]) .o-menu-list-tile:active:not(:disabled, [data-disabled]) > .o-menu-list-mark { background-color: var(--vk-overlay-card-pressed); }
|
|
157
|
+
:is([data-menu-list-tiles="wide"], [data-menu-list-tiles="circle"], [data-menu-list-tiles="colour"]) .o-menu-list-tile-name {
|
|
158
|
+
display: -webkit-box; max-width: 100%; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
|
|
159
|
+
}
|
|
160
|
+
[data-menu-list-tiles="wide"] .o-menu-list-tile > .o-menu-list-mark { width: 100%; height: calc(var(--vk-spacing) * 14); border-radius: var(--menu-list-corners); }
|
|
161
|
+
[data-menu-list-tiles="circle"] .o-menu-list-tile > .o-menu-list-mark { width: calc(var(--vk-spacing) * 13); height: calc(var(--vk-spacing) * 13); border-radius: var(--vk-radius-full); }
|
|
162
|
+
[data-menu-list-tiles="circle"] .o-menu-list-tile > .o-menu-list-mark > svg { width: calc(var(--vk-spacing) * 5.5); height: calc(var(--vk-spacing) * 5.5); }
|
|
163
|
+
[data-menu-list-tiles="colour"] .o-menu-list-tile > .o-menu-list-mark { width: calc(var(--vk-spacing) * 14); height: calc(var(--vk-spacing) * 14); border-radius: var(--vk-radius-full); color: var(--vk-fg-inverse); }
|
|
164
|
+
[data-menu-list-tiles="colour"] .o-menu-list-tile:nth-child(1) > .o-menu-list-mark { background-color: var(--vk-label-blue); }
|
|
165
|
+
[data-menu-list-tiles="colour"] .o-menu-list-tile:nth-child(2) > .o-menu-list-mark { background-color: var(--vk-label-amber); }
|
|
166
|
+
[data-menu-list-tiles="colour"] .o-menu-list-tile:nth-child(3) > .o-menu-list-mark { background-color: var(--vk-label-purple); }
|
|
167
|
+
[data-menu-list-tiles="colour"] .o-menu-list-tile:nth-child(4) > .o-menu-list-mark { background-color: var(--vk-label-green); }
|
|
168
|
+
[data-menu-list-tiles="colour"] .o-menu-list-tile:nth-child(1):active:not(:disabled, [data-disabled]) > .o-menu-list-mark { background-color: var(--vk-label-blue-pressed); }
|
|
169
|
+
[data-menu-list-tiles="colour"] .o-menu-list-tile:nth-child(2):active:not(:disabled, [data-disabled]) > .o-menu-list-mark { background-color: var(--vk-label-amber-pressed); }
|
|
170
|
+
[data-menu-list-tiles="colour"] .o-menu-list-tile:nth-child(3):active:not(:disabled, [data-disabled]) > .o-menu-list-mark { background-color: var(--vk-label-purple-pressed); }
|
|
171
|
+
[data-menu-list-tiles="colour"] .o-menu-list-tile:nth-child(4):active:not(:disabled, [data-disabled]) > .o-menu-list-mark { background-color: var(--vk-label-green-pressed); }
|
|
172
|
+
:is([data-menu-list-tiles="wide"], [data-menu-list-tiles="circle"], [data-menu-list-tiles="colour"]) .o-menu-list-tile:is(:disabled, [data-disabled]) > .o-menu-list-mark { background-color: var(--vk-neutral); color: var(--vk-fg-disabled); }
|
|
173
|
+
|
|
174
|
+
/* ── On a computer: a menu's rows, inside a menu's panel or standing on a page. Base UI marks a row data-highlighted
|
|
175
|
+
under the pointer or the keyboard, a choice data-checked, a row that can't be used data-disabled, and a row whose choices are
|
|
176
|
+
open data-popup-open; list.css draws the row itself, this file its parts. ───────────────────── */
|
|
177
|
+
/* How long the pointer rests on a row one level in before its panel opens, read by the script that opens it. */
|
|
178
|
+
.o-menu-row { --menu-sub-wait: var(--vk-submenu-delay); }
|
|
179
|
+
/* ── A row: its 16px icon 8px before its name, then its keys, its value or its way further in ──────── */
|
|
180
|
+
.o-menu-row { white-space: nowrap; text-decoration: none; }
|
|
181
|
+
.o-menu-row > svg:first-child { flex: none; width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); fill: none; stroke: var(--vk-fg-subtle); stroke-linecap: round; stroke-linejoin: round; }
|
|
182
|
+
.o-menu-row:is([data-highlighted], [data-popup-open], [data-force="hover"]) > svg:first-child { stroke: var(--vk-fg); }
|
|
183
|
+
.o-menu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
184
|
+
.o-menu-keys { flex: none; display: flex; gap: calc(var(--vk-spacing) * 0.75); margin-left: calc(var(--vk-spacing) * 6); font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtlest); }
|
|
185
|
+
.o-menu-keys kbd { font: inherit; }
|
|
186
|
+
/* How many it holds, at its end in the quietest colour; a Spinner while that loads. */
|
|
187
|
+
.o-menu-count { flex: none; display: flex; margin-left: auto; padding-left: calc(var(--vk-spacing) * 4); font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtlest); font-variant-numeric: tabular-nums; }
|
|
188
|
+
.o-menu-value { flex: none; max-width: calc(var(--vk-spacing) * 30); margin-left: calc(var(--vk-spacing) * 4); overflow: hidden; text-overflow: ellipsis; font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtle); }
|
|
189
|
+
/* A choice's detail: what it reads as (a date style's sample), quiet, before its tick. */
|
|
190
|
+
.o-menu-detail { flex: none; margin-left: calc(var(--vk-spacing) * 4); font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtlest); font-variant-numeric: tabular-nums; }
|
|
191
|
+
.o-menu-more { flex: none; width: calc(var(--vk-spacing) * 3.5); height: calc(var(--vk-spacing) * 3.5); margin-right: calc(var(--vk-spacing) * -0.5); fill: none; stroke: var(--vk-fg-subtlest); stroke-linecap: round; stroke-linejoin: round; }
|
|
192
|
+
.o-menu-row .o-list-tick { margin-left: calc(var(--vk-spacing) * 4); }
|
|
193
|
+
|
|
194
|
+
/* ── Takes something away: in the danger colour, washed under the pointer so it warns before the click ─ */
|
|
195
|
+
.o-menu-row.o-menu-danger { color: var(--vk-danger); }
|
|
196
|
+
.o-menu-danger > svg:first-child, .o-menu-danger:is([data-highlighted], [data-force="hover"]) > svg:first-child { stroke: var(--vk-danger); }
|
|
197
|
+
.o-menu-danger .o-menu-keys { color: var(--vk-danger); }
|
|
198
|
+
.o-menu-row.o-menu-danger:is([data-highlighted], [data-force="hover"]) { background-color: var(--vk-danger-subtlest); }
|
|
199
|
+
|
|
200
|
+
/* ── Can't be used: greyed, no fill under the pointer; its tooltip says why ─────────────────────────── */
|
|
201
|
+
.o-menu-row[data-disabled] { color: var(--vk-fg-disabled); cursor: not-allowed; }
|
|
202
|
+
.o-menu-row[data-disabled] > svg:first-child { stroke: var(--vk-fg-disabled); }
|
|
203
|
+
.o-menu-row[data-disabled]:is([data-highlighted], [data-force="hover"]) { background-color: transparent; }
|
|
204
|
+
|
|
205
|
+
/* A tick: the Checkbox's own box before its name (CheckboxMark, checkbox.css), ticked and greyed by its row. */
|
|
206
|
+
/* A link that leaves the app: an arrow after its name. */
|
|
207
|
+
.o-menu-away { flex: none; width: calc(var(--vk-spacing) * 3.5); height: calc(var(--vk-spacing) * 3.5); margin-left: calc(var(--vk-spacing) * 4); fill: none; stroke: var(--vk-fg-subtlest); stroke-linecap: round; stroke-linejoin: round; }
|
|
208
|
+
|
|
209
|
+
/* A row alone, shown in one of its states. */
|
|
210
|
+
.o-list.o-menu.o-menu-state { min-width: calc(var(--vk-spacing) * 46); box-shadow: none; }
|
|
211
|
+
|
|
212
|
+
/* ── Shown open in the page: a choice row's choices beside it, their edges on one line, their first row
|
|
213
|
+
level with it; room kept for them. A computer's cases: on a phone the page's On the phone stands the Sheet at its step (sheet.tsx) ─ */
|
|
214
|
+
.o-menu-pair { padding-right: calc(var(--vk-spacing) * 52); }
|
|
215
|
+
.o-menu-subwrap { position: relative; }
|
|
216
|
+
.o-menu-subwrap > .o-menu-sub { position: absolute; z-index: 2; top: calc(-1 * var(--list-pad, var(--vk-spacing)) - var(--vk-border-width)); left: calc(100% + var(--vk-spacing)); }
|
|
217
|
+
|
|
218
|
+
/* ── What scrolls in a menu's panel (MenuScroll): its rows, alone, when the panel is taller than the room on screen. ── */
|
|
219
|
+
.o-menu-list-scroll { display: grid; min-height: 0; overflow-y: auto; overscroll-behavior: contain; outline: none; }
|
|
220
|
+
|
|
221
|
+
/* ── In a panel that is no menu: its rows stand in their holder's panel (the Pane, a Popover), as a menu's in its: a
|
|
222
|
+
row's corners as the list's (list.css's .o-list .o-list-row), no panel of its own. ─────────────────────────────────── */
|
|
223
|
+
.o-menu-rows { --list-row-corners-in: var(--list-row-corners, var(--list-row-r, var(--list-box-r, var(--vk-radius-lg)))); display: grid; min-width: 0; outline: none; }
|
|
224
|
+
.o-menu-rows .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))); }
|
|
225
|
+
/* A tick as the Switch, at its end. */
|
|
226
|
+
.o-menu-switch > .o-switch { flex: none; margin-left: calc(var(--vk-spacing) * 4); }
|
|
227
|
+
/* A value in force (a filter's "1", a sort's "Amount +1"): in the brand. */
|
|
228
|
+
.o-menu-value[data-on] { color: var(--vk-fg-accent); }
|
|
229
|
+
/* A tick as an eye, at its end: open while it is on, crossed while off, quieter; greyed on a row that can't be used. */
|
|
230
|
+
.o-menu-eye { flex: none; display: grid; place-items: center; margin-left: calc(var(--vk-spacing) * 4); color: var(--vk-fg-subtle); }
|
|
231
|
+
.o-menu-eye > svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); }
|
|
232
|
+
.o-menu-eye:not([data-on]) { color: var(--vk-fg-subtlest); }
|
|
233
|
+
.o-menu-row[data-disabled] > .o-menu-eye { color: var(--vk-fg-disabled); }
|
|
234
|
+
|
|
235
|
+
/* The eye's change, a phone's and a panel's alike: its outline stays; its slash, a path one long, is drawn across from its
|
|
236
|
+
top as it is crossed (arriving, ease-out) and drawn back away as it opens (leaving, ease-in, so its last dot goes at once), on
|
|
237
|
+
duration-fast, the band cut from the outline beside it drawn with it, the pupil's half above the slash fading, and its colour
|
|
238
|
+
easing. The slash is hidden only once drawn away, so no dot stands at its top. */
|
|
239
|
+
:is(.o-menu-eye, .o-menu-list-eye) { transition: color var(--vk-duration-fast) var(--vk-ease-out); }
|
|
240
|
+
:is(.o-eye-slash, .o-eye-cut) { stroke-dasharray: 1 1; stroke-dashoffset: 1; visibility: hidden;
|
|
241
|
+
transition: stroke-dashoffset var(--vk-duration-fast) var(--vk-ease-in), visibility var(--vk-duration-fast); }
|
|
242
|
+
.o-eye-upper { transition: opacity var(--vk-duration-fast) var(--vk-ease-out); }
|
|
243
|
+
:not([data-on]) > svg > .o-eye-slash, :not([data-on]) > svg > mask > .o-eye-cut { stroke-dashoffset: 0; visibility: visible; transition-timing-function: var(--vk-ease-out); }
|
|
244
|
+
:not([data-on]) > svg > .o-eye-upper { opacity: 0; }
|
|
245
|
+
@media (prefers-reduced-motion: reduce) { :is(.o-menu-eye, .o-menu-list-eye, .o-eye-slash, .o-eye-cut, .o-eye-upper) { transition: none; } }
|
|
246
|
+
/* A row with a grip: the grip at its start; held, it stands over the others on the overlay's ground, as the sort
|
|
247
|
+
editor's held rule does, its smooth clip let go so its shadow shows. */
|
|
248
|
+
.o-menu-row > .o-menu-grip { flex: none; margin-left: calc(var(--vk-spacing) * -1); touch-action: none; }
|
|
249
|
+
/* A row with no grip among rows that carry one keeps the grip's room (Mihai, 19 Nov 2026: "Keep the room"): the grip itself, out of
|
|
250
|
+
sight, standing where a grip stands, so every row's mark is in one line. */
|
|
251
|
+
.o-menu-grip-room { display: contents; visibility: hidden; }
|
|
252
|
+
.o-menu-grip-room > .o-button { flex: none; margin-left: calc(var(--vk-spacing) * -1); }
|
|
253
|
+
.o-menu-row[data-lifted] { position: relative; z-index: var(--vk-layer-popup); clip-path: none; background-color: var(--vk-overlay); box-shadow: var(--vk-shadow-lg); cursor: grabbing; }
|
|
254
|
+
.o-menu-row[data-lifted] > .o-menu-grip { cursor: grabbing; }
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* What a list of rows with a grip says to a screen reader alone: each move, as it is made. Out of sight, as the Status's
|
|
258
|
+
word standing alone (status.css). */
|
|
259
|
+
.o-menu-said { position: absolute; width: var(--vk-border-width); height: var(--vk-border-width); overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { NumberField as BaseNumberField } from "@base-ui/react/number-field";
|
|
3
|
+
import { type InputSize } from "../input/input.js";
|
|
4
|
+
import type { InputOwnLook } from "../input/looks.js";
|
|
5
|
+
export interface NumberFieldProps extends Omit<BaseNumberField.Root.Props, "className" | "render" | "children" | "style" | "onKeyDown" | "onFocus" | "onBlur" | "autoFocus" | "placeholder"> {
|
|
6
|
+
/** Its height, as the Input's (InputSize): md 36 unless said; every field takes 44 on the phone. */
|
|
7
|
+
size?: InputSize;
|
|
8
|
+
/** What stands before the value, in the field's start side: a currency ("€"), an icon. */
|
|
9
|
+
before?: React.ReactNode;
|
|
10
|
+
/** What stands after the value, in the field's end side, before its steppers: a unit ("%", "kg", "days"). */
|
|
11
|
+
after?: React.ReactNode;
|
|
12
|
+
/** Its steppers. The Input's buttons, Decrease then Increase, at its end: shown from 32px up and never in a cell (no room)
|
|
13
|
+
* unless said (true), and never on a field that is read only; a 24 or 28px field has no room for them, as the Input's own
|
|
14
|
+
* buttons, and its keys still step it. Or "arrows": up over down at its end, as a number's editor draws them, at every size and
|
|
15
|
+
* in a cell too, hidden (their room kept) until the field is edited and always shown in a cell, never on a field that is read
|
|
16
|
+
* only; Shift and a press steps by largeStep. false: none. */
|
|
17
|
+
steppers?: boolean | "arrows";
|
|
18
|
+
/** Where its value stands: at its start unless said, or at its end, as a number in a table's column. Its digits line up either way. */
|
|
19
|
+
align?: "start" | "end";
|
|
20
|
+
/** A drag on its unit (before or after) changes it, by its step per few pixels: off unless said. */
|
|
21
|
+
scrub?: boolean;
|
|
22
|
+
/** The input's own words when it is empty. Never the label's job. */
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
"aria-label"?: string;
|
|
25
|
+
"aria-labelledby"?: string;
|
|
26
|
+
"aria-describedby"?: string;
|
|
27
|
+
/** On its input: an app that runs its own keys first. */
|
|
28
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
29
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
30
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
31
|
+
autoFocus?: boolean;
|
|
32
|
+
/** Whether the browser and the password managers may fill it: on unless said. Off for a box holding someone else's
|
|
33
|
+
* details (a record's), so nothing offers the user's own (useAutofill). */
|
|
34
|
+
autofill?: boolean;
|
|
35
|
+
/** A box's own look, on its field: its options, whole, winning over its frame's. */
|
|
36
|
+
look?: InputOwnLook;
|
|
37
|
+
/** How it stands, its kind, which its place picks: in its field unless said; Soft, its field
|
|
38
|
+
* in the Soft look as its own whatever the app picks for its Inputs (the Input's Soft); inline, typed into where it stands, its group the inline input's, as its
|
|
39
|
+
* frame picks it, its size and look meaning nothing; or bare: the control alone, where its place
|
|
40
|
+
* frames it, Base UI's root standing aside, with no sides, steppers or arrows, its size and look meaning nothing. */
|
|
41
|
+
chrome?: "field" | "soft" | "inline" | "bare";
|
|
42
|
+
className?: string;
|
|
43
|
+
style?: React.CSSProperties;
|
|
44
|
+
}
|
|
45
|
+
/** A number typed in, stepped or bounded: the Input's own field with its steppers, a minimum, a maximum and a step,
|
|
46
|
+
* and a unit or a currency beside the value. Alone, or inside a Field, which gives it its label and its note or
|
|
47
|
+
* its error. */
|
|
48
|
+
export declare const NumberField: React.ForwardRefExoticComponent<Omit<NumberFieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { NumberField as BaseNumberField } from "@base-ui/react/number-field";
|
|
4
|
+
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { InlineInputGroup } from "../inline-input/inline-input.js";
|
|
6
|
+
import { useAutofill } from "../input/autofill.js";
|
|
7
|
+
import { InputGroup, InputGroupAddon, InputGroupButton } from "../input/input.js";
|
|
8
|
+
function Mark({ paths }) {
|
|
9
|
+
return (_jsx("svg", { width: 15, height: 15, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) }));
|
|
10
|
+
}
|
|
11
|
+
const MINUS = ["M5 12l14 0"], PLUS = ["M12 5l0 14", "M5 12l14 0"];
|
|
12
|
+
function pageKeys(e, on) {
|
|
13
|
+
if (!on || (e.key !== "PageUp" && e.key !== "PageDown") || e.altKey || e.ctrlKey || e.metaKey || e.nativeEvent.isComposing)
|
|
14
|
+
return;
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
e.currentTarget.dispatchEvent(new KeyboardEvent("keydown", { key: e.key === "PageUp" ? "ArrowUp" : "ArrowDown", shiftKey: true, bubbles: true, cancelable: true }));
|
|
17
|
+
}
|
|
18
|
+
const UP_MARK = _jsx("svg", { viewBox: "0 0 8 5", "aria-hidden": "true", children: _jsx("path", { d: "M0 5h8l-4-5z" }) }), DOWN_MARK = _jsx("svg", { viewBox: "0 0 8 5", "aria-hidden": "true", children: _jsx("path", { d: "M0 0h8l-4 5z" }) });
|
|
19
|
+
const DRAG = _jsx("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { d: "M8 7l-5 5l5 5M16 7l5 5l-5 5M3 12h18" }) });
|
|
20
|
+
export const NumberField = React.forwardRef(function NumberField({ size = "md", before, after, steppers, align = "start", scrub = false, placeholder, "aria-label": label, "aria-labelledby": labelledBy, "aria-describedby": describedBy, onKeyDown, onFocus, onBlur, autoFocus, autofill = true, look, chrome, className, style, disabled, readOnly, ...root }, ref) {
|
|
21
|
+
const fill = useAutofill();
|
|
22
|
+
const arrows = steppers === "arrows" && !readOnly;
|
|
23
|
+
const stepped = steppers !== "arrows" && (steppers ?? (size !== "2xs" && size !== "xs" && !readOnly && chrome !== "inline"));
|
|
24
|
+
const side = (where, what) => what == null ? null : scrub
|
|
25
|
+
? _jsxs(BaseNumberField.ScrubArea, { className: "o-number-scrub", render: (props) => _jsx(InputGroupAddon, { side: where, ...props, children: props.children }), children: [what, _jsx(BaseNumberField.ScrubAreaCursor, { className: "o-number-cursor", children: DRAG })] }, where)
|
|
26
|
+
: _jsx(InputGroupAddon, { side: where, children: what }, where);
|
|
27
|
+
const input = (_jsx(BaseNumberField.Input, { className: cx("o-input-control o-input-num", align === "end" && "o-number-end"), ...fill(autofill), placeholder: placeholder, "aria-label": label, "aria-labelledby": labelledBy, "aria-describedby": describedBy, autoFocus: autoFocus, onKeyDown: (e) => { onKeyDown?.(e); if (!e.defaultPrevented)
|
|
28
|
+
pageKeys(e, !disabled && !readOnly); }, onFocus: onFocus, onBlur: onBlur }));
|
|
29
|
+
if (chrome === "bare")
|
|
30
|
+
return (_jsx(BaseNumberField.Root, { ref: ref, className: cx("o-number o-number-bare", className), style: style, disabled: disabled, readOnly: readOnly, "data-kit": "number-field", ...root, children: input }));
|
|
31
|
+
return (_jsx(BaseNumberField.Root, { ref: ref, className: cx("o-number", className), style: style, disabled: disabled, readOnly: readOnly, "data-kit": "number-field", ...root, children: _jsxs(BaseNumberField.Group, { render: (props) => chrome === "inline"
|
|
32
|
+
? _jsx(InlineInputGroup, { ...props, children: props.children })
|
|
33
|
+
: _jsx(InputGroup, { size: size, look: look, chrome: chrome === "soft" ? "soft" : undefined, ...props, children: props.children }), children: [side("start", before), input, side("end", after), stepped && (_jsxs(InputGroupAddon, { side: "end", className: "o-number-steps", children: [_jsx(BaseNumberField.Decrement, { render: _jsx(InputGroupButton, { icon: _jsx(Mark, { paths: MINUS }) }) }), _jsx(BaseNumberField.Increment, { render: _jsx(InputGroupButton, { icon: _jsx(Mark, { paths: PLUS }) }) })] })), arrows && (_jsxs(InputGroupAddon, { side: "end", className: "o-number-arrows", children: [_jsx(BaseNumberField.Increment, { className: "o-number-arrow", "aria-label": "Increase", children: UP_MARK }), _jsx(BaseNumberField.Decrement, { className: "o-number-arrow", "aria-label": "Decrease", children: DOWN_MARK })] }))] }) }));
|
|
34
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const NUMBER_FIELD_TOKENS: readonly [{
|
|
2
|
+
readonly name: "--vk-border-width";
|
|
3
|
+
readonly kind: "size";
|
|
4
|
+
readonly outright: "--border-width";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "--vk-duration-fast";
|
|
7
|
+
readonly kind: "motion";
|
|
8
|
+
readonly outright: "--duration-fast";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "--vk-ease-out";
|
|
11
|
+
readonly kind: "motion";
|
|
12
|
+
readonly outright: "--ease-out";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "--vk-fg";
|
|
15
|
+
readonly kind: "colour";
|
|
16
|
+
readonly outright: "--text";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "--vk-fg-disabled";
|
|
19
|
+
readonly kind: "colour";
|
|
20
|
+
readonly outright: "--text-disabled";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "--vk-fg-subtle";
|
|
23
|
+
readonly kind: "colour";
|
|
24
|
+
readonly outright: "--text-subtle";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "--vk-ground";
|
|
27
|
+
readonly kind: "colour";
|
|
28
|
+
readonly outright: "--surface";
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "--vk-overlay-pressed";
|
|
31
|
+
readonly kind: "colour";
|
|
32
|
+
readonly outright: "--surface-overlay-pressed";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "--vk-overlay-selected";
|
|
35
|
+
readonly kind: "colour";
|
|
36
|
+
readonly outright: "--surface-overlay-selected";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "--vk-radius-xs";
|
|
39
|
+
readonly kind: "size";
|
|
40
|
+
readonly outright: "--radius-xs";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "--vk-spacing";
|
|
43
|
+
readonly kind: "size";
|
|
44
|
+
readonly outright: "--spacing";
|
|
45
|
+
}];
|
|
46
|
+
/** The prefixes of the number field's own machinery, set and read by it alone: not public. */
|
|
47
|
+
export declare const NUMBER_FIELD_PRIVATE: readonly ["--number-"];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const NUMBER_FIELD_TOKENS = [
|
|
2
|
+
{ name: "--vk-border-width", kind: "size", outright: "--border-width" },
|
|
3
|
+
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
4
|
+
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
5
|
+
{ name: "--vk-fg", kind: "colour", outright: "--text" },
|
|
6
|
+
{ name: "--vk-fg-disabled", kind: "colour", outright: "--text-disabled" },
|
|
7
|
+
{ name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
|
|
8
|
+
{ name: "--vk-ground", kind: "colour", outright: "--surface" },
|
|
9
|
+
{ name: "--vk-overlay-pressed", kind: "colour", outright: "--surface-overlay-pressed" },
|
|
10
|
+
{ name: "--vk-overlay-selected", kind: "colour", outright: "--surface-overlay-selected" },
|
|
11
|
+
{ name: "--vk-radius-xs", kind: "size", outright: "--radius-xs" },
|
|
12
|
+
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
13
|
+
];
|
|
14
|
+
export const NUMBER_FIELD_PRIVATE = ["--number-"];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* The Number field. Its field, its sides, its buttons and every look are the Input's own (input.css): this file
|
|
2
|
+
holds only what is its own. Every value it draws with is a public name. Base UI marks a stepper
|
|
3
|
+
data-disabled at its bound, and the field data-scrubbing while its unit is dragged.
|
|
4
|
+
|
|
5
|
+
The rules sit in the components layer, so a utility class on it still wins. */
|
|
6
|
+
@layer components {
|
|
7
|
+
|
|
8
|
+
.o-number { min-width: 0; }
|
|
9
|
+
/* Bare: the control alone, Base UI's root standing aside, so the input is its place's own child, as the Input's bare form. */
|
|
10
|
+
.o-number-bare { display: contents; }
|
|
11
|
+
|
|
12
|
+
/* ── Its steppers, Decrease then Increase, at its end. On the phone each keeps the Input's 28px button and takes a
|
|
13
|
+
44px target round it, the two set apart so their targets never meet. ─────────────────────────────────────── */
|
|
14
|
+
/* Named with the addon it is, so its gap wins over the addon's own wherever the stylesheets stand in the page. */
|
|
15
|
+
.o-input-addon.o-number-steps { gap: calc(var(--vk-spacing) * 0.5); }
|
|
16
|
+
.o-number-steps > .o-button { position: relative; }
|
|
17
|
+
@media (width < 640px) {
|
|
18
|
+
.o-input-addon.o-number-steps:where(:not([data-computer-host], [data-computer-host] *)) { gap: calc(var(--vk-spacing) * 4); }
|
|
19
|
+
.o-number-steps > .o-button:where(:not([data-computer-host], [data-computer-host] *))::before { content: ""; position: absolute; top: 50%; left: 50%; width: calc(var(--vk-spacing) * 11); height: calc(var(--vk-spacing) * 11); translate: -50% -50%; }
|
|
20
|
+
}
|
|
21
|
+
@container o-phone (width < 640px) {
|
|
22
|
+
.o-input-addon.o-number-steps { gap: calc(var(--vk-spacing) * 4); }
|
|
23
|
+
.o-number-steps > .o-button::before { content: ""; position: absolute; top: 50%; left: 50%; width: calc(var(--vk-spacing) * 11); height: calc(var(--vk-spacing) * 11); translate: -50% -50%; }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* ── Its arrows, up over down at its end, as the Number editor's: 12 × 20 on the overlay's pressed fill, which stays seen in
|
|
27
|
+
dark, --number-arrows-room from what stands before them, 2px unless said, whatever the group's gap (--input-group-gap).
|
|
28
|
+
Each fills its row (the side centres what it holds
|
|
29
|
+
otherwise). Hidden until the field is edited, their room kept so the value never moves; a group in a cell is never .o-input,
|
|
30
|
+
so there they always show, the box standing only while it is edited. ───────────────────────────────────────────────────── */
|
|
31
|
+
.o-input-addon.o-number-arrows {
|
|
32
|
+
display: grid; grid-template-rows: 1fr 1fr; align-items: stretch; gap: 0; width: calc(var(--vk-spacing) * 3); height: calc(var(--vk-spacing) * 5);
|
|
33
|
+
margin-inline-start: calc(var(--number-arrows-room, calc(var(--vk-spacing) / 2)) - var(--input-group-gap, calc(var(--vk-spacing) * 1.5))); border-radius: var(--vk-radius-xs); overflow: hidden; background-color: var(--vk-overlay-pressed); cursor: default;
|
|
34
|
+
}
|
|
35
|
+
.o-input:not(:focus-within) > .o-number-arrows { visibility: hidden; }
|
|
36
|
+
/* In the Inline input the arrows stand as everything beside the value does, its gap from it, in the box's own colour,
|
|
37
|
+
always shown: the box stands only while it is edited. */
|
|
38
|
+
.o-inline-input-group > .o-input-addon.o-number-arrows { margin-inline-start: 0; color: inherit; }
|
|
39
|
+
.o-number-arrow {
|
|
40
|
+
display: grid; place-items: center; margin: 0; padding: 0; border: 0; background-color: transparent; color: var(--vk-fg-subtle); cursor: default;
|
|
41
|
+
transition: background-color var(--vk-duration-fast) var(--vk-ease-out), color var(--vk-duration-fast) var(--vk-ease-out);
|
|
42
|
+
}
|
|
43
|
+
@media (hover: hover) { .o-number-arrow:hover { background-color: var(--vk-overlay-selected); color: var(--vk-fg); } }
|
|
44
|
+
.o-number-arrow[data-disabled] { background-color: transparent; color: var(--vk-fg-disabled); }
|
|
45
|
+
.o-number-arrow > svg { width: calc(var(--vk-spacing) * 2); height: calc(var(--vk-spacing) * 1.25); fill: currentColor; }
|
|
46
|
+
|
|
47
|
+
/* ── Its value at its end, as a number in a table's column; its digits line up either way (.o-input-num). ──────────── */
|
|
48
|
+
.o-input-control.o-number-end { text-align: end; }
|
|
49
|
+
|
|
50
|
+
/* ── A unit that is dragged to change it: the pointer says so, and while it drags, the cursor Base UI draws. ─── */
|
|
51
|
+
.o-number-scrub { cursor: ew-resize; touch-action: none; }
|
|
52
|
+
.o-number-cursor { display: flex; color: var(--vk-fg); filter: drop-shadow(0 0 var(--vk-border-width) var(--vk-ground)); pointer-events: none; }
|
|
53
|
+
.o-number-cursor > svg { width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
54
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ViewsTagProps } from "../../atoms/types.js";
|
|
2
|
+
import type { OptionColour } from "./looks.js";
|
|
3
|
+
/** A value's colour as ViewKit names it, as the Option's: ViewKit's gray is the Option's grey, the rest the same. */
|
|
4
|
+
export declare const colourOf: (color: string | undefined) => OptionColour | undefined;
|
|
5
|
+
/** The Tag atom: the Option in the value's colour. */
|
|
6
|
+
export declare function OptionTag({ label, color, leading, onRemove, className }: ViewsTagProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Option } from "./option.js";
|
|
3
|
+
export const colourOf = (color) => (color === "gray" ? "grey" : color);
|
|
4
|
+
export function OptionTag({ label, color, leading, onRemove, className }) {
|
|
5
|
+
return _jsx(Option, { colour: colourOf(color), icon: leading ?? undefined, onRemove: onRemove, className: className, children: label });
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PieceLooks } from "../../looks/looks.js";
|
|
2
|
+
/** A value's own colour: one of the seven label hues, or grey. */
|
|
3
|
+
export type OptionColour = "blue" | "green" | "amber" | "red" | "purple" | "pink" | "teal" | "grey";
|
|
4
|
+
export declare const optionColours: readonly OptionColour[];
|
|
5
|
+
export type OptionLookOptionId = "colour" | "height" | "radius" | "smoothing" | "edge";
|
|
6
|
+
/** The Option's options and looks. */
|
|
7
|
+
export declare const OPTION_LOOKS: PieceLooks<OptionLookOptionId>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const optionColours = ["blue", "green", "amber", "red", "purple", "pink", "teal", "grey"];
|
|
2
|
+
const options = [
|
|
3
|
+
{ id: "colour", name: "Colour", def: "pill", values: [{ id: "none", name: "No colour" }, { id: "dot", name: "Dot" }, { id: "pill", name: "Pill" }, { id: "flat", name: "Flat fill" }] },
|
|
4
|
+
{ id: "height", name: "Height", def: "22", kind: "steps", values: ["20", "22", "24"].map((id) => ({ id, name: id })) },
|
|
5
|
+
{ id: "radius", name: "Corners", def: "lg", kind: "steps", values: ["xs", "sm", "md", "lg", "full"].map((id) => ({ id, name: id === "full" ? "Full" : id })) },
|
|
6
|
+
{ id: "smoothing", name: "Corner smoothing", def: "app", values: [{ id: "app", name: "The app's" }, { id: "smooth", name: "Smooth" }, { id: "round", name: "Round" }] },
|
|
7
|
+
{ id: "edge", name: "Edge", def: "strong", values: [{ id: "strong", name: "Strong" }, { id: "subtle", name: "Subtle" }, { id: "fill", name: "Grey fill" }] },
|
|
8
|
+
];
|
|
9
|
+
const SHAPE = { height: "22", radius: "md", smoothing: "app", edge: "strong" };
|
|
10
|
+
export const OPTION_LOOKS = {
|
|
11
|
+
id: "option",
|
|
12
|
+
name: "Option",
|
|
13
|
+
options,
|
|
14
|
+
looks: [
|
|
15
|
+
{ id: "none", name: "No colour", picks: { colour: "none", ...SHAPE } },
|
|
16
|
+
{ id: "dot", name: "Linear's dot", picks: { colour: "dot", ...SHAPE } },
|
|
17
|
+
{ id: "pill", name: "Attio's pill", picks: { colour: "pill", ...SHAPE } },
|
|
18
|
+
{ id: "flat", name: "Notion's flat fill", picks: { colour: "flat", ...SHAPE } },
|
|
19
|
+
{ id: "shadcn", name: "shadcn's Badge", picks: { colour: "none", height: "20", radius: "full", smoothing: "app", edge: "subtle" } },
|
|
20
|
+
],
|
|
21
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type OptionColour } from "./looks.js";
|
|
4
|
+
export interface OptionProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** A value's own colour: drawn only in a colour look (looks.ts); left out, or a colour it lacks, the Option is plain. */
|
|
7
|
+
colour?: OptionColour;
|
|
8
|
+
/** The rest of a row's values, "+2". */
|
|
9
|
+
count?: number;
|
|
10
|
+
/** While editing: a remove button named "Remove <option>". */
|
|
11
|
+
onRemove?: () => void;
|
|
12
|
+
/** md, 22 high, in a list or a field on a computer; lg, 28 high, in a phone's row, its words a step larger. */
|
|
13
|
+
size?: "md" | "lg";
|
|
14
|
+
className?: string;
|
|
15
|
+
/** At its start: the value's own mark, an icon (12px, 14 in a phone's row); quiet, or in its colour where a colour look
|
|
16
|
+
* draws one, in place of the dot. */
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
/** At its end: what a press does (a chevron that opens its choices, an arrow to another site), quieter; left out while editing. */
|
|
19
|
+
iconEnd?: React.ReactNode;
|
|
20
|
+
/** Drawn as another element, a link above all (`<a href>`, or a router's): Base UI's render. Never while editing (its
|
|
21
|
+
* remove button can't stand in a link), and never on a count. */
|
|
22
|
+
render?: useRender.RenderProp;
|
|
23
|
+
}
|
|
24
|
+
/** One value of a select or multi-select field, in a plain edge, or in its colour where a colour look draws it. What else it
|
|
25
|
+
* is given (a chip's keys and marks, when a select draws it in its field) goes on its edge. */
|
|
26
|
+
export declare const Option: React.ForwardRefExoticComponent<OptionProps & Omit<React.HTMLAttributes<HTMLSpanElement>, keyof OptionProps> & React.RefAttributes<HTMLSpanElement>>;
|
|
27
|
+
/** A field's values as they show on a record or in a list: each as an Option, in its colour where `colours` gives one, the
|
|
28
|
+
* first `max` then a count for the rest; with none, a dash. Two values may share their words (two people of one name):
|
|
29
|
+
* each stands as its own chip. */
|
|
30
|
+
export declare function Options({ values, max, colours, className }: {
|
|
31
|
+
values: string[];
|
|
32
|
+
max?: number;
|
|
33
|
+
colours?: Partial<Record<string, OptionColour>>;
|
|
34
|
+
className?: string;
|
|
35
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { TagCut, TagRemove } from "../tag/tag.js";
|
|
6
|
+
import { optionColours } from "./looks.js";
|
|
7
|
+
export const Option = React.forwardRef(function Option({ children, colour, count, onRemove, size, icon, iconEnd, render, className, ...props }, ref) {
|
|
8
|
+
const word = typeof children === "string" ? children : undefined;
|
|
9
|
+
const shown = onRemove ? undefined : render;
|
|
10
|
+
const link = React.isValidElement(shown) && shown.props.href != null;
|
|
11
|
+
const element = useRender({
|
|
12
|
+
defaultTagName: "span", render: shown, ref, enabled: count == null,
|
|
13
|
+
props: {
|
|
14
|
+
className: cx("o-tag o-option", size === "lg" && "o-option-lg", className), title: word, "data-kit": "option",
|
|
15
|
+
"data-colour": colour && optionColours.includes(colour) ? colour : undefined, ...(link ? { "data-link": "" } : {}), ...props,
|
|
16
|
+
children: _jsxs(_Fragment, { children: [_jsx(TagCut, {}), icon != null && _jsx("span", { className: "o-option-icon", "data-side": "start", "aria-hidden": "true", children: icon }), _jsx("span", { className: "o-tag-word", children: children }), iconEnd != null && !onRemove && _jsx("span", { className: "o-option-icon", "data-side": "end", "aria-hidden": "true", children: iconEnd }), onRemove && _jsx(TagRemove, { word: word, onRemove: onRemove })] }),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
if (count != null)
|
|
20
|
+
return _jsxs("span", { ref: ref, className: cx("o-tag o-tag-count o-option", size === "lg" && "o-option-lg", className), "data-kit": "option", ...props, children: [_jsx(TagCut, {}), "+", count] });
|
|
21
|
+
return element;
|
|
22
|
+
});
|
|
23
|
+
export function Options({ values, max, colours, className }) {
|
|
24
|
+
if (!values.length)
|
|
25
|
+
return _jsx("span", { className: cx("o-option-none", className), children: "\u2014" });
|
|
26
|
+
const shown = max != null && values.length > max ? values.slice(0, max) : values, rest = values.length - shown.length;
|
|
27
|
+
return _jsxs("span", { className: cx("o-options", className), children: [keyed(shown).map(([key, v]) => _jsx(Option, { colour: colours?.[v], children: v }, key)), rest > 0 && _jsx(Option, { count: rest })] });
|
|
28
|
+
}
|
|
29
|
+
const keyed = (values) => {
|
|
30
|
+
const seen = new Map();
|
|
31
|
+
return values.map((v) => { const n = seen.get(v) ?? 0; seen.set(v, n + 1); return [n ? `${v}\u0000${n}` : v, v]; });
|
|
32
|
+
};
|