@canonical/react-ds-global-form 0.30.0 → 0.31.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 (63) hide show
  1. package/dist/esm/density.css +234 -0
  2. package/dist/esm/docs/examples/density-examples.css +20 -0
  3. package/dist/esm/index.css +66 -6
  4. package/dist/esm/lib/_work_in_progress/DensityTestbed/Testbed.js +77 -0
  5. package/dist/esm/lib/_work_in_progress/DensityTestbed/Testbed.js.map +1 -0
  6. package/dist/esm/lib/_work_in_progress/DensityTestbed/baseline-system.css +81 -0
  7. package/dist/esm/lib/_work_in_progress/DensityTestbed/density.testbed.css +153 -0
  8. package/dist/esm/lib/_work_in_progress/DensityTestbed/mocks.js +23 -0
  9. package/dist/esm/lib/_work_in_progress/DensityTestbed/mocks.js.map +1 -0
  10. package/dist/esm/lib/common/Wrapper/styles.css +3 -1
  11. package/dist/esm/lib/common/bindField/bindField.js +15 -8
  12. package/dist/esm/lib/common/bindField/bindField.js.map +1 -1
  13. package/dist/esm/lib/component/ChoicesField/common/Option/Option.js +1 -1
  14. package/dist/esm/lib/component/ChoicesField/common/Option/Option.js.map +1 -1
  15. package/dist/esm/lib/component/ChoicesField/styles.css +55 -15
  16. package/dist/esm/lib/component/DateField/DateField.js +19 -1
  17. package/dist/esm/lib/component/DateField/DateField.js.map +1 -1
  18. package/dist/esm/lib/component/FileUploadField/FileUploadField.js +40 -3
  19. package/dist/esm/lib/component/FileUploadField/FileUploadField.js.map +1 -1
  20. package/dist/esm/lib/component/NumberField/NumberField.js +1 -1
  21. package/dist/esm/lib/component/NumberField/NumberField.js.map +1 -1
  22. package/dist/esm/lib/component/RangeField/RangeField.js +1 -1
  23. package/dist/esm/lib/component/RangeField/RangeField.js.map +1 -1
  24. package/dist/esm/lib/subcomponent/CheckboxInput/styles.css +45 -16
  25. package/dist/esm/lib/subcomponent/DateInput/styles.css +12 -0
  26. package/dist/esm/lib/subcomponent/DateTimeInput/styles.css +13 -0
  27. package/dist/esm/lib/subcomponent/Field/Label/Label.js +1 -3
  28. package/dist/esm/lib/subcomponent/Field/Label/Label.js.map +1 -1
  29. package/dist/esm/lib/subcomponent/Field/Label/styles.css +2 -3
  30. package/dist/esm/lib/subcomponent/FileUploadInput/FileUploadInput.js +11 -21
  31. package/dist/esm/lib/subcomponent/FileUploadInput/FileUploadInput.js.map +1 -1
  32. package/dist/esm/lib/subcomponent/FileUploadInput/styles.css +3 -3
  33. package/dist/esm/lib/subcomponent/PasswordInput/styles.css +5 -6
  34. package/dist/esm/lib/subcomponent/RadioInput/styles.css +36 -7
  35. package/dist/esm/lib/subcomponent/RangeInput/styles.css +10 -9
  36. package/dist/esm/lib/subcomponent/SwitchInput/styles.css +27 -10
  37. package/dist/esm/lib/subcomponent/TextInput/TextInput.js +1 -1
  38. package/dist/esm/lib/subcomponent/TextInput/TextInput.js.map +1 -1
  39. package/dist/esm/lib/subcomponent/TextareaInput/TextareaInput.js +1 -3
  40. package/dist/esm/lib/subcomponent/TextareaInput/TextareaInput.js.map +1 -1
  41. package/dist/esm/lib/subcomponent/TextareaInput/styles.css +4 -9
  42. package/dist/esm/lib/subcomponent/TimeInput/styles.css +8 -0
  43. package/dist/esm/lib/utils/countries/countries.js +1 -1
  44. package/dist/esm/lib/utils/countries/countries.js.map +1 -1
  45. package/dist/esm/lib/utils/hooks/useFieldError.js +21 -24
  46. package/dist/esm/lib/utils/hooks/useFieldError.js.map +1 -1
  47. package/dist/types/lib/_work_in_progress/DensityTestbed/Testbed.d.ts +42 -0
  48. package/dist/types/lib/_work_in_progress/DensityTestbed/Testbed.d.ts.map +1 -0
  49. package/dist/types/lib/_work_in_progress/DensityTestbed/mocks.d.ts +26 -0
  50. package/dist/types/lib/_work_in_progress/DensityTestbed/mocks.d.ts.map +1 -0
  51. package/dist/types/lib/common/bindField/bindField.d.ts.map +1 -1
  52. package/dist/types/lib/common/bindField/types.d.ts +14 -5
  53. package/dist/types/lib/common/bindField/types.d.ts.map +1 -1
  54. package/dist/types/lib/component/DateField/DateField.d.ts +3 -2
  55. package/dist/types/lib/component/DateField/DateField.d.ts.map +1 -1
  56. package/dist/types/lib/component/FileUploadField/FileUploadField.d.ts +8 -5
  57. package/dist/types/lib/component/FileUploadField/FileUploadField.d.ts.map +1 -1
  58. package/dist/types/lib/subcomponent/Field/Label/Label.d.ts.map +1 -1
  59. package/dist/types/lib/subcomponent/FileUploadInput/FileUploadInput.d.ts.map +1 -1
  60. package/dist/types/lib/subcomponent/TextareaInput/TextareaInput.d.ts.map +1 -1
  61. package/dist/types/lib/utils/hooks/useFieldError.d.ts +14 -0
  62. package/dist/types/lib/utils/hooks/useFieldError.d.ts.map +1 -1
  63. package/package.json +13 -13
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Baseline-alignment spike — testbed stylesheet (WORK IN PROGRESS)
3
+ *
4
+ * SPIKE surface, not shipping CSS. Scoped under `.density-testbed`.
5
+ *
6
+ * Layout philosophy (per session S TODOs 2–4, 7):
7
+ * · No cards, no field labels — zero chrome noise.
8
+ * · LINE-BASED: each bucket is ONE horizontal line of inline-block elements.
9
+ * Overflow-x scroll is fine; we are reading vertical alignment, not layout.
10
+ * · One bucket per story.
11
+ * · Every line starts with a few letters of paragraph-style text (the `.p`
12
+ * reference), so controls can be read against prose on the same baseline.
13
+ *
14
+ * The baseline grid overlay comes from the styles-debug plugin (story
15
+ * `parameters.baseline`); the box seat uses the shipped engine model (the
16
+ * alternative top-align + external-margin model lives in SPIKE.md).
17
+ */
18
+
19
+ /* ── The testbed root ── */
20
+ .density-testbed {
21
+ /* --baseline-height is 4px. Source of truth, in order:
22
+ 1. @canonical/styles-typography's baseline-shim.css registers it via
23
+ `@property … initial-value: 0.25rem`, so the engine ALWAYS has 4px even
24
+ if styles-main did not load (order-independent — learned from the
25
+ typography example, which loads an engine standalone). Then
26
+ 2. @canonical/styles' spacing.css sets it explicitly to 0.25rem when present.
27
+ The literal fallback below is belt-and-suspenders; the @property makes it
28
+ redundant. Nothing to override here. */
29
+ padding: 0 var(--baseline-height, 0.25rem);
30
+ color: var(--color-text, #1a1a1a);
31
+ }
32
+
33
+ /* ───────────────────────────────────────────────────────────────────────────
34
+ * Bucket row — REGULAR component layout, no flattening or overrides
35
+ *
36
+ * A simple inline row: a short prose lead, then the components in their NORMAL
37
+ * structure laid inline. Controls are top-referenced density boxes (the density
38
+ * system seats each one's text on the grid INTERNALLY), so the row aligns the
39
+ * boxes by their TOPS. No block padding — the row must sit at the canvas origin
40
+ * so what we read is the density system's own grid registration, not a nudge. */
41
+ .density-testbed__row {
42
+ display: flex;
43
+ flex-wrap: nowrap; /* one horizontal line — overflow scrolls, never wraps */
44
+ align-items: flex-start;
45
+ gap: calc(var(--baseline-height) * 3); /* 12px */
46
+ overflow-x: auto;
47
+ }
48
+ .density-testbed__row > * {
49
+ flex: 0 0 auto; /* natural width, don't grow/shrink; the row scrolls instead */
50
+ }
51
+ .density-testbed__row > .p {
52
+ margin: 0;
53
+ }
54
+
55
+ /* Re-seat the reference LEAD to the density target (TESTBED ONLY) ──────────────
56
+ * Prose is engine-seated now (Stage A), which lands it on the NEAREST grid line —
57
+ * one baseline off from the controls' density TARGET line. The lead only exists to
58
+ * be read against the controls, so here (and only here) we opt it back into the
59
+ * exact density seat the controls use: crush to line-height 1, then pad the top by
60
+ * the same `target − (1em+1cap)/2` the shipping controls use. This is calibration
61
+ * of a measuring stick, NOT a change to how prose ships. */
62
+ .density-testbed__row > .density-testbed__lead.p {
63
+ line-height: 1;
64
+ padding-block-start: max(
65
+ 0px,
66
+ calc(var(--density-target-baseline-px, 0px) - calc((1em + 1cap) / 2))
67
+ );
68
+ padding-block-end: 0;
69
+ }
70
+
71
+ /* ───────────────────────────────────────────────────────────────────────────
72
+ * Boxed controls — the two alignment models
73
+ *
74
+ * `.spike-box` is a bordered box whose interior is a single line of `.p` text
75
+ * (button label, input value, nav item, table cell). Inline-block so it sits on
76
+ * the line. The text seat reads the engine's --start-nudge / --end-nudge.
77
+ * ─────────────────────────────────────────────────────────────────────────── */
78
+ .density-testbed .spike-box {
79
+ --box-border-width: 1px;
80
+ --box-padding-inline: var(--density-padding-inline, 0.75rem);
81
+
82
+ display: inline-flex;
83
+ align-items: stretch;
84
+ box-sizing: border-box;
85
+ vertical-align: baseline;
86
+ border: var(--box-border-width) solid var(--color-border, #b3b3b3);
87
+ border-radius: var(--dimension-radius-100, 0.25rem);
88
+ padding-inline: var(--box-padding-inline);
89
+ background: var(--color-background, #fff);
90
+ }
91
+
92
+ .density-testbed .spike-box > .seat {
93
+ display: block;
94
+ white-space: nowrap;
95
+ }
96
+
97
+ /* Shared-border stack (list/table rows) — laid horizontally on the line here,
98
+ each cell a box; the shared-border collapse is between inline siblings. */
99
+ .density-testbed .spike-rows {
100
+ display: inline-flex;
101
+ vertical-align: baseline;
102
+ }
103
+ .density-testbed .spike-rows > .spike-box {
104
+ border-radius: 0;
105
+ }
106
+ .density-testbed .spike-rows > .spike-box + .spike-box {
107
+ border-inline-start: none;
108
+ }
109
+
110
+ /* Box seat — the shipped engine model: engine's asymmetric nudges, both borders
111
+ * on the grid. (The current/proposed model toggle was removed; the alternative
112
+ * top-align + external-margin model is documented in SPIKE.md.) */
113
+ .density-testbed .spike-box > .seat {
114
+ padding-block-start: var(--start-nudge);
115
+ padding-block-end: var(--end-nudge);
116
+ }
117
+
118
+ /* ───────────────────────────────────────────────────────────────────────────
119
+ * Typography bucket (TODO 5) — real paragraph text at several sizes on one line,
120
+ * to witness how the 4px baseline affects cap-based nudges (TODO 6). Inline so
121
+ * the sizes sit next to each other and can be read against the grid together.
122
+ * ─────────────────────────────────────────────────────────────────────────── */
123
+ .density-testbed__type {
124
+ display: flex;
125
+ align-items: flex-start;
126
+ gap: calc(var(--baseline-height) * 4);
127
+ overflow-x: auto;
128
+ white-space: nowrap;
129
+ padding-block: calc(var(--baseline-height) * 2);
130
+ }
131
+
132
+ /* Stacked full paragraphs of each tier, one after another, below the inline
133
+ row — so a real prose BLOCK of each tier can be read against the grid. */
134
+ .density-testbed__prose {
135
+ max-width: 40rem;
136
+ margin-top: calc(var(--baseline-height) * 4);
137
+ }
138
+
139
+ /* Both sections use the package's own tags (h1..h6, p). The engine sizes each
140
+ tier; we only reset the demo margins so the grid reading is clean. No custom
141
+ size classes — each tag IS its tier. */
142
+ .density-testbed__type > :where(h1, h2, h3, h4, h5, h6, p),
143
+ .density-testbed__prose > :where(h1, h2, h3, h4, h5, h6, p) {
144
+ margin: 0;
145
+ }
146
+
147
+ /* ── Density inline lever (retained) ── */
148
+ .density-comfortable {
149
+ --density-padding-inline: 0.75rem;
150
+ }
151
+ .density-dense {
152
+ --density-padding-inline: 0.5rem;
153
+ }
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Baseline-alignment spike — boxed-control primitive + mocks (WORK IN PROGRESS)
4
+ *
5
+ * `SpikeBox` is the unit under test: a bordered box whose interior is a single
6
+ * line of `.p`-tier text (a stand-in for a button label, input value, nav-item
7
+ * text or table-cell text). Its seat uses the shipped engine model (the
8
+ * asymmetric start/end nudges from `density.testbed.css`); the alternative
9
+ * external-margin model was dropped, so there is no model toggle. Using one
10
+ * primitive keeps buckets comparing like-for-like; the real Button/inputs are
11
+ * shown alongside in the story for reference.
12
+ */
13
+ /** A boxed control: border + a `.p` text seat, seated on the grid by the engine's
14
+ * start/end nudges (see density.testbed.css). */
15
+ export const SpikeBox = ({ children, as = "div", role, }) => {
16
+ const Tag = as;
17
+ return (_jsx(Tag, { className: "spike-box", role: role, type: as === "button" ? "button" : undefined, children: _jsx("span", { className: "seat p", children: children }) }));
18
+ };
19
+ /** A run of boxed cells sharing one border — the list/table-row case, laid out
20
+ * inline on the bucket line (the CSS collapses the between-borders). Exercises
21
+ * how per-cell external margin interacts with a shared border. */
22
+ export const SpikeRows = ({ rows }) => (_jsx("div", { className: "spike-rows", children: rows.map((r) => (_jsx(SpikeBox, { children: r }, r))) }));
23
+ //# sourceMappingURL=mocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../../../../src/lib/_work_in_progress/DensityTestbed/mocks.tsx"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG;AAEH;kDACkD;AAClD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,QAAQ,EACR,EAAE,GAAG,KAAK,EACV,IAAI,GAKL,EAAsB,EAAE;IACvB,MAAM,GAAG,GAAG,EAAE,CAAC;IACf,OAAO,CACL,KAAC,GAAG,IACF,SAAS,EAAC,WAAW,EACrB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAE5C,eAAM,SAAS,EAAC,QAAQ,YAAE,QAAQ,GAAQ,GACtC,CACP,CAAC;AACJ,CAAC,CAAC;AAEF;;mEAEmE;AACnE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAsB,EAAsB,EAAE,CAAC,CAC7E,cAAK,SAAS,EAAC,YAAY,YACxB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACf,KAAC,QAAQ,cAAU,CAAC,IAAL,CAAC,CAAgB,CACjC,CAAC,GACE,CACP,CAAC"}
@@ -2,7 +2,9 @@
2
2
  display: grid;
3
3
  grid-template-columns: subgrid;
4
4
  grid-column: var(--form-field-columns, 1 / -1);
5
- row-gap: var(--form-field-inline-gap);
5
+ /* Vertical gap from the label row down to the payload row. Uses the block-axis
6
+ label-gap token — NOT --form-field-inline-gap (that is horizontal-only now). */
7
+ row-gap: var(--form-field-label-gap);
6
8
  align-items: baseline;
7
9
 
8
10
  & > .ds.field-label {
@@ -23,17 +23,24 @@ Presentational, mode, options = {}) {
23
23
  const label = Presentational.displayName ||
24
24
  Presentational.name ||
25
25
  "Input";
26
- // Merge the field's register defaults UNDER the consumer's registerProps. Cast
27
- // once: RHF's RegisterOptions is a discriminated union (e.g. `valueAsNumber`
28
- // excludes `pattern`), which an object spread cannot satisfy structurally even
29
- // though the merged value is valid at runtime.
30
- const mergeRegister = (registerProps) => ({ ...options.registerDefaults, ...registerProps });
26
+ // Merge the field's `additionalRegisterProps` UNDER the consumer's
27
+ // registerProps (consumer always wins). `additionalRegisterProps` may be a
28
+ // static object or a function of the component's own props; resolve it per
29
+ // render against `props`. Cast once: RHF's RegisterOptions is a discriminated
30
+ // union (e.g. `valueAsNumber` excludes `pattern`), which an object spread
31
+ // cannot satisfy structurally even though the merged value is valid at runtime.
32
+ const mergeRegister = (registerProps, props) => {
33
+ const extra = typeof options.additionalRegisterProps === "function"
34
+ ? options.additionalRegisterProps(props)
35
+ : options.additionalRegisterProps;
36
+ return { ...extra, ...registerProps };
37
+ };
31
38
  let Bound;
32
39
  if (mode === "controlled") {
33
40
  Bound = ({ name, registerProps, ...rest }) => {
34
41
  const { field } = useController({
35
42
  name,
36
- rules: registerProps,
43
+ rules: mergeRegister(registerProps, rest),
37
44
  ...(options.defaultValue !== undefined
38
45
  ? { defaultValue: options.defaultValue }
39
46
  : {}),
@@ -55,7 +62,7 @@ Presentational, mode, options = {}) {
55
62
  return createElement(Presentational, {
56
63
  ...rest,
57
64
  value,
58
- ...register(name, mergeRegister(registerProps)),
65
+ ...register(name, mergeRegister(registerProps, rest)),
59
66
  });
60
67
  };
61
68
  }
@@ -64,7 +71,7 @@ Presentational, mode, options = {}) {
64
71
  const { register } = useFormContext();
65
72
  return createElement(Presentational, {
66
73
  ...rest,
67
- ...register(name, mergeRegister(registerProps)),
74
+ ...register(name, mergeRegister(registerProps, rest)),
68
75
  });
69
76
  };
70
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"bindField.js","sourceRoot":"","sources":["../../../../../src/lib/common/bindField/bindField.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAW,MAAM,OAAO,CAAC;AACnE,OAAO,EAEL,aAAa,EACb,cAAc,EACd,QAAQ,GACT,MAAM,iBAAi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AAa,CAAC,cAAc,EAAE;gBACnC,GAAG,IAAI;gBACP,KAAK;gBACL,GAAG,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;aACtD,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,IAAI,EAAK,EAAE,EAAE;YAC9C,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,EAAE,CAAC;YACtC,OAAO,aAAa,CAAC,cAAc,EAAE;gBACnC,GAAG,IAAI;gBACP,GAAG,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;aACtD,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,GAAG,aAAa,KAAK,GAAG,CAAC;IAC1C,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -9,7 +9,7 @@ const componentCssClassName = "ds option";
9
9
  */
10
10
  const Option = ({ name, type, option, checked, disabled, onChange, }) => {
11
11
  const ariaProps = useOptionAriaProperties(name, option.value);
12
- return (_jsxs("div", { className: [componentCssClassName, "grid", disabled && "disabled"]
12
+ return (_jsxs("div", { className: [componentCssClassName, disabled && "disabled"]
13
13
  .filter(Boolean)
14
14
  .join(" "), children: [_jsx("input", { name: name, value: option.value, disabled: disabled, type: type, checked: checked, onChange: onChange, ...ariaProps.input }), _jsx("label", { className: "p", ...ariaProps.label, children: option.label })] }));
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Option.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/ChoicesField/common/Option/Option.tsx"],"names":[],"mappings":";AAGA,OAAO,uBAAuB,MAAM,oDAAoD,CAAC;AAGzF,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,GACI,EAAsB,EAAE;IACpC,MAAM,SAAS,GAAG,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9D,OAAO,CACL,eACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,MAAM,EAAE,QAAQ,IAAI,UAAU,CAAC;aAC/D,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,aAEZ,gBACE,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,KACd,SAAS,CAAC,KAAK,GACnB,EAEF,gBAAO,SAAS,EAAC,GAAG,KAAK,SAAS,CAAC,KAAK,YACrC,MAAM,CAAC,KAAK,GACP,IACJ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Option.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/ChoicesField/common/Option/Option.tsx"],"names":[],"mappings":";AAGA,OAAO,uBAAuB,MAAM,oDAAoD,CAAC;AAGzF,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,GACI,EAAsB,EAAE;IACpC,MAAM,SAAS,GAAG,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9D,OAAO,CACL,eACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,QAAQ,IAAI,UAAU,CAAC;aACvD,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,aAEZ,gBACE,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,KACd,SAAS,CAAC,KAAK,GACnB,EAEF,gBAAO,SAAS,EAAC,GAAG,KAAK,SAAS,CAAC,KAAK,YACrC,MAAM,CAAC,KAAK,GACP,IACJ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -5,7 +5,9 @@
5
5
  margin: 0;
6
6
  display: flex;
7
7
  flex-wrap: wrap;
8
- gap: 0 var(--container-gap-loose);
8
+ /* Row gap gives stacked/wrapped options vertical breathing room (was 0, so
9
+ * stacked items touched); column gap is the inline separation (per review). */
10
+ gap: var(--form-group-gap) var(--container-gap-loose);
9
11
 
10
12
  /* Stacked: one option per line */
11
13
  &.stacked {
@@ -39,21 +41,35 @@
39
41
  & > input[type="radio"] {
40
42
  appearance: none;
41
43
  box-sizing: border-box;
42
- width: calc(var(--space-baseline) * 2); /* 16px — 2bU */
43
- height: calc(var(--space-baseline) * 2); /* 16px — 2bU */
44
+ width: var(--dimension-200); /* 16px */
45
+ height: var(--dimension-200); /* 16px */
44
46
  border: var(--dimension-stroke-thickness-medium) solid var(--color-border);
45
47
  border-radius: 50%;
46
- background-color: var(--color-foreground-radio-unselected);
48
+ background-color: var(
49
+ --surface-color-foreground-radio-unselected,
50
+ var(--color-foreground-radio-unselected)
51
+ );
47
52
  cursor: inherit;
48
53
  transition:
49
54
  background-color 150ms ease,
50
55
  border-color 150ms ease;
51
56
 
52
57
  &:checked {
53
- border-color: var(--color-foreground-radio-selected);
58
+ border-color: var(
59
+ --surface-color-foreground-radio-selected,
60
+ var(--color-foreground-radio-selected)
61
+ );
54
62
  background: radial-gradient(
55
- var(--color-foreground-radio-selected) 40%,
56
- var(--color-foreground-radio-unselected) 41%
63
+ var(
64
+ --surface-color-foreground-radio-selected,
65
+ var(--color-foreground-radio-selected)
66
+ )
67
+ 40%,
68
+ var(
69
+ --surface-color-foreground-radio-unselected,
70
+ var(--color-foreground-radio-unselected)
71
+ )
72
+ 41%
57
73
  );
58
74
  }
59
75
 
@@ -61,8 +77,18 @@
61
77
  background-color: var(--color-foreground-radio-unselected-hover);
62
78
  }
63
79
 
80
+ /* Hover shifts only the dot's fill (channel shade), not a whole-element
81
+ * brightness filter that would also dim the ring. */
64
82
  &:checked:hover:not(:disabled) {
65
- filter: brightness(0.9);
83
+ border-color: var(--hover--color-foreground-radio-selected);
84
+ background: radial-gradient(
85
+ var(--hover--color-foreground-radio-selected) 40%,
86
+ var(
87
+ --surface-color-foreground-radio-unselected,
88
+ var(--color-foreground-radio-unselected)
89
+ )
90
+ 41%
91
+ );
66
92
  }
67
93
 
68
94
  &:focus-visible {
@@ -81,11 +107,14 @@
81
107
  appearance: none;
82
108
  box-sizing: border-box;
83
109
  position: relative;
84
- width: calc(var(--space-baseline) * 2); /* 16px — 2bU */
85
- height: calc(var(--space-baseline) * 2); /* 16px — 2bU */
110
+ width: var(--dimension-200); /* 16px */
111
+ height: var(--dimension-200); /* 16px */
86
112
  border: var(--dimension-stroke-thickness-medium) solid var(--color-border);
87
113
  border-radius: var(--dimension-radius-small);
88
- background-color: var(--color-foreground-checkbox-unselected);
114
+ background-color: var(
115
+ --surface-color-foreground-checkbox-unselected,
116
+ var(--color-foreground-checkbox-unselected)
117
+ );
89
118
  cursor: inherit;
90
119
  transition:
91
120
  background-color 150ms ease,
@@ -107,11 +136,20 @@
107
136
  }
108
137
 
109
138
  &:checked {
110
- background: var(--color-foreground-checkbox-selected);
111
- border-color: var(--color-foreground-checkbox-selected);
139
+ background: var(
140
+ --surface-color-foreground-checkbox-selected,
141
+ var(--color-foreground-checkbox-selected)
142
+ );
143
+ border-color: var(
144
+ --surface-color-foreground-checkbox-selected,
145
+ var(--color-foreground-checkbox-selected)
146
+ );
112
147
 
113
148
  &::before {
114
- background-color: var(--color-foreground-checkbox-checkmark);
149
+ background-color: var(
150
+ --surface-color-foreground-checkbox-checkmark,
151
+ var(--color-foreground-checkbox-checkmark)
152
+ );
115
153
  mask-image: url("/icons/checkmark.svg#checkmark");
116
154
  -webkit-mask-image: url("/icons/checkmark.svg#checkmark");
117
155
  }
@@ -121,8 +159,10 @@
121
159
  background-color: var(--color-foreground-checkbox-unselected-hover);
122
160
  }
123
161
 
162
+ /* Hover shifts only the fill (channel shade), not the masked checkmark. */
124
163
  &:checked:hover:not(:disabled) {
125
- filter: brightness(0.9);
164
+ background-color: var(--hover--color-foreground-checkbox-selected);
165
+ border-color: var(--hover--color-foreground-checkbox-selected);
126
166
  }
127
167
 
128
168
  &:focus-visible {
@@ -1,11 +1,29 @@
1
1
  import bindField from "../../common/bindField/index.js";
2
2
  import withWrapper from "../../common/Wrapper/withWrapper.js";
3
3
  import { DateInput } from "../../subcomponent/DateInput/index.js";
4
+ /**
5
+ * Turn the `min`/`max` date props into react-hook-form `min`/`max` rules so an
6
+ * out-of-range date reports an inline error — the native attributes alone only
7
+ * constrain the picker UI and never reach RHF. ISO `YYYY-MM-DD` strings compare
8
+ * lexicographically, so the native rule works directly on the stored value.
9
+ */
10
+ const dateRangeRules = ({ min, max, }) => {
11
+ const rules = {};
12
+ if (typeof min === "string" && min) {
13
+ rules.min = { value: min, message: `Date must be on or after ${min}.` };
14
+ }
15
+ if (typeof max === "string" && max) {
16
+ rules.max = { value: max, message: `Date must be on or before ${max}.` };
17
+ }
18
+ return rules;
19
+ };
4
20
  /**
5
21
  * Date input bound to react-hook-form, wrapped with field chrome
6
22
  * (label, description, error) and middleware/conditional-display support.
7
23
  *
8
24
  * `import { DateField } from "@canonical/react-ds-global-form";`
9
25
  */
10
- export default withWrapper(bindField(DateInput, "native"));
26
+ export default withWrapper(bindField(DateInput, "native", {
27
+ additionalRegisterProps: dateRangeRules,
28
+ }));
11
29
  //# sourceMappingURL=DateField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateField.js","sourceRoot":"","sources":["../../../../../src/lib/component/DateField/DateField.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAGlE;;;;;GAKG;AACH,eAAe,WAAW,CACxB,SAAS,CAAiB,SAAS,EAAE,QAAQ,CAAC,CAC/C,CAAC"}
1
+ {"version":3,"file":"DateField.js","sourceRoot":"","sources":["../../../../../src/lib/component/DateField/DateField.tsx"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAGlE;;;;;GAKG;AACH,MAAM,cAAc,GAAG,CAAC,EACtB,GAAG,EACH,GAAG,GACqB,EAAmB,EAAE;IAC7C,MAAM,KAAK,GAAoB,EAAE,CAAC;IAClC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,EAAE,CAAC;QACnC,KAAK,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,4BAA4B,GAAG,GAAG,EAAE,CAAC;IAC1E,CAAC;IACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,EAAE,CAAC;QACnC,KAAK,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,6BAA6B,GAAG,GAAG,EAAE,CAAC;IAC3E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;GAKG;AACH,eAAe,WAAW,CACxB,SAAS,CAAiB,SAAS,EAAE,QAAQ,EAAE;IAC7C,uBAAuB,EAAE,cAAc;CACxC,CAAC,CACH,CAAC"}
@@ -1,14 +1,51 @@
1
1
  import bindField from "../../common/bindField/index.js";
2
2
  import withWrapper from "../../common/Wrapper/withWrapper.js";
3
3
  import { FileUploadInput } from "../../subcomponent/FileUploadInput/index.js";
4
+ const formatFileSize = (bytes) => {
5
+ if (bytes < 1024)
6
+ return `${bytes} B`;
7
+ if (bytes < 1024 * 1024)
8
+ return `${Math.round(bytes / 1024)} KB`;
9
+ return `${Math.round((bytes / (1024 * 1024)) * 10) / 10} MB`;
10
+ };
4
11
  /**
5
- * FileUploadInput bound to react-hook-form (controlled), wrapped with field chrome.
6
- * The `defaultValue` preserves the registration default the original leaf set
7
- * in `useController` (`[]`).
12
+ * Turn the `maxFiles`/`maxSize` props into a react-hook-form `validate` rule on
13
+ * the selected `File[]`, so an over-limit or oversized selection reports a
14
+ * standard field error (via the Wrapper's FieldError). Validation lives at the
15
+ * field/RHF layer — the presentational input just reports the chosen files.
16
+ */
17
+ const fileConstraintRules = ({ maxFiles, maxSize, }) => {
18
+ const hasMaxFiles = typeof maxFiles === "number";
19
+ const hasMaxSize = typeof maxSize === "number";
20
+ if (!hasMaxFiles && !hasMaxSize)
21
+ return {};
22
+ return {
23
+ validate: (value) => {
24
+ const files = Array.isArray(value) ? value : [];
25
+ if (hasMaxFiles && files.length > maxFiles) {
26
+ return `You can upload at most ${maxFiles} file${maxFiles === 1 ? "" : "s"}.`;
27
+ }
28
+ if (hasMaxSize) {
29
+ const tooBig = files.find((file) => file.size > maxSize);
30
+ if (tooBig) {
31
+ return `${tooBig.name} exceeds ${formatFileSize(maxSize)}.`;
32
+ }
33
+ }
34
+ return true;
35
+ },
36
+ };
37
+ };
38
+ /**
39
+ * FileUploadInput bound to react-hook-form (controlled), wrapped with field
40
+ * chrome. The `defaultValue` preserves the registration default the original
41
+ * leaf set in `useController` (`[]`). `maxFiles`/`maxSize` are enforced as RHF
42
+ * validation rules so violations surface as a standard field error rather than
43
+ * being silently dropped in the input.
8
44
  *
9
45
  * `import { FileUploadField } from "@canonical/react-ds-global-form";`
10
46
  */
11
47
  export default withWrapper(bindField(FileUploadInput, "controlled", {
12
48
  defaultValue: [],
49
+ additionalRegisterProps: fileConstraintRules,
13
50
  }));
14
51
  //# sourceMappingURL=FileUploadField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploadField.js","sourceRoot":"","sources":["../../../../../src/lib/component/FileUploadField/FileUploadField.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAG9E;;;;;;GAMG;AACH,eAAe,WAAW,CACxB,SAAS,CAAuB,eAAe,EAAE,YAAY,EAAE;IAC7D,YAAY,EAAE,EAAE;CACjB,CAAC,CACH,CAAC"}
1
+ {"version":3,"file":"FileUploadField.js","sourceRoot":"","sources":["../../../../../src/lib/component/FileUploadField/FileUploadField.tsx"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAG9E,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE;IAC/C,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACjE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC;AAC/D,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,CAAC,EAC3B,QAAQ,EACR,OAAO,GACiB,EAAmB,EAAE;IAC7C,MAAM,WAAW,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC;IACjD,MAAM,UAAU,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC;IAC/C,IAAI,CAAC,WAAW,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAE3C,OAAO;QACL,QAAQ,EAAE,CAAC,KAAc,EAAE,EAAE;YAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,IAAI,WAAW,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;gBAC3C,OAAO,0BAA0B,QAAQ,QACvC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACxB,GAAG,CAAC;YACN,CAAC;YACD,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;gBACzD,IAAI,MAAM,EAAE,CAAC;oBACX,OAAO,GAAG,MAAM,CAAC,IAAI,YAAY,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC;gBAC9D,CAAC;YACH,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAe,WAAW,CACxB,SAAS,CAAuB,eAAe,EAAE,YAAY,EAAE;IAC7D,YAAY,EAAE,EAAE;IAChB,uBAAuB,EAAE,mBAAmB;CAC7C,CAAC,CACH,CAAC"}
@@ -13,6 +13,6 @@ export default withWrapper(
13
13
  // `valueAsNumber` so RHF stores a number, not the string the native
14
14
  // `<input type="number">` reports (the consumer's registerProps still win).
15
15
  bindField(NumberInput, "native", {
16
- registerDefaults: { valueAsNumber: true },
16
+ additionalRegisterProps: { valueAsNumber: true },
17
17
  }));
18
18
  //# sourceMappingURL=NumberField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField.js","sourceRoot":"","sources":["../../../../../src/lib/component/NumberField/NumberField.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AAExD,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAGtE;;;;;;GAMG;AACH,eAAe,WAAW;AACxB,oEAAoE;AACpE,4EAA4E;AAC5E,SAAS,CAAmB,WAAW,EAAE,QAAQ,EAAE;IACjD,gBAAgB,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;CAC1C,CAAC,CACH,CAAC"}
1
+ {"version":3,"file":"NumberField.js","sourceRoot":"","sources":["../../../../../src/lib/component/NumberField/NumberField.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AAExD,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAGtE;;;;;;GAMG;AACH,eAAe,WAAW;AACxB,oEAAoE;AACpE,4EAA4E;AAC5E,SAAS,CAAmB,WAAW,EAAE,QAAQ,EAAE;IACjD,uBAAuB,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;CACjD,CAAC,CACH,CAAC"}
@@ -14,6 +14,6 @@ import { RangeControl } from "./common/index.js";
14
14
  * `import { RangeField } from "@canonical/react-ds-global-form";`
15
15
  */
16
16
  export default withWrapper(bindField(RangeControl, "native", {
17
- registerDefaults: { valueAsNumber: true },
17
+ additionalRegisterProps: { valueAsNumber: true },
18
18
  }));
19
19
  //# sourceMappingURL=RangeField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RangeField.js","sourceRoot":"","sources":["../../../../../src/lib/component/RangeField/RangeField.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,eAAe,WAAW,CACxB,SAAS,CAAkB,YAAY,EAAE,QAAQ,EAAE;IACjD,gBAAgB,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;CAC1C,CAAC,CACH,CAAC"}
1
+ {"version":3,"file":"RangeField.js","sourceRoot":"","sources":["../../../../../src/lib/component/RangeField/RangeField.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,eAAe,WAAW,CACxB,SAAS,CAAkB,YAAY,EAAE,QAAQ,EAAE;IACjD,uBAAuB,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;CACjD,CAAC,CACH,CAAC"}
@@ -6,11 +6,18 @@
6
6
  /* Align to the field edge like the label (no side margin by default), not to
7
7
  * the input's inner padding. Overridable via the shared variable. */
8
8
  margin-inline: var(--form-label-padding-inline, 0);
9
- width: calc(var(--space-baseline) * 2); /* 16px — 2bU */
10
- height: calc(var(--space-baseline) * 2); /* 16px — 2bU */
9
+ /* A 16px control — a fixed element size, NOT a baseline multiple. It was
10
+ `--space-baseline × 2` (16px when the baseline was 8px), but the 4px-baseline
11
+ spike halved it to 8px. Size to the stable --dimension-200 (16px) so the
12
+ control size is decoupled from the baseline grid unit. */
13
+ width: var(--dimension-200);
14
+ height: var(--dimension-200);
11
15
  border: var(--dimension-stroke-thickness-medium) solid var(--color-border);
12
16
  border-radius: var(--dimension-radius-small);
13
- background: var(--color-foreground-checkbox-unselected);
17
+ background: var(
18
+ --surface-color-foreground-checkbox-unselected,
19
+ var(--color-foreground-checkbox-unselected)
20
+ );
14
21
  cursor: pointer;
15
22
  transition:
16
23
  background-color 150ms ease,
@@ -42,11 +49,22 @@
42
49
 
43
50
  &:checked {
44
51
  position: relative;
45
- background: var(--color-foreground-checkbox-selected);
46
- border-color: var(--color-foreground-checkbox-selected);
52
+ /* Selected fill + checkmark read the surface-provided tokens (with a flat
53
+ * fallback) so the control adapts to OnSurface stepping. */
54
+ background: var(
55
+ --surface-color-foreground-checkbox-selected,
56
+ var(--color-foreground-checkbox-selected)
57
+ );
58
+ border-color: var(
59
+ --surface-color-foreground-checkbox-selected,
60
+ var(--color-foreground-checkbox-selected)
61
+ );
47
62
 
48
63
  &::before {
49
- background-color: var(--color-foreground-checkbox-checkmark);
64
+ background-color: var(
65
+ --surface-color-foreground-checkbox-checkmark,
66
+ var(--color-foreground-checkbox-checkmark)
67
+ );
50
68
  mask-image: url("/icons/checkmark.svg#checkmark");
51
69
  -webkit-mask-image: url("/icons/checkmark.svg#checkmark");
52
70
  }
@@ -54,11 +72,20 @@
54
72
 
55
73
  &:indeterminate {
56
74
  position: relative;
57
- background: var(--color-foreground-checkbox-selected);
58
- border-color: var(--color-foreground-checkbox-selected);
75
+ background: var(
76
+ --surface-color-foreground-checkbox-selected,
77
+ var(--color-foreground-checkbox-selected)
78
+ );
79
+ border-color: var(
80
+ --surface-color-foreground-checkbox-selected,
81
+ var(--color-foreground-checkbox-selected)
82
+ );
59
83
 
60
84
  &::before {
61
- background-color: var(--color-foreground-checkbox-checkmark);
85
+ background-color: var(
86
+ --surface-color-foreground-checkbox-checkmark,
87
+ var(--color-foreground-checkbox-checkmark)
88
+ );
62
89
  mask-image: url("/icons/minus.svg#minus");
63
90
  -webkit-mask-image: url("/icons/minus.svg#minus");
64
91
  }
@@ -68,14 +95,16 @@
68
95
  background: var(--color-foreground-checkbox-unselected-hover);
69
96
  }
70
97
 
71
- &:checked:hover:not(:disabled) {
72
- background-color: var(--color-foreground-checkbox-selected);
73
- filter: brightness(0.9);
74
- }
75
-
98
+ /* Hover on a selected/indeterminate box shifts ONLY the fill, not the
99
+ * checkmark/minus glyph (per design review): the background swaps to the
100
+ * hovered selected shade while `::before` keeps its own colour. The hover
101
+ * shade comes from the `--hover--…-selected` channel (criticality-style OKLCH
102
+ * delta shim), replacing the old whole-element `filter: brightness()` that
103
+ * also dimmed the glyph. */
104
+ &:checked:hover:not(:disabled),
76
105
  &:indeterminate:hover:not(:disabled) {
77
- background-color: var(--color-foreground-checkbox-selected);
78
- filter: brightness(0.9);
106
+ background-color: var(--hover--color-foreground-checkbox-selected);
107
+ border-color: var(--hover--color-foreground-checkbox-selected);
79
108
  }
80
109
 
81
110
  &:focus-visible {
@@ -12,4 +12,16 @@
12
12
  &::-webkit-inner-spin-button {
13
13
  display: none;
14
14
  }
15
+
16
+ /* NOTE (design review) — two native-<input type="date"> limits parked for Diana:
17
+ * 1. "Suggested" format text → muted: NOT implementable in pure CSS. No
18
+ * placeholder attribute (so `:placeholder-shown` never matches), and
19
+ * `::-webkit-datetime-edit` colours the whole edit region — mask AND typed
20
+ * value — with no empty-state selector, and Firefox ignores it. Needs a
21
+ * custom (non-native) control or a JS empty-state hook.
22
+ * 2. Calendar indicator → pragma icon: no calendar glyph exists in
23
+ * @canonical/ds-assets to mask onto `::-webkit-calendar-picker-indicator`,
24
+ * and that pseudo-element is WebKit/Chromium-only (Firefox draws its own,
25
+ * unstyleable). Needs a new ds-assets glyph + Chrome/Safari-only styling, or
26
+ * a custom control. */
15
27
  }