@warp-ds/elements 2.10.0-next.18 → 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 (83) hide show
  1. package/dist/custom-elements.json +179 -159
  2. package/dist/docs/affix/affix.md +117 -0
  3. package/dist/docs/affix/styling.md +107 -0
  4. package/dist/docs/breadcrumbs/breadcrumbs.md +67 -4
  5. package/dist/docs/breadcrumbs/styling.md +67 -4
  6. package/dist/docs/index.md +1 -1
  7. package/dist/docs/select/select.md +91 -0
  8. package/dist/docs/select/styling.md +91 -0
  9. package/dist/docs/textarea/styling.md +91 -0
  10. package/dist/docs/textarea/textarea.md +91 -0
  11. package/dist/docs/textfield/api.md +8 -0
  12. package/dist/docs/textfield/styling.md +95 -0
  13. package/dist/docs/textfield/textfield.md +103 -0
  14. package/dist/index.d.ts +90 -64
  15. package/dist/packages/affix/affix-styles.d.ts +8 -0
  16. package/dist/packages/affix/affix-styles.js +108 -0
  17. package/dist/packages/affix/affix.d.ts +11 -8
  18. package/dist/packages/affix/affix.js +118 -17
  19. package/dist/packages/affix/affix.js.map +4 -4
  20. package/dist/packages/affix/affix.react.stories.d.ts +1 -1
  21. package/dist/packages/affix/react.d.ts +1 -1
  22. package/dist/packages/alert/alert.js.map +1 -1
  23. package/dist/packages/attention/attention.js.map +1 -1
  24. package/dist/packages/breadcrumb-item/breadcrumb-item.js +16 -7
  25. package/dist/packages/breadcrumb-item/breadcrumb-item.js.map +2 -2
  26. package/dist/packages/breadcrumb-item/styles.js +14 -5
  27. package/dist/packages/button/button.react.stories.d.ts +2 -2
  28. package/dist/packages/button/react.d.ts +1 -1
  29. package/dist/packages/checkbox-group/react.d.ts +1 -1
  30. package/dist/packages/combobox/combobox.react.stories.d.ts +2 -2
  31. package/dist/packages/combobox/react.d.ts +1 -1
  32. package/dist/packages/datepicker/datepicker.js.map +1 -1
  33. package/dist/packages/datepicker/datepicker.react.stories.d.ts +2 -2
  34. package/dist/packages/datepicker/react.d.ts +1 -1
  35. package/dist/packages/expandable/expandable.js.map +1 -1
  36. package/dist/packages/icon/icon.js +2 -2
  37. package/dist/packages/icon/icon.js.map +1 -1
  38. package/dist/packages/icon/icon.react.stories.d.ts +2 -1
  39. package/dist/packages/icon/icon.react.stories.js +1 -1
  40. package/dist/packages/modal-header/modal-header.js.map +1 -1
  41. package/dist/packages/pagination/pagination.js.map +1 -1
  42. package/dist/packages/pill/pill.js.map +1 -1
  43. package/dist/packages/radio-group/react.d.ts +1 -1
  44. package/dist/packages/select/input-styles.d.ts +11 -0
  45. package/dist/packages/select/input-styles.js +88 -0
  46. package/dist/packages/select/react.d.ts +1 -1
  47. package/dist/packages/select/select.js +96 -19
  48. package/dist/packages/select/select.js.map +4 -4
  49. package/dist/packages/select/select.react.stories.d.ts +2 -2
  50. package/dist/packages/slider/react.d.ts +1 -1
  51. package/dist/packages/slider/slider.react.stories.d.ts +1 -1
  52. package/dist/packages/slider-thumb/react.d.ts +1 -1
  53. package/dist/packages/snackbar/snackbar.d.ts +2 -2
  54. package/dist/packages/snackbar/snackbar.js +1 -1
  55. package/dist/packages/snackbar/snackbar.js.map +2 -2
  56. package/dist/packages/step/step.js.map +1 -1
  57. package/dist/packages/textarea/input-styles.d.ts +11 -0
  58. package/dist/packages/textarea/input-styles.js +88 -0
  59. package/dist/packages/textarea/react.d.ts +1 -1
  60. package/dist/packages/textarea/textarea.js +99 -20
  61. package/dist/packages/textarea/textarea.js.map +4 -4
  62. package/dist/packages/textarea/textarea.react.stories.d.ts +2 -2
  63. package/dist/packages/textfield/input-styles.d.ts +11 -0
  64. package/dist/packages/textfield/input-styles.js +88 -0
  65. package/dist/packages/textfield/locales/da/messages.d.mts +1 -0
  66. package/dist/packages/textfield/locales/da/messages.mjs +1 -0
  67. package/dist/packages/textfield/locales/en/messages.d.mts +1 -0
  68. package/dist/packages/textfield/locales/en/messages.mjs +1 -0
  69. package/dist/packages/textfield/locales/fi/messages.d.mts +1 -0
  70. package/dist/packages/textfield/locales/fi/messages.mjs +1 -0
  71. package/dist/packages/textfield/locales/nb/messages.d.mts +1 -0
  72. package/dist/packages/textfield/locales/nb/messages.mjs +1 -0
  73. package/dist/packages/textfield/locales/sv/messages.d.mts +1 -0
  74. package/dist/packages/textfield/locales/sv/messages.mjs +1 -0
  75. package/dist/packages/textfield/react.d.ts +1 -1
  76. package/dist/packages/textfield/textfield.d.ts +11 -1
  77. package/dist/packages/textfield/textfield.js +111 -24
  78. package/dist/packages/textfield/textfield.js.map +4 -4
  79. package/dist/packages/textfield/textfield.react.stories.d.ts +2 -2
  80. package/dist/packages/toast/toast.js.map +1 -1
  81. package/dist/web-types.json +60 -50
  82. package/eik/index.js +20 -20
  83. package/package.json +1 -1
@@ -128,11 +128,72 @@ Breadcrumbs should support orientation within the site hierarchy. They should no
128
128
 
129
129
  ### Breadcrumbs
130
130
 
131
- The styling API for the Breadcrumbs component is under construction.
131
+ The breadcrumbs components support styling through **component tokens** (CSS custom properties with a `--w-c-` prefix) and **parts**.
132
+
133
+ `w-breadcrumbs` does not expose component-specific tokens. Set `w-breadcrumb-item` tokens on `w-breadcrumbs` or another ancestor to style all items in a breadcrumb trail.
134
+
135
+ ```css
136
+ w-breadcrumbs {
137
+ --w-c-breadcrumb-item-link-color: var(--w-s-color-text-link);
138
+ --w-c-breadcrumb-item-separator-spacing: 1.2rem;
139
+ }
140
+ ```
132
141
 
133
142
  ### Breadcrumb Item
134
143
 
135
- The w-breadcrumb-item component supports styling through **parts**.
144
+ The `w-breadcrumb-item` component supports styling through **component tokens** and **parts**.
145
+
146
+ #### Component tokens
147
+
148
+ Set these on `w-breadcrumb-item` to override one item, or on `w-breadcrumbs` to let the values inherit into all item children.
149
+
150
+ ```css
151
+ w-breadcrumb-item {
152
+ --w-c-breadcrumb-item-link-color-hover: var(--w-s-color-text-link-hover);
153
+ --w-c-breadcrumb-item-font-weight: 700;
154
+ }
155
+ ```
156
+
157
+ ##### Layout and typography
158
+
159
+ | Token | Purpose | Default |
160
+ | ----------------------------------- | --------------------------------------- | ------------------- |
161
+ | `--w-c-breadcrumb-item-font-size` | Font size for the label and separator | inherited font size |
162
+ | `--w-c-breadcrumb-item-line-height` | Line height for the label and separator | `1.5` |
163
+ | `--w-c-breadcrumb-item-font-weight` | Font weight for the label and separator | `400` |
164
+ | `--w-c-breadcrumb-item-padding-x` | Inline padding for linked items | `0` |
165
+ | `--w-c-breadcrumb-item-padding-y` | Block padding for linked items | `0` |
166
+
167
+ ##### Link color
168
+
169
+ | Token | Purpose | Default |
170
+ | ----------------------------------------- | ------------------------------------------ | ---------------------------- |
171
+ | `--w-c-breadcrumb-item-link-color` | Color for linked items | `var(--w-s-color-text-link)` |
172
+ | `--w-c-breadcrumb-item-link-color-hover` | Color for linked items on hover | link color |
173
+ | `--w-c-breadcrumb-item-link-color-active` | Color for linked items in the active state | link color |
174
+
175
+ ##### Text color
176
+
177
+ | Token | Purpose | Default |
178
+ | ---------------------------------- | -------------------------- | ----------------------- |
179
+ | `--w-c-breadcrumb-item-text-color` | Color for non-linked items | `var(--w-s-color-text)` |
180
+
181
+ ##### Separator
182
+
183
+ | Token | Purpose | Default |
184
+ | ----------------------------------------- | ------------------------------------------- | ----------------------- |
185
+ | `--w-c-breadcrumb-item-separator-color` | Color for the separator | `var(--w-s-color-icon)` |
186
+ | `--w-c-breadcrumb-item-separator-spacing` | Inline margin on each side of the separator | `0.8rem` |
187
+
188
+ The separator uses `--w-c-breadcrumb-item-font-size`, `--w-c-breadcrumb-item-line-height`, and `--w-c-breadcrumb-item-font-weight`.
189
+
190
+ ##### Focus
191
+
192
+ | Token | Purpose | Default |
193
+ | -------------------------------------- | ------------------------------------- | -------------------- |
194
+ | `--w-c-breadcrumb-item-outline-width` | Focus outline width for linked items | native focus outline |
195
+ | `--w-c-breadcrumb-item-outline-color` | Focus outline color for linked items | native focus outline |
196
+ | `--w-c-breadcrumb-item-outline-offset` | Focus outline offset for linked items | native focus outline |
136
197
 
137
198
  #### Parts
138
199
 
@@ -146,11 +207,11 @@ Example:
146
207
 
147
208
  ```css
148
209
  w-breadcrumb-item::part(link) {
149
- text-decoration-thickness: 2px;
210
+ text-decoration-thickness: 2px;
150
211
  }
151
212
 
152
213
  w-breadcrumb-item::part(separator) {
153
- margin-inline: 1.2rem;
214
+ margin-inline: 1.2rem;
154
215
  }
155
216
  ```
156
217
 
@@ -158,6 +219,8 @@ w-breadcrumb-item::part(separator) {
158
219
 
159
220
  - `separator` is not rendered when `current-page` is set.
160
221
  - Use `link` for linked breadcrumb items and `text` for non-linked breadcrumb items.
222
+ - Link color, padding, and focus tokens apply only when `href` is set.
223
+ - Focus tokens do not make non-linked breadcrumb items keyboard-focusable.
161
224
 
162
225
  ## `<w-breadcrumbs>` API
163
226
 
@@ -2,11 +2,72 @@
2
2
 
3
3
  ### Breadcrumbs
4
4
 
5
- The styling API for the Breadcrumbs component is under construction.
5
+ The breadcrumbs components support styling through **component tokens** (CSS custom properties with a `--w-c-` prefix) and **parts**.
6
+
7
+ `w-breadcrumbs` does not expose component-specific tokens. Set `w-breadcrumb-item` tokens on `w-breadcrumbs` or another ancestor to style all items in a breadcrumb trail.
8
+
9
+ ```css
10
+ w-breadcrumbs {
11
+ --w-c-breadcrumb-item-link-color: var(--w-s-color-text-link);
12
+ --w-c-breadcrumb-item-separator-spacing: 1.2rem;
13
+ }
14
+ ```
6
15
 
7
16
  ### Breadcrumb Item
8
17
 
9
- The w-breadcrumb-item component supports styling through **parts**.
18
+ The `w-breadcrumb-item` component supports styling through **component tokens** and **parts**.
19
+
20
+ #### Component tokens
21
+
22
+ Set these on `w-breadcrumb-item` to override one item, or on `w-breadcrumbs` to let the values inherit into all item children.
23
+
24
+ ```css
25
+ w-breadcrumb-item {
26
+ --w-c-breadcrumb-item-link-color-hover: var(--w-s-color-text-link-hover);
27
+ --w-c-breadcrumb-item-font-weight: 700;
28
+ }
29
+ ```
30
+
31
+ ##### Layout and typography
32
+
33
+ | Token | Purpose | Default |
34
+ | ----------------------------------- | --------------------------------------- | ------------------- |
35
+ | `--w-c-breadcrumb-item-font-size` | Font size for the label and separator | inherited font size |
36
+ | `--w-c-breadcrumb-item-line-height` | Line height for the label and separator | `1.5` |
37
+ | `--w-c-breadcrumb-item-font-weight` | Font weight for the label and separator | `400` |
38
+ | `--w-c-breadcrumb-item-padding-x` | Inline padding for linked items | `0` |
39
+ | `--w-c-breadcrumb-item-padding-y` | Block padding for linked items | `0` |
40
+
41
+ ##### Link color
42
+
43
+ | Token | Purpose | Default |
44
+ | ----------------------------------------- | ------------------------------------------ | ---------------------------- |
45
+ | `--w-c-breadcrumb-item-link-color` | Color for linked items | `var(--w-s-color-text-link)` |
46
+ | `--w-c-breadcrumb-item-link-color-hover` | Color for linked items on hover | link color |
47
+ | `--w-c-breadcrumb-item-link-color-active` | Color for linked items in the active state | link color |
48
+
49
+ ##### Text color
50
+
51
+ | Token | Purpose | Default |
52
+ | ---------------------------------- | -------------------------- | ----------------------- |
53
+ | `--w-c-breadcrumb-item-text-color` | Color for non-linked items | `var(--w-s-color-text)` |
54
+
55
+ ##### Separator
56
+
57
+ | Token | Purpose | Default |
58
+ | ----------------------------------------- | ------------------------------------------- | ----------------------- |
59
+ | `--w-c-breadcrumb-item-separator-color` | Color for the separator | `var(--w-s-color-icon)` |
60
+ | `--w-c-breadcrumb-item-separator-spacing` | Inline margin on each side of the separator | `0.8rem` |
61
+
62
+ The separator uses `--w-c-breadcrumb-item-font-size`, `--w-c-breadcrumb-item-line-height`, and `--w-c-breadcrumb-item-font-weight`.
63
+
64
+ ##### Focus
65
+
66
+ | Token | Purpose | Default |
67
+ | -------------------------------------- | ------------------------------------- | -------------------- |
68
+ | `--w-c-breadcrumb-item-outline-width` | Focus outline width for linked items | native focus outline |
69
+ | `--w-c-breadcrumb-item-outline-color` | Focus outline color for linked items | native focus outline |
70
+ | `--w-c-breadcrumb-item-outline-offset` | Focus outline offset for linked items | native focus outline |
10
71
 
11
72
  #### Parts
12
73
 
@@ -20,11 +81,11 @@ Example:
20
81
 
21
82
  ```css
22
83
  w-breadcrumb-item::part(link) {
23
- text-decoration-thickness: 2px;
84
+ text-decoration-thickness: 2px;
24
85
  }
25
86
 
26
87
  w-breadcrumb-item::part(separator) {
27
- margin-inline: 1.2rem;
88
+ margin-inline: 1.2rem;
28
89
  }
29
90
  ```
30
91
 
@@ -32,3 +93,5 @@ w-breadcrumb-item::part(separator) {
32
93
 
33
94
  - `separator` is not rendered when `current-page` is set.
34
95
  - Use `link` for linked breadcrumb items and `text` for non-linked breadcrumb items.
96
+ - Link color, padding, and focus tokens apply only when `href` is set.
97
+ - Focus tokens do not make non-linked breadcrumb items keyboard-focusable.
@@ -9,7 +9,7 @@ Generated by `pnpm build:docs`. This file indexes the Markdown documentation shi
9
9
 
10
10
  | Component | Element / API | Package | Summary | Docs |
11
11
  |-|-|-|-|-|
12
- | Affix | `<w-affix>` | `affix` | This component is usually used in other components like form elements to show a prefix or suffix. See for example `w-textfield`. | [affix.md](./affix/affix.md) |
12
+ | Affix | `<w-affix>` | `affix` | This component is usually used in other components like form elements to show a prefix or suffix. See for example `w-textfield`. ## Accessibility Note Due to shadow DOM encapsulation, ARIA attributes (like `aria-describedby`, `aria-labelledby`) cannot reference elements across shadow boundaries. This means: - Non-interactive affixes (text labels, icons) cannot be connected to the parent input via ARIA - Interactive affixes (buttons) must have their own `aria-label` (already implemented) - Do NOT attempt to reference affix content from parent components via ARIA ID references - it won't work For non-interactive labels (e.g., currency symbols), consider including the information in the main label or placeholder instead of relying on ARIA to announce affix content. | [affix.md](./affix/affix.md) |
13
13
  | Alert | `<w-alert>` | `alert` | Alert is an inline component used for displaying different types of messages. For accessibility reasons, alert should appear close to the element that triggered it. | [alert.md](./alert/alert.md) |
14
14
  | Attention | `<w-attention>` | `attention` | Attention is a versatile component for displaying contextual information and messages. It can be used for a wide range of purposes, such as tooltips, callouts, popovers, and highlights. The component is designed to be anchored to a trigger element, providing contextual information related to that element. It supports various placements and styling options to accommodate different use cases and design needs. Note: attention will soon be split into multiple components (tooltip, callout, popover, highlight) at which time this component will be deprecated. For now, use the `tooltip`, `callout`, `popover`, and `highlight` boolean properties to achieve the desired style and behavior. | [attention.md](./attention/attention.md) |
15
15
  | Badge | `<w-badge>` | `badge` | `w-badge` is used for showing a small amount of non-interactive color-categorized metadata, like a status or count. | [badge.md](./badge/badge.md) |
@@ -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)