viewkitjs 0.21.0 → 0.23.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 (237) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/MIGRATION.md +1 -1
  3. package/README.md +1 -1
  4. package/fields/dist/conventions.d.ts +15 -3
  5. package/fields/dist/conventions.js +25 -0
  6. package/fields/dist/design/category-colors.d.ts +12 -5
  7. package/fields/dist/design/category-colors.js +7 -7
  8. package/fields/dist/query/buckets.js +42 -35
  9. package/fields/dist/query/date.js +2 -13
  10. package/fields/docs/guides/conventions.md +1 -1
  11. package/fields/docs/guides/options.md +2 -1
  12. package/fields/docs/reference/design-category-colors.md +2 -2
  13. package/fields/docs/reference/fields.md +1 -1
  14. package/package.json +13 -1
  15. package/views/dist/atoms/tones.js +7 -7
  16. package/views/dist/contract.d.ts +6 -1
  17. package/views/dist/contract.js +1 -0
  18. package/views/dist/controls/atoms.d.ts +8 -0
  19. package/views/dist/controls/atoms.js +8 -0
  20. package/views/dist/controls/button/button.d.ts +40 -0
  21. package/views/dist/controls/button/button.js +40 -0
  22. package/views/dist/controls/button/looks.d.ts +4 -0
  23. package/views/dist/controls/button/looks.js +20 -0
  24. package/views/dist/controls/button/map-button.d.ts +11 -0
  25. package/views/dist/controls/button/map-button.js +20 -0
  26. package/views/dist/controls/button/own-look.d.ts +59 -0
  27. package/views/dist/controls/button/own-look.js +33 -0
  28. package/views/dist/controls/button/tokens.d.ts +351 -0
  29. package/views/dist/controls/button/tokens.js +90 -0
  30. package/views/dist/controls/button.css +530 -0
  31. package/views/dist/controls/checkbox/checkbox.d.ts +28 -0
  32. package/views/dist/controls/checkbox/checkbox.js +15 -0
  33. package/views/dist/controls/checkbox/looks.d.ts +3 -0
  34. package/views/dist/controls/checkbox/looks.js +8 -0
  35. package/views/dist/controls/checkbox/map-checkbox.d.ts +2 -0
  36. package/views/dist/controls/checkbox/map-checkbox.js +5 -0
  37. package/views/dist/controls/checkbox/tokens.d.ts +131 -0
  38. package/views/dist/controls/checkbox/tokens.js +35 -0
  39. package/views/dist/controls/checkbox.css +133 -0
  40. package/views/dist/controls/controls.d.ts +14 -0
  41. package/views/dist/controls/controls.js +14 -0
  42. package/views/dist/controls/field/field.d.ts +94 -0
  43. package/views/dist/controls/field/field.js +46 -0
  44. package/views/dist/controls/field/looks.d.ts +13 -0
  45. package/views/dist/controls/field/looks.js +22 -0
  46. package/views/dist/controls/field/tokens.d.ts +75 -0
  47. package/views/dist/controls/field/tokens.js +21 -0
  48. package/views/dist/controls/field.css +98 -0
  49. package/views/dist/controls/glass-button/glass-button.d.ts +40 -0
  50. package/views/dist/controls/glass-button/glass-button.js +16 -0
  51. package/views/dist/controls/glass-button/looks.d.ts +4 -0
  52. package/views/dist/controls/glass-button/looks.js +4 -0
  53. package/views/dist/controls/glass-button/tokens.d.ts +127 -0
  54. package/views/dist/controls/glass-button/tokens.js +34 -0
  55. package/views/dist/controls/glass-button.css +111 -0
  56. package/views/dist/controls/index.d.ts +37 -0
  57. package/views/dist/controls/index.js +31 -0
  58. package/views/dist/controls/inline-input/inline-input.d.ts +14 -0
  59. package/views/dist/controls/inline-input/inline-input.js +10 -0
  60. package/views/dist/controls/inline-input/looks.d.ts +3 -0
  61. package/views/dist/controls/inline-input/looks.js +16 -0
  62. package/views/dist/controls/inline-input/tokens.d.ts +79 -0
  63. package/views/dist/controls/inline-input/tokens.js +22 -0
  64. package/views/dist/controls/inline-input.css +78 -0
  65. package/views/dist/controls/input/autofill.d.ts +25 -0
  66. package/views/dist/controls/input/autofill.js +17 -0
  67. package/views/dist/controls/input/input.d.ts +119 -0
  68. package/views/dist/controls/input/input.js +127 -0
  69. package/views/dist/controls/input/looks.d.ts +41 -0
  70. package/views/dist/controls/input/looks.js +48 -0
  71. package/views/dist/controls/input/map-input.d.ts +2 -0
  72. package/views/dist/controls/input/map-input.js +5 -0
  73. package/views/dist/controls/input/tokens.d.ts +171 -0
  74. package/views/dist/controls/input/tokens.js +45 -0
  75. package/views/dist/controls/input.css +381 -0
  76. package/views/dist/controls/internal/anchor.d.ts +16 -0
  77. package/views/dist/controls/internal/anchor.js +8 -0
  78. package/views/dist/controls/internal/close-reason.d.ts +5 -0
  79. package/views/dist/controls/internal/close-reason.js +2 -0
  80. package/views/dist/controls/internal/popup-host.d.ts +7 -0
  81. package/views/dist/controls/internal/popup-host.js +10 -0
  82. package/views/dist/controls/internal/scroll.d.ts +11 -0
  83. package/views/dist/controls/internal/scroll.js +14 -0
  84. package/views/dist/controls/kbd/kbd.d.ts +13 -0
  85. package/views/dist/controls/kbd/kbd.js +10 -0
  86. package/views/dist/controls/kbd/looks.d.ts +4 -0
  87. package/views/dist/controls/kbd/looks.js +4 -0
  88. package/views/dist/controls/kbd/tokens.d.ts +47 -0
  89. package/views/dist/controls/kbd/tokens.js +14 -0
  90. package/views/dist/controls/kbd.css +46 -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 +372 -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 +220 -0
  141. package/views/dist/controls/smooth.css +101 -0
  142. package/views/dist/controls/spinner/looks.d.ts +4 -0
  143. package/views/dist/controls/spinner/looks.js +32 -0
  144. package/views/dist/controls/spinner/spinner.d.ts +23 -0
  145. package/views/dist/controls/spinner/spinner.js +16 -0
  146. package/views/dist/controls/spinner/tokens.d.ts +55 -0
  147. package/views/dist/controls/spinner/tokens.js +16 -0
  148. package/views/dist/controls/spinner.css +147 -0
  149. package/views/dist/controls/status/atom-status-badge.d.ts +10 -0
  150. package/views/dist/controls/status/atom-status-badge.js +13 -0
  151. package/views/dist/controls/status/looks.d.ts +4 -0
  152. package/views/dist/controls/status/looks.js +22 -0
  153. package/views/dist/controls/status/marks.d.ts +26 -0
  154. package/views/dist/controls/status/marks.js +73 -0
  155. package/views/dist/controls/status/status.d.ts +43 -0
  156. package/views/dist/controls/status/status.js +26 -0
  157. package/views/dist/controls/status/tokens.d.ts +407 -0
  158. package/views/dist/controls/status/tokens.js +104 -0
  159. package/views/dist/controls/status.css +164 -0
  160. package/views/dist/controls/switch/looks.d.ts +4 -0
  161. package/views/dist/controls/switch/looks.js +19 -0
  162. package/views/dist/controls/switch/switch.d.ts +15 -0
  163. package/views/dist/controls/switch/switch.js +11 -0
  164. package/views/dist/controls/switch/tokens.d.ts +139 -0
  165. package/views/dist/controls/switch/tokens.js +37 -0
  166. package/views/dist/controls/switch.css +169 -0
  167. package/views/dist/controls/tag/atom-cell-more.d.ts +3 -0
  168. package/views/dist/controls/tag/atom-cell-more.js +5 -0
  169. package/views/dist/controls/tag/looks.d.ts +4 -0
  170. package/views/dist/controls/tag/looks.js +4 -0
  171. package/views/dist/controls/tag/tag.d.ts +25 -0
  172. package/views/dist/controls/tag/tag.js +19 -0
  173. package/views/dist/controls/tag/tokens.d.ts +63 -0
  174. package/views/dist/controls/tag/tokens.js +18 -0
  175. package/views/dist/controls/tag.css +81 -0
  176. package/views/dist/controls/toggle/looks.d.ts +3 -0
  177. package/views/dist/controls/toggle/looks.js +12 -0
  178. package/views/dist/controls/toggle/toggle.d.ts +47 -0
  179. package/views/dist/controls/toggle/toggle.js +23 -0
  180. package/views/dist/controls/toggle/tokens.d.ts +55 -0
  181. package/views/dist/controls/toggle/tokens.js +16 -0
  182. package/views/dist/controls/toggle.css +67 -0
  183. package/views/dist/controls/tokens.d.ts +16 -0
  184. package/views/dist/controls/tokens.js +45 -0
  185. package/views/dist/controls/tooltip/looks.d.ts +4 -0
  186. package/views/dist/controls/tooltip/looks.js +4 -0
  187. package/views/dist/controls/tooltip/map-tooltip.d.ts +3 -0
  188. package/views/dist/controls/tooltip/map-tooltip.js +5 -0
  189. package/views/dist/controls/tooltip/tokens.d.ts +75 -0
  190. package/views/dist/controls/tooltip/tokens.js +21 -0
  191. package/views/dist/controls/tooltip/tooltip.d.ts +54 -0
  192. package/views/dist/controls/tooltip/tooltip.js +78 -0
  193. package/views/dist/controls/tooltip.css +94 -0
  194. package/views/dist/display/date.js +15 -2
  195. package/views/dist/grid/chrome/GridTable.js +21 -19
  196. package/views/dist/grid/chrome/grid-row-window.js +3 -0
  197. package/views/dist/grid/chrome/useGridColumnLayout.d.ts +4 -1
  198. package/views/dist/grid/chrome/useGridColumnLayout.js +17 -2
  199. package/views/dist/grid/chrome/useGridFittedWidths.d.ts +29 -0
  200. package/views/dist/grid/chrome/useGridFittedWidths.js +46 -0
  201. package/views/dist/looks/index.d.ts +17 -0
  202. package/views/dist/looks/index.js +17 -0
  203. package/views/dist/looks/looks.d.ts +2 -1
  204. package/views/dist/looks/pieces.js +37 -1
  205. package/views/dist/model/column-schema.d.ts +3 -2
  206. package/views/dist/model/column-state.d.ts +11 -1
  207. package/views/dist/model/column-state.js +8 -2
  208. package/views/dist/panels/react/views-row/FoldingViewRow.js +8 -8
  209. package/views/dist/styles.css +2748 -56
  210. package/views/dist/styles.unlayered.css +2765 -56
  211. package/views/docs/contract.md +39 -8
  212. package/views/docs/controls/button.md +93 -0
  213. package/views/docs/controls/checkbox.md +38 -0
  214. package/views/docs/controls/field.md +26 -0
  215. package/views/docs/controls/glass-button.md +37 -0
  216. package/views/docs/controls/inline-input.md +27 -0
  217. package/views/docs/controls/input.md +48 -0
  218. package/views/docs/controls/kbd.md +17 -0
  219. package/views/docs/controls/number-field.md +17 -0
  220. package/views/docs/controls/option.md +61 -0
  221. package/views/docs/controls/phone-header.md +20 -0
  222. package/views/docs/controls/popover.md +26 -0
  223. package/views/docs/controls/scrollbar.md +16 -0
  224. package/views/docs/controls/sheet.md +41 -0
  225. package/views/docs/controls/spinner.md +19 -0
  226. package/views/docs/controls/status.md +107 -0
  227. package/views/docs/controls/switch.md +40 -0
  228. package/views/docs/controls/tag.md +21 -0
  229. package/views/docs/controls/toggle.md +19 -0
  230. package/views/docs/controls/tooltip.md +24 -0
  231. package/views/docs/getting-started.md +1 -1
  232. package/views/docs/guides/the-provider.md +1 -1
  233. package/views/docs/index.md +1 -0
  234. package/views/docs/install.md +2 -0
  235. package/views/docs/reference/controls.md +207 -0
  236. package/views/docs/reference/looks.md +77 -2
  237. package/views/docs/reference/views.md +10 -2
@@ -0,0 +1,55 @@
1
+ export declare const SPINNER_TOKENS: readonly [{
2
+ readonly name: "--vk-brand";
3
+ readonly kind: "colour";
4
+ readonly outright: "--background-brand-bold";
5
+ }, {
6
+ readonly name: "--vk-brand-subtler";
7
+ readonly kind: "colour";
8
+ readonly outright: "--background-brand-subtler";
9
+ }, {
10
+ readonly name: "--vk-duration-fast";
11
+ readonly kind: "motion";
12
+ readonly outright: "--duration-fast";
13
+ }, {
14
+ readonly name: "--vk-duration-base";
15
+ readonly kind: "motion";
16
+ readonly outright: "--duration-base";
17
+ }, {
18
+ readonly name: "--vk-ease-out";
19
+ readonly kind: "motion";
20
+ readonly outright: "--ease-out";
21
+ }, {
22
+ readonly name: "--vk-ease-in-out";
23
+ readonly kind: "motion";
24
+ readonly outright: "--ease-in-out";
25
+ }, {
26
+ readonly name: "--vk-loading-dim";
27
+ readonly kind: "motion";
28
+ readonly outright: "--loading-dim";
29
+ }, {
30
+ readonly name: "--vk-progress-slide";
31
+ readonly kind: "motion";
32
+ readonly outright: "--progress-slide";
33
+ }, {
34
+ readonly name: "--vk-radius-full";
35
+ readonly kind: "size";
36
+ readonly outright: "--radius-full";
37
+ }, {
38
+ readonly name: "--vk-spacing";
39
+ readonly kind: "size";
40
+ readonly outright: "--spacing";
41
+ }, {
42
+ readonly name: "--vk-spinner-breath";
43
+ readonly kind: "motion";
44
+ readonly outright: "--spinner-breath";
45
+ }, {
46
+ readonly name: "--vk-spinner-turn";
47
+ readonly kind: "motion";
48
+ readonly outright: "--spinner-turn";
49
+ }, {
50
+ readonly name: "--vk-spinner-turn-reduced";
51
+ readonly kind: "motion";
52
+ readonly outright: "--spinner-turn-reduced";
53
+ }];
54
+ /** The prefixes of the spinner's own machinery, set and read by it alone: not public. */
55
+ export declare const SPINNER_PRIVATE: readonly ["--o-spinner-", "--o-loading-"];
@@ -0,0 +1,16 @@
1
+ export const SPINNER_TOKENS = [
2
+ { name: "--vk-brand", kind: "colour", outright: "--background-brand-bold" },
3
+ { name: "--vk-brand-subtler", kind: "colour", outright: "--background-brand-subtler" },
4
+ { name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
5
+ { name: "--vk-duration-base", kind: "motion", outright: "--duration-base" },
6
+ { name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
7
+ { name: "--vk-ease-in-out", kind: "motion", outright: "--ease-in-out" },
8
+ { name: "--vk-loading-dim", kind: "motion", outright: "--loading-dim" },
9
+ { name: "--vk-progress-slide", kind: "motion", outright: "--progress-slide" },
10
+ { name: "--vk-radius-full", kind: "size", outright: "--radius-full" },
11
+ { name: "--vk-spacing", kind: "size", outright: "--spacing" },
12
+ { name: "--vk-spinner-breath", kind: "motion", outright: "--spinner-breath" },
13
+ { name: "--vk-spinner-turn", kind: "motion", outright: "--spinner-turn" },
14
+ { name: "--vk-spinner-turn-reduced", kind: "motion", outright: "--spinner-turn-reduced" },
15
+ ];
16
+ export const SPINNER_PRIVATE = ["--o-spinner-", "--o-loading-"];
@@ -0,0 +1,147 @@
1
+ /* The Spinner, as its card draws it: something on its way, on a 50-unit drawing,
2
+ in the colour of the words beside it. Its line is about an eighth of its size (--o-spinner-l, the drawing's own stroke,
3
+ spinner.tsx). Every kind's parts are in the drawing; this file shows the one the frame or the app around it picks (looks.ts,
4
+ data-spinner-kind, -breath, -line, -track, -bars) and hides the rest. With nothing picked it is the tail, and the loading
5
+ bar's ends are soft: the Outright look's picks. The arc, which a frame names, turns
6
+ once every spinner-turn while its length breathes every spinner-breath, starting a quarter turn and half a breath in, so
7
+ the first frame already shows the arc, never a dot. Every look's pace is a share of those two tokens; the lengths along the
8
+ ring, the bars' heights and the pulse's reach are the drawing's geometry, not tokens.
9
+
10
+ The loading bar is the Spinner's own: a thin bar sliding along the top of what is loading again, which dims to
11
+ loading-dim under it. Its pace is a share of progress-slide, the Progress's bar with no total.
12
+
13
+ The rules sit in the components layer, so a utility class on a spinner still wins. */
14
+ @layer components {
15
+
16
+ /* ── The arc, as a frame that names a kind other than the tail draws it (nothing picked is the tail, below) ─────────────────────────────────────────────────────────────────────── */
17
+ .o-spinner {
18
+ --o-spinner-turn: var(--vk-spinner-turn); --o-spinner-breath: var(--vk-spinner-breath); --o-spinner-weight: 1;
19
+ flex: none; display: inline-block; color: inherit;
20
+ animation: vk-spin-turn var(--o-spinner-turn) linear infinite; animation-delay: calc(var(--o-spinner-turn) * -0.25);
21
+ }
22
+ .o-spinner > :is(.o-spinner-track, .o-spinner-arc) { fill: none; stroke: currentColor; stroke-width: calc(var(--o-spinner-l) * var(--o-spinner-weight) * 1px); }
23
+ .o-spinner > :is(.o-spinner-track, .o-spinner-bars, .o-spinner-dot, .o-spinner-ring) { display: none; }
24
+ .o-spinner-track { opacity: 0.14; }
25
+ .o-spinner-arc {
26
+ stroke-linecap: round; stroke-dasharray: 1 200; stroke-dashoffset: 0;
27
+ animation: vk-spin-breath var(--o-spinner-breath) linear infinite; animation-delay: calc(var(--o-spinner-breath) * -0.5);
28
+ }
29
+
30
+ /* ── Breath, the arc's. Slower: the same at two thirds of its speed. Never a dot: the same two beats, eased, between an eighth
31
+ and five eighths of the ring. Soft: both ends ease out and back round a middle that turns steadily. Barely: the same,
32
+ between a third and a half of the ring ───────────────────────────────────────────────────────────────────────── */
33
+ [data-spinner-breath="slow"] .o-spinner { --o-spinner-turn: calc(var(--vk-spinner-turn) * 1.45); --o-spinner-breath: calc(var(--vk-spinner-breath) * 1.45); }
34
+ [data-spinner-breath="open"] .o-spinner { --o-spinner-turn: calc(var(--vk-spinner-turn) * 2.2); --o-spinner-breath: calc(var(--vk-spinner-breath) * 1.6); }
35
+ [data-spinner-breath="soft"] .o-spinner { --o-spinner-turn: calc(var(--vk-spinner-turn) * 0.8); --o-spinner-breath: calc(var(--vk-spinner-breath) * 1.85); }
36
+ [data-spinner-breath="barely"] .o-spinner { --o-spinner-turn: calc(var(--vk-spinner-turn) * 0.7); --o-spinner-breath: calc(var(--vk-spinner-breath) * 2.15); }
37
+ [data-spinner-breath="open"] .o-spinner-arc { animation-name: vk-spin-open; animation-timing-function: var(--vk-ease-in-out); }
38
+ [data-spinner-breath="soft"] .o-spinner-arc { animation-name: vk-spin-soft; animation-timing-function: var(--vk-ease-in-out); }
39
+ [data-spinner-breath="barely"] .o-spinner-arc { animation-name: vk-spin-barely; animation-timing-function: var(--vk-ease-in-out); }
40
+
41
+ /* ── Line and Track, a ring's: its line lighter, and a faint ring under it ──────────────────────────────────────── */
42
+ [data-spinner-line="thin"] .o-spinner { --o-spinner-weight: 0.65; }
43
+ [data-spinner-track="faint"] .o-spinner > .o-spinner-track { display: inline; }
44
+
45
+ /* ── Kind. These come after Breath, so a kind that isn't the arc takes its own pace and stills the arc's breath.
46
+ Tail: the ring fading out behind its head, steady, only its place changing. The fade is painted on the drawing's own box
47
+ and cut to the ring's line; the arc is its round head, a dot where the fade ends.
48
+ Two halves: two arcs a fifth of the ring each, opposite each other, turning slowly ─────────────────────────────── */
49
+ [data-spinner-kind="tail"] .o-spinner, .o-spinner:not([data-spinner-kind] *) {
50
+ --o-spinner-turn: calc(var(--vk-spinner-turn) * 0.65);
51
+ --o-spinner-in: calc((20 - var(--o-spinner-l) * var(--o-spinner-weight) / 2) * 4%); --o-spinner-out: calc((20 + var(--o-spinner-l) * var(--o-spinner-weight) / 2) * 4%);
52
+ border-radius: var(--vk-radius-full);
53
+ background-image: conic-gradient(transparent 0turn, color-mix(in srgb, currentColor 48%, transparent) 0.133turn, color-mix(in srgb, currentColor 73%, transparent) 0.267turn,
54
+ color-mix(in srgb, currentColor 86%, transparent) 0.4turn, color-mix(in srgb, currentColor 93%, transparent) 0.533turn, transparent 0.533turn);
55
+ -webkit-mask-image: radial-gradient(farthest-side, transparent calc(var(--o-spinner-in) - 0.5px), black var(--o-spinner-in), black var(--o-spinner-out), transparent calc(var(--o-spinner-out) + 0.5px));
56
+ mask-image: radial-gradient(farthest-side, transparent calc(var(--o-spinner-in) - 0.5px), black var(--o-spinner-in), black var(--o-spinner-out), transparent calc(var(--o-spinner-out) + 0.5px));
57
+ }
58
+ [data-spinner-kind="tail"] .o-spinner-arc, .o-spinner-arc:not([data-spinner-kind] *) { animation: none; stroke-dasharray: 0.01 200; stroke-dashoffset: -35.57; }
59
+ [data-spinner-kind="halves"] .o-spinner { --o-spinner-turn: calc(var(--vk-spinner-turn) * 1.1); }
60
+ [data-spinner-kind="halves"] .o-spinner-arc { animation: none; stroke-dasharray: 25.13 37.7; stroke-dashoffset: 0; }
61
+
62
+ /* Bars and the pulse stand still as a whole: only their parts move. */
63
+ :is([data-spinner-kind="bars"], [data-spinner-kind="pulse"]) .o-spinner { animation: none; }
64
+ :is([data-spinner-kind="bars"], [data-spinner-kind="pulse"]) .o-spinner > :is(.o-spinner-track, .o-spinner-arc) { display: none; }
65
+
66
+ /* Bars: three growing from their middle, from three eighths of their height to all of it, one beat every half turn, each a
67
+ fifth of a beat after the one before. Eased: each bar slows at its ends, one beat a breath. From the foot: five, from a
68
+ fifth of their height, each at its own pace (--o-spinner-pace) and place in it (--o-spinner-at) */
69
+ [data-spinner-kind="bars"]:not([data-spinner-bars="foot"]) .o-spinner > .o-spinner-bars:not(.o-spinner-foot),
70
+ [data-spinner-kind="bars"][data-spinner-bars="foot"] .o-spinner > .o-spinner-foot { display: inline; }
71
+ .o-spinner-bars > rect {
72
+ --o-spinner-beat: calc(var(--vk-spinner-turn) * 0.5);
73
+ fill: currentColor; transform-box: fill-box; transform-origin: center;
74
+ animation: vk-spin-bar var(--o-spinner-beat) linear infinite; animation-delay: calc(var(--o-spinner-beat) * var(--o-spinner-at));
75
+ }
76
+ [data-spinner-bars="eased"] .o-spinner-bars > rect { --o-spinner-beat: var(--vk-spinner-breath); animation-timing-function: var(--vk-ease-in-out); }
77
+ .o-spinner-foot > rect {
78
+ --o-spinner-beat: calc(var(--vk-spinner-breath) * var(--o-spinner-pace)); transform-origin: 50% 100%;
79
+ animation-name: vk-spin-foot; animation-timing-function: var(--vk-ease-in-out); animation-delay: calc(var(--vk-spinner-breath) * var(--o-spinner-at));
80
+ }
81
+
82
+ /* The pulse: a dot, and a ring that leaves it and fades, once every four fifths of a turn. */
83
+ [data-spinner-kind="pulse"] .o-spinner > :is(.o-spinner-dot, .o-spinner-ring) { display: inline; }
84
+ .o-spinner-dot { fill: currentColor; }
85
+ .o-spinner-ring {
86
+ --o-spinner-beat: calc(var(--vk-spinner-turn) * 0.8);
87
+ fill: none; stroke: currentColor; stroke-width: 3.33px; opacity: 0;
88
+ animation: vk-spin-ring var(--o-spinner-beat) var(--vk-ease-out) infinite, vk-spin-fade var(--o-spinner-beat) linear infinite;
89
+ }
90
+
91
+ /* ── The loading bar: along the top of the box that holds what is loading again, half a spacing step high, in the brand. A
92
+ third of it slides across, in the Progress's time and on its curve; under Loading bar › Soft ends (data-spinner-loading)
93
+ a longer piece fades out at both ends and takes a little longer. What it holds dims to loading-dim, quickly, and comes
94
+ back in duration-base ────────────────────────────────────────────────────────────────────────────────────────── */
95
+ .o-loading { position: relative; min-width: 0; }
96
+ .o-loading-bar { --o-loading-share: 0.35; position: absolute; inset: 0 0 auto 0; z-index: 1; display: block; height: calc(var(--vk-spacing) * 0.5); overflow: hidden; pointer-events: none; }
97
+ .o-loading-bar::before {
98
+ content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--o-loading-share) * 100%); background-color: var(--vk-brand);
99
+ animation: vk-loading-slide calc(var(--vk-progress-slide) * 0.85) var(--vk-ease-in-out) infinite;
100
+ }
101
+ [data-spinner-loading="soft"] .o-loading-bar, .o-loading-bar:not([data-spinner-loading] *) { --o-loading-share: 0.48; }
102
+ [data-spinner-loading="soft"] .o-loading-bar::before, .o-loading-bar:not([data-spinner-loading] *)::before {
103
+ background-color: transparent; animation-duration: calc(var(--vk-progress-slide) * 1.15);
104
+ background-image: linear-gradient(90deg, transparent, color-mix(in srgb, var(--vk-brand) 50%, transparent) 17%, color-mix(in srgb, var(--vk-brand) 75%, transparent) 33%,
105
+ color-mix(in srgb, var(--vk-brand) 88%, transparent) 46% 54%, color-mix(in srgb, var(--vk-brand) 75%, transparent) 67%, color-mix(in srgb, var(--vk-brand) 50%, transparent) 83%, transparent);
106
+ }
107
+ .o-loading-held { min-width: 0; transition: opacity var(--vk-duration-base) var(--vk-ease-out); }
108
+ .o-loading[data-loading] > .o-loading-held { opacity: var(--vk-loading-dim); transition-duration: var(--vk-duration-fast); }
109
+
110
+ /* Under reduced motion a ring stops breathing and turns slowly, the bars and the pulse stand still, and the loading bar stands
111
+ across its box in the pale blue, as the Progress's does. */
112
+ @media (prefers-reduced-motion: reduce) {
113
+ .o-spinner { animation-duration: var(--vk-spinner-turn-reduced); }
114
+ .o-spinner-arc { stroke-dasharray: 80 200; }
115
+ :is(.o-spinner-arc, [data-spinner-breath] .o-spinner-arc) { animation: none; }
116
+ :is(.o-spinner-bars, [data-spinner-bars] .o-spinner-bars) > rect { animation: none; }
117
+ .o-spinner-bars > rect:nth-child(odd) { transform: scaleY(0.6); }
118
+ .o-spinner-ring { animation: none; opacity: 0.4; }
119
+ .o-loading-bar::before, [data-spinner-loading] .o-loading-bar::before, .o-loading-bar:not([data-spinner-loading] *)::before { animation: none; width: 100%; background-image: none; background-color: var(--vk-brand-subtler); }
120
+ .o-loading-held { transition: none; }
121
+ }
122
+ }
123
+ @keyframes vk-spin-turn { to { transform: rotate(360deg); } }
124
+ @keyframes vk-spin-breath {
125
+ 0% { stroke-dasharray: 1 200; stroke-dashoffset: 0; }
126
+ 50% { stroke-dasharray: 90 200; stroke-dashoffset: -35; }
127
+ 100% { stroke-dasharray: 90 200; stroke-dashoffset: -124; }
128
+ }
129
+ /* The ring is 125.66 long: these lengths and the gaps after them add up to it, so an arc that passes the ring's start goes on. */
130
+ @keyframes vk-spin-open {
131
+ 0% { stroke-dasharray: 15.08 110.58; stroke-dashoffset: 0; }
132
+ 50% { stroke-dasharray: 77.91 47.75; stroke-dashoffset: -30.16; }
133
+ 100% { stroke-dasharray: 15.08 110.58; stroke-dashoffset: -125.66; }
134
+ }
135
+ @keyframes vk-spin-soft {
136
+ 0%, 100% { stroke-dasharray: 27.65 98.02; stroke-dashoffset: 13.82; }
137
+ 50% { stroke-dasharray: 72.89 52.78; stroke-dashoffset: 36.44; }
138
+ }
139
+ @keyframes vk-spin-barely {
140
+ 0%, 100% { stroke-dasharray: 42.73 82.94; stroke-dashoffset: 21.36; }
141
+ 50% { stroke-dasharray: 62.83 62.83; stroke-dashoffset: 31.42; }
142
+ }
143
+ @keyframes vk-spin-bar { 0%, 100% { transform: scaleY(0.375); } 50% { transform: scaleY(1); } }
144
+ @keyframes vk-spin-foot { 0%, 100% { transform: scaleY(0.22); } 50% { transform: scaleY(1); } }
145
+ @keyframes vk-spin-ring { from { r: 8.33px; } to { r: 21.88px; } }
146
+ @keyframes vk-spin-fade { from { opacity: 0.7; } to { opacity: 0; } }
147
+ @keyframes vk-loading-slide { from { transform: translateX(-100%); } to { transform: translateX(calc(100% / var(--o-loading-share))); } }
@@ -0,0 +1,10 @@
1
+ import type { ViewsStatusBadgeProps } from "../../atoms/types.js";
2
+ import { type StatusPlace } from "./status.js";
3
+ type StatusSlot = ViewsStatusBadgeProps["slot"];
4
+ /** Where a status of a slot stands on the Status's path. */
5
+ export declare const statusPlaceOf: (slot: StatusSlot) => StatusPlace;
6
+ /** A step between, at its quarters among the steps between (`steps`, in their order). */
7
+ export declare function quartersOf<T>(steps: readonly T[], at: T): 1 | 2 | 3;
8
+ /** The StatusBadge atom: the Status at its slot's place. */
9
+ export declare function StatusBadgeAtom({ slot, label, place, size, className }: ViewsStatusBadgeProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cx } from "../../internal/cx.js";
3
+ import { Status } from "./status.js";
4
+ const PLACE = { pending: "start", running: "between", primary: "between", success: "won", error: "lost", warning: "risk", muted: "archived" };
5
+ export const statusPlaceOf = (slot) => PLACE[slot];
6
+ export function quartersOf(steps, at) {
7
+ return Math.min(3, Math.max(1, Math.round((4 * (steps.indexOf(at) + 1)) / (steps.length + 1))));
8
+ }
9
+ export function StatusBadgeAtom({ slot, label, place, size, className }) {
10
+ const at = statusPlaceOf(slot), steps = place?.options.filter((o) => o.slot && statusPlaceOf(o.slot) === "between") ?? [];
11
+ const here = place?.options[place.index], quarters = at === "between" && here && steps.includes(here) ? quartersOf(steps, here) : 2;
12
+ return _jsx(Status, { place: at, quarters: quarters, size: "md", className: cx(size === "row" && "vk-status-row", className), children: label });
13
+ }
@@ -0,0 +1,4 @@
1
+ import type { PieceLooks } from "../../looks/looks.js";
2
+ export type StatusLookOptionId = "mark" | "shape" | "colour" | "path";
3
+ /** The Status's options and looks. */
4
+ export declare const STATUS_LOOKS: PieceLooks<StatusLookOptionId>;
@@ -0,0 +1,22 @@
1
+ const options = [
2
+ { id: "mark", name: "Mark", def: "dot", values: [{ id: "quarters", name: "Today’s ring" }, { id: "none", name: "None" }, { id: "linear", name: "After Linear" }, { id: "segments", name: "Steps in the ring" }, { id: "progress", name: "A ring that grows" }, { id: "pie", name: "A pie" }, { id: "square", name: "A square" }, { id: "dot", name: "A dot" }, { id: "dots", name: "Dots in a row" }, { id: "bar", name: "A short bar" }, { id: "signal", name: "Rising bars" }, { id: "number", name: "The step’s number" }, { id: "stroke", name: "A stroke" }] },
3
+ { id: "shape", name: "Shape", def: "tint", values: [{ id: "bare", name: "Bare" }, { id: "coloured", name: "Word in colour" }, { id: "tint", name: "Pale pill" }, { id: "edged", name: "Edged pill" }, { id: "quiet", name: "Quiet pill" }, { id: "solid", name: "Solid" }, { id: "lozenge", name: "Lozenge" }, { id: "tag", name: "Square tag" }, { id: "alone", name: "Mark alone" }] },
4
+ { id: "colour", name: "Colour", def: "meaning", values: [{ id: "meaning", name: "By meaning" }, { id: "step", name: "Each step its own" }, { id: "deeper", name: "Deeper as it goes" }, { id: "quiet", name: "Quiet until the end" }, { id: "groups", name: "Three groups" }] },
5
+ { id: "path", name: "Along the path", def: "none", values: [{ id: "none", name: "None" }, { id: "under", name: "Steps under" }, { id: "before", name: "A small path" }, { id: "words", name: "In words" }, { id: "time", name: "Time there" }] },
6
+ ];
7
+ const base = { mark: "quarters", shape: "bare", colour: "meaning", path: "none" };
8
+ export const STATUS_LOOKS = {
9
+ id: "status",
10
+ name: "Status",
11
+ options,
12
+ looks: [
13
+ { id: "today", name: "Today’s", picks: { ...base } },
14
+ { id: "linear", name: "Linear", picks: { ...base, mark: "linear", colour: "quiet" } },
15
+ { id: "attio", name: "Attio", picks: { ...base, mark: "dot", colour: "step" } },
16
+ { id: "stripe", name: "Stripe", picks: { ...base, shape: "tint", mark: "dot" } },
17
+ { id: "github", name: "GitHub", picks: { ...base, shape: "edged", mark: "dot" } },
18
+ { id: "jira", name: "Jira", picks: { ...base, shape: "lozenge", mark: "none", colour: "groups" } },
19
+ { id: "notion", name: "Notion", picks: { ...base, shape: "tint", mark: "dot", colour: "groups" } },
20
+ { id: "monday", name: "monday.com", picks: { ...base, shape: "solid", mark: "none", colour: "step" } },
21
+ ],
22
+ };
@@ -0,0 +1,26 @@
1
+ import type { StatusPlace } from "./status.js";
2
+ export declare const MARKS: readonly ["quarters", "linear", "segments", "progress", "pie", "square", "dot", "dots", "bar", "signal", "number", "stroke"];
3
+ export type MarkId = (typeof MARKS)[number];
4
+ /** on: a line in the colour; off: the same, faint; fill: filled in the colour; cut: a tick, a cross or a sign cut out of the fill
5
+ * in the ground the status stands on; ink: a sign drawn in the colour; num: the step's number. width: the box's width, its height
6
+ * 16. butt: its lines end square, where its arcs keep gaps between them. spinner: the Spinner stands in it. */
7
+ export interface MarkDrawing {
8
+ width: number;
9
+ on?: string;
10
+ onWidth?: number;
11
+ dash?: string;
12
+ off?: string;
13
+ offWidth?: number;
14
+ offDash?: string;
15
+ fill?: string;
16
+ cut?: string;
17
+ ink?: string;
18
+ markWidth?: number;
19
+ num?: string;
20
+ butt?: boolean;
21
+ spinner?: boolean;
22
+ }
23
+ export declare const isDealPlace: (place: StatusPlace) => boolean;
24
+ export declare const stepOf: (place: StatusPlace, quarters?: 1 | 2 | 3) => number;
25
+ /** What a mark draws for a place. "own" is a kind's place's own mark. */
26
+ export declare function markOf(mark: MarkId | "own", place: StatusPlace, quarters?: 1 | 2 | 3): MarkDrawing;
@@ -0,0 +1,73 @@
1
+ export const MARKS = ["quarters", "linear", "segments", "progress", "pie", "square", "dot", "dots", "bar", "signal", "number", "stroke"];
2
+ const r2 = (n) => Math.round(n * 100) / 100;
3
+ const circ = (cx, cy, r) => `M${r2(cx + r)} ${cy}a${r} ${r} 0 1 1 ${r2(-2 * r)} 0a${r} ${r} 0 1 1 ${r2(2 * r)} 0`;
4
+ const pt = (r, t) => { const a = t * 2 * Math.PI - Math.PI / 2; return `${r2(8 + r * Math.cos(a))} ${r2(8 + r * Math.sin(a))}`; };
5
+ const arc = (r, t0, t1) => `M${pt(r, t0)}A${r} ${r} 0 ${t1 - t0 > 0.5 ? 1 : 0} 1 ${pt(r, t1)}`;
6
+ const pie = (r, fr) => (fr >= 1 ? circ(8, 8, r) : `M8 8V${r2(8 - r)}A${r} ${r} 0 ${fr > 0.5 ? 1 : 0} 1 ${pt(r, fr)}Z`);
7
+ const TICK = "M5.2 8.2l1.9 1.9 3.7-3.8", CROSS = "M6 6l4 4M10 6l-4 4", BANG = "M8 5v3.5M8 11h.01";
8
+ const QUARTER = ["", "M8 4a4 4 0 0 1 4 4h-4z", "M8 4a4 4 0 0 1 0 8z", "M8 4a4 4 0 1 1 -4 4h4z"];
9
+ const SQUARE = "M4 2.25h8a1.75 1.75 0 0 1 1.75 1.75v8a1.75 1.75 0 0 1-1.75 1.75h-8a1.75 1.75 0 0 1-1.75-1.75v-8a1.75 1.75 0 0 1 1.75-1.75z";
10
+ const SQUARE_FULL = "M4 1.5h8a2.5 2.5 0 0 1 2.5 2.5v8a2.5 2.5 0 0 1-2.5 2.5h-8a2.5 2.5 0 0 1-2.5-2.5v-8a2.5 2.5 0 0 1 2.5-2.5z";
11
+ const DASHED = { width: 16, on: circ(8, 8, 6), onWidth: 1.5, dash: "1.6 1.54" };
12
+ const OWN = {
13
+ "queued": DASHED,
14
+ "running": { width: 16, spinner: true },
15
+ "succeeded": { width: 16, fill: circ(8, 8, 7), cut: TICK },
16
+ "failed": { width: 16, fill: circ(8, 8, 7), cut: CROSS },
17
+ "cancelled": { width: 16, fill: circ(8, 8, 7), cut: "M5.5 10.5l5-5" },
18
+ "skipped": { width: 16, on: circ(8, 8, 6), onWidth: 1.5, ink: "M5.75 10.25l4.5-4.5", markWidth: 1.5 },
19
+ "on-track": { width: 16, fill: circ(8, 8, 7), cut: "M4.6 10.2 7.1 7.7l1.8 1.8 2.6-2.9" },
20
+ "at-risk": { width: 16, fill: circ(8, 8, 7), cut: BANG },
21
+ "off-track": { width: 16, fill: circ(8, 8, 7), cut: "M4.6 6.2 7.1 8.7l1.8-1.8 2.6 2.9" },
22
+ "no-update": DASHED,
23
+ "draft": DASHED,
24
+ "scheduled": { width: 16, on: circ(8, 8, 6), onWidth: 1.5, ink: "M8 5v3.2l2 1.3", markWidth: 1.5 },
25
+ "live": { width: 16, fill: circ(8, 8, 3.5), off: circ(8, 8, 6.25), offWidth: 1.5 },
26
+ "paused": { width: 16, fill: circ(8, 8, 7), cut: "M6.5 5.75v4.5M9.5 5.75v4.5" },
27
+ "ended": { width: 16, fill: circ(8, 8, 7), cut: "M5.75 8h4.5" },
28
+ };
29
+ const DEAL = ["start", "between", "won", "lost", "risk", "archived"];
30
+ export const isDealPlace = (place) => DEAL.includes(place);
31
+ export const stepOf = (place, quarters = 2) => (place === "start" ? 1 : place === "between" ? quarters + 1 : place === "won" || place === "lost" ? 5 : 0);
32
+ export function markOf(mark, place, quarters = 2) {
33
+ if (mark === "own" || !isDealPlace(place))
34
+ return OWN[place] ?? DASHED;
35
+ const end = place === "won" || place === "lost", off = place === "risk" || place === "archived", n = stepOf(place, quarters);
36
+ const fr = place === "between" ? quarters / 4 : end ? 1 : 0, sign = place === "won" ? TICK : CROSS;
37
+ const lit = (ds) => ({ on: ds.filter((_, i) => !off && i < n).join("") || undefined, off: ds.filter((_, i) => off || i >= n).join("") || undefined });
38
+ switch (mark) {
39
+ case "quarters":
40
+ return end ? { width: 16, fill: circ(8, 8, 7), cut: sign } : { width: 16, on: circ(8, 8, 6), fill: place === "between" ? QUARTER[quarters] : undefined, ink: place === "risk" ? BANG : undefined, dash: place === "archived" ? "2.4 2.3" : undefined };
41
+ case "linear":
42
+ return end ? { width: 16, fill: circ(8, 8, 7), cut: sign, markWidth: 1.6 }
43
+ : { width: 16, on: circ(8, 8, 6), onWidth: 1.5, fill: place === "between" ? pie(3.25, fr) : undefined, ink: place === "risk" ? BANG : undefined, markWidth: 1.6, dash: place === "start" ? "1.6 1.54" : place === "archived" ? "0.01 2.6" : undefined };
44
+ case "segments":
45
+ return { width: 16, ...lit([0, 1, 2, 3, 4].map((i) => arc(6, i / 5 + 0.028, (i + 1) / 5 - 0.028))), butt: true, ink: end ? sign : place === "risk" ? BANG : undefined, markWidth: 1.6 };
46
+ case "progress":
47
+ return { width: 16, off: circ(8, 8, 6), offWidth: 2.25, onWidth: 2.25, offDash: place === "archived" ? "2.4 2.3" : undefined,
48
+ on: end ? circ(8, 8, 6) : place === "start" ? arc(6, 0, 0.004) : place === "between" ? arc(6, 0, fr) : undefined, ink: end ? sign : place === "risk" ? BANG : undefined, markWidth: 1.6 };
49
+ case "pie":
50
+ return end ? { width: 16, fill: circ(8, 8, 7), cut: sign }
51
+ : { width: 16, on: circ(8, 8, 6.25), onWidth: 1.5, fill: place === "between" ? pie(6.25, fr) : undefined, ink: place === "risk" ? BANG : undefined, dash: place === "archived" ? "2 1.93" : undefined };
52
+ case "square": {
53
+ const h = r2(8 * fr);
54
+ return end ? { width: 16, fill: SQUARE_FULL, cut: sign, markWidth: 1.8 }
55
+ : { width: 16, on: SQUARE, onWidth: 1.5, fill: place === "between" ? `M4 ${r2(12 - h)}h8v${h}h-8z` : undefined, ink: place === "risk" ? BANG : undefined, markWidth: 1.8, dash: place === "archived" ? "2 1.7" : undefined };
56
+ }
57
+ case "dot":
58
+ return place === "archived" ? { width: 9, on: circ(4.5, 8, 3), onWidth: 1.5 } : { width: 9, fill: circ(4.5, 8, 3.75) };
59
+ case "dots":
60
+ return { width: 28, ...lit([3, 8.5, 14, 19.5, 25].map((x) => `M${x} 8h0`)), onWidth: 4.2, offWidth: 4.2 };
61
+ case "bar": {
62
+ const q = end ? 1 : place === "start" ? 0.1 : place === "between" ? 0.15 + fr * 0.8 : 0;
63
+ return { width: 20, off: "M2 8H18", offWidth: 3, onWidth: 3, offDash: place === "archived" ? "2 2.6" : undefined, on: q ? `M2 8H${r2(2 + 16 * q)}` : undefined };
64
+ }
65
+ case "signal":
66
+ return { width: 16, ...lit([[2.5, 10.5], [6.17, 8], [9.83, 5.5], [13.5, 3]].map(([x, y]) => `M${x} 13.5V${y}`)), onWidth: 2.2, offWidth: 2.2 };
67
+ case "number":
68
+ return end ? { width: 16, fill: circ(8, 8, 7.25), cut: sign, markWidth: 1.7 }
69
+ : { width: 16, on: circ(8, 8, 6.75), onWidth: 1.25, num: place === "risk" ? "!" : place === "archived" ? undefined : String(n), dash: place === "archived" ? "1.8 1.7" : undefined };
70
+ case "stroke":
71
+ return { width: 6, on: "M3 3V13", onWidth: 3, dash: place === "archived" ? "1.5 2.2" : undefined };
72
+ }
73
+ }
@@ -0,0 +1,43 @@
1
+ import * as React from "react";
2
+ import type { OptionColour } from "../option/looks.js";
3
+ /** A deal's path: its start, a step between, its two ends, and off it at risk or archived. */
4
+ export type DealPlace = "start" | "between" | "won" | "lost" | "risk" | "archived";
5
+ /** Something that runs and can fail: an import, a sync, a send. */
6
+ export type RunPlace = "queued" | "running" | "succeeded" | "failed" | "cancelled" | "skipped";
7
+ /** How a project or an account is doing, said by a person. */
8
+ export type HealthPlace = "on-track" | "at-risk" | "off-track" | "no-update";
9
+ /** Something sent out or put live: a campaign, a page, a form. */
10
+ export type PublishedPlace = "draft" | "scheduled" | "live" | "paused" | "ended";
11
+ export type StatusPlace = DealPlace | RunPlace | HealthPlace | PublishedPlace;
12
+ export type StatusSize = "sm" | "md" | "lg" | "xl";
13
+ export interface StatusProps {
14
+ /** The step's word ("Negotiation"). */
15
+ children: React.ReactNode;
16
+ /** Its place: on a deal's path or off it, or a run's, a project's health's, or something published's. */
17
+ place: StatusPlace;
18
+ /** For a step between: how far along, in quarters (1, 2 or 3). */
19
+ quarters?: 1 | 2 | 3;
20
+ /** sm in a dense row or a cell, md in a list, lg at the top of a record, xl a record's head on a phone. */
21
+ size?: StatusSize;
22
+ /** The step's own colour, someone's pick, worn under Colour › Each step its own. */
23
+ colour?: OptionColour;
24
+ /** Its step of how many, for Along the path: unless given, the start 1, a step between its quarters + 1, its ends 5, of 5. */
25
+ step?: number;
26
+ steps?: number;
27
+ /** The step it was lost at, put at risk at or set aside from ("Negotiation"), for Along the path › In words. */
28
+ at?: string;
29
+ /** How long it has stood there ("12 days"), for Along the path › Time there. */
30
+ since?: string;
31
+ /** It has stood there too long: its time in the warning colour. */
32
+ stale?: boolean;
33
+ className?: string;
34
+ }
35
+ /** The mark alone, as a mark beside a step's name (a select's list, a menu's choices). */
36
+ export declare function StatusGlyph({ place, quarters, colour, className }: {
37
+ place: StatusPlace;
38
+ quarters?: 1 | 2 | 3;
39
+ colour?: OptionColour;
40
+ className?: string;
41
+ }): import("react/jsx-runtime").JSX.Element;
42
+ /** Where a record stands on its path: a mark that says how far along, and the word. */
43
+ export declare function Status({ children, place, quarters, size, colour, step, steps, at, since, stale, className }: StatusProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { cx } from "../../internal/cx.js";
3
+ import { Spinner } from "../spinner/spinner.js";
4
+ import { MARKS, isDealPlace, markOf, stepOf } from "./marks.js";
5
+ const SPINNER = { sm: 12, md: 14, lg: 16, xl: 18 };
6
+ function Drawing({ id, m, size }) {
7
+ if (m.spinner)
8
+ return _jsx("span", { className: "o-status-svg o-status-spin", "data-mark": id, children: _jsx(Spinner, { size: SPINNER[size], label: "" }) });
9
+ const cap = m.butt ? "butt" : undefined;
10
+ return (_jsxs("svg", { className: "o-status-svg", "data-mark": id, viewBox: `0 0 ${m.width} 16`, strokeWidth: 2, "aria-hidden": "true", style: m.width === 16 ? undefined : { "--st-w": m.width / 16 }, children: [m.off && _jsx("path", { className: "o-status-off", d: m.off, strokeWidth: m.offWidth, strokeDasharray: m.offDash, strokeLinecap: cap }), m.on && _jsx("path", { className: "o-status-on", d: m.on, strokeWidth: m.onWidth, strokeDasharray: m.dash, strokeLinecap: cap }), m.fill && _jsx("path", { className: "o-status-fill", d: m.fill }), m.cut && _jsx("path", { className: "o-status-mark", d: m.cut, strokeWidth: m.markWidth }), m.ink && _jsx("path", { className: "o-status-ink", d: m.ink, strokeWidth: m.markWidth }), m.num && _jsx("text", { className: "o-status-num", x: m.width / 2, y: "8.6", fontSize: 8.5, fontWeight: 700, textAnchor: "middle", dominantBaseline: "central", children: m.num })] }));
11
+ }
12
+ function Marks({ place, quarters, size }) {
13
+ if (!isDealPlace(place))
14
+ return _jsx(Drawing, { id: "own", m: markOf("own", place), size: size });
15
+ return _jsx(_Fragment, { children: MARKS.map((id) => _jsx(Drawing, { id: id, m: markOf(id, place, quarters), size: size }, id)) });
16
+ }
17
+ const placeAttrs = (place, quarters, colour) => ({ "data-place": place, "data-quarters": place === "between" ? quarters : undefined, "data-colour": colour });
18
+ export function StatusGlyph({ place, quarters = 2, colour, className }) {
19
+ return (_jsx("span", { className: cx("o-status o-status-glyph", className), ...placeAttrs(place, quarters, colour), children: _jsx(Marks, { place: place, quarters: quarters, size: "md" }) }));
20
+ }
21
+ export function Status({ children, place, quarters = 2, size = "md", colour, step, steps = 5, at, since, stale, className }) {
22
+ const deal = isDealPlace(place), n = step ?? stepOf(place, quarters), reached = place === "risk" || place === "archived" ? 0 : n;
23
+ const words = !deal || place === "won" ? null : place === "lost" ? (at ? `at ${at}` : null) : place === "risk" ? (at ? `· at ${at}` : null) : place === "archived" ? (at ? `· from ${at}` : null) : `· ${n} of ${steps}`;
24
+ const bars = (form) => (_jsx("span", { className: "o-status-path", "data-form": form, "aria-hidden": "true", children: Array.from({ length: steps }, (_, i) => _jsx("span", { "data-on": i < reached ? "" : undefined }, i)) }));
25
+ return (_jsxs("span", { className: cx("o-status", size !== "md" && `o-status-${size}`, className), ...placeAttrs(place, quarters, colour), "data-kit": "status", children: [_jsx(Marks, { place: place, quarters: quarters, size: size }), _jsx("span", { className: "o-status-word", children: children }), deal && bars("before"), deal && bars("under"), words && _jsx("span", { className: "o-status-more", "data-form": "words", children: words }), deal && since && _jsxs("span", { className: "o-status-more", "data-form": "time", "data-stale": stale ? "" : undefined, children: ["\u00B7 ", since] })] }));
26
+ }