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.
Files changed (231) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/package.json +2 -4
  3. package/views/dist/contract.d.ts +6 -289
  4. package/views/dist/contract.js +1 -96
  5. package/views/dist/controls/atoms.d.ts +8 -0
  6. package/views/dist/controls/atoms.js +8 -0
  7. package/views/dist/controls/button/tokens.d.ts +351 -0
  8. package/views/dist/controls/button/tokens.js +90 -0
  9. package/views/dist/controls/checkbox/checkbox.d.ts +28 -0
  10. package/views/dist/controls/checkbox/checkbox.js +15 -0
  11. package/views/dist/controls/checkbox/looks.d.ts +3 -0
  12. package/views/dist/controls/checkbox/looks.js +8 -0
  13. package/views/dist/controls/checkbox/map-checkbox.d.ts +2 -0
  14. package/views/dist/controls/checkbox/map-checkbox.js +5 -0
  15. package/views/dist/controls/checkbox/tokens.d.ts +131 -0
  16. package/views/dist/controls/checkbox/tokens.js +35 -0
  17. package/views/dist/controls/checkbox.css +133 -0
  18. package/views/dist/controls/controls.d.ts +12 -3
  19. package/views/dist/controls/controls.js +13 -1
  20. package/views/dist/controls/field/field.d.ts +94 -0
  21. package/views/dist/controls/field/field.js +46 -0
  22. package/views/dist/controls/field/looks.d.ts +13 -0
  23. package/views/dist/controls/field/looks.js +22 -0
  24. package/views/dist/controls/field/tokens.d.ts +75 -0
  25. package/views/dist/controls/field/tokens.js +21 -0
  26. package/views/dist/controls/field.css +98 -0
  27. package/views/dist/controls/glass-button/glass-button.d.ts +40 -0
  28. package/views/dist/controls/glass-button/glass-button.js +16 -0
  29. package/views/dist/controls/glass-button/looks.d.ts +4 -0
  30. package/views/dist/controls/glass-button/looks.js +4 -0
  31. package/views/dist/controls/glass-button/tokens.d.ts +127 -0
  32. package/views/dist/controls/glass-button/tokens.js +34 -0
  33. package/views/dist/controls/glass-button.css +111 -0
  34. package/views/dist/controls/grip/grip.d.ts +14 -0
  35. package/views/dist/controls/grip/grip.js +9 -0
  36. package/views/dist/controls/index.d.ts +32 -0
  37. package/views/dist/controls/index.js +31 -0
  38. package/views/dist/controls/inline-input/inline-input.d.ts +14 -0
  39. package/views/dist/controls/inline-input/inline-input.js +10 -0
  40. package/views/dist/controls/inline-input/looks.d.ts +3 -0
  41. package/views/dist/controls/inline-input/looks.js +16 -0
  42. package/views/dist/controls/inline-input/tokens.d.ts +79 -0
  43. package/views/dist/controls/inline-input/tokens.js +22 -0
  44. package/views/dist/controls/inline-input.css +78 -0
  45. package/views/dist/controls/input/autofill.d.ts +25 -0
  46. package/views/dist/controls/input/autofill.js +17 -0
  47. package/views/dist/controls/input/input.d.ts +119 -0
  48. package/views/dist/controls/input/input.js +127 -0
  49. package/views/dist/controls/input/looks.d.ts +41 -0
  50. package/views/dist/controls/input/looks.js +48 -0
  51. package/views/dist/controls/input/map-input.d.ts +2 -0
  52. package/views/dist/controls/input/map-input.js +5 -0
  53. package/views/dist/controls/input/tokens.d.ts +171 -0
  54. package/views/dist/controls/input/tokens.js +45 -0
  55. package/views/dist/controls/input.css +381 -0
  56. package/views/dist/controls/internal/anchor.d.ts +16 -0
  57. package/views/dist/controls/internal/anchor.js +8 -0
  58. package/views/dist/controls/internal/close-reason.d.ts +5 -0
  59. package/views/dist/controls/internal/close-reason.js +2 -0
  60. package/views/dist/controls/internal/hold.d.ts +25 -0
  61. package/views/dist/controls/internal/hold.js +81 -0
  62. package/views/dist/controls/internal/icons.d.ts +8 -0
  63. package/views/dist/controls/internal/icons.js +65 -0
  64. package/views/dist/controls/internal/popup-host.d.ts +7 -0
  65. package/views/dist/controls/internal/popup-host.js +10 -0
  66. package/views/dist/controls/internal/read-token.d.ts +6 -0
  67. package/views/dist/controls/internal/read-token.js +11 -0
  68. package/views/dist/controls/internal/reorder.d.ts +44 -0
  69. package/views/dist/controls/internal/reorder.js +83 -0
  70. package/views/dist/controls/internal/scroll.d.ts +11 -0
  71. package/views/dist/controls/internal/scroll.js +14 -0
  72. package/views/dist/controls/kbd/kbd.d.ts +13 -0
  73. package/views/dist/controls/kbd/kbd.js +10 -0
  74. package/views/dist/controls/kbd/looks.d.ts +4 -0
  75. package/views/dist/controls/kbd/looks.js +4 -0
  76. package/views/dist/controls/kbd/tokens.d.ts +47 -0
  77. package/views/dist/controls/kbd/tokens.js +14 -0
  78. package/views/dist/controls/kbd.css +46 -0
  79. package/views/dist/controls/list/tokens.d.ts +139 -0
  80. package/views/dist/controls/list/tokens.js +37 -0
  81. package/views/dist/controls/list.css +188 -0
  82. package/views/dist/controls/menu-list/keys.d.ts +7 -0
  83. package/views/dist/controls/menu-list/keys.js +29 -0
  84. package/views/dist/controls/menu-list/looks.d.ts +4 -0
  85. package/views/dist/controls/menu-list/looks.js +20 -0
  86. package/views/dist/controls/menu-list/menu-list.d.ts +196 -0
  87. package/views/dist/controls/menu-list/menu-list.js +346 -0
  88. package/views/dist/controls/menu-list/tokens.d.ts +187 -0
  89. package/views/dist/controls/menu-list/tokens.js +49 -0
  90. package/views/dist/controls/menu-list.css +259 -0
  91. package/views/dist/controls/number-field/number-field.d.ts +48 -0
  92. package/views/dist/controls/number-field/number-field.js +34 -0
  93. package/views/dist/controls/number-field/tokens.d.ts +47 -0
  94. package/views/dist/controls/number-field/tokens.js +14 -0
  95. package/views/dist/controls/number-field.css +54 -0
  96. package/views/dist/controls/option/atom-tag.d.ts +6 -0
  97. package/views/dist/controls/option/atom-tag.js +6 -0
  98. package/views/dist/controls/option/looks.d.ts +7 -0
  99. package/views/dist/controls/option/looks.js +21 -0
  100. package/views/dist/controls/option/option.d.ts +35 -0
  101. package/views/dist/controls/option/option.js +32 -0
  102. package/views/dist/controls/option/tokens.d.ts +223 -0
  103. package/views/dist/controls/option/tokens.js +58 -0
  104. package/views/dist/controls/option.css +92 -0
  105. package/views/dist/controls/phone-header/header-bar.d.ts +18 -0
  106. package/views/dist/controls/phone-header/header-bar.js +9 -0
  107. package/views/dist/controls/phone-header/looks.d.ts +4 -0
  108. package/views/dist/controls/phone-header/looks.js +4 -0
  109. package/views/dist/controls/phone-header/soft-edge.d.ts +5 -0
  110. package/views/dist/controls/phone-header/soft-edge.js +3 -0
  111. package/views/dist/controls/phone-header/tokens.d.ts +59 -0
  112. package/views/dist/controls/phone-header/tokens.js +17 -0
  113. package/views/dist/controls/phone-header.css +51 -0
  114. package/views/dist/controls/popover/looks.d.ts +4 -0
  115. package/views/dist/controls/popover/looks.js +10 -0
  116. package/views/dist/controls/popover/map-popover.d.ts +3 -0
  117. package/views/dist/controls/popover/map-popover.js +5 -0
  118. package/views/dist/controls/popover/popover.d.ts +74 -0
  119. package/views/dist/controls/popover/popover.js +106 -0
  120. package/views/dist/controls/popover/tokens.d.ts +83 -0
  121. package/views/dist/controls/popover/tokens.js +23 -0
  122. package/views/dist/controls/popover.css +94 -0
  123. package/views/dist/controls/scrollbar/scrollbar.d.ts +10 -0
  124. package/views/dist/controls/scrollbar/scrollbar.js +143 -0
  125. package/views/dist/controls/scrollbar/tokens.d.ts +43 -0
  126. package/views/dist/controls/scrollbar/tokens.js +13 -0
  127. package/views/dist/controls/scrollbar.css +47 -0
  128. package/views/dist/controls/sheet/bottom-sheet.d.ts +98 -0
  129. package/views/dist/controls/sheet/bottom-sheet.js +375 -0
  130. package/views/dist/controls/sheet/forms.d.ts +38 -0
  131. package/views/dist/controls/sheet/forms.js +26 -0
  132. package/views/dist/controls/sheet/looks.d.ts +4 -0
  133. package/views/dist/controls/sheet/looks.js +10 -0
  134. package/views/dist/controls/sheet/map-sheet.d.ts +3 -0
  135. package/views/dist/controls/sheet/map-sheet.js +12 -0
  136. package/views/dist/controls/sheet/spring.d.ts +22 -0
  137. package/views/dist/controls/sheet/spring.js +48 -0
  138. package/views/dist/controls/sheet/tokens.d.ts +143 -0
  139. package/views/dist/controls/sheet/tokens.js +38 -0
  140. package/views/dist/controls/sheet.css +223 -0
  141. package/views/dist/controls/spinner/tokens.d.ts +55 -0
  142. package/views/dist/controls/spinner/tokens.js +16 -0
  143. package/views/dist/controls/status/atom-status-badge.d.ts +10 -0
  144. package/views/dist/controls/status/atom-status-badge.js +13 -0
  145. package/views/dist/controls/status/looks.d.ts +4 -0
  146. package/views/dist/controls/status/looks.js +22 -0
  147. package/views/dist/controls/status/marks.d.ts +26 -0
  148. package/views/dist/controls/status/marks.js +73 -0
  149. package/views/dist/controls/status/status.d.ts +43 -0
  150. package/views/dist/controls/status/status.js +26 -0
  151. package/views/dist/controls/status/tokens.d.ts +407 -0
  152. package/views/dist/controls/status/tokens.js +104 -0
  153. package/views/dist/controls/status.css +164 -0
  154. package/views/dist/controls/switch/looks.d.ts +4 -0
  155. package/views/dist/controls/switch/looks.js +19 -0
  156. package/views/dist/controls/switch/switch.d.ts +15 -0
  157. package/views/dist/controls/switch/switch.js +11 -0
  158. package/views/dist/controls/switch/tokens.d.ts +139 -0
  159. package/views/dist/controls/switch/tokens.js +37 -0
  160. package/views/dist/controls/switch.css +169 -0
  161. package/views/dist/controls/tag/atom-cell-more.d.ts +3 -0
  162. package/views/dist/controls/tag/atom-cell-more.js +5 -0
  163. package/views/dist/controls/tag/looks.d.ts +4 -0
  164. package/views/dist/controls/tag/looks.js +4 -0
  165. package/views/dist/controls/tag/tag.d.ts +25 -0
  166. package/views/dist/controls/tag/tag.js +19 -0
  167. package/views/dist/controls/tag/tokens.d.ts +63 -0
  168. package/views/dist/controls/tag/tokens.js +18 -0
  169. package/views/dist/controls/tag.css +81 -0
  170. package/views/dist/controls/toggle/looks.d.ts +3 -0
  171. package/views/dist/controls/toggle/looks.js +12 -0
  172. package/views/dist/controls/toggle/toggle.d.ts +47 -0
  173. package/views/dist/controls/toggle/toggle.js +23 -0
  174. package/views/dist/controls/toggle/tokens.d.ts +55 -0
  175. package/views/dist/controls/toggle/tokens.js +16 -0
  176. package/views/dist/controls/toggle.css +67 -0
  177. package/views/dist/controls/tokens.d.ts +16 -0
  178. package/views/dist/controls/tokens.js +49 -0
  179. package/views/dist/controls/tooltip/looks.d.ts +4 -0
  180. package/views/dist/controls/tooltip/looks.js +4 -0
  181. package/views/dist/controls/tooltip/map-tooltip.d.ts +3 -0
  182. package/views/dist/controls/tooltip/map-tooltip.js +5 -0
  183. package/views/dist/controls/tooltip/tokens.d.ts +75 -0
  184. package/views/dist/controls/tooltip/tokens.js +21 -0
  185. package/views/dist/controls/tooltip/tooltip.d.ts +54 -0
  186. package/views/dist/controls/tooltip/tooltip.js +78 -0
  187. package/views/dist/controls/tooltip.css +94 -0
  188. package/views/dist/grid/chrome/GridTable.js +21 -19
  189. package/views/dist/grid/chrome/grid-caret-keys.d.ts +7 -0
  190. package/views/dist/grid/chrome/grid-caret-keys.js +22 -0
  191. package/views/dist/grid/chrome/grid-row-window.js +3 -0
  192. package/views/dist/grid/chrome/useGridColumnLayout.d.ts +4 -1
  193. package/views/dist/grid/chrome/useGridColumnLayout.js +17 -2
  194. package/views/dist/grid/chrome/useGridFittedWidths.d.ts +32 -0
  195. package/views/dist/grid/chrome/useGridFittedWidths.js +59 -0
  196. package/views/dist/grid/chrome/useGridKeyboard.js +3 -0
  197. package/views/dist/looks/index.d.ts +16 -0
  198. package/views/dist/looks/index.js +16 -0
  199. package/views/dist/looks/looks.d.ts +10 -9
  200. package/views/dist/looks/pieces.js +38 -2
  201. package/views/dist/model/column-schema.d.ts +3 -2
  202. package/views/dist/model/column-state.d.ts +11 -1
  203. package/views/dist/model/column-state.js +8 -2
  204. package/views/dist/styles.css +2362 -7
  205. package/views/dist/styles.unlayered.css +2362 -7
  206. package/views/docs/contract.md +5 -97
  207. package/views/docs/controls/button.md +93 -0
  208. package/views/docs/controls/checkbox.md +38 -0
  209. package/views/docs/controls/field.md +26 -0
  210. package/views/docs/controls/glass-button.md +37 -0
  211. package/views/docs/controls/inline-input.md +27 -0
  212. package/views/docs/controls/input.md +48 -0
  213. package/views/docs/controls/kbd.md +17 -0
  214. package/views/docs/controls/list.md +40 -0
  215. package/views/docs/controls/menu-list.md +52 -0
  216. package/views/docs/controls/number-field.md +17 -0
  217. package/views/docs/controls/option.md +61 -0
  218. package/views/docs/controls/phone-header.md +20 -0
  219. package/views/docs/controls/popover.md +26 -0
  220. package/views/docs/controls/scrollbar.md +16 -0
  221. package/views/docs/controls/sheet.md +41 -0
  222. package/views/docs/controls/spinner.md +19 -0
  223. package/views/docs/controls/status.md +107 -0
  224. package/views/docs/controls/switch.md +40 -0
  225. package/views/docs/controls/tag.md +21 -0
  226. package/views/docs/controls/toggle.md +19 -0
  227. package/views/docs/controls/tooltip.md +24 -0
  228. package/views/docs/getting-started.md +1 -1
  229. package/views/docs/reference/controls.md +213 -2
  230. package/views/docs/reference/looks.md +70 -3
  231. package/views/docs/reference/views.md +7 -2
@@ -0,0 +1,35 @@
1
+ export const CHECKBOX_TOKENS = [
2
+ { name: "--vk-border", kind: "colour", outright: "--border" },
3
+ { name: "--vk-border-brand", kind: "colour", outright: "--border-focused" },
4
+ { name: "--vk-border-danger", kind: "colour", outright: "--border-danger" },
5
+ { name: "--vk-border-input", kind: "colour", outright: "--border-input" },
6
+ { name: "--vk-border-input-hovered", kind: "colour", outright: "--border-input-hovered" },
7
+ { name: "--vk-border-subtle", kind: "colour", outright: "--border-subtle" },
8
+ { name: "--vk-border-width", kind: "size", outright: "--border-width" },
9
+ { name: "--vk-brand", kind: "colour", outright: "--background-brand-bold" },
10
+ { name: "--vk-brand-hovered", kind: "colour", outright: "--background-brand-bold-hovered" },
11
+ { name: "--vk-corner-smoothing", kind: "size", outright: "--corner-smoothing" },
12
+ { name: "--vk-danger-bold", kind: "colour", outright: "--background-danger-bold" },
13
+ { name: "--vk-danger-bold-hovered", kind: "colour", outright: "--background-danger-bold-hovered" },
14
+ { name: "--vk-duration-base", kind: "motion", outright: "--duration-base" },
15
+ { name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
16
+ { name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
17
+ { name: "--vk-fg-disabled", kind: "colour", outright: "--text-disabled" },
18
+ { name: "--vk-fg-inverse", kind: "colour", outright: "--text-inverse" },
19
+ { name: "--vk-fg-on-brand", kind: "colour", outright: "--text-brand-inverse" },
20
+ { name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
21
+ { name: "--vk-focus-offset", kind: "size", outright: "--focus-offset" },
22
+ { name: "--vk-focus-width", kind: "size", outright: "--focus-width" },
23
+ { name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
24
+ { name: "--vk-hovered", kind: "colour", outright: "--surface-hovered" },
25
+ { name: "--vk-input", kind: "colour", outright: "--background-input" },
26
+ { name: "--vk-line-height-sm", kind: "size", outright: "--text-sm--line-height" },
27
+ { name: "--vk-neutral", kind: "colour", outright: "--background-neutral" },
28
+ { name: "--vk-radius-lg", kind: "size", outright: "--radius-lg" },
29
+ { name: "--vk-radius-sm", kind: "size", outright: "--radius-sm" },
30
+ { name: "--vk-selected", kind: "colour", outright: "--surface-selected" },
31
+ { name: "--vk-spacing", kind: "size", outright: "--spacing" },
32
+ { name: "--vk-sunken", kind: "colour", outright: "--surface-sunken" },
33
+ { name: "--vk-sunken-hovered", kind: "colour", outright: "--surface-sunken-hovered" },
34
+ ];
35
+ export const CHECKBOX_PRIVATE = ["--check-", "--list-card-"];
@@ -0,0 +1,133 @@
1
+ /* The Checkbox, as its card draws it. Every value it draws with
2
+ is a public name; this file only says which token each part and state takes. Base UI marks the
3
+ box data-checked, data-indeterminate and data-disabled; data-force draws a state for the sheet. The
4
+ states come in the card's order, a later one winning: the pointer, on, partly, error, focus, disabled.
5
+
6
+ The rules sit in the components layer, so a utility class on a checkbox still wins. */
7
+ @layer components {
8
+
9
+ /* ── At rest: a 16px box, a soft-cornered edge, see-through; the label 10px to its right presses it. Its ground and edge are
10
+ variables, which every state below sets, so its cut draws them under Smooth: --check-ground, --check-edge ── */
11
+ .o-check { position: relative; display: inline-flex; align-items: flex-start; gap: calc(var(--vk-spacing) * 2.5); cursor: pointer; -webkit-tap-highlight-color: transparent; }
12
+ .o-check-box {
13
+ --check-ground: var(--vk-input); --check-edge: var(--vk-border-input); --check-rr: min(var(--vk-radius-sm), var(--vk-spacing) * 2);
14
+ flex: none; box-sizing: border-box; display: grid; place-items: center;
15
+ width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); margin-top: calc(var(--vk-spacing) * 0.5);
16
+ border: var(--vk-border-width) solid var(--check-edge); border-radius: var(--vk-radius-sm);
17
+ background-color: var(--check-ground); color: var(--vk-fg-inverse); outline: none;
18
+ transition: background-color var(--vk-duration-fast) var(--vk-ease-out), border-color var(--vk-duration-fast) var(--vk-ease-out);
19
+ }
20
+ .o-check-mark { display: grid; place-items: center; }
21
+ .o-check-mark svg { width: calc(var(--vk-spacing) * 3); height: calc(var(--vk-spacing) * 3); fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
22
+ /* The tick draws itself in when the box is ticked. */
23
+ /* Its ends are flat while it is hidden: WebKit draws a round end of a dash of no length as a dot, which showed in an unticked box
24
+ on an iPhone; ticked, they are round again. */
25
+ .o-check-tick { stroke-dasharray: 1; stroke-dashoffset: 1; stroke-linecap: butt; transition: stroke-dashoffset var(--vk-duration-base) var(--vk-ease-out); }
26
+ .o-check-dash { display: none; }
27
+
28
+ /* ── Under the pointer, on the box or its label: a louder edge; a ticked box a deeper brand ───────── */
29
+ /* A hover only on a screen with a pointer; a press and the forced state stay out. */
30
+ .o-check-box[data-force="hover"]:not([data-disabled]) { --check-edge: var(--vk-border-input-hovered); }
31
+ @media (hover: hover) { .o-check:hover > .o-check-box:not([data-disabled]) { --check-edge: var(--vk-border-input-hovered); } }
32
+
33
+ /* ── On: the brand, with the tick ──────────────────────────────────────────────────────────────────── */
34
+ .o-check-box[data-checked] { --check-edge: var(--vk-brand); --check-ground: var(--vk-brand); color: var(--vk-fg-on-brand); }
35
+ .o-check-box[data-force="hover"][data-checked]:not([data-disabled]) { --check-edge: var(--vk-brand-hovered); --check-ground: var(--vk-brand-hovered); }
36
+ @media (hover: hover) { .o-check:hover > .o-check-box[data-checked]:not([data-disabled]) { --check-edge: var(--vk-brand-hovered); --check-ground: var(--vk-brand-hovered); } }
37
+ .o-check-box[data-checked] .o-check-tick { stroke-dashoffset: 0; stroke-linecap: round; }
38
+
39
+ /* ── Partly: a box standing for several when only some are picked keeps its edge, a dash in place of
40
+ the tick; some and all read apart by the fill, not a colour ─────────────────────────────────────── */
41
+ .o-check-box[data-indeterminate] { color: var(--vk-fg-subtle); }
42
+ .o-check-box[data-indeterminate] .o-check-tick { display: none; }
43
+ .o-check-box[data-indeterminate] .o-check-dash { display: block; }
44
+
45
+ /* ── In error (aria-invalid, its Field's error, or a group in error around it): a red edge; ticked, the
46
+ danger colour fills it. The pointer never takes it away; focus rings it in red; disabled wins. ─── */
47
+ .o-check-box:is([aria-invalid="true"], [data-invalid], .o-fieldset[data-invalid] *):not([data-disabled]),
48
+ .o-check-box[data-force="hover"]:is([aria-invalid="true"], [data-invalid], .o-fieldset[data-invalid] *):not([data-disabled]) { --check-edge: var(--vk-border-danger); }
49
+ @media (hover: hover) { .o-check:hover > .o-check-box:is([aria-invalid="true"], [data-invalid], .o-fieldset[data-invalid] *):not([data-disabled]) { --check-edge: var(--vk-border-danger); } }
50
+ .o-check-box[data-checked]:is([aria-invalid="true"], [data-invalid], .o-fieldset[data-invalid] *):not([data-disabled]) { --check-edge: var(--vk-danger-bold); --check-ground: var(--vk-danger-bold); color: var(--vk-fg-inverse); }
51
+ .o-check-box[data-force="hover"][data-checked]:is([aria-invalid="true"], [data-invalid], .o-fieldset[data-invalid] *):not([data-disabled]) { --check-edge: var(--vk-danger-bold-hovered); --check-ground: var(--vk-danger-bold-hovered); }
52
+ @media (hover: hover) { .o-check:hover > .o-check-box[data-checked]:is([aria-invalid="true"], [data-invalid], .o-fieldset[data-invalid] *):not([data-disabled]) { --check-edge: var(--vk-danger-bold-hovered); --check-ground: var(--vk-danger-bold-hovered); } }
53
+ .o-check-box:is(:focus-visible, [data-force="focus"]):is([aria-invalid="true"], [data-invalid], .o-fieldset[data-invalid] *) { outline-color: var(--vk-border-danger); }
54
+
55
+ /* ── Focus: the outline 2px outside the box ────────────────────────────────────────────────────────── */
56
+ .o-check-box:is(:focus-visible, [data-force="focus"]) { outline: var(--vk-focus-width) solid var(--vk-border-brand); outline-offset: var(--vk-focus-offset); }
57
+
58
+ /* ── Disabled: a grey box, a softer edge, the tick and the label greyed ─────────────────────────────── */
59
+ .o-check-box[data-disabled] { --check-edge: var(--vk-border-subtle); --check-ground: var(--vk-neutral); color: var(--vk-fg-disabled); }
60
+ .o-check:has(> .o-check-box[data-disabled]) { cursor: not-allowed; }
61
+ .o-check:has(> .o-check-box[data-disabled]) .o-choice-label { color: var(--vk-fg-disabled); }
62
+
63
+ /* ── The box alone in a list's row (CheckboxMark): the row is pressed, so the box reads the row, ticked
64
+ when it is chosen and greyed when it is off ─────────────────────────────────────────────────────── */
65
+ .o-check-box.o-check-in-row { margin-top: 0; }
66
+ :is([data-selected], [aria-selected="true"], [data-checked], [aria-checked="true"]) > .o-check-in-row { --check-edge: var(--vk-brand); --check-ground: var(--vk-brand); color: var(--vk-fg-on-brand); }
67
+ :is([data-selected], [aria-selected="true"], [data-checked], [aria-checked="true"]) > .o-check-in-row .o-check-tick { stroke-dashoffset: 0; stroke-linecap: round; }
68
+ [data-disabled] > .o-check-in-row { --check-edge: var(--vk-border-subtle); --check-ground: var(--vk-neutral); color: var(--vk-fg-disabled); }
69
+
70
+ /* ── Corner smoothing: The app's, with nothing set, follows the token corner-smoothing (Round is the
71
+ token at 0), Smooth and Round set the box apart (data-checkbox-smoothing, looks.ts). Under Smooth or The app's the box is drawn
72
+ with the smooth outline (smooth.css), eased on its 16px side, in every browser that knows shape(); one that doesn't
73
+ keeps the corners above, and so does Round, which paints the box as before. The box is never clipped: its focus ring and its
74
+ pressing area (::after, the app's press styles) stand outside it. Its ground and edge are handed to its cut (.o-check-cut, its first
75
+ child), over its border box: the ground (::before) clipped by the outline, the edge (::after) a ring along it, each moving as the
76
+ box's colours do. The list's and the card's corners are the grouped choices' own. ──────────────────────────────── */
77
+ .o-check-cut { display: none; --smooth-amount: var(--vk-corner-smoothing); }
78
+ /* Its layers' colours move as the box's do, a rule light enough that reduced motion (at the file's end) stops it. */
79
+ .o-check-cut::before, .o-check-cut::after { transition: background-color var(--vk-duration-fast) var(--vk-ease-out); }
80
+ [data-checkbox-smoothing="smooth"] .o-check-box > .o-check-cut { --smooth-amount: initial; }
81
+ @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)) {
82
+ /* Its own corner is its ground's, so its focus ring stands on the fitted corner: worked from the token, or the full
83
+ 0.7 under its own Smooth, never from the cut's amount, which stays on the cut. */
84
+ .o-check-box:not([data-checkbox-smoothing="round"] *):has(> .o-check-cut) {
85
+ --smooth-side: calc(var(--vk-spacing) * 4);
86
+ position: relative; isolation: isolate; border-color: transparent; background-color: transparent;
87
+ border-radius: min(var(--check-rr), var(--vk-spacing) * 4 / (2 + 2 * var(--vk-corner-smoothing)));
88
+ }
89
+ [data-checkbox-smoothing="smooth"] .o-check-box:not([data-checkbox-smoothing="round"] *):has(> .o-check-cut) {
90
+ border-radius: min(var(--check-rr), var(--vk-spacing) * 4 / 3.4);
91
+ }
92
+ .o-check-box:not([data-checkbox-smoothing="round"] *) > .o-check-cut {
93
+ --check-fit: min(var(--check-rr), var(--vk-spacing) * 4 / (2 + 2 * var(--smooth-amount, 0.7))); --smooth-t: var(--check-fit);
94
+ display: block; position: absolute; inset: calc(var(--vk-border-width) * -1); z-index: -1; pointer-events: none;
95
+ }
96
+ .o-check-box:not([data-checkbox-smoothing="round"] *) > .o-check-cut::before {
97
+ content: ""; position: absolute; inset: 0; background-color: var(--check-ground); clip-path: shape(var(--smooth-outline));
98
+ }
99
+ .o-check-box:not([data-checkbox-smoothing="round"] *) > .o-check-cut::after {
100
+ --smooth-t: max(0px, var(--check-fit) - var(--vk-border-width)); --smooth-in: var(--vk-border-width);
101
+ content: ""; position: absolute; inset: 0; background-color: var(--check-edge); clip-path: shape(var(--smooth-ring));
102
+ }
103
+ }
104
+
105
+ /* ── A list: rows in a bordered box, the first (pick all) on the sunken ground; every row takes its
106
+ ground's hover, a picked row its selected fill ──────────────────────────────────────────────────── */
107
+ .o-check-list { display: grid; border: var(--vk-border-width) solid var(--vk-border); border-radius: var(--vk-radius-lg); overflow: hidden; }
108
+ .o-check.o-check-row { display: flex; width: 100%; box-sizing: border-box; padding: calc(var(--vk-spacing) * 3) calc(var(--vk-spacing) * 3.5); border-top: var(--vk-border-width) solid var(--vk-border-subtle); transition: background-color var(--vk-duration-fast) var(--vk-ease-out); }
109
+ .o-check-row:first-child { border-top: 0; background-color: var(--vk-sunken); }
110
+ @media (hover: hover) { .o-check-row:hover { background-color: var(--vk-hovered); } }
111
+ @media (hover: hover) { .o-check-row:first-child:hover { background-color: var(--vk-sunken-hovered); } }
112
+ .o-check-row:has(> .o-check-box[data-checked]) { background-color: var(--vk-selected); }
113
+
114
+ /* ── The list's card smooth: following the token corner-smoothing, drawn with the smooth outline
115
+ (ViewKit's smooth.css) in every browser that knows shape(); one that doesn't keeps the corners above. Its round part is fitted to one
116
+ row, as a control's is. Nothing stands outside it (its rows were hidden past its edge), so it is clipped itself, its rows with it,
117
+ hiding nothing more; its edge is a ring along the curve over its rows (::after), as the Kbd's is. ── */
118
+ @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)) {
119
+ .o-check-list {
120
+ --smooth-amount: var(--vk-corner-smoothing); --list-card-side: calc(var(--vk-spacing) * 6 + var(--vk-font-size-sm) * var(--vk-line-height-sm));
121
+ --list-card-fit: min(var(--vk-radius-lg), var(--list-card-side) / (2 + 2 * var(--smooth-amount, 0.7)));
122
+ --smooth-t: var(--list-card-fit); --smooth-side: var(--list-card-side);
123
+ position: relative; overflow: visible; border-color: transparent; border-radius: var(--list-card-fit); clip-path: shape(var(--smooth-outline));
124
+ }
125
+ .o-check-list::after {
126
+ --smooth-t: max(0px, var(--list-card-fit) - var(--vk-border-width)); --smooth-in: var(--vk-border-width);
127
+ content: ""; position: absolute; inset: calc(var(--vk-border-width) * -1); z-index: 1; pointer-events: none;
128
+ background-color: var(--vk-border); clip-path: shape(var(--smooth-ring));
129
+ }
130
+ }
131
+
132
+ @media (prefers-reduced-motion: reduce) { .o-check-box, .o-check-tick, .o-check-row, .o-check-cut::before, .o-check-cut::after { transition: none; } }
133
+ }
@@ -1,5 +1,14 @@
1
- import type { ComponentType } from "react";
2
- import type { ViewsButtonProps } from "../provider/components.js";
1
+ import { MapButton } from "./button/map-button.js";
2
+ import { MapTooltip } from "./tooltip/map-tooltip.js";
3
+ import { MapPopover } from "./popover/map-popover.js";
4
+ import { MapSheet } from "./sheet/map-sheet.js";
5
+ import { MapCheckbox } from "./checkbox/map-checkbox.js";
6
+ import { MapInput } from "./input/map-input.js";
3
7
  export declare const CONTROLS: {
4
- readonly Button: ComponentType<ViewsButtonProps>;
8
+ Button: typeof MapButton;
9
+ Tooltip: typeof MapTooltip;
10
+ Popover: typeof MapPopover;
11
+ Sheet: typeof MapSheet;
12
+ Input: typeof MapInput;
13
+ Checkbox: typeof MapCheckbox;
5
14
  };
@@ -1,2 +1,14 @@
1
1
  import { MapButton } from "./button/map-button.js";
2
- export const CONTROLS = { Button: MapButton };
2
+ import { MapTooltip } from "./tooltip/map-tooltip.js";
3
+ import { MapPopover } from "./popover/map-popover.js";
4
+ import { MapSheet } from "./sheet/map-sheet.js";
5
+ import { MapCheckbox } from "./checkbox/map-checkbox.js";
6
+ import { MapInput } from "./input/map-input.js";
7
+ export const CONTROLS = {
8
+ Button: MapButton,
9
+ Tooltip: MapTooltip,
10
+ Popover: MapPopover,
11
+ Sheet: MapSheet,
12
+ Input: MapInput,
13
+ Checkbox: MapCheckbox,
14
+ };
@@ -0,0 +1,94 @@
1
+ import * as React from "react";
2
+ import { type FieldRowsLook } from "./looks.js";
3
+ /** A field's error, or several: none, one (written as it is), or a list (each once). */
4
+ export type FieldError = React.ReactNode | React.ReactNode[];
5
+ /** The errors to show, empty ones left out and the same words shown once. */
6
+ export declare function errorsOf(error: FieldError): React.ReactNode[];
7
+ /** One error as it is; several as a list. */
8
+ export declare function ErrorWords({ errors }: {
9
+ errors: React.ReactNode[];
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ export interface FieldProps {
12
+ /** What the field holds, above it. Never the placeholder's job. Without one, its control names itself (an aria-label). */
13
+ label?: React.ReactNode;
14
+ /** Adds the asterisk after the label; give the control `required` too. */
15
+ required?: boolean;
16
+ /** Under the field: what it is for, or why it is locked. */
17
+ note?: React.ReactNode;
18
+ /** Under the field in place of the note: the fix ("Write the amount as a number: 84000"); several, as a list, each once. */
19
+ error?: FieldError;
20
+ /** The note stays when an error shows, the error under it: a password's rules above what broke them. */
21
+ keepNote?: boolean;
22
+ /** Its label above it (vertical); beside it, the label and note on the left and the field and its error on the right
23
+ * (horizontal); or beside it on a computer, above it on a phone (responsive). */
24
+ orientation?: "vertical" | "horizontal" | "responsive";
25
+ disabled?: boolean;
26
+ /** False for a control that is a button (a select's field): its label is then words, not a <label>, so a press on it puts
27
+ * the focus on the field instead of pressing it, and the pointer on it leaves the field at rest. */
28
+ nativeLabel?: boolean;
29
+ /** The label's id, for a control that names itself by its label and its value (a select's field). */
30
+ labelId?: string;
31
+ /** Its label small and quiet, as a body's parts wear it over their boxes: 12px, regular, in the subtle text colour; 14px on
32
+ * a phone. */
33
+ quietLabel?: boolean;
34
+ /** Which form a quiet label takes: the computer's unless said. The app says the phone's where it draws a phone's form. */
35
+ form?: "computer" | "phone";
36
+ className?: string;
37
+ children: React.ReactNode;
38
+ }
39
+ /** A field: its label, its control (an Input or InputGroup, a select, a tag field), and under it its note or its error. */
40
+ export declare function Field({ label, required, note, error, keepNote, orientation, disabled, nativeLabel, labelId, quietLabel, form, className, children }: FieldProps): import("react/jsx-runtime").JSX.Element;
41
+ export interface FieldSetProps {
42
+ /** What the group asks or holds, above it ("Who can see this deal", "Billing address"). */
43
+ legend: React.ReactNode;
44
+ /** Adds the asterisk after the legend: one choice at least is needed. */
45
+ required?: boolean;
46
+ /** Under the legend: what the choices mean, or why they are locked. */
47
+ note?: React.ReactNode;
48
+ /** Under the choices: the fix ("Choose at least one region."), or several, as a list. It takes the note's place unless
49
+ * `keepNote`. */
50
+ error?: FieldError;
51
+ /** The note stays when an error shows. */
52
+ keepNote?: boolean;
53
+ /** Every field and choice in it is off. */
54
+ disabled?: boolean;
55
+ /** A part of a form with several fields under it (an address): the legend a heading over them, the fields 20px apart.
56
+ * Without it, one question answered by its choices (radios, checkboxes), the legend a field's label. */
57
+ section?: boolean;
58
+ className?: string;
59
+ children: React.ReactNode;
60
+ }
61
+ /** Fields or choices that answer one question, under their own legend, with their own note and error: a RadioGroup or
62
+ * checkboxes, or a part of a form. */
63
+ export declare function FieldSet({ legend, required, note, error, keepNote, disabled, section, className, children }: FieldSetProps): import("react/jsx-runtime").JSX.Element;
64
+ /** A line between fields, with a word on it when one says how the two relate ("or", between signing in with Google and with
65
+ * an email). */
66
+ export declare function FieldSeparator({ children, className }: {
67
+ children?: React.ReactNode;
68
+ className?: string;
69
+ }): import("react/jsx-runtime").JSX.Element;
70
+ export interface FieldRowsProps extends React.HTMLAttributes<HTMLDivElement> {
71
+ /** The look its place hands it, whole (an editor's look), winning over the frame's pick; left out, the frame's. */
72
+ look?: FieldRowsLook;
73
+ }
74
+ /** Field rows' card: fields that belong together, as rows of one card on a phone, or each its own card. Its rows are FieldRowsRows;
75
+ * anything else stands in it as its place puts it. */
76
+ export declare function FieldRows({ look, className, children, ...props }: FieldRowsProps): import("react/jsx-runtime").JSX.Element;
77
+ export type FieldRowsRowProps = {
78
+ label?: React.ReactNode;
79
+ labelClassName?: string;
80
+ className?: string;
81
+ children?: React.ReactNode;
82
+ /** Adds the asterisk after the label, as the Field's own. */
83
+ required?: boolean;
84
+ } & (({
85
+ as?: "label";
86
+ } & Omit<React.LabelHTMLAttributes<HTMLLabelElement>, "className" | "children">) | ({
87
+ as: "button";
88
+ } & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "children">) | ({
89
+ as: "div";
90
+ } & Omit<React.HTMLAttributes<HTMLDivElement>, "className" | "children">));
91
+ /** A row of Field rows: its label beside its control, the control bare (the Input, the number field), so a press anywhere in it
92
+ * reaches the control (label); a row pressed to open a step, its value and arrow its place's (button); or a row holding its own
93
+ * controls, a value in a list (div). */
94
+ export declare const FieldRowsRow: React.ForwardRefExoticComponent<FieldRowsRowProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Field as BaseField } from "@base-ui/react/field";
4
+ import { Fieldset as BaseFieldset } from "@base-ui/react/fieldset";
5
+ import { FieldRootContext, useFieldRootContext } from "@base-ui/react/internals/field-root-context";
6
+ import { cx } from "../../internal/cx.js";
7
+ import { fieldRowsAttrs } from "./looks.js";
8
+ export function errorsOf(error) {
9
+ const all = (Array.isArray(error) ? error : [error]).filter((e) => e != null && e !== false && e !== "");
10
+ return all.filter((e, i) => typeof e !== "string" || all.indexOf(e) === i);
11
+ }
12
+ export function ErrorWords({ errors }) {
13
+ return errors.length > 1 ? _jsx("ul", { className: "o-field-errors", children: errors.map((e, i) => _jsx("li", { children: e }, i)) }) : _jsx(_Fragment, { children: errors[0] });
14
+ }
15
+ export function Field({ label, required = false, note, error, keepNote = false, orientation = "vertical", disabled, nativeLabel = true, labelId, quietLabel = false, form, className, children }) {
16
+ const errors = errorsOf(error), invalid = errors.length > 0;
17
+ const phone = quietLabel && form === "phone";
18
+ return (_jsxs(BaseField.Root, { className: cx("o-field", className), "data-orientation": orientation === "vertical" ? undefined : orientation, "data-field-label": quietLabel ? "quiet" : undefined, "data-field-form": phone ? "phone" : undefined, invalid: invalid, disabled: disabled, "data-kit": "field", children: [label != null && _jsxs(BaseField.Label, { className: "o-field-label", id: labelId, ...(nativeLabel ? {} : { nativeLabel: false, render: _jsx("span", {}) }), children: [label, required && _jsx("span", { className: "o-field-req", "aria-hidden": "true", children: "*" })] }), children, note != null && (!invalid || keepNote) && _jsx(BaseField.Description, { className: "o-field-note", children: note }), invalid && _jsx(BaseField.Error, { className: "o-field-error", match: true, children: _jsx(ErrorWords, { errors: errors }) })] }));
19
+ }
20
+ function SetDisabled({ disabled, children }) {
21
+ const outer = useFieldRootContext();
22
+ const off = Boolean(outer.disabled || disabled);
23
+ const value = React.useMemo(() => ({ ...outer, disabled: off, state: { ...outer.state, disabled: off } }), [outer, off]);
24
+ return _jsx(FieldRootContext.Provider, { value: value, children: children });
25
+ }
26
+ export function FieldSet({ legend, required = false, note, error, keepNote = false, disabled, section = false, className, children }) {
27
+ const errors = errorsOf(error), invalid = errors.length > 0, id = React.useId();
28
+ const noted = note != null && (!invalid || keepNote);
29
+ const described = [noted && `${id}-note`, invalid && `${id}-error`].filter(Boolean).join(" ");
30
+ return (_jsxs(BaseFieldset.Root, { className: cx("o-fieldset", section && "o-fieldset-section", className), disabled: disabled, "data-invalid": invalid || undefined, "aria-describedby": described || undefined, "data-kit": "field", children: [_jsxs(BaseFieldset.Legend, { className: "o-field-label o-fieldset-legend", children: [legend, required && _jsx("span", { className: "o-field-req", "aria-hidden": "true", children: "*" })] }), noted && _jsx("p", { className: "o-field-note", id: `${id}-note`, children: note }), _jsx("div", { className: "o-fieldset-body", children: _jsx(SetDisabled, { disabled: disabled, children: children }) }), invalid && _jsx("div", { className: "o-field-error", id: `${id}-error`, role: "alert", children: _jsx(ErrorWords, { errors: errors }) })] }));
31
+ }
32
+ export function FieldSeparator({ children, className }) {
33
+ return (_jsxs("div", { className: cx("o-field-sep", className), role: "separator", children: [_jsx("span", { className: "o-field-sep-line" }), children != null && _jsxs(_Fragment, { children: [_jsx("span", { className: "o-field-sep-words", children: children }), _jsx("span", { className: "o-field-sep-line" })] })] }));
34
+ }
35
+ export function FieldRows({ look, className, children, ...props }) {
36
+ return _jsx("div", { className: cx("o-field-rows", className), "data-kit": "field", ...(look ? fieldRowsAttrs(look) : {}), ...props, children: children });
37
+ }
38
+ export const FieldRowsRow = React.forwardRef(function FieldRowsRow({ as = "label", label, labelClassName, required = false, className, children, ...props }, ref) {
39
+ const inner = _jsxs(_Fragment, { children: [label != null && _jsxs("span", { className: cx("o-field-row-label", labelClassName), children: [label, required && _jsx("span", { className: "o-field-req", "aria-hidden": "true", children: "*" })] }), children] });
40
+ const cls = cx("o-field-row", className);
41
+ if (as === "button")
42
+ return _jsx("button", { ref: ref, type: "button", className: cls, ...props, children: inner });
43
+ if (as === "div")
44
+ return _jsx("div", { ref: ref, className: cls, ...props, children: inner });
45
+ return _jsx("label", { ref: ref, className: cls, ...props, children: inner });
46
+ });
@@ -0,0 +1,13 @@
1
+ import type { PieceLooks } from "../../looks/looks.js";
2
+ export type FieldLookOptionId = "rows-cards" | "rows-edge" | "rows-height" | "rows-label" | "rows-lines";
3
+ /** A card's own look, handed by its place (an editor's look): each option, an option left out taking its default. */
4
+ export type FieldRowsLook = Partial<{
5
+ cards: "one" | "each";
6
+ edge: "on" | "off";
7
+ height: "48" | "52" | "56";
8
+ label: "104" | "none";
9
+ lines: "words" | "across" | "none";
10
+ }>;
11
+ export declare const FIELD_LOOKS: PieceLooks<FieldLookOptionId>;
12
+ /** A card's own look, whole, as its data attributes (`data-field-rows-<option>`), an option left out taking its default. */
13
+ export declare function fieldRowsAttrs(look: FieldRowsLook): Record<string, string>;
@@ -0,0 +1,22 @@
1
+ const options = [
2
+ { id: "rows-cards", name: "Cards", def: "one", device: "phone", demo: false, values: [{ id: "one", name: "One" }, { id: "each", name: "Each row" }] },
3
+ { id: "rows-edge", name: "Edge", def: "on", device: "phone", demo: false, values: [{ id: "on", name: "On" }, { id: "off", name: "Off" }] },
4
+ { id: "rows-height", name: "Height", def: "52", device: "phone", demo: false, values: [{ id: "48", name: "48" }, { id: "52", name: "52" }, { id: "56", name: "56" }] },
5
+ { id: "rows-label", name: "Label", def: "104", device: "phone", demo: false, values: [{ id: "104", name: "104" }, { id: "none", name: "None" }] },
6
+ { id: "rows-lines", name: "Lines", def: "words", device: "phone", demo: false, values: [{ id: "words", name: "From the words" }, { id: "across", name: "Across" }, { id: "none", name: "None" }] },
7
+ ];
8
+ export const FIELD_LOOKS = {
9
+ id: "field",
10
+ name: "Field",
11
+ options,
12
+ looks: [
13
+ { id: "card", name: "Card", device: "phone", picks: { "rows-cards": "one", "rows-edge": "on", "rows-height": "52", "rows-label": "104", "rows-lines": "words" } },
14
+ { id: "each", name: "A card each", device: "phone", picks: { "rows-cards": "each", "rows-edge": "on", "rows-height": "56", "rows-label": "104", "rows-lines": "none" } },
15
+ { id: "rows", name: "Rows in a card", device: "phone", picks: { "rows-cards": "one", "rows-edge": "off", "rows-height": "48", "rows-label": "104", "rows-lines": "across" } },
16
+ ],
17
+ };
18
+ const known = (o, v) => (v && o.values.some((x) => x.id === v) ? v : o.def);
19
+ export function fieldRowsAttrs(look) {
20
+ const picks = look;
21
+ return Object.fromEntries(options.map((o) => [`data-field-${o.id}`, known(o, picks[o.id.slice("rows-".length)])]));
22
+ }
@@ -0,0 +1,75 @@
1
+ export declare const FIELD_TOKENS: readonly [{
2
+ readonly name: "--vk-border-overlay-card";
3
+ readonly kind: "colour";
4
+ readonly outright: "--border-overlay-card";
5
+ }, {
6
+ readonly name: "--vk-border-subtle";
7
+ readonly kind: "colour";
8
+ readonly outright: "--border-subtle";
9
+ }, {
10
+ readonly name: "--vk-border-width";
11
+ readonly kind: "size";
12
+ readonly outright: "--border-width";
13
+ }, {
14
+ readonly name: "--vk-danger";
15
+ readonly kind: "colour";
16
+ readonly outright: "--text-danger";
17
+ }, {
18
+ readonly name: "--vk-fg";
19
+ readonly kind: "colour";
20
+ readonly outright: "--text";
21
+ }, {
22
+ readonly name: "--vk-fg-disabled";
23
+ readonly kind: "colour";
24
+ readonly outright: "--text-disabled";
25
+ }, {
26
+ readonly name: "--vk-fg-subtle";
27
+ readonly kind: "colour";
28
+ readonly outright: "--text-subtle";
29
+ }, {
30
+ readonly name: "--vk-font-size-base";
31
+ readonly kind: "size";
32
+ readonly outright: "--text-base";
33
+ }, {
34
+ readonly name: "--vk-font-size-sm";
35
+ readonly kind: "size";
36
+ readonly outright: "--text-sm";
37
+ }, {
38
+ readonly name: "--vk-font-size-xs";
39
+ readonly kind: "size";
40
+ readonly outright: "--text-xs";
41
+ }, {
42
+ readonly name: "--vk-font-weight-medium";
43
+ readonly kind: "size";
44
+ readonly outright: "--font-weight-medium";
45
+ }, {
46
+ readonly name: "--vk-font-weight-normal";
47
+ readonly kind: "size";
48
+ readonly outright: "--font-weight-normal";
49
+ }, {
50
+ readonly name: "--vk-line-height-base";
51
+ readonly kind: "size";
52
+ readonly outright: "--text-base--line-height";
53
+ }, {
54
+ readonly name: "--vk-line-height-sm";
55
+ readonly kind: "size";
56
+ readonly outright: "--text-sm--line-height";
57
+ }, {
58
+ readonly name: "--vk-line-height-xs";
59
+ readonly kind: "size";
60
+ readonly outright: "--text-xs--line-height";
61
+ }, {
62
+ readonly name: "--vk-overlay-card";
63
+ readonly kind: "colour";
64
+ readonly outright: "--surface-overlay-card";
65
+ }, {
66
+ readonly name: "--vk-radius-xl";
67
+ readonly kind: "size";
68
+ readonly outright: "--radius-xl";
69
+ }, {
70
+ readonly name: "--vk-spacing";
71
+ readonly kind: "size";
72
+ readonly outright: "--spacing";
73
+ }];
74
+ /** The prefixes of the Field's own machinery, set and read by it alone: not public. */
75
+ export declare const FIELD_PRIVATE: readonly ["--field-"];
@@ -0,0 +1,21 @@
1
+ export const FIELD_TOKENS = [
2
+ { name: "--vk-border-overlay-card", kind: "colour", outright: "--border-overlay-card" },
3
+ { name: "--vk-border-subtle", kind: "colour", outright: "--border-subtle" },
4
+ { name: "--vk-border-width", kind: "size", outright: "--border-width" },
5
+ { name: "--vk-danger", kind: "colour", outright: "--text-danger" },
6
+ { name: "--vk-fg", kind: "colour", outright: "--text" },
7
+ { name: "--vk-fg-disabled", kind: "colour", outright: "--text-disabled" },
8
+ { name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
9
+ { name: "--vk-font-size-base", kind: "size", outright: "--text-base" },
10
+ { name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
11
+ { name: "--vk-font-size-xs", kind: "size", outright: "--text-xs" },
12
+ { name: "--vk-font-weight-medium", kind: "size", outright: "--font-weight-medium" },
13
+ { name: "--vk-font-weight-normal", kind: "size", outright: "--font-weight-normal" },
14
+ { name: "--vk-line-height-base", kind: "size", outright: "--text-base--line-height" },
15
+ { name: "--vk-line-height-sm", kind: "size", outright: "--text-sm--line-height" },
16
+ { name: "--vk-line-height-xs", kind: "size", outright: "--text-xs--line-height" },
17
+ { name: "--vk-overlay-card", kind: "colour", outright: "--surface-overlay-card" },
18
+ { name: "--vk-radius-xl", kind: "size", outright: "--radius-xl" },
19
+ { name: "--vk-spacing", kind: "size", outright: "--spacing" },
20
+ ];
21
+ export const FIELD_PRIVATE = ["--field-"];
@@ -0,0 +1,98 @@
1
+ /* A field (its label, note and error), a group of fields (FieldSet), a field's list of errors, the line between
2
+ fields, and a field beside its label, as shadcn's Field draws them, on public names. A field's label and a group's
3
+ legend (which reads as one) are both .o-field-label; a field's label can be quiet instead.
4
+
5
+ The rules sit in the components layer, so a utility class still wins. */
6
+ @layer components {
7
+
8
+ /* ── A field: its label, then its control, then its note or its error ──────────────────────────────── */
9
+ /* Its one column never wider than the field: a control holding a long value (a Select's chosen country) ends in its "…",
10
+ never widening what holds it, as the field beside its label already does. */
11
+ .o-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: calc(var(--vk-spacing) * 1.5); min-width: 0; }
12
+ .o-field-label { font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); font-weight: var(--vk-font-weight-medium); color: var(--vk-fg); }
13
+ /* A quiet label, as a body's parts wear it over their boxes: 12px, regular, subtle; 14px in the phone's form. */
14
+ .o-field[data-field-label="quiet"] > .o-field-label { font-size: var(--vk-font-size-xs); line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs)); font-weight: var(--vk-font-weight-normal); color: var(--vk-fg-subtle); }
15
+ .o-field[data-field-label="quiet"][data-field-form="phone"] > .o-field-label { font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
16
+ /* A required field's asterisk, after its label. */
17
+ .o-field-req { margin-left: calc(var(--vk-spacing) * 0.5); color: var(--vk-danger); }
18
+ /* The note says what the field is for or why it is locked; an error takes its place and says the fix. */
19
+ .o-field-note, .o-field-error { margin: 0; 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); }
20
+ .o-field-error { color: var(--vk-danger); }
21
+
22
+ /* ── A group: its legend, a note under it, the choices or fields, then its error ───────────────────── */
23
+ .o-fieldset { display: grid; gap: calc(var(--vk-spacing) * 3); min-width: 0; margin: 0; padding: 0; border: 0; }
24
+ /* The legend is drawn as a field's label (.o-field-label); with a note under it, the note sits as close as a
25
+ field's does. */
26
+ .o-fieldset-legend:has(+ .o-field-note) { margin-bottom: calc(var(--vk-spacing) * -1.5); }
27
+ .o-fieldset-body { display: grid; min-width: 0; }
28
+ .o-fieldset[disabled] .o-fieldset-legend { color: var(--vk-fg-disabled); }
29
+ /* A part of a form: the legend a heading over its fields, the fields 20px apart. */
30
+ .o-fieldset-section .o-fieldset-legend { font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); }
31
+ .o-fieldset-section > .o-fieldset-body { gap: calc(var(--vk-spacing) * 5); }
32
+
33
+ /* ── Several errors: a list, each on its own line ──────────────────────────────────────────────────── */
34
+ .o-field-errors { display: grid; gap: calc(var(--vk-spacing) * 0.5); margin: 0; padding-left: calc(var(--vk-spacing) * 4); list-style: disc; }
35
+
36
+ /* ── A line between fields, its word in the middle ─────────────────────────────────────────────────── */
37
+ .o-field-sep { display: flex; align-items: center; gap: calc(var(--vk-spacing) * 3); min-height: calc(var(--vk-spacing) * 5); }
38
+ .o-field-sep-line { flex: 1; height: var(--vk-border-width); background-color: var(--vk-border-subtle); }
39
+ .o-field-sep-words { 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); }
40
+
41
+ /* ── A field beside its label: the label and its note on the left, the field and its error on the right,
42
+ the label's words on the field's line. Responsive does so on a computer, and stands above the
43
+ field on the phone (the phone switch). ───────────────────────────────────────────────────────────── */
44
+ .o-field:is([data-orientation="horizontal"], [data-orientation="responsive"]) { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: baseline; column-gap: calc(var(--vk-spacing) * 4); }
45
+ .o-field:is([data-orientation="horizontal"], [data-orientation="responsive"]) > * { grid-column: 2; }
46
+ .o-field:is([data-orientation="horizontal"], [data-orientation="responsive"]) > :is(.o-field-label, .o-field-note) { grid-column: 1; }
47
+ @media (width < 640px) {
48
+ .o-field[data-orientation="responsive"]:where(:not([data-computer-host], [data-computer-host] *)) { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
49
+ .o-field[data-orientation="responsive"] > :is(*, .o-field-label, .o-field-note):where(:not([data-computer-host], [data-computer-host] *)) { grid-column: 1; }
50
+ }
51
+ @container o-phone (width < 640px) {
52
+ .o-field[data-orientation="responsive"] { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
53
+ .o-field[data-orientation="responsive"] > :is(*, .o-field-label, .o-field-note) { grid-column: 1; }
54
+ }
55
+
56
+ /* ── Field rows: on a phone, fields as rows of a card ──────────────────────────────────────────
57
+ Each option, on a frame or on the card itself (the look its place hands it, whole, which wins), sets the card's and
58
+ its rows' variables; nothing set is Card: one card on the overlay's card ground, its edge, rows 52, the label 104, the line
59
+ between rows from the words. What stands inside a row and where is its place's: a place may set a row's inset and gap. A row
60
+ typed into shows the caret alone. */
61
+ [data-field-rows-edge="on"] { --field-rows-edge: var(--vk-border-width) solid var(--vk-border-subtle); }
62
+ [data-field-rows-edge="off"] { --field-rows-edge: 0 none; }
63
+ [data-field-rows-cards="one"] {
64
+ --field-rows-card-display: block; --field-rows-card-gap: 0px; --field-rows-card-overflow: hidden; --field-rows-card-edge: var(--field-rows-edge);
65
+ --field-rows-card-corners: var(--vk-radius-xl); --field-rows-card-ground: var(--vk-overlay-card);
66
+ --field-rows-row-edge: 0 none; --field-rows-row-corners: 0px; --field-rows-row-ground: transparent;
67
+ }
68
+ [data-field-rows-cards="each"] {
69
+ --field-rows-card-display: grid; --field-rows-card-gap: calc(var(--vk-spacing) * 2.5); --field-rows-card-overflow: visible; --field-rows-card-edge: 0 none;
70
+ --field-rows-card-corners: 0px; --field-rows-card-ground: transparent;
71
+ --field-rows-row-edge: var(--field-rows-edge); --field-rows-row-corners: var(--vk-radius-xl); --field-rows-row-ground: var(--vk-overlay-card);
72
+ }
73
+ [data-field-rows-height="48"] { --field-rows-row: calc(var(--vk-spacing) * 12); }
74
+ [data-field-rows-height="52"] { --field-rows-row: calc(var(--vk-spacing) * 13); }
75
+ [data-field-rows-height="56"] { --field-rows-row: calc(var(--vk-spacing) * 14); }
76
+ [data-field-rows-label="104"] { --field-rows-label: block; }
77
+ [data-field-rows-label="none"] { --field-rows-label: none; }
78
+ [data-field-rows-lines="words"] { --field-rows-line-image: linear-gradient(var(--vk-border-overlay-card), var(--vk-border-overlay-card)); --field-rows-line-shadow: none; }
79
+ [data-field-rows-lines="across"] { --field-rows-line-image: none; --field-rows-line-shadow: inset 0 var(--vk-border-width) 0 var(--vk-border-overlay-card); }
80
+ [data-field-rows-lines="none"] { --field-rows-line-image: none; --field-rows-line-shadow: none; }
81
+
82
+ .o-field-rows {
83
+ display: var(--field-rows-card-display, block); grid-template-columns: minmax(0, 1fr); gap: var(--field-rows-card-gap, 0px); min-width: 0;
84
+ font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); overflow: var(--field-rows-card-overflow, hidden); border: var(--field-rows-card-edge, var(--vk-border-width) solid var(--vk-border-subtle));
85
+ border-radius: var(--field-rows-card-corners, var(--vk-radius-xl)); background-color: var(--field-rows-card-ground, var(--vk-overlay-card));
86
+ }
87
+ .o-field-row {
88
+ display: flex; align-items: center; gap: calc(var(--vk-spacing) * 3); box-sizing: border-box; width: 100%; min-height: var(--field-rows-row, calc(var(--vk-spacing) * 13));
89
+ margin: 0; padding: 0 calc(var(--vk-spacing) * 4); border: var(--field-rows-row-edge, 0 none); border-radius: var(--field-rows-row-corners, 0px);
90
+ background-color: var(--field-rows-row-ground, transparent); color: var(--vk-fg); font: inherit; text-align: left;
91
+ }
92
+ button.o-field-row { cursor: pointer; }
93
+ .o-field-row + .o-field-row {
94
+ background-image: var(--field-rows-line-image, linear-gradient(var(--vk-border-overlay-card), var(--vk-border-overlay-card))); background-size: calc(100% - var(--vk-spacing) * 4) var(--vk-border-width);
95
+ background-position: calc(var(--vk-spacing) * 4) 0; background-repeat: no-repeat; box-shadow: var(--field-rows-line-shadow, none);
96
+ }
97
+ .o-field-row-label { display: var(--field-rows-label, block); flex: none; width: calc(var(--vk-spacing) * 26); color: var(--vk-fg-subtle); }
98
+ }