@warp-ds/elements 2.10.0-next.4 → 2.10.0-next.5
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/dist/custom-elements.json +68 -14
- package/dist/docs/affix/affix.md +2 -0
- package/dist/docs/affix/styling.md +1 -0
- package/dist/docs/alert/alert.md +2 -0
- package/dist/docs/alert/styling.md +1 -0
- package/dist/docs/attention/attention.md +2 -0
- package/dist/docs/attention/styling.md +1 -0
- package/dist/docs/badge/badge.md +2 -0
- package/dist/docs/badge/styling.md +1 -0
- package/dist/docs/box/box.md +22 -38
- package/dist/docs/box/examples.md +20 -38
- package/dist/docs/box/styling.md +1 -0
- package/dist/docs/breadcrumbs/breadcrumbs.md +8 -0
- package/dist/docs/breadcrumbs/examples.md +7 -1
- package/dist/docs/breadcrumbs/styling.md +1 -0
- package/dist/docs/button/button.md +73 -0
- package/dist/docs/button/styling.md +72 -0
- package/dist/docs/card/card.md +2 -0
- package/dist/docs/card/styling.md +1 -0
- package/dist/docs/checkbox/api.md +128 -0
- package/dist/docs/checkbox/checkbox.md +134 -0
- package/dist/docs/checkbox-group/accessibility.md +71 -0
- package/dist/docs/checkbox-group/api.md +79 -0
- package/dist/docs/checkbox-group/checkbox-group.md +492 -0
- package/dist/docs/checkbox-group/examples.md +105 -0
- package/dist/docs/checkbox-group/styling.md +132 -0
- package/dist/docs/checkbox-group/usage.md +95 -0
- package/dist/docs/combobox/combobox.md +2 -0
- package/dist/docs/combobox/styling.md +1 -0
- package/dist/docs/datepicker/accessibility.md +25 -0
- package/dist/docs/datepicker/api.md +22 -14
- package/dist/docs/datepicker/datepicker.md +208 -14
- package/dist/docs/datepicker/examples.md +75 -0
- package/dist/docs/datepicker/styling.md +1 -0
- package/dist/docs/datepicker/usage.md +84 -0
- package/dist/docs/expandable/api.md +20 -32
- package/dist/docs/expandable/examples.md +54 -0
- package/dist/docs/expandable/expandable.md +74 -32
- package/dist/docs/expandable/styling.md +1 -0
- package/dist/docs/icon/icon.md +2 -0
- package/dist/docs/icon/styling.md +1 -0
- package/dist/docs/link/link.md +2 -0
- package/dist/docs/link/styling.md +1 -0
- package/dist/docs/modal/modal.md +2 -0
- package/dist/docs/modal/styling.md +1 -0
- package/dist/docs/modal-footer/modal-footer.md +0 -6
- package/dist/docs/modal-header/modal-header.md +0 -6
- package/dist/docs/page-indicator/page-indicator.md +2 -0
- package/dist/docs/page-indicator/styling.md +1 -0
- package/dist/docs/pagination/pagination.md +2 -0
- package/dist/docs/pagination/styling.md +1 -0
- package/dist/docs/pill/pill.md +2 -0
- package/dist/docs/pill/styling.md +1 -0
- package/dist/docs/radio/radio.md +0 -6
- package/dist/docs/select/select.md +2 -0
- package/dist/docs/select/styling.md +1 -0
- package/dist/docs/slider/slider.md +2 -0
- package/dist/docs/slider/styling.md +1 -0
- package/dist/docs/slider-thumb/slider-thumb.md +2 -0
- package/dist/docs/slider-thumb/styling.md +1 -0
- package/dist/docs/step-indicator/step-indicator.md +2 -0
- package/dist/docs/step-indicator/styling.md +1 -0
- package/dist/docs/switch/styling.md +1 -0
- package/dist/docs/switch/switch.md +2 -0
- package/dist/docs/tabs/styling.md +1 -0
- package/dist/docs/tabs/tabs.md +2 -0
- package/dist/docs/textarea/styling.md +1 -0
- package/dist/docs/textarea/textarea.md +2 -0
- package/dist/docs/textfield/styling.md +1 -0
- package/dist/docs/textfield/textfield.md +2 -0
- package/dist/index.d.ts +164 -128
- package/dist/packages/affix/affix.hydration.test.js +1 -1
- package/dist/packages/alert/alert.hydration.test.js +1 -1
- package/dist/packages/attention/attention.hydration.test.js +1 -1
- package/dist/packages/attention/attention.js +397 -446
- package/dist/packages/attention/attention.js.map +4 -4
- package/dist/packages/badge/badge.hydration.test.js +1 -1
- package/dist/packages/box/box.hydration.test.js +1 -1
- package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.js +3 -2
- package/dist/packages/button/button.hydration.test.js +1 -1
- package/dist/packages/button/button.js +387 -436
- package/dist/packages/button/button.js.map +4 -4
- package/dist/packages/button/button.stories.d.ts +29 -0
- package/dist/packages/button/button.stories.js +176 -2
- package/dist/packages/button/styles.d.ts +22 -1
- package/dist/packages/button/styles.js +390 -1
- package/dist/packages/card/card.hydration.test.js +1 -1
- package/dist/packages/checkbox/checkbox.d.ts +5 -3
- package/dist/packages/checkbox/checkbox.hydration.test.js +1 -1
- package/dist/packages/checkbox/checkbox.js +2 -2
- package/dist/packages/checkbox/checkbox.js.map +3 -3
- package/dist/packages/checkbox/checkbox.react.stories.d.ts +1 -1
- package/dist/packages/checkbox/checkbox.stories.d.ts +2 -2
- package/dist/packages/checkbox/react.d.ts +2 -2
- package/dist/packages/checkbox-group/checkbox-group.d.ts +5 -3
- package/dist/packages/checkbox-group/checkbox-group.hydration.test.js +1 -1
- package/dist/packages/checkbox-group/checkbox-group.js +6 -6
- package/dist/packages/checkbox-group/checkbox-group.js.map +3 -3
- package/dist/packages/checkbox-group/react.d.ts +3 -3
- package/dist/packages/datepicker/datepicker.d.ts +22 -30
- package/dist/packages/datepicker/datepicker.hydration.test.js +1 -1
- package/dist/packages/datepicker/datepicker.js.map +2 -2
- package/dist/packages/expandable/expandable.d.ts +11 -32
- package/dist/packages/expandable/expandable.hydration.test.js +1 -1
- package/dist/packages/expandable/expandable.js.map +2 -2
- package/dist/packages/expandable/expandable.react.stories.d.ts +2 -2
- package/dist/packages/expandable/react.d.ts +1 -1
- package/dist/packages/icon/icon.hydration.test.js +1 -1
- package/dist/packages/link/link.hydration.test.js +1 -1
- package/dist/packages/link/link.js +420 -190
- package/dist/packages/link/link.js.map +4 -4
- package/dist/packages/link/styles.d.ts +5 -0
- package/dist/packages/link/styles.js +80 -0
- package/dist/packages/modal/modal.hydration.test.js +1 -1
- package/dist/packages/page-indicator/page-indicator.hydration.test.js +1 -1
- package/dist/packages/pagination/pagination.hydration.test.js +1 -1
- package/dist/packages/pill/pill.hydration.test.js +1 -1
- package/dist/packages/radio/radio.hydration.test.js +1 -1
- package/dist/packages/radio/radio.js.map +1 -1
- package/dist/packages/radio-group/radio-group.a11y.test.js +6 -2
- package/dist/packages/radio-group/radio-group.hydration.test.js +6 -2
- package/dist/packages/radio-group/radio-group.js +2 -2
- package/dist/packages/radio-group/radio-group.js.map +4 -4
- package/dist/packages/select/select.a11y.test.js +6 -2
- package/dist/packages/select/select.hydration.test.js +1 -1
- package/dist/packages/select/select.test.js +4 -2
- package/dist/packages/slider/slider.hydration.test.js +7 -2
- package/dist/packages/slider/slider.js.map +1 -1
- package/dist/packages/slider/slider.react.stories.js +2 -2
- package/dist/packages/slider-thumb/slider-thumb.hydration.test.js +1 -1
- package/dist/packages/step/step.hydration.test.js +1 -1
- package/dist/packages/step-indicator/step-indicator.hydration.test.js +1 -1
- package/dist/packages/switch/switch.hydration.test.js +1 -1
- package/dist/packages/tab/tab.hydration.test.js +1 -1
- package/dist/packages/tab-panel/tab-panel.hydration.test.js +1 -1
- package/dist/packages/tabs/tabs.a11y.test.js +1 -1
- package/dist/packages/tabs/tabs.hydration.test.js +1 -1
- package/dist/packages/tabs/tabs.test.js +3 -3
- package/dist/packages/textarea/textarea.hydration.test.js +1 -1
- package/dist/packages/textfield/textfield.hydration.test.js +1 -1
- package/dist/web-types.json +91 -28
- package/eik/index.js +115 -0
- package/package.json +7 -4
- package/dist/docs/modal-footer/accessibility.md +0 -1
- package/dist/docs/modal-footer/examples.md +0 -1
- package/dist/docs/modal-footer/usage.md +0 -1
- package/dist/docs/modal-header/accessibility.md +0 -1
- package/dist/docs/modal-header/examples.md +0 -1
- package/dist/docs/modal-header/usage.md +0 -1
- package/dist/docs/radio/accessibility.md +0 -1
- package/dist/docs/radio/examples.md +0 -1
- package/dist/docs/radio/usage.md +0 -1
- package/dist/packages/button/styles/w-button.styles.d.ts +0 -1
- package/dist/packages/button/styles/w-button.styles.js +0 -282
- package/dist/packages/link/styles/w-link.styles.d.ts +0 -1
- package/dist/packages/link/styles/w-link.styles.js +0 -213
|
@@ -98,6 +98,7 @@ Breadcrumbs should support orientation within the site hierarchy. They should no
|
|
|
98
98
|
### Basic
|
|
99
99
|
|
|
100
100
|
<elements-example>
|
|
101
|
+
|
|
101
102
|
```html
|
|
102
103
|
<w-breadcrumbs>
|
|
103
104
|
<a href="#/real-estate">Real estate</a>
|
|
@@ -105,11 +106,13 @@ Breadcrumbs should support orientation within the site hierarchy. They should no
|
|
|
105
106
|
<span aria-current="page">Oslo</span>
|
|
106
107
|
</w-breadcrumbs>
|
|
107
108
|
```
|
|
109
|
+
|
|
108
110
|
</elements-example>
|
|
109
111
|
|
|
110
112
|
### Custom Accessible Label
|
|
111
113
|
|
|
112
114
|
<elements-example>
|
|
115
|
+
|
|
113
116
|
```html
|
|
114
117
|
<w-breadcrumbs aria-label="Product category path">
|
|
115
118
|
<a href="#/marketplace">Marketplace</a>
|
|
@@ -117,19 +120,24 @@ Breadcrumbs should support orientation within the site hierarchy. They should no
|
|
|
117
120
|
<span aria-current="page">Sofas</span>
|
|
118
121
|
</w-breadcrumbs>
|
|
119
122
|
```
|
|
123
|
+
|
|
120
124
|
</elements-example>
|
|
121
125
|
|
|
122
126
|
### Short Path
|
|
123
127
|
|
|
124
128
|
<elements-example>
|
|
129
|
+
|
|
125
130
|
```html
|
|
126
131
|
<w-breadcrumbs>
|
|
127
132
|
<a href="#/help">Help</a>
|
|
128
133
|
<span aria-current="page">Contact us</span>
|
|
129
134
|
</w-breadcrumbs>
|
|
130
135
|
```
|
|
136
|
+
|
|
131
137
|
</elements-example>
|
|
132
138
|
|
|
139
|
+
## Styling API
|
|
140
|
+
|
|
133
141
|
## `<w-breadcrumbs>` API
|
|
134
142
|
|
|
135
143
|
Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
### Basic
|
|
4
4
|
|
|
5
5
|
<elements-example>
|
|
6
|
+
|
|
6
7
|
```html
|
|
7
8
|
<w-breadcrumbs>
|
|
8
9
|
<a href="#/real-estate">Real estate</a>
|
|
@@ -10,11 +11,13 @@
|
|
|
10
11
|
<span aria-current="page">Oslo</span>
|
|
11
12
|
</w-breadcrumbs>
|
|
12
13
|
```
|
|
14
|
+
|
|
13
15
|
</elements-example>
|
|
14
16
|
|
|
15
17
|
### Custom Accessible Label
|
|
16
18
|
|
|
17
19
|
<elements-example>
|
|
20
|
+
|
|
18
21
|
```html
|
|
19
22
|
<w-breadcrumbs aria-label="Product category path">
|
|
20
23
|
<a href="#/marketplace">Marketplace</a>
|
|
@@ -22,15 +25,18 @@
|
|
|
22
25
|
<span aria-current="page">Sofas</span>
|
|
23
26
|
</w-breadcrumbs>
|
|
24
27
|
```
|
|
28
|
+
|
|
25
29
|
</elements-example>
|
|
26
30
|
|
|
27
31
|
### Short Path
|
|
28
32
|
|
|
29
33
|
<elements-example>
|
|
34
|
+
|
|
30
35
|
```html
|
|
31
36
|
<w-breadcrumbs>
|
|
32
37
|
<a href="#/help">Help</a>
|
|
33
38
|
<span aria-current="page">Contact us</span>
|
|
34
39
|
</w-breadcrumbs>
|
|
35
40
|
```
|
|
36
|
-
|
|
41
|
+
|
|
42
|
+
</elements-example>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## Styling API
|
|
@@ -270,6 +270,79 @@ For backwards compatibility, if `href` is set, `w-button` renders a link with bu
|
|
|
270
270
|
|
|
271
271
|
</elements-example>
|
|
272
272
|
|
|
273
|
+
## Styling API
|
|
274
|
+
|
|
275
|
+
This component supports styling through **component tokens** (CSS custom properties with a --w-c- prefix) and **parts**.
|
|
276
|
+
|
|
277
|
+
### Parts
|
|
278
|
+
|
|
279
|
+
Use `::part(...)` from outside the component.
|
|
280
|
+
|
|
281
|
+
- `base` — the clickable element (`<button>` or `<w-link>`)
|
|
282
|
+
|
|
283
|
+
Example:
|
|
284
|
+
|
|
285
|
+
```css
|
|
286
|
+
w-button::part(base) {
|
|
287
|
+
text-transform: uppercase;
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Component tokens
|
|
292
|
+
|
|
293
|
+
Set these on `w-button` to override visuals.
|
|
294
|
+
|
|
295
|
+
```css
|
|
296
|
+
w-button {
|
|
297
|
+
--w-c-button-bg: var(--w-s-color-background-primary);
|
|
298
|
+
--w-c-button-color: var(--w-s-color-text-inverted);
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### Layout & typography
|
|
303
|
+
|
|
304
|
+
- `--w-c-button-radius`
|
|
305
|
+
- `--w-c-button-font-size`
|
|
306
|
+
- `--w-c-button-line-height`
|
|
307
|
+
- `--w-c-button-font-weight`
|
|
308
|
+
- `--w-c-button-padding-x`
|
|
309
|
+
- `--w-c-button-padding-y`
|
|
310
|
+
|
|
311
|
+
#### Background
|
|
312
|
+
|
|
313
|
+
- `--w-c-button-bg`
|
|
314
|
+
- `--w-c-button-bg-hover`
|
|
315
|
+
- `--w-c-button-bg-active`
|
|
316
|
+
|
|
317
|
+
#### Text color
|
|
318
|
+
|
|
319
|
+
- `--w-c-button-color`
|
|
320
|
+
- `--w-c-button-color-hover`
|
|
321
|
+
- `--w-c-button-color-active`
|
|
322
|
+
|
|
323
|
+
#### Border
|
|
324
|
+
|
|
325
|
+
- `--w-c-button-border-width`
|
|
326
|
+
- `--w-c-button-border-color`
|
|
327
|
+
- `--w-c-button-border-color-hover`
|
|
328
|
+
- `--w-c-button-border-color-active`
|
|
329
|
+
|
|
330
|
+
#### Focus
|
|
331
|
+
|
|
332
|
+
- `--w-c-button-outline-width`
|
|
333
|
+
- `--w-c-button-outline-color`
|
|
334
|
+
- `--w-c-button-outline-offset`
|
|
335
|
+
|
|
336
|
+
#### Motion
|
|
337
|
+
|
|
338
|
+
- `--w-c-button-transition`
|
|
339
|
+
|
|
340
|
+
### Notes
|
|
341
|
+
|
|
342
|
+
- Variant defaults are set internally using fallbacks, so overriding tokens works across variants.
|
|
343
|
+
- The `quiet` boolean is supported for backwards compatibility. Prefer `variant="quiet"` going forward.
|
|
344
|
+
- When `loading` is set, the button is treated as disabled (no pointer interaction).
|
|
345
|
+
|
|
273
346
|
## `<w-button>` API
|
|
274
347
|
|
|
275
348
|
Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
## Styling API
|
|
2
|
+
|
|
3
|
+
This component supports styling through **component tokens** (CSS custom properties with a --w-c- prefix) and **parts**.
|
|
4
|
+
|
|
5
|
+
### Parts
|
|
6
|
+
|
|
7
|
+
Use `::part(...)` from outside the component.
|
|
8
|
+
|
|
9
|
+
- `base` — the clickable element (`<button>` or `<w-link>`)
|
|
10
|
+
|
|
11
|
+
Example:
|
|
12
|
+
|
|
13
|
+
```css
|
|
14
|
+
w-button::part(base) {
|
|
15
|
+
text-transform: uppercase;
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Component tokens
|
|
20
|
+
|
|
21
|
+
Set these on `w-button` to override visuals.
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
w-button {
|
|
25
|
+
--w-c-button-bg: var(--w-s-color-background-primary);
|
|
26
|
+
--w-c-button-color: var(--w-s-color-text-inverted);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### Layout & typography
|
|
31
|
+
|
|
32
|
+
- `--w-c-button-radius`
|
|
33
|
+
- `--w-c-button-font-size`
|
|
34
|
+
- `--w-c-button-line-height`
|
|
35
|
+
- `--w-c-button-font-weight`
|
|
36
|
+
- `--w-c-button-padding-x`
|
|
37
|
+
- `--w-c-button-padding-y`
|
|
38
|
+
|
|
39
|
+
#### Background
|
|
40
|
+
|
|
41
|
+
- `--w-c-button-bg`
|
|
42
|
+
- `--w-c-button-bg-hover`
|
|
43
|
+
- `--w-c-button-bg-active`
|
|
44
|
+
|
|
45
|
+
#### Text color
|
|
46
|
+
|
|
47
|
+
- `--w-c-button-color`
|
|
48
|
+
- `--w-c-button-color-hover`
|
|
49
|
+
- `--w-c-button-color-active`
|
|
50
|
+
|
|
51
|
+
#### Border
|
|
52
|
+
|
|
53
|
+
- `--w-c-button-border-width`
|
|
54
|
+
- `--w-c-button-border-color`
|
|
55
|
+
- `--w-c-button-border-color-hover`
|
|
56
|
+
- `--w-c-button-border-color-active`
|
|
57
|
+
|
|
58
|
+
#### Focus
|
|
59
|
+
|
|
60
|
+
- `--w-c-button-outline-width`
|
|
61
|
+
- `--w-c-button-outline-color`
|
|
62
|
+
- `--w-c-button-outline-offset`
|
|
63
|
+
|
|
64
|
+
#### Motion
|
|
65
|
+
|
|
66
|
+
- `--w-c-button-transition`
|
|
67
|
+
|
|
68
|
+
### Notes
|
|
69
|
+
|
|
70
|
+
- Variant defaults are set internally using fallbacks, so overriding tokens works across variants.
|
|
71
|
+
- The `quiet` boolean is supported for backwards compatibility. Prefer `variant="quiet"` going forward.
|
|
72
|
+
- When `loading` is set, the button is treated as disabled (no pointer interaction).
|
package/dist/docs/card/card.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## Styling API
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
### `<w-checkbox>` API
|
|
2
|
+
|
|
3
|
+
#### Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Default | Summary |
|
|
6
|
+
|-|-|-|-|
|
|
7
|
+
| _computedInvalid (JS only) | `boolean` | `-` | Computed invalid state: combines own invalid with group invalid |
|
|
8
|
+
| checked | `boolean` | `false` | Whether the checkbox is checked. |
|
|
9
|
+
| disabled | `boolean` | `false` | Whether the checkbox is disabled. |
|
|
10
|
+
| indeterminate | `boolean` | `false` | Whether the checkbox is visually indeterminate. |
|
|
11
|
+
| input (JS only) | `HTMLInputElement \| null` | `-` | - |
|
|
12
|
+
| invalid | `boolean` | `false` | Whether the checkbox is visually invalid. |
|
|
13
|
+
| name | `string \| undefined` | `-` | The name of the checkbox. |
|
|
14
|
+
| required | `boolean` | `false` | Whether the checkbox must be checked before form submission. |
|
|
15
|
+
| shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true }` | - |
|
|
16
|
+
| validationMessage (JS only) | `string` | `-` | Returns the validation message if the checkbox is invalid, otherwise an empty string |
|
|
17
|
+
| validity (JS only) | `ValidityState` | `-` | Returns the validity state of the checkbox |
|
|
18
|
+
| value | `string \| null` | `null` | The value submitted when the checkbox is checked. |
|
|
19
|
+
|
|
20
|
+
#### Property Details
|
|
21
|
+
|
|
22
|
+
##### _computedInvalid (JS only)
|
|
23
|
+
|
|
24
|
+
Computed invalid state: combines own invalid with group invalid
|
|
25
|
+
|
|
26
|
+
- Type: `boolean`
|
|
27
|
+
- Default: `-`
|
|
28
|
+
|
|
29
|
+
##### checked
|
|
30
|
+
|
|
31
|
+
Whether the checkbox is checked.
|
|
32
|
+
|
|
33
|
+
Checked checkboxes submit their value with form data. The property is reflected to the `checked` attribute.
|
|
34
|
+
|
|
35
|
+
- Type: `boolean`
|
|
36
|
+
- Default: `false`
|
|
37
|
+
|
|
38
|
+
##### disabled
|
|
39
|
+
|
|
40
|
+
Whether the checkbox is disabled.
|
|
41
|
+
|
|
42
|
+
Disabled checkboxes cannot be focused, changed, or submitted with form data.
|
|
43
|
+
|
|
44
|
+
- Type: `boolean`
|
|
45
|
+
- Default: `false`
|
|
46
|
+
|
|
47
|
+
##### indeterminate
|
|
48
|
+
|
|
49
|
+
Whether the checkbox is visually indeterminate.
|
|
50
|
+
|
|
51
|
+
Use this for parent options that represent a mixed set of child selections. Clicking the checkbox clears the indeterminate state and sets the checkbox to checked.
|
|
52
|
+
|
|
53
|
+
- Type: `boolean`
|
|
54
|
+
- Default: `false`
|
|
55
|
+
|
|
56
|
+
##### input (JS only)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
- Type: `HTMLInputElement | null`
|
|
61
|
+
- Default: `-`
|
|
62
|
+
|
|
63
|
+
##### invalid
|
|
64
|
+
|
|
65
|
+
Whether the checkbox is visually invalid.
|
|
66
|
+
|
|
67
|
+
Use this to show an externally managed validation error. Required validation also sets the invalid state after the user interacts with the checkbox or tries to submit the form.
|
|
68
|
+
|
|
69
|
+
- Type: `boolean`
|
|
70
|
+
- Default: `false`
|
|
71
|
+
|
|
72
|
+
##### name
|
|
73
|
+
|
|
74
|
+
The name of the checkbox.
|
|
75
|
+
|
|
76
|
+
When the checkbox is checked and belongs to a form, this name is submitted with the checkbox value. If the checkbox is inside a `w-checkbox-group` with a name, the group name is used when the checkbox does not have its own name.
|
|
77
|
+
|
|
78
|
+
- Type: `string | undefined`
|
|
79
|
+
- Default: `-`
|
|
80
|
+
|
|
81
|
+
##### required
|
|
82
|
+
|
|
83
|
+
Whether the checkbox must be checked before form submission.
|
|
84
|
+
|
|
85
|
+
A required checkbox is invalid until it is checked. For requiring at least one option in a set, use `required` on `w-checkbox-group`.
|
|
86
|
+
|
|
87
|
+
- Type: `boolean`
|
|
88
|
+
- Default: `false`
|
|
89
|
+
|
|
90
|
+
##### shadowRootOptions (JS only)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
- Type: `object`
|
|
95
|
+
- Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true }`
|
|
96
|
+
|
|
97
|
+
##### validationMessage (JS only)
|
|
98
|
+
|
|
99
|
+
Returns the validation message if the checkbox is invalid, otherwise an empty string
|
|
100
|
+
|
|
101
|
+
- Type: `string`
|
|
102
|
+
- Default: `-`
|
|
103
|
+
|
|
104
|
+
##### validity (JS only)
|
|
105
|
+
|
|
106
|
+
Returns the validity state of the checkbox
|
|
107
|
+
|
|
108
|
+
- Type: `ValidityState`
|
|
109
|
+
- Default: `-`
|
|
110
|
+
|
|
111
|
+
##### value
|
|
112
|
+
|
|
113
|
+
The value submitted when the checkbox is checked.
|
|
114
|
+
|
|
115
|
+
If no value attribute is set, the checkbox defaults to `on`. Unchecked and disabled checkboxes do not submit a value.
|
|
116
|
+
|
|
117
|
+
- Type: `string | null`
|
|
118
|
+
- Default: `null`
|
|
119
|
+
|
|
120
|
+
#### Events
|
|
121
|
+
|
|
122
|
+
##### change
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
- Type: `Event`
|
|
127
|
+
|
|
128
|
+
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Checkbox (w-checkbox)
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### `<w-checkbox>` API
|
|
8
|
+
|
|
9
|
+
#### Properties
|
|
10
|
+
|
|
11
|
+
| Name | Type | Default | Summary |
|
|
12
|
+
|-|-|-|-|
|
|
13
|
+
| _computedInvalid (JS only) | `boolean` | `-` | Computed invalid state: combines own invalid with group invalid |
|
|
14
|
+
| checked | `boolean` | `false` | Whether the checkbox is checked. |
|
|
15
|
+
| disabled | `boolean` | `false` | Whether the checkbox is disabled. |
|
|
16
|
+
| indeterminate | `boolean` | `false` | Whether the checkbox is visually indeterminate. |
|
|
17
|
+
| input (JS only) | `HTMLInputElement \| null` | `-` | - |
|
|
18
|
+
| invalid | `boolean` | `false` | Whether the checkbox is visually invalid. |
|
|
19
|
+
| name | `string \| undefined` | `-` | The name of the checkbox. |
|
|
20
|
+
| required | `boolean` | `false` | Whether the checkbox must be checked before form submission. |
|
|
21
|
+
| shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true }` | - |
|
|
22
|
+
| validationMessage (JS only) | `string` | `-` | Returns the validation message if the checkbox is invalid, otherwise an empty string |
|
|
23
|
+
| validity (JS only) | `ValidityState` | `-` | Returns the validity state of the checkbox |
|
|
24
|
+
| value | `string \| null` | `null` | The value submitted when the checkbox is checked. |
|
|
25
|
+
|
|
26
|
+
#### Property Details
|
|
27
|
+
|
|
28
|
+
##### _computedInvalid (JS only)
|
|
29
|
+
|
|
30
|
+
Computed invalid state: combines own invalid with group invalid
|
|
31
|
+
|
|
32
|
+
- Type: `boolean`
|
|
33
|
+
- Default: `-`
|
|
34
|
+
|
|
35
|
+
##### checked
|
|
36
|
+
|
|
37
|
+
Whether the checkbox is checked.
|
|
38
|
+
|
|
39
|
+
Checked checkboxes submit their value with form data. The property is reflected to the `checked` attribute.
|
|
40
|
+
|
|
41
|
+
- Type: `boolean`
|
|
42
|
+
- Default: `false`
|
|
43
|
+
|
|
44
|
+
##### disabled
|
|
45
|
+
|
|
46
|
+
Whether the checkbox is disabled.
|
|
47
|
+
|
|
48
|
+
Disabled checkboxes cannot be focused, changed, or submitted with form data.
|
|
49
|
+
|
|
50
|
+
- Type: `boolean`
|
|
51
|
+
- Default: `false`
|
|
52
|
+
|
|
53
|
+
##### indeterminate
|
|
54
|
+
|
|
55
|
+
Whether the checkbox is visually indeterminate.
|
|
56
|
+
|
|
57
|
+
Use this for parent options that represent a mixed set of child selections. Clicking the checkbox clears the indeterminate state and sets the checkbox to checked.
|
|
58
|
+
|
|
59
|
+
- Type: `boolean`
|
|
60
|
+
- Default: `false`
|
|
61
|
+
|
|
62
|
+
##### input (JS only)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
- Type: `HTMLInputElement | null`
|
|
67
|
+
- Default: `-`
|
|
68
|
+
|
|
69
|
+
##### invalid
|
|
70
|
+
|
|
71
|
+
Whether the checkbox is visually invalid.
|
|
72
|
+
|
|
73
|
+
Use this to show an externally managed validation error. Required validation also sets the invalid state after the user interacts with the checkbox or tries to submit the form.
|
|
74
|
+
|
|
75
|
+
- Type: `boolean`
|
|
76
|
+
- Default: `false`
|
|
77
|
+
|
|
78
|
+
##### name
|
|
79
|
+
|
|
80
|
+
The name of the checkbox.
|
|
81
|
+
|
|
82
|
+
When the checkbox is checked and belongs to a form, this name is submitted with the checkbox value. If the checkbox is inside a `w-checkbox-group` with a name, the group name is used when the checkbox does not have its own name.
|
|
83
|
+
|
|
84
|
+
- Type: `string | undefined`
|
|
85
|
+
- Default: `-`
|
|
86
|
+
|
|
87
|
+
##### required
|
|
88
|
+
|
|
89
|
+
Whether the checkbox must be checked before form submission.
|
|
90
|
+
|
|
91
|
+
A required checkbox is invalid until it is checked. For requiring at least one option in a set, use `required` on `w-checkbox-group`.
|
|
92
|
+
|
|
93
|
+
- Type: `boolean`
|
|
94
|
+
- Default: `false`
|
|
95
|
+
|
|
96
|
+
##### shadowRootOptions (JS only)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
- Type: `object`
|
|
101
|
+
- Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true }`
|
|
102
|
+
|
|
103
|
+
##### validationMessage (JS only)
|
|
104
|
+
|
|
105
|
+
Returns the validation message if the checkbox is invalid, otherwise an empty string
|
|
106
|
+
|
|
107
|
+
- Type: `string`
|
|
108
|
+
- Default: `-`
|
|
109
|
+
|
|
110
|
+
##### validity (JS only)
|
|
111
|
+
|
|
112
|
+
Returns the validity state of the checkbox
|
|
113
|
+
|
|
114
|
+
- Type: `ValidityState`
|
|
115
|
+
- Default: `-`
|
|
116
|
+
|
|
117
|
+
##### value
|
|
118
|
+
|
|
119
|
+
The value submitted when the checkbox is checked.
|
|
120
|
+
|
|
121
|
+
If no value attribute is set, the checkbox defaults to `on`. Unchecked and disabled checkboxes do not submit a value.
|
|
122
|
+
|
|
123
|
+
- Type: `string | null`
|
|
124
|
+
- Default: `null`
|
|
125
|
+
|
|
126
|
+
#### Events
|
|
127
|
+
|
|
128
|
+
##### change
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
- Type: `Event`
|
|
133
|
+
|
|
134
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
## Accessibility
|
|
2
|
+
|
|
3
|
+
Checkbox group renders the child checkboxes inside an element with `role="group"`. The group label is connected to the group, and help text is connected when provided.
|
|
4
|
+
|
|
5
|
+
### Provide A Group Label
|
|
6
|
+
|
|
7
|
+
Use `label` to describe the shared question or topic.
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<w-checkbox-group label="Interests" name="interests">
|
|
11
|
+
<w-checkbox value="housing">Housing</w-checkbox>
|
|
12
|
+
<w-checkbox value="jobs">Jobs</w-checkbox>
|
|
13
|
+
<w-checkbox value="travel">Travel</w-checkbox>
|
|
14
|
+
</w-checkbox-group>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The group label should not duplicate every option label. It should explain what the options are about.
|
|
18
|
+
|
|
19
|
+
### Use Help Text For Extra Context
|
|
20
|
+
|
|
21
|
+
Use `help-text` for instructions, constraints, or validation feedback.
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<w-checkbox-group label="Interests" help-text="Select all that apply" name="interests">
|
|
25
|
+
<w-checkbox value="housing">Housing</w-checkbox>
|
|
26
|
+
<w-checkbox value="jobs">Jobs</w-checkbox>
|
|
27
|
+
<w-checkbox value="travel">Travel</w-checkbox>
|
|
28
|
+
</w-checkbox-group>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Keep help text short and actionable.
|
|
32
|
+
|
|
33
|
+
### Required Groups
|
|
34
|
+
|
|
35
|
+
Use `required` on the group when at least one option must be selected.
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<w-checkbox-group label="Preferences" required help-text="Choose at least one" name="preferences">
|
|
39
|
+
<w-checkbox value="email">Email</w-checkbox>
|
|
40
|
+
<w-checkbox value="sms">SMS</w-checkbox>
|
|
41
|
+
</w-checkbox-group>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Do not put `required` on each child checkbox for a "choose at least one" requirement. That would mean every option must be selected.
|
|
45
|
+
|
|
46
|
+
### Validation Feedback
|
|
47
|
+
|
|
48
|
+
Do not rely on invalid styling alone. Provide clear help text that explains what the user needs to do.
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<w-checkbox-group label="Preferences" invalid help-text="Select at least one option" name="preferences">
|
|
52
|
+
<w-checkbox value="email">Email</w-checkbox>
|
|
53
|
+
<w-checkbox value="sms">SMS</w-checkbox>
|
|
54
|
+
</w-checkbox-group>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
When the group is invalid, the invalid state is also shared with child checkboxes for consistent styling and accessibility state.
|
|
58
|
+
|
|
59
|
+
### Checkbox Labels
|
|
60
|
+
|
|
61
|
+
Each child checkbox still needs its own clear label.
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<w-checkbox-group label="Contact preferences" name="contact">
|
|
65
|
+
<w-checkbox value="email">Email</w-checkbox>
|
|
66
|
+
<w-checkbox value="sms">SMS</w-checkbox>
|
|
67
|
+
<w-checkbox value="push">Push notifications</w-checkbox>
|
|
68
|
+
</w-checkbox-group>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Avoid option labels that only make sense visually, such as "Yes" or "This one", unless the group label gives enough context.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
## `<w-checkbox-group>` API
|
|
2
|
+
|
|
3
|
+
Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
|
|
4
|
+
|
|
5
|
+
### Properties
|
|
6
|
+
|
|
7
|
+
| Name | Type | Default | Summary |
|
|
8
|
+
|-|-|-|-|
|
|
9
|
+
| help-text | `string` | `-` | Help text displayed below the checkbox group. |
|
|
10
|
+
| invalid | `boolean` | `false` | Whether the checkbox group is visually invalid. |
|
|
11
|
+
| label | `string` | `-` | The group label displayed above the checkboxes. |
|
|
12
|
+
| name | `string` | `-` | The name applied to child checkboxes when they do not provide one. |
|
|
13
|
+
| optional | `boolean` | `false` | Whether to show optional text next to the label. |
|
|
14
|
+
| required | `boolean` | `false` | Whether at least one checkbox in the group must be selected. |
|
|
15
|
+
| shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }` | - |
|
|
16
|
+
|
|
17
|
+
### Property Details
|
|
18
|
+
|
|
19
|
+
#### help-text
|
|
20
|
+
|
|
21
|
+
Help text displayed below the checkbox group.
|
|
22
|
+
|
|
23
|
+
Use this for supporting guidance or validation feedback. When required validation fails, the group replaces this text with the localized required message.
|
|
24
|
+
|
|
25
|
+
- Type: `string`
|
|
26
|
+
- Default: `-`
|
|
27
|
+
|
|
28
|
+
#### invalid
|
|
29
|
+
|
|
30
|
+
Whether the checkbox group is visually invalid.
|
|
31
|
+
|
|
32
|
+
Use this to show an externally managed validation error for the group. The invalid state is also shared with child checkboxes for consistent styling and accessibility state.
|
|
33
|
+
|
|
34
|
+
- Type: `boolean`
|
|
35
|
+
- Default: `false`
|
|
36
|
+
|
|
37
|
+
#### label
|
|
38
|
+
|
|
39
|
+
The group label displayed above the checkboxes.
|
|
40
|
+
|
|
41
|
+
Use this to describe the shared question or topic for the checkbox options. The label is connected to the internal group for assistive technologies.
|
|
42
|
+
|
|
43
|
+
- Type: `string`
|
|
44
|
+
- Default: `-`
|
|
45
|
+
|
|
46
|
+
#### name
|
|
47
|
+
|
|
48
|
+
The name applied to child checkboxes when they do not provide one.
|
|
49
|
+
|
|
50
|
+
Use this when the grouped checkboxes should submit values under the same form field name. Individual checkboxes can still override the group name with their own `name`.
|
|
51
|
+
|
|
52
|
+
- Type: `string`
|
|
53
|
+
- Default: `-`
|
|
54
|
+
|
|
55
|
+
#### optional
|
|
56
|
+
|
|
57
|
+
Whether to show optional text next to the label.
|
|
58
|
+
|
|
59
|
+
Use this to indicate that selecting an option from the group is not required.
|
|
60
|
+
|
|
61
|
+
- Type: `boolean`
|
|
62
|
+
- Default: `false`
|
|
63
|
+
|
|
64
|
+
#### required
|
|
65
|
+
|
|
66
|
+
Whether at least one checkbox in the group must be selected.
|
|
67
|
+
|
|
68
|
+
Required validation is managed by the group. The individual checkboxes provide the submitted form values.
|
|
69
|
+
|
|
70
|
+
- Type: `boolean`
|
|
71
|
+
- Default: `false`
|
|
72
|
+
|
|
73
|
+
#### shadowRootOptions (JS only)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
- Type: `object`
|
|
78
|
+
- Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }`
|
|
79
|
+
|