viewkitjs 0.24.0 → 0.25.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 +20 -0
- package/fields/dist/creatable.d.ts +9 -5
- package/fields/dist/creatable.js +8 -1
- package/fields/dist/messages.d.ts +19 -1
- package/fields/dist/messages.js +75 -0
- package/fields/dist/registry.js +4 -7
- package/fields/dist/types.d.ts +4 -2
- package/fields/dist/zod.d.ts +58 -0
- package/fields/dist/zod.js +430 -2
- package/fields/docs/guides/checking-definitions.md +6 -1
- package/fields/docs/guides/field-types.md +5 -1
- package/fields/docs/reference/definitions.md +1 -2
- package/fields/docs/reference/types.md +2 -1
- package/fields/skills/viewkit/SKILL.md +2 -2
- package/package.json +1 -1
- package/views/dist/controls/avatar/avatar.d.ts +58 -0
- package/views/dist/controls/avatar/avatar.js +54 -0
- package/views/dist/controls/avatar/looks.d.ts +4 -0
- package/views/dist/controls/avatar/looks.js +5 -0
- package/views/dist/controls/avatar/tokens.d.ts +131 -0
- package/views/dist/controls/avatar/tokens.js +35 -0
- package/views/dist/controls/avatar.css +163 -0
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/index.d.ts +12 -0
- package/views/dist/controls/index.js +12 -0
- package/views/dist/controls/internal/phone.d.ts +9 -0
- package/views/dist/controls/internal/phone.js +15 -0
- package/views/dist/controls/internal/read-token.d.ts +2 -1
- package/views/dist/controls/internal/read-token.js +1 -1
- package/views/dist/controls/internal/scroll.d.ts +38 -0
- package/views/dist/controls/internal/scroll.js +126 -0
- package/views/dist/controls/list/looks.d.ts +4 -0
- package/views/dist/controls/list/looks.js +12 -0
- package/views/dist/controls/list.css +17 -13
- package/views/dist/controls/menu/map-menu.d.ts +11 -0
- package/views/dist/controls/menu/map-menu.js +47 -0
- package/views/dist/controls/menu/menu.d.ts +75 -0
- package/views/dist/controls/menu/menu.js +105 -0
- package/views/dist/controls/menu/tokens.d.ts +23 -0
- package/views/dist/controls/menu/tokens.js +8 -0
- package/views/dist/controls/menu-list/looks.d.ts +5 -1
- package/views/dist/controls/menu-list/looks.js +6 -4
- package/views/dist/controls/menu-list/menu-list.js +3 -1
- package/views/dist/controls/menu-list.css +39 -31
- package/views/dist/controls/menu.css +25 -0
- package/views/dist/controls/picker/looks.d.ts +19 -0
- package/views/dist/controls/picker/looks.js +32 -0
- package/views/dist/controls/picker/picker.d.ts +153 -0
- package/views/dist/controls/picker/picker.js +773 -0
- package/views/dist/controls/picker/rows.d.ts +129 -0
- package/views/dist/controls/picker/rows.js +90 -0
- package/views/dist/controls/picker/tokens.d.ts +147 -0
- package/views/dist/controls/picker/tokens.js +39 -0
- package/views/dist/controls/picker.css +237 -0
- package/views/dist/controls/popup-line/tokens.d.ts +23 -0
- package/views/dist/controls/popup-line/tokens.js +8 -0
- package/views/dist/controls/popup-line.css +44 -0
- package/views/dist/controls/select/filled.d.ts +7 -0
- package/views/dist/controls/select/filled.js +5 -0
- package/views/dist/controls/select/fit.d.ts +9 -0
- package/views/dist/controls/select/fit.js +11 -0
- package/views/dist/controls/select/select.d.ts +131 -0
- package/views/dist/controls/select/select.js +227 -0
- package/views/dist/controls/select/side.d.ts +3 -0
- package/views/dist/controls/select/side.js +4 -0
- package/views/dist/controls/select/tokens.d.ts +27 -0
- package/views/dist/controls/select/tokens.js +9 -0
- package/views/dist/controls/select.css +91 -0
- package/views/dist/controls/tokens.js +10 -0
- package/views/dist/looks/index.d.ts +4 -0
- package/views/dist/looks/index.js +4 -0
- package/views/dist/looks/pieces.js +6 -0
- package/views/dist/styles.css +586 -62
- package/views/dist/styles.unlayered.css +586 -62
- package/views/docs/controls/avatar.md +38 -0
- package/views/docs/controls/menu.md +11 -0
- package/views/docs/controls/picker.md +42 -0
- package/views/docs/controls/popup-line.md +11 -0
- package/views/docs/controls/select.md +12 -0
- package/views/docs/reference/controls.md +86 -0
- package/views/docs/reference/looks.md +8 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/* The Picker: what a person picks from, a body the Popover or the Sheet holds. Its rows are list.css's (.o-list-row and its
|
|
2
|
+
parts), so they read as the Select's and the Menu's; this file draws only what is the Picker's own. Every value is a
|
|
3
|
+
control token. Base UI marks a row data-highlighted, data-selected and data-disabled; the frame round it says the options an
|
|
4
|
+
app picked (looks.ts): picker.tsx reads data-picker-search, -picked, -mark, -create and -heading; this file reads
|
|
5
|
+
data-picker-line (beside · below) and data-picker-doing (centred · start).
|
|
6
|
+
|
|
7
|
+
The rules sit in the components layer, so a utility class still wins. */
|
|
8
|
+
@layer components {
|
|
9
|
+
|
|
10
|
+
.o-picker { position: relative; display: flex; flex-direction: column; min-width: 0; color: var(--vk-fg); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
|
|
11
|
+
/* How long a phone's row is held before it lifts, handed on the Picker, where every row it holds inherits it: picker.tsx reads
|
|
12
|
+
it off the held row. */
|
|
13
|
+
.o-picker { --picker-hold: var(--vk-hold-delay); }
|
|
14
|
+
.o-picker .o-list-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
15
|
+
/* A row's second line beside its name (Second line: Beside, Attio's): the name takes its width first, the line what is
|
|
16
|
+
left, cut first; or below it, as the list's rows draw it. */
|
|
17
|
+
.o-picker .o-list-text { display: flex; align-items: baseline; gap: calc(var(--vk-spacing) * 2); }
|
|
18
|
+
.o-picker .o-list-main { flex: 0 1 auto; }
|
|
19
|
+
.o-picker .o-list-line { flex: 1 1 0; min-width: 0; }
|
|
20
|
+
[data-picker-line="below"] .o-picker .o-list-text { display: grid; gap: var(--vk-border-width); }
|
|
21
|
+
|
|
22
|
+
/* The check in the brand's circle at a row's end (Held: Check, Attio's), seen only on the row the field holds. */
|
|
23
|
+
.o-picker-check { flex: none; display: grid; place-items: center; width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); border-radius: var(--vk-radius-full); background-color: var(--vk-brand); color: var(--vk-fg-on-brand); visibility: hidden; }
|
|
24
|
+
.o-picker-check > svg { width: calc(var(--vk-spacing) * 2.5); height: calc(var(--vk-spacing) * 2.5); }
|
|
25
|
+
/* Read from the Picker's root, so the list's shared row class stays lib's (check-fields: a class lib homes is shared). */
|
|
26
|
+
.o-picker .o-list-row:is([data-selected], [aria-selected="true"]) > .o-picker-check { visibility: visible; }
|
|
27
|
+
/* Create below a line (Create: Below a line, Attio's): its words the text's, not the quieter ones. */
|
|
28
|
+
.o-list-row.o-picker-create-apart .o-list-main { color: var(--vk-fg); }
|
|
29
|
+
|
|
30
|
+
/* ── The search: the shared line across a popup's top (popup-line.css), 6 above and below round its chips, 4 over the
|
|
31
|
+
rows. With nothing to search it stays, out of sight, so the keys still work; a letter typed brings it back holding the
|
|
32
|
+
letter. Its box is the kit's Input's list, bare: 64 at least beside chips, the list's words. ── */
|
|
33
|
+
.o-picker-search { --popup-line-pad-block: calc(var(--vk-spacing) * 1.5); }
|
|
34
|
+
.o-input-control.o-picker-input { min-width: calc(var(--vk-spacing) * 16); font-size: var(--vk-font-size-sm); }
|
|
35
|
+
/* In the Soft box (searchLook "soft"): the Input's own box, its place in the list as Customize's Columns' search, 4 over the rows. */
|
|
36
|
+
.o-picker-search-soft { flex: none; padding-bottom: calc(var(--vk-spacing) * 1); }
|
|
37
|
+
/* What is picked as chips (the option Chips): the Options with their × before the words typed, wrapping. */
|
|
38
|
+
.o-picker-chips { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: calc(var(--vk-spacing) * 1.5); }
|
|
39
|
+
|
|
40
|
+
/* ── How many are picked, and Clear all, when several can be ────────────────────────────────────────────────────── */
|
|
41
|
+
.o-picker-count { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--vk-spacing) * 1.5) calc(var(--vk-spacing) * 2); 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); }
|
|
42
|
+
.o-picker-count > .o-button { margin: calc(var(--vk-spacing) * -1) calc(var(--vk-spacing) * -2) calc(var(--vk-spacing) * -1) 0; }
|
|
43
|
+
|
|
44
|
+
/* ── The rows: they scroll under the search when there are many, in a box of their own inside the list; a row keeps its height,
|
|
45
|
+
so a row with its second line below stands whole and the rows scroll ──────────────────────────────────────── */
|
|
46
|
+
.o-picker-listbox { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; outline: none; }
|
|
47
|
+
.o-picker-rows { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: calc(var(--vk-spacing) * 80); overflow-y: auto; outline: none; }
|
|
48
|
+
.o-picker-rows > * { flex: none; }
|
|
49
|
+
/* ── The foot: the actions, and Create where it stands below a line, under the rows, always in view; the shared line at the foot
|
|
50
|
+
(popup-line.css), its line reaching as the search's, as the list's Dividers say, 4 under the rows, its rows
|
|
51
|
+
standing where the rows above stand ── */
|
|
52
|
+
.o-picker-foot.o-popup-line {
|
|
53
|
+
--popup-line-height: 0px; --popup-line-under: var(--vk-spacing); --popup-line-gap: 0px;
|
|
54
|
+
--popup-line-pad: var(--popup-line-reach); --popup-line-pad-block: var(--popup-line-reach);
|
|
55
|
+
flex: none; flex-direction: column; align-items: stretch;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ── On a computer it follows the list's rules, so a Picker and a Select's list side by
|
|
59
|
+
side match. Its rows are the list's: the Input box's corners or Row corners, square at padding 0 (list.css), 8½ rows at most
|
|
60
|
+
(list-rows), a row's room round the one brought into view. And a Popover holding it, and no editor, draws the list's panel in
|
|
61
|
+
place of its own options: the list's Edge (its lines' colour with it), Shadow and Padding, its corners the Input box's plus the padding, never past 2xl,
|
|
62
|
+
and its Corner smoothing (the list's smooth outline, or round), the Popover's own smooth outline not drawn. A body picks the shell's
|
|
63
|
+
options it needs; the Popover knows nothing of what it holds. ── */
|
|
64
|
+
.o-picker[data-picker-form="computer"] .o-list-row { --list-row-rad: var(--list-row-corners, var(--list-row-r, var(--list-box-r, var(--vk-radius-lg))));
|
|
65
|
+
--list-row-pill-in: var(--list-row-corners-pill, var(--list-row-pill, var(--list-box-pill, 0))); }
|
|
66
|
+
.o-picker[data-picker-form="computer"] .o-picker-rows {
|
|
67
|
+
max-height: calc(var(--list-rows) * var(--list-row-h, calc(var(--vk-spacing) * 8))); scroll-padding-block: var(--list-row-h, calc(var(--vk-spacing) * 8));
|
|
68
|
+
}
|
|
69
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])) {
|
|
70
|
+
--popover-edge: var(--list-edge, var(--vk-border)); --divider-colour: var(--list-sep-colour, var(--vk-border)); --popover-shadow: var(--list-shadow, var(--vk-shadow-xl)); --popover-pad: var(--list-pad, calc(var(--vk-spacing) * 1.5));
|
|
71
|
+
--popover-corners: calc(min(var(--list-box-r, var(--vk-radius-lg)), var(--vk-radius-2xl)) + var(--list-pad, calc(var(--vk-spacing) * 1.5)));
|
|
72
|
+
background-color: var(--vk-overlay);
|
|
73
|
+
}
|
|
74
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])) > .o-popover-cut { clip-path: none; }
|
|
75
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])) > .o-popover-cut::before,
|
|
76
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])) > .o-popover-cut::after { clip-path: none; border-radius: var(--picker-c); } /* set by nothing: no radius */
|
|
77
|
+
/* Under the list's Smooth its panel is the Select's list's to the curve: the same radius (its rows' fitted corners plus
|
|
78
|
+
the padding) and the same smoothing, eased on the same side (list.css works the numbers out on this Popover as on a list). The
|
|
79
|
+
Popover's cut eases nothing, so the Picker draws the panel itself, as the list does: its edge (::before) clipped by the kit's
|
|
80
|
+
outline and its ground (::after) by the outline a line in, over it, each filling the cut it stands in; the cut paints nothing and the shell keeps the shadow.
|
|
81
|
+
The Picker draws it wherever in the cut it stands, as the ground is taken off wherever the Popover holds one: on the grid a
|
|
82
|
+
wrapper with no box of its own stands between them, and a Picker reached only as the cut's child left the list with no
|
|
83
|
+
ground there. */
|
|
84
|
+
@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)) {
|
|
85
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])):not([data-list-smoothing="round"] *) { --popover-corners: min(var(--list-panel-r), var(--list-panel-side) / 2); background-color: transparent; }
|
|
86
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])):not([data-list-smoothing="round"] *) > .o-popover-cut { background-color: transparent; }
|
|
87
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])):not([data-list-smoothing="round"] *) > .o-popover-cut::before,
|
|
88
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])):not([data-list-smoothing="round"] *) > .o-popover-cut::after { content: none; }
|
|
89
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])):not([data-list-smoothing="round"] *) > .o-popover-cut .o-picker[data-picker-form="computer"] {
|
|
90
|
+
--smooth-amount: initial; --smooth-t: min(var(--list-panel-r), var(--list-panel-side) / 2); --smooth-side: var(--list-panel-side);
|
|
91
|
+
position: relative; isolation: isolate;
|
|
92
|
+
}
|
|
93
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])):not([data-list-smoothing="round"] *) > .o-popover-cut .o-picker[data-picker-form="computer"]::before,
|
|
94
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])):not([data-list-smoothing="round"] *) > .o-popover-cut .o-picker[data-picker-form="computer"]::after {
|
|
95
|
+
content: ""; position: absolute; inset: calc(var(--list-pad, calc(var(--vk-spacing) * 1.5)) * -1); z-index: -1; pointer-events: none;
|
|
96
|
+
}
|
|
97
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])):not([data-list-smoothing="round"] *) > .o-popover-cut .o-picker[data-picker-form="computer"]::before {
|
|
98
|
+
background-color: var(--vk-overlay); background-image: linear-gradient(var(--list-edge, var(--vk-border)), var(--list-edge, var(--vk-border))); clip-path: shape(var(--smooth-outline));
|
|
99
|
+
}
|
|
100
|
+
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])):not([data-list-smoothing="round"] *) > .o-popover-cut .o-picker[data-picker-form="computer"]::after {
|
|
101
|
+
--smooth-t: max(0px, min(var(--list-panel-r), var(--list-panel-side) / 2) - var(--vk-border-width));
|
|
102
|
+
inset: calc(var(--vk-border-width) - var(--list-pad, calc(var(--vk-spacing) * 1.5))); background-color: var(--vk-overlay); clip-path: shape(var(--smooth-outline));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/* At rest: the light Base UI puts on a row by itself while nothing is typed (as the list opens, as its search empties, after a
|
|
106
|
+
pick) is not drawn: a row lights only under the pointer, after ↑ or ↓, or while something is typed. A row under the pointer keeps it, and
|
|
107
|
+
a row whose menu is open keeps its own (below); a ⋮ shown only on the lit row stays hidden. A page's standing list stands the same. */
|
|
108
|
+
.o-picker[data-rest] .o-list-row[data-highlighted]:not([data-menu-open], [data-force="hover"]) { background-color: transparent; }
|
|
109
|
+
.o-picker[data-rest] .o-list-row[data-highlighted]:not([data-menu-open]) > .o-picker-row-menu[data-shown="pointer"] { visibility: hidden; }
|
|
110
|
+
@media (hover: hover) {
|
|
111
|
+
.o-picker[data-rest] .o-list-row[data-highlighted]:hover:not([data-menu-open]) { background-color: var(--list-highlight, var(--list-hl-grey, var(--vk-overlay-pressed))); }
|
|
112
|
+
.o-picker[data-rest] .o-list-row[data-highlighted]:hover:not([data-menu-open]) > .o-picker-row-menu[data-shown="pointer"] { visibility: visible; }
|
|
113
|
+
}
|
|
114
|
+
/* In a list's panel (the Select's) the search's line and the foot's reach the panel's edge by its padding, as the
|
|
115
|
+
Select's own did. */
|
|
116
|
+
.o-list :is(.o-picker-search, .o-picker-foot) { --popup-line-bleed: var(--list-pad, calc(var(--vk-spacing) * 1.5)); }
|
|
117
|
+
/* In the Popover it takes the room the shell has and no more, so on a short screen its rows scroll and the search stays. */
|
|
118
|
+
.o-picker[data-picker-form="computer"] { flex: 1 1 auto; min-height: 0; }
|
|
119
|
+
.o-picker-kind { flex: none; font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtlest); }
|
|
120
|
+
/* A row's kind as a badge at its end (Kind: Badge, Attio's): the kind's icon on the kind's colour, a person's blue, a
|
|
121
|
+
company's amber, another kind its first letter on the neutral ground. On a phone a size up. */
|
|
122
|
+
.o-picker-badge { flex: none; display: grid; place-items: center; width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); border-radius: var(--vk-radius-sm); background-color: var(--vk-neutral); color: var(--vk-fg-subtle); font-size: var(--vk-font-size-xs); font-weight: var(--vk-font-weight-semibold); line-height: 1; }
|
|
123
|
+
.o-picker-badge[data-of="person"] { background-color: var(--vk-label-blue); color: var(--vk-fg-inverse); }
|
|
124
|
+
.o-picker-badge[data-of="company"] { background-color: var(--vk-label-amber); color: var(--vk-fg-inverse); }
|
|
125
|
+
.o-picker-badge > svg { width: calc(var(--vk-spacing) * 3); height: calc(var(--vk-spacing) * 3); }
|
|
126
|
+
.o-picker[data-picker-form="phone"] .o-picker-badge { width: calc(var(--vk-spacing) * 6); height: calc(var(--vk-spacing) * 6); border-radius: var(--vk-radius-md); }
|
|
127
|
+
.o-picker[data-picker-form="phone"] .o-picker-badge > svg { width: calc(var(--vk-spacing) * 3.75); height: calc(var(--vk-spacing) * 3.75); }
|
|
128
|
+
/* A set's lead: its word on the leading held row, read as the kind's word; Make lead, a text Button, on the others. */
|
|
129
|
+
.o-picker-lead { flex: none; font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtlest); }
|
|
130
|
+
.o-picker-lead-make { flex: none; }
|
|
131
|
+
/* A row's own menu: ⋮ at its end, the kit's quiet Button as it is (⋯, the Menu's, on a phone), only placed here. Under
|
|
132
|
+
Pointer (rowMenus), it shows on the lit row and on the row whose menu is open; and that row stays lit while its menu is open. */
|
|
133
|
+
.o-picker-row-menu { flex: none; }
|
|
134
|
+
.o-picker-row-menu[data-shown="pointer"] { visibility: hidden; }
|
|
135
|
+
.o-picker .o-list-row:is([data-highlighted], [data-menu-open]) > .o-picker-row-menu[data-shown="pointer"] { visibility: visible; }
|
|
136
|
+
.o-picker .o-list-row[data-menu-open] { background-color: var(--list-highlight, var(--list-hl-grey, var(--vk-overlay-pressed))); }
|
|
137
|
+
/* Rows put in order: only a row marked data-row, in a Picker asked to order its rows. Held on a phone, no callout; lifted,
|
|
138
|
+
it rides over the rows as the Menu list's lifted row does, unclipped so its shadow shows (a computer's row is clipped to its smooth
|
|
139
|
+
corners), the phone's lines beside it gone while it is carried. */
|
|
140
|
+
.o-picker [data-row][data-drag-start] { -webkit-touch-callout: none; }
|
|
141
|
+
.o-picker [data-row][data-lifted] { position: relative; z-index: var(--vk-layer-popup); background-color: var(--vk-overlay); box-shadow: var(--vk-shadow-lg); }
|
|
142
|
+
.o-picker[data-picker-form="computer"] [data-row][data-lifted] { cursor: grabbing; clip-path: none; }
|
|
143
|
+
.o-picker .o-picker-row[data-row][data-lifted], .o-picker .o-picker-row[data-row][data-lifted] + .o-picker-row[data-row] { background-image: none; }
|
|
144
|
+
/* A sign before the name (a currency's €), in a column of its own so the names line up. */
|
|
145
|
+
.o-picker-sign { display: inline-block; min-width: calc(var(--vk-spacing) * 8); color: var(--vk-fg-subtle); font-variant-numeric: tabular-nums; }
|
|
146
|
+
.o-picker-mark { display: inline-flex; align-items: center; margin-right: calc(var(--vk-spacing) * 2.5); vertical-align: middle; }
|
|
147
|
+
/* On a phone the rows' text is a size up, so the column is too, the computer's at the phone's size: a three-letter code
|
|
148
|
+
(CHF) keeps the room before its name it has on a computer. */
|
|
149
|
+
.o-picker[data-picker-form="phone"] .o-picker-sign { min-width: calc(var(--vk-spacing) * 9); }
|
|
150
|
+
/* ── A level in (Attio's): ‹ at the search's start, in the magnifier's place, its words where they stood; the open level's
|
|
151
|
+
own row on top; its rows in a box of their own, indented 20, a thin line along their start, 8 in
|
|
152
|
+
from the rows' own start (a row's padding: 8 on a computer, 16 on a phone), so it stands where it stands on both; a row that leads
|
|
153
|
+
one level in ends in its count and ›. On a phone the same, in the same Sheet, ‹ at the bar's start ── */
|
|
154
|
+
/* Its 24 pulled in above and below to the magnifier's line, so the search never grows as it comes; still pressed whole. */
|
|
155
|
+
.o-picker-search > .o-picker-back { flex: none; margin: calc(var(--vk-spacing) * -1) calc(var(--vk-spacing) * -1) calc(var(--vk-spacing) * -1) calc(var(--vk-spacing) * -1.25); }
|
|
156
|
+
/* The level's own row stands unlit, lighting only under the pointer as a row does; on a phone it has no ground of its own. */
|
|
157
|
+
.o-list-row.o-picker-parent { cursor: default; }
|
|
158
|
+
@media (hover: hover) { .o-list-row.o-picker-parent:hover { background-color: var(--list-highlight, var(--list-hl-grey, var(--vk-overlay-pressed))); } }
|
|
159
|
+
.o-picker-row.o-picker-parent { cursor: default; }
|
|
160
|
+
.o-picker-level { --picker-level-pad: calc(var(--vk-spacing) * 2); position: relative; padding-left: calc(var(--vk-spacing) * 5); }
|
|
161
|
+
.o-picker-level::before { content: ""; position: absolute; top: var(--vk-spacing); bottom: var(--vk-spacing); left: calc(var(--picker-level-pad) + var(--vk-spacing) * 2); width: var(--vk-border-width); background-color: var(--vk-border-subtle); }
|
|
162
|
+
/* On a phone its rows stay the card's whole width, as a phone's rows are, so one pressed or lit lights edge to edge: the 20 in is each
|
|
163
|
+
row's own padding, its separator starting under its words; the line, drawn over them, wears the edge's colour, the subtle edge's being the
|
|
164
|
+
card's own ground there. */
|
|
165
|
+
.o-picker[data-picker-form="phone"] .o-picker-level { --picker-level-pad: calc(var(--vk-spacing) * 4); padding-left: 0; }
|
|
166
|
+
.o-picker[data-picker-form="phone"] .o-picker-level::before { background-color: var(--vk-border); }
|
|
167
|
+
.o-picker[data-picker-form="phone"] .o-picker-level > .o-picker-row { padding-left: calc(var(--vk-spacing) * 9); }
|
|
168
|
+
.o-picker[data-picker-form="phone"] .o-picker-level > .o-picker-row + .o-picker-row { background-size: calc(100% - var(--vk-spacing) * 9) var(--vk-border-width); background-position: calc(var(--vk-spacing) * 9) 0; }
|
|
169
|
+
.o-picker-bar > [data-back] { flex: none; margin-right: auto; }
|
|
170
|
+
.o-picker-opens { flex: none; display: flex; align-items: center; gap: calc(var(--vk-spacing) * 0.5); font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtlest); font-variant-numeric: tabular-nums; }
|
|
171
|
+
.o-picker-opens > svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); }
|
|
172
|
+
.o-picker[data-picker-form="phone"] .o-picker-opens { font-size: var(--vk-font-size-sm); }
|
|
173
|
+
/* A value's count: at its row's end, right before what says it is held, so the marks keep their column and the counts stand on
|
|
174
|
+
one edge beside them; read as a level's count is, its figures lined up down the list. */
|
|
175
|
+
.o-picker-row-count { flex: none; font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtlest); font-variant-numeric: tabular-nums; }
|
|
176
|
+
.o-picker[data-picker-form="phone"] .o-picker-row-count { font-size: var(--vk-font-size-sm); }
|
|
177
|
+
.o-picker[data-picker-form="phone"] .o-picker-opens > svg { width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); }
|
|
178
|
+
.o-picker-icon { flex: none; display: grid; place-items: center; width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); color: var(--vk-fg-subtle); }
|
|
179
|
+
.o-picker-icon > svg { width: 100%; height: 100%; }
|
|
180
|
+
.o-picker-action > .o-kbd, .o-picker-action > .o-keys { flex: none; }
|
|
181
|
+
|
|
182
|
+
/* ── What the list is doing: searching, nothing matches, couldn't search, nothing yet; loading more at its end ────── */
|
|
183
|
+
/* Centred (What the list is doing: Centred, Attio's), or at the start. */
|
|
184
|
+
.o-picker-message { display: flex; align-items: center; justify-content: center; gap: calc(var(--vk-spacing) * 2); padding: calc(var(--vk-spacing) * 3) calc(var(--vk-spacing) * 2); color: var(--vk-fg-subtle); text-align: center; }
|
|
185
|
+
.o-picker-message-text { flex: 0 1 auto; }
|
|
186
|
+
[data-picker-doing="start"] .o-picker-message { justify-content: flex-start; text-align: left; }
|
|
187
|
+
[data-picker-doing="start"] .o-picker-message-text { flex: 1; }
|
|
188
|
+
.o-picker-more { display: flex; align-items: center; justify-content: center; gap: calc(var(--vk-spacing) * 2); min-height: calc(var(--vk-spacing) * 8); font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtle); }
|
|
189
|
+
|
|
190
|
+
/* ── On a phone (rounds 3 and 4 of its sketch): the Selected card, one plain card of what can be picked 24 under it, rows of
|
|
191
|
+
56 (64 with a second line), a circle or, for several in Attio's look, a box at a row's end, and the bar floating at the foot of what scrolls ──────────────── */
|
|
192
|
+
.o-picker[data-picker-form="phone"] { min-height: var(--picker-room, auto); font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); }
|
|
193
|
+
.o-picker-phone { display: flex; flex-direction: column; outline: none; }
|
|
194
|
+
.o-picker-label { margin: calc(var(--vk-spacing) * 4) var(--vk-spacing) calc(var(--vk-spacing) * 2); font-size: var(--vk-font-size-sm); color: var(--vk-fg-subtle); }
|
|
195
|
+
.o-picker-card { overflow: hidden; border: var(--vk-border-width) solid var(--vk-border-subtle); border-radius: var(--vk-radius-xl); background-color: var(--vk-overlay-card); }
|
|
196
|
+
.o-picker-list { margin-top: calc(var(--vk-spacing) * 6); }
|
|
197
|
+
.o-picker-row { display: flex; align-items: center; gap: calc(var(--vk-spacing) * 3); box-sizing: border-box; min-height: calc(var(--vk-spacing) * 14); padding: 0 calc(var(--vk-spacing) * 4); cursor: pointer; outline: none; user-select: none; -webkit-tap-highlight-color: transparent; }
|
|
198
|
+
.o-picker-row:has(.o-list-line) { min-height: calc(var(--vk-spacing) * 16); }
|
|
199
|
+
.o-picker-row + .o-picker-row { background-image: linear-gradient(var(--vk-border-subtle), var(--vk-border-subtle)); background-size: calc(100% - var(--vk-spacing) * 4) var(--vk-border-width); background-position: calc(var(--vk-spacing) * 4) 0; background-repeat: no-repeat; }
|
|
200
|
+
/* A press shows; the keys' highlight shows only while something is typed in the search and it has focus (data-typed), the first
|
|
201
|
+
match Enter picks. With nothing typed Base UI lights the held row, the first in its order, so a list never opens, nor its search
|
|
202
|
+
takes a tap, looking pressed. */
|
|
203
|
+
.o-picker-row:not([data-disabled]):active, .o-picker[data-typed]:has(.o-input-control:focus) .o-picker-row[data-highlighted]:not([data-disabled]) { background-color: var(--vk-overlay-card-pressed); }
|
|
204
|
+
.o-picker-row[data-disabled] { color: var(--vk-fg-disabled); cursor: default; }
|
|
205
|
+
.o-picker-row[data-disabled] .o-list-line { color: var(--vk-fg-disabled); }
|
|
206
|
+
.o-picker-row .o-list-line { font-size: var(--vk-font-size-sm); }
|
|
207
|
+
/* The circle: filled when held, an empty ring when it could be, grey with an edge when the field can't be left empty. */
|
|
208
|
+
.o-picker-circle { flex: none; display: grid; place-items: center; width: calc(var(--vk-spacing) * 6); height: calc(var(--vk-spacing) * 6); border-radius: var(--vk-radius-full); background-color: var(--vk-brand); color: var(--vk-fg-inverse); }
|
|
209
|
+
.o-picker-circle > svg { width: calc(var(--vk-spacing) * 3.25); height: calc(var(--vk-spacing) * 3.25); }
|
|
210
|
+
.o-picker-circle-off { background-color: transparent; box-shadow: inset 0 0 0 calc(var(--vk-border-width) * 1.5) var(--vk-border-bold); }
|
|
211
|
+
.o-picker-circle-fixed { background-color: var(--vk-neutral); color: var(--vk-fg); box-shadow: inset 0 0 0 calc(var(--vk-border-width) * 1.5) var(--vk-border-bold); }
|
|
212
|
+
/* What the list is doing, in the list's place: centred words, and a button where there is something to do. */
|
|
213
|
+
.o-picker-note { display: flex; flex-direction: column; align-items: center; gap: calc(var(--vk-spacing) * 3); padding: calc(var(--vk-spacing) * 9) calc(var(--vk-spacing) * 4); text-align: center; color: var(--vk-fg-subtle); }
|
|
214
|
+
.o-picker-note b { color: var(--vk-fg); font-weight: var(--vk-font-weight-semibold); }
|
|
215
|
+
.o-picker-first { padding-top: calc(var(--vk-spacing) * 30); }
|
|
216
|
+
.o-picker[data-picker-form="phone"] .o-picker-more { min-height: calc(var(--vk-spacing) * 12); font-size: var(--vk-font-size-sm); }
|
|
217
|
+
/* The bar: the search and ⋯, or Create while what is typed matches nothing, at the foot of what scrolls, over a fade to the
|
|
218
|
+
ground; 8 over the padding the Sheet's body keeps under what it holds, which, while the search has focus, is the phone's
|
|
219
|
+
keyboard (sheet.css, --sheet-keyboard), so it stands 8 over the keyboard and the list ends above it. */
|
|
220
|
+
.o-picker-bar {
|
|
221
|
+
position: sticky; bottom: calc(-1 * var(--picker-under, 0px)); z-index: 1; display: flex; align-items: center; justify-content: flex-end; gap: calc(var(--vk-spacing) * 2.5);
|
|
222
|
+
margin-top: auto; margin-bottom: calc(-1 * var(--picker-under, 0px)); padding: calc(var(--vk-spacing) * 8) 0 calc(var(--vk-spacing) * 2 + var(--picker-under, 0px));
|
|
223
|
+
background-image: linear-gradient(to bottom, transparent, var(--vk-overlay) calc(var(--vk-spacing) * 8));
|
|
224
|
+
}
|
|
225
|
+
.o-picker-pill { flex: 1; }
|
|
226
|
+
/* ── A mark after a row's name (a private view's lock), quieter; and a phone's actions under the list (actionsUnder), each
|
|
227
|
+
the outlined Button across the list's width, 16 under it ── */
|
|
228
|
+
.o-picker-after { flex: none; display: inline-flex; align-items: center; margin-left: calc(var(--vk-spacing) * 1.5); color: var(--vk-fg-subtlest); vertical-align: middle; }
|
|
229
|
+
.o-picker-after > svg { width: calc(var(--vk-spacing) * 3.5); height: calc(var(--vk-spacing) * 3.5); }
|
|
230
|
+
.o-picker[data-picker-form="phone"] .o-picker-after > svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); }
|
|
231
|
+
.o-picker-under { display: grid; gap: calc(var(--vk-spacing) * 2); margin-top: calc(var(--vk-spacing) * 4); }
|
|
232
|
+
.o-picker-under > .o-button { width: 100%; }
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* ── On the phone the search's words are 16px, as the list's are, so iOS never zooms in ── */
|
|
236
|
+
@media (width < 640px) { .o-input-control.o-picker-input:where(:not([data-computer-host], [data-computer-host] *)) { font-size: var(--vk-font-size-base); } }
|
|
237
|
+
@container o-phone (width < 640px) { .o-input-control.o-picker-input { font-size: var(--vk-font-size-base); } }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const POPUP_LINE_TOKENS: readonly [{
|
|
2
|
+
readonly name: "--vk-border-danger";
|
|
3
|
+
readonly kind: "colour";
|
|
4
|
+
readonly outright: "--border-danger";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "--vk-border-subtle";
|
|
7
|
+
readonly kind: "colour";
|
|
8
|
+
readonly outright: "--border-subtle";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "--vk-fg-subtlest";
|
|
11
|
+
readonly kind: "colour";
|
|
12
|
+
readonly outright: "--text-subtlest";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "--vk-border-width";
|
|
15
|
+
readonly kind: "size";
|
|
16
|
+
readonly outright: "--border-width";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "--vk-spacing";
|
|
19
|
+
readonly kind: "size";
|
|
20
|
+
readonly outright: "--spacing";
|
|
21
|
+
}];
|
|
22
|
+
/** The popup line's own machinery: how far it reaches, its height, padding, gaps and its rule. */
|
|
23
|
+
export declare const POPUP_LINE_PRIVATE: readonly ["--popup-line-"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const POPUP_LINE_TOKENS = [
|
|
2
|
+
{ name: "--vk-border-danger", kind: "colour", outright: "--border-danger" },
|
|
3
|
+
{ name: "--vk-border-subtle", kind: "colour", outright: "--border-subtle" },
|
|
4
|
+
{ name: "--vk-fg-subtlest", kind: "colour", outright: "--text-subtlest" },
|
|
5
|
+
{ name: "--vk-border-width", kind: "size", outright: "--border-width" },
|
|
6
|
+
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
7
|
+
];
|
|
8
|
+
export const POPUP_LINE_PRIVATE = ["--popup-line-"];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* The line across a popup's top, at Attio's measures (from its select's and multi-select's search): 35 high with its rule, its first thing 12 in, 4 over what follows it, its icon 15 across in the quietest text colour,
|
|
2
|
+
at rest and in focus. It reaches the shell's edge by the shell's own padding (--popover-pad) less the edge's width, so the
|
|
3
|
+
edge still shows; a line under it; an icon or a control before what fills it, the kit's Input bare, or a back row's words.
|
|
4
|
+
Its height, inset, gaps and icon are its own, set by no place (popup-line.test.mjs holds it). What its holder decides
|
|
5
|
+
stays the holder's, by these, never by a copy of the rule:
|
|
6
|
+
--popup-line-bleed how far it reaches past what holds it: the Popover's padding less its edge unless said (the Select's list: 4)
|
|
7
|
+
--popup-line-more more reach, where what holds it pads more (the Compound editor's labelled boxes: 4)
|
|
8
|
+
--popup-line-pad-block its top and bottom padding: 0 unless said (the Picker's: 6, round its chips)
|
|
9
|
+
At the foot (data-at="foot", the Values editor's line to add one, in one of its looks) the same, mirrored, its line over it; the
|
|
10
|
+
Picker's foot, the list's own and no line across the top, alone sets --popup-line-height, -pad, -gap and -under (picker.css).
|
|
11
|
+
Inside a floating surface (the Popover, a list's panel) the line is drawn as the Menu's divider is:
|
|
12
|
+
its box and its reach stay, and its rule (::after, over its own border's room) stands in from each end as the list's Dividers
|
|
13
|
+
say, Inset from where a row's words start (its reach and a row's 8), Rows as wide as what it stands over (its reach), Full width
|
|
14
|
+
to the edge, inside it (none); and it wears its surface's --divider-colour, the edge's colour, border-subtle where there is
|
|
15
|
+
none (list.css, popover.css). Refused, it is the danger line whatever the surface.
|
|
16
|
+
Every value is a token (control tokens); the rules sit in the components layer, so a utility class still wins. */
|
|
17
|
+
@layer components {
|
|
18
|
+
.o-popup-line {
|
|
19
|
+
--popup-line-reach: var(--popup-line-bleed, calc(max(0px, calc(var(--popover-pad, 0px) - var(--vk-border-width))) + var(--popup-line-more, 0px)));
|
|
20
|
+
display: flex; align-items: center; gap: var(--popup-line-gap, calc(var(--vk-spacing) * 2)); box-sizing: border-box;
|
|
21
|
+
min-height: var(--popup-line-height, calc(var(--vk-spacing) * 8.75));
|
|
22
|
+
margin: calc(-1 * var(--popup-line-reach)) calc(-1 * var(--popup-line-reach)) var(--popup-line-under, var(--vk-spacing));
|
|
23
|
+
padding: var(--popup-line-pad-block, 0px) var(--popup-line-pad, calc(var(--vk-spacing) * 3));
|
|
24
|
+
--popup-line-colour: var(--vk-border-subtle); border-bottom: var(--vk-border-width) solid var(--popup-line-colour);
|
|
25
|
+
}
|
|
26
|
+
.o-popup-line[data-at="foot"] {
|
|
27
|
+
margin: var(--popup-line-under, var(--vk-spacing)) calc(-1 * var(--popup-line-reach)) calc(-1 * var(--popup-line-reach));
|
|
28
|
+
border-top: var(--vk-border-width) solid var(--popup-line-colour); border-bottom: 0;
|
|
29
|
+
}
|
|
30
|
+
.o-popup-line > svg { flex: none; width: calc(var(--vk-spacing) * 3.75); height: calc(var(--vk-spacing) * 3.75); color: var(--vk-fg-subtlest); }
|
|
31
|
+
/* In a floating surface: its rule drawn in from each end, in the surface's line colour. */
|
|
32
|
+
:is(.o-popover, .o-list) .o-popup-line {
|
|
33
|
+
--popup-line-colour: var(--divider-colour, var(--vk-border-subtle));
|
|
34
|
+
--popup-line-in: calc(var(--popup-line-reach) * var(--dividers-rows, 1) + var(--vk-spacing) * 2 * var(--dividers-words, 1));
|
|
35
|
+
position: relative; border-color: transparent;
|
|
36
|
+
}
|
|
37
|
+
:is(.o-popover, .o-list) .o-popup-line::after {
|
|
38
|
+
content: ""; position: absolute; left: var(--popup-line-in); right: var(--popup-line-in); bottom: calc(-1 * var(--vk-border-width)); height: var(--vk-border-width);
|
|
39
|
+
background-color: var(--popup-line-colour); pointer-events: none;
|
|
40
|
+
}
|
|
41
|
+
:is(.o-popover, .o-list) .o-popup-line[data-at="foot"]::after { top: calc(-1 * var(--vk-border-width)); bottom: auto; }
|
|
42
|
+
/* Refused, its line turns red; at the foot it has no line under it, and the Values editor's refused line draws its own. */
|
|
43
|
+
.o-popup-line[data-bad]:not([data-at="foot"]) { --popup-line-colour: var(--vk-border-danger); }
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const fold: (s: string) => string;
|
|
2
|
+
/** What the browser filled into a Select's form, matched to a row by its value or its name, folded as the search folds;
|
|
3
|
+
* nothing for words that match no row. Nothing here reads the page, so a plain test reads it as it is. */
|
|
4
|
+
export declare function filledMatch<T extends {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}>(items: T[], filled: string): T | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function chipsThatFit({ chips, more, words, gap, row, least, typed }) {
|
|
2
|
+
const room = row - Math.max(least, typed ? words + 4 : 0) - gap;
|
|
3
|
+
if (chips.reduce((a, w) => a + w + gap, 0) <= room)
|
|
4
|
+
return chips.length;
|
|
5
|
+
let used = 0, k = 0;
|
|
6
|
+
while (k < chips.length && used + chips[k] + gap + more <= room) {
|
|
7
|
+
used += chips[k] + gap;
|
|
8
|
+
k++;
|
|
9
|
+
}
|
|
10
|
+
return typed ? k : Math.max(1, k);
|
|
11
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type FieldError } from "../field/field.js";
|
|
3
|
+
import { type PickerItem } from "../picker/picker.js";
|
|
4
|
+
/** One choice: its value and label, an optional line that says what it means, a mark before it (a
|
|
5
|
+
* stage's glyph, a person's avatar; a bare Avatar is drawn again at 16 in a typed field's chip), "you" after the person themself, and the group it sits under. */
|
|
6
|
+
export interface SelectItem {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
line?: string;
|
|
10
|
+
mark?: React.ReactNode;
|
|
11
|
+
you?: boolean;
|
|
12
|
+
group?: string;
|
|
13
|
+
/** It can't be picked: greyed, passed over by the keys. */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** A line above it, setting it apart from the rows before. */
|
|
16
|
+
divider?: boolean;
|
|
17
|
+
/** The choices it leads to one level in (a deal's Company: its Name, Industry, Region): the Picker opens them in place and never
|
|
18
|
+
* picks it; one picked there is named by its path, "Company › Region". */
|
|
19
|
+
level?: SelectItem[];
|
|
20
|
+
}
|
|
21
|
+
/** What every Select takes, with its own list or alone. */
|
|
22
|
+
interface SelectFieldProps {
|
|
23
|
+
/** What the field holds, above it. Without one, give it an aria-label. */
|
|
24
|
+
label?: React.ReactNode;
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
/** Its height, as the Input's and the Button's: 24 and 28px in dense rows (24 with 12px words), 32 in
|
|
27
|
+
* toolbars, 36 (md) beside other fields, 44 on the phone. */
|
|
28
|
+
size?: "2xs" | "xs" | "sm" | "md" | "lg";
|
|
29
|
+
/** Whether its list is open, set from outside. */
|
|
30
|
+
open?: boolean;
|
|
31
|
+
onOpenChange?: (open: boolean) => void;
|
|
32
|
+
/** Under the field: what it is for, or why it is off. */
|
|
33
|
+
note?: React.ReactNode;
|
|
34
|
+
/** Under the field in place of the note: the fix; several, as a list, each once. */
|
|
35
|
+
error?: FieldError;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
"aria-label"?: string;
|
|
38
|
+
className?: string;
|
|
39
|
+
/** The field drawn as under the pointer or in focus, as a page that shows it draws it. */
|
|
40
|
+
"data-force"?: "hover" | "focus";
|
|
41
|
+
}
|
|
42
|
+
/** The field alone: it owns no list. A press, or ↓ or ↑, tells its holder, which opens what it owns (a phone's date wheels, a step
|
|
43
|
+
* of a Sheet); while `open` it is drawn in the Select's own open state; its arrow down unless said. It shows what it holds, or
|
|
44
|
+
* its placeholder. Nothing else. */
|
|
45
|
+
export interface SelectAloneProps extends SelectFieldProps {
|
|
46
|
+
/** What it opens, for a screen reader (its aria-haspopup): a list, or a dialog (wheels, a calendar). */
|
|
47
|
+
opens: "listbox" | "dialog";
|
|
48
|
+
/** What it holds, as its holder words it; nothing shows the placeholder. A string is drawn as the Select's value; anything else as given. */
|
|
49
|
+
shown?: React.ReactNode;
|
|
50
|
+
/** Its arrow: down unless said; right, for a step it opens; none. */
|
|
51
|
+
arrow?: "down" | "right" | "none";
|
|
52
|
+
items?: never;
|
|
53
|
+
}
|
|
54
|
+
/** A Select with its own list, or its field alone (`opens`). */
|
|
55
|
+
export type SelectProps = SelectListProps | SelectAloneProps;
|
|
56
|
+
export interface SelectListProps extends SelectFieldProps {
|
|
57
|
+
opens?: never;
|
|
58
|
+
items: SelectItem[];
|
|
59
|
+
/** Several at once: a checkbox on each row, the chosen ones in the field as Option chips; the list stays open. */
|
|
60
|
+
multiple?: boolean;
|
|
61
|
+
defaultValue?: string | string[] | null;
|
|
62
|
+
/** The value set from outside: the field shows it, and a pick only asks for it through onValueChange. */
|
|
63
|
+
value?: string | string[] | null;
|
|
64
|
+
onValueChange?: (value: string | string[] | null) => void;
|
|
65
|
+
/** Its name in a form, which then sends its value (several values under one name); `required` stops the
|
|
66
|
+
* form until one is picked. */
|
|
67
|
+
name?: string;
|
|
68
|
+
required?: boolean;
|
|
69
|
+
/** What the value can't be changed from: its list still opens and can be read, and a press on a row changes nothing. */
|
|
70
|
+
readOnly?: boolean;
|
|
71
|
+
/** The browser's autofill hint for its form value ("country-name"), on the box's own form input. */
|
|
72
|
+
autoComplete?: string;
|
|
73
|
+
/** Where its list opens: under the field by default, or above; at its start, centre or end. */
|
|
74
|
+
side?: "bottom" | "top";
|
|
75
|
+
align?: "start" | "center" | "end";
|
|
76
|
+
/** How wide its list is, on a computer: its box's (the default), a long name ending in "…"; or as wide as its widest row needs,
|
|
77
|
+
* never narrower than its box nor 192 (unless the room on screen is less), never past the room on screen or
|
|
78
|
+
* the 288 a Picker stands in a Popover, a longer name then ending in "…", its start edge on its box's (the filter
|
|
79
|
+
* editor's and the sort editor's boxes). A phone's list stands in the Sheet either way. */
|
|
80
|
+
listWidth?: "box" | "rows";
|
|
81
|
+
/** Choices shown as Option chips, in the list and in the field, as an option field's are. */
|
|
82
|
+
chips?: boolean;
|
|
83
|
+
/** A row at the top that clears the field ("No owner"), while it has a value. */
|
|
84
|
+
clear?: string;
|
|
85
|
+
/** A search on top of the list, with what it says before anything is typed ("Find someone"). */
|
|
86
|
+
search?: string;
|
|
87
|
+
/** Where its search is: on top of the list (the default, the field a button you press), or the field
|
|
88
|
+
* itself, typed straight into, its placeholder what it says ("Type a country"). Typed into, several
|
|
89
|
+
* chosen sit in the field as chips with their own ×, and from 32px up a × clears it. */
|
|
90
|
+
searchIn?: "list" | "field";
|
|
91
|
+
/** What's typed, handed out as it changes: the app looks up the matches (on its server) and gives them
|
|
92
|
+
* as items, which the list then shows as they are. */
|
|
93
|
+
onSearch?: (typed: string) => void;
|
|
94
|
+
/** The lookup is under way: the list says so. */
|
|
95
|
+
loading?: boolean;
|
|
96
|
+
/** What the list says when the search finds nothing ("No one by that name."). */
|
|
97
|
+
none?: string;
|
|
98
|
+
/** With a search: "Create “<what was typed>”" at the bottom when nothing matches exactly. */
|
|
99
|
+
create?: boolean;
|
|
100
|
+
/** An action in the list's foot ("New industry"), which puts the cursor in the search to name one. */
|
|
101
|
+
footer?: string;
|
|
102
|
+
/** A list with nothing yet: what it says, its one button, and the name the first one gets. */
|
|
103
|
+
empty?: {
|
|
104
|
+
text: string;
|
|
105
|
+
action: string;
|
|
106
|
+
first: string;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** Pick one thing, or several, from a list: the Input's own field with a chevron, and its list; or the field alone,
|
|
110
|
+
* opening a list it doesn't own. */
|
|
111
|
+
export declare function Select(props: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
112
|
+
/** The Select's rows as the Picker's: a mark before the name, or the name as an Option chip; its line, "you", its group,
|
|
113
|
+
* whether it can be picked, a line above it, and its level, each one in it handed on the same way, as they are. */
|
|
114
|
+
export declare const toPickerItems: (items: SelectItem[], chips?: boolean) => PickerItem[];
|
|
115
|
+
export interface SelectShownProps {
|
|
116
|
+
items: SelectItem[];
|
|
117
|
+
defaultValue?: string | string[] | null;
|
|
118
|
+
multiple?: boolean;
|
|
119
|
+
chips?: boolean;
|
|
120
|
+
/** A search on top, as the list has it. */
|
|
121
|
+
search?: string;
|
|
122
|
+
none?: string;
|
|
123
|
+
placeholder?: string;
|
|
124
|
+
"aria-label": string;
|
|
125
|
+
}
|
|
126
|
+
/** The field with its list open under it, standing in the page: for a page that shows what the list looks like. The list is the
|
|
127
|
+
* Picker standing in the list's panel, wearing the list's options and the Picker's. Picking still changes the field; it
|
|
128
|
+
* never floats or closes. It stands lit as a list opens: its held row at rest, the row under the pointer while there is one, a
|
|
129
|
+
* screen with a pointer only, so the list's Highlight and its intensity show on it as they are picked. */
|
|
130
|
+
export declare function SelectShown({ items, defaultValue, multiple, chips, search, none, placeholder, "aria-label": name }: SelectShownProps): import("react/jsx-runtime").JSX.Element;
|
|
131
|
+
export {};
|