@warp-ds/elements 2.10.0-next.17 → 2.10.0-next.19

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 (104) hide show
  1. package/dist/custom-elements.json +285 -159
  2. package/dist/docs/affix/affix.md +117 -0
  3. package/dist/docs/affix/styling.md +107 -0
  4. package/dist/docs/breadcrumb-item/api.md +27 -0
  5. package/dist/docs/breadcrumb-item/breadcrumb-item.md +34 -0
  6. package/dist/docs/breadcrumbs/accessibility.md +8 -18
  7. package/dist/docs/breadcrumbs/breadcrumbs.md +120 -34
  8. package/dist/docs/breadcrumbs/examples.md +8 -8
  9. package/dist/docs/breadcrumbs/styling.md +96 -0
  10. package/dist/docs/breadcrumbs/usage.md +8 -8
  11. package/dist/docs/index.md +2 -1
  12. package/dist/docs/select/select.md +91 -0
  13. package/dist/docs/select/styling.md +91 -0
  14. package/dist/docs/textarea/styling.md +91 -0
  15. package/dist/docs/textarea/textarea.md +91 -0
  16. package/dist/docs/textfield/api.md +8 -0
  17. package/dist/docs/textfield/styling.md +95 -0
  18. package/dist/docs/textfield/textfield.md +103 -0
  19. package/dist/index.d.ts +175 -64
  20. package/dist/packages/affix/affix-styles.d.ts +8 -0
  21. package/dist/packages/affix/affix-styles.js +108 -0
  22. package/dist/packages/affix/affix.d.ts +11 -8
  23. package/dist/packages/affix/affix.js +118 -17
  24. package/dist/packages/affix/affix.js.map +4 -4
  25. package/dist/packages/affix/affix.react.stories.d.ts +1 -1
  26. package/dist/packages/affix/react.d.ts +1 -1
  27. package/dist/packages/alert/alert.js.map +1 -1
  28. package/dist/packages/attention/attention.js.map +1 -1
  29. package/dist/packages/breadcrumb-item/breadcrumb-item.d.ts +29 -0
  30. package/dist/packages/breadcrumb-item/breadcrumb-item.js +2529 -0
  31. package/dist/packages/breadcrumb-item/breadcrumb-item.js.map +7 -0
  32. package/dist/packages/breadcrumb-item/react.d.ts +2 -0
  33. package/dist/packages/breadcrumb-item/react.js +11 -0
  34. package/dist/packages/breadcrumb-item/styles.d.ts +4 -0
  35. package/dist/packages/breadcrumb-item/styles.js +81 -0
  36. package/dist/packages/breadcrumbs/breadcrumbs.d.ts +2 -0
  37. package/dist/packages/breadcrumbs/breadcrumbs.js +11 -13
  38. package/dist/packages/breadcrumbs/breadcrumbs.js.map +3 -3
  39. package/dist/packages/breadcrumbs/breadcrumbs.react.stories.js +11 -10
  40. package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +4 -5
  41. package/dist/packages/breadcrumbs/breadcrumbs.stories.js +14 -11
  42. package/dist/packages/button/button.react.stories.d.ts +2 -2
  43. package/dist/packages/button/react.d.ts +1 -1
  44. package/dist/packages/checkbox-group/react.d.ts +1 -1
  45. package/dist/packages/combobox/combobox.react.stories.d.ts +2 -2
  46. package/dist/packages/combobox/react.d.ts +1 -1
  47. package/dist/packages/datepicker/datepicker.js.map +1 -1
  48. package/dist/packages/datepicker/datepicker.react.stories.d.ts +2 -2
  49. package/dist/packages/datepicker/react.d.ts +1 -1
  50. package/dist/packages/expandable/expandable.js.map +1 -1
  51. package/dist/packages/icon/icon.js +2 -2
  52. package/dist/packages/icon/icon.js.map +1 -1
  53. package/dist/packages/icon/icon.react.stories.d.ts +2 -1
  54. package/dist/packages/icon/icon.react.stories.js +1 -1
  55. package/dist/packages/modal-header/modal-header.js.map +1 -1
  56. package/dist/packages/pagination/pagination.js.map +1 -1
  57. package/dist/packages/pagination/pagination.react.stories.d.ts +2 -2
  58. package/dist/packages/pagination/react.d.ts +1 -1
  59. package/dist/packages/pill/pill.js.map +1 -1
  60. package/dist/packages/radio-group/react.d.ts +1 -1
  61. package/dist/packages/select/input-styles.d.ts +11 -0
  62. package/dist/packages/select/input-styles.js +88 -0
  63. package/dist/packages/select/react.d.ts +1 -1
  64. package/dist/packages/select/select.js +96 -19
  65. package/dist/packages/select/select.js.map +4 -4
  66. package/dist/packages/select/select.react.stories.d.ts +2 -2
  67. package/dist/packages/slider/react.d.ts +1 -1
  68. package/dist/packages/slider/slider.react.stories.d.ts +1 -1
  69. package/dist/packages/slider-thumb/react.d.ts +1 -1
  70. package/dist/packages/snackbar/snackbar.d.ts +2 -2
  71. package/dist/packages/snackbar/snackbar.js +1 -1
  72. package/dist/packages/snackbar/snackbar.js.map +2 -2
  73. package/dist/packages/step/step.js.map +1 -1
  74. package/dist/packages/textarea/input-styles.d.ts +11 -0
  75. package/dist/packages/textarea/input-styles.js +88 -0
  76. package/dist/packages/textarea/react.d.ts +1 -1
  77. package/dist/packages/textarea/textarea.js +99 -20
  78. package/dist/packages/textarea/textarea.js.map +4 -4
  79. package/dist/packages/textarea/textarea.react.stories.d.ts +2 -2
  80. package/dist/packages/textfield/input-styles.d.ts +11 -0
  81. package/dist/packages/textfield/input-styles.js +88 -0
  82. package/dist/packages/textfield/locales/da/messages.d.mts +1 -0
  83. package/dist/packages/textfield/locales/da/messages.mjs +1 -0
  84. package/dist/packages/textfield/locales/en/messages.d.mts +1 -0
  85. package/dist/packages/textfield/locales/en/messages.mjs +1 -0
  86. package/dist/packages/textfield/locales/fi/messages.d.mts +1 -0
  87. package/dist/packages/textfield/locales/fi/messages.mjs +1 -0
  88. package/dist/packages/textfield/locales/nb/messages.d.mts +1 -0
  89. package/dist/packages/textfield/locales/nb/messages.mjs +1 -0
  90. package/dist/packages/textfield/locales/sv/messages.d.mts +1 -0
  91. package/dist/packages/textfield/locales/sv/messages.mjs +1 -0
  92. package/dist/packages/textfield/react.d.ts +1 -1
  93. package/dist/packages/textfield/textfield.d.ts +11 -1
  94. package/dist/packages/textfield/textfield.js +111 -24
  95. package/dist/packages/textfield/textfield.js.map +4 -4
  96. package/dist/packages/textfield/textfield.react.stories.d.ts +2 -2
  97. package/dist/packages/toast/styles.js +1 -1
  98. package/dist/packages/toast/toast.js +7 -7
  99. package/dist/packages/toast/toast.js.map +2 -2
  100. package/dist/packages/toast-container/toast-container.js +8 -8
  101. package/dist/packages/toast-container/toast-container.js.map +3 -3
  102. package/dist/web-types.json +96 -50
  103. package/eik/index.js +20 -20
  104. package/package.json +8 -1
@@ -160,6 +160,97 @@ The `readonly` boolean attribute makes the selection immutable. Unlike disabled
160
160
 
161
161
  ## Styling API
162
162
 
163
+ This section documents the supported styling hooks for `<w-select>`.
164
+
165
+ Use these hooks to customize appearance without relying on internal structure or selectors.
166
+
167
+ Before changing the default styles, remember that doing so can result in less consistent experiences for users across the product. Prefer defaults.
168
+
169
+ - Prefer **component tokens** for size, spacing, and state styling.
170
+ - Use **parts** only for small, local tweaks.
171
+ - Avoid relying on internal class names or selectors.
172
+
173
+ ### Parts
174
+
175
+ The select exposes a minimal set of parts that can be targeted for last‑mile layout or typography tweaks.
176
+
177
+ | Part | Targets | Typical use |
178
+ |---|---|---|
179
+ | `input` | native select element | minor typography or spacing tweaks |
180
+
181
+ Example:
182
+
183
+ ```css
184
+ w-select::part(input) {
185
+ letter-spacing: 0.5px;
186
+ }
187
+ ```
188
+
189
+ Parts are intended as an **escape hatch**.
190
+ Prefer component tokens for anything state‑ or size‑related.
191
+
192
+
193
+ ### Component tokens
194
+
195
+ Component tokens (`--w-c-input-*`) act as inputs to the select styling.
196
+ They can be set directly on the component or inherited from a parent container.
197
+
198
+ These tokens are **shared across textfield, textarea, and select** for consistent form styling.
199
+
200
+ ```css
201
+ .form-section {
202
+ --w-c-input-label-font-weight: 600;
203
+ --w-c-input-help-text-color: var(--w-s-color-text);
204
+ }
205
+ ```
206
+
207
+ Defaults are defined internally; setting a token is always optional.
208
+
209
+
210
+ #### Label tokens
211
+
212
+ | Token | Purpose | Default |
213
+ |---|---|---|
214
+ | `--w-c-input-label-color` | label text color | `--w-s-color-text` |
215
+ | `--w-c-input-label-font-size` | label font size | `--w-font-size-s` |
216
+ | `--w-c-input-label-line-height` | label line height | `--w-line-height-s` |
217
+ | `--w-c-input-label-font-weight` | label font weight | `700` |
218
+ | `--w-c-input-label-padding-bottom` | space below label | `0.4rem` |
219
+ | `--w-c-input-label-cursor` | cursor when hovering label | `pointer` |
220
+ | `--w-c-input-label-display` | label display mode | `block` |
221
+
222
+
223
+ #### Optional indicator tokens
224
+
225
+ When `optional` attribute is set, these tokens control the "(optional)" text styling:
226
+
227
+ | Token | Purpose | Default |
228
+ |---|---|---|
229
+ | `--w-c-input-optional-color` | optional text color | `--w-s-color-text-subtle` |
230
+ | `--w-c-input-optional-font-size` | optional text font size | `--w-font-size-s` |
231
+ | `--w-c-input-optional-line-height` | optional text line height | `--w-line-height-s` |
232
+ | `--w-c-input-optional-font-weight` | optional text font weight | `400` |
233
+ | `--w-c-input-optional-padding-left` | space before optional text | `0.8rem` |
234
+
235
+
236
+ #### Help text tokens
237
+
238
+ | Token | Purpose | Default |
239
+ |---|---|---|
240
+ | `--w-c-input-help-text-color` | help text color (normal state) | `--w-s-color-text-subtle` |
241
+ | `--w-c-input-help-text-color-invalid` | help text color when invalid | `--w-s-color-text-negative` |
242
+ | `--w-c-input-help-text-font-size` | help text font size | `--w-font-size-xs` |
243
+ | `--w-c-input-help-text-line-height` | help text line height | `--w-line-height-xs` |
244
+ | `--w-c-input-help-text-margin-top` | space above help text | `0.4rem` |
245
+ | `--w-c-input-help-text-display` | help text display mode | `block` |
246
+
247
+
248
+ ## Implementation notes
249
+
250
+ ### Shared token system
251
+
252
+ Select shares its label, optional indicator, and help text tokens with `w-textfield` and `w-textarea`. This ensures consistent form styling across all text input components.
253
+
163
254
  ## `<w-select>` API
164
255
 
165
256
  Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
@@ -1 +1,92 @@
1
1
  ## Styling API
2
+
3
+ This section documents the supported styling hooks for `<w-select>`.
4
+
5
+ Use these hooks to customize appearance without relying on internal structure or selectors.
6
+
7
+ Before changing the default styles, remember that doing so can result in less consistent experiences for users across the product. Prefer defaults.
8
+
9
+ - Prefer **component tokens** for size, spacing, and state styling.
10
+ - Use **parts** only for small, local tweaks.
11
+ - Avoid relying on internal class names or selectors.
12
+
13
+ ### Parts
14
+
15
+ The select exposes a minimal set of parts that can be targeted for last‑mile layout or typography tweaks.
16
+
17
+ | Part | Targets | Typical use |
18
+ |---|---|---|
19
+ | `input` | native select element | minor typography or spacing tweaks |
20
+
21
+ Example:
22
+
23
+ ```css
24
+ w-select::part(input) {
25
+ letter-spacing: 0.5px;
26
+ }
27
+ ```
28
+
29
+ Parts are intended as an **escape hatch**.
30
+ Prefer component tokens for anything state‑ or size‑related.
31
+
32
+
33
+ ### Component tokens
34
+
35
+ Component tokens (`--w-c-input-*`) act as inputs to the select styling.
36
+ They can be set directly on the component or inherited from a parent container.
37
+
38
+ These tokens are **shared across textfield, textarea, and select** for consistent form styling.
39
+
40
+ ```css
41
+ .form-section {
42
+ --w-c-input-label-font-weight: 600;
43
+ --w-c-input-help-text-color: var(--w-s-color-text);
44
+ }
45
+ ```
46
+
47
+ Defaults are defined internally; setting a token is always optional.
48
+
49
+
50
+ #### Label tokens
51
+
52
+ | Token | Purpose | Default |
53
+ |---|---|---|
54
+ | `--w-c-input-label-color` | label text color | `--w-s-color-text` |
55
+ | `--w-c-input-label-font-size` | label font size | `--w-font-size-s` |
56
+ | `--w-c-input-label-line-height` | label line height | `--w-line-height-s` |
57
+ | `--w-c-input-label-font-weight` | label font weight | `700` |
58
+ | `--w-c-input-label-padding-bottom` | space below label | `0.4rem` |
59
+ | `--w-c-input-label-cursor` | cursor when hovering label | `pointer` |
60
+ | `--w-c-input-label-display` | label display mode | `block` |
61
+
62
+
63
+ #### Optional indicator tokens
64
+
65
+ When `optional` attribute is set, these tokens control the "(optional)" text styling:
66
+
67
+ | Token | Purpose | Default |
68
+ |---|---|---|
69
+ | `--w-c-input-optional-color` | optional text color | `--w-s-color-text-subtle` |
70
+ | `--w-c-input-optional-font-size` | optional text font size | `--w-font-size-s` |
71
+ | `--w-c-input-optional-line-height` | optional text line height | `--w-line-height-s` |
72
+ | `--w-c-input-optional-font-weight` | optional text font weight | `400` |
73
+ | `--w-c-input-optional-padding-left` | space before optional text | `0.8rem` |
74
+
75
+
76
+ #### Help text tokens
77
+
78
+ | Token | Purpose | Default |
79
+ |---|---|---|
80
+ | `--w-c-input-help-text-color` | help text color (normal state) | `--w-s-color-text-subtle` |
81
+ | `--w-c-input-help-text-color-invalid` | help text color when invalid | `--w-s-color-text-negative` |
82
+ | `--w-c-input-help-text-font-size` | help text font size | `--w-font-size-xs` |
83
+ | `--w-c-input-help-text-line-height` | help text line height | `--w-line-height-xs` |
84
+ | `--w-c-input-help-text-margin-top` | space above help text | `0.4rem` |
85
+ | `--w-c-input-help-text-display` | help text display mode | `block` |
86
+
87
+
88
+ ## Implementation notes
89
+
90
+ ### Shared token system
91
+
92
+ Select shares its label, optional indicator, and help text tokens with `w-textfield` and `w-textarea`. This ensures consistent form styling across all text input components.
@@ -1 +1,92 @@
1
1
  ## Styling API
2
+
3
+ This section documents the supported styling hooks for `<w-textarea>`.
4
+
5
+ Use these hooks to customize appearance without relying on internal structure or selectors.
6
+
7
+ Before changing the default styles, remember that doing so can result in less consistent experiences for users across the product. Prefer defaults.
8
+
9
+ - Prefer **component tokens** for size, spacing, and state styling.
10
+ - Use **parts** only for small, local tweaks.
11
+ - Avoid relying on internal class names or selectors.
12
+
13
+ ### Parts
14
+
15
+ The textarea exposes a minimal set of parts that can be targeted for last‑mile layout or typography tweaks.
16
+
17
+ | Part | Targets | Typical use |
18
+ |---|---|---|
19
+ | `input` | native textarea element | minor typography or spacing tweaks |
20
+
21
+ Example:
22
+
23
+ ```css
24
+ w-textarea::part(input) {
25
+ letter-spacing: 0.5px;
26
+ }
27
+ ```
28
+
29
+ Parts are intended as an **escape hatch**.
30
+ Prefer component tokens for anything state‑ or size‑related.
31
+
32
+
33
+ ### Component tokens
34
+
35
+ Component tokens (`--w-c-input-*`) act as inputs to the textarea styling.
36
+ They can be set directly on the component or inherited from a parent container.
37
+
38
+ These tokens are **shared across textfield, textarea, and select** for consistent form styling.
39
+
40
+ ```css
41
+ .form-section {
42
+ --w-c-input-label-font-weight: 600;
43
+ --w-c-input-help-text-color: var(--w-s-color-text);
44
+ }
45
+ ```
46
+
47
+ Defaults are defined internally; setting a token is always optional.
48
+
49
+
50
+ #### Label tokens
51
+
52
+ | Token | Purpose | Default |
53
+ |---|---|---|
54
+ | `--w-c-input-label-color` | label text color | `--w-s-color-text` |
55
+ | `--w-c-input-label-font-size` | label font size | `--w-font-size-s` |
56
+ | `--w-c-input-label-line-height` | label line height | `--w-line-height-s` |
57
+ | `--w-c-input-label-font-weight` | label font weight | `700` |
58
+ | `--w-c-input-label-padding-bottom` | space below label | `0.4rem` |
59
+ | `--w-c-input-label-cursor` | cursor when hovering label | `pointer` |
60
+ | `--w-c-input-label-display` | label display mode | `block` |
61
+
62
+
63
+ #### Optional indicator tokens
64
+
65
+ When `optional` attribute is set, these tokens control the "(optional)" text styling:
66
+
67
+ | Token | Purpose | Default |
68
+ |---|---|---|
69
+ | `--w-c-input-optional-color` | optional text color | `--w-s-color-text-subtle` |
70
+ | `--w-c-input-optional-font-size` | optional text font size | `--w-font-size-s` |
71
+ | `--w-c-input-optional-line-height` | optional text line height | `--w-line-height-s` |
72
+ | `--w-c-input-optional-font-weight` | optional text font weight | `400` |
73
+ | `--w-c-input-optional-padding-left` | space before optional text | `0.8rem` |
74
+
75
+
76
+ #### Help text tokens
77
+
78
+ | Token | Purpose | Default |
79
+ |---|---|---|
80
+ | `--w-c-input-help-text-color` | help text color (normal state) | `--w-s-color-text-subtle` |
81
+ | `--w-c-input-help-text-color-invalid` | help text color when invalid | `--w-s-color-text-negative` |
82
+ | `--w-c-input-help-text-font-size` | help text font size | `--w-font-size-xs` |
83
+ | `--w-c-input-help-text-line-height` | help text line height | `--w-line-height-xs` |
84
+ | `--w-c-input-help-text-margin-top` | space above help text | `0.4rem` |
85
+ | `--w-c-input-help-text-display` | help text display mode | `block` |
86
+
87
+
88
+ ## Implementation notes
89
+
90
+ ### Shared token system
91
+
92
+ Textarea shares its label, optional indicator, and help text tokens with `w-textfield` and `w-select`. This ensures consistent form styling across all text input components.
@@ -113,6 +113,97 @@ Makes the textarea content immutable while remaining focusable. The contents can
113
113
 
114
114
  ## Styling API
115
115
 
116
+ This section documents the supported styling hooks for `<w-textarea>`.
117
+
118
+ Use these hooks to customize appearance without relying on internal structure or selectors.
119
+
120
+ Before changing the default styles, remember that doing so can result in less consistent experiences for users across the product. Prefer defaults.
121
+
122
+ - Prefer **component tokens** for size, spacing, and state styling.
123
+ - Use **parts** only for small, local tweaks.
124
+ - Avoid relying on internal class names or selectors.
125
+
126
+ ### Parts
127
+
128
+ The textarea exposes a minimal set of parts that can be targeted for last‑mile layout or typography tweaks.
129
+
130
+ | Part | Targets | Typical use |
131
+ |---|---|---|
132
+ | `input` | native textarea element | minor typography or spacing tweaks |
133
+
134
+ Example:
135
+
136
+ ```css
137
+ w-textarea::part(input) {
138
+ letter-spacing: 0.5px;
139
+ }
140
+ ```
141
+
142
+ Parts are intended as an **escape hatch**.
143
+ Prefer component tokens for anything state‑ or size‑related.
144
+
145
+
146
+ ### Component tokens
147
+
148
+ Component tokens (`--w-c-input-*`) act as inputs to the textarea styling.
149
+ They can be set directly on the component or inherited from a parent container.
150
+
151
+ These tokens are **shared across textfield, textarea, and select** for consistent form styling.
152
+
153
+ ```css
154
+ .form-section {
155
+ --w-c-input-label-font-weight: 600;
156
+ --w-c-input-help-text-color: var(--w-s-color-text);
157
+ }
158
+ ```
159
+
160
+ Defaults are defined internally; setting a token is always optional.
161
+
162
+
163
+ #### Label tokens
164
+
165
+ | Token | Purpose | Default |
166
+ |---|---|---|
167
+ | `--w-c-input-label-color` | label text color | `--w-s-color-text` |
168
+ | `--w-c-input-label-font-size` | label font size | `--w-font-size-s` |
169
+ | `--w-c-input-label-line-height` | label line height | `--w-line-height-s` |
170
+ | `--w-c-input-label-font-weight` | label font weight | `700` |
171
+ | `--w-c-input-label-padding-bottom` | space below label | `0.4rem` |
172
+ | `--w-c-input-label-cursor` | cursor when hovering label | `pointer` |
173
+ | `--w-c-input-label-display` | label display mode | `block` |
174
+
175
+
176
+ #### Optional indicator tokens
177
+
178
+ When `optional` attribute is set, these tokens control the "(optional)" text styling:
179
+
180
+ | Token | Purpose | Default |
181
+ |---|---|---|
182
+ | `--w-c-input-optional-color` | optional text color | `--w-s-color-text-subtle` |
183
+ | `--w-c-input-optional-font-size` | optional text font size | `--w-font-size-s` |
184
+ | `--w-c-input-optional-line-height` | optional text line height | `--w-line-height-s` |
185
+ | `--w-c-input-optional-font-weight` | optional text font weight | `400` |
186
+ | `--w-c-input-optional-padding-left` | space before optional text | `0.8rem` |
187
+
188
+
189
+ #### Help text tokens
190
+
191
+ | Token | Purpose | Default |
192
+ |---|---|---|
193
+ | `--w-c-input-help-text-color` | help text color (normal state) | `--w-s-color-text-subtle` |
194
+ | `--w-c-input-help-text-color-invalid` | help text color when invalid | `--w-s-color-text-negative` |
195
+ | `--w-c-input-help-text-font-size` | help text font size | `--w-font-size-xs` |
196
+ | `--w-c-input-help-text-line-height` | help text line height | `--w-line-height-xs` |
197
+ | `--w-c-input-help-text-margin-top` | space above help text | `0.4rem` |
198
+ | `--w-c-input-help-text-display` | help text display mode | `block` |
199
+
200
+
201
+ ## Implementation notes
202
+
203
+ ### Shared token system
204
+
205
+ Textarea shares its label, optional indicator, and help text tokens with `w-textfield` and `w-select`. This ensures consistent form styling across all text input components.
206
+
116
207
  ## `<w-textarea>` API
117
208
 
118
209
  Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
@@ -20,6 +20,7 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
20
20
  | min-length | `number \| undefined` | `-` | **Deprecated**: Use the native `minlength` attribute |
21
21
  | minlength | `number \| undefined` | `-` | For `text`, `search`, `url`, `tel`, `email` and `password` fields, sets the [minimum string length](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#minlength) required. |
22
22
  | name | `string \| undefined` | `-` | The [name](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#name) of the input field when submitting the form. |
23
+ | optional | `boolean` | `false` | Whether to show the optional indicator after the label. |
23
24
  | pattern | `string \| undefined` | `-` | Sets a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) that the input's value must [match to pass validation](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#pattern) |
24
25
  | placeholder | `string \| undefined` | `-` | Shown in the textfield when it doesn't have a value |
25
26
  | prefixSlotChange (JS only) | `prefixSlotChange() => void` | `-` | - |
@@ -145,6 +146,13 @@ The [name](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/
145
146
  - Type: `string | undefined`
146
147
  - Default: `-`
147
148
 
149
+ #### optional
150
+
151
+ Whether to show the optional indicator after the label.
152
+
153
+ - Type: `boolean`
154
+ - Default: `false`
155
+
148
156
  #### pattern
149
157
 
150
158
  Sets a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) that the input's value must [match to pass validation](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#pattern)
@@ -1 +1,96 @@
1
1
  ## Styling API
2
+
3
+ This section documents the supported styling hooks for `<w-textfield>`.
4
+
5
+ Use these hooks to customize appearance without relying on internal structure or selectors.
6
+
7
+ Before changing the default styles, remember that doing so can result in less consistent experiences for users across the product. Prefer defaults.
8
+
9
+ - Prefer **component tokens** for size, spacing, and state styling.
10
+ - Use **parts** only for small, local tweaks.
11
+ - Avoid relying on internal class names or selectors.
12
+
13
+ ### Parts
14
+
15
+ The textfield exposes a minimal set of parts that can be targeted for last‑mile layout or typography tweaks.
16
+
17
+ | Part | Targets | Typical use |
18
+ |---|---|---|
19
+ | `input` | native input element | minor typography or spacing tweaks |
20
+
21
+ Example:
22
+
23
+ ```css
24
+ w-textfield::part(input) {
25
+ letter-spacing: 0.5px;
26
+ }
27
+ ```
28
+
29
+ Parts are intended as an **escape hatch**.
30
+ Prefer component tokens for anything state‑ or size‑related.
31
+
32
+
33
+ ### Component tokens
34
+
35
+ Component tokens (`--w-c-input-*`) act as inputs to the textfield styling.
36
+ They can be set directly on the component or inherited from a parent container.
37
+
38
+ These tokens are **shared across textfield, textarea, and select** for consistent form styling.
39
+
40
+ ```css
41
+ .form-section {
42
+ --w-c-input-label-font-weight: 600;
43
+ --w-c-input-help-text-color: var(--w-s-color-text);
44
+ }
45
+ ```
46
+
47
+ Defaults are defined internally; setting a token is always optional.
48
+
49
+
50
+ #### Label tokens
51
+
52
+ | Token | Purpose | Default |
53
+ |---|---|---|
54
+ | `--w-c-input-label-color` | label text color | `--w-s-color-text` |
55
+ | `--w-c-input-label-font-size` | label font size | `--w-font-size-s` |
56
+ | `--w-c-input-label-line-height` | label line height | `--w-line-height-s` |
57
+ | `--w-c-input-label-font-weight` | label font weight | `700` |
58
+ | `--w-c-input-label-padding-bottom` | space below label | `0.4rem` |
59
+ | `--w-c-input-label-cursor` | cursor when hovering label | `pointer` |
60
+ | `--w-c-input-label-display` | label display mode | `block` |
61
+
62
+
63
+ #### Optional indicator tokens
64
+
65
+ When `optional` attribute is set, these tokens control the "(optional)" text styling:
66
+
67
+ | Token | Purpose | Default |
68
+ |---|---|---|
69
+ | `--w-c-input-optional-color` | optional text color | `--w-s-color-text-subtle` |
70
+ | `--w-c-input-optional-font-size` | optional text font size | `--w-font-size-s` |
71
+ | `--w-c-input-optional-line-height` | optional text line height | `--w-line-height-s` |
72
+ | `--w-c-input-optional-font-weight` | optional text font weight | `400` |
73
+ | `--w-c-input-optional-padding-left` | space before optional text | `0.8rem` |
74
+
75
+
76
+ #### Help text tokens
77
+
78
+ | Token | Purpose | Default |
79
+ |---|---|---|
80
+ | `--w-c-input-help-text-color` | help text color (normal state) | `--w-s-color-text-subtle` |
81
+ | `--w-c-input-help-text-color-invalid` | help text color when invalid | `--w-s-color-text-negative` |
82
+ | `--w-c-input-help-text-font-size` | help text font size | `--w-font-size-xs` |
83
+ | `--w-c-input-help-text-line-height` | help text line height | `--w-line-height-xs` |
84
+ | `--w-c-input-help-text-margin-top` | space above help text | `0.4rem` |
85
+ | `--w-c-input-help-text-display` | help text display mode | `block` |
86
+
87
+
88
+ ## Implementation notes
89
+
90
+ ### Shared token system
91
+
92
+ Textfield shares its label, optional indicator, and help text tokens with `w-textarea` and `w-select`. This ensures consistent form styling across all text input components.
93
+
94
+ ### Affix accessibility
95
+
96
+ Due to shadow DOM boundaries, affix content (prefix/suffix slots) cannot be connected to the input via ARIA references. For non-interactive affixes like currency symbols or unit labels, consider including that information in the main `label` or `placeholder` text instead for better screen reader support.
@@ -183,6 +183,101 @@ The readonly boolean attribute makes the w-textfield's text content immutable. U
183
183
 
184
184
  ## Styling API
185
185
 
186
+ This section documents the supported styling hooks for `<w-textfield>`.
187
+
188
+ Use these hooks to customize appearance without relying on internal structure or selectors.
189
+
190
+ Before changing the default styles, remember that doing so can result in less consistent experiences for users across the product. Prefer defaults.
191
+
192
+ - Prefer **component tokens** for size, spacing, and state styling.
193
+ - Use **parts** only for small, local tweaks.
194
+ - Avoid relying on internal class names or selectors.
195
+
196
+ ### Parts
197
+
198
+ The textfield exposes a minimal set of parts that can be targeted for last‑mile layout or typography tweaks.
199
+
200
+ | Part | Targets | Typical use |
201
+ |---|---|---|
202
+ | `input` | native input element | minor typography or spacing tweaks |
203
+
204
+ Example:
205
+
206
+ ```css
207
+ w-textfield::part(input) {
208
+ letter-spacing: 0.5px;
209
+ }
210
+ ```
211
+
212
+ Parts are intended as an **escape hatch**.
213
+ Prefer component tokens for anything state‑ or size‑related.
214
+
215
+
216
+ ### Component tokens
217
+
218
+ Component tokens (`--w-c-input-*`) act as inputs to the textfield styling.
219
+ They can be set directly on the component or inherited from a parent container.
220
+
221
+ These tokens are **shared across textfield, textarea, and select** for consistent form styling.
222
+
223
+ ```css
224
+ .form-section {
225
+ --w-c-input-label-font-weight: 600;
226
+ --w-c-input-help-text-color: var(--w-s-color-text);
227
+ }
228
+ ```
229
+
230
+ Defaults are defined internally; setting a token is always optional.
231
+
232
+
233
+ #### Label tokens
234
+
235
+ | Token | Purpose | Default |
236
+ |---|---|---|
237
+ | `--w-c-input-label-color` | label text color | `--w-s-color-text` |
238
+ | `--w-c-input-label-font-size` | label font size | `--w-font-size-s` |
239
+ | `--w-c-input-label-line-height` | label line height | `--w-line-height-s` |
240
+ | `--w-c-input-label-font-weight` | label font weight | `700` |
241
+ | `--w-c-input-label-padding-bottom` | space below label | `0.4rem` |
242
+ | `--w-c-input-label-cursor` | cursor when hovering label | `pointer` |
243
+ | `--w-c-input-label-display` | label display mode | `block` |
244
+
245
+
246
+ #### Optional indicator tokens
247
+
248
+ When `optional` attribute is set, these tokens control the "(optional)" text styling:
249
+
250
+ | Token | Purpose | Default |
251
+ |---|---|---|
252
+ | `--w-c-input-optional-color` | optional text color | `--w-s-color-text-subtle` |
253
+ | `--w-c-input-optional-font-size` | optional text font size | `--w-font-size-s` |
254
+ | `--w-c-input-optional-line-height` | optional text line height | `--w-line-height-s` |
255
+ | `--w-c-input-optional-font-weight` | optional text font weight | `400` |
256
+ | `--w-c-input-optional-padding-left` | space before optional text | `0.8rem` |
257
+
258
+
259
+ #### Help text tokens
260
+
261
+ | Token | Purpose | Default |
262
+ |---|---|---|
263
+ | `--w-c-input-help-text-color` | help text color (normal state) | `--w-s-color-text-subtle` |
264
+ | `--w-c-input-help-text-color-invalid` | help text color when invalid | `--w-s-color-text-negative` |
265
+ | `--w-c-input-help-text-font-size` | help text font size | `--w-font-size-xs` |
266
+ | `--w-c-input-help-text-line-height` | help text line height | `--w-line-height-xs` |
267
+ | `--w-c-input-help-text-margin-top` | space above help text | `0.4rem` |
268
+ | `--w-c-input-help-text-display` | help text display mode | `block` |
269
+
270
+
271
+ ## Implementation notes
272
+
273
+ ### Shared token system
274
+
275
+ Textfield shares its label, optional indicator, and help text tokens with `w-textarea` and `w-select`. This ensures consistent form styling across all text input components.
276
+
277
+ ### Affix accessibility
278
+
279
+ Due to shadow DOM boundaries, affix content (prefix/suffix slots) cannot be connected to the input via ARIA references. For non-interactive affixes like currency symbols or unit labels, consider including that information in the main `label` or `placeholder` text instead for better screen reader support.
280
+
186
281
  ## `<w-textfield>` API
187
282
 
188
283
  Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
@@ -205,6 +300,7 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
205
300
  | min-length | `number \| undefined` | `-` | **Deprecated**: Use the native `minlength` attribute |
206
301
  | minlength | `number \| undefined` | `-` | For `text`, `search`, `url`, `tel`, `email` and `password` fields, sets the [minimum string length](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#minlength) required. |
207
302
  | name | `string \| undefined` | `-` | The [name](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#name) of the input field when submitting the form. |
303
+ | optional | `boolean` | `false` | Whether to show the optional indicator after the label. |
208
304
  | pattern | `string \| undefined` | `-` | Sets a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) that the input's value must [match to pass validation](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#pattern) |
209
305
  | placeholder | `string \| undefined` | `-` | Shown in the textfield when it doesn't have a value |
210
306
  | prefixSlotChange (JS only) | `prefixSlotChange() => void` | `-` | - |
@@ -330,6 +426,13 @@ The [name](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/
330
426
  - Type: `string | undefined`
331
427
  - Default: `-`
332
428
 
429
+ #### optional
430
+
431
+ Whether to show the optional indicator after the label.
432
+
433
+ - Type: `boolean`
434
+ - Default: `false`
435
+
333
436
  #### pattern
334
437
 
335
438
  Sets a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) that the input's value must [match to pass validation](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#pattern)