@warp-ds/elements 2.9.2-next.1 → 2.10.0-next.2
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 +281 -58
- package/dist/docs/button/accessibility.md +42 -0
- package/dist/docs/button/api.md +63 -39
- package/dist/docs/button/button.md +322 -40
- package/dist/docs/button/examples.md +126 -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 +234 -3
- package/dist/docs/card/examples.md +75 -0
- package/dist/docs/card/usage.md +76 -0
- package/dist/docs/modal/accessibility.md +1 -0
- package/dist/docs/modal/api.md +51 -0
- package/dist/docs/modal/examples.md +67 -0
- package/dist/docs/modal/modal.md +238 -0
- package/dist/docs/modal/usage.md +110 -0
- package/dist/docs/modal-footer/accessibility.md +1 -0
- package/dist/docs/modal-footer/api.md +11 -0
- package/dist/docs/modal-footer/examples.md +1 -0
- package/dist/docs/modal-footer/modal-footer.md +23 -0
- package/dist/docs/modal-footer/usage.md +1 -0
- package/dist/docs/modal-header/accessibility.md +1 -0
- package/dist/docs/modal-header/api.md +42 -0
- package/dist/docs/modal-header/examples.md +1 -0
- package/dist/docs/modal-header/modal-header.md +54 -0
- package/dist/docs/modal-header/usage.md +1 -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 +23 -6
- 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 +50 -12
- 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 +43 -28
- package/dist/docs/pill/usage.md +8 -0
- package/dist/index.d.ts +341 -301
- package/dist/packages/affix/affix.js.map +1 -1
- package/dist/packages/attention/attention.js +23 -21
- package/dist/packages/attention/attention.js.map +4 -4
- package/dist/packages/attention/attention.test.js +1 -1
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +1 -1
- package/dist/packages/button/button.d.ts +54 -37
- package/dist/packages/button/button.js +17 -15
- package/dist/packages/button/button.js.map +4 -4
- package/dist/packages/button/button.react.stories.d.ts +2 -2
- package/dist/packages/button/react.d.ts +1 -1
- package/dist/packages/card/card.d.ts +9 -6
- package/dist/packages/card/card.js.map +3 -3
- package/dist/packages/checkbox/checkbox.test.js +1 -1
- package/dist/packages/checkbox-group/checkbox-group.a11y.test.js +1 -1
- package/dist/packages/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/packages/combobox/combobox.js.map +1 -1
- package/dist/packages/datepicker/DatePicker.test.js +1 -1
- package/dist/packages/datepicker/datepicker.js.map +1 -1
- package/dist/packages/datepicker/datepicker.test.js +1 -1
- package/dist/packages/link/link.test.js +1 -1
- package/dist/packages/modal/index.d.ts +4 -4
- package/dist/packages/modal/index.js +4 -4
- package/dist/packages/modal/modal.d.ts +21 -12
- package/dist/packages/modal/modal.js +4 -4
- 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 +3 -1
- 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.js.map +3 -3
- package/dist/packages/pagination/pagination.d.ts +11 -11
- package/dist/packages/pagination/pagination.js.map +3 -3
- package/dist/packages/pagination/pagination.test.js +1 -1
- package/dist/packages/pill/pill.d.ts +14 -29
- package/dist/packages/pill/pill.js.map +3 -3
- 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.test.js +1 -1
- package/dist/packages/radio-group/radio-group.a11y.test.js +1 -1
- package/dist/packages/radio-group/radio-group.js.map +1 -1
- package/dist/packages/select/select.js.map +1 -1
- package/dist/packages/slider/slider.js.map +1 -1
- package/dist/packages/slider/slider.test.js +1 -1
- package/dist/packages/slider-thumb/slider-thumb.js.map +1 -1
- package/dist/packages/step/step.js.map +1 -1
- package/dist/packages/switch/switch.a11y.test.js +1 -1
- package/dist/packages/tabs/tabs.a11y.test.js +1 -1
- package/dist/packages/tabs/tabs.test.js +1 -1
- package/dist/packages/textarea/textarea.js.map +1 -1
- package/dist/packages/textarea/textarea.test.js +1 -1
- package/dist/packages/textfield/textfield.test.js +1 -1
- package/dist/packages/toast/toast.js.map +1 -1
- package/dist/web-types.json +290 -73
- package/package.json +5 -5
|
@@ -1 +1,75 @@
|
|
|
1
1
|
## Accessibility
|
|
2
|
+
|
|
3
|
+
Card is a visual container. It does not create a heading, landmark, list item, link, button, or other semantic structure for the slotted content.
|
|
4
|
+
|
|
5
|
+
### Provide Semantic Content
|
|
6
|
+
|
|
7
|
+
Use semantic HTML inside the card so assistive technologies can understand the content.
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<w-card>
|
|
11
|
+
<article style="padding: 16px;" aria-labelledby="listing-heading">
|
|
12
|
+
<h3 id="listing-heading">Apartment in Oslo</h3>
|
|
13
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
14
|
+
</article>
|
|
15
|
+
</w-card>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Do not rely on the card surface, border, or selected styling to communicate meaning.
|
|
19
|
+
|
|
20
|
+
### Selected State
|
|
21
|
+
|
|
22
|
+
Use `selected` only when the card represents a selected item or choice.
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<w-card selected>
|
|
26
|
+
<div style="padding: 16px;">
|
|
27
|
+
<h3>Standard delivery</h3>
|
|
28
|
+
<p>Delivered in 2-4 business days.</p>
|
|
29
|
+
</div>
|
|
30
|
+
</w-card>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The selected state should also be clear from the surrounding context, such as a group label, heading, or visible text.
|
|
34
|
+
|
|
35
|
+
### Clickable Cards
|
|
36
|
+
|
|
37
|
+
Use `clickable` only when the whole card has one action or represents one selectable choice.
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<w-card clickable>
|
|
41
|
+
<div style="padding: 16px;">
|
|
42
|
+
<h3>Home delivery</h3>
|
|
43
|
+
<p>Delivered to your door.</p>
|
|
44
|
+
</div>
|
|
45
|
+
</w-card>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The visible card content should describe what will be selected or activated. Do not put separate links, buttons, form controls, or other interactive elements inside a clickable card.
|
|
49
|
+
|
|
50
|
+
### Prefer Specific Interactive Elements
|
|
51
|
+
|
|
52
|
+
If only part of the card is interactive, use the appropriate element for that action.
|
|
53
|
+
|
|
54
|
+
Use a link for navigation:
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<w-card>
|
|
58
|
+
<div style="padding: 16px;">
|
|
59
|
+
<h3><a href="/listings/123">Apartment in Oslo</a></h3>
|
|
60
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
61
|
+
</div>
|
|
62
|
+
</w-card>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Use a button for an action on the current page:
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<w-card>
|
|
69
|
+
<div style="padding: 16px;">
|
|
70
|
+
<h3>Apartment in Oslo</h3>
|
|
71
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
72
|
+
<w-button variant="primary">Contact seller</w-button>
|
|
73
|
+
</div>
|
|
74
|
+
</w-card>
|
|
75
|
+
```
|
package/dist/docs/card/api.md
CHANGED
|
@@ -7,9 +7,9 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
7
7
|
| Name | Type | Default | Summary |
|
|
8
8
|
|-|-|-|-|
|
|
9
9
|
| buttonText (JS only) | `unknown` | `-` | - |
|
|
10
|
-
| clickable | `boolean` | `false` |
|
|
11
|
-
| flat | `boolean` | `false` |
|
|
12
|
-
| selected | `boolean` | `false` |
|
|
10
|
+
| clickable | `boolean` | `false` | Whether the whole card is interactive. |
|
|
11
|
+
| flat | `boolean` | `false` | Whether the card uses the flat visual treatment. |
|
|
12
|
+
| selected | `boolean` | `false` | Whether the card is visually selected. |
|
|
13
13
|
|
|
14
14
|
### Property Details
|
|
15
15
|
|
|
@@ -22,21 +22,27 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
22
22
|
|
|
23
23
|
#### clickable
|
|
24
24
|
|
|
25
|
+
Whether the whole card is interactive.
|
|
25
26
|
|
|
27
|
+
When set, the card becomes keyboard focusable and Enter or Space triggers a click on the card. Use this only when the whole card has one action or represents one selectable choice.
|
|
26
28
|
|
|
27
29
|
- Type: `boolean`
|
|
28
30
|
- Default: `false`
|
|
29
31
|
|
|
30
32
|
#### flat
|
|
31
33
|
|
|
34
|
+
Whether the card uses the flat visual treatment.
|
|
32
35
|
|
|
36
|
+
Flat cards use a bordered surface instead of the default elevated surface. Use this for denser layouts or when the card sits inside another surface.
|
|
33
37
|
|
|
34
38
|
- Type: `boolean`
|
|
35
39
|
- Default: `false`
|
|
36
40
|
|
|
37
41
|
#### selected
|
|
38
42
|
|
|
43
|
+
Whether the card is visually selected.
|
|
39
44
|
|
|
45
|
+
Use this when the card represents a selected item or choice. This only controls the visual selected state; update it from your application state when the selection changes.
|
|
40
46
|
|
|
41
47
|
- Type: `boolean`
|
|
42
48
|
- Default: `false`
|
package/dist/docs/card/card.md
CHANGED
|
@@ -8,10 +8,235 @@ Card is a layout component used for separating content areas on a page.
|
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
|
+
Card is a layout component for visually grouping related content as one item.
|
|
12
|
+
|
|
13
|
+
Use `w-card` for listings, summaries, recommendations, or selectable choices where the grouped content should feel like a single object. The component does not add padding, headings, spacing between children, or semantic structure. Those must be provided by the content inside the card.
|
|
14
|
+
|
|
15
|
+
### Basic Card
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<w-card>
|
|
19
|
+
<div style="padding: 16px;">
|
|
20
|
+
<h3>Apartment in Oslo</h3>
|
|
21
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
22
|
+
</div>
|
|
23
|
+
</w-card>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Visual Treatments
|
|
27
|
+
|
|
28
|
+
The default card uses an elevated surface. Use `flat` when the card should sit more quietly in the layout.
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<w-card>
|
|
32
|
+
<div style="padding: 16px;">
|
|
33
|
+
<h3>Elevated card</h3>
|
|
34
|
+
<p>Use this for cards that need more visual separation.</p>
|
|
35
|
+
</div>
|
|
36
|
+
</w-card>
|
|
37
|
+
|
|
38
|
+
<w-card flat>
|
|
39
|
+
<div style="padding: 16px;">
|
|
40
|
+
<h3>Flat card</h3>
|
|
41
|
+
<p>Use this for dense layouts or cards inside another surface.</p>
|
|
42
|
+
</div>
|
|
43
|
+
</w-card>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Selected Cards
|
|
47
|
+
|
|
48
|
+
Use `selected` when a card represents a selected item or choice.
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<w-card selected>
|
|
52
|
+
<div style="padding: 16px;">
|
|
53
|
+
<h3>Standard delivery</h3>
|
|
54
|
+
<p>Delivered in 2-4 business days.</p>
|
|
55
|
+
</div>
|
|
56
|
+
</w-card>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The `selected` property only controls the card's visual state. Update it from your application state when the selection changes.
|
|
60
|
+
|
|
61
|
+
### Clickable Cards
|
|
62
|
+
|
|
63
|
+
Use `clickable` when the whole card should behave as one interactive choice. The card becomes keyboard focusable, and Enter or Space triggers a click on the card.
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<w-card clickable>
|
|
67
|
+
<div style="padding: 16px;">
|
|
68
|
+
<h3>Pick up nearby</h3>
|
|
69
|
+
<p>Collect the item from a pickup point.</p>
|
|
70
|
+
</div>
|
|
71
|
+
</w-card>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Listen for the card's click event and update `selected` yourself.
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<w-card clickable selected>
|
|
78
|
+
<div style="padding: 16px;">
|
|
79
|
+
<h3>Home delivery</h3>
|
|
80
|
+
<p>Delivered to your door.</p>
|
|
81
|
+
</div>
|
|
82
|
+
</w-card>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Do not use `clickable` when the card contains separate links, buttons, form controls, or other interactive elements. In those cases, keep the card non-clickable and make the specific control interactive instead.
|
|
86
|
+
|
|
11
87
|
## Accessibility
|
|
12
88
|
|
|
89
|
+
Card is a visual container. It does not create a heading, landmark, list item, link, button, or other semantic structure for the slotted content.
|
|
90
|
+
|
|
91
|
+
### Provide Semantic Content
|
|
92
|
+
|
|
93
|
+
Use semantic HTML inside the card so assistive technologies can understand the content.
|
|
94
|
+
|
|
95
|
+
```html
|
|
96
|
+
<w-card>
|
|
97
|
+
<article style="padding: 16px;" aria-labelledby="listing-heading">
|
|
98
|
+
<h3 id="listing-heading">Apartment in Oslo</h3>
|
|
99
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
100
|
+
</article>
|
|
101
|
+
</w-card>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Do not rely on the card surface, border, or selected styling to communicate meaning.
|
|
105
|
+
|
|
106
|
+
### Selected State
|
|
107
|
+
|
|
108
|
+
Use `selected` only when the card represents a selected item or choice.
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<w-card selected>
|
|
112
|
+
<div style="padding: 16px;">
|
|
113
|
+
<h3>Standard delivery</h3>
|
|
114
|
+
<p>Delivered in 2-4 business days.</p>
|
|
115
|
+
</div>
|
|
116
|
+
</w-card>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The selected state should also be clear from the surrounding context, such as a group label, heading, or visible text.
|
|
120
|
+
|
|
121
|
+
### Clickable Cards
|
|
122
|
+
|
|
123
|
+
Use `clickable` only when the whole card has one action or represents one selectable choice.
|
|
124
|
+
|
|
125
|
+
```html
|
|
126
|
+
<w-card clickable>
|
|
127
|
+
<div style="padding: 16px;">
|
|
128
|
+
<h3>Home delivery</h3>
|
|
129
|
+
<p>Delivered to your door.</p>
|
|
130
|
+
</div>
|
|
131
|
+
</w-card>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The visible card content should describe what will be selected or activated. Do not put separate links, buttons, form controls, or other interactive elements inside a clickable card.
|
|
135
|
+
|
|
136
|
+
### Prefer Specific Interactive Elements
|
|
137
|
+
|
|
138
|
+
If only part of the card is interactive, use the appropriate element for that action.
|
|
139
|
+
|
|
140
|
+
Use a link for navigation:
|
|
141
|
+
|
|
142
|
+
```html
|
|
143
|
+
<w-card>
|
|
144
|
+
<div style="padding: 16px;">
|
|
145
|
+
<h3><a href="/listings/123">Apartment in Oslo</a></h3>
|
|
146
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
147
|
+
</div>
|
|
148
|
+
</w-card>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Use a button for an action on the current page:
|
|
152
|
+
|
|
153
|
+
```html
|
|
154
|
+
<w-card>
|
|
155
|
+
<div style="padding: 16px;">
|
|
156
|
+
<h3>Apartment in Oslo</h3>
|
|
157
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
158
|
+
<w-button variant="primary">Contact seller</w-button>
|
|
159
|
+
</div>
|
|
160
|
+
</w-card>
|
|
161
|
+
```
|
|
162
|
+
|
|
13
163
|
## Examples
|
|
14
164
|
|
|
165
|
+
### Basic
|
|
166
|
+
|
|
167
|
+
<elements-example>
|
|
168
|
+
|
|
169
|
+
```html
|
|
170
|
+
<w-card>
|
|
171
|
+
<div style="padding: 16px;">
|
|
172
|
+
<h3>Apartment in Oslo</h3>
|
|
173
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
174
|
+
</div>
|
|
175
|
+
</w-card>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
</elements-example>
|
|
179
|
+
|
|
180
|
+
### Flat
|
|
181
|
+
|
|
182
|
+
<elements-example>
|
|
183
|
+
|
|
184
|
+
```html
|
|
185
|
+
<w-card flat>
|
|
186
|
+
<div style="padding: 16px;">
|
|
187
|
+
<h3>Order summary</h3>
|
|
188
|
+
<p>Review the item price, delivery, and total before continuing.</p>
|
|
189
|
+
</div>
|
|
190
|
+
</w-card>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
</elements-example>
|
|
194
|
+
|
|
195
|
+
### Selected
|
|
196
|
+
|
|
197
|
+
<elements-example>
|
|
198
|
+
|
|
199
|
+
```html
|
|
200
|
+
<w-card selected>
|
|
201
|
+
<div style="padding: 16px;">
|
|
202
|
+
<h3>Standard delivery</h3>
|
|
203
|
+
<p>Delivered in 2-4 business days.</p>
|
|
204
|
+
</div>
|
|
205
|
+
</w-card>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
</elements-example>
|
|
209
|
+
|
|
210
|
+
### Flat Selected
|
|
211
|
+
|
|
212
|
+
<elements-example>
|
|
213
|
+
|
|
214
|
+
```html
|
|
215
|
+
<w-card flat selected>
|
|
216
|
+
<div style="padding: 16px;">
|
|
217
|
+
<h3>Pickup point</h3>
|
|
218
|
+
<p>Collect the item from a nearby pickup point.</p>
|
|
219
|
+
</div>
|
|
220
|
+
</w-card>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
</elements-example>
|
|
224
|
+
|
|
225
|
+
### Clickable
|
|
226
|
+
|
|
227
|
+
<elements-example>
|
|
228
|
+
|
|
229
|
+
```html
|
|
230
|
+
<w-card clickable>
|
|
231
|
+
<div style="padding: 16px;">
|
|
232
|
+
<h3>Home delivery</h3>
|
|
233
|
+
<p>Delivered to your door.</p>
|
|
234
|
+
</div>
|
|
235
|
+
</w-card>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
</elements-example>
|
|
239
|
+
|
|
15
240
|
## `<w-card>` API
|
|
16
241
|
|
|
17
242
|
Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
|
|
@@ -21,9 +246,9 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
21
246
|
| Name | Type | Default | Summary |
|
|
22
247
|
|-|-|-|-|
|
|
23
248
|
| buttonText (JS only) | `unknown` | `-` | - |
|
|
24
|
-
| clickable | `boolean` | `false` |
|
|
25
|
-
| flat | `boolean` | `false` |
|
|
26
|
-
| selected | `boolean` | `false` |
|
|
249
|
+
| clickable | `boolean` | `false` | Whether the whole card is interactive. |
|
|
250
|
+
| flat | `boolean` | `false` | Whether the card uses the flat visual treatment. |
|
|
251
|
+
| selected | `boolean` | `false` | Whether the card is visually selected. |
|
|
27
252
|
|
|
28
253
|
### Property Details
|
|
29
254
|
|
|
@@ -36,21 +261,27 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
36
261
|
|
|
37
262
|
#### clickable
|
|
38
263
|
|
|
264
|
+
Whether the whole card is interactive.
|
|
39
265
|
|
|
266
|
+
When set, the card becomes keyboard focusable and Enter or Space triggers a click on the card. Use this only when the whole card has one action or represents one selectable choice.
|
|
40
267
|
|
|
41
268
|
- Type: `boolean`
|
|
42
269
|
- Default: `false`
|
|
43
270
|
|
|
44
271
|
#### flat
|
|
45
272
|
|
|
273
|
+
Whether the card uses the flat visual treatment.
|
|
46
274
|
|
|
275
|
+
Flat cards use a bordered surface instead of the default elevated surface. Use this for denser layouts or when the card sits inside another surface.
|
|
47
276
|
|
|
48
277
|
- Type: `boolean`
|
|
49
278
|
- Default: `false`
|
|
50
279
|
|
|
51
280
|
#### selected
|
|
52
281
|
|
|
282
|
+
Whether the card is visually selected.
|
|
53
283
|
|
|
284
|
+
Use this when the card represents a selected item or choice. This only controls the visual selected state; update it from your application state when the selection changes.
|
|
54
285
|
|
|
55
286
|
- Type: `boolean`
|
|
56
287
|
- Default: `false`
|
|
@@ -1 +1,76 @@
|
|
|
1
1
|
## Examples
|
|
2
|
+
|
|
3
|
+
### Basic
|
|
4
|
+
|
|
5
|
+
<elements-example>
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<w-card>
|
|
9
|
+
<div style="padding: 16px;">
|
|
10
|
+
<h3>Apartment in Oslo</h3>
|
|
11
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
12
|
+
</div>
|
|
13
|
+
</w-card>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
</elements-example>
|
|
17
|
+
|
|
18
|
+
### Flat
|
|
19
|
+
|
|
20
|
+
<elements-example>
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<w-card flat>
|
|
24
|
+
<div style="padding: 16px;">
|
|
25
|
+
<h3>Order summary</h3>
|
|
26
|
+
<p>Review the item price, delivery, and total before continuing.</p>
|
|
27
|
+
</div>
|
|
28
|
+
</w-card>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
</elements-example>
|
|
32
|
+
|
|
33
|
+
### Selected
|
|
34
|
+
|
|
35
|
+
<elements-example>
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<w-card selected>
|
|
39
|
+
<div style="padding: 16px;">
|
|
40
|
+
<h3>Standard delivery</h3>
|
|
41
|
+
<p>Delivered in 2-4 business days.</p>
|
|
42
|
+
</div>
|
|
43
|
+
</w-card>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
</elements-example>
|
|
47
|
+
|
|
48
|
+
### Flat Selected
|
|
49
|
+
|
|
50
|
+
<elements-example>
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<w-card flat selected>
|
|
54
|
+
<div style="padding: 16px;">
|
|
55
|
+
<h3>Pickup point</h3>
|
|
56
|
+
<p>Collect the item from a nearby pickup point.</p>
|
|
57
|
+
</div>
|
|
58
|
+
</w-card>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
</elements-example>
|
|
62
|
+
|
|
63
|
+
### Clickable
|
|
64
|
+
|
|
65
|
+
<elements-example>
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<w-card clickable>
|
|
69
|
+
<div style="padding: 16px;">
|
|
70
|
+
<h3>Home delivery</h3>
|
|
71
|
+
<p>Delivered to your door.</p>
|
|
72
|
+
</div>
|
|
73
|
+
</w-card>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
</elements-example>
|
package/dist/docs/card/usage.md
CHANGED
|
@@ -1 +1,77 @@
|
|
|
1
1
|
## Usage
|
|
2
|
+
|
|
3
|
+
Card is a layout component for visually grouping related content as one item.
|
|
4
|
+
|
|
5
|
+
Use `w-card` for listings, summaries, recommendations, or selectable choices where the grouped content should feel like a single object. The component does not add padding, headings, spacing between children, or semantic structure. Those must be provided by the content inside the card.
|
|
6
|
+
|
|
7
|
+
### Basic Card
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<w-card>
|
|
11
|
+
<div style="padding: 16px;">
|
|
12
|
+
<h3>Apartment in Oslo</h3>
|
|
13
|
+
<p>Bright 3-room apartment with balcony.</p>
|
|
14
|
+
</div>
|
|
15
|
+
</w-card>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Visual Treatments
|
|
19
|
+
|
|
20
|
+
The default card uses an elevated surface. Use `flat` when the card should sit more quietly in the layout.
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<w-card>
|
|
24
|
+
<div style="padding: 16px;">
|
|
25
|
+
<h3>Elevated card</h3>
|
|
26
|
+
<p>Use this for cards that need more visual separation.</p>
|
|
27
|
+
</div>
|
|
28
|
+
</w-card>
|
|
29
|
+
|
|
30
|
+
<w-card flat>
|
|
31
|
+
<div style="padding: 16px;">
|
|
32
|
+
<h3>Flat card</h3>
|
|
33
|
+
<p>Use this for dense layouts or cards inside another surface.</p>
|
|
34
|
+
</div>
|
|
35
|
+
</w-card>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Selected Cards
|
|
39
|
+
|
|
40
|
+
Use `selected` when a card represents a selected item or choice.
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<w-card selected>
|
|
44
|
+
<div style="padding: 16px;">
|
|
45
|
+
<h3>Standard delivery</h3>
|
|
46
|
+
<p>Delivered in 2-4 business days.</p>
|
|
47
|
+
</div>
|
|
48
|
+
</w-card>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The `selected` property only controls the card's visual state. Update it from your application state when the selection changes.
|
|
52
|
+
|
|
53
|
+
### Clickable Cards
|
|
54
|
+
|
|
55
|
+
Use `clickable` when the whole card should behave as one interactive choice. The card becomes keyboard focusable, and Enter or Space triggers a click on the card.
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<w-card clickable>
|
|
59
|
+
<div style="padding: 16px;">
|
|
60
|
+
<h3>Pick up nearby</h3>
|
|
61
|
+
<p>Collect the item from a pickup point.</p>
|
|
62
|
+
</div>
|
|
63
|
+
</w-card>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Listen for the card's click event and update `selected` yourself.
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<w-card clickable selected>
|
|
70
|
+
<div style="padding: 16px;">
|
|
71
|
+
<h3>Home delivery</h3>
|
|
72
|
+
<p>Delivered to your door.</p>
|
|
73
|
+
</div>
|
|
74
|
+
</w-card>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Do not use `clickable` when the card contains separate links, buttons, form controls, or other interactive elements. In those cases, keep the card non-clickable and make the specific control interactive instead.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## Accessibility
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
## `<w-modal>` 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
|
+
| content-id | `string` | `-` | - |
|
|
10
|
+
| ignore-backdrop-clicks | `boolean` | `false` | Ignores clicks to the backdrop when set |
|
|
11
|
+
| show | `boolean` | `false` | Controls if the modal should show or hide. |
|
|
12
|
+
|
|
13
|
+
### Property Details
|
|
14
|
+
|
|
15
|
+
#### content-id
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
- Type: `string`
|
|
20
|
+
- Default: `-`
|
|
21
|
+
|
|
22
|
+
#### ignore-backdrop-clicks
|
|
23
|
+
|
|
24
|
+
Ignores clicks to the backdrop when set
|
|
25
|
+
|
|
26
|
+
- Type: `boolean`
|
|
27
|
+
- Default: `false`
|
|
28
|
+
|
|
29
|
+
#### show
|
|
30
|
+
|
|
31
|
+
Controls if the modal should show or hide.
|
|
32
|
+
|
|
33
|
+
You can also call the `open()` and `close()` methods.
|
|
34
|
+
|
|
35
|
+
- Type: `boolean`
|
|
36
|
+
- Default: `false`
|
|
37
|
+
|
|
38
|
+
### Events
|
|
39
|
+
|
|
40
|
+
#### hidden
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
- Type: `CustomEvent`
|
|
45
|
+
#### shown
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
- Type: `CustomEvent`
|
|
50
|
+
|
|
51
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
## Examples
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### With a titlebar
|
|
6
|
+
|
|
7
|
+
<elements-example>
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<div>
|
|
11
|
+
<w-button aria-haspopup='dialog'>
|
|
12
|
+
Open a modal
|
|
13
|
+
</w-button>
|
|
14
|
+
<w-modal>
|
|
15
|
+
<w-modal-header
|
|
16
|
+
slot='header'
|
|
17
|
+
title='An example modal'
|
|
18
|
+
></w-modal-header>
|
|
19
|
+
<div slot='content'>
|
|
20
|
+
<w-button variant='utility' small>
|
|
21
|
+
Toggle back button
|
|
22
|
+
</w-button>
|
|
23
|
+
<p>
|
|
24
|
+
I bomb atomically, Socrates' philosophies and hypotheses...
|
|
25
|
+
</p>
|
|
26
|
+
<p>
|
|
27
|
+
First I'm gonna getcha, once I gotcha, I gat-cha...
|
|
28
|
+
</p>
|
|
29
|
+
</div>
|
|
30
|
+
<w-modal-footer slot='footer'>
|
|
31
|
+
<w-button variant='primary'>
|
|
32
|
+
OK
|
|
33
|
+
</w-button>
|
|
34
|
+
</w-modal-footer>
|
|
35
|
+
</w-modal>
|
|
36
|
+
</div>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
</elements-example>
|
|
40
|
+
|
|
41
|
+
### With an image at the top
|
|
42
|
+
|
|
43
|
+
<elements-example>
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<w-button aria-haspopup="dialog" commandfor="my-modal" command="show-modal">
|
|
47
|
+
Open a modal
|
|
48
|
+
</w-button>
|
|
49
|
+
<w-modal id="my-modal">
|
|
50
|
+
<w-modal-header slot="header" title="Look a doggo!">
|
|
51
|
+
<img
|
|
52
|
+
slot="top"
|
|
53
|
+
class="h-[256] w-full object-cover"
|
|
54
|
+
src="/pages/public/unocssmusical.jpeg"
|
|
55
|
+
alt="AI-generated picture of a band in colourful setup"
|
|
56
|
+
>
|
|
57
|
+
</w-modal-header>
|
|
58
|
+
<div slot="content">
|
|
59
|
+
<p>I bomb atomically, Socrates' philosophies and hypotheses...</p>
|
|
60
|
+
</div>
|
|
61
|
+
<w-modal-footer slot="footer">
|
|
62
|
+
<w-button variant="primary" id="modal-close-button-two">OK</w-button>
|
|
63
|
+
</w-modal-footer>
|
|
64
|
+
</w-modal>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
</elements-example>
|