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.
Files changed (82) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/fields/dist/creatable.d.ts +9 -5
  3. package/fields/dist/creatable.js +8 -1
  4. package/fields/dist/messages.d.ts +19 -1
  5. package/fields/dist/messages.js +75 -0
  6. package/fields/dist/registry.js +4 -7
  7. package/fields/dist/types.d.ts +4 -2
  8. package/fields/dist/zod.d.ts +58 -0
  9. package/fields/dist/zod.js +430 -2
  10. package/fields/docs/guides/checking-definitions.md +6 -1
  11. package/fields/docs/guides/field-types.md +5 -1
  12. package/fields/docs/reference/definitions.md +1 -2
  13. package/fields/docs/reference/types.md +2 -1
  14. package/fields/skills/viewkit/SKILL.md +2 -2
  15. package/package.json +1 -1
  16. package/views/dist/controls/avatar/avatar.d.ts +58 -0
  17. package/views/dist/controls/avatar/avatar.js +54 -0
  18. package/views/dist/controls/avatar/looks.d.ts +4 -0
  19. package/views/dist/controls/avatar/looks.js +5 -0
  20. package/views/dist/controls/avatar/tokens.d.ts +131 -0
  21. package/views/dist/controls/avatar/tokens.js +35 -0
  22. package/views/dist/controls/avatar.css +163 -0
  23. package/views/dist/controls/controls.d.ts +2 -0
  24. package/views/dist/controls/controls.js +2 -0
  25. package/views/dist/controls/index.d.ts +12 -0
  26. package/views/dist/controls/index.js +12 -0
  27. package/views/dist/controls/internal/phone.d.ts +9 -0
  28. package/views/dist/controls/internal/phone.js +15 -0
  29. package/views/dist/controls/internal/read-token.d.ts +2 -1
  30. package/views/dist/controls/internal/read-token.js +1 -1
  31. package/views/dist/controls/internal/scroll.d.ts +38 -0
  32. package/views/dist/controls/internal/scroll.js +126 -0
  33. package/views/dist/controls/list/looks.d.ts +4 -0
  34. package/views/dist/controls/list/looks.js +12 -0
  35. package/views/dist/controls/list.css +17 -13
  36. package/views/dist/controls/menu/map-menu.d.ts +11 -0
  37. package/views/dist/controls/menu/map-menu.js +47 -0
  38. package/views/dist/controls/menu/menu.d.ts +75 -0
  39. package/views/dist/controls/menu/menu.js +105 -0
  40. package/views/dist/controls/menu/tokens.d.ts +23 -0
  41. package/views/dist/controls/menu/tokens.js +8 -0
  42. package/views/dist/controls/menu-list/looks.d.ts +5 -1
  43. package/views/dist/controls/menu-list/looks.js +6 -4
  44. package/views/dist/controls/menu-list/menu-list.js +3 -1
  45. package/views/dist/controls/menu-list.css +39 -31
  46. package/views/dist/controls/menu.css +25 -0
  47. package/views/dist/controls/picker/looks.d.ts +19 -0
  48. package/views/dist/controls/picker/looks.js +32 -0
  49. package/views/dist/controls/picker/picker.d.ts +153 -0
  50. package/views/dist/controls/picker/picker.js +773 -0
  51. package/views/dist/controls/picker/rows.d.ts +129 -0
  52. package/views/dist/controls/picker/rows.js +90 -0
  53. package/views/dist/controls/picker/tokens.d.ts +147 -0
  54. package/views/dist/controls/picker/tokens.js +39 -0
  55. package/views/dist/controls/picker.css +237 -0
  56. package/views/dist/controls/popup-line/tokens.d.ts +23 -0
  57. package/views/dist/controls/popup-line/tokens.js +8 -0
  58. package/views/dist/controls/popup-line.css +44 -0
  59. package/views/dist/controls/select/filled.d.ts +7 -0
  60. package/views/dist/controls/select/filled.js +5 -0
  61. package/views/dist/controls/select/fit.d.ts +9 -0
  62. package/views/dist/controls/select/fit.js +11 -0
  63. package/views/dist/controls/select/select.d.ts +131 -0
  64. package/views/dist/controls/select/select.js +227 -0
  65. package/views/dist/controls/select/side.d.ts +3 -0
  66. package/views/dist/controls/select/side.js +4 -0
  67. package/views/dist/controls/select/tokens.d.ts +27 -0
  68. package/views/dist/controls/select/tokens.js +9 -0
  69. package/views/dist/controls/select.css +91 -0
  70. package/views/dist/controls/tokens.js +10 -0
  71. package/views/dist/looks/index.d.ts +4 -0
  72. package/views/dist/looks/index.js +4 -0
  73. package/views/dist/looks/pieces.js +6 -0
  74. package/views/dist/styles.css +586 -62
  75. package/views/dist/styles.unlayered.css +586 -62
  76. package/views/docs/controls/avatar.md +38 -0
  77. package/views/docs/controls/menu.md +11 -0
  78. package/views/docs/controls/picker.md +42 -0
  79. package/views/docs/controls/popup-line.md +11 -0
  80. package/views/docs/controls/select.md +12 -0
  81. package/views/docs/reference/controls.md +86 -0
  82. package/views/docs/reference/looks.md +8 -0
@@ -12,6 +12,14 @@
12
12
 
13
13
  A fifth, data-menu-list-close (hidden · shown), is read by the Menu, not here: a Close row over its rows.
14
14
 
15
+ Nothing set draws My preset's: Words, rows 56 high, corners 2xl, lines full width. Each rule keyed on one of those values has a
16
+ twin on the same subject, :not([data-menu-list-<option>] *), at the same weight, so a frame that sets the option turns it off;
17
+ the bare rules draw the rest (Card, Inset, 52, xl). The nearest frame wins: each rule keyed on a value stands down inside a
18
+ frame of another value set within it, by a :where() of no weight, so a piece that pins its own rows (Customize's settings, a
19
+ stack's people: MENU_LIST_CARD_FRAME) keeps them whatever the app picks round it. A sheet's rules ask both of the list it
20
+ holds. The guard reads two frames deep: a frame of the outer value under one of another under one of that value again falls
21
+ back to the bare rules, and a frame worn inside a sheet changes its rows, never the sheet's own ground.
22
+
15
23
  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
24
 
17
25
  The rules sit in the components layer, so a utility class still wins. */
@@ -21,10 +29,10 @@
21
29
  --menu-list-row: calc(var(--vk-spacing) * 13); --menu-list-corners: var(--vk-radius-xl); --menu-list-inset: calc(var(--vk-spacing) * 4);
22
30
  display: grid; gap: calc(var(--vk-spacing) * 3); min-width: 0;
23
31
  }
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); }
32
+ [data-menu-list-height="48"] .o-menu-list:where(:not([data-menu-list-height="48"] [data-menu-list-height]:not([data-menu-list-height="48"]) *)) { --menu-list-row: calc(var(--vk-spacing) * 12); }
33
+ [data-menu-list-height="56"] .o-menu-list:where(:not([data-menu-list-height="56"] [data-menu-list-height]:not([data-menu-list-height="56"]) *)), .o-menu-list:not([data-menu-list-height] *) { --menu-list-row: calc(var(--vk-spacing) * 14); }
34
+ [data-menu-list-corners="lg"] .o-menu-list:where(:not([data-menu-list-corners="lg"] [data-menu-list-corners]:not([data-menu-list-corners="lg"]) *)) { --menu-list-corners: var(--vk-radius-lg); }
35
+ [data-menu-list-corners="2xl"] .o-menu-list:where(:not([data-menu-list-corners="2xl"] [data-menu-list-corners]:not([data-menu-list-corners="2xl"]) *)), .o-menu-list:not([data-menu-list-corners] *) { --menu-list-corners: var(--vk-radius-2xl); }
28
36
 
29
37
  /* ── A section: rows that belong together, on a card ─────────────────────────────────────────────────────────────── */
30
38
  .o-menu-list-section { display: grid; min-width: 0; overflow: hidden; border-radius: var(--menu-list-corners); background-color: var(--vk-overlay-card); }
@@ -35,10 +43,10 @@
35
43
  as they are, a line under it, as a phone's action sheet holds its title. ─────────────────────────────────────────────────── */
36
44
  .o-menu-list-group { display: grid; gap: calc(var(--vk-spacing) * 1.5); min-width: 0; }
37
45
  .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; }
46
+ [data-menu-list-rows="plain"] .o-menu-list-group > .o-list-heading:where(:not([data-menu-list-rows="plain"] [data-menu-list-rows]:not([data-menu-list-rows="plain"]) *)) { padding-inline: calc(var(--vk-spacing) * 2); }
47
+ [data-menu-list-rows="words"] .o-menu-list-group:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *)), .o-menu-list-group:not([data-menu-list-rows] *) { gap: 0; overflow: hidden; border-radius: var(--vk-radius-2xl); background-color: var(--vk-overlay); box-shadow: var(--vk-shadow-2xl); }
48
+ [data-menu-list-rows="words"] .o-menu-list-group > .o-list-heading:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *)), .o-menu-list-group > .o-list-heading:not([data-menu-list-rows] *) { padding: calc(var(--vk-spacing) * 3) calc(var(--vk-spacing) * 4); border-bottom: var(--vk-border-width) solid var(--vk-border); text-align: center; }
49
+ [data-menu-list-rows="words"] .o-menu-list-group > .o-menu-list-section:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *)), .o-menu-list-group > .o-menu-list-section:not([data-menu-list-rows] *) { border-radius: 0; box-shadow: none; }
42
50
 
43
51
  /* ── A row: an icon, its name, and on its right a value, an arrow, a tick or a switch ────────────────────────────── */
44
52
  .o-menu-list-row {
@@ -99,36 +107,36 @@
99
107
  .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
108
 
101
109
  /* Its lines the card's whole width, or none. */
102
- [data-menu-list-lines="none"] .o-menu-list-row::before { display: none; }
110
+ [data-menu-list-lines="none"] .o-menu-list-row:where(:not([data-menu-list-lines="none"] [data-menu-list-lines]:not([data-menu-list-lines="none"]) *))::before { display: none; }
103
111
 
104
112
  /* 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); }
113
+ [data-menu-list-rows="plain"] .o-menu-list-section:where(:not([data-menu-list-rows="plain"] [data-menu-list-rows]:not([data-menu-list-rows="plain"]) *)) { margin-inline: calc(var(--vk-spacing) * -2); overflow: visible; border-radius: 0; background-color: transparent; }
114
+ [data-menu-list-rows="plain"] :where(.o-menu-list) .o-menu-list-row:where(:not([data-menu-list-rows="plain"] [data-menu-list-rows]:not([data-menu-list-rows="plain"]) *)) { border-radius: var(--vk-radius-lg); }
115
+ [data-menu-list-rows="plain"] :where(.o-menu-list) .o-menu-list-row:active:not(:disabled, [data-disabled]):where(:not([data-menu-list-rows="plain"] [data-menu-list-rows]:not([data-menu-list-rows="plain"]) *)) { background-color: var(--vk-overlay-pressed); }
108
116
 
109
117
  /* 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); }
118
+ [data-menu-list-rows="joined"] .o-menu-list-section:where(:not([data-menu-list-rows="joined"] [data-menu-list-rows]:not([data-menu-list-rows="joined"]) *)) { gap: calc(var(--vk-spacing) * 0.75); overflow: visible; border-radius: 0; background-color: transparent; }
119
+ [data-menu-list-rows="joined"] :where(.o-menu-list) .o-menu-list-row:where(:not([data-menu-list-rows="joined"] [data-menu-list-rows]:not([data-menu-list-rows="joined"]) *)) { border-radius: var(--vk-radius-sm); background-color: var(--vk-overlay-card); }
120
+ [data-menu-list-rows="joined"] :where(.o-menu-list) .o-menu-list-row:first-child:where(:not([data-menu-list-rows="joined"] [data-menu-list-rows]:not([data-menu-list-rows="joined"]) *)) { border-start-start-radius: var(--menu-list-corners); border-start-end-radius: var(--menu-list-corners); }
121
+ [data-menu-list-rows="joined"] :where(.o-menu-list) .o-menu-list-row:last-child:where(:not([data-menu-list-rows="joined"] [data-menu-list-rows]:not([data-menu-list-rows="joined"]) *)) { border-end-start-radius: var(--menu-list-corners); border-end-end-radius: var(--menu-list-corners); }
122
+ [data-menu-list-rows="joined"] :where(.o-menu-list) .o-menu-list-row:where(:not([data-menu-list-rows="joined"] [data-menu-list-rows]:not([data-menu-list-rows="joined"]) *))::before { display: none; }
123
+ [data-menu-list-rows="joined"] :where(.o-menu-list) .o-menu-list-row:active:not(:disabled, [data-disabled]):where(:not([data-menu-list-rows="joined"] [data-menu-list-rows]:not([data-menu-list-rows="joined"]) *)) { background-color: var(--vk-overlay-card-pressed); }
116
124
 
117
125
  /* 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
126
  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; }
127
+ [data-menu-list-rows="words"] .o-menu-list:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *)), .o-menu-list:not([data-menu-list-rows] *) { gap: calc(var(--vk-spacing) * 2); }
128
+ [data-menu-list-rows="words"] .o-menu-list-section:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *)), .o-menu-list-section:not([data-menu-list-rows] *) { border-radius: var(--vk-radius-2xl); background-color: var(--vk-overlay); box-shadow: var(--vk-shadow-2xl); }
129
+ [data-menu-list-rows="words"] :where(.o-menu-list) .o-menu-list-row:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *)), :where(.o-menu-list) .o-menu-list-row:not([data-menu-list-rows] *) { justify-content: center; text-align: center; font-weight: var(--vk-font-weight-medium); }
130
+ [data-menu-list-rows="words"] :where(.o-menu-list) .o-menu-list-row:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *))::before, :where(.o-menu-list) .o-menu-list-row:not([data-menu-list-rows] *)::before { background-color: var(--vk-border); }
131
+ [data-menu-list-rows="words"] :where(.o-menu-list) .o-menu-list-row:active:not(:disabled, [data-disabled]):where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *)), :where(.o-menu-list) .o-menu-list-row:active:not(:disabled, [data-disabled]):not([data-menu-list-rows] *) { background-color: var(--vk-overlay-pressed); }
132
+ [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):where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([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):not([data-menu-list-rows] *) { display: none; }
133
+ [data-menu-list-rows="words"] :where(.o-menu-list) .o-menu-list-name:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *)), :where(.o-menu-list) .o-menu-list-name:not([data-menu-list-rows] *) { flex: none; }
134
+ [data-menu-list-rows="words"] .o-sheet.o-sheet:has(.o-menu-list:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *))), .o-sheet.o-sheet:has(.o-menu-list:not([data-menu-list-rows] *)) { background-color: transparent; box-shadow: none; }
135
+ [data-menu-list-rows="words"] .o-sheet.o-sheet:has(.o-menu-list:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *))) > .o-sheet-cut, .o-sheet.o-sheet:has(.o-menu-list:not([data-menu-list-rows] *)) > .o-sheet-cut { background-color: transparent; clip-path: none; overflow: visible; }
136
+ [data-menu-list-rows="words"] .o-sheet:has(.o-menu-list:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *))) .o-sheet-handle, .o-sheet:has(.o-menu-list:not([data-menu-list-rows] *)) .o-sheet-handle { display: none; }
137
+ [data-menu-list-rows="words"] .o-sheet:has(.o-menu-list:where(:not([data-menu-list-rows="words"] [data-menu-list-rows]:not([data-menu-list-rows="words"]) *))) .o-sheet-body, .o-sheet:has(.o-menu-list:not([data-menu-list-rows] *)) .o-sheet-body { padding: 0 0 max(calc(var(--vk-spacing) * 2), var(--sheet-home)); overflow: visible; }
130
138
 
131
- [data-menu-list-lines="full"] .o-menu-list-row { --menu-list-line: 0px; }
139
+ [data-menu-list-lines="full"] .o-menu-list-row:where(:not([data-menu-list-lines="full"] [data-menu-list-lines]:not([data-menu-list-lines="full"]) *)), .o-menu-list-row:not([data-menu-list-lines] *) { --menu-list-line: 0px; }
132
140
 
133
141
  /* ── The tiles: the few done most, side by side over its rows ────────────────────────────────────────────────────── */
134
142
  .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; }
@@ -213,7 +221,7 @@
213
221
  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
222
  .o-menu-pair { padding-right: calc(var(--vk-spacing) * 52); }
215
223
  .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)); }
224
+ .o-menu-subwrap > .o-menu-sub { position: absolute; z-index: 2; top: calc(-1 * var(--list-pad, calc(var(--vk-spacing) * 1.5)) - var(--vk-border-width)); left: calc(100% + var(--list-pad, calc(var(--vk-spacing) * 1.5))); }
217
225
 
218
226
  /* ── What scrolls in a menu's panel (MenuScroll): its rows, alone, when the panel is taller than the room on screen. ── */
219
227
  .o-menu-list-scroll { display: grid; min-height: 0; overflow-y: auto; overscroll-behavior: contain; outline: none; }
@@ -0,0 +1,25 @@
1
+ /* The Menu. Every value it draws with is a
2
+ token (control tokens); this file only says which token the menu's own parts take: its panel, its catcher of presses outside it and
3
+ its ⋯. The panel and the rows are list.css; a row's own parts are the Menu list's (menu-list.css).
4
+
5
+ The rules sit in the components layer, so a utility class on a menu still wins. */
6
+ @layer components {
7
+
8
+ /* ── Its catcher of presses outside it: Base UI draws it unnamed beside the panel, in the menu's own portal. It stands on
9
+ the popup layer under the panel, so a menu opened over a drawer-layer overlay (a Sheet, a page's side panel on a phone)
10
+ takes a press on that overlay's dim and closes alone. ─────────────────────────────────────────────────── */
11
+ .o-menu-portal > [role="presentation"] { z-index: var(--vk-layer-popup); }
12
+
13
+ /* ── The panel: it fits its widest row, 208px to 320px; its shadow, edge, corners and padding the list's options (list.css) ── */
14
+ .o-list.o-menu { width: max-content; min-width: calc(var(--vk-spacing) * 52); max-width: calc(var(--vk-spacing) * 80); }
15
+ /* Never taller than the room on screen: its rows, which alone scroll (MenuScroll, menu-list.css), stand in the panel's
16
+ padding, the kit's scrollbar over them; the panel and its edge stay still. */
17
+ .o-list.o-menu { max-height: var(--available-height); grid-template-rows: minmax(0, 1fr); }
18
+
19
+ /* ── The ⋯ button: under the pointer and while its menu is open, the neutral fill and the text colour ─ */
20
+ .o-button.o-menu-dots { color: var(--vk-fg-subtle); }
21
+ /* A hover only on a screen with a pointer (iOS keeps :hover on what was last tapped); a press and the forced state stay out. */
22
+ .o-button.o-menu-dots:is([data-popup-open], [data-force="hover"], [data-force="open"]) { --button-ground: var(--vk-neutral); color: var(--vk-fg); }
23
+ @media (hover: hover) { .o-button.o-menu-dots:hover { --button-ground: var(--vk-neutral); color: var(--vk-fg); } }
24
+
25
+ }
@@ -0,0 +1,19 @@
1
+ import type { PieceLooks } from "../../looks/looks.js";
2
+ export type PickerOptionId = "search" | "picked" | "mark" | "line" | "create" | "doing" | "heading" | "kind" | "face";
3
+ /** The Picker's options and looks. */
4
+ export declare const PICKER_LOOKS: PieceLooks<PickerOptionId>;
5
+ /** What the Picker's code reads of its options; What the list is doing is its stylesheet's alone. */
6
+ export type PickerWorn = {
7
+ search: "always" | "needed";
8
+ picked: "first" | "count" | "chips";
9
+ mark: "check" | "tick";
10
+ line: "beside" | "below";
11
+ create: "apart" | "last";
12
+ heading: "shown" | "hidden";
13
+ kind: "badge" | "line" | "end" | "none";
14
+ face: "20" | "24" | "32";
15
+ };
16
+ /** The data attributes pickerWornOf reads, for an observer that reads them again as an app's picks change. */
17
+ export declare const pickerRead: string[];
18
+ /** The options worn around `el`, each read off the nearest frame that sets it; outside any frame, the defaults (Attio's). */
19
+ export declare function pickerWornOf(el: Element | null): PickerWorn;
@@ -0,0 +1,32 @@
1
+ const options = [
2
+ { id: "search", name: "Search", def: "always", values: [{ id: "always", name: "Always" }, { id: "needed", name: "When needed" }] },
3
+ { id: "picked", name: "What is picked", device: "desktop", def: "first", values: [{ id: "first", name: "Listed first" }, { id: "count", name: "Count" }, { id: "chips", name: "Chips" }] },
4
+ { id: "mark", name: "Held", def: "check", values: [{ id: "check", name: "Check" }, { id: "tick", name: "Tick" }] },
5
+ { id: "line", name: "Second line", def: "beside", values: [{ id: "beside", name: "Beside" }, { id: "below", name: "Below" }] },
6
+ { id: "create", name: "Create", device: "desktop", def: "apart", values: [{ id: "apart", name: "Below a line" }, { id: "last", name: "Last row" }] },
7
+ { id: "doing", name: "What the list is doing", device: "desktop", def: "centred", values: [{ id: "centred", name: "Centred" }, { id: "start", name: "At the start" }] },
8
+ { id: "heading", name: "Actions heading", device: "desktop", def: "hidden", values: [{ id: "shown", name: "Shown" }, { id: "hidden", name: "Hidden" }] },
9
+ { id: "kind", name: "Kind", def: "badge", values: [{ id: "badge", name: "Badge" }, { id: "line", name: "Second line" }, { id: "end", name: "At the end" }, { id: "none", name: "None" }] },
10
+ { id: "face", name: "Face size", device: "desktop", def: "32", values: [{ id: "20", name: "20" }, { id: "24", name: "24" }, { id: "32", name: "32" }] },
11
+ ];
12
+ const defs = Object.fromEntries(options.map((o) => [o.id, o.def]));
13
+ export const PICKER_LOOKS = {
14
+ id: "picker",
15
+ name: "Picker",
16
+ options,
17
+ looks: [
18
+ { id: "attio", name: "Attio", picks: { ...defs } },
19
+ { id: "mihai", name: "Mihai's", picks: { search: "needed", picked: "count", mark: "tick", line: "below", create: "last", doing: "start", heading: "shown", kind: "end", face: "32" } },
20
+ ],
21
+ };
22
+ const READ = ["search", "picked", "mark", "line", "create", "heading", "kind", "face"];
23
+ export const pickerRead = READ.map((id) => `data-picker-${id}`);
24
+ export function pickerWornOf(el) {
25
+ const worn = {};
26
+ for (const id of READ) {
27
+ const option = options.find((o) => o.id === id);
28
+ const v = el?.closest(`[data-picker-${id}]`)?.getAttribute(`data-picker-${id}`);
29
+ worn[id] = v && option.values.some((x) => x.id === v) ? v : option.def;
30
+ }
31
+ return worn;
32
+ }
@@ -0,0 +1,153 @@
1
+ import * as React from "react";
2
+ import { type SheetHeadProps } from "../sheet/bottom-sheet.js";
3
+ import { type PickerItem } from "./rows.js";
4
+ export type { PickerItem, PickerAs } from "./rows.js";
5
+ export { openLevels } from "./rows.js";
6
+ /** What can be done from the list, not picked: its icon, its name, its keys. */
7
+ export interface PickerAction {
8
+ id: string;
9
+ label: string;
10
+ icon: React.ReactNode;
11
+ keys?: string[];
12
+ onSelect: () => void;
13
+ }
14
+ export type PickerDoing = "searching" | "failed";
15
+ export interface PickerProps {
16
+ /** The field's name: the Sheet's title, and the list's name to a screen reader. */
17
+ label: string;
18
+ items: PickerItem[];
19
+ multiple?: boolean;
20
+ /** What the field holds. */
21
+ value: string | string[] | null;
22
+ /** On a computer, a pick (one) or each change (several); on a phone, a tap (one) or ✓ (several). */
23
+ onValueChange: (value: string | string[] | null) => void;
24
+ /** The job is done and the shell closes: a pick of one; ✓ or Cancel on a phone. */
25
+ onDone?: () => void;
26
+ /** The empty row's words ("No industry"); left out, a field of one value can't be left empty. Several can always be
27
+ * emptied, by Clear all or by unticking the last. */
28
+ empty?: string;
29
+ /** What the search says before anything is typed ("Find a country"). */
30
+ search?: string;
31
+ /** Takes new values: handed what was typed, it makes the value and returns it, which is then picked. */
32
+ onCreate?: (typed: string) => string;
33
+ /** The values come from the server: handed each query; `items` are its answer, shown as they are. */
34
+ onSearch?: (query: string) => void;
35
+ /** What the list is doing besides showing its rows. */
36
+ doing?: PickerDoing;
37
+ onRetry?: () => void;
38
+ /** More to load: shows Loading more… last, and is called each time that row comes into view. A page of rows too short to
39
+ * push it out of view is never asked for again, so hand it a page that fills the list (20, as ViewKit's). */
40
+ onMore?: () => void;
41
+ /** The field has no values yet: what it says, and its one action. */
42
+ nothingYet?: {
43
+ text: string;
44
+ line?: string;
45
+ action: string;
46
+ onAction: () => void;
47
+ };
48
+ actions?: PickerAction[];
49
+ /** What was typed on what opened it (a letter on a cell): the list opens filtered by it, the search holding it. */
50
+ typed?: string;
51
+ /** Which form; by default the phone's in a phone's window or in a PhoneHost screen, else the computer's. */
52
+ form?: "computer" | "phone";
53
+ /** Where a phone's draft of several and its Cancel and ✓ stand: `own` (the default), the Picker's, handed back in `head`;
54
+ * `shell`, the shell's (ViewKit's panel): it hands no head and hands every change through onValueChange as it is
55
+ * made. A shell that keeps the draft runs its actions itself, so they stay shown while what is typed matches nothing. */
56
+ draft?: "own" | "shell";
57
+ /** Several held, one of them leading (a set whose field leads, ViewKit's): which, a way to make another lead, and the words
58
+ * for both. Drawn on the held rows, its word on the leading one and Make lead on the others; with chips none is drawn, and
59
+ * the first held leads; on a phone only where the shell keeps the draft, so Make lead never names a value Cancel drops. */
60
+ lead?: PickerLead;
61
+ /** Put the focus in the search as it opens, without scrolling the page (ViewKit's): once, as the body first stands
62
+ * on the page, so a shell that places it a render later loses it. */
63
+ autoFocus?: boolean;
64
+ /** It opens and can be read, and changes nothing: a press on a row picks nothing, and nothing new can be made. */
65
+ readOnly?: boolean;
66
+ /** What it says when what is typed matches nothing ("No one by that name."); "Nothing matches" unless said. */
67
+ none?: string;
68
+ /** Whether its search shows, said by what holds it (the Select: the app's own say); left out, the Search option and
69
+ * the list decide. Hidden, it stays out of sight for the keys, and a letter jumps to the first row it starts. */
70
+ searchShown?: boolean;
71
+ /** How its search is drawn on a computer: `line` (the default), the shared popup line, the Input bare after the magnifier; or `soft`,
72
+ * the Input's Soft box at sm with the magnifier, as every search in Customize's Pane is, where its holder keeps its levels; a
73
+ * Picker that keeps its own draws its ‹ in the box in the magnifier's place. On a phone it changes nothing. */
74
+ searchLook?: "line" | "soft";
75
+ /** Drawn standing open on a page (a component's page): it stands as a list stands the moment it opens, nothing lit. */
76
+ standing?: boolean;
77
+ /** A level standing open as it opens, by its row's value, for a page's case: in place, on a computer and on a phone. */
78
+ defaultLevel?: string;
79
+ /** The levels open, by their rows' values, outermost first, kept by its holder: handed with onLevelsChange, its holder's
80
+ * head names the deepest and goes back, so the Picker draws no ‹ (on a phone none at its bar's start) and no level's own row: the
81
+ * open level's rows stand as a list of their own. Backspace in an empty search still goes back, through onLevelsChange. */
82
+ levels?: string[];
83
+ onLevelsChange?: (levels: string[]) => void;
84
+ /** When a row's own ⋮ shows, on a computer: `always` (the default), or `pointer`, on the lit row (which the pointer lights
85
+ * too) and the row whose menu is open. On a phone ⋯ always shows. */
86
+ rowMenus?: "always" | "pointer";
87
+ /** On a phone, a frame of their own round its rows' menus' rows (the Menu's `frame`, MENU_LIST_CARD_FRAME): what a list whose
88
+ * rows' menus are no menu's own sheet (a list of views) keeps, whatever the app picked round it. */
89
+ menuFrame?: Readonly<Record<string, string>>;
90
+ /** Its rows can be put in order: a row pressed and dragged, with no grip (on a phone after a hold), or ⌥↑ ⌥↓ on the lit
91
+ * row, only among the rows under its own heading and never while something is typed; handed every value in its new order at each
92
+ * move. Left out, no row moves. */
93
+ onOrderChange?: (values: string[]) => void;
94
+ /** Several on a computer, Listed first: a row ticked joins the ticked ones above the line at once, and one unticked goes back to its
95
+ * place (the Links editor's roles). Left out, the ticked ones stay as they were when the list was placed, so
96
+ * a row never moves under the pointer. */
97
+ firstFollows?: boolean;
98
+ /** On a phone, a list in an order of its own (a list's views): what is held stays in its place in the list, marked by its
99
+ * circle, and moves like any other row, with no Selected card; the rows under a heading stand on a card of their own under it, and
100
+ * move only among them; while something is typed the matches stand on one card, with no headings. In a full Sheet it opens
101
+ * scrolled just far enough that the one held shows, clear of the bar. On a computer it changes nothing: held rows stand in
102
+ * their place there already. */
103
+ heldInPlace?: boolean;
104
+ /** On a phone, its actions stand under the list, each the outlined Button, while nothing is typed; the bar holds the search alone
105
+ * (the views list's New view). On a computer it changes nothing: its actions stand in its foot. */
106
+ actionsUnder?: boolean;
107
+ }
108
+ export interface PickerLead {
109
+ value: string | null;
110
+ onLead: (value: string) => void;
111
+ label: string;
112
+ makeLabel: string;
113
+ }
114
+ export interface PickerParts {
115
+ /** What the shell holds; on a phone its bar too, standing at the foot of a full Sheet's body, or ending the list in another. */
116
+ body: React.ReactNode;
117
+ /** On a phone, what the Sheet's head is handed (SheetHead's props); {} keeps its own X. Always {} on a computer, and in a
118
+ * shell that keeps the draft. */
119
+ head: Pick<SheetHeadProps, "close" | "left" | "right" | "children">;
120
+ /** Several on a phone with its own draft: "change", the draft of what the field holds, which ✓ saves and Cancel leaves;
121
+ * null otherwise, a shell that keeps the draft included. The body stays mounted while its shell is open: taken off the
122
+ * page and put back, its draft starts again from what the field holds. */
123
+ step: "change" | null;
124
+ }
125
+ /** What the Picker hands a box that is its search (searchIn "box"): the keys it adds to the box's own, and what the box holds now. */
126
+ export interface PickerBoxSearch {
127
+ onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
128
+ typed: string;
129
+ /** What the box carries for the list's state: at rest, no row active to a screen reader. Spread on the box's input. */
130
+ attrs: {
131
+ "aria-activedescendant"?: undefined;
132
+ };
133
+ }
134
+ /** The Picker's state and the parts a shell pours in. */
135
+ export declare function usePicker(props: PickerProps): PickerParts;
136
+ /** The body alone, for a shell that holds only a body (the Popover). */
137
+ export declare function Picker(props: PickerProps): import("react/jsx-runtime").JSX.Element;
138
+ /** The Picker under a box that opens it, on a computer (the Select's): its root round the box its holder draws, and its
139
+ * list handed to the panel its holder draws (Base UI's own popup round the list). The box is a Base UI Combobox.Trigger, or, with its
140
+ * search in the box, the holder's input group round the Combobox's input (the Select typed into). */
141
+ export interface PickerUnderProps extends Omit<PickerProps, "form" | "draft" | "autoFocus"> {
142
+ /** Where its search is: in its own list (the default), or the box itself, typed straight into (the Select's): the box then
143
+ * holds the Combobox's one input, handed the Picker's keys and what it holds, and the list draws no search. */
144
+ searchIn?: "list" | "box";
145
+ open: boolean;
146
+ onOpenChange: (open: boolean) => void;
147
+ /** The box, drawn inside the Picker's root; with its search in the box, a function handed the Picker's keys and what it holds. */
148
+ box: React.ReactNode | ((search: PickerBoxSearch) => React.ReactNode);
149
+ /** The panel round the list: what the box opens. */
150
+ panel: (list: React.ReactNode) => React.ReactNode;
151
+ disabled?: boolean;
152
+ }
153
+ export declare function PickerUnder({ open, onOpenChange, box, panel, disabled, searchIn, ...props }: PickerUnderProps): import("react/jsx-runtime").JSX.Element;