@warp-ds/elements 2.9.0-next.6 → 2.9.1-next.1

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.
Files changed (40) hide show
  1. package/dist/custom-elements.json +80 -21
  2. package/dist/docs/affix/affix.md +24 -38
  3. package/dist/docs/affix/examples.md +24 -38
  4. package/dist/docs/alert/accessibility.md +4 -9
  5. package/dist/docs/alert/alert.md +24 -39
  6. package/dist/docs/alert/examples.md +20 -30
  7. package/dist/docs/attention/accessibility.md +50 -0
  8. package/dist/docs/attention/api.md +40 -27
  9. package/dist/docs/attention/attention.md +276 -27
  10. package/dist/docs/attention/examples.md +91 -0
  11. package/dist/docs/attention/usage.md +91 -0
  12. package/dist/docs/badge/badge.md +23 -36
  13. package/dist/docs/badge/examples.md +23 -36
  14. package/dist/docs/box/accessibility.md +29 -0
  15. package/dist/docs/box/api.md +16 -11
  16. package/dist/docs/box/box.md +189 -11
  17. package/dist/docs/box/examples.md +98 -0
  18. package/dist/docs/box/usage.md +47 -0
  19. package/dist/docs/textarea/accessibility.md +5 -0
  20. package/dist/docs/textarea/api.md +32 -47
  21. package/dist/docs/textarea/examples.md +81 -0
  22. package/dist/docs/textarea/textarea.md +133 -49
  23. package/dist/docs/textarea/usage.md +9 -0
  24. package/dist/docs/textfield/examples.md +32 -49
  25. package/dist/docs/textfield/textfield.md +39 -60
  26. package/dist/docs/textfield/usage.md +7 -11
  27. package/dist/index.d.ts +276 -154
  28. package/dist/packages/attention/attention.d.ts +46 -37
  29. package/dist/packages/attention/attention.js +20 -20
  30. package/dist/packages/attention/attention.js.map +3 -3
  31. package/dist/packages/box/box.d.ts +15 -14
  32. package/dist/packages/box/box.js +6 -6
  33. package/dist/packages/box/box.js.map +4 -4
  34. package/dist/packages/box/box.react.stories.d.ts +1 -1
  35. package/dist/packages/box/box.stories.d.ts +1 -0
  36. package/dist/packages/box/box.stories.js +12 -5
  37. package/dist/packages/textarea/textarea.d.ts +38 -29
  38. package/dist/packages/textarea/textarea.js.map +2 -2
  39. package/dist/web-types.json +216 -44
  40. package/package.json +1 -2
@@ -2,26 +2,17 @@
2
2
 
3
3
  ### Basic
4
4
 
5
- <style-isolate>
6
- <w-badge>New</w-badge>
7
- </style-isolate>
8
-
5
+ <elements-example>
6
+
9
7
  ```html
10
8
  <w-badge>New</w-badge>
11
9
  ```
12
10
 
11
+ </elements-example>
12
+
13
13
  ### Status Variants
14
14
 
15
- <style-isolate>
16
- <div style="display: flex; flex-wrap: wrap; gap: 8px; align-items: center;">
17
- <w-badge variant="neutral">Neutral</w-badge>
18
- <w-badge variant="info">Info</w-badge>
19
- <w-badge variant="positive">Approved</w-badge>
20
- <w-badge variant="warning">Pending</w-badge>
21
- <w-badge variant="negative">Rejected</w-badge>
22
- <w-badge variant="disabled">Unavailable</w-badge>
23
- </div>
24
- </style-isolate>
15
+ <elements-example>
25
16
 
26
17
  ```html
27
18
  <w-badge variant="neutral">Neutral</w-badge>
@@ -32,52 +23,48 @@
32
23
  <w-badge variant="disabled">Unavailable</w-badge>
33
24
  ```
34
25
 
35
- ### Price
26
+ </elements-example>
36
27
 
37
- <style-isolate>
38
- <w-badge variant="price">1 200 kr</w-badge>
39
- </style-isolate>
28
+ ### Price
40
29
 
30
+ <elements-example>
31
+
41
32
  ```html
42
33
  <w-badge variant="price">1 200 kr</w-badge>
43
34
  ```
44
35
 
45
- ### Sponsored
36
+ </elements-example>
46
37
 
47
- <style-isolate>
48
- <w-badge variant="sponsored">Sponsored</w-badge>
49
- </style-isolate>
38
+ ### Sponsored
50
39
 
40
+ <elements-example>
41
+
51
42
  ```html
52
43
  <w-badge variant="sponsored">Sponsored</w-badge>
53
44
  ```
54
45
 
46
+ </elements-example>
47
+
55
48
  ### Positioned
56
49
 
57
- <style-isolate>
58
- <div style="position: relative; width: 220px; height: 124px; border-radius: 8px; overflow: hidden; background: #e5e7eb;">
59
- <w-badge variant="price" position="top-right">1 200 kr</w-badge>
60
- </div>
61
- </style-isolate>
50
+ <elements-example>
62
51
 
63
52
  ```html
64
- <div style="position: relative;">
65
- <img src="listing.jpg" alt="Living room with large windows" />
53
+ <div style="position: relative; width: 220px; height: 124px; border-radius: 8px; overflow: hidden; background: #e5e7eb;">
66
54
  <w-badge variant="price" position="top-right">1 200 kr</w-badge>
67
55
  </div>
68
56
  ```
69
57
 
58
+ </elements-example>
59
+
70
60
  ### Positioned Sponsored Badge
71
61
 
72
- <style-isolate>
73
- <div style="position: relative; width: 220px; height: 124px; border-radius: 8px; overflow: hidden; background: #e5e7eb;">
74
- <w-badge variant="sponsored" position="bottom-left">Sponsored</w-badge>
75
- </div>
76
- </style-isolate>
62
+ <elements-example>
77
63
 
78
64
  ```html
79
- <div style="position: relative;">
80
- <img src="listing.jpg" alt="Living room with large windows" />
65
+ <div style="position: relative; width: 220px; height: 124px; border-radius: 8px; overflow: hidden; background: #e5e7eb;">
81
66
  <w-badge variant="sponsored" position="bottom-left">Sponsored</w-badge>
82
67
  </div>
83
68
  ```
69
+
70
+ </elements-example>
@@ -1 +1,30 @@
1
1
  ## Accessibility
2
+
3
+ Box wraps its slotted content in a section tag by default which is equivalant to role="region" for the purposes of screen readers.
4
+
5
+ ### Do Not Rely On Visual Treatment Alone
6
+
7
+ The `info`, `neutral`, `bordered`, and `bleed` properties are visual only. They do not change the meaning of the content for assistive technologies.
8
+
9
+ Always use headings, text, and semantic HTML inside the box to communicate structure and purpose.
10
+
11
+ ### Landmark Behaviour For Meaningful Sections
12
+
13
+ By default, w-box behaves as a landmark for screen readers. This means it represents a section of the page that users may want to navigate to directly.
14
+
15
+ We strongly suggest you provide a heading and an accessible landmark name to ensure that screen readers properly treat it as a landmark.
16
+
17
+ ```html
18
+   <w-box aria-labelledby="delivery-heading">
19
+     <h2 id="delivery-heading">Delivery</h2>
20
+     <p>Choose how you want the item delivered.</p>
21
+   </w-box>
22
+ ```
23
+
24
+ If you must use box for a purely visual grouping, set role none:
25
+
26
+ ```html
27
+ <w-box role="none">
28
+   <p>This box is only a visual container.</p>
29
+ </w-box>
30
+ ```
@@ -4,48 +4,53 @@
4
4
 
5
5
  | Name | Type | Default | Summary |
6
6
  |-|-|-|-|
7
- | bleed | `boolean` | `false` | - |
8
- | bordered | `boolean` | `false` | - |
9
- | info | `boolean` | `false` | - |
10
- | neutral | `boolean` | `false` | - |
11
- | role | `string` | `-` | - |
7
+ | bleed | `boolean` | `false` | Makes the box bleed to the container edge. |
8
+ | bordered | `boolean` | `false` | Shows the box as a bordered surface. |
9
+ | info | `boolean` | `false` | Shows the box with information styling. |
10
+ | neutral | `boolean` | `false` | Shows the box with neutral styling. |
11
+ | role | `string` | `'region'` | ARIA role for the box wrapper. |
12
12
 
13
13
  ### Property Details
14
14
 
15
15
  #### bleed
16
16
 
17
-
17
+ Makes the box bleed to the container edge.
18
+ Extends the box into the horizontal gutter on narrow screens. Adds negative horizontal margins and square side corners below the small breakpoint, then restores the normal margins and rounded corners from the small breakpoint and up.
18
19
 
19
20
  - Type: `boolean`
20
21
  - Default: `false`
21
22
 
22
23
  #### bordered
23
24
 
24
-
25
+ Shows the box as a bordered surface.
26
+ Use this when the content needs a clear visual boundary from the surrounding page.
25
27
 
26
28
  - Type: `boolean`
27
29
  - Default: `false`
28
30
 
29
31
  #### info
30
32
 
31
-
33
+ Shows the box with information styling.
34
+ Use this for supporting informational content that should be visually separated from the surrounding page.
32
35
 
33
36
  - Type: `boolean`
34
37
  - Default: `false`
35
38
 
36
39
  #### neutral
37
40
 
38
-
41
+ Shows the box with neutral styling.
42
+ Use this for quiet grouped content that needs a background without strong emphasis.
39
43
 
40
44
  - Type: `boolean`
41
45
  - Default: `false`
42
46
 
43
47
  #### role
44
48
 
45
-
49
+ ARIA role for the box wrapper.
50
+ Defaults to a role of `region`. Set `role="none"` to override this behaviour for purely visual grouping, or set a specific role when the box has a clearer semantic purpose.
46
51
 
47
52
  - Type: `string`
48
- - Default: `-`
53
+ - Default: `'region'`
49
54
 
50
55
  ### Types
51
56
 
@@ -8,58 +8,236 @@ Box is a layout component used for separating content areas on a page.
8
8
 
9
9
  ## Usage
10
10
 
11
+ Box is a layout component for visually separating a section of content from the surrounding page.
12
+
13
+ Use `w-box` for grouped content that needs padding, a background, or a border. The component does not add heading structure, spacing between children, or interactive behavior. Those you must provide yourself.
14
+
15
+ ### Basic Box
16
+
17
+ ```html
18
+ <w-box aria-labelledby="delivery-heading">
19
+ <h2 id="deliver-heading">Delivery</h2>
20
+ <p>Choose how you want the item delivered.</p>
21
+ </w-box>
22
+ ```
23
+
24
+ ### Visual Treatments
25
+
26
+ Use one visual treatment at a time:
27
+
28
+ - `neutral`: a quiet sunken surface for grouped content
29
+ - `info`: a subtle information background
30
+ - `bordered`: a bordered surface with the default background
31
+
32
+ ```html
33
+ <w-box neutral role="none">
34
+ <p>Neutral content area</p>
35
+ </w-box>
36
+
37
+ <w-box info role="none">
38
+ <p>Informational content area</p>
39
+ </w-box>
40
+
41
+ <w-box bordered role="none">
42
+ <p>Bordered content area</p>
43
+ </w-box>
44
+ ```
45
+
46
+ ### Bleed
47
+
48
+ Use `bleed` when a box sits inside a page gutter but should extend to the container edge on narrow screens. `bleed` is commonly combined with a visual treatment such as `neutral` or `info`.
49
+
50
+ ```html
51
+ <w-box neutral bleed aria-labelledby="summary-heading">
52
+ <h2 id="summary-heading">Summary</h2>
53
+ <p>This box extends into the horizontal gutter on narrow screens.</p>
54
+ </w-box>
55
+ ```
56
+
11
57
  ## Accessibility
12
58
 
59
+ Box wraps its slotted content in a section tag by default which is equivalant to role="region" for the purposes of screen readers.
60
+
61
+ ### Do Not Rely On Visual Treatment Alone
62
+
63
+ The `info`, `neutral`, `bordered`, and `bleed` properties are visual only. They do not change the meaning of the content for assistive technologies.
64
+
65
+ Always use headings, text, and semantic HTML inside the box to communicate structure and purpose.
66
+
67
+ ### Landmark Behaviour For Meaningful Sections
68
+
69
+ By default, w-box behaves as a landmark for screen readers. This means it represents a section of the page that users may want to navigate to directly.
70
+
71
+ We strongly suggest you provide a heading and an accessible landmark name to ensure that screen readers properly treat it as a landmark.
72
+
73
+ ```html
74
+   <w-box aria-labelledby="delivery-heading">
75
+     <h2 id="delivery-heading">Delivery</h2>
76
+     <p>Choose how you want the item delivered.</p>
77
+   </w-box>
78
+ ```
79
+
80
+ If you must use box for a purely visual grouping, set role none:
81
+
82
+ ```html
83
+ <w-box role="none">
84
+   <p>This box is only a visual container.</p>
85
+ </w-box>
86
+ ```
87
+
13
88
  ## Examples
14
89
 
90
+ ### Basic
91
+
92
+ <style-isolate>
93
+ <w-box aria-labelledby="delivery-heading">
94
+ <h2 id="delivery-heading">Delivery</h2>
95
+ <p>Choose how you want the item delivered.</p>
96
+ </w-box>
97
+ </style-isolate>
98
+
99
+ ```html
100
+ <w-box aria-labelledby="delivery-heading">
101
+ <h2 id="delivery-heading">Delivery</h2>
102
+ <p>Choose how you want the item delivered.</p>
103
+ </w-box>
104
+ ```
105
+
106
+ ### Neutral
107
+
108
+ <style-isolate>
109
+ <w-box neutral aria-labelledby="order-summary-heading">
110
+ <h2 id="order-summary-heading">Order summary</h2>
111
+ <p>Review the item price, delivery, and total before continuing.</p>
112
+ </w-box>
113
+ </style-isolate>
114
+
115
+ ```html
116
+ <w-box neutral aria-labelledby="order-summary-heading">
117
+ <h2 id="order-summary-heading">Order summary</h2>
118
+ <p>Review the item price, delivery, and total before continuing.</p>
119
+ </w-box>
120
+ ```
121
+
122
+ ### Info
123
+
124
+ <style-isolate>
125
+ <w-box info aria-labelledby="good-to-know-heading">
126
+ <h2 id="good-to-know-heading">Good to know</h2>
127
+ <p>You can change the delivery method before payment.</p>
128
+ </w-box>
129
+ </style-isolate>
130
+
131
+ ```html
132
+ <w-box info aria-labelledby="good-to-know-heading">
133
+ <h2 id="good-to-know-heading">Good to know</h2>
134
+ <p>You can change the delivery method before payment.</p>
135
+ </w-box>
136
+ ```
137
+
138
+ ### Bordered
139
+
140
+ <style-isolate>
141
+ <w-box bordered aria-labelledby="contact-seller-heading">
142
+ <h2 id="contact-seller-heading">Contact seller</h2>
143
+ <p>Send a message to ask about pickup times.</p>
144
+ </w-box>
145
+ </style-isolate>
146
+
147
+ ```html
148
+ <w-box bordered aria-labelledby="contact-seller-heading">
149
+ <h2 id="contact-seller-heading">Contact seller</h2>
150
+ <p>Send a message to ask about pickup times.</p>
151
+ </w-box>
152
+ ```
153
+
154
+ ### Bleed
155
+
156
+ <style-isolate>
157
+ <div style="padding: 0 16px;">
158
+ <w-box neutral bleed aria-labelledby="summary-heading">
159
+ <h2 id="summary-heading">Summary</h2>
160
+ <p>This box extends into the horizontal gutter on narrow screens.</p>
161
+ </w-box>
162
+ </div>
163
+ </style-isolate>
164
+
165
+ ```html
166
+ <div style="padding: 0 16px;">
167
+ <w-box neutral bleed aria-labelledby="summary-heading">
168
+ <h2 id="summary-heading">Summary</h2>
169
+ <p>This box extends into the horizontal gutter on narrow screens.</p>
170
+ </w-box>
171
+ </div>
172
+ ```
173
+
174
+ ### Visual Grouping Without Accessibility Landmarking
175
+
176
+ <style-isolate>
177
+ <w-box role="none">
178
+ <p>This box is only a visual container.</p>
179
+ </w-box>
180
+ </style-isolate>
181
+
182
+ ```html
183
+ <w-box role="none">
184
+ <p>This box is only a visual container.</p>
185
+ </w-box>
186
+ ```
187
+
15
188
  ## API Documentation
16
189
 
17
190
  ### Properties
18
191
 
19
192
  | Name | Type | Default | Summary |
20
193
  |-|-|-|-|
21
- | bleed | `boolean` | `false` | - |
22
- | bordered | `boolean` | `false` | - |
23
- | info | `boolean` | `false` | - |
24
- | neutral | `boolean` | `false` | - |
25
- | role | `string` | `-` | - |
194
+ | bleed | `boolean` | `false` | Makes the box bleed to the container edge. |
195
+ | bordered | `boolean` | `false` | Shows the box as a bordered surface. |
196
+ | info | `boolean` | `false` | Shows the box with information styling. |
197
+ | neutral | `boolean` | `false` | Shows the box with neutral styling. |
198
+ | role | `string` | `'region'` | ARIA role for the box wrapper. |
26
199
 
27
200
  ### Property Details
28
201
 
29
202
  #### bleed
30
203
 
31
-
204
+ Makes the box bleed to the container edge.
205
+ Extends the box into the horizontal gutter on narrow screens. Adds negative horizontal margins and square side corners below the small breakpoint, then restores the normal margins and rounded corners from the small breakpoint and up.
32
206
 
33
207
  - Type: `boolean`
34
208
  - Default: `false`
35
209
 
36
210
  #### bordered
37
211
 
38
-
212
+ Shows the box as a bordered surface.
213
+ Use this when the content needs a clear visual boundary from the surrounding page.
39
214
 
40
215
  - Type: `boolean`
41
216
  - Default: `false`
42
217
 
43
218
  #### info
44
219
 
45
-
220
+ Shows the box with information styling.
221
+ Use this for supporting informational content that should be visually separated from the surrounding page.
46
222
 
47
223
  - Type: `boolean`
48
224
  - Default: `false`
49
225
 
50
226
  #### neutral
51
227
 
52
-
228
+ Shows the box with neutral styling.
229
+ Use this for quiet grouped content that needs a background without strong emphasis.
53
230
 
54
231
  - Type: `boolean`
55
232
  - Default: `false`
56
233
 
57
234
  #### role
58
235
 
59
-
236
+ ARIA role for the box wrapper.
237
+ Defaults to a role of `region`. Set `role="none"` to override this behaviour for purely visual grouping, or set a specific role when the box has a clearer semantic purpose.
60
238
 
61
239
  - Type: `string`
62
- - Default: `-`
240
+ - Default: `'region'`
63
241
 
64
242
  ### Types
65
243
 
@@ -1 +1,99 @@
1
1
  ## Examples
2
+
3
+ ### Basic
4
+
5
+ <style-isolate>
6
+ <w-box aria-labelledby="delivery-heading">
7
+ <h2 id="delivery-heading">Delivery</h2>
8
+ <p>Choose how you want the item delivered.</p>
9
+ </w-box>
10
+ </style-isolate>
11
+
12
+ ```html
13
+ <w-box aria-labelledby="delivery-heading">
14
+ <h2 id="delivery-heading">Delivery</h2>
15
+ <p>Choose how you want the item delivered.</p>
16
+ </w-box>
17
+ ```
18
+
19
+ ### Neutral
20
+
21
+ <style-isolate>
22
+ <w-box neutral aria-labelledby="order-summary-heading">
23
+ <h2 id="order-summary-heading">Order summary</h2>
24
+ <p>Review the item price, delivery, and total before continuing.</p>
25
+ </w-box>
26
+ </style-isolate>
27
+
28
+ ```html
29
+ <w-box neutral aria-labelledby="order-summary-heading">
30
+ <h2 id="order-summary-heading">Order summary</h2>
31
+ <p>Review the item price, delivery, and total before continuing.</p>
32
+ </w-box>
33
+ ```
34
+
35
+ ### Info
36
+
37
+ <style-isolate>
38
+ <w-box info aria-labelledby="good-to-know-heading">
39
+ <h2 id="good-to-know-heading">Good to know</h2>
40
+ <p>You can change the delivery method before payment.</p>
41
+ </w-box>
42
+ </style-isolate>
43
+
44
+ ```html
45
+ <w-box info aria-labelledby="good-to-know-heading">
46
+ <h2 id="good-to-know-heading">Good to know</h2>
47
+ <p>You can change the delivery method before payment.</p>
48
+ </w-box>
49
+ ```
50
+
51
+ ### Bordered
52
+
53
+ <style-isolate>
54
+ <w-box bordered aria-labelledby="contact-seller-heading">
55
+ <h2 id="contact-seller-heading">Contact seller</h2>
56
+ <p>Send a message to ask about pickup times.</p>
57
+ </w-box>
58
+ </style-isolate>
59
+
60
+ ```html
61
+ <w-box bordered aria-labelledby="contact-seller-heading">
62
+ <h2 id="contact-seller-heading">Contact seller</h2>
63
+ <p>Send a message to ask about pickup times.</p>
64
+ </w-box>
65
+ ```
66
+
67
+ ### Bleed
68
+
69
+ <style-isolate>
70
+ <div style="padding: 0 16px;">
71
+ <w-box neutral bleed aria-labelledby="summary-heading">
72
+ <h2 id="summary-heading">Summary</h2>
73
+ <p>This box extends into the horizontal gutter on narrow screens.</p>
74
+ </w-box>
75
+ </div>
76
+ </style-isolate>
77
+
78
+ ```html
79
+ <div style="padding: 0 16px;">
80
+ <w-box neutral bleed aria-labelledby="summary-heading">
81
+ <h2 id="summary-heading">Summary</h2>
82
+ <p>This box extends into the horizontal gutter on narrow screens.</p>
83
+ </w-box>
84
+ </div>
85
+ ```
86
+
87
+ ### Visual Grouping Without Accessibility Landmarking
88
+
89
+ <style-isolate>
90
+ <w-box role="none">
91
+ <p>This box is only a visual container.</p>
92
+ </w-box>
93
+ </style-isolate>
94
+
95
+ ```html
96
+ <w-box role="none">
97
+ <p>This box is only a visual container.</p>
98
+ </w-box>
99
+ ```
@@ -1 +1,48 @@
1
1
  ## Usage
2
+
3
+ Box is a layout component for visually separating a section of content from the surrounding page.
4
+
5
+ Use `w-box` for grouped content that needs padding, a background, or a border. The component does not add heading structure, spacing between children, or interactive behavior. Those you must provide yourself.
6
+
7
+ ### Basic Box
8
+
9
+ ```html
10
+ <w-box aria-labelledby="delivery-heading">
11
+ <h2 id="deliver-heading">Delivery</h2>
12
+ <p>Choose how you want the item delivered.</p>
13
+ </w-box>
14
+ ```
15
+
16
+ ### Visual Treatments
17
+
18
+ Use one visual treatment at a time:
19
+
20
+ - `neutral`: a quiet sunken surface for grouped content
21
+ - `info`: a subtle information background
22
+ - `bordered`: a bordered surface with the default background
23
+
24
+ ```html
25
+ <w-box neutral role="none">
26
+ <p>Neutral content area</p>
27
+ </w-box>
28
+
29
+ <w-box info role="none">
30
+ <p>Informational content area</p>
31
+ </w-box>
32
+
33
+ <w-box bordered role="none">
34
+ <p>Bordered content area</p>
35
+ </w-box>
36
+ ```
37
+
38
+ ### Bleed
39
+
40
+ Use `bleed` when a box sits inside a page gutter but should extend to the container edge on narrow screens. `bleed` is commonly combined with a visual treatment such as `neutral` or `info`.
41
+
42
+ ```html
43
+ <w-box neutral bleed aria-labelledby="summary-heading">
44
+ <h2 id="summary-heading">Summary</h2>
45
+ <p>This box extends into the horizontal gutter on narrow screens.</p>
46
+ </w-box>
47
+ ```
48
+
@@ -1 +1,6 @@
1
1
  ## Accessibility
2
+
3
+ If a visible label isn't specified, an `aria-label` must be provided to the text field for accessibility. If the field is labeled by a separate element, an `aria-labelledby` property must be provided using the `id` of the labeling element instead.
4
+
5
+ - Always provide a visible label (do not rely on `placeholder` alone).
6
+ - Do not rely on color alone for interaction feedback (e.g. error states).