@namroodinc/liquid-editorial 0.3.2 → 0.4.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 (155) hide show
  1. package/AGENTS.md +4 -0
  2. package/README.md +1576 -180
  3. package/UPGRADING.md +215 -0
  4. package/dist/chunks/ColourField-CJicr3OT.cjs +2 -0
  5. package/dist/chunks/ColourField-CJicr3OT.cjs.map +1 -0
  6. package/dist/chunks/{ColourField-C2YDshDg.js → ColourField-DjHRiFDU.js} +167 -162
  7. package/dist/chunks/ColourField-DjHRiFDU.js.map +1 -0
  8. package/dist/chunks/DatePicker-D_6CQpUd.js +296 -0
  9. package/dist/chunks/DatePicker-D_6CQpUd.js.map +1 -0
  10. package/dist/chunks/DatePicker-aSlYLjtW.cjs +2 -0
  11. package/dist/chunks/DatePicker-aSlYLjtW.cjs.map +1 -0
  12. package/dist/chunks/FormEditor-M7tNidFo.js +584 -0
  13. package/dist/chunks/FormEditor-M7tNidFo.js.map +1 -0
  14. package/dist/chunks/FormEditor-UzbPdiJo.cjs +2 -0
  15. package/dist/chunks/FormEditor-UzbPdiJo.cjs.map +1 -0
  16. package/dist/chunks/Slider-k8weRl34.cjs +2 -0
  17. package/dist/chunks/Slider-k8weRl34.cjs.map +1 -0
  18. package/dist/chunks/Slider-vdMFLX-H.js +174 -0
  19. package/dist/chunks/Slider-vdMFLX-H.js.map +1 -0
  20. package/dist/chunks/dialogFocus-B9iqKl3I.cjs +2 -0
  21. package/dist/chunks/dialogFocus-B9iqKl3I.cjs.map +1 -0
  22. package/dist/chunks/dialogFocus-BFoyeTpA.js +48 -0
  23. package/dist/chunks/dialogFocus-BFoyeTpA.js.map +1 -0
  24. package/dist/components/Choice/index.cjs +1 -1
  25. package/dist/components/Choice/index.cjs.map +1 -1
  26. package/dist/components/Choice/index.d.cts.map +1 -1
  27. package/dist/components/Choice/index.d.ts.map +1 -1
  28. package/dist/components/Choice/index.js +2 -0
  29. package/dist/components/Choice/index.js.map +1 -1
  30. package/dist/components/ColourField/focus.d.cts +0 -1
  31. package/dist/components/ColourField/focus.d.cts.map +1 -1
  32. package/dist/components/ColourField/focus.d.ts +0 -1
  33. package/dist/components/ColourField/focus.d.ts.map +1 -1
  34. package/dist/components/ColourField/index.cjs +1 -1
  35. package/dist/components/ColourField/index.d.cts.map +1 -1
  36. package/dist/components/ColourField/index.d.ts.map +1 -1
  37. package/dist/components/ColourField/index.js +1 -1
  38. package/dist/components/ColourField/value.d.cts +6 -0
  39. package/dist/components/ColourField/value.d.cts.map +1 -1
  40. package/dist/components/ColourField/value.d.ts +6 -0
  41. package/dist/components/ColourField/value.d.ts.map +1 -1
  42. package/dist/components/DatePicker/date.d.cts +9 -0
  43. package/dist/components/DatePicker/date.d.cts.map +1 -0
  44. package/dist/components/DatePicker/date.d.ts +9 -0
  45. package/dist/components/DatePicker/date.d.ts.map +1 -0
  46. package/dist/components/DatePicker/index.cjs +1 -2
  47. package/dist/components/DatePicker/index.d.cts +9 -6
  48. package/dist/components/DatePicker/index.d.cts.map +1 -1
  49. package/dist/components/DatePicker/index.d.ts +9 -6
  50. package/dist/components/DatePicker/index.d.ts.map +1 -1
  51. package/dist/components/DatePicker/index.js +1 -259
  52. package/dist/components/DatePicker/style.css +5 -0
  53. package/dist/components/Drawer/index.cjs +1 -1
  54. package/dist/components/Drawer/index.cjs.map +1 -1
  55. package/dist/components/Drawer/index.d.cts.map +1 -1
  56. package/dist/components/Drawer/index.d.ts.map +1 -1
  57. package/dist/components/Drawer/index.js +69 -73
  58. package/dist/components/Drawer/index.js.map +1 -1
  59. package/dist/components/EditLayout/index.cjs +1 -1
  60. package/dist/components/EditLayout/index.cjs.map +1 -1
  61. package/dist/components/EditLayout/index.d.cts.map +1 -1
  62. package/dist/components/EditLayout/index.d.ts.map +1 -1
  63. package/dist/components/EditLayout/index.js +68 -55
  64. package/dist/components/EditLayout/index.js.map +1 -1
  65. package/dist/components/Field/style.css +20 -0
  66. package/dist/components/FormEditor/README.md +375 -0
  67. package/dist/components/FormEditor/additional-control.d.cts +6 -0
  68. package/dist/components/FormEditor/additional-control.d.cts.map +1 -0
  69. package/dist/components/FormEditor/additional-control.d.ts +6 -0
  70. package/dist/components/FormEditor/additional-control.d.ts.map +1 -0
  71. package/dist/components/FormEditor/choice-control.d.cts +6 -0
  72. package/dist/components/FormEditor/choice-control.d.cts.map +1 -0
  73. package/dist/components/FormEditor/choice-control.d.ts +6 -0
  74. package/dist/components/FormEditor/choice-control.d.ts.map +1 -0
  75. package/dist/components/FormEditor/control.d.cts +8 -0
  76. package/dist/components/FormEditor/control.d.cts.map +1 -1
  77. package/dist/components/FormEditor/control.d.ts +8 -0
  78. package/dist/components/FormEditor/control.d.ts.map +1 -1
  79. package/dist/components/FormEditor/index.cjs +1 -1
  80. package/dist/components/FormEditor/index.d.cts +1 -1
  81. package/dist/components/FormEditor/index.d.cts.map +1 -1
  82. package/dist/components/FormEditor/index.d.ts +1 -1
  83. package/dist/components/FormEditor/index.d.ts.map +1 -1
  84. package/dist/components/FormEditor/index.js +1 -1
  85. package/dist/components/FormEditor/model.d.cts +68 -2
  86. package/dist/components/FormEditor/model.d.cts.map +1 -1
  87. package/dist/components/FormEditor/model.d.ts +68 -2
  88. package/dist/components/FormEditor/model.d.ts.map +1 -1
  89. package/dist/components/FormEditor/style.css +12 -0
  90. package/dist/components/Grid/style.css +2 -1
  91. package/dist/components/ImageCropper/index.cjs +1 -1
  92. package/dist/components/ImageCropper/index.cjs.map +1 -1
  93. package/dist/components/ImageCropper/index.js +6 -6
  94. package/dist/components/ImageCropper/index.js.map +1 -1
  95. package/dist/components/Modal/index.cjs +1 -1
  96. package/dist/components/Modal/index.cjs.map +1 -1
  97. package/dist/components/Modal/index.d.cts.map +1 -1
  98. package/dist/components/Modal/index.d.ts.map +1 -1
  99. package/dist/components/Modal/index.js +40 -48
  100. package/dist/components/Modal/index.js.map +1 -1
  101. package/dist/components/NumberField/index.cjs +1 -1
  102. package/dist/components/NumberField/index.cjs.map +1 -1
  103. package/dist/components/NumberField/index.d.cts.map +1 -1
  104. package/dist/components/NumberField/index.d.ts.map +1 -1
  105. package/dist/components/NumberField/index.js +4 -0
  106. package/dist/components/NumberField/index.js.map +1 -1
  107. package/dist/components/Popover/index.cjs +1 -1
  108. package/dist/components/Popover/index.cjs.map +1 -1
  109. package/dist/components/Popover/index.d.cts +2 -0
  110. package/dist/components/Popover/index.d.cts.map +1 -1
  111. package/dist/components/Popover/index.d.ts +2 -0
  112. package/dist/components/Popover/index.d.ts.map +1 -1
  113. package/dist/components/Popover/index.js +45 -44
  114. package/dist/components/Popover/index.js.map +1 -1
  115. package/dist/components/SelectionCard/index.cjs +1 -1
  116. package/dist/components/SelectionCard/index.cjs.map +1 -1
  117. package/dist/components/SelectionCard/index.d.cts.map +1 -1
  118. package/dist/components/SelectionCard/index.d.ts.map +1 -1
  119. package/dist/components/SelectionCard/index.js +2 -1
  120. package/dist/components/SelectionCard/index.js.map +1 -1
  121. package/dist/components/Slider/index.cjs +1 -2
  122. package/dist/components/Slider/index.d.cts +14 -1
  123. package/dist/components/Slider/index.d.cts.map +1 -1
  124. package/dist/components/Slider/index.d.ts +14 -1
  125. package/dist/components/Slider/index.d.ts.map +1 -1
  126. package/dist/components/Slider/index.js +1 -127
  127. package/dist/components/Slider/scale.d.cts +13 -0
  128. package/dist/components/Slider/scale.d.cts.map +1 -0
  129. package/dist/components/Slider/scale.d.ts +13 -0
  130. package/dist/components/Slider/scale.d.ts.map +1 -0
  131. package/dist/elements.css +9 -0
  132. package/dist/index.cjs +1 -1
  133. package/dist/index.d.cts +1 -1
  134. package/dist/index.d.cts.map +1 -1
  135. package/dist/index.d.ts +1 -1
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +20 -20
  138. package/dist/internal/dialogFocus.d.cts +17 -0
  139. package/dist/internal/dialogFocus.d.cts.map +1 -0
  140. package/dist/internal/dialogFocus.d.ts +17 -0
  141. package/dist/internal/dialogFocus.d.ts.map +1 -0
  142. package/dist/reset.css +2 -0
  143. package/dist/styles.css +1 -0
  144. package/package.json +2 -2
  145. package/dist/chunks/ColourField-C2YDshDg.js.map +0 -1
  146. package/dist/chunks/ColourField-Dc9533G6.cjs +0 -2
  147. package/dist/chunks/ColourField-Dc9533G6.cjs.map +0 -1
  148. package/dist/chunks/FormEditor-DRmPFe2E.js +0 -328
  149. package/dist/chunks/FormEditor-DRmPFe2E.js.map +0 -1
  150. package/dist/chunks/FormEditor-PVkvKep1.cjs +0 -2
  151. package/dist/chunks/FormEditor-PVkvKep1.cjs.map +0 -1
  152. package/dist/components/DatePicker/index.cjs.map +0 -1
  153. package/dist/components/DatePicker/index.js.map +0 -1
  154. package/dist/components/Slider/index.cjs.map +0 -1
  155. package/dist/components/Slider/index.js.map +0 -1
package/UPGRADING.md CHANGED
@@ -2,6 +2,221 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.4.0
6
+
7
+ ### Breaking changes
8
+
9
+ - `FormSchema.fields` is now `readonly FormItem[]` (`FormField | FormDivider`)
10
+ instead of `readonly FormField[]`. TypeScript that reads schema items as
11
+ fields, such as `schema.fields.find((field) => field.id === id)!.label` or
12
+ `schema.fields.map((field) => ({ ...field, required: true }))`, no longer
13
+ compiles. Narrow with `item.type !== "divider"` first, or declare literal
14
+ schemas with `satisfies FormSchema` so they keep their own item types. Schemas
15
+ that are only passed to FormEditor or `validateFormValues` need no change.
16
+ - `FormField` adds seven `type` discriminators, and `FormFieldValue` adds
17
+ `string[]` and `RangeSliderValue`. Exhaustive `never` checks over field types
18
+ or stored values need the new cases.
19
+
20
+ ### Expanded FormEditor and packaged agent reference
21
+
22
+ Added `slider`, `rangeSlider`, `colour`, `radioGroup`, `checkboxGroup`, `tags`,
23
+ and `date` schema fields. The existing `select` dropdown is now included in the
24
+ expanded examples and has its own section in the agent guide. Radio/checkbox
25
+ groups accept one or more options, `appearance: "default" | "card"`, and
26
+ `columns: 1 | 2 | 3` on each field to set the options per row independently of
27
+ FormEditor's field columns. The GroupColumns story demonstrates all four group
28
+ styles with live column controls.
29
+ Existing boolean fields remain switches. Required groups need a selection;
30
+ required booleans still accept `false`. The shared controls supply their existing
31
+ styling, keyboard behavior, picker modes and disabled states.
32
+
33
+ `FormSchema.fields` now accepts `FormItem`, the union of value-bearing `FormField`
34
+ and layout-only `FormDivider`. Add `{ id, type: "divider" }` for a full-width
35
+ horizontal rule with no label, value or validation. Plain `hr` elements throughout
36
+ the library, including rich text, use the theme's muted `--rule-color` and
37
+ `--rule-width`. FormEditor uses grid spacing around its rules.
38
+
39
+ #### Adoption
40
+
41
+ Read `dist/components/FormEditor/README.md` in the installed package for every
42
+ supported prop, schema option, value shape and integration example. The guide is
43
+ copied from the source FormEditor folder and linked from AGENTS.md. Agents adding
44
+ shared form controls must also add their FormEditor adapter or document an
45
+ exclusion in a decision document, and keep the guide current.
46
+
47
+ Keep application-owned values, loading, permissions and saving. New arrays store
48
+ strings, and two-thumb range sliders use `{ min, max }` with two finite numeric
49
+ endpoints. Calendar dates are `YYYY-MM-DD`, distinct from existing UTC `dateTime`.
50
+ Cleared scalar selections remove their keys; empty tag/checkbox arrays remain.
51
+ Invalid colour drafts are retained in FormValues so pre-save validation rejects
52
+ them; valid edits use canonical hex. Continue running `validateFormValues` before
53
+ saving. Narrow `item.type !== "divider"` before reading field-only properties
54
+ when iterating `schema.fields` (see Breaking changes). Tests that read an unset
55
+ FormEditor slider or range slider's printed value should expect `"Not set"` or
56
+ the field's `placeholder`; tests that expected an empty calendar to focus its first enabled
57
+ day should expect today, or the nearest bound.
58
+
59
+ #### Compatibility
60
+
61
+ No public API is removed or renamed, and no dependency or manual version change
62
+ is introduced. Existing schemas and stored values retain their runtime behavior.
63
+ Widening `FormSchema.fields` and the field and value unions is a type-level
64
+ breaking change, listed above, so this release is a minor version below 1.0.
65
+ Update exhaustive switches and custom persistence adapters when adopting the new
66
+ types. Slider and RangeSlider `valueText`/`onValueCommit`, RangeSlider `hasFill`
67
+ and Popover `tabIndex` are optional and default to the previous output. `gap="none"` spacing is unchanged; custom `calc()` expressions
68
+ that read `--grid-gap` now receive a length. Dividers require unique IDs just
69
+ like fields. The global `hr` style is visible with aggregate styles even without
70
+ the optional reset; override it locally if a consuming surface needs another rule.
71
+
72
+ The local unreleased `numberRange` and `dateRange` FormEditor adapters are deferred
73
+ and are not supported schema types. Remove those fields from local schemas or
74
+ compose the existing standalone NumberRangeField/DateRangeField controls outside
75
+ FormEditor. The standalone APIs remain available. These adapters were never part
76
+ of a published package version; the cumulative release removes no published API.
77
+
78
+ Standalone DateField adds opt-in `isClearable` and `clearLabel`; DateRangeField
79
+ adds `isClearable`. Defaults remain false. Clearing returns focus to the date
80
+ trigger. DateRangeField now respects both global bounds and the other endpoint,
81
+ including when loaded endpoints lie outside those bounds. Standalone NumberRangeField
82
+ steppers now include their endpoint label, such as `Increase Minimum`. Update exact button
83
+ name assertions accordingly.
84
+
85
+ Opening a calendar now focuses the selected day, or today when the value is empty
86
+ or invalid, moved inside `min`/`max`; arrow keys start from that day. Escape closes
87
+ that calendar and returns focus to its trigger while leaving an enclosing Modal
88
+ or Drawer open, including after a click on the calendar's heading or padding.
89
+ Disabling an open DateField closes its calendar. Popover accepts an optional
90
+ `tabIndex`; DateField sets `-1` on its calendar dialog so clicks keep focus inside.
91
+
92
+ Slider and RangeSlider add an optional `valueText`, printed instead of the
93
+ number(s) and announced as `aria-valuetext`, and `onValueCommit`, which reports
94
+ the shown value after a click or step key on a thumb even when it did not move.
95
+ RangeSlider also adds `hasFill` (default `true`); `false` leaves the span between
96
+ the thumbs unpainted. RangeSlider thumbs now stop exactly one step apart with
97
+ decimal steps; previously `0.3 - 0.1` could emit `0.19999999999999998`.
98
+ ColourField drops a typed draft when a parent that stored the invalid text then
99
+ restores another value, including the value from before the edit. Its picker
100
+ dialog also sets `tabIndex={-1}`, so Escape after a click on the picker's padding
101
+ or labels closes only the picker, not an enclosing Modal or Drawer.
102
+
103
+ FormEditor sliders and range sliders with no stored value print `placeholder` or
104
+ `"Not set"` and store their shown position (the full range, for a range slider,
105
+ which is drawn without a fill while unset) on a click or an arrow, Home, End or
106
+ Page key, so the minimum or full range can be chosen directly. Loaded slider values outside the scale, and
107
+ reversed ranges, are drawn clamped and ordered while validation still reports
108
+ them. Decimal scales such as `min: 0.2, max: 0.3, step: 0.1` no longer fail
109
+ schema checks or one-step range validation through floating-point error.
110
+ Required date and colour fields loaded as blank strings wait for an edit or
111
+ `showAllErrors` before showing their required message, and an optional radio
112
+ group stored as `""` shows no clear action. `validateFormValues` now uses only
113
+ pure date, colour and slider helpers rather than importing the calendar UI.
114
+
115
+ ChoiceGroup and SelectionCardGroup now size their responsive columns against
116
+ their own width, stepping down before an option would be narrower than
117
+ `--choice-card-min-width` (default `15rem`). This also applies outside FormEditor
118
+ and prevents cramped cards when there is no container ancestor. It works with
119
+ `gap="none"`, whose `--grid-gap` value is now `0px` rather than a unitless `0`,
120
+ and the column minimum leaves 1px of slack so rounding never drops a column.
121
+
122
+ Button-based inputs, including Select and DateField triggers, explicitly retain
123
+ `--field-radius` even when Button styles load after Field styles. The default is
124
+ 4px, matching text and colour fields. Ordinary action buttons and floating panels
125
+ keep their existing radius tokens. No application changes are required; local
126
+ radius overrides can be removed if they only compensated for import order.
127
+
128
+ The agent guide and stories now distinguish `date` (custom calendar popover,
129
+ date-only string) from `dateTime` (native browser date/time input, UTC timestamp).
130
+ Their behavior and value contracts are unchanged.
131
+
132
+ #### Verification
133
+
134
+ Run consuming typechecks, tests and builds. Test new value serialization and
135
+ clears, required one-option groups, both appearances, disabled choices, loaded
136
+ choices, select dropdown selection/clearing, group option columns and invalid
137
+ colour drafts. Check group legends, option
138
+ and endpoint names, radio keyboard navigation across multiple forms, calendar
139
+ clearing/focus, and popovers inside Modal/Drawer. Review separators and responsive
140
+ columns in every theme. Confirm the packaged guide and imported styles resolve.
141
+ Compare Select, calendar, colour and text input radii, including late-loaded
142
+ Button styles and custom `--field-radius` overrides. Check unset required
143
+ slider and range slider labels, fills and click/keyboard commits, decimal range sliders, loaded
144
+ out-of-range slider values, Discard after invalid colour typing, empty and
145
+ future-bounded calendars, Escape after clicking a calendar heading or colour
146
+ picker padding inside a Modal or Drawer, and `gap="none"` card groups at several widths.
147
+ Library maintainers run full validation, refresh Fallow reports and verify
148
+ React 18/19 ESM/CommonJS packages and the guide's examples against the packed build.
149
+
150
+ ## 0.3.3
151
+
152
+ ### Complete component guide and Fallow quality gate
153
+
154
+ The README now covers all 43 component families and 93 runtime exports, with
155
+ imports, practical examples, key defaults, state ownership, and accessibility
156
+ guidance. The catalogue includes compound components, hooks, helpers, and asset
157
+ aliases, with links to source stories. Detailed prop types remain in the shipped
158
+ TypeScript declarations.
159
+
160
+ Modal and Drawer share one Tab trap:
161
+
162
+ - Both return focus that left the panel on the next Tab, including focus that
163
+ fell to the page when the focused control was removed. Previously only
164
+ Drawer did this.
165
+ - Tab wraps from the focused panel itself and from untabbable focus beyond
166
+ either end. A radio group counts as one stop.
167
+ - Hidden inputs and unrendered or inert controls no longer count as the first
168
+ or last control, and no longer receive a dialog's initial focus.
169
+ - Tab inside a Popover anchored in the dialog is left to the popup. This covers
170
+ DateField and DateRangeField calendars, Menu, Select, Time, ColourField, and
171
+ custom Popovers. Previously a Drawer moved focus to its first control.
172
+ - A Drawer portaled into a shadow root tracks focus inside it.
173
+ - A Tab keydown that another handler already prevented is left alone.
174
+
175
+ EditLayout's action bar is a private component, reducing its complexity without
176
+ changing rail state, mounting, responsive behavior, or leave confirmation.
177
+
178
+ #### Adoption
179
+
180
+ No application code changes are required. Use the README's catalogue and Field
181
+ composition examples when adopting components. Continue importing `styles.css`
182
+ explicitly and managing data access, routing, and persistence in the application.
183
+ If a custom popup built on `Popover` inside a Modal or Drawer stops Tab
184
+ propagation only to escape the dialog's trap, remove that workaround. Update
185
+ tests that Tab from outside an open Modal and expect focus to stay outside: it
186
+ now moves to the Modal's first control (last with Shift+Tab).
187
+
188
+ Library contributors: `npm run fallow` now checks dead code, duplicates, and
189
+ cyclomatic/cognitive complexity together without changing report files. It runs
190
+ in CI and release validation. Run `npm run test:coverage && npm run fallow:report`
191
+ to update committed JSON/Markdown reports; fix required findings before merging.
192
+ Report rows name the export, member, package, or line, and take fixes from
193
+ Fallow's own suggestions without suppressions. Fallow exit 1 is classified like
194
+ exit 0; higher exits fail with Fallow's message. Estimated CRAP change-risk
195
+ advisories remain visible and non-blocking. Keep the original baseline and
196
+ thresholds. `npm run typecheck` now covers `scripts/`.
197
+
198
+ #### Compatibility
199
+
200
+ Public exports, props, CSS entry points, peer dependencies, and package versions
201
+ are unchanged. The stronger gate affects library contribution/release checks.
202
+ Modal's recapture of escaped focus is the most visible keyboard change; the
203
+ other Tab changes correct cases where focus left a dialog or landed on a control
204
+ that could not take it. Drawer exit timing, focus restoration, nested dialog
205
+ ordering, and scroll-lock behavior retain their existing contracts. Version
206
+ increments remain owned by the main-branch release workflow.
207
+
208
+ #### Verification
209
+
210
+ Run consuming typechecks, tests, and builds. Check Tab/Shift+Tab, Escape, opener
211
+ focus restoration, and nested dialogs. In a Modal and a Drawer, Tab inside an
212
+ open DateField calendar or Menu, press Shift+Tab after clicking non-interactive
213
+ dialog text, and Tab after removing the focused control. For EditLayout,
214
+ exercise a DateField in the Details sheet as well as responsive rail
215
+ changes, controlled preferences, leave confirmation, and values entered in rail
216
+ fields while moving between the rail and Details sheet. Library maintainers run
217
+ `npm run validate`, refresh the Fallow reports after coverage, and verify that
218
+ all README examples resolve against the built package.
219
+
5
220
  ## 0.3.2
6
221
 
7
222
  ### Colour picker and shared popover positioning
@@ -0,0 +1,2 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./Icon-BBoWP_Y6.cjs"),l=require("../components/Button/index.cjs"),u=require("./mergeRefs-Bc3qS0Tt.cjs"),d=require("./dialogFocus-B9iqKl3I.cjs"),f=require("../components/TextField/index.cjs"),p=require("../components/FieldAffix/index.cjs"),m=require("../components/Popover/index.cjs"),h=require("./Slider-k8weRl34.cjs");let g=require("react"),_=require("react/jsx-runtime"),v=require("colord"),y=require("colord/plugins/names");y=s(y,1),(0,v.extend)([y.default]);var b={h:0,s:100,v:0,a:1};function x(e){let t=e.trim();if(!t)return null;let n=t.replace(/^#/,``),r=n.length<5?[...n].map(e=>e+e).join(``):n,i=/^(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i.test(n)?(0,v.colord)({r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16),a:r.length===8?parseInt(r.slice(6),16)/255:1}):(0,v.colord)(t);return i.isValid()?i:null}function S(e){return(0,v.colord)(e).toHex().toUpperCase()}function C(e){return x(e)?.toHex().toUpperCase()??``}function w(e,t=b){let n=x(e);if(!n||n.toHex().toUpperCase()===S(t))return t;let{r,g:i,b:a,a:o}=n.rgba,s=Math.max(r,i,a),c=s-Math.min(r,i,a),l=c===0?t.h:s===r?(i-a)/c*60:s===i?((a-r)/c+2)*60:((r-i)/c+4)*60;l<0&&(l+=360);let u={h:l,s:s?c/s*100:0,v:s/255*100,a:o};return{...u,h:u.s===0?t.h:u.h,s:u.v===0?t.s:u.s}}function T(e){let t=e.closest(`[aria-modal='true']`)??document.body,n=d.n(t).filter(e=>!e.closest(`.ds-popover`));(n[n.map(t=>e.contains(t)).lastIndexOf(!0)+1]??n[0])?.focus({preventScroll:!0})}function E(e){return Math.max(0,Math.min(100,e))}function D({colour:e,isDisabled:t,onChange:n}){let r=(0,g.useRef)(null),i=t=>{let r=t.currentTarget.getBoundingClientRect();r.width&&r.height&&n({...e,s:E((t.clientX-r.left)/r.width*100),v:E((1-(t.clientY-r.top)/r.height)*100)})};return(0,_.jsx)(`div`,{className:`ds-colour-panel__square`,role:`slider`,tabIndex:t?-1:0,"aria-label":`Saturation and brightness`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.s),"aria-valuetext":`Saturation ${Math.round(e.s)}%, brightness ${Math.round(e.v)}%`,"aria-disabled":t||void 0,onKeyDown:r=>{if(t)return;let i=r.shiftKey?10:1,a={ArrowLeft:{s:E(e.s-i)},ArrowRight:{s:E(e.s+i)},ArrowDown:{v:E(e.v-i)},ArrowUp:{v:E(e.v+i)},Home:{s:0},End:{s:100}}[r.key];a&&(r.preventDefault(),n({...e,...a}))},onPointerDown:e=>{t||e.button!==0||(e.preventDefault(),e.currentTarget.focus(),r.current=e.pointerId,e.currentTarget.setPointerCapture(e.pointerId),i(e))},onPointerMove:e=>{!t&&r.current===e.pointerId&&i(e)},onPointerUp:e=>{r.current===e.pointerId&&(r.current=null,e.currentTarget.releasePointerCapture(e.pointerId))},onPointerCancel:()=>{r.current=null},onLostPointerCapture:()=>{r.current=null},children:(0,_.jsx)(`span`,{className:`ds-colour-panel__thumb`,style:{left:`${e.s}%`,top:`${100-e.v}%`}})})}function O({value:e,defaultValue:t=``,onValueChange:n}){let[r,i]=(0,g.useState)(t),a=e??r,[o,s]=(0,g.useState)(()=>({source:a,colour:w(a)})),c=o.colour;return o.source!==a&&(c=w(a,c),s({source:a,colour:c})),{current:a,colour:c,commit:t=>{let r=typeof t==`string`?C(t):S(t);s({source:r,colour:typeof t==`string`?w(t,c):t}),e===void 0&&i(r),n?.(r)}}}function k(e,t){let[n,r]=(0,g.useState)(null);return n&&n.source!==e&&n.text===e&&r({source:e,text:e}),{text:n?.source===e?n.text:t||e,type:(t,n)=>r({source:n?C(t):e,text:t}),discard:()=>r(null)}}function A(){return window.EyeDropper}var j=()=>()=>{},M=[],N=8;function P(e,t,n){let r=t%N,i=r+Math.floor((n-1-r)/N)*N;switch(e){case`Home`:return 0;case`End`:return n-1;case`ArrowRight`:return(t+1)%n;case`ArrowLeft`:return(t-1+n)%n;case`ArrowDown`:return t+N<n?t+N:r;case`ArrowUp`:return t>=N?t-N:i;default:return}}var F=(0,g.forwardRef)(function({value:e,defaultValue:t,onValueChange:n,...r},i){let{current:a,colour:o,commit:s}=O({value:e,defaultValue:t,onValueChange:n});return(0,_.jsx)(I,{...r,ref:i,colour:o,current:a,onColourChange:s})}),I=(0,g.forwardRef)(function({colour:e,current:t,onColourChange:n,presets:r=M,showPresets:i=!0,picker:a=`custom`,isDisabled:o=!1,className:s,style:u,...d},f){let p=(0,g.useRef)(null),m=(0,g.useRef)(!0),v=(0,g.useRef)(o),[y,b]=(0,g.useState)(!1),[T,E]=(0,g.useState)(``),O=(0,g.useSyncExternalStore)(j,()=>!!A(),()=>!1),k=(0,g.useId)(),F=C(t),I=S({...e,a:1}),L=(0,g.useMemo)(()=>{let e=new Map;for(let t of r){let n=C(t);n&&!e.has(n)&&e.set(n,t)}return[...e].map(([e,t])=>({normalised:e,preset:t}))},[r]),R=L.findIndex(e=>e.normalised===F);(0,g.useEffect)(()=>{v.current=o},[o]),(0,g.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let z=async()=>{let t=A();if(!(!t||o||y)){b(!0),E(``);try{let r=await new t().open();m.current&&!v.current&&x(r.sRGBHex)&&n({...w(r.sRGBHex,e),a:e.a})}catch(e){m.current&&!(e instanceof DOMException&&e.name===`AbortError`)&&E(`Unable to pick a colour from the screen. Try again.`)}finally{m.current&&b(!1)}}};return(0,_.jsxs)(`div`,{...d,ref:f,className:[`ds-colour-panel`,s].filter(Boolean).join(` `),"data-disabled":o||void 0,style:{...u,"--colour-hue":`hsl(${e.h} 100% 50%)`,"--colour-rgb":I,"--colour-rgba":S(e)},children:[(0,_.jsxs)(`div`,{className:`ds-colour-panel__head`,children:[(0,_.jsx)(`span`,{children:`Colour`}),(0,_.jsx)(`span`,{className:`ds-colour-panel__value`,children:F||`No colour`})]}),a===`custom`?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(D,{colour:e,isDisabled:o,onChange:n}),(0,_.jsxs)(`div`,{className:`ds-colour-panel__hue-row`,children:[O&&(0,_.jsx)(l.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`pipette`,"aria-label":`Pick from screen`,isDisabled:o,"aria-busy":y||void 0,onClick:()=>void z()}),(0,_.jsx)(h.n,{className:`ds-colour-panel__hue`,value:e.h,min:0,max:360,step:1,hasValueLabel:!1,"aria-label":`Hue`,"aria-valuetext":`${Math.round(e.h)} degrees`,isDisabled:o,onValueChange:t=>n({...e,h:t}),onKeyDown:t=>{if(!t.shiftKey||![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(t.key))return;t.preventDefault();let r=t.key===`ArrowRight`||t.key===`ArrowUp`?15:-15;n({...e,h:Math.max(0,Math.min(360,e.h+r))})}})]})]}):(0,_.jsxs)(`div`,{className:`ds-colour-panel__native`,children:[(0,_.jsx)(`input`,{ref:p,type:`color`,value:I,tabIndex:-1,"aria-hidden":`true`,disabled:o,onChange:t=>{x(t.target.value)&&n({...w(t.target.value,e),a:e.a})}}),(0,_.jsx)(l.Button,{variant:`neutral`,size:`sm`,iconStart:`pipette`,isDisabled:o,onClick:()=>{let e=p.current;if(e)try{e.showPicker?e.showPicker():e.click()}catch{e.click()}},children:`Custom colour…`})]}),(0,_.jsxs)(`div`,{className:`ds-colour-panel__opacity`,children:[(0,_.jsx)(`label`,{htmlFor:`${k}-opacity`,children:`Opacity`}),(0,_.jsx)(h.n,{id:`${k}-opacity`,className:`ds-colour-panel__alpha`,value:Math.round(e.a*100),min:0,max:100,step:1,suffix:`%`,isDisabled:o,onValueChange:t=>n({...e,a:t/100})})]}),i&&L.length>0&&(0,_.jsxs)(`div`,{className:`ds-colour-panel__presets`,children:[(0,_.jsx)(`span`,{id:k,className:`ds-colour-panel__presets-label`,children:`Presets`}),(0,_.jsx)(`div`,{className:`ds-colour-panel__grid`,role:`radiogroup`,"aria-labelledby":k,style:{"--colour-preset-columns":N},onKeyDown:e=>{let t=Array.from(e.currentTarget.querySelectorAll(`[role='radio']`)),n=t.indexOf(e.target),r=n<0?void 0:P(e.key,n,t.length);r!==void 0&&(e.preventDefault(),t[r]?.focus(),t[r]?.click())},children:L.map(({normalised:e,preset:t},r)=>{let i=r===R;return(0,_.jsx)(l.Button,{variant:`simple`,size:`xs`,isIconOnly:!0,role:`radio`,"aria-checked":i,"aria-label":t,title:t,tabIndex:r===Math.max(0,R)?0:-1,isDisabled:o,className:`ds-colour-panel__preset`,onClick:()=>n(t),children:(0,_.jsx)(`span`,{className:`ds-colour-swatch`,style:{"--colour-swatch":e},children:i&&(0,_.jsx)(c.t,{name:`check`,size:16,strokeWidth:3})})},e)})})]}),T&&(0,_.jsx)(`span`,{className:`ds-colour-panel__error`,role:`status`,children:T})]})}),L=(0,g.forwardRef)(function({value:e,defaultValue:t,onValueChange:n,onValidityChange:r,presets:i,showPresets:a,picker:o,placement:s,isDisabled:c=!1,disabled:h,readOnly:v,isInvalid:y,"aria-invalid":b,id:S,className:w,onBlur:E,onKeyDown:D,...A},j){let{current:M,colour:N,commit:P}=O({value:e,defaultValue:t,onValueChange:n}),[F,L]=(0,g.useState)(!1),R=(0,g.useRef)(null),z=(0,g.useRef)(null),B=(0,g.useRef)(null),V=(0,g.useRef)(null),H=(0,g.useId)(),U=S??`${H}-input`,W=C(M),{text:G,type:K,discard:q}=k(M,W),J=!(!G.trim()||x(G)),Y=c||h;F&&(Y||v)&&L(!1);let X=F&&!Y&&!v;(0,g.useEffect)(()=>{r?.(!J),z.current?.setCustomValidity(J?`Enter a colour, such as #0052CC or rebeccapurple.`:``)},[J,r]),(0,g.useEffect)(()=>{if(!X)return;V.current&&d.n(V.current)[0]?.focus({preventScroll:!0});let e=e=>{let t=e.target;t&&!R.current?.contains(t)&&!V.current?.contains(t)&&L(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[X]);let Z=e=>{B.current=e,L(!X)},Q=()=>{L(!1),B.current?.focus({preventScroll:!0})},$={"aria-label":X?`Close colour picker`:`Open colour picker`,"aria-haspopup":`dialog`,"aria-expanded":X,"aria-controls":X?H:void 0,isDisabled:Y||v};return(0,_.jsxs)(`div`,{className:`ds-colour-field`,ref:R,onBlur:e=>{let t=e.relatedTarget;t&&!R.current?.contains(t)&&!V.current?.contains(t)&&L(!1)},onKeyDown:e=>{if(X&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Q()),!X||e.key!==`Tab`||!V.current?.contains(e.target))return;let t=d.n(V.current);(e.shiftKey?e.target===t[0]:e.target===t.at(-1))&&(e.preventDefault(),e.stopPropagation(),L(!1),e.shiftKey?B.current?.focus({preventScroll:!0}):R.current&&T(R.current))},children:[(0,_.jsx)(p.FieldAffix,{isLeadInteractive:!0,isTrailInteractive:!0,lead:(0,_.jsx)(l.Button,{"aria-hidden":`true`,tabIndex:-1,isDisabled:$.isDisabled,variant:`simple`,size:`xs`,isIconOnly:!0,onMouseDown:e=>e.preventDefault(),onClick:()=>{B.current=z.current,X?Q():L(!0)},children:(0,_.jsx)(`span`,{className:`ds-colour-swatch ds-colour-field__swatch`,style:{"--colour-swatch":W||`transparent`}})}),trail:(0,_.jsx)(l.Button,{...$,variant:`simple`,size:`xs`,isIconOnly:!0,iconStart:`chevron-down`,onClick:e=>Z(e.currentTarget)}),children:(0,_.jsx)(f.TextField,{...A,ref:u.t(z,j),id:U,disabled:Y,readOnly:v,spellCheck:!1,autoComplete:`off`,value:G,"aria-invalid":J||y||b||void 0,"aria-haspopup":`dialog`,"aria-controls":X?H:void 0,className:[`ds-colour-field__input`,w].filter(Boolean).join(` `),onChange:e=>{let t=e.target.value,n=!t.trim()||!!x(t);K(t,n),n&&P(t)},onBlur:e=>{J||q(),E?.(e)},onKeyDown:e=>{D?.(e),!e.defaultPrevented&&(e.key===`Enter`&&!J&&(e.preventDefault(),q()),e.key===`ArrowDown`&&!Y&&!v&&(e.preventDefault(),B.current=e.currentTarget,L(!0)))}})}),(0,_.jsx)(m.Popover,{anchorRef:z,anchorId:U,isOpen:X,placement:s,panelRef:V,id:H,role:`dialog`,"aria-label":`Choose a colour`,tabIndex:-1,className:`ds-colour-field__popover`,children:(0,_.jsx)(I,{colour:N,current:W,presets:i,showPresets:a,picker:o,onColourChange:e=>{q(),P(e)}})})]})});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return L}});
2
+ //# sourceMappingURL=ColourField-CJicr3OT.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColourField-CJicr3OT.cjs","names":["extend","namesPlugin","tabbableControls","useRef","useState","forwardRef","useRef","useState","useSyncExternalStore","useId","useMemo","_Fragment","Button","Slider","Icon","forwardRef","useState","useRef","useId","tabbableControls","FieldAffix","Button","TextField","mergeRefs","Popover","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__copyProps","from","keys","i","n","key","to","except","k","desc","__toESM","mod","isNodeMode","target","require_Icon","require_components_Button_index","require_mergeRefs","require_dialogFocus","require_components_TextField_index","require_components_FieldAffix_index","require_components_Popover_index","require_Slider","react","react_jsx_runtime","colord","colord_plugins_names","emptyColour","parseColour","text","value","hex","digits","digit","colour","colourHex","normaliseColour","colourState","parsed","previous","max","g","b","delta","h","next","focusAfterField","boundary","root","controls","element","clamp","ColourSquare","dragging","update","rect","event","onChange","isDisabled","step","change","useColourValue","internal","setInternal","defaultValue","current","selection","setSelection","onValueChange","useColourDraft","draft","setDraft","isValid","eyeDropperConstructor","subscribe","noPresets","presetColumns","presetTarget","column","index","lastInColumn","count","ColourPanel","rest","ColourPanelContent","commit","inputRef","active","disabledRef","isPicking","setPicking","pickerError","setPickerError","hasEyeDropper","presetsId","rgb","swatches","unique","preset","presets","normalised","selectedIndex","swatch","pickFromScreen","EyeDropper","result","onColourChange","error","className","style","picker","input","a","showPresets","radios","selected","ColourField","ariaInvalid","isOpen","setOpen","rootRef","openerRef","panelRef","panelId","fieldId","id","invalid","effectiveDisabled","disabled","readOnly","visible","onValidityChange","outside","toggle","opener","close","triggerProps","ref","isInvalid","valid","type","discard","onBlur","onKeyDown"],"sources":["../../src/components/ColourField/colour.ts","../../src/components/ColourField/focus.ts","../../src/components/ColourField/square.tsx","../../src/components/ColourField/value.ts","../../src/components/ColourField/panel.tsx","../../src/components/ColourField/index.tsx"],"sourcesContent":["import { colord, extend } from \"colord\";\nimport namesPlugin from \"colord/plugins/names\";\n\nextend([namesPlugin]);\n\nexport interface Colour {\n h: number;\n s: number;\n v: number;\n a: number;\n}\n\nconst emptyColour: Colour = { h: 0, s: 100, v: 0, a: 1 };\n\nexport function parseColour(value: string) {\n const text = value.trim();\n if (!text) {\n return null;\n }\n const hex = text.replace(/^#/, \"\");\n // Colord's string hex parser rounds alpha to two decimals. Decode hex bytes\n // first so a typed alpha survives normalisation and later opacity edits.\n const digits = hex.length < 5 ? [...hex].map((digit) => digit + digit).join(\"\") : hex;\n const colour = /^(?:[\\da-f]{3,4}|[\\da-f]{6}|[\\da-f]{8})$/i.test(hex)\n ? colord({\n r: parseInt(digits.slice(0, 2), 16),\n g: parseInt(digits.slice(2, 4), 16),\n b: parseInt(digits.slice(4, 6), 16),\n a: digits.length === 8 ? parseInt(digits.slice(6), 16) / 255 : 1,\n })\n : colord(text);\n return colour.isValid() ? colour : null;\n}\n\nexport function colourHex(colour: Colour) {\n return colord(colour).toHex().toUpperCase();\n}\n\nexport function normaliseColour(value: string) {\n return parseColour(value)?.toHex().toUpperCase() ?? \"\";\n}\n\n/** Preserve latent hue in greys, and saturation in black, including parent echoes. */\nexport function colourState(value: string, previous = emptyColour): Colour {\n const parsed = parseColour(value);\n if (!parsed || parsed.toHex().toUpperCase() === colourHex(previous)) {\n return previous;\n }\n // Keep full HSV precision: changing opacity must not quantise the RGB value.\n const { r, g, b, a } = parsed.rgba;\n const max = Math.max(r, g, b);\n const delta = max - Math.min(r, g, b);\n let h =\n delta === 0\n ? previous.h\n : max === r\n ? ((g - b) / delta) * 60\n : max === g\n ? ((b - r) / delta + 2) * 60\n : ((r - g) / delta + 4) * 60;\n if (h < 0) {\n h += 360;\n }\n const next = { h, s: max ? (delta / max) * 100 : 0, v: (max / 255) * 100, a };\n return { ...next, h: next.s === 0 ? previous.h : next.h, s: next.v === 0 ? previous.s : next.s };\n}\n","import { tabbableControls } from \"../../internal/dialogFocus\";\n\n/** Continue after the composed field, respecting an enclosing modal's focus boundary. */\nexport function focusAfterField(root: HTMLElement) {\n const boundary = root.closest<HTMLElement>(\"[aria-modal='true']\") ?? document.body;\n const controls = tabbableControls(boundary).filter((element) => !element.closest(\".ds-popover\"));\n const last = controls.map((element) => root.contains(element)).lastIndexOf(true);\n const next = controls[last + 1] ?? controls[0];\n next?.focus({ preventScroll: true });\n}\n","import { useRef, type KeyboardEvent, type PointerEvent } from \"react\";\nimport type { Colour } from \"./colour\";\n\ninterface ColourSquareProps {\n colour: Colour;\n isDisabled: boolean;\n onChange: (colour: Colour) => void;\n}\n\nfunction clamp(value: number) {\n return Math.max(0, Math.min(100, value));\n}\n\nexport function ColourSquare({ colour, isDisabled, onChange }: ColourSquareProps) {\n const dragging = useRef<number | null>(null);\n const update = (event: PointerEvent<HTMLDivElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n if (!rect.width || !rect.height) {\n return;\n }\n onChange({\n ...colour,\n s: clamp(((event.clientX - rect.left) / rect.width) * 100),\n v: clamp((1 - (event.clientY - rect.top) / rect.height) * 100),\n });\n };\n const handleKey = (event: KeyboardEvent) => {\n if (isDisabled) {\n return;\n }\n const step = event.shiftKey ? 10 : 1;\n const changes: Record<string, Partial<Colour>> = {\n ArrowLeft: { s: clamp(colour.s - step) },\n ArrowRight: { s: clamp(colour.s + step) },\n ArrowDown: { v: clamp(colour.v - step) },\n ArrowUp: { v: clamp(colour.v + step) },\n Home: { s: 0 },\n End: { s: 100 },\n };\n const change = changes[event.key];\n if (!change) {\n return;\n }\n event.preventDefault();\n onChange({ ...colour, ...change });\n };\n return (\n <div\n className=\"ds-colour-panel__square\"\n role=\"slider\"\n tabIndex={isDisabled ? -1 : 0}\n aria-label=\"Saturation and brightness\"\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={Math.round(colour.s)}\n aria-valuetext={`Saturation ${Math.round(colour.s)}%, brightness ${Math.round(colour.v)}%`}\n aria-disabled={isDisabled || undefined}\n onKeyDown={handleKey}\n onPointerDown={(event) => {\n if (isDisabled || event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.currentTarget.focus();\n dragging.current = event.pointerId;\n event.currentTarget.setPointerCapture(event.pointerId);\n update(event);\n }}\n onPointerMove={(event) => {\n if (!isDisabled && dragging.current === event.pointerId) {\n update(event);\n }\n }}\n onPointerUp={(event) => {\n if (dragging.current !== event.pointerId) {\n return;\n }\n dragging.current = null;\n event.currentTarget.releasePointerCapture(event.pointerId);\n }}\n onPointerCancel={() => {\n dragging.current = null;\n }}\n onLostPointerCapture={() => {\n dragging.current = null;\n }}\n >\n <span\n className=\"ds-colour-panel__thumb\"\n style={{ left: `${colour.s}%`, top: `${100 - colour.v}%` }}\n />\n </div>\n );\n}\n","import { useState } from \"react\";\nimport { colourHex, colourState, normaliseColour, type Colour } from \"./colour\";\n\nexport interface ColourValueProps {\n value?: string;\n defaultValue?: string;\n /** Uppercase hex (including alpha when needed), or an empty string when cleared. */\n onValueChange?: (value: string) => void;\n}\n\nexport function useColourValue({ value, defaultValue = \"\", onValueChange }: ColourValueProps) {\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n const [selection, setSelection] = useState(() => ({\n source: current,\n colour: colourState(current),\n }));\n let colour = selection.colour;\n if (selection.source !== current) {\n colour = colourState(current, colour);\n setSelection({ source: current, colour });\n }\n\n const commit = (next: string | Colour) => {\n const hex = typeof next === \"string\" ? normaliseColour(next) : colourHex(next);\n setSelection({\n source: hex,\n colour: typeof next === \"string\" ? colourState(next, colour) : next,\n });\n if (value === undefined) {\n setInternal(hex);\n }\n onValueChange?.(hex);\n };\n\n return { current, colour, commit };\n}\n\n/** Typed text the field shows until it is committed, blurred, or replaced. */\nexport function useColourDraft(current: string, hex: string) {\n const [draft, setDraft] = useState<{ source: string; text: string } | null>(null);\n // A draft belongs to the value it was typed over. A parent that stores the invalid\n // text (FormEditor does) takes it over, so restoring the earlier value then wins.\n if (draft && draft.source !== current && draft.text === current) {\n setDraft({ source: current, text: current });\n }\n const text = draft?.source === current ? draft.text : hex || current;\n /** Valid text becomes the committed hex; invalid text stays over the current value. */\n const type = (next: string, isValid: boolean) =>\n setDraft({ source: isValid ? normaliseColour(next) : current, text: next });\n return { text, type, discard: () => setDraft(null) };\n}\n","import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Slider } from \"../Slider\";\nimport { colourHex, colourState, normaliseColour, parseColour, type Colour } from \"./colour\";\nimport { ColourSquare } from \"./square\";\nimport { useColourValue, type ColourValueProps } from \"./value\";\nimport \"./style.css\";\n\nexport interface ColourPickerOptions {\n presets?: string[];\n showPresets?: boolean;\n picker?: \"custom\" | \"native\";\n isDisabled?: boolean;\n}\n\nexport interface ColourPanelProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, \"defaultValue\" | \"onChange\">,\n ColourValueProps,\n ColourPickerOptions {}\n\ninterface EyeDropperInstance {\n open: () => Promise<{ sRGBHex: string }>;\n}\nfunction eyeDropperConstructor() {\n return (window as Window & { EyeDropper?: new () => EyeDropperInstance }).EyeDropper;\n}\nconst subscribe = () => () => {};\nconst noPresets: string[] = [];\nconst presetColumns = 8;\n\n/** Where a key moves within the preset grid; rows wrap within their column. */\nfunction presetTarget(key: string, index: number, count: number) {\n const column = index % presetColumns;\n const lastInColumn = column + Math.floor((count - 1 - column) / presetColumns) * presetColumns;\n switch (key) {\n case \"Home\":\n return 0;\n case \"End\":\n return count - 1;\n case \"ArrowRight\":\n return (index + 1) % count;\n case \"ArrowLeft\":\n return (index - 1 + count) % count;\n case \"ArrowDown\":\n return index + presetColumns < count ? index + presetColumns : column;\n case \"ArrowUp\":\n return index >= presetColumns ? index - presetColumns : lastInColumn;\n default:\n return undefined;\n }\n}\n\n/** A standalone colour selection surface, also composed by ColourField. */\nexport const ColourPanel = forwardRef<HTMLDivElement, ColourPanelProps>(function ColourPanel(\n { value, defaultValue, onValueChange, ...rest },\n ref,\n) {\n const { current, colour, commit } = useColourValue({ value, defaultValue, onValueChange });\n return (\n <ColourPanelContent\n {...rest}\n ref={ref}\n colour={colour}\n current={current}\n onColourChange={commit}\n />\n );\n});\n\ninterface ColourPanelContentProps extends Omit<\n ColourPanelProps,\n \"value\" | \"defaultValue\" | \"onValueChange\"\n> {\n colour: Colour;\n current: string;\n onColourChange: (colour: Colour | string) => void;\n}\n\nexport const ColourPanelContent = forwardRef<HTMLDivElement, ColourPanelContentProps>(\n function ColourPanelContent(\n {\n colour,\n current,\n onColourChange,\n presets = noPresets,\n showPresets = true,\n picker = \"custom\",\n isDisabled = false,\n className,\n style,\n ...rest\n },\n ref,\n ) {\n const inputRef = useRef<HTMLInputElement>(null);\n const active = useRef(true);\n const disabledRef = useRef(isDisabled);\n const [isPicking, setPicking] = useState(false);\n const [pickerError, setPickerError] = useState(\"\");\n const hasEyeDropper = useSyncExternalStore(\n subscribe,\n () => Boolean(eyeDropperConstructor()),\n () => false,\n );\n const presetsId = useId();\n const hex = normaliseColour(current);\n const rgb = colourHex({ ...colour, a: 1 });\n // Equivalent spellings collapse onto the first; each preset is parsed once.\n const swatches = useMemo(() => {\n const unique = new Map<string, string>();\n for (const preset of presets) {\n const normalised = normaliseColour(preset);\n if (normalised && !unique.has(normalised)) {\n unique.set(normalised, preset);\n }\n }\n return [...unique].map(([normalised, preset]) => ({ normalised, preset }));\n }, [presets]);\n const selectedIndex = swatches.findIndex((swatch) => swatch.normalised === hex);\n useEffect(() => {\n disabledRef.current = isDisabled;\n }, [isDisabled]);\n useEffect(() => {\n active.current = true;\n return () => {\n active.current = false;\n };\n }, []);\n\n const pickFromScreen = async () => {\n const EyeDropper = eyeDropperConstructor();\n if (!EyeDropper || isDisabled || isPicking) {\n return;\n }\n setPicking(true);\n setPickerError(\"\");\n try {\n const result = await new EyeDropper().open();\n if (active.current && !disabledRef.current) {\n if (parseColour(result.sRGBHex)) {\n onColourChange({ ...colourState(result.sRGBHex, colour), a: colour.a });\n }\n }\n } catch (error) {\n if (active.current && !(error instanceof DOMException && error.name === \"AbortError\")) {\n setPickerError(\"Unable to pick a colour from the screen. Try again.\");\n }\n } finally {\n if (active.current) {\n setPicking(false);\n }\n }\n };\n\n return (\n <div\n {...rest}\n ref={ref}\n className={[\"ds-colour-panel\", className].filter(Boolean).join(\" \")}\n data-disabled={isDisabled || undefined}\n style={\n {\n ...style,\n \"--colour-hue\": `hsl(${colour.h} 100% 50%)`,\n \"--colour-rgb\": rgb,\n \"--colour-rgba\": colourHex(colour),\n } as CSSProperties\n }\n >\n <div className=\"ds-colour-panel__head\">\n <span>Colour</span>\n <span className=\"ds-colour-panel__value\">{hex || \"No colour\"}</span>\n </div>\n {picker === \"custom\" ? (\n <>\n <ColourSquare\n colour={colour}\n isDisabled={isDisabled}\n onChange={onColourChange}\n />\n <div className=\"ds-colour-panel__hue-row\">\n {hasEyeDropper && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"pipette\"\n aria-label=\"Pick from screen\"\n isDisabled={isDisabled}\n // Busy, not pending: a pending Button disables itself and drops focus.\n aria-busy={isPicking || undefined}\n onClick={() => void pickFromScreen()}\n />\n )}\n <Slider\n className=\"ds-colour-panel__hue\"\n value={colour.h}\n min={0}\n max={360}\n step={1}\n hasValueLabel={false}\n aria-label=\"Hue\"\n aria-valuetext={`${Math.round(colour.h)} degrees`}\n isDisabled={isDisabled}\n onValueChange={(h) => onColourChange({ ...colour, h })}\n onKeyDown={(event) => {\n if (\n !event.shiftKey ||\n ![\"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\"].includes(event.key)\n ) {\n return;\n }\n event.preventDefault();\n const delta = event.key === \"ArrowRight\" || event.key === \"ArrowUp\" ? 15 : -15;\n onColourChange({ ...colour, h: Math.max(0, Math.min(360, colour.h + delta)) });\n }}\n />\n </div>\n </>\n ) : (\n <div className=\"ds-colour-panel__native\">\n <input\n ref={inputRef}\n type=\"color\"\n value={rgb}\n tabIndex={-1}\n aria-hidden=\"true\"\n disabled={isDisabled}\n onChange={(event) => {\n if (parseColour(event.target.value)) {\n onColourChange({ ...colourState(event.target.value, colour), a: colour.a });\n }\n }}\n />\n <Button\n variant=\"neutral\"\n size=\"sm\"\n iconStart=\"pipette\"\n isDisabled={isDisabled}\n onClick={() => {\n const input = inputRef.current;\n if (!input) {\n return;\n }\n try {\n if (input.showPicker) {\n input.showPicker();\n } else {\n input.click();\n }\n } catch {\n input.click();\n }\n }}\n >\n Custom colour…\n </Button>\n </div>\n )}\n <div className=\"ds-colour-panel__opacity\">\n <label htmlFor={`${presetsId}-opacity`}>Opacity</label>\n <Slider\n id={`${presetsId}-opacity`}\n className=\"ds-colour-panel__alpha\"\n value={Math.round(colour.a * 100)}\n min={0}\n max={100}\n step={1}\n suffix=\"%\"\n isDisabled={isDisabled}\n onValueChange={(a) => onColourChange({ ...colour, a: a / 100 })}\n />\n </div>\n {showPresets && swatches.length > 0 && (\n <div className=\"ds-colour-panel__presets\">\n <span\n id={presetsId}\n className=\"ds-colour-panel__presets-label\"\n >\n Presets\n </span>\n <div\n className=\"ds-colour-panel__grid\"\n role=\"radiogroup\"\n aria-labelledby={presetsId}\n style={{ \"--colour-preset-columns\": presetColumns } as CSSProperties}\n onKeyDown={(event) => {\n const radios = Array.from(\n event.currentTarget.querySelectorAll<HTMLButtonElement>(\"[role='radio']\"),\n );\n const index = radios.indexOf(event.target as HTMLButtonElement);\n const next = index < 0 ? undefined : presetTarget(event.key, index, radios.length);\n if (next === undefined) {\n return;\n }\n event.preventDefault();\n radios[next]?.focus();\n radios[next]?.click();\n }}\n >\n {swatches.map(({ normalised, preset }, index) => {\n const selected = index === selectedIndex;\n return (\n <Button\n key={normalised}\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n role=\"radio\"\n aria-checked={selected}\n aria-label={preset}\n title={preset}\n tabIndex={index === Math.max(0, selectedIndex) ? 0 : -1}\n isDisabled={isDisabled}\n className=\"ds-colour-panel__preset\"\n onClick={() => onColourChange(preset)}\n >\n <span\n className=\"ds-colour-swatch\"\n style={{ \"--colour-swatch\": normalised } as CSSProperties}\n >\n {selected && (\n <Icon\n name=\"check\"\n size={16}\n strokeWidth={3}\n />\n )}\n </span>\n </Button>\n );\n })}\n </div>\n </div>\n )}\n {pickerError && (\n <span\n className=\"ds-colour-panel__error\"\n role=\"status\"\n >\n {pickerError}\n </span>\n )}\n </div>\n );\n },\n);\n","import { forwardRef, useEffect, useId, useRef, useState, type CSSProperties } from \"react\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport { TextField, type TextFieldProps } from \"../TextField\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { normaliseColour, parseColour } from \"./colour\";\nimport { tabbableControls } from \"../../internal/dialogFocus\";\nimport { focusAfterField } from \"./focus\";\nimport { ColourPanelContent, type ColourPickerOptions } from \"./panel\";\nimport { useColourDraft, useColourValue, type ColourValueProps } from \"./value\";\nimport \"./style.css\";\n\nexport { ColourPanel } from \"./panel\";\nexport type { ColourPanelProps } from \"./panel\";\n\nexport interface ColourFieldProps\n extends\n Omit<TextFieldProps, \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"children\">,\n ColourValueProps,\n ColourPickerOptions {\n isInvalid?: boolean;\n placement?: PopoverPlacement;\n /** Parsing validity; an empty value is valid and native required validation remains separate. */\n onValidityChange?: (isValid: boolean) => void;\n}\n\n/** A typed colour value and a visual picker, bound to the shared Field frame. */\nexport const ColourField = forwardRef<HTMLInputElement, ColourFieldProps>(function ColourField(\n {\n value,\n defaultValue,\n onValueChange,\n onValidityChange,\n presets,\n showPresets,\n picker,\n placement,\n isDisabled = false,\n disabled,\n readOnly,\n isInvalid,\n \"aria-invalid\": ariaInvalid,\n id,\n className,\n onBlur,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const { current, colour, commit } = useColourValue({ value, defaultValue, onValueChange });\n const [isOpen, setOpen] = useState(false);\n const rootRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const openerRef = useRef<HTMLElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const panelId = useId();\n const fieldId = id ?? `${panelId}-input`;\n const hex = normaliseColour(current);\n const { text, type, discard } = useColourDraft(current, hex);\n const invalid = Boolean(text.trim() && !parseColour(text));\n const effectiveDisabled = isDisabled || disabled;\n if (isOpen && (effectiveDisabled || readOnly)) {\n setOpen(false);\n }\n const visible = isOpen && !effectiveDisabled && !readOnly;\n\n useEffect(() => {\n onValidityChange?.(!invalid);\n inputRef.current?.setCustomValidity(\n invalid ? \"Enter a colour, such as #0052CC or rebeccapurple.\" : \"\",\n );\n }, [invalid, onValidityChange]);\n\n useEffect(() => {\n if (!visible) {\n return;\n }\n if (panelRef.current) {\n tabbableControls(panelRef.current)[0]?.focus({ preventScroll: true });\n }\n const outside = (event: MouseEvent) => {\n const target = event.target as Node;\n if (target && !rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", outside);\n return () => document.removeEventListener(\"mousedown\", outside);\n }, [visible]);\n\n const toggle = (opener: HTMLElement) => {\n openerRef.current = opener;\n setOpen(!visible);\n };\n const close = () => {\n setOpen(false);\n openerRef.current?.focus({ preventScroll: true });\n };\n const triggerProps = {\n \"aria-label\": visible ? \"Close colour picker\" : \"Open colour picker\",\n \"aria-haspopup\": \"dialog\" as const,\n \"aria-expanded\": visible,\n \"aria-controls\": visible ? panelId : undefined,\n isDisabled: effectiveDisabled || readOnly,\n };\n\n return (\n <div\n className=\"ds-colour-field\"\n ref={rootRef}\n onBlur={(event) => {\n const target = event.relatedTarget as Node | null;\n if (target && !rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n }}\n onKeyDown={(event) => {\n if (visible && event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n close();\n }\n if (!visible || event.key !== \"Tab\" || !panelRef.current?.contains(event.target as Node)) {\n return;\n }\n const controls = tabbableControls(panelRef.current);\n const atBoundary = event.shiftKey\n ? event.target === controls[0]\n : event.target === controls.at(-1);\n if (!atBoundary) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n if (event.shiftKey) {\n openerRef.current?.focus({ preventScroll: true });\n } else if (rootRef.current) {\n focusAfterField(rootRef.current);\n }\n }}\n >\n <FieldAffix\n isLeadInteractive\n isTrailInteractive\n lead={\n // A pointer shortcut only: the chevron is the one keyboard and screen\n // reader trigger. The swatch never takes focus; the input gets it back.\n <Button\n aria-hidden=\"true\"\n tabIndex={-1}\n isDisabled={triggerProps.isDisabled}\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n openerRef.current = inputRef.current;\n if (visible) {\n close();\n } else {\n setOpen(true);\n }\n }}\n >\n <span\n className=\"ds-colour-swatch ds-colour-field__swatch\"\n style={{ \"--colour-swatch\": hex || \"transparent\" } as CSSProperties}\n />\n </Button>\n }\n trail={\n <Button\n {...triggerProps}\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n iconStart=\"chevron-down\"\n onClick={(event) => toggle(event.currentTarget)}\n />\n }\n >\n <TextField\n {...rest}\n ref={mergeRefs(inputRef, ref)}\n id={fieldId}\n disabled={effectiveDisabled}\n readOnly={readOnly}\n spellCheck={false}\n autoComplete=\"off\"\n value={text}\n aria-invalid={invalid || isInvalid || ariaInvalid || undefined}\n aria-haspopup=\"dialog\"\n aria-controls={visible ? panelId : undefined}\n className={[\"ds-colour-field__input\", className].filter(Boolean).join(\" \")}\n onChange={(event) => {\n const next = event.target.value;\n const valid = !next.trim() || Boolean(parseColour(next));\n type(next, valid);\n if (valid) {\n commit(next);\n }\n }}\n onBlur={(event) => {\n if (!invalid) {\n discard();\n }\n onBlur?.(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) {\n return;\n }\n if (event.key === \"Enter\" && !invalid) {\n event.preventDefault();\n discard();\n }\n if (event.key === \"ArrowDown\" && !effectiveDisabled && !readOnly) {\n event.preventDefault();\n openerRef.current = event.currentTarget;\n setOpen(true);\n }\n }}\n />\n </FieldAffix>\n <Popover\n anchorRef={inputRef}\n anchorId={fieldId}\n isOpen={visible}\n placement={placement}\n panelRef={panelRef}\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose a colour\"\n // A click on the padding or a label focuses the dialog rather than the page,\n // so the field's own Escape handler still runs before an enclosing Modal's.\n tabIndex={-1}\n className=\"ds-colour-field__popover\"\n >\n <ColourPanelContent\n colour={colour}\n current={hex}\n presets={presets}\n showPresets={showPresets}\n picker={picker}\n onColourChange={(next) => {\n discard();\n commit(next);\n }}\n />\n </Popover>\n </div>\n );\n});\n"],"mappings":"A,07BAGAA,EAAAA,EAAAA,OAAAA,CAAO,CAACC,EAAAA,OAAW,CAAC,EASpB,IAAMwD,EAAsB,CAAE,EAAG,EAAG,EAAG,IAAK,EAAG,EAAG,EAAG,CAAE,EAEvD,SAAgBC,EAAY,EAAe,CACzC,IAAMC,EAAOC,EAAM,KAAK,EACxB,GAAI,CAACD,EACH,OAAO,KAET,IAAME,EAAMF,EAAK,QAAQ,KAAM,EAAE,EAG3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