@warp-ds/elements 2.9.0-next.4 → 2.9.0-next.6

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 (99) hide show
  1. package/dist/custom-elements.json +3554 -3442
  2. package/dist/docs/affix/accessibility.md +7 -0
  3. package/dist/docs/affix/affix.md +174 -10
  4. package/dist/docs/affix/api.md +28 -10
  5. package/dist/docs/affix/examples.md +92 -0
  6. package/dist/docs/affix/usage.md +47 -0
  7. package/dist/docs/alert/alert.md +12 -12
  8. package/dist/docs/alert/api.md +12 -12
  9. package/dist/docs/attention/api.md +46 -46
  10. package/dist/docs/attention/attention.md +46 -46
  11. package/dist/docs/badge/accessibility.md +44 -0
  12. package/dist/docs/badge/api.md +12 -8
  13. package/dist/docs/badge/badge.md +191 -10
  14. package/dist/docs/badge/examples.md +82 -0
  15. package/dist/docs/badge/usage.md +53 -0
  16. package/dist/docs/button/api.md +46 -42
  17. package/dist/docs/button/button.md +46 -42
  18. package/dist/docs/card/api.md +11 -11
  19. package/dist/docs/card/card.md +11 -11
  20. package/dist/docs/combobox/api.md +62 -62
  21. package/dist/docs/combobox/combobox.md +62 -62
  22. package/dist/docs/datepicker/api.md +74 -66
  23. package/dist/docs/datepicker/datepicker.md +74 -66
  24. package/dist/docs/expandable/api.md +26 -26
  25. package/dist/docs/expandable/expandable.md +26 -26
  26. package/dist/docs/link/api.md +28 -28
  27. package/dist/docs/link/link.md +28 -28
  28. package/dist/docs/page-indicator/api.md +6 -6
  29. package/dist/docs/page-indicator/page-indicator.md +6 -6
  30. package/dist/docs/pagination/api.md +3 -3
  31. package/dist/docs/pagination/pagination.md +3 -3
  32. package/dist/docs/pill/api.md +19 -15
  33. package/dist/docs/pill/pill.md +19 -15
  34. package/dist/docs/select/api.md +44 -44
  35. package/dist/docs/select/select.md +44 -44
  36. package/dist/docs/slider/api.md +80 -78
  37. package/dist/docs/slider/slider.md +80 -78
  38. package/dist/docs/slider-thumb/api.md +28 -76
  39. package/dist/docs/slider-thumb/slider-thumb.md +28 -76
  40. package/dist/docs/switch/api.md +16 -16
  41. package/dist/docs/switch/switch.md +16 -16
  42. package/dist/docs/tab/api.md +26 -40
  43. package/dist/docs/tab/tab.md +26 -40
  44. package/dist/docs/tab-panel/api.md +1 -17
  45. package/dist/docs/tab-panel/tab-panel.md +1 -17
  46. package/dist/docs/tabs/api.md +3 -3
  47. package/dist/docs/tabs/tabs.md +3 -3
  48. package/dist/docs/textarea/api.md +42 -40
  49. package/dist/docs/textarea/textarea.md +42 -40
  50. package/dist/docs/textfield/accessibility.md +15 -0
  51. package/dist/docs/textfield/api.md +86 -83
  52. package/dist/docs/textfield/examples.md +147 -0
  53. package/dist/docs/textfield/textfield.md +279 -86
  54. package/dist/docs/textfield/usage.md +30 -0
  55. package/dist/index.d.ts +343 -319
  56. package/dist/packages/affix/affix.d.ts +23 -14
  57. package/dist/packages/affix/affix.js +24 -11
  58. package/dist/packages/affix/affix.js.map +4 -4
  59. package/dist/packages/affix/affix.stories.d.ts +3 -0
  60. package/dist/packages/affix/affix.stories.js +16 -0
  61. package/dist/packages/affix/affix.test.js +7 -0
  62. package/dist/packages/affix/locales/da/messages.d.mts +1 -0
  63. package/dist/packages/affix/locales/da/messages.mjs +1 -0
  64. package/dist/packages/affix/locales/en/messages.d.mts +1 -0
  65. package/dist/packages/affix/locales/en/messages.mjs +1 -0
  66. package/dist/packages/affix/locales/fi/messages.d.mts +1 -0
  67. package/dist/packages/affix/locales/fi/messages.mjs +1 -0
  68. package/dist/packages/affix/locales/nb/messages.d.mts +1 -0
  69. package/dist/packages/affix/locales/nb/messages.mjs +1 -0
  70. package/dist/packages/affix/locales/sv/messages.d.mts +1 -0
  71. package/dist/packages/affix/locales/sv/messages.mjs +1 -0
  72. package/dist/packages/badge/badge.d.ts +7 -5
  73. package/dist/packages/badge/badge.js.map +2 -2
  74. package/dist/packages/badge/badge.react.stories.d.ts +1 -1
  75. package/dist/packages/box/box.react.stories.d.ts +1 -1
  76. package/dist/packages/breadcrumbs/breadcrumbs.react.stories.d.ts +1 -1
  77. package/dist/packages/button/button.react.stories.d.ts +1 -1
  78. package/dist/packages/card/card.react.stories.d.ts +1 -1
  79. package/dist/packages/combobox/combobox.react.stories.d.ts +1 -1
  80. package/dist/packages/datepicker/datepicker.js +1 -1
  81. package/dist/packages/datepicker/datepicker.js.map +2 -2
  82. package/dist/packages/datepicker/datepicker.react.stories.d.ts +9 -1
  83. package/dist/packages/datepicker/react.d.ts +4 -0
  84. package/dist/packages/datepicker/react.js +4 -0
  85. package/dist/packages/expandable/expandable.react.stories.d.ts +1 -1
  86. package/dist/packages/link/link.react.stories.d.ts +1 -1
  87. package/dist/packages/page-indicator/page-indicator.react.stories.d.ts +1 -1
  88. package/dist/packages/pagination/pagination.react.stories.d.ts +1 -1
  89. package/dist/packages/pill/pill.react.stories.d.ts +1 -1
  90. package/dist/packages/select/select.react.stories.d.ts +1 -1
  91. package/dist/packages/textarea/textarea.react.stories.d.ts +1 -1
  92. package/dist/packages/textfield/textfield.d.ts +57 -60
  93. package/dist/packages/textfield/textfield.js +5 -5
  94. package/dist/packages/textfield/textfield.js.map +2 -2
  95. package/dist/packages/textfield/textfield.react.stories.d.ts +1 -1
  96. package/dist/packages/textfield/textfield.stories.d.ts +3 -0
  97. package/dist/packages/textfield/textfield.stories.js +45 -0
  98. package/dist/web-types.json +452 -147
  99. package/package.json +2 -2
@@ -4,126 +4,154 @@
4
4
 
5
5
  | Name | Type | Default | Summary |
6
6
  |-|-|-|-|
7
- | shadowRootOptions | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }` | - |
8
- | disabled | `boolean` | `false` | - |
9
- | invalid | `boolean` | `false` | - |
10
- | id | `string` | `-` | - |
11
- | label | `string` | `-` | - |
12
- | helpText | `string` | `-` | - |
13
- | size | `string` | `-` | - |
14
- | max | `number` | `-` | - |
15
- | min | `number` | `-` | - |
16
- | minLength | `number` | `-` | - |
17
- | maxLength | `number` | `-` | - |
18
- | pattern | `string` | `-` | - |
19
- | placeholder | `string` | `-` | - |
20
- | readOnly | `boolean` | `false` | - |
21
- | readonly | `boolean` | `false` | - |
22
- | required | `boolean` | `false` | - |
23
- | type | `string` | `-` | - |
24
- | value | `string` | `-` | - |
25
- | name | `string` | `-` | - |
26
- | step | `number` | `-` | - |
27
- | autocomplete | `string | undefined` | `-` | - |
28
- | formatter | `(value: string) => string` | `-` | - |
29
- | _hasPrefix | `unknown` | `-` | - |
30
- | _hasSuffix | `unknown` | `-` | - |
7
+ | autocomplete | `string \| undefined` | `-` | A space-separated string that hints to browsers [what type of content it can suggest](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete#value) to autofill. |
8
+ | disabled | `boolean` | `false` | Makes the element not focusable and hides it from form submits |
9
+ | formatter | `(value: string) => string` | `-` | Function to format value when the input field |
10
+ | helpText | `string` | `-` | Description shown below the input field |
11
+ | invalid | `boolean` | `false` | Mark the form field as invalid. |
12
+ | label | `string` | `-` | Either a `label` or an `aria-label` must be provided. |
13
+ | max | `number` | `-` | Use with `type="number"` to set the [maximum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#maxlength). |
14
+ | maxLength | `number` | `-` | **Deprecated**: Use the native `maxlength` attribute |
15
+ | maxlength | `number` | `-` | For `text`, `search`, `url`, `tel`, `email` and `password` fields, sets the [maximum string length](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#maxlength) allowed. |
16
+ | min | `number` | `-` | Use with `type="number"` to set the [minimum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#minlength). |
17
+ | minLength | `number` | `-` | **Deprecated**: Use the native `minlength` attribute |
18
+ | minlength | `number` | `-` | 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. |
19
+ | name | `string` | `-` | The [name](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#name) of the input field when submitting the form. |
20
+ | pattern | `string` | `-` | 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) |
21
+ | placeholder | `string` | `-` | Shown in the textfield when it doesn't have a value |
22
+ | readOnly | `boolean` | `false` | **Deprecated**: Use the native readonly attribute instead. |
23
+ | readonly | `boolean` | `false` | Whether the input can be selected but not changed by the user. |
24
+ | required | `boolean` | `false` | Whether user input is required on the input before form submission. |
25
+ | size | `string` | `-` | 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. |
26
+ | step | `number` | `-` | Forces `number` inputs to be a whole number of `step` |
27
+ | type | `string` | `-` | The [type of input](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types). |
28
+ | value | `string` | `-` | Lets you set the current value. |
31
29
 
32
30
  ### Property Details
33
31
 
34
- #### shadowRootOptions
35
-
32
+ #### autocomplete
36
33
 
34
+ A space-separated string that hints to browsers [what type of content it can suggest](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete#value) to autofill.
37
35
 
38
- - Type: `object`
39
- - Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }`
36
+ - Type: `string \| undefined`
37
+ - Default: `-`
40
38
 
41
39
  #### disabled
42
40
 
41
+ Keep in mind that using disabled in its current form is an anti-pattern.
43
42
 
43
+ There will always be users who don't understand why an element is disabled, or users who can't even see that it is disabled because of poor lighting conditions or other reasons.
44
+
45
+ Please consider more informative alternatives before choosing to use disabled on an element.
44
46
 
45
47
  - Type: `boolean`
46
48
  - Default: `false`
47
49
 
48
- #### invalid
49
-
50
+ #### formatter
50
51
 
52
+ Function to format value when the input field.
51
53
 
52
- - Type: `boolean`
53
- - Default: `false`
54
+ Only active when the input field does not have focus,
55
+ similar to the accessible input [masking example from Filament Group](https://filamentgroup.github.io/politespace/demo/demo.html).
54
56
 
55
- #### id
57
+ - Type: `(value: string) => string`
58
+ - Default: `-`
56
59
 
60
+ #### helpText
57
61
 
62
+ Use in combination with `invalid` to show as a validation error message,
63
+ or on its own to show a help text.
58
64
 
59
65
  - Type: `string`
60
66
  - Default: `-`
61
67
 
62
- #### label
68
+ #### invalid
69
+
70
+ Mark the form field as invalid. Make sure to also set a `help-text` to help users fix the validation problem.
71
+
72
+ - Type: `boolean`
73
+ - Default: `false`
63
74
 
75
+ #### label
64
76
 
77
+ Either a `label` or an `aria-label` must be provided.
65
78
 
66
79
  - Type: `string`
67
80
  - Default: `-`
68
81
 
69
- #### helpText
70
-
82
+ #### max
71
83
 
84
+ Use with `type="number"` to set the [maximum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#maxlength).
72
85
 
73
- - Type: `string`
86
+ - Type: `number`
74
87
  - Default: `-`
75
88
 
76
- #### size
89
+ #### maxLength
77
90
 
91
+ **Deprecated**: Use the native `maxlength` attribute
78
92
 
79
93
 
80
- - Type: `string`
81
- - Default: `-`
82
94
 
83
- #### max
95
+ - Type: `number`
96
+ - Default: `-`
84
97
 
98
+ #### maxlength
85
99
 
100
+ For `text`, `search`, `url`, `tel`, `email` and `password` fields, sets the [maximum string length](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#maxlength) allowed.
86
101
 
87
102
  - Type: `number`
88
103
  - Default: `-`
89
104
 
90
105
  #### min
91
106
 
92
-
107
+ Use with `type="number"` to set the [minimum allowed value](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#minlength).
93
108
 
94
109
  - Type: `number`
95
110
  - Default: `-`
96
111
 
97
112
  #### minLength
98
113
 
114
+ **Deprecated**: Use the native `minlength` attribute
115
+
99
116
 
100
117
 
101
118
  - Type: `number`
102
119
  - Default: `-`
103
120
 
104
- #### maxLength
105
-
121
+ #### minlength
106
122
 
123
+ 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.
107
124
 
108
125
  - Type: `number`
109
126
  - Default: `-`
110
127
 
111
- #### pattern
128
+ #### name
112
129
 
130
+ The [name](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#name) of the input field when submitting the form.
113
131
 
132
+ - Type: `string`
133
+ - Default: `-`
134
+
135
+ #### pattern
136
+
137
+ 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)
114
138
 
115
139
  - Type: `string`
116
140
  - Default: `-`
117
141
 
118
142
  #### placeholder
119
143
 
144
+ Set a text that is shown in the textfield when it doesn't have a value.
120
145
 
146
+ Placeholder text should not be used as a substitute for labeling the element with a visible label.
121
147
 
122
148
  - Type: `string`
123
149
  - Default: `-`
124
150
 
125
151
  #### readOnly
126
152
 
153
+ **Deprecated**: Use the native readonly attribute instead.
154
+
127
155
 
128
156
 
129
157
  - Type: `boolean`
@@ -131,72 +159,47 @@
131
159
 
132
160
  #### readonly
133
161
 
134
-
162
+ Whether the input can be selected but not changed by the user.
135
163
 
136
164
  - Type: `boolean`
137
165
  - Default: `false`
138
166
 
139
167
  #### required
140
168
 
141
-
169
+ Whether user input is required on the input before form submission.
142
170
 
143
171
  - Type: `boolean`
144
172
  - Default: `false`
145
173
 
146
- #### type
147
-
148
-
149
-
150
- - Type: `string`
151
- - Default: `-`
152
-
153
- #### value
154
-
155
-
156
-
157
- - Type: `string`
158
- - Default: `-`
159
-
160
- #### name
161
-
174
+ #### size
162
175
 
176
+ 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.
163
177
 
164
178
  - Type: `string`
165
179
  - Default: `-`
166
180
 
167
181
  #### step
168
182
 
183
+ When used with `number` this attribute forces inputs to be a whole number of `step`.
169
184
 
185
+ For example with a `step="5"` only values that divide evenly on 5 are allowed.
186
+ Using arrow up and down in the input field increments and decrements by 5.
170
187
 
171
188
  - Type: `number`
172
189
  - Default: `-`
173
190
 
174
- #### autocomplete
175
-
176
-
177
-
178
- - Type: `string | undefined`
179
- - Default: `-`
180
-
181
- #### formatter
182
-
183
-
184
-
185
- - Type: `(value: string) => string`
186
- - Default: `-`
187
-
188
- #### _hasPrefix
189
-
191
+ #### type
190
192
 
193
+ The [type of input](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types).
191
194
 
192
- - Type: `unknown`
195
+ - Type: `string`
193
196
  - Default: `-`
194
197
 
195
- #### _hasSuffix
196
-
198
+ #### value
197
199
 
200
+ Lets you set the current value.
198
201
 
199
- - Type: `unknown`
202
+ - Type: `string`
200
203
  - Default: `-`
201
204
 
202
205
  ### Types
@@ -1 +1,148 @@
1
1
  ## Examples
2
+
3
+ ### Placeholder
4
+
5
+ Placeholder text can be used to describe the expected value or formatting for the textfield.
6
+
7
+ Placeholder text will only appear when the textfield is empty, and must not be used as a
8
+ substitute for labeling the element with a visible label.
9
+
10
+ <style-isolate>
11
+ <w-textfield label="Email" placeholder="ola.nordmann@finn.no"></w-textfield>
12
+ </style-isolate>
13
+
14
+ ```html
15
+ <w-textfield label="Email" placeholder="ola.nordmann@finn.no"></w-textfield>
16
+ ```
17
+
18
+ ### Prefix label
19
+
20
+ <style-isolate>
21
+ <w-textfield label="Price">
22
+ <w-affix slot="prefix" label="kr"></w-affix>
23
+ </w-textfield>
24
+ </style-isolate>
25
+
26
+ ```html
27
+ <w-textfield label="Price">
28
+ <w-affix slot="prefix" label="kr"></w-affix>
29
+ </w-textfield>
30
+ ```
31
+
32
+ ### Suffix Label
33
+
34
+ <style-isolate>
35
+ <w-textfield label="Price">
36
+ <w-affix slot="suffix" label="kr"></w-affix>
37
+ </w-textfield>
38
+ </style-isolate>
39
+
40
+ ```html
41
+ <w-textfield label="Price">
42
+ <w-affix slot="suffix" label="kr"></w-affix>
43
+ </w-textfield>
44
+ ```
45
+
46
+ ### Prefix Search Icon
47
+
48
+ <style-isolate>
49
+ <w-textfield label="Search">
50
+ <w-affix slot="prefix" search></w-affix>
51
+ </w-textfield>
52
+ </style-isolate>
53
+
54
+ ```html
55
+ <w-textfield label="Search">
56
+ <w-affix slot="prefix" search></w-affix>
57
+ </w-textfield>
58
+ ```
59
+
60
+ ### Suffix Search Icon
61
+
62
+ If you wrap the textfield with affix in a form element, clicking the search button will automatically submit the form
63
+
64
+ <style-isolate>
65
+ <form>
66
+ <w-textfield label="Search">
67
+ <w-affix slot="suffix" search></w-affix>
68
+ </w-textfield>
69
+ </form>
70
+ </style-isolate>
71
+
72
+ ```html
73
+ <form>
74
+ <w-textfield label="Search">
75
+ <w-affix slot="prefix" search></w-affix>
76
+ </w-textfield>
77
+ </form>
78
+ ```
79
+
80
+ ### Suffix Clear Icon
81
+
82
+ Clicking the clear button will reset the textfield
83
+
84
+ <style-isolate>
85
+ <w-textfield label="Search input">
86
+ <w-affix slot="suffix" clear></w-affix>
87
+ </w-textfield>
88
+ </style-isolate>
89
+
90
+ ```html
91
+ <w-textfield label="Search input">
92
+ <w-affix slot="suffix" clear></w-affix>
93
+ </w-textfield>
94
+ ```
95
+
96
+ ### Affix with arbitrary icon
97
+
98
+ <style-isolate>
99
+ <w-textfield label="Award">
100
+ <w-affix slot="prefix" icon="AwardMedal"></w-affix>
101
+ </w-textfield>
102
+ </style-isolate>
103
+
104
+ ```html
105
+ <w-textfield label="Award">
106
+ <w-affix slot="prefix" icon="AwardMedal"></w-affix>
107
+ </w-textfield>
108
+ ```
109
+
110
+ ### Disabled
111
+
112
+ Keep in mind that using disabled in its current form is an anti-pattern.
113
+
114
+ There will always be users who don't understand why an element is disabled, or users who can't even see that
115
+ it is disabled because of poor lighting conditions or other reasons.
116
+
117
+ Please consider more informative alternatives before choosing to use disabled on an element.
118
+
119
+ <style-isolate>
120
+ <div class="flex flex-col space-y-32">
121
+ <w-textfield label="Email" disabled value="ola.nordmann@finn.no"></w-textfield>
122
+ <w-textfield label="Email" disabled></w-textfield>
123
+ </div>
124
+ </style-isolate>
125
+
126
+ ```html
127
+ <div class="flex flex-col space-y-32">
128
+ <w-textfield label="Email" disabled value="ola.nordmann@finn.no"></w-textfield>
129
+ <w-textfield label="Email" disabled></w-textfield>
130
+ </div>
131
+ ```
132
+
133
+ ### Read only
134
+
135
+ The readonly boolean attribute makes the w-textfield's text content immutable. Unlike disabled the w-textfield remains focusable and the contents can still be copied. See [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/readOnly) for more information.
136
+
137
+ <style-isolate>
138
+ <w-textfield label="Email" type="email" value="ola.nordmann@finn.no" readonly></w-textfield>
139
+ </style-isolate>
140
+
141
+ ```html
142
+ <w-textfield
143
+ label="Email"
144
+ type="email"
145
+ value="ola.nordmann@finn.no"
146
+ readonly
147
+ ></w-textfield>
148
+ ```