@canonical/react-ds-global-form 0.30.0 → 0.32.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 (111) hide show
  1. package/dist/esm/density.css +357 -0
  2. package/dist/esm/docs/examples/density-examples.css +20 -0
  3. package/dist/esm/index.css +110 -12
  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/ToggleWrapper.css +33 -4
  11. package/dist/esm/lib/common/Wrapper/ToggleWrapper.js +2 -2
  12. package/dist/esm/lib/common/Wrapper/ToggleWrapper.js.map +1 -1
  13. package/dist/esm/lib/common/Wrapper/styles.css +15 -1
  14. package/dist/esm/lib/common/Wrapper/withToggleWrapper.js +11 -1
  15. package/dist/esm/lib/common/Wrapper/withToggleWrapper.js.map +1 -1
  16. package/dist/esm/lib/common/bindField/bindField.js +15 -8
  17. package/dist/esm/lib/common/bindField/bindField.js.map +1 -1
  18. package/dist/esm/lib/component/ChoicesField/common/Option/Option.js +1 -1
  19. package/dist/esm/lib/component/ChoicesField/common/Option/Option.js.map +1 -1
  20. package/dist/esm/lib/component/ChoicesField/styles.css +55 -15
  21. package/dist/esm/lib/component/DateField/DateField.js +19 -1
  22. package/dist/esm/lib/component/DateField/DateField.js.map +1 -1
  23. package/dist/esm/lib/component/FileUploadField/FileUploadField.js +40 -3
  24. package/dist/esm/lib/component/FileUploadField/FileUploadField.js.map +1 -1
  25. package/dist/esm/lib/component/NumberField/NumberField.js +1 -1
  26. package/dist/esm/lib/component/NumberField/NumberField.js.map +1 -1
  27. package/dist/esm/lib/component/RangeField/RangeField.js +1 -1
  28. package/dist/esm/lib/component/RangeField/RangeField.js.map +1 -1
  29. package/dist/esm/lib/component/SwitchField/SwitchField.js +6 -1
  30. package/dist/esm/lib/component/SwitchField/SwitchField.js.map +1 -1
  31. package/dist/esm/lib/subcomponent/CheckboxInput/styles.css +45 -16
  32. package/dist/esm/lib/subcomponent/DateInput/styles.css +12 -0
  33. package/dist/esm/lib/subcomponent/DateTimeInput/styles.css +13 -0
  34. package/dist/esm/lib/subcomponent/Field/Label/Label.js +1 -3
  35. package/dist/esm/lib/subcomponent/Field/Label/Label.js.map +1 -1
  36. package/dist/esm/lib/subcomponent/Field/Label/styles.css +2 -3
  37. package/dist/esm/lib/subcomponent/FileUploadInput/FileUploadInput.js +11 -21
  38. package/dist/esm/lib/subcomponent/FileUploadInput/FileUploadInput.js.map +1 -1
  39. package/dist/esm/lib/subcomponent/FileUploadInput/styles.css +3 -3
  40. package/dist/esm/lib/subcomponent/PasswordInput/styles.css +5 -6
  41. package/dist/esm/lib/subcomponent/RadioInput/styles.css +36 -7
  42. package/dist/esm/lib/subcomponent/RangeInput/styles.css +10 -9
  43. package/dist/esm/lib/subcomponent/SelectInput/styles.css +32 -4
  44. package/dist/esm/lib/subcomponent/SwitchInput/styles.css +27 -10
  45. package/dist/esm/lib/subcomponent/TextInput/TextInput.js +1 -1
  46. package/dist/esm/lib/subcomponent/TextInput/TextInput.js.map +1 -1
  47. package/dist/esm/lib/subcomponent/TextareaInput/TextareaInput.js +1 -3
  48. package/dist/esm/lib/subcomponent/TextareaInput/TextareaInput.js.map +1 -1
  49. package/dist/esm/lib/subcomponent/TextareaInput/styles.css +4 -9
  50. package/dist/esm/lib/subcomponent/TimeInput/styles.css +8 -0
  51. package/dist/esm/lib/utils/countries/countries.js +1 -1
  52. package/dist/esm/lib/utils/countries/countries.js.map +1 -1
  53. package/dist/esm/lib/utils/hooks/useFieldError.js +21 -24
  54. package/dist/esm/lib/utils/hooks/useFieldError.js.map +1 -1
  55. package/dist/types/lib/_work_in_progress/DensityTestbed/Testbed.d.ts +42 -0
  56. package/dist/types/lib/_work_in_progress/DensityTestbed/Testbed.d.ts.map +1 -0
  57. package/dist/types/lib/_work_in_progress/DensityTestbed/mocks.d.ts +26 -0
  58. package/dist/types/lib/_work_in_progress/DensityTestbed/mocks.d.ts.map +1 -0
  59. package/dist/types/lib/common/Wrapper/ToggleWrapper.d.ts +1 -1
  60. package/dist/types/lib/common/Wrapper/ToggleWrapper.d.ts.map +1 -1
  61. package/dist/types/lib/common/Wrapper/withToggleWrapper.d.ts +4 -1
  62. package/dist/types/lib/common/Wrapper/withToggleWrapper.d.ts.map +1 -1
  63. package/dist/types/lib/common/Wrapper/withWrapper.d.ts +1 -1
  64. package/dist/types/lib/common/Wrapper/withWrapper.d.ts.map +1 -1
  65. package/dist/types/lib/common/bindField/bindField.d.ts.map +1 -1
  66. package/dist/types/lib/common/bindField/types.d.ts +14 -5
  67. package/dist/types/lib/common/bindField/types.d.ts.map +1 -1
  68. package/dist/types/lib/common/types.d.ts +1 -0
  69. package/dist/types/lib/common/types.d.ts.map +1 -1
  70. package/dist/types/lib/component/ChoicesField/ChoicesField.d.ts +1 -0
  71. package/dist/types/lib/component/ChoicesField/ChoicesField.d.ts.map +1 -1
  72. package/dist/types/lib/component/ColorField/ColorField.d.ts +1 -0
  73. package/dist/types/lib/component/ColorField/ColorField.d.ts.map +1 -1
  74. package/dist/types/lib/component/ComboboxField/ComboboxField.d.ts +1 -0
  75. package/dist/types/lib/component/ComboboxField/ComboboxField.d.ts.map +1 -1
  76. package/dist/types/lib/component/DateField/DateField.d.ts +4 -2
  77. package/dist/types/lib/component/DateField/DateField.d.ts.map +1 -1
  78. package/dist/types/lib/component/DateTimeField/DateTimeField.d.ts +1 -0
  79. package/dist/types/lib/component/DateTimeField/DateTimeField.d.ts.map +1 -1
  80. package/dist/types/lib/component/FileUploadField/FileUploadField.d.ts +9 -5
  81. package/dist/types/lib/component/FileUploadField/FileUploadField.d.ts.map +1 -1
  82. package/dist/types/lib/component/HiddenField/HiddenField.d.ts +1 -0
  83. package/dist/types/lib/component/HiddenField/HiddenField.d.ts.map +1 -1
  84. package/dist/types/lib/component/NumberField/NumberField.d.ts +1 -0
  85. package/dist/types/lib/component/NumberField/NumberField.d.ts.map +1 -1
  86. package/dist/types/lib/component/PasswordField/PasswordField.d.ts +1 -0
  87. package/dist/types/lib/component/PasswordField/PasswordField.d.ts.map +1 -1
  88. package/dist/types/lib/component/PhoneField/PhoneField.d.ts +1 -0
  89. package/dist/types/lib/component/PhoneField/PhoneField.d.ts.map +1 -1
  90. package/dist/types/lib/component/RangeField/RangeField.d.ts +1 -0
  91. package/dist/types/lib/component/RangeField/RangeField.d.ts.map +1 -1
  92. package/dist/types/lib/component/RatingField/RatingField.d.ts +1 -0
  93. package/dist/types/lib/component/RatingField/RatingField.d.ts.map +1 -1
  94. package/dist/types/lib/component/RichChoicesField/RichChoicesField.d.ts +1 -0
  95. package/dist/types/lib/component/RichChoicesField/RichChoicesField.d.ts.map +1 -1
  96. package/dist/types/lib/component/SelectField/SelectField.d.ts +1 -0
  97. package/dist/types/lib/component/SelectField/SelectField.d.ts.map +1 -1
  98. package/dist/types/lib/component/SwitchField/SwitchField.d.ts +5 -0
  99. package/dist/types/lib/component/SwitchField/SwitchField.d.ts.map +1 -1
  100. package/dist/types/lib/component/TextField/TextField.d.ts +1 -0
  101. package/dist/types/lib/component/TextField/TextField.d.ts.map +1 -1
  102. package/dist/types/lib/component/TextareaField/TextareaField.d.ts +1 -0
  103. package/dist/types/lib/component/TextareaField/TextareaField.d.ts.map +1 -1
  104. package/dist/types/lib/component/TimeField/TimeField.d.ts +1 -0
  105. package/dist/types/lib/component/TimeField/TimeField.d.ts.map +1 -1
  106. package/dist/types/lib/subcomponent/Field/Label/Label.d.ts.map +1 -1
  107. package/dist/types/lib/subcomponent/FileUploadInput/FileUploadInput.d.ts.map +1 -1
  108. package/dist/types/lib/subcomponent/TextareaInput/TextareaInput.d.ts.map +1 -1
  109. package/dist/types/lib/utils/hooks/useFieldError.d.ts +14 -0
  110. package/dist/types/lib/utils/hooks/useFieldError.d.ts.map +1 -1
  111. package/package.json +14 -14
@@ -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,CAA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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"}
@@ -7,7 +7,12 @@ import { SwitchInput } from "../../subcomponent/SwitchInput/index.js";
7
7
  * middleware/conditional-display support. Requires at least one of
8
8
  * `label`/`controlLabel`.
9
9
  *
10
+ * The label defaults to the LEFT of the switch (`labelPosition: "before"`): a
11
+ * label before a switch names its purpose, which is the switch convention (a
12
+ * label after would read as the switch's state). Callers can override with
13
+ * `labelPosition="after"`.
14
+ *
10
15
  * `import { SwitchField } from "@canonical/react-ds-global-form";`
11
16
  */
12
- export default withToggleWrapper(bindField(SwitchInput, "native"));
17
+ export default withToggleWrapper(bindField(SwitchInput, "native"), { labelPosition: "before" });
13
18
  //# sourceMappingURL=SwitchField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SwitchField.js","sourceRoot":"","sources":["../../../../../src/lib/component/SwitchField/SwitchField.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iCAAiC,CAAC;AAExD,OAAO,iBAAiB,MAAM,2CAA2C,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAItE;;;;;;;GAOG;AACH,eAAe,iBAAiB,CAC9B,SAAS,CAAwB,WAAW,EAAE,QAAQ,CAAC,CACxD,CAAC"}
1
+ {"version":3,"file":"SwitchField.js","sourceRoot":"","sources":["../../../../../src/lib/component/SwitchField/SwitchField.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iCAAiC,CAAC;AAExD,OAAO,iBAAiB,MAAM,2CAA2C,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAItE;;;;;;;;;;;;GAYG;AACH,eAAe,iBAAiB,CAC9B,SAAS,CAAwB,WAAW,EAAE,QAAQ,CAAC,EACvD,EAAE,aAAa,EAAE,QAAQ,EAAE,CAC5B,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
  }
@@ -12,4 +12,17 @@
12
12
  &::-webkit-inner-spin-button {
13
13
  display: none;
14
14
  }
15
+
16
+ /* NOTE (design review) — two native-<input type="datetime-local"> limits
17
+ * parked for Diana:
18
+ * 1. "Suggested" format text → muted: NOT implementable in pure CSS. No
19
+ * placeholder attribute (so `:placeholder-shown` never matches), and
20
+ * `::-webkit-datetime-edit` colours the whole edit region — mask AND typed
21
+ * value — with no empty-state selector, and Firefox ignores it. Needs a
22
+ * custom (non-native) control or a JS empty-state hook.
23
+ * 2. Calendar/clock indicator → pragma icon: no calendar/clock glyph exists in
24
+ * @canonical/ds-assets to mask onto `::-webkit-calendar-picker-indicator`,
25
+ * and that pseudo-element is WebKit/Chromium-only (Firefox draws its own,
26
+ * unstyleable). Needs a new ds-assets glyph + Chrome/Safari-only styling, or
27
+ * a custom control. */
15
28
  }
@@ -21,9 +21,7 @@ const Label = ({ id, children, className, style, name, isOptional, requiredIndic
21
21
  // informational and belongs in the accessible name.
22
22
  const markRequired = requiredIndicator === "required" && !isOptional;
23
23
  const showOptionalSuffix = requiredIndicator === "optional" && isOptional;
24
- return (_jsxs(Element, { id: id, style: style, htmlFor: Element === "label" ? htmlFor : undefined, "data-required": markRequired || undefined, className: [componentCssClassName, "p", className]
25
- .filter(Boolean)
26
- .join(" "), children: [children || name, showOptionalSuffix && (_jsxs("span", { className: "optional", children: [" (", messages.optional(), ")"] }))] }));
24
+ return (_jsxs(Element, { id: id, style: style, htmlFor: Element === "label" ? htmlFor : undefined, "data-required": markRequired || undefined, className: [componentCssClassName, className].filter(Boolean).join(" "), children: [children || name, showOptionalSuffix && (_jsxs("span", { className: "optional", children: [" (", messages.optional(), ")"] }))] }));
27
25
  };
28
26
  export default Label;
29
27
  //# sourceMappingURL=Label.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/Field/Label/Label.tsx"],"names":[],"mappings":";AAGA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAE/C,iDAAiD;AACjD,MAAM,eAAe,GAAG;IACtB,QAAQ,EAAE,GAAG,EAAE,CAAC,UAAU;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,KAAK,GAAG,CAAC,EACb,EAAE,EACF,QAAQ,EACR,SAAS,EACT,KAAK,EACL,IAAI,EACJ,UAAU,EACV,iBAAiB,GAAG,UAAU,EAC9B,QAAQ,GAAG,eAAe,EAC1B,OAAO,EACP,GAAG,EAAE,OAAO,GAAG,OAAO,G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C,2EAA2E;IAC3E,uEAAuE;IACvE,8EAA8E;IAC9E,wEAAwE;IACxE,mFAAmF;IACnF,mEAAmE;IACnE,oDAAoD;IACpD,MAAM,YAAY,GAAG,iBAAiB,KAAK,UAAU,IAAI,CAAC,UAAU,CAAC;IACrE,MAAM,kBAAkB,GAAG,iBAAiB,KAAK,UAAU,IAAI,UAAU,CAAC;IAE1E,OAAO,CACL,MAAC,OAAO,IACN,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,mBACnC,YAAY,IAAI,SAAS,EACxC,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aAEtE,QAAQ,IAAI,IAAI,EAChB,kBAAkB,IAAI,CACrB,gBAAM,SAAS,EAAC,UAAU,mBAAI,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAC3D,IACO,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -1,5 +1,5 @@
1
1
  .ds.field-label {
2
- font-weight: var(--form-label-font-weight, bold);
2
+ font-weight: var(--form-label-font-weight, normal);
3
3
  color: var(--form-label-color);
4
4
  /* No side padding by default — the label aligns to the field edge, not the
5
5
  * input's inner padding. Overridable via the variable. */
@@ -18,9 +18,8 @@
18
18
  }
19
19
 
20
20
  /* The "(optional)" suffix is a muted hint, visually subordinate to the label
21
- * (which is bold) — not the same weight/colour as the label text. */
21
+ * — distinguished by colour (the label now uses regular paragraph weight too). */
22
22
  & > .optional {
23
- font-weight: var(--typography-text-primary-font-weight, normal);
24
23
  color: var(--color-text-muted);
25
24
  }
26
25
  }
@@ -10,34 +10,24 @@ const componentCssClassName = "ds input file-upload";
10
10
  *
11
11
  * `import { FileUploadInput } from "@canonical/react-ds-global-form";`
12
12
  */
13
- export const FileUploadInput = ({ id, className, style, value, onChange, accept, maxSize, maxFiles, multiple = false, disabled = false, ...otherProps }) => {
13
+ export const FileUploadInput = ({ id, className, style, value, onChange, accept,
14
+ // Destructured out of `otherProps` so they are NOT spread onto the drop-zone
15
+ // <button> as invalid DOM attributes. The FIELD reads them (as RHF validation
16
+ // rules); the presentational input does not enforce them.
17
+ maxSize, maxFiles, multiple = false, disabled = false, ...otherProps }) => {
14
18
  const inputRef = useRef(null);
15
19
  const [isDragOver, setIsDragOver] = useState(false);
16
20
  const files = Array.isArray(value) ? value : [];
17
- const validateFile = useCallback((file) => {
18
- if (maxSize && file.size > maxSize) {
19
- return `${file.name} exceeds ${formatFileSize(maxSize)}`;
20
- }
21
- return null;
22
- }, [maxSize]);
21
+ /* Presentational only: report the chosen files up via `onChange`. Constraint
22
+ * validation (maxFiles/maxSize) lives on the FIELD as a react-hook-form
23
+ * `validate` rule so violations surface through the standard FieldError,
24
+ * rather than being enforced (and silently dropped) here. `maxFiles`/`maxSize`
25
+ * are still accepted for the field to read and for the native `accept` hint. */
23
26
  const addFiles = useCallback((incoming) => {
24
27
  const newFiles = Array.from(incoming);
25
- const errors = [];
26
- for (const file of newFiles) {
27
- const error = validateFile(file);
28
- if (error) {
29
- errors.push(error);
30
- }
31
- }
32
- if (errors.length > 0) {
33
- return;
34
- }
35
28
  const merged = multiple ? [...files, ...newFiles] : newFiles.slice(0, 1);
36
- if (maxFiles && merged.length > maxFiles) {
37
- return;
38
- }
39
29
  onChange?.(merged);
40
- }, [files, multiple, maxFiles, onChange, validateFile]);
30
+ }, [files, multiple, onChange]);
41
31
  const removeFile = useCallback((index) => {
42
32
  const next = files.filter((_, i) => i !== index);
43
33
  onChange?.(next);
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploadInput.js","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/FileUploadInput.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MA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,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,gBACpB,UAAU,IAAI,CAAC,IAAI,EAAE,EACjC,QAAQ,EAAE,QAAQ,YAElB,eAAM,SAAS,EAAC,GAAG,uBAAe,GAC3B,KAlBF,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE,CAmBvC,CACN,CAAC,GACC,CACN,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,iDAAiD;AACjD,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACpD,CAAC;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"FileUploadInput.js","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/FileUploadInput.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,EAAE,EACF,SAAS,EACT,KAAK,EACL,KAAK,EACL,QAAQ,EACR,MAAM;AACN,6EAA6E;AAC7E,8EAA8E;AAC9E,0DAA0D;AAC1D,OAAO,EACP,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,GAAG,UAAU,EACQ,EAAsB,EAAE;IAC7C,MAAM,QAAQ,GAAG,MAAM,CAAmB,I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I,GAAQ,EAChD,eAAM,SAAS,EAAC,aAAa,YAAE,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAQ,EAChE,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,aAAa,EACvB,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,gBACpB,UAAU,IAAI,CAAC,IAAI,EAAE,EACjC,QAAQ,EAAE,QAAQ,YAElB,eAAM,SAAS,EAAC,GAAG,uBAAe,GAC3B,KAlBF,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE,CAmBvC,CACN,CAAC,GACC,CACN,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,iDAAiD;AACjD,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACpD,CAAC;AAED,eAAe,eAAe,CAAC"}
@@ -8,7 +8,7 @@
8
8
  align-items: center;
9
9
  justify-content: center;
10
10
  box-sizing: border-box;
11
- min-height: calc(var(--space-baseline) * 16); /* 128px — 16bU */
11
+ min-height: calc(var(--dimension-400) * 4); /* 128px */
12
12
  /* Compensate padding for border so total stays on baseline grid */
13
13
  padding: calc(
14
14
  var(--form-input-padding-block) -
@@ -85,8 +85,8 @@
85
85
  }
86
86
 
87
87
  & > .file-list > .file-item > .file-preview {
88
- width: calc(var(--space-baseline) * 4); /* 32px — 4bU */
89
- height: calc(var(--space-baseline) * 4); /* 32px — 4bU */
88
+ width: var(--dimension-400); /* 32px */
89
+ height: var(--dimension-400); /* 32px */
90
90
  object-fit: cover;
91
91
  border-radius: var(--form-input-border-radius);
92
92
  flex-shrink: 0;
@@ -29,12 +29,12 @@
29
29
  padding-inline: var(--form-field-inline-gap);
30
30
  border: none;
31
31
  background: transparent;
32
- color: var(--color-text-muted);
32
+ color: var(--color-icon);
33
33
  cursor: pointer;
34
34
 
35
35
  & > .reveal-icon {
36
- width: calc(var(--space-baseline) * 2); /* 16px — 2bU */
37
- height: calc(var(--space-baseline) * 2);
36
+ width: var(--dimension-200); /* 16px */
37
+ height: var(--dimension-200);
38
38
  background-color: currentColor;
39
39
  mask-repeat: no-repeat;
40
40
  mask-position: center;
@@ -54,9 +54,8 @@
54
54
  }
55
55
  }
56
56
 
57
- &:hover:not(:disabled) {
58
- color: var(--color-text);
59
- }
57
+ /* No hover colour change: the reveal toggle keeps `--color-icon` in all
58
+ * pointer states (per design review). */
60
59
 
61
60
  &:focus-visible {
62
61
  outline: none;
@@ -6,21 +6,39 @@
6
6
  appearance: none;
7
7
  box-sizing: border-box;
8
8
  margin-inline: var(--form-input-padding-inline);
9
- width: calc(var(--space-baseline) * 2); /* 16px — 2bU */
10
- height: calc(var(--space-baseline) * 2); /* 16px — 2bU */
9
+ /* 16px control — a fixed element size, not a baseline multiple (the 4px-baseline
10
+ spike halved the old `--space-baseline × 2`). Stable --dimension-200 (16px). */
11
+ width: var(--dimension-200);
12
+ height: var(--dimension-200);
11
13
  border: var(--dimension-stroke-thickness-medium) solid var(--color-border);
12
14
  border-radius: 50%;
13
- background-color: var(--color-foreground-radio-unselected);
15
+ background-color: var(
16
+ --surface-color-foreground-radio-unselected,
17
+ var(--color-foreground-radio-unselected)
18
+ );
14
19
  cursor: pointer;
15
20
  transition:
16
21
  background-color 150ms ease,
17
22
  border-color 150ms ease;
18
23
 
19
24
  &:checked {
20
- border-color: var(--color-foreground-radio-selected);
25
+ /* Dot = selected token, ring fill = unselected token; both surface-provided
26
+ * (flat fallback) so the control adapts to OnSurface stepping. */
27
+ border-color: var(
28
+ --surface-color-foreground-radio-selected,
29
+ var(--color-foreground-radio-selected)
30
+ );
21
31
  background: radial-gradient(
22
- var(--color-foreground-radio-selected) 40%,
23
- var(--color-foreground-radio-unselected) 41%
32
+ var(
33
+ --surface-color-foreground-radio-selected,
34
+ var(--color-foreground-radio-selected)
35
+ )
36
+ 40%,
37
+ var(
38
+ --surface-color-foreground-radio-unselected,
39
+ var(--color-foreground-radio-unselected)
40
+ )
41
+ 41%
24
42
  );
25
43
  }
26
44
 
@@ -28,8 +46,19 @@
28
46
  background-color: var(--color-foreground-radio-unselected-hover);
29
47
  }
30
48
 
49
+ /* Hover on a selected radio shifts only the dot's fill, not via a whole-element
50
+ * brightness filter (which would also dim the ring). Re-paint the gradient with
51
+ * the hovered selected shade from the `--hover--…-selected` channel. */
31
52
  &:checked:hover:not(:disabled) {
32
- filter: brightness(0.9);
53
+ border-color: var(--hover--color-foreground-radio-selected);
54
+ background: radial-gradient(
55
+ var(--hover--color-foreground-radio-selected) 40%,
56
+ var(
57
+ --surface-color-foreground-radio-unselected,
58
+ var(--color-foreground-radio-unselected)
59
+ )
60
+ 41%
61
+ );
33
62
  }
34
63
 
35
64
  &:focus-visible {
@@ -4,7 +4,7 @@
4
4
  /* Element box is as tall as the THUMB (16px), so the thumb and its focus
5
5
  * ring are never clipped in a flex row; the visible 8px track is painted by
6
6
  * the track pseudo-elements below, vertically centred within this box. */
7
- height: calc(var(--space-baseline) * 2); /* 16px — 2bU */
7
+ height: var(--dimension-200); /* 16px */
8
8
  background: transparent;
9
9
  border: none;
10
10
  outline: none;
@@ -14,7 +14,7 @@
14
14
  * border even after `appearance: none` on the element — THIS is the visible
15
15
  * border. Style the track here: flat, no border, 8px tall. */
16
16
  &::-webkit-slider-runnable-track {
17
- height: var(--space-baseline); /* 8px — 1bU */
17
+ height: var(--dimension-100); /* 8px */
18
18
  background: var(--color-foreground-slider-track);
19
19
  border: none;
20
20
  border-radius: var(--dimension-radius-small);
@@ -23,7 +23,7 @@
23
23
  /* Firefox draws the track via its own pseudo-element with its own UA border —
24
24
  * zero it and paint the flat track here to match WebKit. */
25
25
  &::-moz-range-track {
26
- height: var(--space-baseline); /* 8px — 1bU */
26
+ height: var(--dimension-100); /* 8px */
27
27
  background: var(--color-foreground-slider-track);
28
28
  border: none;
29
29
  border-radius: var(--dimension-radius-small);
@@ -31,10 +31,11 @@
31
31
 
32
32
  &::-webkit-slider-thumb {
33
33
  appearance: none;
34
- width: calc(var(--space-baseline) * 2); /* 16px — 2bU */
35
- height: calc(var(--space-baseline) * 2); /* 16px — 2bU */
36
- /* Re-centre the 16px thumb on the 8px runnable-track: (8 − 16) / 2 = −4px. */
37
- margin-top: calc((var(--space-baseline) - var(--space-baseline) * 2) / 2);
34
+ width: var(--dimension-200); /* 16px */
35
+ height: var(--dimension-200); /* 16px */
36
+ /* Re-centre the 16px thumb on the 8px runnable-track: (8 − 16) / 2 = −4px.
37
+ Derived from the actual track/thumb dimension tokens, not the baseline unit. */
38
+ margin-top: calc((var(--dimension-100) - var(--dimension-200)) / 2);
38
39
  border-radius: 50%;
39
40
  background: var(--color-foreground-slider-progress);
40
41
  border: none;
@@ -42,8 +43,8 @@
42
43
  }
43
44
 
44
45
  &::-moz-range-thumb {
45
- width: calc(var(--space-baseline) * 2); /* 16px — 2bU */
46
- height: calc(var(--space-baseline) * 2); /* 16px — 2bU */
46
+ width: var(--dimension-200); /* 16px */
47
+ height: var(--dimension-200); /* 16px */
47
48
  border-radius: 50%;
48
49
  background: var(--color-foreground-slider-progress);
49
50
  border: none;
@@ -1,10 +1,38 @@
1
- /* Chevron indicator sourced from @canonical/ds-assets icons/chevron-down.svg */
1
+ /* Chevron indicator, painted with CSS gradients so it takes the theme colour.
2
+ * A `background-image` SVG cannot be recoloured by CSS (no inheritance into
3
+ * the image document), which left the caret black on dark themes — the same
4
+ * reason the checkbox/accordion glyphs are masks. A <select> is a replaced
5
+ * element with no ::before/::after to mask, so the chevron is drawn instead:
6
+ * two diagonally-striped gradient squares butted together form a down-chevron
7
+ * STROKE (transparent → colour → transparent along each diagonal), coloured by
8
+ * --color-icon like every other control glyph. */
2
9
  .ds.input.select {
3
10
  appearance: none;
4
- background-image: url("/icons/chevron-down.svg#chevron-down");
11
+ --select-caret-color: var(--color-icon, currentColor);
12
+ --select-caret-half: 0.4em; /* each square; the chevron is two halves wide */
13
+ /* left half: rising stroke ╱ */
14
+ background-image:
15
+ linear-gradient(
16
+ 45deg,
17
+ transparent 42%,
18
+ var(--select-caret-color) 42%,
19
+ var(--select-caret-color) 58%,
20
+ transparent 58%
21
+ ),
22
+ /* right half: falling stroke ╲ */
23
+ linear-gradient(
24
+ 135deg,
25
+ transparent 42%,
26
+ var(--select-caret-color) 42%,
27
+ var(--select-caret-color) 58%,
28
+ transparent 58%
29
+ );
5
30
  background-repeat: no-repeat;
6
- background-position: right var(--form-input-padding-inline) center;
7
- background-size: 1em;
31
+ background-position:
32
+ right calc(var(--form-input-padding-inline) + var(--select-caret-half))
33
+ center,
34
+ right var(--form-input-padding-inline) center;
35
+ background-size: var(--select-caret-half) var(--select-caret-half);
8
36
  /* This element IS the text-bearing leaf, so it carries the inline padding
9
37
  * (`.ds.input.chrome` provides only the block padding). The end side leaves
10
38
  * room for the chevron. */