@canonical/react-ds-global-form 0.36.0 → 0.38.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.
- package/README.md +40 -0
- package/dist/esm/density.css +320 -302
- package/dist/esm/docs/examples/density-examples.css +19 -14
- package/dist/esm/index.css +361 -335
- package/dist/esm/lib/_work_in_progress/DensityTestbed/baseline-system.css +71 -64
- package/dist/esm/lib/_work_in_progress/DensityTestbed/density.testbed.css +127 -123
- package/dist/esm/lib/common/Wrapper/ToggleWrapper.css +73 -54
- package/dist/esm/lib/common/Wrapper/styles.css +35 -31
- package/dist/esm/lib/component/ChoicesField/common/Option/Option.js +4 -1
- package/dist/esm/lib/component/ChoicesField/common/Option/Option.js.map +1 -1
- package/dist/esm/lib/component/ChoicesField/styles.css +195 -163
- package/dist/esm/lib/component/RangeField/common/RangeControl/styles.css +39 -35
- package/dist/esm/lib/component/RichChoicesField/styles.css +93 -89
- package/dist/esm/lib/index.js +2 -0
- package/dist/esm/lib/index.js.map +1 -1
- package/dist/esm/lib/subcomponent/CheckboxInput/styles.css +115 -111
- package/dist/esm/lib/subcomponent/ColorInput/styles.css +177 -173
- package/dist/esm/lib/subcomponent/ComboboxInput/SingleCombobox.js +2 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/SingleCombobox.js.map +1 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/common/List/List.js +1 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/common/List/List.js.map +1 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/common/List/styles.css +33 -29
- package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/styles.css +21 -17
- package/dist/esm/lib/subcomponent/ComboboxInput/styles.css +59 -55
- package/dist/esm/lib/subcomponent/ComboboxInput/utils/index.js +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/utils/index.js.map +1 -1
- package/dist/esm/lib/subcomponent/DateInput/styles.css +23 -19
- package/dist/esm/lib/subcomponent/DateTimeInput/styles.css +24 -20
- package/dist/esm/lib/subcomponent/Field/Description/styles.css +9 -5
- package/dist/esm/lib/subcomponent/Field/Error/styles.css +9 -5
- package/dist/esm/lib/subcomponent/Field/Label/Label.js +2 -2
- package/dist/esm/lib/subcomponent/Field/Label/Label.js.map +1 -1
- package/dist/esm/lib/subcomponent/Field/Label/styles.css +25 -21
- package/dist/esm/lib/subcomponent/FileUploadInput/styles.css +125 -119
- package/dist/esm/lib/subcomponent/NumberInput/styles.css +32 -28
- package/dist/esm/lib/subcomponent/PasswordInput/styles.css +58 -54
- package/dist/esm/lib/subcomponent/PhoneInput/PhoneInput.js +44 -20
- package/dist/esm/lib/subcomponent/PhoneInput/PhoneInput.js.map +1 -1
- package/dist/esm/lib/subcomponent/PhoneInput/styles.css +53 -49
- package/dist/esm/lib/subcomponent/RadioInput/styles.css +70 -66
- package/dist/esm/lib/subcomponent/RangeInput/styles.css +74 -70
- package/dist/esm/lib/subcomponent/RatingInput/styles.css +132 -128
- package/dist/esm/lib/subcomponent/SelectInput/styles.css +44 -40
- package/dist/esm/lib/subcomponent/SwitchInput/styles.css +90 -86
- package/dist/esm/lib/subcomponent/TextInput/styles.css +30 -26
- package/dist/esm/lib/subcomponent/TextareaInput/styles.css +14 -10
- package/dist/esm/lib/subcomponent/TimeInput/styles.css +19 -15
- package/dist/esm/lib/utils/countries/index.js +3 -3
- package/dist/esm/lib/utils/countries/index.js.map +1 -1
- package/dist/esm/lib/utils/formatter/applyPattern.js +38 -0
- package/dist/esm/lib/utils/formatter/applyPattern.js.map +1 -0
- package/dist/esm/lib/utils/formatter/createFormatterRegisterOptions.js +22 -0
- package/dist/esm/lib/utils/formatter/createFormatterRegisterOptions.js.map +1 -0
- package/dist/esm/lib/utils/formatter/createPatternFormatter.js +25 -0
- package/dist/esm/lib/utils/formatter/createPatternFormatter.js.map +1 -0
- package/dist/esm/lib/utils/formatter/index.js +8 -0
- package/dist/esm/lib/utils/formatter/index.js.map +1 -0
- package/dist/esm/lib/utils/formatter/stripToDigits.js +12 -0
- package/dist/esm/lib/utils/formatter/stripToDigits.js.map +1 -0
- package/dist/esm/lib/utils/formatter/types.js +2 -0
- package/dist/esm/lib/utils/formatter/types.js.map +1 -0
- package/dist/esm/lib/utils/hooks/index.js +1 -0
- package/dist/esm/lib/utils/hooks/index.js.map +1 -1
- package/dist/esm/lib/utils/hooks/types.js +2 -0
- package/dist/esm/lib/utils/hooks/types.js.map +1 -0
- package/dist/esm/lib/utils/hooks/useFormattedValue.js +195 -0
- package/dist/esm/lib/utils/hooks/useFormattedValue.js.map +1 -0
- package/dist/esm/lib/utils/index.js +6 -2
- package/dist/esm/lib/utils/index.js.map +1 -1
- package/dist/esm/lib/utils/mergeRefs.js +25 -0
- package/dist/esm/lib/utils/mergeRefs.js.map +1 -0
- package/dist/esm/lib/utils/middleware/addRESTValidation.js +1 -1
- package/dist/esm/lib/utils/middleware/addRESTValidation.js.map +1 -1
- package/dist/types/lib/component/ChoicesField/common/Option/Option.d.ts.map +1 -1
- package/dist/types/lib/component/PhoneField/PhoneField.d.ts +2 -1
- package/dist/types/lib/component/PhoneField/PhoneField.d.ts.map +1 -1
- package/dist/types/lib/index.d.ts +4 -0
- package/dist/types/lib/index.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/ComboboxInput/SingleCombobox.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/ComboboxInput/utils/index.d.ts +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/utils/index.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/PhoneInput/PhoneInput.d.ts +19 -2
- package/dist/types/lib/subcomponent/PhoneInput/PhoneInput.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/PhoneInput/types.d.ts +20 -7
- package/dist/types/lib/subcomponent/PhoneInput/types.d.ts.map +1 -1
- package/dist/types/lib/utils/countries/index.d.ts +0 -3
- package/dist/types/lib/utils/countries/index.d.ts.map +1 -1
- package/dist/types/lib/utils/formatter/applyPattern.d.ts +17 -0
- package/dist/types/lib/utils/formatter/applyPattern.d.ts.map +1 -0
- package/dist/types/lib/utils/formatter/createFormatterRegisterOptions.d.ts +20 -0
- package/dist/types/lib/utils/formatter/createFormatterRegisterOptions.d.ts.map +1 -0
- package/dist/types/lib/utils/formatter/createPatternFormatter.d.ts +19 -0
- package/dist/types/lib/utils/formatter/createPatternFormatter.d.ts.map +1 -0
- package/dist/types/lib/utils/formatter/index.d.ts +6 -0
- package/dist/types/lib/utils/formatter/index.d.ts.map +1 -0
- package/dist/types/lib/utils/formatter/stripToDigits.d.ts +10 -0
- package/dist/types/lib/utils/formatter/stripToDigits.d.ts.map +1 -0
- package/dist/types/lib/utils/formatter/types.d.ts +30 -0
- package/dist/types/lib/utils/formatter/types.d.ts.map +1 -0
- package/dist/types/lib/utils/hooks/index.d.ts +2 -0
- package/dist/types/lib/utils/hooks/index.d.ts.map +1 -1
- package/dist/types/lib/utils/hooks/types.d.ts +33 -0
- package/dist/types/lib/utils/hooks/types.d.ts.map +1 -0
- package/dist/types/lib/utils/hooks/useFormattedValue.d.ts +30 -0
- package/dist/types/lib/utils/hooks/useFormattedValue.d.ts.map +1 -0
- package/dist/types/lib/utils/index.d.ts +2 -0
- package/dist/types/lib/utils/index.d.ts.map +1 -1
- package/dist/types/lib/utils/mergeRefs.d.ts +14 -0
- package/dist/types/lib/utils/mergeRefs.d.ts.map +1 -0
- package/package.json +17 -16
- package/dist/esm/lib/subcomponent/ComboboxInput/utils/mergeRefs.js +0 -12
- package/dist/esm/lib/subcomponent/ComboboxInput/utils/mergeRefs.js.map +0 -1
- package/dist/esm/lib/utils/countries/applyPhoneMask.js +0 -35
- package/dist/esm/lib/utils/countries/applyPhoneMask.js.map +0 -1
- package/dist/esm/lib/utils/countries/phoneRegisterOptions.js +0 -18
- package/dist/esm/lib/utils/countries/phoneRegisterOptions.js.map +0 -1
- package/dist/esm/lib/utils/countries/removePhoneMask.js +0 -12
- package/dist/esm/lib/utils/countries/removePhoneMask.js.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/utils/mergeRefs.d.ts +0 -3
- package/dist/types/lib/subcomponent/ComboboxInput/utils/mergeRefs.d.ts.map +0 -1
- package/dist/types/lib/utils/countries/applyPhoneMask.d.ts +0 -14
- package/dist/types/lib/utils/countries/applyPhoneMask.d.ts.map +0 -1
- package/dist/types/lib/utils/countries/phoneRegisterOptions.d.ts +0 -14
- package/dist/types/lib/utils/countries/phoneRegisterOptions.d.ts.map +0 -1
- package/dist/types/lib/utils/countries/removePhoneMask.d.ts +0 -10
- package/dist/types/lib/utils/countries/removePhoneMask.d.ts.map +0 -1
|
@@ -1,99 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
border: none;
|
|
3
|
-
padding: 0;
|
|
4
|
-
margin: 0;
|
|
5
|
-
display: grid;
|
|
6
|
-
grid-template-columns: subgrid;
|
|
7
|
-
grid-column: 1 / -1;
|
|
8
|
-
row-gap: var(--form-group-gap);
|
|
1
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
display:
|
|
3
|
+
@layer ds.components.global {
|
|
4
|
+
.ds.form-rich-choices {
|
|
5
|
+
border: none;
|
|
6
|
+
padding: 0;
|
|
7
|
+
margin: 0;
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: subgrid;
|
|
10
|
+
grid-column: 1 / -1;
|
|
11
|
+
row-gap: var(--form-group-gap);
|
|
16
12
|
|
|
17
|
-
/*
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
overflow: hidden;
|
|
23
|
-
clip: rect(0, 0, 0, 0);
|
|
24
|
-
white-space: nowrap;
|
|
25
|
-
border: 0;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/* Label is the visible card surface */
|
|
29
|
-
& > label {
|
|
13
|
+
/* Each option (common/Option, `.ds.option`) is styled here, scoped to this
|
|
14
|
+
* group so the generic class cannot collide with options elsewhere. */
|
|
15
|
+
& > .ds.option {
|
|
16
|
+
grid-column: var(--rich-choices-span, auto);
|
|
17
|
+
position: relative;
|
|
30
18
|
display: flex;
|
|
31
|
-
flex-direction: column;
|
|
32
|
-
flex: 1;
|
|
33
|
-
box-sizing: border-box;
|
|
34
|
-
gap: var(--form-group-gap);
|
|
35
|
-
padding-inline: var(--form-input-padding-inline);
|
|
36
|
-
/* Block padding: chrome padding + baseline nudges, minus border */
|
|
37
|
-
padding-block-start: calc(
|
|
38
|
-
var(--form-input-padding-block) +
|
|
39
|
-
var(--start-nudge, 0px) -
|
|
40
|
-
var(--form-input-border-width)
|
|
41
|
-
);
|
|
42
|
-
padding-block-end: calc(
|
|
43
|
-
var(--form-input-padding-block) +
|
|
44
|
-
var(--end-nudge, 0px) -
|
|
45
|
-
var(--form-input-border-width)
|
|
46
|
-
);
|
|
47
|
-
border: var(--form-input-border-width) solid
|
|
48
|
-
var(--form-input-border-color);
|
|
49
|
-
border-radius: var(--form-input-border-radius);
|
|
50
|
-
background-color: var(--form-input-background);
|
|
51
|
-
color: var(--form-input-color);
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
transition:
|
|
54
|
-
border-color 150ms ease,
|
|
55
|
-
background-color 150ms ease,
|
|
56
|
-
box-shadow 150ms ease;
|
|
57
|
-
user-select: none;
|
|
58
|
-
}
|
|
59
19
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
20
|
+
/* Hide the native input */
|
|
21
|
+
& > input {
|
|
22
|
+
position: absolute;
|
|
23
|
+
width: 1px;
|
|
24
|
+
height: 1px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
clip: rect(0, 0, 0, 0);
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
border: 0;
|
|
29
|
+
}
|
|
67
30
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
31
|
+
/* Label is the visible card surface */
|
|
32
|
+
& > label {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
flex: 1;
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
gap: var(--form-group-gap);
|
|
38
|
+
padding-inline: var(--form-input-padding-inline);
|
|
39
|
+
/* Block padding: chrome padding + baseline nudges, minus border */
|
|
40
|
+
padding-block-start: calc(
|
|
41
|
+
var(--form-input-padding-block) +
|
|
42
|
+
var(--start-nudge, 0px) -
|
|
43
|
+
var(--form-input-border-width)
|
|
44
|
+
);
|
|
45
|
+
padding-block-end: calc(
|
|
46
|
+
var(--form-input-padding-block) +
|
|
47
|
+
var(--end-nudge, 0px) -
|
|
48
|
+
var(--form-input-border-width)
|
|
49
|
+
);
|
|
50
|
+
border: var(--form-input-border-width) solid
|
|
51
|
+
var(--form-input-border-color);
|
|
52
|
+
border-radius: var(--form-input-border-radius);
|
|
53
|
+
background-color: var(--form-input-background);
|
|
54
|
+
color: var(--form-input-color);
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
transition:
|
|
57
|
+
border-color var(--motion-duration-fast) ease,
|
|
58
|
+
background-color var(--motion-duration-fast) ease,
|
|
59
|
+
box-shadow var(--motion-duration-fast) ease;
|
|
60
|
+
user-select: none;
|
|
61
|
+
}
|
|
78
62
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
63
|
+
/* Hover */
|
|
64
|
+
& > input:not(:disabled) + label:hover {
|
|
65
|
+
background-color: var(
|
|
66
|
+
--hover--color-foreground-input,
|
|
67
|
+
var(--color-foreground-input-hover)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Focus */
|
|
72
|
+
/* biome-ignore lint/style/noDescendingSpecificity: state rules are ordered by
|
|
73
|
+
interaction semantics (hover → focus → checked → disabled); the preceding
|
|
74
|
+
:hover rule only reads as higher specificity because of its :not(:disabled)
|
|
75
|
+
guard. Reordering to satisfy the linter would change the cascade. */
|
|
76
|
+
& > input:focus-visible + label {
|
|
77
|
+
outline: none;
|
|
78
|
+
border-color: var(--form-input-border-color-focus);
|
|
79
|
+
box-shadow: 0 0 0 1px var(--form-focus-ring-color);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Checked / selected */
|
|
83
|
+
/* biome-ignore lint/style/noDescendingSpecificity: see the focus rule above. */
|
|
84
|
+
& > input:checked + label {
|
|
85
|
+
border-color: var(--form-input-border-color-focus);
|
|
86
|
+
background-color: var(
|
|
87
|
+
--hover--color-foreground-input,
|
|
88
|
+
var(--color-foreground-input-hover)
|
|
89
|
+
);
|
|
90
|
+
box-shadow: 0 0 0 1px var(--form-input-border-color-focus);
|
|
91
|
+
}
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
/* Disabled */
|
|
94
|
+
/* biome-ignore lint/style/noDescendingSpecificity: see the focus rule above. */
|
|
95
|
+
& > input:disabled + label {
|
|
96
|
+
border-color: var(--form-input-border-color-disabled);
|
|
97
|
+
background-color: var(--form-input-background-disabled);
|
|
98
|
+
color: var(--form-input-color-disabled);
|
|
99
|
+
cursor: not-allowed;
|
|
100
|
+
}
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
}
|
package/dist/esm/lib/index.js
CHANGED
|
@@ -4,5 +4,7 @@
|
|
|
4
4
|
// otherwise internal — composed by the Field pattern, not exported at the root.
|
|
5
5
|
export * from "./pattern/index.js";
|
|
6
6
|
export { RatingInput } from "./subcomponent/index.js";
|
|
7
|
+
export { applyPattern, createFormatterRegisterOptions, createPatternFormatter, stripToDigits, } from "./utils/formatter/index.js";
|
|
8
|
+
export { useFormattedValue } from "./utils/hooks/index.js";
|
|
7
9
|
export * from "./utils/middleware/index.js";
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,4EAA4E;AAC5E,+EAA+E;AAC/E,gFAAgF;AAChF,cAAc,oBAAoB,CAAC;AAUnC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,4EAA4E;AAC5E,+EAA+E;AAC/E,gFAAgF;AAChF,cAAc,oBAAoB,CAAC;AAUnC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAOtD,OAAO,EACL,YAAY,EACZ,8BAA8B,EAC9B,sBAAsB,EACtB,aAAa,GACd,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,cAAc,6BAA6B,CAAC"}
|
|
@@ -1,131 +1,135 @@
|
|
|
1
|
-
|
|
2
|
-
appearance: none;
|
|
3
|
-
box-sizing: border-box;
|
|
4
|
-
/* Positioning context for the masked checkmark/minus glyph (`::before`). */
|
|
5
|
-
position: relative;
|
|
6
|
-
/* Align to the field edge like the label (no side margin by default), not to
|
|
7
|
-
* the input's inner padding. Overridable via the shared variable. */
|
|
8
|
-
margin-inline: var(--form-label-padding-inline, 0);
|
|
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);
|
|
15
|
-
border: var(--dimension-stroke-thickness-medium) solid var(--color-border);
|
|
16
|
-
border-radius: var(--dimension-radius-small);
|
|
17
|
-
background: var(
|
|
18
|
-
--surface-color-foreground-checkbox-unselected,
|
|
19
|
-
var(--color-foreground-checkbox-unselected)
|
|
20
|
-
);
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
transition:
|
|
23
|
-
background-color 150ms ease,
|
|
24
|
-
border-color 150ms ease;
|
|
1
|
+
/* Layer: ds.components.global (@canonical/styles README, "Cascade layers"). */
|
|
25
2
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
* IMPORTANT: only the :checked / :indeterminate rules give the ::before a
|
|
33
|
-
* `mask-image` AND a `background-color`. The base ::before sets geometry only
|
|
34
|
-
* — with no mask-image the mask is `none`, which means NO clipping, so a
|
|
35
|
-
* `background-color` here would paint the WHOLE box as a solid square in the
|
|
36
|
-
* unchecked state (visible under any theme where the checkmark colour differs
|
|
37
|
-
* from the box). So the paint lives with the mask, never on its own. */
|
|
38
|
-
&::before {
|
|
39
|
-
content: "";
|
|
40
|
-
position: absolute;
|
|
41
|
-
inset: 0;
|
|
42
|
-
mask-repeat: no-repeat;
|
|
43
|
-
mask-position: center;
|
|
44
|
-
mask-size: 75%;
|
|
45
|
-
-webkit-mask-repeat: no-repeat;
|
|
46
|
-
-webkit-mask-position: center;
|
|
47
|
-
-webkit-mask-size: 75%;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&:checked {
|
|
3
|
+
@layer ds.components.global {
|
|
4
|
+
.ds.form-checkbox {
|
|
5
|
+
appearance: none;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
/* Positioning context for the masked checkmark/minus glyph (`::before`). */
|
|
51
8
|
position: relative;
|
|
52
|
-
/*
|
|
53
|
-
*
|
|
9
|
+
/* Align to the field edge like the label (no side margin by default), not to
|
|
10
|
+
* the input's inner padding. Overridable via the shared variable. */
|
|
11
|
+
margin-inline: var(--form-label-padding-inline, 0);
|
|
12
|
+
/* A 16px control — a fixed element size, NOT a baseline multiple. It was
|
|
13
|
+
`--space-baseline × 2` (16px when the baseline was 8px), but the 4px-baseline
|
|
14
|
+
spike halved it to 8px. Size to the stable --dimension-200 (16px) so the
|
|
15
|
+
control size is decoupled from the baseline grid unit. */
|
|
16
|
+
width: var(--dimension-200);
|
|
17
|
+
height: var(--dimension-200);
|
|
18
|
+
border: var(--dimension-stroke-thickness-medium) solid var(--color-border);
|
|
19
|
+
border-radius: var(--dimension-radius-small);
|
|
54
20
|
background: var(
|
|
55
|
-
--surface-color-foreground-checkbox-
|
|
56
|
-
var(--color-foreground-checkbox-
|
|
57
|
-
);
|
|
58
|
-
border-color: var(
|
|
59
|
-
--surface-color-foreground-checkbox-selected,
|
|
60
|
-
var(--color-foreground-checkbox-selected)
|
|
21
|
+
--surface-color-foreground-checkbox-unselected,
|
|
22
|
+
var(--color-foreground-checkbox-unselected)
|
|
61
23
|
);
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
transition:
|
|
26
|
+
background-color var(--motion-duration-fast) ease,
|
|
27
|
+
border-color var(--motion-duration-fast) ease;
|
|
62
28
|
|
|
29
|
+
/* The glyph is a masked pseudo-element layered over the box, NOT a
|
|
30
|
+
* background-image: a background-image SVG can't be recoloured by CSS, so the
|
|
31
|
+
* checkmark would ignore the theme. Masking + `background-color` lets the
|
|
32
|
+
* glyph take the checkmark token (same technique as PasswordInput's eye
|
|
33
|
+
* icon). The box keeps its own `background` for the selected fill.
|
|
34
|
+
*
|
|
35
|
+
* IMPORTANT: only the :checked / :indeterminate rules give the ::before a
|
|
36
|
+
* `mask-image` AND a `background-color`. The base ::before sets geometry only
|
|
37
|
+
* — with no mask-image the mask is `none`, which means NO clipping, so a
|
|
38
|
+
* `background-color` here would paint the WHOLE box as a solid square in the
|
|
39
|
+
* unchecked state (visible under any theme where the checkmark colour differs
|
|
40
|
+
* from the box). So the paint lives with the mask, never on its own. */
|
|
63
41
|
&::before {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
mask-
|
|
69
|
-
|
|
42
|
+
content: "";
|
|
43
|
+
position: absolute;
|
|
44
|
+
inset: 0;
|
|
45
|
+
mask-repeat: no-repeat;
|
|
46
|
+
mask-position: center;
|
|
47
|
+
mask-size: 100%;
|
|
48
|
+
-webkit-mask-repeat: no-repeat;
|
|
49
|
+
-webkit-mask-position: center;
|
|
50
|
+
-webkit-mask-size: 100%;
|
|
70
51
|
}
|
|
71
|
-
}
|
|
72
52
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var(
|
|
82
|
-
|
|
53
|
+
&:checked {
|
|
54
|
+
position: relative;
|
|
55
|
+
/* Selected fill + checkmark read the surface-provided tokens (with a flat
|
|
56
|
+
* fallback) so the control adapts to OnSurface stepping. */
|
|
57
|
+
background: var(
|
|
58
|
+
--surface-color-foreground-checkbox-selected,
|
|
59
|
+
var(--color-foreground-checkbox-selected)
|
|
60
|
+
);
|
|
61
|
+
border-color: var(
|
|
62
|
+
--surface-color-foreground-checkbox-selected,
|
|
63
|
+
var(--color-foreground-checkbox-selected)
|
|
64
|
+
);
|
|
83
65
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
66
|
+
&::before {
|
|
67
|
+
background-color: var(
|
|
68
|
+
--surface-color-foreground-checkbox-checkmark,
|
|
69
|
+
var(--color-foreground-checkbox-checkmark)
|
|
70
|
+
);
|
|
71
|
+
mask-image: url("/icons/checkmark.svg#checkmark");
|
|
72
|
+
-webkit-mask-image: url("/icons/checkmark.svg#checkmark");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&:indeterminate {
|
|
77
|
+
position: relative;
|
|
78
|
+
background: var(
|
|
79
|
+
--surface-color-foreground-checkbox-selected,
|
|
80
|
+
var(--color-foreground-checkbox-selected)
|
|
81
|
+
);
|
|
82
|
+
border-color: var(
|
|
83
|
+
--surface-color-foreground-checkbox-selected,
|
|
84
|
+
var(--color-foreground-checkbox-selected)
|
|
88
85
|
);
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
|
|
87
|
+
&::before {
|
|
88
|
+
background-color: var(
|
|
89
|
+
--surface-color-foreground-checkbox-checkmark,
|
|
90
|
+
var(--color-foreground-checkbox-checkmark)
|
|
91
|
+
);
|
|
92
|
+
mask-image: url("/icons/minus.svg#minus");
|
|
93
|
+
-webkit-mask-image: url("/icons/minus.svg#minus");
|
|
94
|
+
}
|
|
91
95
|
}
|
|
92
|
-
}
|
|
93
96
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
&:hover:not(:disabled):not(:checked):not(:indeterminate) {
|
|
98
|
+
background: var(--color-foreground-checkbox-unselected-hover);
|
|
99
|
+
}
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
/* Hover on a selected/indeterminate box shifts ONLY the fill, not the
|
|
102
|
+
* checkmark/minus glyph (per design review): the background swaps to the
|
|
103
|
+
* hovered selected shade while `::before` keeps its own colour. The hover
|
|
104
|
+
* shade comes from the `--hover--…-selected` channel (criticality-style OKLCH
|
|
105
|
+
* delta shim), replacing the old whole-element `filter: brightness()` that
|
|
106
|
+
* also dimmed the glyph. */
|
|
107
|
+
&:checked:hover:not(:disabled),
|
|
108
|
+
&:indeterminate:hover:not(:disabled) {
|
|
109
|
+
background-color: var(--hover--color-foreground-checkbox-selected);
|
|
110
|
+
border-color: var(--hover--color-foreground-checkbox-selected);
|
|
111
|
+
}
|
|
109
112
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
&:focus-visible {
|
|
114
|
+
outline: none;
|
|
115
|
+
border-color: var(--color-focus-ring);
|
|
116
|
+
box-shadow: 0 0 0 1px var(--color-focus-ring);
|
|
117
|
+
}
|
|
115
118
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
&:disabled {
|
|
120
|
+
border-color: var(--color-border-disabled);
|
|
121
|
+
background: var(--color-foreground-checkbox-unselected-disabled);
|
|
122
|
+
cursor: not-allowed;
|
|
123
|
+
}
|
|
121
124
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
&:checked:disabled,
|
|
126
|
+
&:indeterminate:disabled {
|
|
127
|
+
background: var(--color-foreground-checkbox-selected-disabled);
|
|
128
|
+
border-color: var(--color-foreground-checkbox-selected-disabled);
|
|
126
129
|
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
&::before {
|
|
131
|
+
background-color: var(--color-foreground-checkbox-checkmark-disabled);
|
|
132
|
+
}
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
}
|