@newtone-dev/ui-react-web 0.43.0 → 0.44.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 (229) hide show
  1. package/dist/app-frame/app-frame.css +16 -67
  2. package/dist/app-frame/control/control.d.ts +1 -0
  3. package/dist/app-frame/control/control.d.ts.map +1 -1
  4. package/dist/app-frame/control/control.js +3 -2
  5. package/dist/app-frame/control/control.js.map +1 -1
  6. package/dist/app-frame/launcher/launcher.d.ts +6 -2
  7. package/dist/app-frame/launcher/launcher.d.ts.map +1 -1
  8. package/dist/app-frame/launcher/launcher.js +12 -11
  9. package/dist/app-frame/launcher/launcher.js.map +1 -1
  10. package/dist/app-frame/main-menu/main-menu.js +2 -2
  11. package/dist/app-frame/main-menu/main-menu.js.map +1 -1
  12. package/dist/app-frame/menu/menu.d.ts +1 -0
  13. package/dist/app-frame/menu/menu.d.ts.map +1 -1
  14. package/dist/app-frame/menu/menu.js +3 -1
  15. package/dist/app-frame/menu/menu.js.map +1 -1
  16. package/dist/app-frame/parts.d.ts +3 -1
  17. package/dist/app-frame/parts.d.ts.map +1 -1
  18. package/dist/app-frame/parts.js +12 -4
  19. package/dist/app-frame/parts.js.map +1 -1
  20. package/dist/ask-button/ask-button.css +37 -0
  21. package/dist/ask-button/ask-button.d.ts +24 -0
  22. package/dist/ask-button/ask-button.d.ts.map +1 -0
  23. package/dist/ask-button/ask-button.js +19 -0
  24. package/dist/ask-button/ask-button.js.map +1 -0
  25. package/dist/ask-button/index.d.ts +3 -0
  26. package/dist/ask-button/index.d.ts.map +1 -0
  27. package/dist/ask-button/index.js +2 -0
  28. package/dist/ask-button/index.js.map +1 -0
  29. package/dist/badge/badge.css +44 -0
  30. package/dist/badge/badge.d.ts +16 -0
  31. package/dist/badge/badge.d.ts.map +1 -0
  32. package/dist/badge/badge.js +15 -0
  33. package/dist/badge/badge.js.map +1 -0
  34. package/dist/badge/index.d.ts +3 -0
  35. package/dist/badge/index.d.ts.map +1 -0
  36. package/dist/badge/index.js +2 -0
  37. package/dist/badge/index.js.map +1 -0
  38. package/dist/below/below.css +8 -10
  39. package/dist/below/below.d.ts +3 -4
  40. package/dist/below/below.d.ts.map +1 -1
  41. package/dist/below/below.js +10 -52
  42. package/dist/below/below.js.map +1 -1
  43. package/dist/below/grip.d.ts +20 -0
  44. package/dist/below/grip.d.ts.map +1 -0
  45. package/dist/below/grip.js +78 -0
  46. package/dist/below/grip.js.map +1 -0
  47. package/dist/canvas/box/box.d.ts +9 -2
  48. package/dist/canvas/box/box.d.ts.map +1 -1
  49. package/dist/canvas/box/box.js +2 -2
  50. package/dist/canvas/box/box.js.map +1 -1
  51. package/dist/canvas/canvas.css +105 -34
  52. package/dist/canvas/canvas.d.ts +9 -2
  53. package/dist/canvas/canvas.d.ts.map +1 -1
  54. package/dist/canvas/canvas.js +19 -6
  55. package/dist/canvas/canvas.js.map +1 -1
  56. package/dist/canvas/cells/cells.d.ts +3 -3
  57. package/dist/canvas/cells/cells.js +10 -9
  58. package/dist/canvas/cells/cells.js.map +1 -1
  59. package/dist/canvas/cells/grid.d.ts +32 -0
  60. package/dist/canvas/cells/grid.d.ts.map +1 -1
  61. package/dist/canvas/cells/grid.js +93 -1
  62. package/dist/canvas/cells/grid.js.map +1 -1
  63. package/dist/canvas/dock/dock.d.ts +6 -1
  64. package/dist/canvas/dock/dock.d.ts.map +1 -1
  65. package/dist/canvas/dock/dock.js +19 -3
  66. package/dist/canvas/dock/dock.js.map +1 -1
  67. package/dist/canvas/frame/frame.d.ts.map +1 -1
  68. package/dist/canvas/frame/frame.js +1 -7
  69. package/dist/canvas/frame/frame.js.map +1 -1
  70. package/dist/canvas/index.d.ts +2 -1
  71. package/dist/canvas/index.d.ts.map +1 -1
  72. package/dist/canvas/index.js.map +1 -1
  73. package/dist/canvas/insert/insert.d.ts +18 -0
  74. package/dist/canvas/insert/insert.d.ts.map +1 -0
  75. package/dist/canvas/insert/insert.js +40 -0
  76. package/dist/canvas/insert/insert.js.map +1 -0
  77. package/dist/canvas/pin/pin.d.ts.map +1 -1
  78. package/dist/canvas/pin/pin.js +2 -1
  79. package/dist/canvas/pin/pin.js.map +1 -1
  80. package/dist/chat/chat.css +2 -7
  81. package/dist/chat/chat.d.ts +5 -3
  82. package/dist/chat/chat.d.ts.map +1 -1
  83. package/dist/chat/chat.js +17 -24
  84. package/dist/chat/chat.js.map +1 -1
  85. package/dist/data-grid/data-grid.css +128 -0
  86. package/dist/data-grid/data-grid.d.ts +45 -0
  87. package/dist/data-grid/data-grid.d.ts.map +1 -0
  88. package/dist/data-grid/data-grid.js +50 -0
  89. package/dist/data-grid/data-grid.js.map +1 -0
  90. package/dist/data-grid/index.d.ts +3 -0
  91. package/dist/data-grid/index.d.ts.map +1 -0
  92. package/dist/data-grid/index.js +2 -0
  93. package/dist/data-grid/index.js.map +1 -0
  94. package/dist/discover/discover.css +60 -0
  95. package/dist/discover/discover.d.ts +33 -0
  96. package/dist/discover/discover.d.ts.map +1 -0
  97. package/dist/discover/discover.js +13 -0
  98. package/dist/discover/discover.js.map +1 -0
  99. package/dist/discover/index.d.ts +4 -0
  100. package/dist/discover/index.d.ts.map +1 -0
  101. package/dist/discover/index.js +3 -0
  102. package/dist/discover/index.js.map +1 -0
  103. package/dist/file-grid/file-grid.css +5 -0
  104. package/dist/file-grid/file-grid.d.ts +9 -2
  105. package/dist/file-grid/file-grid.d.ts.map +1 -1
  106. package/dist/file-grid/file-grid.js +5 -4
  107. package/dist/file-grid/file-grid.js.map +1 -1
  108. package/dist/floating-bar/floating-bar.css +20 -1
  109. package/dist/floating-bar/floating-bar.d.ts +16 -1
  110. package/dist/floating-bar/floating-bar.d.ts.map +1 -1
  111. package/dist/floating-bar/floating-bar.js +51 -46
  112. package/dist/floating-bar/floating-bar.js.map +1 -1
  113. package/dist/floating-bar/menu.d.ts +1 -0
  114. package/dist/floating-bar/menu.d.ts.map +1 -1
  115. package/dist/floating-bar/menu.js +12 -1
  116. package/dist/floating-bar/menu.js.map +1 -1
  117. package/dist/font-picker/font-picker.css +39 -0
  118. package/dist/font-picker/font-picker.d.ts +29 -0
  119. package/dist/font-picker/font-picker.d.ts.map +1 -0
  120. package/dist/font-picker/font-picker.js +119 -0
  121. package/dist/font-picker/font-picker.js.map +1 -0
  122. package/dist/font-picker/index.d.ts +3 -0
  123. package/dist/font-picker/index.d.ts.map +1 -0
  124. package/dist/font-picker/index.js +2 -0
  125. package/dist/font-picker/index.js.map +1 -0
  126. package/dist/hint/hint.css +55 -0
  127. package/dist/hint/hint.d.ts +33 -0
  128. package/dist/hint/hint.d.ts.map +1 -0
  129. package/dist/hint/hint.js +80 -0
  130. package/dist/hint/hint.js.map +1 -0
  131. package/dist/hint/index.d.ts +4 -0
  132. package/dist/hint/index.d.ts.map +1 -0
  133. package/dist/hint/index.js +3 -0
  134. package/dist/hint/index.js.map +1 -0
  135. package/dist/index.d.ts +27 -3
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +12 -0
  138. package/dist/index.js.map +1 -1
  139. package/dist/inspector/inspector.css +27 -0
  140. package/dist/inspector/inspector.d.ts +12 -1
  141. package/dist/inspector/inspector.d.ts.map +1 -1
  142. package/dist/inspector/inspector.js +6 -3
  143. package/dist/inspector/inspector.js.map +1 -1
  144. package/dist/look-picker/index.d.ts +3 -0
  145. package/dist/look-picker/index.d.ts.map +1 -0
  146. package/dist/look-picker/index.js +2 -0
  147. package/dist/look-picker/index.js.map +1 -0
  148. package/dist/look-picker/look-picker.css +90 -0
  149. package/dist/look-picker/look-picker.d.ts +40 -0
  150. package/dist/look-picker/look-picker.d.ts.map +1 -0
  151. package/dist/look-picker/look-picker.js +82 -0
  152. package/dist/look-picker/look-picker.js.map +1 -0
  153. package/dist/look-thumb/index.d.ts +3 -0
  154. package/dist/look-thumb/index.d.ts.map +1 -0
  155. package/dist/look-thumb/index.js +2 -0
  156. package/dist/look-thumb/index.js.map +1 -0
  157. package/dist/look-thumb/look-thumb.css +7 -0
  158. package/dist/look-thumb/look-thumb.d.ts +27 -0
  159. package/dist/look-thumb/look-thumb.d.ts.map +1 -0
  160. package/dist/look-thumb/look-thumb.js +15 -0
  161. package/dist/look-thumb/look-thumb.js.map +1 -0
  162. package/dist/material/index.d.ts +3 -0
  163. package/dist/material/index.d.ts.map +1 -0
  164. package/dist/material/index.js +2 -0
  165. package/dist/material/index.js.map +1 -0
  166. package/dist/material/material.css +306 -0
  167. package/dist/material/material.d.ts +43 -0
  168. package/dist/material/material.d.ts.map +1 -0
  169. package/dist/material/material.js +27 -0
  170. package/dist/material/material.js.map +1 -0
  171. package/dist/on-media/on-media.css +6 -6
  172. package/dist/prompt-field/index.d.ts +3 -0
  173. package/dist/prompt-field/index.d.ts.map +1 -0
  174. package/dist/prompt-field/index.js +2 -0
  175. package/dist/prompt-field/index.js.map +1 -0
  176. package/dist/prompt-field/prompt-field.css +203 -0
  177. package/dist/prompt-field/prompt-field.d.ts +72 -0
  178. package/dist/prompt-field/prompt-field.d.ts.map +1 -0
  179. package/dist/prompt-field/prompt-field.js +91 -0
  180. package/dist/prompt-field/prompt-field.js.map +1 -0
  181. package/dist/quick-action/index.d.ts +1 -1
  182. package/dist/quick-action/index.d.ts.map +1 -1
  183. package/dist/quick-action/quick-action.css +60 -17
  184. package/dist/quick-action/quick-action.d.ts +34 -28
  185. package/dist/quick-action/quick-action.d.ts.map +1 -1
  186. package/dist/quick-action/quick-action.js +25 -21
  187. package/dist/quick-action/quick-action.js.map +1 -1
  188. package/dist/row-list/row-list.css +3 -0
  189. package/dist/seed-color-field/index.d.ts +3 -0
  190. package/dist/seed-color-field/index.d.ts.map +1 -0
  191. package/dist/seed-color-field/index.js +2 -0
  192. package/dist/seed-color-field/index.js.map +1 -0
  193. package/dist/seed-color-field/seed-color-field.css +105 -0
  194. package/dist/seed-color-field/seed-color-field.d.ts +36 -0
  195. package/dist/seed-color-field/seed-color-field.d.ts.map +1 -0
  196. package/dist/seed-color-field/seed-color-field.js +103 -0
  197. package/dist/seed-color-field/seed-color-field.js.map +1 -0
  198. package/dist/skeleton/index.d.ts +3 -0
  199. package/dist/skeleton/index.d.ts.map +1 -0
  200. package/dist/skeleton/index.js +2 -0
  201. package/dist/skeleton/index.js.map +1 -0
  202. package/dist/skeleton/skeleton.css +84 -0
  203. package/dist/skeleton/skeleton.d.ts +50 -0
  204. package/dist/skeleton/skeleton.d.ts.map +1 -0
  205. package/dist/skeleton/skeleton.js +25 -0
  206. package/dist/skeleton/skeleton.js.map +1 -0
  207. package/dist/slide-list/index.d.ts +1 -1
  208. package/dist/slide-list/index.d.ts.map +1 -1
  209. package/dist/slide-list/slide-list.css +259 -22
  210. package/dist/slide-list/slide-list.d.ts +78 -1
  211. package/dist/slide-list/slide-list.d.ts.map +1 -1
  212. package/dist/slide-list/slide-list.js +264 -18
  213. package/dist/slide-list/slide-list.js.map +1 -1
  214. package/dist/split/split.css +8 -10
  215. package/dist/thread/thread.css +7 -39
  216. package/dist/thread/thread.d.ts.map +1 -1
  217. package/dist/thread/thread.js +44 -45
  218. package/dist/thread/thread.js.map +1 -1
  219. package/dist/tile-picker/tile-picker.css +18 -0
  220. package/dist/tile-picker/tile-picker.d.ts +12 -2
  221. package/dist/tile-picker/tile-picker.d.ts.map +1 -1
  222. package/dist/tile-picker/tile-picker.js +19 -4
  223. package/dist/tile-picker/tile-picker.js.map +1 -1
  224. package/dist/workbench/workbench.css +55 -16
  225. package/dist/workbench/workbench.d.ts +7 -2
  226. package/dist/workbench/workbench.d.ts.map +1 -1
  227. package/dist/workbench/workbench.js +8 -2
  228. package/dist/workbench/workbench.js.map +1 -1
  229. package/package.json +61 -1
@@ -3,7 +3,8 @@
3
3
  *
4
4
  * ---- the size is a ladder now, and the knob it replaced is deleted -------
5
5
  *
6
- * TWO RUNGS, 48 AND 56, `lg` BY DEFAULT -- which is the 3.5rem the deleted knob already held.
6
+ * FOUR RUNGS, 36, 40, 48 AND 56, `lg` (48) BY DEFAULT (Joshua 2026-11-11). Before that it had two,
7
+ * 48 and 56, and the default was 56, the 3.5rem the deleted knob already held.
7
8
  * `--newtone-quick-action-size` was one custom property a caller retuned in its own scope, taken
8
9
  * from `Avatar` rather than re-derived, on the reasoning that *a ladder sized from the call sites a
9
10
  * library happens to know about leaves the next one off every rung*.
@@ -12,7 +13,7 @@
12
13
  * sized from call sites: four components in this library had reached 44 and 56 on 14/20 and 16/24
13
14
  * separately, THIS ONE AMONG THEM, before there was a ladder to be a rung of. The knob is deleted
14
15
  * rather than kept beside `size` because two ways to say one thing is the shape this library
15
- * refuses, and it had no call sites at all -- issues/open/154, issues/open/201.
16
+ * refuses, and it had no call sites at all -- issues/done/154, issues/open/201.
16
17
  *
17
18
  * The reference narrows its circle on a phone inside the media query that hands its dock back,
18
19
  * which is a fact about that shell and not about this component: whatever pins the circle owns
@@ -32,18 +33,29 @@
32
33
  * follow the circle's ink through every state without the caller painting it -- the same three
33
34
  * lines `icon-link.css` spends for the same reason.
34
35
  *
35
- * ---- THERE IS NO SHADOW, and the component is weaker for it --------------
36
+ * ---- the lift is the glass's, and this sheet draws only the flat disc ----
36
37
  *
37
- * The reference lifts this circle on `--shadow-l` at rest and further on hover, on the argument
38
- * that a control on screen for a whole visit must separate itself by depth rather than by hue.
39
- * **Newtone has no shadow vocabulary and no motion vocabulary**, so the lift and the 2px translate
40
- * are both gone rather than hard-coded here. What separates the disc instead is a 1px rim, present
41
- * in every state so the box never changes size. On a busy ground that is genuinely less separation
42
- * than the reference achieves, and the fix is a token group rather than a declaration in this file. */
38
+ * Inside glass the disc is raised (Joshua 2026-11-11): the wash, the lit edge and the close shadow
39
+ * cast in black, written once in material.css, the only sheet that names them. Outside glass it
40
+ * is this sheet's flat disc, separated by a 1px rim present in every state so the box never
41
+ * changes size. `primary` takes a primary Button's fills.
42
+ *
43
+ * LENGTHS IT DECIDES:
44
+ * 36px `sm`, 40px `md`: two rungs the quick-action slice has no token for (its own two are 48
45
+ * and 56, Action's), so they are written here; contracts/button.md, *Sizes*
46
+ * 20px the mark on 36 and 40, 24px on 48 and 56: the glyph that pairs with each half of the
47
+ * ladder (14/20 and 16/24)
48
+ * 14.6% where a badge's centre stands in from the box's corner: on the outline at 45 degrees */
49
+
50
+ /* Its badge comes with it. */
51
+ @import '../badge/badge.css';
43
52
 
44
53
  .newtone-quick-action {
54
+ position: relative;
45
55
  display: inline-grid;
46
56
  place-items: center;
57
+ box-sizing: border-box;
58
+ --_badge-inset: 14.6%;
47
59
  /* THE RUNG SETS `--newtone-quick-action-box` BELOW and this reads it, so the disc is one
48
60
  * declaration per rung rather than a copy of the block. contracts/button.md, *Sizes*. */
49
61
  inline-size: var(--newtone-quick-action-box);
@@ -64,20 +76,34 @@
64
76
 
65
77
  /* ---- the rungs ----------------------------------------------------------
66
78
  *
67
- * 48 and 56, the same two `Action` takes. `--newtone-quick-action-size` was one knob a consumer
68
- * retuned and is deleted rather than kept beside these -- issues/open/201, and it had no call
69
- * sites. contracts/button.md, *Sizes*. */
79
+ * 36, 40, 48 and 56 (Joshua 2026-11-11). The token slice's `size.sm` (48) and `size.lg` (56) are
80
+ * this component's `lg` and `xl`; `--newtone-quick-action-size` was one knob a consumer retuned and
81
+ * is deleted rather than kept beside these -- issues/open/201. contracts/button.md, *Sizes*. */
70
82
  .newtone-quick-action--sm {
71
- --newtone-quick-action-box: var(--newtone-quick-action-size-sm);
83
+ --newtone-quick-action-box: 36px;
84
+ --_quick-action-mark: 20px;
85
+ }
86
+
87
+ .newtone-quick-action--md {
88
+ --newtone-quick-action-box: 40px;
89
+ --_quick-action-mark: 20px;
72
90
  }
73
91
 
74
92
  .newtone-quick-action--lg {
93
+ --newtone-quick-action-box: var(--newtone-quick-action-size-sm);
94
+ --_quick-action-mark: 24px;
95
+ }
96
+
97
+ .newtone-quick-action--xl {
75
98
  --newtone-quick-action-box: var(--newtone-quick-action-size-lg);
99
+ --_quick-action-mark: 24px;
76
100
  }
77
101
 
78
- .newtone-quick-action > * {
79
- inline-size: 1.5rem;
80
- block-size: 1.5rem;
102
+ /* The mark, whatever arrives: an `Icon` sizes itself (its `size` prop), anything else (a vendored svg) takes the
103
+ * rung's glyph. The badge is not the mark. */
104
+ .newtone-quick-action > :not(.newtone-badge, .newtone-icon) {
105
+ inline-size: var(--_quick-action-mark);
106
+ block-size: var(--_quick-action-mark);
81
107
  fill: currentColor;
82
108
  }
83
109
 
@@ -87,12 +113,29 @@
87
113
  border-color: var(--newtone-quick-action-hover-border);
88
114
  }
89
115
 
90
- .newtone-quick-action:active {
116
+ .newtone-quick-action:is(:active, [aria-pressed='true']) {
91
117
  background: var(--newtone-quick-action-pressed-fill);
92
118
  color: var(--newtone-quick-action-pressed-text);
93
119
  border-color: var(--newtone-quick-action-pressed-border);
94
120
  }
95
121
 
122
+ /* `primary`: a primary Button's fills, flat. */
123
+ .newtone-quick-action--primary {
124
+ background: var(--newtone-button-primary-rest-fill);
125
+ color: var(--newtone-button-primary-rest-text);
126
+ border-color: var(--newtone-button-primary-rest-border);
127
+ }
128
+ .newtone-quick-action--primary:hover {
129
+ background: var(--newtone-button-primary-hover-fill);
130
+ color: var(--newtone-button-primary-hover-text);
131
+ border-color: var(--newtone-button-primary-hover-border);
132
+ }
133
+ .newtone-quick-action--primary:is(:active, [aria-pressed='true']) {
134
+ background: var(--newtone-button-primary-pressed-fill);
135
+ color: var(--newtone-button-primary-pressed-text);
136
+ border-color: var(--newtone-button-primary-pressed-border);
137
+ }
138
+
96
139
  .newtone-quick-action:focus-visible {
97
140
  outline: 2px solid var(--newtone-quick-action-focus-ring);
98
141
  outline-offset: 2px;
@@ -1,17 +1,18 @@
1
1
  import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from 'react';
2
2
  /**
3
- * Two rungs of the ladder's five: **48 and 56**, the same two `Action` takes.
3
+ * Four rungs of the ladder's five: **36, 40, 48 and 56** (Joshua 2026-11-11, when it was revived as the general round
4
+ * action). Before, it had two, 48 and 56, the two `Action` takes; Action keeps those. Nothing rendered one, so the
5
+ * names moved for free: what was `sm` (48) is now `lg`, what was `lg` (56) is `xl`. contracts/button.md, *Sizes*.
4
6
  *
5
7
  * THIS COMPONENT ARGUED AGAINST A LADDER AND THE ARGUMENT WAS RIGHT. It shipped a single
6
8
  * `--newtone-quick-action-size` knob instead, on `Avatar`'s reasoning: *a ladder sized from the
7
- * call sites a library happens to know about leaves the next one off every rung.*
8
- *
9
- * WHAT CHANGED ON 2026-09-21 IS NOT THE ARGUMENT. It is that the ladder stopped being sized from
10
- * call sites -- four components in this library had reached 44 and 56 on 14/20 and 16/24
11
- * separately, **this one among them at 3.5rem, before there was a ladder to be a rung of**. Joining
12
- * costs no prediction. governance/code/a-controls-size-is-one-rung-and-the-rung-carries-everything.md.
9
+ * call sites a library happens to know about leaves the next one off every rung.* What changed on
10
+ * 2026-09-21 is that the ladder stopped being sized from call sites.
11
+ * governance/code/a-controls-size-is-one-rung-and-the-rung-carries-everything.md.
13
12
  */
14
- export type QuickActionSize = 'sm' | 'lg';
13
+ export type QuickActionSize = 'sm' | 'md' | 'lg' | 'xl';
14
+ /** `neutral` takes the ground's own colours; `primary` is the accent fill, a primary Button's. */
15
+ export type QuickActionVariant = 'neutral' | 'primary';
15
16
  interface QuickActionCommon {
16
17
  /**
17
18
  * The accessible name, and the only name this control has. **Never rendered** -- the mark is
@@ -25,11 +26,19 @@ interface QuickActionCommon {
25
26
  * ligature. A slot renders both; a name prop renders one.
26
27
  */
27
28
  children: ReactNode;
29
+ /** Which rung: 36, 40, 48 or 56. Defaults to `lg`, 48. */
30
+ size?: QuickActionSize;
31
+ /** `neutral` by default. */
32
+ variant?: QuickActionVariant;
28
33
  /**
29
- * Which rung: 48 or 56. Defaults to `lg`, which is 56 -- the value the deleted knob already
30
- * had, so nothing that renders one would move. Nothing renders one.
34
+ * On, it stays pressed (`aria-pressed`): what it opens is open. Left out, it is not a toggle. A link takes none.
31
35
  */
32
- size?: QuickActionSize;
36
+ pressed?: boolean;
37
+ /**
38
+ * Something waits behind it: `true` a dot, a number a count (99+ past 99), 0 or false nothing. A `Badge` on its
39
+ * outline at 45 degrees. Hidden from a screen reader, so `label` says the count ("Ask, 2 replies").
40
+ */
41
+ badge?: number | boolean;
33
42
  }
34
43
  export type QuickActionProps = QuickActionCommon & ((Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'aria-label'> & {
35
44
  href?: undefined;
@@ -52,17 +61,14 @@ export type QuickActionProps = QuickActionCommon & ((Omit<ButtonHTMLAttributes<H
52
61
  * That is issues/open/201 arriving early: a consumer writes no Newtone property, and what replaces
53
62
  * one is a prop.
54
63
  *
55
- * ---- NOTHING RENDERS ONE, and that is recorded rather than smoothed over --
64
+ * ---- it sat two months with nothing rendering it --------------------------
56
65
  *
57
66
  * **Ported 2026-09-16 from `~/Projects/Harbour Space/-harbour-space-design-system` with zero call
58
- * sites anywhere in this house.** It is the only component in this library in that position, and
59
- * the only one whose shape was settled by reading a reference rather than by a consumer pushing on
60
- * it -- which is the thing the preamble refuses, built anyway on an explicit decision after the
61
- * cost was put on the table. `production/newtone/ui_react-web/_issues/open/154-the-round-action-nothing-presses.md`.
62
- *
63
- * **So every refusal below is argued from the reference and from sibling components, and none of
64
- * them has been tested.** They may all be right. Whoever gives this a consumer should expect to
65
- * change some of them, which is what happened to `Control` within hours of it landing.
67
+ * sites anywhere in this house**, its shape settled by reading a reference rather than by a consumer
68
+ * pushing on it. `production/newtone/ui_react-web/_issues/done/154-the-round-action-nothing-presses.md`.
69
+ * Revived 2026-11-11 (Joshua) as the general round action: AskButton is one, and HuevOS People's
70
+ * "+" renders one. The refusals below were argued from the reference before any of that; expect a
71
+ * consumer to change some of them.
66
72
  *
67
73
  * ---- no brand variant ----------------------------------------------------
68
74
  *
@@ -71,18 +77,18 @@ export type QuickActionProps = QuickActionCommon & ((Omit<ButtonHTMLAttributes<H
71
77
  * a client, and a licensed asset lives with its licence holder -- *the library learns to express a
72
78
  * thing, it never carries it.* The slot above is what replaces it.
73
79
  *
74
- * ---- no `disabled`, and no shadow ----------------------------------------
80
+ * ---- no `disabled`; raised on glass, flat off it --------------------------
75
81
  *
76
82
  * `disabled` is absent for `Action`'s reason, which is stronger here: an unavailable action that is
77
83
  * on screen for the entire visit is worse than one that is not there.
78
84
  *
79
- * **The shadow is the one thing this visibly lost.** The reference's whole colour argument is that
80
- * the circle takes the surface's own ground and is lifted by depth rather than by hue, because it
81
- * must not compete with the page for a whole scroll. Newtone has no shadow vocabulary, so the lift
82
- * is dropped rather than hard-coded, and a rim does the separating instead. On a busy ground this
83
- * is genuinely weaker than the component it came from, and the fix is a vocabulary rather than
84
- * anything in this folder -- `newtone_ui_tokens.md` section 8, *Shadows, blur, spread*.
85
+ * **Inside glass it is raised** (Joshua 2026-11-11): the glass wash, the lit edge and the close
86
+ * shadow cast in black, which is the lift the reference had and this lost while Newtone had no
87
+ * shadow vocabulary. `primary` wears the accent glass; pressed, it sits down to the contact shadow.
88
+ * **Outside glass it is a flat disc** with a 1px rim. It reads the material from the DOM attribute
89
+ * (material.css), so it stays a server component. AskButton is this, `primary`, always on glass.
90
+ * Revived 2026-11-11, closing issues/done/154.
85
91
  */
86
- export declare function QuickAction({ label, children, size, className, ...rest }: QuickActionProps): import("react").JSX.Element;
92
+ export declare function QuickAction({ label, children, size, variant, pressed, badge, className, ...rest }: QuickActionProps): import("react").JSX.Element;
87
93
  export {};
88
94
  //# sourceMappingURL=quick-action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quick-action.d.ts","sourceRoot":"","sources":["../../src/quick-action/quick-action.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAElF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,CAAA;AAEzC,UAAU,iBAAiB;IACvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,eAAe,CAAA;CACzB;AAED,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAC5C,CACM,CAAC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC,GAAG;IACxE,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB,CAAC,GACF,CAAC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,YAAY,CAAC,GAAG;IACjF,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAA;CACf,CAAC,CACP,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,IAAW,EACX,SAAS,EACT,GAAG,IAAI,EACV,EAAE,gBAAgB,+BA2BlB"}
1
+ {"version":3,"file":"quick-action.d.ts","sourceRoot":"","sources":["../../src/quick-action/quick-action.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGlF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEvD,kGAAkG;AAClG,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,CAAA;AAEtD,UAAU,iBAAiB;IACvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3B;AAED,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAC5C,CACM,CAAC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC,GAAG;IACxE,IAAI,CAAC,EAAE,SAAS,CAAA;CACnB,CAAC,GACF,CAAC,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,YAAY,CAAC,GAAG;IACjF,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAA;CACf,CAAC,CACP,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,IAAW,EACX,OAAmB,EACnB,OAAO,EACP,KAAK,EACL,SAAS,EACT,GAAG,IAAI,EACV,EAAE,gBAAgB,+BAoClB"}
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Badge } from '../badge/badge.js';
2
3
  /**
3
4
  * One round action a page keeps within reach for a whole visit -- a chat entry, a back to top, a
4
5
  * help button. `Action`'s persistent sibling: an action is a moment a reader arrives at, this is on
@@ -14,17 +15,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
15
  * That is issues/open/201 arriving early: a consumer writes no Newtone property, and what replaces
15
16
  * one is a prop.
16
17
  *
17
- * ---- NOTHING RENDERS ONE, and that is recorded rather than smoothed over --
18
+ * ---- it sat two months with nothing rendering it --------------------------
18
19
  *
19
20
  * **Ported 2026-09-16 from `~/Projects/Harbour Space/-harbour-space-design-system` with zero call
20
- * sites anywhere in this house.** It is the only component in this library in that position, and
21
- * the only one whose shape was settled by reading a reference rather than by a consumer pushing on
22
- * it -- which is the thing the preamble refuses, built anyway on an explicit decision after the
23
- * cost was put on the table. `production/newtone/ui_react-web/_issues/open/154-the-round-action-nothing-presses.md`.
24
- *
25
- * **So every refusal below is argued from the reference and from sibling components, and none of
26
- * them has been tested.** They may all be right. Whoever gives this a consumer should expect to
27
- * change some of them, which is what happened to `Control` within hours of it landing.
21
+ * sites anywhere in this house**, its shape settled by reading a reference rather than by a consumer
22
+ * pushing on it. `production/newtone/ui_react-web/_issues/done/154-the-round-action-nothing-presses.md`.
23
+ * Revived 2026-11-11 (Joshua) as the general round action: AskButton is one, and HuevOS People's
24
+ * "+" renders one. The refusals below were argued from the reference before any of that; expect a
25
+ * consumer to change some of them.
28
26
  *
29
27
  * ---- no brand variant ----------------------------------------------------
30
28
  *
@@ -33,26 +31,32 @@ import { jsx as _jsx } from "react/jsx-runtime";
33
31
  * a client, and a licensed asset lives with its licence holder -- *the library learns to express a
34
32
  * thing, it never carries it.* The slot above is what replaces it.
35
33
  *
36
- * ---- no `disabled`, and no shadow ----------------------------------------
34
+ * ---- no `disabled`; raised on glass, flat off it --------------------------
37
35
  *
38
36
  * `disabled` is absent for `Action`'s reason, which is stronger here: an unavailable action that is
39
37
  * on screen for the entire visit is worse than one that is not there.
40
38
  *
41
- * **The shadow is the one thing this visibly lost.** The reference's whole colour argument is that
42
- * the circle takes the surface's own ground and is lifted by depth rather than by hue, because it
43
- * must not compete with the page for a whole scroll. Newtone has no shadow vocabulary, so the lift
44
- * is dropped rather than hard-coded, and a rim does the separating instead. On a busy ground this
45
- * is genuinely weaker than the component it came from, and the fix is a vocabulary rather than
46
- * anything in this folder -- `newtone_ui_tokens.md` section 8, *Shadows, blur, spread*.
39
+ * **Inside glass it is raised** (Joshua 2026-11-11): the glass wash, the lit edge and the close
40
+ * shadow cast in black, which is the lift the reference had and this lost while Newtone had no
41
+ * shadow vocabulary. `primary` wears the accent glass; pressed, it sits down to the contact shadow.
42
+ * **Outside glass it is a flat disc** with a 1px rim. It reads the material from the DOM attribute
43
+ * (material.css), so it stays a server component. AskButton is this, `primary`, always on glass.
44
+ * Revived 2026-11-11, closing issues/done/154.
47
45
  */
48
- export function QuickAction({ label, children, size = 'lg', className, ...rest }) {
49
- const classes = ['newtone-quick-action', `newtone-quick-action--${size}`, className]
46
+ export function QuickAction({ label, children, size = 'lg', variant = 'neutral', pressed, badge, className, ...rest }) {
47
+ const classes = [
48
+ 'newtone-quick-action',
49
+ `newtone-quick-action--${size}`,
50
+ variant === 'primary' ? 'newtone-quick-action--primary' : null,
51
+ className,
52
+ ]
50
53
  .filter(Boolean)
51
54
  .join(' ');
55
+ const mark = badge === true ? _jsx(Badge, {}) : typeof badge === 'number' ? _jsx(Badge, { count: badge }) : null;
52
56
  if (rest.href !== undefined) {
53
57
  const { href, ...anchor } = rest;
54
- return (_jsx("a", { href: href, className: classes, "aria-label": label, ...anchor, children: children }));
58
+ return (_jsxs("a", { href: href, className: classes, "aria-label": label, ...anchor, children: [children, mark] }));
55
59
  }
56
- return (_jsx("button", { type: "button", className: classes, "aria-label": label, ...rest, children: children }));
60
+ return (_jsxs("button", { type: "button", className: classes, "aria-label": label, "aria-pressed": pressed, ...rest, children: [children, mark] }));
57
61
  }
58
62
  //# sourceMappingURL=quick-action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"quick-action.js","sourceRoot":"","sources":["../../src/quick-action/quick-action.tsx"],"names":[],"mappings":";AA+CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,UAAU,WAAW,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,IAAI,GAAG,IAAI,EACX,SAAS,EACT,GAAG,IAAI,EACQ;IACf,MAAM,OAAO,GAAG,CAAC,sBAAsB,EAAE,yBAAyB,IAAI,EAAE,EAAE,SAAS,CAAC;SAC/E,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IAEd,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,IAG3B,CAAA;QACD,OAAO,CACH,YAAG,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,gBAAc,KAAK,KAAM,MAAM,YAC3D,QAAQ,GACT,CACP,CAAA;IACL,CAAC;IAED,OAAO,CACH,iBACI,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,gBACN,KAAK,KACZ,IAAgD,YAEpD,QAAQ,GACJ,CACZ,CAAA;AACL,CAAC"}
1
+ {"version":3,"file":"quick-action.js","sourceRoot":"","sources":["../../src/quick-action/quick-action.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAyDzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,WAAW,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,SAAS,EACnB,OAAO,EACP,KAAK,EACL,SAAS,EACT,GAAG,IAAI,EACQ;IACf,MAAM,OAAO,GAAG;QACZ,sBAAsB;QACtB,yBAAyB,IAAI,EAAE;QAC/B,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,IAAI;QAC9D,SAAS;KACZ;SACI,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;IACd,MAAM,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAC,KAAK,KAAG,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,CAAA;IAEpG,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,IAG3B,CAAA;QACD,OAAO,CACH,aAAG,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,gBAAc,KAAK,KAAM,MAAM,aAC3D,QAAQ,EACR,IAAI,IACL,CACP,CAAA;IACL,CAAC;IAED,OAAO,CACH,kBACI,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,gBACN,KAAK,kBACH,OAAO,KAChB,IAAgD,aAEpD,QAAQ,EACR,IAAI,IACA,CACZ,CAAA;AACL,CAAC"}
@@ -19,7 +19,10 @@
19
19
  justify-content: flex-start;
20
20
  gap: var(--newtone-space-2);
21
21
  }
22
+ /* The words take the room the row has left, so they stand right after what leads the row (a FramedIcon) and the end
23
+ stays at the end; with space-between alone, a row of three put them in its middle (2026-11-11, the Store). */
22
24
  .newtone-row-list-text {
25
+ flex: 1 1 auto;
23
26
  display: flex;
24
27
  flex-direction: column;
25
28
  gap: var(--newtone-space-1);
@@ -0,0 +1,3 @@
1
+ export { SeedColorField } from './seed-color-field.js';
2
+ export type { SeedColorFieldProps, SeedColorFieldLabels, SeedColor } from './seed-color-field.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/seed-color-field/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { SeedColorField } from './seed-color-field.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/seed-color-field/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,105 @@
1
+ /* SeedColorField -- blueprint components/seed-color-field.md. One palette of a seed: its ramp, its hue and saturation,
2
+ * and the strips it unfolds.
3
+ *
4
+ * LENGTHS IT DECIDES:
5
+ * 36px the ramp, as tall as the NumberFields beside it; 72px wide, six steps of the palette side by side
6
+ * 20px the base's picture beside a departure; 1px its hairline
7
+ * 16px each strip; 12px the ring where the value stands, 2px of surface.primary in a text.primary hairline,
8
+ * as ColorField's
9
+ * 0.5 how faint the fields are while the palette follows its base
10
+ * The ramp's and the strips' colours are the palette's own, not the interface's: written in seed-color-field.tsx, as
11
+ * data. */
12
+ .newtone-seed-color-field {
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: var(--newtone-space-2);
16
+ min-inline-size: 0;
17
+ color: var(--newtone-role-text-primary);
18
+ }
19
+ .newtone-seed-color-field-head {
20
+ display: flex;
21
+ align-items: baseline;
22
+ gap: var(--newtone-space-2);
23
+ min-inline-size: 0;
24
+ }
25
+ .newtone-seed-color-field-row {
26
+ display: flex;
27
+ align-items: center;
28
+ gap: var(--newtone-space-2);
29
+ min-inline-size: 0;
30
+ }
31
+ .newtone-seed-color-field-number {
32
+ flex: 1 1 0;
33
+ min-inline-size: 5rem;
34
+ }
35
+ .newtone-seed-color-field-ramp {
36
+ all: unset;
37
+ box-sizing: border-box;
38
+ flex: none;
39
+ display: flex;
40
+ inline-size: 72px;
41
+ block-size: 36px;
42
+ overflow: hidden;
43
+ border: 1px solid var(--newtone-role-divider-primary);
44
+ border-radius: var(--newtone-radius-sm);
45
+ cursor: pointer;
46
+ }
47
+ .newtone-seed-color-field-ramp > span {
48
+ flex: 1;
49
+ }
50
+ .newtone-seed-color-field-ramp:focus-visible {
51
+ outline: 2px solid var(--newtone-role-text-accent);
52
+ outline-offset: 2px;
53
+ }
54
+ .newtone-seed-color-field-ramp:disabled {
55
+ cursor: default;
56
+ }
57
+ /* Following its base: the ramp and the fields faint, the words said beside the name. Typed or scrubbed, it departs. */
58
+ .newtone-seed-color-field[data-same] .newtone-seed-color-field-ramp,
59
+ .newtone-seed-color-field[data-same] .newtone-seed-color-field-number {
60
+ opacity: 0.5;
61
+ }
62
+ .newtone-seed-color-field[data-same] .newtone-seed-color-field-number:focus-within {
63
+ opacity: 1;
64
+ }
65
+ .newtone-seed-color-field-base {
66
+ flex: none;
67
+ box-sizing: border-box;
68
+ inline-size: 20px;
69
+ block-size: 20px;
70
+ border: 1px solid var(--newtone-role-divider-primary);
71
+ border-radius: 50%;
72
+ }
73
+ .newtone-seed-color-field-strips {
74
+ display: flex;
75
+ flex-direction: column;
76
+ gap: var(--newtone-space-3);
77
+ padding-block: var(--newtone-space-1);
78
+ }
79
+ .newtone-seed-color-field-strip {
80
+ position: relative;
81
+ block-size: 16px;
82
+ border-radius: var(--newtone-radius-sm);
83
+ touch-action: none;
84
+ cursor: crosshair;
85
+ outline: none;
86
+ }
87
+ .newtone-seed-color-field-strip:focus-visible {
88
+ outline: 2px solid var(--newtone-role-text-accent);
89
+ outline-offset: 2px;
90
+ }
91
+ .newtone-seed-color-field-strip[aria-disabled='true'] {
92
+ cursor: default;
93
+ }
94
+ .newtone-seed-color-field-ring {
95
+ position: absolute;
96
+ inset-block-start: 50%;
97
+ box-sizing: border-box;
98
+ inline-size: 12px;
99
+ block-size: 12px;
100
+ margin: -6px 0 0 -6px;
101
+ border: 2px solid var(--newtone-role-surface-primary);
102
+ border-radius: 50%;
103
+ box-shadow: 0 0 0 1px var(--newtone-role-text-primary);
104
+ pointer-events: none;
105
+ }
@@ -0,0 +1,36 @@
1
+ import { type HTMLAttributes } from 'react';
2
+ /** A palette's seed: `h`, its hue in degrees (0 to 360); `c`, its saturation as a share of the gamut (0 to 1). */
3
+ export interface SeedColor {
4
+ h: number;
5
+ c: number;
6
+ }
7
+ export interface SeedColorFieldLabels {
8
+ /** Said where the palette follows `inherited`, and on the press that makes it follow again: "Same as base". */
9
+ same: string;
10
+ /** The hue's name: its field's label, and with `label` its full name. */
11
+ hue: string;
12
+ /** The saturation's name, as `hue`. */
13
+ saturation: string;
14
+ /** The fields' short labels, where `hue` and `saturation` are too long to start a field (H, S). */
15
+ hueShort?: string;
16
+ saturationShort?: string;
17
+ /** Names the small picture of `inherited` beside a departure ("Base"); `same` unless given. */
18
+ base?: string;
19
+ }
20
+ export interface SeedColorFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'children'> {
21
+ /** The palette's name: Accent, Neutral. */
22
+ label: string;
23
+ /** The palette as set here; null where it is not set (it follows `inherited`, when given). */
24
+ value: SeedColor | null;
25
+ /** What it follows while `value` is null: the base's palette. Given, the field can be set back to it. */
26
+ inherited?: SeedColor;
27
+ /** Told the palette as it changes; null when it is set back to follow `inherited`. */
28
+ onChange: (value: SeedColor | null) => void;
29
+ /** A change ended (typed, a step, a drag let go, set back): one change, for the consumer's history. */
30
+ onCommit?: () => void;
31
+ labels: SeedColorFieldLabels;
32
+ disabled?: boolean;
33
+ }
34
+ /** A palette: its ramp, its hue and saturation, and the strips it unfolds. Blueprint components/seed-color-field.md. */
35
+ export declare function SeedColorField({ label, value, inherited, onChange, onCommit, labels, disabled, className, ...rest }: SeedColorFieldProps): import("react").JSX.Element;
36
+ //# sourceMappingURL=seed-color-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-color-field.d.ts","sourceRoot":"","sources":["../../src/seed-color-field/seed-color-field.tsx"],"names":[],"mappings":"AAOA,OAAO,EAIH,KAAK,cAAc,EAGtB,MAAM,OAAO,CAAA;AAMd,kHAAkH;AAClH,MAAM,WAAW,SAAS;IACtB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,oBAAoB;IACjC,+GAA+G;IAC/G,IAAI,EAAE,MAAM,CAAA;IACZ,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAA;IACX,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAA;IAClB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC7C,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,GAAG,UAAU,CAC1B;IACG,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,8FAA8F;IAC9F,KAAK,EAAE,SAAS,GAAG,IAAI,CAAA;IACvB,yGAAyG;IACzG,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,sFAAsF;IACtF,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAA;IAC3C,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACrB;AAaD,wHAAwH;AACxH,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACV,EAAE,mBAAmB,+BA8MrB"}
@@ -0,0 +1,103 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // One palette of a seed (seed.json's `{ h, c }`: a hue and a saturation, the share of the most the gamut holds), as a
4
+ // brand or a look edits it: a ramp of the palette's own steps, its hue and saturation to type or scrub, and two strips
5
+ // it unfolds to pick them by eye. Where the palette may follow another (a variant's column follows its base; a brand
6
+ // follows HuevOS), `inherited` is that other: while `value` is null it is shown faintly and said to be the same, and a
7
+ // "Same as base" press puts a departure back. Blueprint components/seed-color-field.md.
8
+ import { useMemo, useRef, useState, } from 'react';
9
+ import { deriveScale } from '../color/index.js';
10
+ import { Button } from '../button/button.js';
11
+ import { NumberField } from '../number-field/number-field.js';
12
+ import { Text } from '../text/text.js';
13
+ // The steps the ramp shows, light to dark, and the one the strips are drawn at (where a palette is most itself).
14
+ const RAMP = [6, 14, 22, 30, 38, 46];
15
+ const STRIP = 22;
16
+ const HUES = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360];
17
+ const SHARES = [0, 0.2, 0.4, 0.6, 0.8, 1];
18
+ const round = (n, places) => Number(n.toFixed(places));
19
+ const wrap = (h) => ((Math.round(h) % 360) + 360) % 360;
20
+ const clamp01 = (n) => Math.min(1, Math.max(0, n));
21
+ const stepOf = (h, c, step) => deriveScale(h, c)[step].srgb;
22
+ /** A palette: its ramp, its hue and saturation, and the strips it unfolds. Blueprint components/seed-color-field.md. */
23
+ export function SeedColorField({ label, value, inherited, onChange, onCommit, labels, disabled, className, ...rest }) {
24
+ const [open, setOpen] = useState(false);
25
+ // Arrow keys held or pressed in a row on a strip: one change, ended when the key is let go (or the strip left).
26
+ const nudging = useRef(false);
27
+ const same = value === null && inherited !== undefined;
28
+ const shown = value ?? inherited ?? null;
29
+ const at = shown ?? { h: 0, c: 0 };
30
+ // The palette's colours are data, not the interface's: drawn from Newtone's own derivation.
31
+ const ramp = useMemo(() => {
32
+ if (!shown)
33
+ return [];
34
+ const steps = deriveScale(shown.h, shown.c);
35
+ return RAMP.map((s) => steps[s].srgb);
36
+ }, [shown?.h, shown?.c]);
37
+ const base = useMemo(() => (inherited && value ? stepOf(inherited.h, inherited.c, STRIP) : null), [inherited?.h, inherited?.c, value === null]);
38
+ // The strips: every hue at this saturation, every saturation at this hue. Only while unfolded. The hues are drawn
39
+ // at least at 40%, so a near-grey palette (a neutral) still shows which hue it leans to.
40
+ const cKey = Math.max(0.4, round(at.c, 2));
41
+ const hKey = Math.round(at.h);
42
+ const hueStrip = useMemo(() => open
43
+ ? `linear-gradient(to right, ${HUES.map((h) => stepOf(h, cKey, STRIP)).join(', ')})`
44
+ : undefined, [open, cKey]);
45
+ const shareStrip = useMemo(() => open
46
+ ? `linear-gradient(to right, ${SHARES.map((c) => stepOf(hKey, c, STRIP)).join(', ')})`
47
+ : undefined, [open, hKey]);
48
+ const set = (to) => {
49
+ const next = { ...at, ...to };
50
+ onChange({ h: wrap(next.h), c: round(clamp01(next.c), 2) });
51
+ };
52
+ // A drag on a strip picks where the pointer is, until it lets go.
53
+ const dragOn = (part) => {
54
+ const pick = (e) => {
55
+ const r = e.currentTarget.getBoundingClientRect();
56
+ const x = clamp01((e.clientX - r.left) / r.width);
57
+ set(part === 'hue' ? { h: Math.min(359, x * 360) } : { c: x });
58
+ };
59
+ return {
60
+ onPointerDown: (e) => {
61
+ if (disabled)
62
+ return;
63
+ e.currentTarget.setPointerCapture(e.pointerId);
64
+ pick(e);
65
+ },
66
+ onPointerMove: (e) => {
67
+ if (e.currentTarget.hasPointerCapture(e.pointerId))
68
+ pick(e);
69
+ },
70
+ onPointerUp: (e) => {
71
+ if (e.currentTarget.hasPointerCapture(e.pointerId))
72
+ onCommit?.();
73
+ },
74
+ };
75
+ };
76
+ const nudge = (part) => (e) => {
77
+ if (e.key === 'Escape')
78
+ return setOpen(false);
79
+ const by = { ArrowLeft: -1, ArrowDown: -1, ArrowRight: 1, ArrowUp: 1 }[e.key];
80
+ if (!by || disabled)
81
+ return;
82
+ e.preventDefault();
83
+ const big = e.shiftKey ? 10 : 1;
84
+ if (part === 'hue')
85
+ set({ h: at.h + by * big });
86
+ else
87
+ set({ c: at.c + (by * big) / 100 });
88
+ nudging.current = true;
89
+ };
90
+ const nudged = () => {
91
+ if (!nudging.current)
92
+ return;
93
+ nudging.current = false;
94
+ onCommit?.();
95
+ };
96
+ const hueName = `${labels.hue}: ${label}`;
97
+ const shareName = `${labels.saturation}: ${label}`;
98
+ return (_jsxs("div", { ...rest, className: ['newtone-seed-color-field', className].filter(Boolean).join(' '), "data-same": same ? '' : undefined, children: [_jsxs("div", { className: "newtone-seed-color-field-head", children: [_jsx(Text, { as: "span", scale: "body-sm", weight: "medium", lines: 1, children: label }), same ? (_jsx(Text, { as: "span", scale: "caption", tone: "secondary", lines: 1, children: labels.same })) : null] }), _jsxs("div", { className: "newtone-seed-color-field-row", children: [_jsx("button", { type: "button", className: "newtone-seed-color-field-ramp", "aria-label": label, "aria-expanded": open, disabled: disabled, onClick: () => setOpen((o) => !o), children: ramp.map((hex, i) => (_jsx("span", { style: { background: hex } }, i))) }), _jsx(NumberField, { className: "newtone-seed-color-field-number", label: labels.hueShort ?? labels.hue, name: hueName, value: shown ? Math.round(shown.h) : null, min: 0, max: 360, unit: "\u00B0", precision: 0, disabled: disabled, onChange: (h) => set({ h }), onCommit: onCommit }), _jsx(NumberField, { className: "newtone-seed-color-field-number", label: labels.saturationShort ?? labels.saturation, name: shareName, value: shown ? Math.round(shown.c * 100) : null, min: 0, max: 100, unit: "%", precision: 0, disabled: disabled, onChange: (p) => set({ c: p / 100 }), onCommit: onCommit }), base ? (_jsx("span", { className: "newtone-seed-color-field-base", role: "img", "aria-label": `${labels.base ?? labels.same}: ${Math.round(inherited.h)}°, ${Math.round(inherited.c * 100)}%`, title: `${labels.base ?? labels.same}: ${Math.round(inherited.h)}°, ${Math.round(inherited.c * 100)}%`, style: { background: base } })) : null, inherited !== undefined && value !== null ? (_jsx(Button, { size: "sm", variant: "tertiary", disabled: disabled, "aria-label": `${labels.same}: ${label}`, onClick: () => {
99
+ onChange(null);
100
+ onCommit?.();
101
+ }, children: labels.same })) : null] }), open ? (_jsxs("div", { className: "newtone-seed-color-field-strips", children: [_jsx("div", { className: "newtone-seed-color-field-strip", role: "slider", tabIndex: disabled ? -1 : 0, "aria-label": hueName, "aria-valuemin": 0, "aria-valuemax": 360, "aria-valuenow": Math.round(at.h), "aria-disabled": disabled || undefined, style: { background: hueStrip }, onKeyDown: nudge('hue'), onKeyUp: nudged, onBlur: nudged, ...dragOn('hue'), children: _jsx("span", { className: "newtone-seed-color-field-ring", style: { left: `${(at.h / 360) * 100}%` } }) }), _jsx("div", { className: "newtone-seed-color-field-strip", role: "slider", tabIndex: disabled ? -1 : 0, "aria-label": shareName, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(at.c * 100), "aria-disabled": disabled || undefined, style: { background: shareStrip }, onKeyDown: nudge('share'), onKeyUp: nudged, onBlur: nudged, ...dragOn('share'), children: _jsx("span", { className: "newtone-seed-color-field-ring", style: { left: `${at.c * 100}%` } }) })] })) : null] }));
102
+ }
103
+ //# sourceMappingURL=seed-color-field.js.map