@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.
- package/dist/custom-elements.json +179 -159
- package/dist/docs/affix/affix.md +117 -0
- package/dist/docs/affix/styling.md +107 -0
- package/dist/docs/breadcrumbs/breadcrumbs.md +67 -4
- package/dist/docs/breadcrumbs/styling.md +67 -4
- package/dist/docs/index.md +1 -1
- package/dist/docs/select/select.md +91 -0
- package/dist/docs/select/styling.md +91 -0
- package/dist/docs/textarea/styling.md +91 -0
- package/dist/docs/textarea/textarea.md +91 -0
- package/dist/docs/textfield/api.md +8 -0
- package/dist/docs/textfield/styling.md +95 -0
- package/dist/docs/textfield/textfield.md +103 -0
- package/dist/index.d.ts +90 -64
- package/dist/packages/affix/affix-styles.d.ts +8 -0
- package/dist/packages/affix/affix-styles.js +108 -0
- package/dist/packages/affix/affix.d.ts +11 -8
- package/dist/packages/affix/affix.js +118 -17
- package/dist/packages/affix/affix.js.map +4 -4
- package/dist/packages/affix/affix.react.stories.d.ts +1 -1
- package/dist/packages/affix/react.d.ts +1 -1
- package/dist/packages/alert/alert.js.map +1 -1
- package/dist/packages/attention/attention.js.map +1 -1
- package/dist/packages/breadcrumb-item/breadcrumb-item.js +16 -7
- package/dist/packages/breadcrumb-item/breadcrumb-item.js.map +2 -2
- package/dist/packages/breadcrumb-item/styles.js +14 -5
- package/dist/packages/button/button.react.stories.d.ts +2 -2
- package/dist/packages/button/react.d.ts +1 -1
- package/dist/packages/checkbox-group/react.d.ts +1 -1
- package/dist/packages/combobox/combobox.react.stories.d.ts +2 -2
- package/dist/packages/combobox/react.d.ts +1 -1
- package/dist/packages/datepicker/datepicker.js.map +1 -1
- package/dist/packages/datepicker/datepicker.react.stories.d.ts +2 -2
- package/dist/packages/datepicker/react.d.ts +1 -1
- package/dist/packages/expandable/expandable.js.map +1 -1
- package/dist/packages/icon/icon.js +2 -2
- package/dist/packages/icon/icon.js.map +1 -1
- package/dist/packages/icon/icon.react.stories.d.ts +2 -1
- package/dist/packages/icon/icon.react.stories.js +1 -1
- package/dist/packages/modal-header/modal-header.js.map +1 -1
- package/dist/packages/pagination/pagination.js.map +1 -1
- package/dist/packages/pill/pill.js.map +1 -1
- package/dist/packages/radio-group/react.d.ts +1 -1
- package/dist/packages/select/input-styles.d.ts +11 -0
- package/dist/packages/select/input-styles.js +88 -0
- package/dist/packages/select/react.d.ts +1 -1
- package/dist/packages/select/select.js +96 -19
- package/dist/packages/select/select.js.map +4 -4
- package/dist/packages/select/select.react.stories.d.ts +2 -2
- package/dist/packages/slider/react.d.ts +1 -1
- package/dist/packages/slider/slider.react.stories.d.ts +1 -1
- package/dist/packages/slider-thumb/react.d.ts +1 -1
- package/dist/packages/snackbar/snackbar.d.ts +2 -2
- package/dist/packages/snackbar/snackbar.js +1 -1
- package/dist/packages/snackbar/snackbar.js.map +2 -2
- package/dist/packages/step/step.js.map +1 -1
- package/dist/packages/textarea/input-styles.d.ts +11 -0
- package/dist/packages/textarea/input-styles.js +88 -0
- package/dist/packages/textarea/react.d.ts +1 -1
- package/dist/packages/textarea/textarea.js +99 -20
- package/dist/packages/textarea/textarea.js.map +4 -4
- package/dist/packages/textarea/textarea.react.stories.d.ts +2 -2
- package/dist/packages/textfield/input-styles.d.ts +11 -0
- package/dist/packages/textfield/input-styles.js +88 -0
- package/dist/packages/textfield/locales/da/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/da/messages.mjs +1 -0
- package/dist/packages/textfield/locales/en/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/en/messages.mjs +1 -0
- package/dist/packages/textfield/locales/fi/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/fi/messages.mjs +1 -0
- package/dist/packages/textfield/locales/nb/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/nb/messages.mjs +1 -0
- package/dist/packages/textfield/locales/sv/messages.d.mts +1 -0
- package/dist/packages/textfield/locales/sv/messages.mjs +1 -0
- package/dist/packages/textfield/react.d.ts +1 -1
- package/dist/packages/textfield/textfield.d.ts +11 -1
- package/dist/packages/textfield/textfield.js +111 -24
- package/dist/packages/textfield/textfield.js.map +4 -4
- package/dist/packages/textfield/textfield.react.stories.d.ts +2 -2
- package/dist/packages/toast/toast.js.map +1 -1
- package/dist/web-types.json +60 -50
- package/eik/index.js +20 -20
- package/package.json +1 -1
|
@@ -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)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WarpIcon, WIcon } from "./packages/icon/icon.ts";
|
|
2
1
|
import type { WarpTextField } from "./packages/textfield/textfield.ts";
|
|
2
|
+
import type { WarpIcon, WIcon } from "./packages/icon/icon.ts";
|
|
3
3
|
import type { WarpAffix } from "./packages/affix/affix.ts";
|
|
4
4
|
import type { WarpAlert } from "./packages/alert/alert.ts";
|
|
5
5
|
import type { WarpLink } from "./packages/link/link.ts";
|
|
@@ -237,33 +237,6 @@ type BaseEvents = {
|
|
|
237
237
|
onPaste?: (event: ClipboardEvent) => void;
|
|
238
238
|
};
|
|
239
239
|
|
|
240
|
-
export type WarpIconProps = {
|
|
241
|
-
/** Icon filename (without .svg) */
|
|
242
|
-
name?: WarpIcon["name"];
|
|
243
|
-
/** Size: small, medium, large or pixel value (e.g. "32px"). */
|
|
244
|
-
size?: WarpIcon["size"];
|
|
245
|
-
/** Locale used for `<title>` text.
|
|
246
|
-
|
|
247
|
-
Reads the `lang` attribute from `<html>`, falls back to 'en'. */
|
|
248
|
-
locale?: WarpIcon["locale"];
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
export type WarpIconSolidJsProps = {
|
|
252
|
-
/** Icon filename (without .svg) */
|
|
253
|
-
"prop:name"?: WarpIcon["name"];
|
|
254
|
-
/** Size: small, medium, large or pixel value (e.g. "32px"). */
|
|
255
|
-
"prop:size"?: WarpIcon["size"];
|
|
256
|
-
/** Locale used for `<title>` text.
|
|
257
|
-
|
|
258
|
-
Reads the `lang` attribute from `<html>`, falls back to 'en'. */
|
|
259
|
-
"prop:locale"?: WarpIcon["locale"];
|
|
260
|
-
|
|
261
|
-
/** Set the innerHTML of the element */
|
|
262
|
-
innerHTML?: string;
|
|
263
|
-
/** Set the textContent of the element */
|
|
264
|
-
textContent?: string | number;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
240
|
export type WarpTextFieldProps = {
|
|
268
241
|
/** Keep in mind that using disabled in its current form is an anti-pattern.
|
|
269
242
|
|
|
@@ -281,6 +254,8 @@ or on its own to show a help text. */
|
|
|
281
254
|
/** Use in combination with `invalid` to show as a validation error message,
|
|
282
255
|
or on its own to show a help text. */
|
|
283
256
|
helpText?: WarpTextField["helpText"];
|
|
257
|
+
/** Whether to show the optional indicator after the label. */
|
|
258
|
+
optional?: WarpTextField["optional"];
|
|
284
259
|
/** Sets the [size](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#size) (width) of the input field to fit the expected length of inputs. */
|
|
285
260
|
size?: WarpTextField["size"];
|
|
286
261
|
/** Use with `type="number"` to set the [maximum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#maxlength). */
|
|
@@ -350,6 +325,8 @@ or on its own to show a help text. */
|
|
|
350
325
|
/** Use in combination with `invalid` to show as a validation error message,
|
|
351
326
|
or on its own to show a help text. */
|
|
352
327
|
"prop:helpText"?: WarpTextField["helpText"];
|
|
328
|
+
/** Whether to show the optional indicator after the label. */
|
|
329
|
+
"prop:optional"?: WarpTextField["optional"];
|
|
353
330
|
/** Sets the [size](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#size) (width) of the input field to fit the expected length of inputs. */
|
|
354
331
|
"prop:size"?: WarpTextField["size"];
|
|
355
332
|
/** Use with `type="number"` to set the [maximum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#maxlength). */
|
|
@@ -407,6 +384,33 @@ similar to the accessible input [masking example from Filament Group](https://fi
|
|
|
407
384
|
textContent?: string | number;
|
|
408
385
|
};
|
|
409
386
|
|
|
387
|
+
export type WarpIconProps = {
|
|
388
|
+
/** Icon filename (without .svg) */
|
|
389
|
+
name?: WarpIcon["name"];
|
|
390
|
+
/** Size: small, medium, large or pixel value (e.g. "32px"). */
|
|
391
|
+
size?: WarpIcon["size"];
|
|
392
|
+
/** Locale used for `<title>` text.
|
|
393
|
+
|
|
394
|
+
Reads the `lang` attribute from `<html>`, falls back to 'en'. */
|
|
395
|
+
locale?: WarpIcon["locale"];
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
export type WarpIconSolidJsProps = {
|
|
399
|
+
/** Icon filename (without .svg) */
|
|
400
|
+
"prop:name"?: WarpIcon["name"];
|
|
401
|
+
/** Size: small, medium, large or pixel value (e.g. "32px"). */
|
|
402
|
+
"prop:size"?: WarpIcon["size"];
|
|
403
|
+
/** Locale used for `<title>` text.
|
|
404
|
+
|
|
405
|
+
Reads the `lang` attribute from `<html>`, falls back to 'en'. */
|
|
406
|
+
"prop:locale"?: WarpIcon["locale"];
|
|
407
|
+
|
|
408
|
+
/** Set the innerHTML of the element */
|
|
409
|
+
innerHTML?: string;
|
|
410
|
+
/** Set the textContent of the element */
|
|
411
|
+
textContent?: string | number;
|
|
412
|
+
};
|
|
413
|
+
|
|
410
414
|
export type WarpAffixProps = {
|
|
411
415
|
/** */
|
|
412
416
|
"aria-label"?: WarpAffix["ariaLabel"];
|
|
@@ -2312,21 +2316,6 @@ Placeholder text should not be used as a substitute for labeling the element wit
|
|
|
2312
2316
|
};
|
|
2313
2317
|
|
|
2314
2318
|
export type CustomElements = {
|
|
2315
|
-
/**
|
|
2316
|
-
*
|
|
2317
|
-
*
|
|
2318
|
-
* ## Attributes & Properties
|
|
2319
|
-
*
|
|
2320
|
-
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
2321
|
-
*
|
|
2322
|
-
* - `name`: Icon filename (without .svg)
|
|
2323
|
-
* - `size`: Size: small, medium, large or pixel value (e.g. "32px").
|
|
2324
|
-
* - `locale`: Locale used for `<title>` text.
|
|
2325
|
-
*
|
|
2326
|
-
* Reads the `lang` attribute from `<html>`, falls back to 'en'.
|
|
2327
|
-
*/
|
|
2328
|
-
"w-icon": Partial<WarpIconProps & BaseProps<WarpIcon> & BaseEvents>;
|
|
2329
|
-
|
|
2330
2319
|
/**
|
|
2331
2320
|
* A single-line input component used for entering and editing textual or numeric data.
|
|
2332
2321
|
*
|
|
@@ -2343,6 +2332,7 @@ export type CustomElements = {
|
|
|
2343
2332
|
* - `label`: Either a `label` or an `aria-label` must be provided.
|
|
2344
2333
|
* - `help-text`/`helpText`: Use in combination with `invalid` to show as a validation error message,
|
|
2345
2334
|
* or on its own to show a help text.
|
|
2335
|
+
* - `optional`: Whether to show the optional indicator after the label.
|
|
2346
2336
|
* - `size`: Sets the [size](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#size) (width) of the input field to fit the expected length of inputs.
|
|
2347
2337
|
* - `max`: Use with `type="number"` to set the [maximum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#maxlength).
|
|
2348
2338
|
* - `min`: Use with `type="number"` to set the [minimum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#minlength).
|
|
@@ -2375,7 +2365,7 @@ export type CustomElements = {
|
|
|
2375
2365
|
* Areas where markup can be added to the component.
|
|
2376
2366
|
*
|
|
2377
2367
|
* - `suffix`: Use with `<w-affix>` to include a suffix, for example the unit for a number (e. g. km or sek).
|
|
2378
|
-
* - `prefix`: Use with `<w-affix>` to include a prefix, for example a search icon.
|
|
2368
|
+
* - `prefix`: Use with `<w-affix>` to include a prefix, for example a search icon. ## Accessibility Note for Affixes Due to shadow DOM boundaries, affix content cannot be connected to the input via ARIA references. For non-interactive affixes (text labels like currency symbols), consider including that information in the main label or placeholder text instead for better screen reader support.
|
|
2379
2369
|
*
|
|
2380
2370
|
* ## Methods
|
|
2381
2371
|
*
|
|
@@ -2390,9 +2380,34 @@ export type CustomElements = {
|
|
|
2390
2380
|
WarpTextFieldProps & BaseProps<WarpTextField> & BaseEvents
|
|
2391
2381
|
>;
|
|
2392
2382
|
|
|
2383
|
+
/**
|
|
2384
|
+
*
|
|
2385
|
+
*
|
|
2386
|
+
* ## Attributes & Properties
|
|
2387
|
+
*
|
|
2388
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
2389
|
+
*
|
|
2390
|
+
* - `name`: Icon filename (without .svg)
|
|
2391
|
+
* - `size`: Size: small, medium, large or pixel value (e.g. "32px").
|
|
2392
|
+
* - `locale`: Locale used for `<title>` text.
|
|
2393
|
+
*
|
|
2394
|
+
* Reads the `lang` attribute from `<html>`, falls back to 'en'.
|
|
2395
|
+
*/
|
|
2396
|
+
"w-icon": Partial<WarpIconProps & BaseProps<WarpIcon> & BaseEvents>;
|
|
2397
|
+
|
|
2393
2398
|
/**
|
|
2394
2399
|
* This component is usually used in other components like form elements to show a prefix or suffix. See for example `w-textfield`.
|
|
2395
2400
|
*
|
|
2401
|
+
* ## Accessibility Note
|
|
2402
|
+
* Due to shadow DOM encapsulation, ARIA attributes (like `aria-describedby`, `aria-labelledby`)
|
|
2403
|
+
* cannot reference elements across shadow boundaries. This means:
|
|
2404
|
+
* - Non-interactive affixes (text labels, icons) cannot be connected to the parent input via ARIA
|
|
2405
|
+
* - Interactive affixes (buttons) must have their own `aria-label` (already implemented)
|
|
2406
|
+
* - Do NOT attempt to reference affix content from parent components via ARIA ID references - it won't work
|
|
2407
|
+
*
|
|
2408
|
+
* For non-interactive labels (e.g., currency symbols), consider including the information in the
|
|
2409
|
+
* main label or placeholder instead of relying on ARIA to announce affix content.
|
|
2410
|
+
*
|
|
2396
2411
|
* [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/forms-affix--docs)
|
|
2397
2412
|
*
|
|
2398
2413
|
* ## Attributes & Properties
|
|
@@ -3502,8 +3517,8 @@ type ReactCustomElementProps<T extends HTMLElement, Props> = Omit<
|
|
|
3502
3517
|
Props;
|
|
3503
3518
|
|
|
3504
3519
|
type CustomElementInstances = {
|
|
3505
|
-
"w-icon": WarpIcon;
|
|
3506
3520
|
"w-textfield": WarpTextField;
|
|
3521
|
+
"w-icon": WarpIcon;
|
|
3507
3522
|
"w-affix": WarpAffix;
|
|
3508
3523
|
"w-alert": WarpAlert;
|
|
3509
3524
|
"w-link": WarpLink;
|
|
@@ -3542,8 +3557,8 @@ type CustomElementInstances = {
|
|
|
3542
3557
|
};
|
|
3543
3558
|
|
|
3544
3559
|
type CustomElementComponentProps = {
|
|
3545
|
-
"w-icon": WarpIconProps;
|
|
3546
3560
|
"w-textfield": WarpTextFieldProps;
|
|
3561
|
+
"w-icon": WarpIconProps;
|
|
3547
3562
|
"w-affix": WarpAffixProps;
|
|
3548
3563
|
"w-alert": WarpAlertProps;
|
|
3549
3564
|
"w-link": WarpLinkProps;
|
|
@@ -3588,23 +3603,6 @@ export type ReactCustomElements = {
|
|
|
3588
3603
|
};
|
|
3589
3604
|
|
|
3590
3605
|
export type CustomElementsSolidJs = {
|
|
3591
|
-
/**
|
|
3592
|
-
*
|
|
3593
|
-
*
|
|
3594
|
-
* ## Attributes & Properties
|
|
3595
|
-
*
|
|
3596
|
-
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
3597
|
-
*
|
|
3598
|
-
* - `name`: Icon filename (without .svg)
|
|
3599
|
-
* - `size`: Size: small, medium, large or pixel value (e.g. "32px").
|
|
3600
|
-
* - `locale`: Locale used for `<title>` text.
|
|
3601
|
-
*
|
|
3602
|
-
* Reads the `lang` attribute from `<html>`, falls back to 'en'.
|
|
3603
|
-
*/
|
|
3604
|
-
"w-icon": Partial<
|
|
3605
|
-
WarpIconProps & WarpIconSolidJsProps & BaseProps<WarpIcon> & BaseEvents
|
|
3606
|
-
>;
|
|
3607
|
-
|
|
3608
3606
|
/**
|
|
3609
3607
|
* A single-line input component used for entering and editing textual or numeric data.
|
|
3610
3608
|
*
|
|
@@ -3621,6 +3619,7 @@ export type CustomElementsSolidJs = {
|
|
|
3621
3619
|
* - `label`: Either a `label` or an `aria-label` must be provided.
|
|
3622
3620
|
* - `help-text`/`helpText`: Use in combination with `invalid` to show as a validation error message,
|
|
3623
3621
|
* or on its own to show a help text.
|
|
3622
|
+
* - `optional`: Whether to show the optional indicator after the label.
|
|
3624
3623
|
* - `size`: Sets the [size](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#size) (width) of the input field to fit the expected length of inputs.
|
|
3625
3624
|
* - `max`: Use with `type="number"` to set the [maximum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#maxlength).
|
|
3626
3625
|
* - `min`: Use with `type="number"` to set the [minimum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#minlength).
|
|
@@ -3653,7 +3652,7 @@ export type CustomElementsSolidJs = {
|
|
|
3653
3652
|
* Areas where markup can be added to the component.
|
|
3654
3653
|
*
|
|
3655
3654
|
* - `suffix`: Use with `<w-affix>` to include a suffix, for example the unit for a number (e. g. km or sek).
|
|
3656
|
-
* - `prefix`: Use with `<w-affix>` to include a prefix, for example a search icon.
|
|
3655
|
+
* - `prefix`: Use with `<w-affix>` to include a prefix, for example a search icon. ## Accessibility Note for Affixes Due to shadow DOM boundaries, affix content cannot be connected to the input via ARIA references. For non-interactive affixes (text labels like currency symbols), consider including that information in the main label or placeholder text instead for better screen reader support.
|
|
3657
3656
|
*
|
|
3658
3657
|
* ## Methods
|
|
3659
3658
|
*
|
|
@@ -3671,9 +3670,36 @@ export type CustomElementsSolidJs = {
|
|
|
3671
3670
|
BaseEvents
|
|
3672
3671
|
>;
|
|
3673
3672
|
|
|
3673
|
+
/**
|
|
3674
|
+
*
|
|
3675
|
+
*
|
|
3676
|
+
* ## Attributes & Properties
|
|
3677
|
+
*
|
|
3678
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
3679
|
+
*
|
|
3680
|
+
* - `name`: Icon filename (without .svg)
|
|
3681
|
+
* - `size`: Size: small, medium, large or pixel value (e.g. "32px").
|
|
3682
|
+
* - `locale`: Locale used for `<title>` text.
|
|
3683
|
+
*
|
|
3684
|
+
* Reads the `lang` attribute from `<html>`, falls back to 'en'.
|
|
3685
|
+
*/
|
|
3686
|
+
"w-icon": Partial<
|
|
3687
|
+
WarpIconProps & WarpIconSolidJsProps & BaseProps<WarpIcon> & BaseEvents
|
|
3688
|
+
>;
|
|
3689
|
+
|
|
3674
3690
|
/**
|
|
3675
3691
|
* This component is usually used in other components like form elements to show a prefix or suffix. See for example `w-textfield`.
|
|
3676
3692
|
*
|
|
3693
|
+
* ## Accessibility Note
|
|
3694
|
+
* Due to shadow DOM encapsulation, ARIA attributes (like `aria-describedby`, `aria-labelledby`)
|
|
3695
|
+
* cannot reference elements across shadow boundaries. This means:
|
|
3696
|
+
* - Non-interactive affixes (text labels, icons) cannot be connected to the parent input via ARIA
|
|
3697
|
+
* - Interactive affixes (buttons) must have their own `aria-label` (already implemented)
|
|
3698
|
+
* - Do NOT attempt to reference affix content from parent components via ARIA ID references - it won't work
|
|
3699
|
+
*
|
|
3700
|
+
* For non-interactive labels (e.g., currency symbols), consider including the information in the
|
|
3701
|
+
* main label or placeholder instead of relying on ARIA to announce affix content.
|
|
3702
|
+
*
|
|
3677
3703
|
* [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/forms-affix--docs)
|
|
3678
3704
|
*
|
|
3679
3705
|
* ## Attributes & Properties
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Affix component styles using the internal token pattern with a public styling API.
|
|
4
|
+
*
|
|
5
|
+
* Public API tokens (customizable):
|
|
6
|
+
* - Wrapper: --w-c-affix-*
|
|
7
|
+
* - Label: --w-c-affix-label-*
|
|
8
|
+
*/
|
|
9
|
+
export const affixStyles = css `
|
|
10
|
+
/* Wrapper component tokens with semantic fallbacks */
|
|
11
|
+
:host {
|
|
12
|
+
/* Internal tokens - not part of public API */
|
|
13
|
+
--_wrapper-bg: var(--w-c-affix-wrapper-bg, transparent);
|
|
14
|
+
--_wrapper-border-radius: var(--w-c-affix-wrapper-border-radius, 0.4rem);
|
|
15
|
+
--_wrapper-padding-left: var(--w-c-affix-wrapper-padding-left, 1.2rem);
|
|
16
|
+
--_wrapper-padding-right: var(--w-c-affix-wrapper-padding-right, 1.2rem);
|
|
17
|
+
--_wrapper-width-with-label: var(
|
|
18
|
+
--w-c-affix-wrapper-width-with-label,
|
|
19
|
+
max-content
|
|
20
|
+
);
|
|
21
|
+
--_wrapper-width-with-icon: var(--w-c-affix-wrapper-width-with-icon, 4rem);
|
|
22
|
+
|
|
23
|
+
/* Label tokens */
|
|
24
|
+
--_label-color: var(--w-c-affix-label-color, var(--w-s-color-text));
|
|
25
|
+
--_label-font-size: var(--w-c-affix-label-font-size, var(--w-font-size-xs));
|
|
26
|
+
--_label-line-height: var(
|
|
27
|
+
--w-c-affix-label-line-height,
|
|
28
|
+
var(--w-line-height-xs)
|
|
29
|
+
);
|
|
30
|
+
--_label-font-weight: var(--w-c-affix-label-font-weight, 700);
|
|
31
|
+
--_label-cursor: var(--w-c-affix-label-cursor, default);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Base wrapper styles (applied to all variants) */
|
|
35
|
+
[part="wrapper"] {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 0;
|
|
38
|
+
bottom: 0;
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
background-color: var(--_wrapper-bg);
|
|
43
|
+
border-radius: var(--_wrapper-border-radius);
|
|
44
|
+
-webkit-font-smoothing: antialiased;
|
|
45
|
+
-moz-osx-font-smoothing: grayscale;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Prefix positioning */
|
|
49
|
+
:host([slot="prefix"]) [part="wrapper"] {
|
|
50
|
+
left: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Suffix positioning */
|
|
54
|
+
:host([slot="suffix"]) [part="wrapper"] {
|
|
55
|
+
right: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Width variants */
|
|
59
|
+
[part="wrapper"].has-label {
|
|
60
|
+
width: var(--_wrapper-width-with-label);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host([slot="prefix"]) [part="wrapper"].has-label {
|
|
64
|
+
padding-left: var(--_wrapper-padding-left);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host([slot="suffix"]) [part="wrapper"].has-label {
|
|
68
|
+
padding-right: var(--_wrapper-padding-right);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[part="wrapper"].has-icon {
|
|
72
|
+
width: var(--_wrapper-width-with-icon);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Label styling */
|
|
76
|
+
[part="label"] {
|
|
77
|
+
display: block;
|
|
78
|
+
position: relative;
|
|
79
|
+
font-size: var(--_label-font-size);
|
|
80
|
+
line-height: var(--_label-line-height);
|
|
81
|
+
font-weight: var(--_label-font-weight);
|
|
82
|
+
color: var(--_label-color);
|
|
83
|
+
cursor: var(--_label-cursor);
|
|
84
|
+
padding-bottom: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Button wrapper for interactive variants */
|
|
88
|
+
button[part="wrapper"] {
|
|
89
|
+
border: none;
|
|
90
|
+
outline: none;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Focus styles for interactive variants */
|
|
95
|
+
button[part="wrapper"]:focus {
|
|
96
|
+
outline: 2px solid var(--w-s-color-border-focus);
|
|
97
|
+
outline-offset: var(--w-outline-offset, -2px);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
button[part="wrapper"]:focus-visible {
|
|
101
|
+
outline: 2px solid var(--w-s-color-border-focus);
|
|
102
|
+
outline-offset: var(--w-outline-offset, -2px);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
button[part="wrapper"]:not(:focus-visible) {
|
|
106
|
+
outline: none;
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
@@ -4,6 +4,16 @@ declare const WarpAffix_base: import("@open-wc/form-control").Constructor<import
|
|
|
4
4
|
/**
|
|
5
5
|
* This component is usually used in other components like form elements to show a prefix or suffix. See for example `w-textfield`.
|
|
6
6
|
*
|
|
7
|
+
* ## Accessibility Note
|
|
8
|
+
* Due to shadow DOM encapsulation, ARIA attributes (like `aria-describedby`, `aria-labelledby`)
|
|
9
|
+
* cannot reference elements across shadow boundaries. This means:
|
|
10
|
+
* - Non-interactive affixes (text labels, icons) cannot be connected to the parent input via ARIA
|
|
11
|
+
* - Interactive affixes (buttons) must have their own `aria-label` (already implemented)
|
|
12
|
+
* - Do NOT attempt to reference affix content from parent components via ARIA ID references - it won't work
|
|
13
|
+
*
|
|
14
|
+
* For non-interactive labels (e.g., currency symbols), consider including the information in the
|
|
15
|
+
* main label or placeholder instead of relying on ARIA to announce affix content.
|
|
16
|
+
*
|
|
7
17
|
* [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/forms-affix--docs)
|
|
8
18
|
*/
|
|
9
19
|
declare class WarpAffix extends WarpAffix_base {
|
|
@@ -40,14 +50,7 @@ declare class WarpAffix extends WarpAffix_base {
|
|
|
40
50
|
icon: string | null;
|
|
41
51
|
static styles: import("lit").CSSResult[];
|
|
42
52
|
/** @internal */
|
|
43
|
-
get
|
|
44
|
-
wrapper: string;
|
|
45
|
-
wrapperWithLabel: string;
|
|
46
|
-
wrapperWithIcon: string;
|
|
47
|
-
label: string;
|
|
48
|
-
};
|
|
49
|
-
/** @internal */
|
|
50
|
-
get _classes(): string;
|
|
53
|
+
get _wrapperClasses(): string;
|
|
51
54
|
/** @internal */
|
|
52
55
|
resetContainingTextField(e: Event): void;
|
|
53
56
|
/** @internal */
|