@warp-ds/elements 2.10.0-next.4 → 2.10.0-next.6
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/custom-elements.json +68 -14
- 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/button.md +73 -2
- package/dist/docs/button/styling.md +72 -0
- package/dist/docs/card/card.md +2 -2
- 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 -2
- 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 -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/icon.md +3 -1
- package/dist/docs/icon/styling.md +1 -0
- package/dist/docs/index.md +46 -0
- package/dist/docs/link/link.md +2 -2
- 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 +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 +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 -7
- 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
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
## Examples
|
|
2
|
+
|
|
3
|
+
### Basic
|
|
4
|
+
|
|
5
|
+
<elements-example>
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
</elements-example>
|
|
12
|
+
|
|
13
|
+
### Checked
|
|
14
|
+
|
|
15
|
+
<elements-example>
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<w-checkbox name="alerts" value="email" checked>Email alerts</w-checkbox>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
</elements-example>
|
|
22
|
+
|
|
23
|
+
### Required
|
|
24
|
+
|
|
25
|
+
<elements-example>
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<form>
|
|
29
|
+
<w-checkbox name="terms" value="accepted" required>Accept the terms</w-checkbox>
|
|
30
|
+
<w-button type="submit">Continue</w-button>
|
|
31
|
+
</form>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
</elements-example>
|
|
35
|
+
|
|
36
|
+
### Invalid
|
|
37
|
+
|
|
38
|
+
<elements-example>
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<w-checkbox name="terms" value="accepted" invalid>Accept the terms</w-checkbox>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
</elements-example>
|
|
45
|
+
|
|
46
|
+
### Disabled
|
|
47
|
+
|
|
48
|
+
<elements-example>
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<w-checkbox name="newsletter" value="yes" disabled>Sign up for updates</w-checkbox>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
</elements-example>
|
|
55
|
+
|
|
56
|
+
### Indeterminate
|
|
57
|
+
|
|
58
|
+
<elements-example>
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<w-checkbox name="all-notifications" indeterminate>All notifications</w-checkbox>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
</elements-example>
|
|
65
|
+
|
|
66
|
+
### Checkbox Group
|
|
67
|
+
|
|
68
|
+
<elements-example>
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<w-checkbox-group label="Interests" help-text="Select all that apply" name="interests">
|
|
72
|
+
<w-checkbox value="housing">Housing</w-checkbox>
|
|
73
|
+
<w-checkbox value="jobs">Jobs</w-checkbox>
|
|
74
|
+
<w-checkbox value="travel">Travel</w-checkbox>
|
|
75
|
+
</w-checkbox-group>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
</elements-example>
|
|
79
|
+
|
|
80
|
+
### Required Checkbox Group
|
|
81
|
+
|
|
82
|
+
<elements-example>
|
|
83
|
+
|
|
84
|
+
```html
|
|
85
|
+
<w-checkbox-group label="Preferences" required help-text="Choose at least one" name="preferences">
|
|
86
|
+
<w-checkbox value="email">Email</w-checkbox>
|
|
87
|
+
<w-checkbox value="sms">SMS</w-checkbox>
|
|
88
|
+
<w-checkbox value="push">Push notifications</w-checkbox>
|
|
89
|
+
</w-checkbox-group>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
</elements-example>
|
|
93
|
+
|
|
94
|
+
### Form Associated
|
|
95
|
+
|
|
96
|
+
<elements-example>
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<form>
|
|
100
|
+
<w-checkbox name="newsletter" value="yes">Sign up for updates</w-checkbox>
|
|
101
|
+
<w-button type="submit">Submit</w-button>
|
|
102
|
+
</form>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
</elements-example>
|
|
@@ -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.
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
A combobox element for text input with selectable options.
|
|
6
6
|
|
|
7
|
-
[See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/forms-combobox--docs)
|
|
8
|
-
|
|
9
7
|
## Usage
|
|
10
8
|
|
|
11
9
|
Use child `<option>` elements for declarative HTML usage.
|
|
@@ -155,6 +153,8 @@ combobox.options = [
|
|
|
155
153
|
|
|
156
154
|
Child option content is plain text. Rich option content is not supported.
|
|
157
155
|
|
|
156
|
+
## Styling API
|
|
157
|
+
|
|
158
158
|
## `<w-combobox>` API
|
|
159
159
|
|
|
160
160
|
Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## Styling API
|
|
@@ -1 +1,26 @@
|
|
|
1
1
|
## Accessibility
|
|
2
|
+
|
|
3
|
+
Datepicker renders a labeled date input with a button that opens a calendar dialog. The calendar uses a grid of dates and moves focus into the calendar when it opens.
|
|
4
|
+
|
|
5
|
+
### Provide A Label
|
|
6
|
+
|
|
7
|
+
Always provide a visible label.
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<w-datepicker label="Departure date" name="departure"></w-datepicker>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The label should describe the date being requested. Avoid generic labels such as "Date" when there are several date fields on the same page.
|
|
14
|
+
|
|
15
|
+
### Calendar Dialog
|
|
16
|
+
|
|
17
|
+
The calendar popup is rendered as a dialog with `aria-modal="true"`. The month heading is announced with `aria-live="polite"` when users move between months.
|
|
18
|
+
|
|
19
|
+
Each date in the calendar grid has an accessible name formatted using `day-format`.
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<w-datepicker label="Date" name="date" day-format="PPPP"></w-datepicker>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use a descriptive `day-format` so screen reader users hear the full date, not only the day number.
|
|
26
|
+
See [the Date FNS docs](https://date-fns.org/v4.1.0/docs/format) for formatting options.
|
|
@@ -7,15 +7,15 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
7
7
|
| Name | Type | Default | Summary |
|
|
8
8
|
|-|-|-|-|
|
|
9
9
|
| calendar (JS only) | `HTMLDivElement` | `-` | - |
|
|
10
|
-
| day-format | `string` | `'PPPP'` |
|
|
11
|
-
| header-format | `string` | `'MMMM yyyy'` |
|
|
10
|
+
| day-format | `string` | `'PPPP'` | The date format used for calendar day accessible names. |
|
|
11
|
+
| header-format | `string` | `'MMMM yyyy'` | The date format used in the calendar header. |
|
|
12
12
|
| input (JS only) | `HTMLInputElement` | `-` | - |
|
|
13
13
|
| isCalendarOpen (JS only) | `boolean` | `false` | - |
|
|
14
|
-
| isDayDisabled (JS only) | `(day: Date) => boolean` | `-` |
|
|
15
|
-
| label | `string` | `-` |
|
|
16
|
-
| lang | `string` | `-` |
|
|
14
|
+
| isDayDisabled (JS only) | `(day: Date) => boolean` | `-` | Function used to disable dates in the calendar. |
|
|
15
|
+
| label | `string` | `-` | The label displayed above the date input. |
|
|
16
|
+
| lang | `string` | `-` | The locale used for calendar labels and date formatting. |
|
|
17
17
|
| month (JS only) | `unknown` | `-` | - |
|
|
18
|
-
| name | `string` | `-` |
|
|
18
|
+
| name | `string` | `-` | The name submitted with the date value. |
|
|
19
19
|
| navigationDate (JS only) | `Date` | `-` | - |
|
|
20
20
|
| previousMonthButton (JS only) | `HTMLButtonElement` | `-` | This is the first focusable element, needed for the modal focus trap. |
|
|
21
21
|
| selectedCell (JS only) | `HTMLTableCellElement` | `-` | - |
|
|
@@ -23,8 +23,8 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
23
23
|
| shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }` | - |
|
|
24
24
|
| todayCell (JS only) | `HTMLTableCellElement` | `-` | - |
|
|
25
25
|
| toggleButton (JS only) | `HTMLButtonElement` | `-` | - |
|
|
26
|
-
| value | `string` | `-` |
|
|
27
|
-
| weekday-format | `string` | `'EEEEEE'` |
|
|
26
|
+
| value | `string` | `-` | The selected date value. |
|
|
27
|
+
| weekday-format | `string` | `'EEEEEE'` | The weekday format shown above the calendar grid. |
|
|
28
28
|
| weeks (JS only) | `unknown` | `-` | - |
|
|
29
29
|
| wrapper (JS only) | `HTMLDivElement` | `-` | - |
|
|
30
30
|
|
|
@@ -39,7 +39,7 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
39
39
|
|
|
40
40
|
#### day-format
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
The date format used for calendar day accessible names.
|
|
43
43
|
|
|
44
44
|
The syntax is defined by [date-fns/format](https://date-fns.org/v4.1.0/docs/format).
|
|
45
45
|
|
|
@@ -48,7 +48,7 @@ The syntax is defined by [date-fns/format](https://date-fns.org/v4.1.0/docs/form
|
|
|
48
48
|
|
|
49
49
|
#### header-format
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
The date format used in the calendar header.
|
|
52
52
|
|
|
53
53
|
The syntax is defined by [date-fns/format](https://date-fns.org/v4.1.0/docs/format).
|
|
54
54
|
|
|
@@ -71,23 +71,27 @@ The syntax is defined by [date-fns/format](https://date-fns.org/v4.1.0/docs/form
|
|
|
71
71
|
|
|
72
72
|
#### isDayDisabled (JS only)
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Function used to disable dates in the calendar.
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
Set this on the element instance in JavaScript, not as an HTML attribute. Disabled dates cannot be selected from the calendar.
|
|
77
77
|
|
|
78
78
|
- Type: `(day: Date) => boolean`
|
|
79
79
|
- Default: `-`
|
|
80
80
|
|
|
81
81
|
#### label
|
|
82
82
|
|
|
83
|
+
The label displayed above the date input.
|
|
83
84
|
|
|
85
|
+
Use this to give the datepicker a visible and accessible name.
|
|
84
86
|
|
|
85
87
|
- Type: `string`
|
|
86
88
|
- Default: `-`
|
|
87
89
|
|
|
88
90
|
#### lang
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
The locale used for calendar labels and date formatting.
|
|
93
|
+
|
|
94
|
+
This takes precedence over the `<html>` `lang` attribute. Supported built-in locales are `en`, `nb`, `sv`, `da`, and `fi`.
|
|
91
95
|
|
|
92
96
|
- Type: `string`
|
|
93
97
|
- Default: `-`
|
|
@@ -101,7 +105,9 @@ Takes precedence over the `<html>` lang attribute.
|
|
|
101
105
|
|
|
102
106
|
#### name
|
|
103
107
|
|
|
108
|
+
The name submitted with the date value.
|
|
104
109
|
|
|
110
|
+
Use this when the datepicker belongs to a form and its value should be included in form data.
|
|
105
111
|
|
|
106
112
|
- Type: `string`
|
|
107
113
|
- Default: `-`
|
|
@@ -161,14 +167,16 @@ the query will point to an element that doesn't exist anymore.
|
|
|
161
167
|
|
|
162
168
|
#### value
|
|
163
169
|
|
|
170
|
+
The selected date value.
|
|
164
171
|
|
|
172
|
+
Use an ISO date string in `YYYY-MM-DD` format. The value is submitted with the form and is reset to its initial value when the form resets.
|
|
165
173
|
|
|
166
174
|
- Type: `string`
|
|
167
175
|
- Default: `-`
|
|
168
176
|
|
|
169
177
|
#### weekday-format
|
|
170
178
|
|
|
171
|
-
|
|
179
|
+
The weekday format shown above the calendar grid.
|
|
172
180
|
|
|
173
181
|
The syntax is defined by [date-fns/format](https://date-fns.org/v4.1.0/docs/format).
|
|
174
182
|
|