@warp-ds/elements 2.9.2-next.1 → 2.10.0-next.10
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 +4 -0
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/custom-elements.json +508 -145
- package/dist/docs/affix/affix.md +2 -2
- package/dist/docs/affix/styling.md +1 -0
- package/dist/docs/alert/alert.md +2 -2
- 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 -40
- package/dist/docs/box/examples.md +20 -38
- package/dist/docs/box/styling.md +1 -0
- package/dist/docs/breadcrumbs/breadcrumbs.md +8 -2
- package/dist/docs/breadcrumbs/examples.md +7 -1
- package/dist/docs/breadcrumbs/styling.md +1 -0
- package/dist/docs/button/accessibility.md +42 -0
- package/dist/docs/button/api.md +63 -39
- package/dist/docs/button/button.md +395 -42
- package/dist/docs/button/examples.md +126 -0
- package/dist/docs/button/styling.md +72 -0
- package/dist/docs/button/usage.md +89 -0
- package/dist/docs/card/accessibility.md +74 -0
- package/dist/docs/card/api.md +9 -3
- package/dist/docs/card/card.md +236 -5
- package/dist/docs/card/examples.md +75 -0
- package/dist/docs/card/styling.md +1 -0
- package/dist/docs/card/usage.md +76 -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/accessibility.md +71 -0
- package/dist/docs/combobox/api.md +60 -30
- package/dist/docs/combobox/combobox.md +205 -32
- package/dist/docs/combobox/examples.md +44 -0
- package/dist/docs/combobox/styling.md +1 -0
- package/dist/docs/combobox/usage.md +28 -0
- package/dist/docs/datepicker/accessibility.md +25 -0
- package/dist/docs/datepicker/api.md +22 -14
- package/dist/docs/datepicker/datepicker.md +208 -16
- 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/accessibility.md +5 -0
- package/dist/docs/icon/api.md +43 -0
- package/dist/docs/icon/examples.md +45 -0
- package/dist/docs/icon/icon.md +115 -0
- package/dist/docs/icon/styling.md +1 -0
- package/dist/docs/icon/usage.md +11 -0
- package/dist/docs/index.md +46 -0
- package/dist/docs/link/api.md +18 -22
- package/dist/docs/link/examples.md +75 -0
- package/dist/docs/link/link.md +113 -24
- package/dist/docs/link/styling.md +1 -0
- package/dist/docs/link/usage.md +18 -0
- package/dist/docs/modal/api.md +51 -0
- package/dist/docs/modal/examples.md +67 -0
- package/dist/docs/modal/modal.md +240 -0
- package/dist/docs/modal/styling.md +1 -0
- package/dist/docs/modal/usage.md +110 -0
- package/dist/docs/modal-footer/api.md +11 -0
- package/dist/docs/modal-footer/modal-footer.md +17 -0
- package/dist/docs/modal-header/api.md +42 -0
- package/dist/docs/modal-header/modal-header.md +48 -0
- package/dist/docs/page-indicator/api.md +6 -6
- package/dist/docs/page-indicator/examples.md +8 -0
- package/dist/docs/page-indicator/page-indicator.md +25 -6
- package/dist/docs/page-indicator/styling.md +1 -0
- package/dist/docs/page-indicator/usage.md +8 -0
- package/dist/docs/pagination/api.md +12 -10
- package/dist/docs/pagination/examples.md +20 -0
- package/dist/docs/pagination/pagination.md +52 -12
- package/dist/docs/pagination/styling.md +1 -0
- package/dist/docs/pagination/usage.md +18 -0
- package/dist/docs/pill/accessibility.md +2 -0
- package/dist/docs/pill/api.md +10 -26
- package/dist/docs/pill/examples.md +23 -0
- package/dist/docs/pill/pill.md +45 -28
- package/dist/docs/pill/styling.md +1 -0
- package/dist/docs/pill/usage.md +8 -0
- package/dist/docs/radio/radio.md +1 -7
- 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 +950 -602
- package/dist/packages/affix/affix.hydration.test.js +1 -1
- package/dist/packages/affix/affix.js +4 -4
- package/dist/packages/affix/affix.js.map +4 -4
- package/dist/packages/alert/alert.hydration.test.js +1 -1
- package/dist/packages/alert/alert.js +3 -3
- package/dist/packages/alert/alert.js.map +3 -3
- package/dist/packages/attention/attention.hydration.test.js +1 -1
- package/dist/packages/attention/attention.js +397 -444
- package/dist/packages/attention/attention.js.map +4 -4
- package/dist/packages/attention/attention.test.js +1 -1
- package/dist/packages/badge/badge.hydration.test.js +1 -1
- package/dist/packages/box/box.hydration.test.js +1 -1
- package/dist/packages/box/box.js +1 -1
- package/dist/packages/box/box.js.map +1 -1
- package/dist/packages/breadcrumbs/breadcrumbs.hydration.test.js +3 -2
- package/dist/packages/breadcrumbs/breadcrumbs.js +4 -4
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +3 -3
- package/dist/packages/button/button.d.ts +54 -37
- package/dist/packages/button/button.hydration.test.js +1 -1
- package/dist/packages/button/button.js +385 -432
- package/dist/packages/button/button.js.map +4 -4
- package/dist/packages/button/button.react.stories.d.ts +2 -2
- package/dist/packages/button/button.stories.d.ts +29 -0
- package/dist/packages/button/button.stories.js +176 -2
- package/dist/packages/button/react.d.ts +1 -1
- package/dist/packages/button/styles.d.ts +22 -1
- package/dist/packages/button/styles.js +390 -1
- package/dist/packages/card/card.d.ts +9 -6
- package/dist/packages/card/card.hydration.test.js +1 -1
- package/dist/packages/card/card.js +3 -3
- package/dist/packages/card/card.js.map +4 -4
- package/dist/packages/checkbox/checkbox.d.ts +45 -14
- package/dist/packages/checkbox/checkbox.hydration.test.js +1 -1
- package/dist/packages/checkbox/checkbox.js +3 -3
- 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/checkbox.test.js +1 -1
- package/dist/packages/checkbox/react.d.ts +2 -2
- package/dist/packages/checkbox-group/checkbox-group.a11y.test.js +1 -1
- package/dist/packages/checkbox-group/checkbox-group.d.ts +35 -8
- 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 +4 -4
- package/dist/packages/checkbox-group/react.d.ts +3 -3
- package/dist/packages/combobox/combobox.a11y.test.js +24 -0
- package/dist/packages/combobox/combobox.d.ts +65 -45
- package/dist/packages/combobox/combobox.hydration.test.js +39 -1
- package/dist/packages/combobox/combobox.js +21 -21
- package/dist/packages/combobox/combobox.js.map +4 -4
- package/dist/packages/combobox/combobox.stories.js +28 -15
- package/dist/packages/combobox/combobox.test.js +110 -0
- package/dist/packages/datepicker/DatePicker.test.js +1 -1
- 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 +49 -49
- package/dist/packages/datepicker/datepicker.js.map +4 -4
- package/dist/packages/datepicker/datepicker.test.js +1 -1
- 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 +11 -11
- package/dist/packages/expandable/expandable.js.map +3 -3
- 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.d.ts +16 -4
- package/dist/packages/icon/icon.hydration.test.js +1 -1
- package/dist/packages/icon/icon.js +2 -2
- package/dist/packages/icon/icon.js.map +3 -3
- package/dist/packages/icon/icon.react.stories.d.ts +1 -1
- package/dist/packages/icon/react.d.ts +2 -2
- package/dist/packages/link/link.d.ts +15 -16
- 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/link.test.js +1 -1
- package/dist/packages/link/styles.d.ts +5 -0
- package/dist/packages/link/styles.js +80 -0
- package/dist/packages/modal/index.d.ts +4 -4
- package/dist/packages/modal/index.js +4 -4
- package/dist/packages/modal/modal.d.ts +22 -12
- package/dist/packages/modal/modal.hydration.test.js +1 -1
- package/dist/packages/modal/modal.js +5 -5
- package/dist/packages/modal/modal.js.map +3 -3
- package/dist/packages/modal/modal.react.stories.d.ts +3 -3
- package/dist/packages/modal/modal.stories.d.ts +2 -1
- package/dist/packages/modal/modal.stories.js +85 -3
- package/dist/packages/modal/react.d.ts +2 -2
- package/dist/packages/modal-footer/modal-footer.d.ts +5 -3
- package/dist/packages/modal-footer/modal-footer.js +4 -4
- package/dist/packages/modal-footer/modal-footer.js.map +3 -3
- package/dist/packages/modal-footer/react.d.ts +1 -1
- package/dist/packages/modal-header/modal-header.d.ts +21 -11
- package/dist/packages/modal-header/modal-header.js +11 -9
- package/dist/packages/modal-header/modal-header.js.map +4 -4
- package/dist/packages/modal-header/react.d.ts +2 -2
- package/dist/packages/page-indicator/page-indicator.d.ts +9 -14
- package/dist/packages/page-indicator/page-indicator.hydration.test.js +1 -1
- package/dist/packages/page-indicator/page-indicator.js +5 -5
- package/dist/packages/page-indicator/page-indicator.js.map +4 -4
- package/dist/packages/pagination/pagination.d.ts +11 -11
- package/dist/packages/pagination/pagination.hydration.test.js +1 -1
- package/dist/packages/pagination/pagination.js +4 -4
- package/dist/packages/pagination/pagination.js.map +4 -4
- package/dist/packages/pagination/pagination.test.js +1 -1
- package/dist/packages/pill/pill.d.ts +14 -29
- package/dist/packages/pill/pill.hydration.test.js +1 -1
- package/dist/packages/pill/pill.js +3 -3
- package/dist/packages/pill/pill.js.map +4 -4
- package/dist/packages/pill/pill.react.stories.d.ts +2 -2
- package/dist/packages/pill/react.d.ts +1 -1
- package/dist/packages/radio/radio.hydration.test.js +1 -1
- package/dist/packages/radio/radio.js +3 -3
- package/dist/packages/radio/radio.js.map +3 -3
- package/dist/packages/radio/radio.test.js +1 -1
- package/dist/packages/radio-group/radio-group.a11y.test.js +7 -3
- package/dist/packages/radio-group/radio-group.hydration.test.js +6 -2
- package/dist/packages/radio-group/radio-group.js +11 -11
- 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.js +7 -7
- package/dist/packages/select/select.js.map +4 -4
- 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 +5 -5
- package/dist/packages/slider/slider.js.map +4 -4
- package/dist/packages/slider/slider.react.stories.js +2 -2
- package/dist/packages/slider/slider.test.js +1 -1
- package/dist/packages/slider-thumb/slider-thumb.hydration.test.js +1 -1
- package/dist/packages/slider-thumb/slider-thumb.js +20 -20
- package/dist/packages/slider-thumb/slider-thumb.js.map +4 -4
- package/dist/packages/step/step.hydration.test.js +1 -1
- package/dist/packages/step/step.js +8 -8
- package/dist/packages/step/step.js.map +4 -4
- package/dist/packages/step-indicator/step-indicator.hydration.test.js +1 -1
- package/dist/packages/switch/switch.a11y.test.js +1 -1
- package/dist/packages/switch/switch.hydration.test.js +1 -1
- package/dist/packages/switch/switch.js +1 -1
- package/dist/packages/switch/switch.js.map +1 -1
- package/dist/packages/tab/tab.hydration.test.js +1 -1
- package/dist/packages/tab/tab.js +10 -10
- package/dist/packages/tab/tab.js.map +2 -2
- package/dist/packages/tab-panel/tab-panel.hydration.test.js +1 -1
- package/dist/packages/tab-panel/tab-panel.js +3 -3
- package/dist/packages/tab-panel/tab-panel.js.map +2 -2
- package/dist/packages/tabs/tabs.a11y.test.js +2 -2
- package/dist/packages/tabs/tabs.hydration.test.js +1 -1
- package/dist/packages/tabs/tabs.js +1 -1
- package/dist/packages/tabs/tabs.js.map +2 -2
- package/dist/packages/tabs/tabs.test.js +4 -4
- package/dist/packages/textarea/textarea.hydration.test.js +1 -1
- package/dist/packages/textarea/textarea.js +4 -4
- package/dist/packages/textarea/textarea.js.map +3 -3
- package/dist/packages/textarea/textarea.test.js +1 -1
- package/dist/packages/textfield/textfield.hydration.test.js +1 -1
- package/dist/packages/textfield/textfield.js +1 -1
- package/dist/packages/textfield/textfield.js.map +1 -1
- package/dist/packages/textfield/textfield.test.js +1 -1
- package/dist/packages/toast/toast.js +6 -6
- package/dist/packages/toast/toast.js.map +4 -4
- package/dist/packages/toast/toast.stories.d.ts +1 -5
- package/dist/packages/toast/toast.stories.js +0 -17
- package/dist/packages/toast-container/toast-container.js +2 -2
- package/dist/packages/toast-container/toast-container.js.map +2 -2
- package/dist/web-types.json +509 -172
- package/eik/index.js +2536 -0
- package/package.json +18 -12
- 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
- /package/dist/docs/{radio → modal}/accessibility.md +0 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
## Styling API
|
|
2
|
+
|
|
3
|
+
This section documents the supported styling hooks for `<w-checkbox>`.
|
|
4
|
+
|
|
5
|
+
Use these hooks to customize appearance without relying on internal structure or selectors.
|
|
6
|
+
|
|
7
|
+
### Parts
|
|
8
|
+
|
|
9
|
+
The checkbox exposes a small set of parts that can be targeted for last‑mile layout or typography tweaks.
|
|
10
|
+
|
|
11
|
+
| Part | Targets | Typical use |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `base` | wrapper element | layout adjustments (spacing, alignment) |
|
|
14
|
+
| `control` | checkbox control (box) | minor alignment or sizing tweaks |
|
|
15
|
+
| `input` | native `<input type="checkbox">` | focus / outline adjustments |
|
|
16
|
+
| `label` | label content | typography tweaks |
|
|
17
|
+
|
|
18
|
+
Example:
|
|
19
|
+
|
|
20
|
+
```css
|
|
21
|
+
w-checkbox::part(label) {
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
w-checkbox::part(control) {
|
|
26
|
+
margin-top: 1px;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Parts are intended as an **escape hatch**.
|
|
31
|
+
Prefer component tokens for anything state‑ or size‑related.
|
|
32
|
+
|
|
33
|
+
### Component tokens (`--w-c-checkbox-*`)
|
|
34
|
+
|
|
35
|
+
Component tokens act as inputs to the checkbox styling.
|
|
36
|
+
They can be set directly on the component or inherited from a parent container.
|
|
37
|
+
|
|
38
|
+
```css
|
|
39
|
+
.settings-panel {
|
|
40
|
+
--w-c-checkbox-gap: 12px;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Defaults are defined internally; setting a token is always optional.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
#### Layout & size
|
|
48
|
+
|
|
49
|
+
| Token | Purpose | Default |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `--w-c-checkbox-gap` | space between control and label | `8px` |
|
|
52
|
+
| `--w-c-checkbox-control-size` | width/height of the control | `2rem` |
|
|
53
|
+
| `--w-c-checkbox-radius` | border radius of the control | `4px` |
|
|
54
|
+
| `--w-c-checkbox-border-width` | border width | `1px` |
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
#### Colors
|
|
58
|
+
|
|
59
|
+
| Token | Purpose | Default |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `--w-c-checkbox-bg` | control background | theme default |
|
|
62
|
+
| `--w-c-checkbox-border-color` | control border color | theme default |
|
|
63
|
+
| `--w-c-checkbox-bg-checked` | background when checked | theme default |
|
|
64
|
+
| `--w-c-checkbox-border-color-checked` | border when checked | theme default |
|
|
65
|
+
| `--w-c-checkbox-icon-color` | icon color | theme default |
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
#### Invalid state
|
|
69
|
+
|
|
70
|
+
| Token | Purpose | Default |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| `--w-c-checkbox-border-color-invalid` | border color when invalid | theme default |
|
|
73
|
+
| `--w-c-checkbox-bg-invalid-checked` | background when invalid and checked | theme default |
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
#### Disabled state
|
|
77
|
+
|
|
78
|
+
| Token | Purpose | Default |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| `--w-c-checkbox-bg-disabled` | background when disabled | theme default |
|
|
81
|
+
| `--w-c-checkbox-border-color-disabled` | border when disabled | theme default |
|
|
82
|
+
| `--w-c-checkbox-bg-disabled-checked` | background when disabled and checked | theme default |
|
|
83
|
+
|
|
84
|
+
#### Focus
|
|
85
|
+
|
|
86
|
+
| Token | Purpose | Default |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `--w-c-checkbox-outline-width` | focus outline width | `2px` |
|
|
89
|
+
| `--w-c-checkbox-outline-color` | focus outline color | theme default |
|
|
90
|
+
| `--w-c-checkbox-outline-offset` | focus outline offset | theme default |
|
|
91
|
+
|
|
92
|
+
#### Motion
|
|
93
|
+
|
|
94
|
+
| Token | Purpose | Default |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `--w-c-checkbox-transition` | transition for control | `150ms cubic-bezier(0.4, 0, 0.2, 1)` |
|
|
97
|
+
|
|
98
|
+
Transitions are automatically disabled when `prefers-reduced-motion: reduce` is active.
|
|
99
|
+
|
|
100
|
+
### Examples
|
|
101
|
+
|
|
102
|
+
#### Compact checkbox
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
.filters w-checkbox {
|
|
106
|
+
--w-c-checkbox-gap: 4px;
|
|
107
|
+
--w-c-checkbox-control-size: 1.6rem;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### Rounded checkbox
|
|
112
|
+
|
|
113
|
+
```css
|
|
114
|
+
w-checkbox {
|
|
115
|
+
--w-c-checkbox-radius: 9999px;
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Contextual color override (advanced)
|
|
120
|
+
|
|
121
|
+
```css
|
|
122
|
+
.danger-zone w-checkbox {
|
|
123
|
+
--w-c-checkbox-border-color-checked: red;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Guidelines
|
|
128
|
+
|
|
129
|
+
- Prefer **component tokens** for size, spacing, and state styling
|
|
130
|
+
- Use **parts** only for small, local tweaks
|
|
131
|
+
- Avoid relying on internal class names or selectors
|
|
132
|
+
- If multiple tokens are required to achieve a look, consider whether a new variant or design token is more appropriate
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
## Usage
|
|
2
|
+
|
|
3
|
+
Checkbox lets users select one or more options. Use it for independent yes/no choices, multi-select lists, and terms or consent confirmations.
|
|
4
|
+
|
|
5
|
+
Use `w-checkbox-group` when several checkboxes share one label, help text, optional indicator, or required validation.
|
|
6
|
+
|
|
7
|
+
### Basic Checkbox
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The slotted text becomes the checkbox label.
|
|
14
|
+
|
|
15
|
+
### Checked State
|
|
16
|
+
|
|
17
|
+
Use `checked` when the checkbox should be selected by default.
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<w-checkbox name="alerts" value="email" checked>Email alerts</w-checkbox>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Listen for the `change` event when you need to react to user changes.
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<w-checkbox id="newsletter" name="newsletter" value="yes">Sign up for updates</w-checkbox>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
const checkbox = document.querySelector('#newsletter');
|
|
30
|
+
|
|
31
|
+
checkbox.addEventListener('change', () => {
|
|
32
|
+
console.log(checkbox.checked);
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Form Submission
|
|
38
|
+
|
|
39
|
+
`w-checkbox` is form-associated. When checked, it submits its `name` and `value` with the form. When unchecked or disabled, it submits nothing.
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<form>
|
|
43
|
+
<w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
|
|
44
|
+
<w-button type="submit">Submit</w-button>
|
|
45
|
+
</form>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If no `value` is set, the submitted value defaults to `on`.
|
|
49
|
+
|
|
50
|
+
### Required
|
|
51
|
+
|
|
52
|
+
Use `required` when one standalone checkbox must be checked before form submission, such as accepting terms.
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<form>
|
|
56
|
+
<w-checkbox name="terms" value="accepted" required>Accept the terms</w-checkbox>
|
|
57
|
+
<w-button type="submit">Continue</w-button>
|
|
58
|
+
</form>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For a set of options where at least one option is required, put `required` on `w-checkbox-group` instead.
|
|
62
|
+
|
|
63
|
+
### Checkbox Group
|
|
64
|
+
|
|
65
|
+
Use `w-checkbox-group` to group related options under a shared label and help text.
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<w-checkbox-group label="Interests" help-text="Select all that apply" name="interests">
|
|
69
|
+
<w-checkbox value="housing">Housing</w-checkbox>
|
|
70
|
+
<w-checkbox value="jobs">Jobs</w-checkbox>
|
|
71
|
+
<w-checkbox value="travel">Travel</w-checkbox>
|
|
72
|
+
</w-checkbox-group>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The group name is applied to child checkboxes that do not have their own `name`.
|
|
76
|
+
|
|
77
|
+
### Indeterminate
|
|
78
|
+
|
|
79
|
+
Use `indeterminate` when a parent checkbox represents a mixed set of child selections.
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<w-checkbox name="all-notifications" indeterminate>All notifications</w-checkbox>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Indeterminate is a visual state. When the user clicks the checkbox, the indeterminate state is cleared and the checkbox becomes checked.
|
|
86
|
+
|
|
87
|
+
### Invalid
|
|
88
|
+
|
|
89
|
+
Set `invalid` when validation is managed outside the component.
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<w-checkbox name="terms" value="accepted" invalid>Accept the terms</w-checkbox>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
When possible, place clear error text near the checkbox or group so users know how to correct the error.
|
|
@@ -1 +1,72 @@
|
|
|
1
1
|
## Accessibility
|
|
2
|
+
|
|
3
|
+
Combobox renders an input with `role="combobox"` and a popup list with `role="listbox"`. Each suggestion is rendered with `role="option"`, and the active suggestion is connected to the input with `aria-activedescendant`.
|
|
4
|
+
|
|
5
|
+
### Provide A Label
|
|
6
|
+
|
|
7
|
+
Always provide a visible label.
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<w-combobox label="Country" placeholder="Search">
|
|
11
|
+
<option value="no">Norway</option>
|
|
12
|
+
<option value="se">Sweden</option>
|
|
13
|
+
<option value="dk">Denmark</option>
|
|
14
|
+
</w-combobox>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Do not rely on placeholder text as the only label. Placeholder text disappears as soon as the user types and is not a reliable accessible name.
|
|
18
|
+
|
|
19
|
+
### Help Text And Errors
|
|
20
|
+
|
|
21
|
+
Use `help-text` for extra guidance or validation feedback.
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<w-combobox label="Country" help-text="Start typing to filter countries">
|
|
25
|
+
<option value="no">Norway</option>
|
|
26
|
+
<option value="se">Sweden</option>
|
|
27
|
+
<option value="dk">Denmark</option>
|
|
28
|
+
</w-combobox>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
When the combobox is invalid, pair `invalid` with help text that explains how to correct the error.
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<w-combobox label="Country" invalid help-text="Select a country from the list">
|
|
35
|
+
<option value="no">Norway</option>
|
|
36
|
+
<option value="se">Sweden</option>
|
|
37
|
+
<option value="dk">Denmark</option>
|
|
38
|
+
</w-combobox>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Do not rely on invalid styling alone.
|
|
42
|
+
|
|
43
|
+
### Keyboard Interaction
|
|
44
|
+
|
|
45
|
+
The input follows common combobox keyboard behavior:
|
|
46
|
+
|
|
47
|
+
- Arrow Down and Arrow Up open the list and move between suggestions.
|
|
48
|
+
- Home and End move to the first and last suggestion.
|
|
49
|
+
- Page Up and Page Down move through suggestions in larger steps.
|
|
50
|
+
- Enter selects the active suggestion.
|
|
51
|
+
- Escape closes the list. When the list is already closed, Escape clears the value.
|
|
52
|
+
- Tab closes the list and moves focus onward.
|
|
53
|
+
|
|
54
|
+
### Suggestions
|
|
55
|
+
|
|
56
|
+
The component announces the number of available suggestions through a screen-reader-only status message while the list is open.
|
|
57
|
+
|
|
58
|
+
Keep option labels short and unique enough to distinguish. If the submitted `value` differs from what users should read, provide a clear option label.
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<w-combobox label="Country" placeholder="Search">
|
|
62
|
+
<option value="us" label="United States">US</option>
|
|
63
|
+
<option value="uk" label="United Kingdom">UK</option>
|
|
64
|
+
<option value="no">Norway</option>
|
|
65
|
+
</w-combobox>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Disabled Comboboxes
|
|
69
|
+
|
|
70
|
+
Avoid disabled comboboxes where possible. Disabled controls can be hard to discover and do not explain why the field is unavailable.
|
|
71
|
+
|
|
72
|
+
Prefer leaving the combobox enabled and showing validation or explanatory feedback when the user tries to continue.
|
|
@@ -6,125 +6,155 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
6
6
|
|
|
7
7
|
| Name | Type | Default | Summary |
|
|
8
8
|
|-|-|-|-|
|
|
9
|
-
| autocomplete | `string \| undefined` | `'off'` |
|
|
10
|
-
| disable-static-filtering | `boolean` | `false` |
|
|
11
|
-
| disabled | `boolean` | `false` | Whether the
|
|
12
|
-
| help-text | `string \| undefined` | `''` |
|
|
13
|
-
| invalid | `boolean` | `false` |
|
|
14
|
-
| label | `string \| undefined` | `''` |
|
|
15
|
-
| match-text-segments | `boolean` | `false` | Whether
|
|
16
|
-
| name | `string \| undefined` | `''` |
|
|
17
|
-
| open-on-focus | `boolean` | `false` | Whether the
|
|
18
|
-
| optional | `boolean` | `false` | Whether to show optional text |
|
|
19
|
-
| options | `ComboboxOption[]` | `[]` | The available options to select from |
|
|
20
|
-
| placeholder | `string \| undefined` | `''` |
|
|
21
|
-
| required | `boolean` | `false` | Whether the
|
|
22
|
-
| select-on-blur | `boolean` | `true` |
|
|
23
|
-
| value | `string` | `''` | The
|
|
9
|
+
| autocomplete | `string \| undefined` | `'off'` | The autocomplete attribute passed to the internal input. |
|
|
10
|
+
| disable-static-filtering | `boolean` | `false` | Whether built-in client-side filtering is disabled. |
|
|
11
|
+
| disabled | `boolean` | `false` | Whether the combobox is disabled. |
|
|
12
|
+
| help-text | `string \| undefined` | `''` | Help text displayed below the input. |
|
|
13
|
+
| invalid | `boolean` | `false` | Whether the combobox is visually invalid. |
|
|
14
|
+
| label | `string \| undefined` | `''` | The label displayed above the input. |
|
|
15
|
+
| match-text-segments | `boolean` | `false` | Whether matching text segments in options are highlighted. |
|
|
16
|
+
| name | `string \| undefined` | `''` | The name submitted with the combobox value. |
|
|
17
|
+
| open-on-focus | `boolean` | `false` | Whether the option list opens when the input receives focus. |
|
|
18
|
+
| optional | `boolean` | `false` | Whether to show optional text next to the label. |
|
|
19
|
+
| options | `ComboboxOption[]` | `[]` | The available options to select from. |
|
|
20
|
+
| placeholder | `string \| undefined` | `''` | Placeholder text displayed when the input is empty. |
|
|
21
|
+
| required | `boolean` | `false` | Whether the combobox is required before form submission. |
|
|
22
|
+
| select-on-blur | `boolean` | `true` | Whether the active option is selected when the input loses focus. |
|
|
23
|
+
| value | `string` | `''` | The selected or typed value. |
|
|
24
24
|
|
|
25
25
|
### Property Details
|
|
26
26
|
|
|
27
27
|
#### autocomplete
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The autocomplete attribute passed to the internal input.
|
|
30
|
+
|
|
31
|
+
Defaults to `off`. Set this when browser autocomplete should be enabled or scoped to a specific autocomplete token.
|
|
30
32
|
|
|
31
33
|
- Type: `string | undefined`
|
|
32
34
|
- Default: `'off'`
|
|
33
35
|
|
|
34
36
|
#### disable-static-filtering
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
Whether built-in client-side filtering is disabled.
|
|
39
|
+
|
|
40
|
+
Use this for remote search or externally filtered results. When disabled, all entries in `options` are rendered as provided.
|
|
37
41
|
|
|
38
42
|
- Type: `boolean`
|
|
39
43
|
- Default: `false`
|
|
40
44
|
|
|
41
45
|
#### disabled
|
|
42
46
|
|
|
43
|
-
Whether the
|
|
47
|
+
Whether the combobox is disabled.
|
|
48
|
+
|
|
49
|
+
Disabled comboboxes cannot be focused, changed, or submitted with form data.
|
|
44
50
|
|
|
45
51
|
- Type: `boolean`
|
|
46
52
|
- Default: `false`
|
|
47
53
|
|
|
48
54
|
#### help-text
|
|
49
55
|
|
|
50
|
-
|
|
56
|
+
Help text displayed below the input.
|
|
57
|
+
|
|
58
|
+
Use this for supporting guidance or validation feedback.
|
|
51
59
|
|
|
52
60
|
- Type: `string | undefined`
|
|
53
61
|
- Default: `''`
|
|
54
62
|
|
|
55
63
|
#### invalid
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
Whether the combobox is visually invalid.
|
|
66
|
+
|
|
67
|
+
Use this to show an externally managed validation error. Pair it with `help-text` to explain how to fix the error.
|
|
58
68
|
|
|
59
69
|
- Type: `boolean`
|
|
60
70
|
- Default: `false`
|
|
61
71
|
|
|
62
72
|
#### label
|
|
63
73
|
|
|
64
|
-
|
|
74
|
+
The label displayed above the input.
|
|
75
|
+
|
|
76
|
+
Use this to give the combobox a visible and accessible name.
|
|
65
77
|
|
|
66
78
|
- Type: `string | undefined`
|
|
67
79
|
- Default: `''`
|
|
68
80
|
|
|
69
81
|
#### match-text-segments
|
|
70
82
|
|
|
71
|
-
Whether
|
|
83
|
+
Whether matching text segments in options are highlighted.
|
|
84
|
+
|
|
85
|
+
Use this to visually emphasize the part of each option that matches the current input value.
|
|
72
86
|
|
|
73
87
|
- Type: `boolean`
|
|
74
88
|
- Default: `false`
|
|
75
89
|
|
|
76
90
|
#### name
|
|
77
91
|
|
|
78
|
-
|
|
92
|
+
The name submitted with the combobox value.
|
|
93
|
+
|
|
94
|
+
Use this when the combobox belongs to a form and its value should be included in form data.
|
|
79
95
|
|
|
80
96
|
- Type: `string | undefined`
|
|
81
97
|
- Default: `''`
|
|
82
98
|
|
|
83
99
|
#### open-on-focus
|
|
84
100
|
|
|
85
|
-
Whether the
|
|
101
|
+
Whether the option list opens when the input receives focus.
|
|
102
|
+
|
|
103
|
+
Use this when users should see available options before they start typing.
|
|
86
104
|
|
|
87
105
|
- Type: `boolean`
|
|
88
106
|
- Default: `false`
|
|
89
107
|
|
|
90
108
|
#### optional
|
|
91
109
|
|
|
92
|
-
Whether to show optional text
|
|
110
|
+
Whether to show optional text next to the label.
|
|
111
|
+
|
|
112
|
+
Use this to indicate that the combobox is not required.
|
|
93
113
|
|
|
94
114
|
- Type: `boolean`
|
|
95
115
|
- Default: `false`
|
|
96
116
|
|
|
97
117
|
#### options
|
|
98
118
|
|
|
99
|
-
The available options to select from
|
|
119
|
+
The available options to select from.
|
|
120
|
+
|
|
121
|
+
Use this for framework usage, application state, or remote search results. When `options` contains entries, it is used instead of child `<option>` elements.
|
|
100
122
|
|
|
101
123
|
- Type: `ComboboxOption[]`
|
|
102
124
|
- Default: `[]`
|
|
103
125
|
|
|
104
126
|
#### placeholder
|
|
105
127
|
|
|
106
|
-
|
|
128
|
+
Placeholder text displayed when the input is empty.
|
|
129
|
+
|
|
130
|
+
Use this as a short hint for the expected input. Do not use placeholder text as a replacement for a label.
|
|
107
131
|
|
|
108
132
|
- Type: `string | undefined`
|
|
109
133
|
- Default: `''`
|
|
110
134
|
|
|
111
135
|
#### required
|
|
112
136
|
|
|
113
|
-
Whether the
|
|
137
|
+
Whether the combobox is required before form submission.
|
|
138
|
+
|
|
139
|
+
Use this when the user must provide a value before submitting the form.
|
|
114
140
|
|
|
115
141
|
- Type: `boolean`
|
|
116
142
|
- Default: `false`
|
|
117
143
|
|
|
118
144
|
#### select-on-blur
|
|
119
145
|
|
|
120
|
-
|
|
146
|
+
Whether the active option is selected when the input loses focus.
|
|
147
|
+
|
|
148
|
+
When enabled, the combobox selects the keyboard-highlighted option, or an option whose value exactly matches the current input value, on blur.
|
|
121
149
|
|
|
122
150
|
- Type: `boolean`
|
|
123
151
|
- Default: `true`
|
|
124
152
|
|
|
125
153
|
#### value
|
|
126
154
|
|
|
127
|
-
The
|
|
155
|
+
The selected or typed value.
|
|
156
|
+
|
|
157
|
+
When an option is selected, this is set to the option value. The displayed text may differ when the option has a separate label.
|
|
128
158
|
|
|
129
159
|
- Type: `string`
|
|
130
160
|
- Default: `''`
|