@warp-ds/elements 2.10.0-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 +6 -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/index.d.ts +36 -12
- package/dist/packages/affix/affix.js.map +1 -1
- package/dist/packages/attention/attention.js.map +1 -1
- package/dist/packages/attention/attention.test.js +1 -1
- package/dist/packages/breadcrumbs/breadcrumbs.js.map +1 -1
- package/dist/packages/button/button.js.map +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-header/modal-header.js +2 -0
- package/dist/packages/modal-header/modal-header.js.map +3 -3
- package/dist/packages/page-indicator/page-indicator.js.map +1 -1
- package/dist/packages/pagination/pagination.js.map +1 -1
- package/dist/packages/pagination/pagination.test.js +1 -1
- package/dist/packages/pill/pill.js.map +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 +19 -4
- package/package.json +2 -2
|
@@ -2235,6 +2235,7 @@
|
|
|
2235
2235
|
"text": "boolean"
|
|
2236
2236
|
},
|
|
2237
2237
|
"default": "false",
|
|
2238
|
+
"description": "Whether the card is visually selected.\n\nUse 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.",
|
|
2238
2239
|
"attribute": "selected",
|
|
2239
2240
|
"reflects": true
|
|
2240
2241
|
},
|
|
@@ -2245,6 +2246,7 @@
|
|
|
2245
2246
|
"text": "boolean"
|
|
2246
2247
|
},
|
|
2247
2248
|
"default": "false",
|
|
2249
|
+
"description": "Whether the card uses the flat visual treatment.\n\nFlat cards use a bordered surface instead of the default elevated surface. Use this for denser layouts or when the card sits inside another surface.",
|
|
2248
2250
|
"attribute": "flat"
|
|
2249
2251
|
},
|
|
2250
2252
|
{
|
|
@@ -2254,6 +2256,7 @@
|
|
|
2254
2256
|
"text": "boolean"
|
|
2255
2257
|
},
|
|
2256
2258
|
"default": "false",
|
|
2259
|
+
"description": "Whether the whole card is interactive.\n\nWhen 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.",
|
|
2257
2260
|
"attribute": "clickable"
|
|
2258
2261
|
},
|
|
2259
2262
|
{
|
|
@@ -2283,6 +2286,7 @@
|
|
|
2283
2286
|
"text": "boolean"
|
|
2284
2287
|
},
|
|
2285
2288
|
"default": "false",
|
|
2289
|
+
"description": "Whether the card is visually selected.\n\nUse 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.",
|
|
2286
2290
|
"fieldName": "selected"
|
|
2287
2291
|
},
|
|
2288
2292
|
{
|
|
@@ -2291,6 +2295,7 @@
|
|
|
2291
2295
|
"text": "boolean"
|
|
2292
2296
|
},
|
|
2293
2297
|
"default": "false",
|
|
2298
|
+
"description": "Whether the card uses the flat visual treatment.\n\nFlat cards use a bordered surface instead of the default elevated surface. Use this for denser layouts or when the card sits inside another surface.",
|
|
2294
2299
|
"fieldName": "flat"
|
|
2295
2300
|
},
|
|
2296
2301
|
{
|
|
@@ -2299,6 +2304,7 @@
|
|
|
2299
2304
|
"text": "boolean"
|
|
2300
2305
|
},
|
|
2301
2306
|
"default": "false",
|
|
2307
|
+
"description": "Whether the whole card is interactive.\n\nWhen 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.",
|
|
2302
2308
|
"fieldName": "clickable"
|
|
2303
2309
|
}
|
|
2304
2310
|
],
|
|
@@ -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.
|
package/dist/index.d.ts
CHANGED
|
@@ -723,22 +723,34 @@ Defaults to the localized "You are here" label. Set `aria-label` when the defaul
|
|
|
723
723
|
};
|
|
724
724
|
|
|
725
725
|
export type WarpCardProps = {
|
|
726
|
-
/**
|
|
726
|
+
/** Whether the card is visually selected.
|
|
727
|
+
|
|
728
|
+
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. */
|
|
727
729
|
selected?: WarpCard["selected"];
|
|
728
|
-
/**
|
|
730
|
+
/** Whether the card uses the flat visual treatment.
|
|
731
|
+
|
|
732
|
+
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. */
|
|
729
733
|
flat?: WarpCard["flat"];
|
|
730
|
-
/**
|
|
734
|
+
/** Whether the whole card is interactive.
|
|
735
|
+
|
|
736
|
+
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. */
|
|
731
737
|
clickable?: WarpCard["clickable"];
|
|
732
738
|
/** */
|
|
733
739
|
buttonText?: WarpCard["buttonText"];
|
|
734
740
|
};
|
|
735
741
|
|
|
736
742
|
export type WarpCardSolidJsProps = {
|
|
737
|
-
/**
|
|
743
|
+
/** Whether the card is visually selected.
|
|
744
|
+
|
|
745
|
+
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. */
|
|
738
746
|
"prop:selected"?: WarpCard["selected"];
|
|
739
|
-
/**
|
|
747
|
+
/** Whether the card uses the flat visual treatment.
|
|
748
|
+
|
|
749
|
+
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. */
|
|
740
750
|
"prop:flat"?: WarpCard["flat"];
|
|
741
|
-
/**
|
|
751
|
+
/** Whether the whole card is interactive.
|
|
752
|
+
|
|
753
|
+
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. */
|
|
742
754
|
"prop:clickable"?: WarpCard["clickable"];
|
|
743
755
|
/** */
|
|
744
756
|
"prop:buttonText"?: WarpCard["buttonText"];
|
|
@@ -2219,9 +2231,15 @@ export type CustomElements = {
|
|
|
2219
2231
|
*
|
|
2220
2232
|
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
2221
2233
|
*
|
|
2222
|
-
* - `selected`:
|
|
2223
|
-
*
|
|
2224
|
-
*
|
|
2234
|
+
* - `selected`: Whether the card is visually selected.
|
|
2235
|
+
*
|
|
2236
|
+
* 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.
|
|
2237
|
+
* - `flat`: Whether the card uses the flat visual treatment.
|
|
2238
|
+
*
|
|
2239
|
+
* 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.
|
|
2240
|
+
* - `clickable`: Whether the whole card is interactive.
|
|
2241
|
+
*
|
|
2242
|
+
* 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.
|
|
2225
2243
|
* - `buttonText`: undefined (property only)
|
|
2226
2244
|
*
|
|
2227
2245
|
* ## Methods
|
|
@@ -3197,9 +3215,15 @@ export type CustomElementsSolidJs = {
|
|
|
3197
3215
|
*
|
|
3198
3216
|
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
3199
3217
|
*
|
|
3200
|
-
* - `selected`:
|
|
3201
|
-
*
|
|
3202
|
-
*
|
|
3218
|
+
* - `selected`: Whether the card is visually selected.
|
|
3219
|
+
*
|
|
3220
|
+
* 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.
|
|
3221
|
+
* - `flat`: Whether the card uses the flat visual treatment.
|
|
3222
|
+
*
|
|
3223
|
+
* 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.
|
|
3224
|
+
* - `clickable`: Whether the whole card is interactive.
|
|
3225
|
+
*
|
|
3226
|
+
* 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.
|
|
3203
3227
|
* - `buttonText`: undefined (property only)
|
|
3204
3228
|
*
|
|
3205
3229
|
* ## Methods
|