grommet 2.35.0 → 2.36.0
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/components/Anchor/Anchor.js +1 -4
- package/components/Anchor/StyledAnchor.js +1 -1
- package/components/Box/Box.js +2 -2
- package/components/Box/StyledBox.js +18 -1
- package/components/Box/index.d.ts +1 -1
- package/components/Box/propTypes.js +4 -1
- package/components/Cards/stories/Simple.js +1 -4
- package/components/Data/stories/Cards.js +9 -19
- package/components/Data/stories/Complex.js +1 -4
- package/components/Data/stories/ComposedToolbar.js +74 -0
- package/components/Data/stories/Infinite.js +29 -64
- package/components/Data/stories/Inline.js +1 -9
- package/components/Data/stories/List.js +3 -9
- package/components/Data/stories/Properties.js +17 -22
- package/components/Data/stories/Simple.js +4 -10
- package/components/Data/stories/SpaceX.js +8 -7
- package/components/Data/stories/StarWars.js +6 -12
- package/components/Data/stories/Views.js +4 -11
- package/components/DataFilter/DataFilter.js +1 -0
- package/components/DataFilter/stories/Simple.js +2 -6
- package/components/DataFilters/stories/Drop.js +2 -6
- package/components/DataFilters/stories/Layer.js +2 -6
- package/components/DataFilters/stories/Simple.js +2 -6
- package/components/DataSearch/stories/Drop.js +6 -11
- package/components/DataSearch/stories/Responsive.js +6 -12
- package/components/DataSearch/stories/Simple.js +5 -10
- package/components/DataSearch/stories/UpdateOnSubmit.js +5 -7
- package/components/DataSort/stories/Drop.js +2 -6
- package/components/DataSort/stories/Simple.js +2 -6
- package/components/DataSummary/stories/Simple.js +2 -6
- package/components/DataTableColumns/stories/Simple.js +2 -6
- package/components/DataTableGroupBy/stories/Simple.js +5 -7
- package/components/DataView/stories/Simple.js +4 -6
- package/components/DateInput/DateInput.js +61 -17
- package/components/DateInput/index.d.ts +1 -0
- package/components/DateInput/propTypes.js +1 -0
- package/components/DateInput/stories/ReadOnly.js +36 -0
- package/components/DateInput/utils.js +2 -2
- package/components/Form/Form.js +34 -1
- package/components/FormField/FormField.js +20 -1
- package/components/FormField/README.md +1 -644
- package/components/FormField/index.d.ts +5 -1
- package/components/FormField/propTypes.js +4 -1
- package/components/FormField/stories/ThresholdValidation.js +51 -0
- package/components/Grommet/Grommet.js +1 -1
- package/components/Grommet/index.d.ts +12 -0
- package/components/Grommet/propTypes.js +12 -0
- package/components/Layer/LayerContainer.js +1 -1
- package/components/List/List.js +33 -30
- package/components/Pagination/Pagination.js +52 -9
- package/components/Pagination/PaginationStep.js +41 -0
- package/components/Pagination/PaginationSummary.js +33 -0
- package/components/Pagination/index.d.ts +2 -0
- package/components/Pagination/propTypes.js +3 -1
- package/components/Pagination/stories/Steps.js +40 -0
- package/components/RangeInput/RangeInput.js +19 -12
- package/components/TextInput/CopyButton.js +53 -0
- package/components/TextInput/StyledTextInput.js +13 -2
- package/components/TextInput/TextInput.js +46 -12
- package/components/TextInput/index.d.ts +1 -0
- package/components/TextInput/propTypes.js +1 -0
- package/components/TextInput/stories/ReadOnly.js +43 -0
- package/components/Toolbar/stories/Simple.js +1 -4
- package/es6/components/Anchor/Anchor.js +1 -4
- package/es6/components/Anchor/StyledAnchor.js +1 -1
- package/es6/components/Box/Box.js +2 -2
- package/es6/components/Box/StyledBox.js +18 -1
- package/es6/components/Box/index.d.ts +1 -1
- package/es6/components/Box/propTypes.js +4 -1
- package/es6/components/Cards/stories/Simple.js +2 -5
- package/es6/components/Data/stories/Cards.js +10 -20
- package/es6/components/Data/stories/Complex.js +2 -5
- package/es6/components/Data/stories/ComposedToolbar.js +69 -0
- package/es6/components/Data/stories/Infinite.js +32 -66
- package/es6/components/Data/stories/Inline.js +2 -10
- package/es6/components/Data/stories/List.js +4 -10
- package/es6/components/Data/stories/Properties.js +18 -23
- package/es6/components/Data/stories/Simple.js +5 -11
- package/es6/components/Data/stories/SpaceX.js +9 -8
- package/es6/components/Data/stories/StarWars.js +7 -13
- package/es6/components/Data/stories/Views.js +5 -12
- package/es6/components/DataFilter/DataFilter.js +1 -0
- package/es6/components/DataFilter/stories/Simple.js +2 -6
- package/es6/components/DataFilters/stories/Drop.js +2 -6
- package/es6/components/DataFilters/stories/Layer.js +2 -6
- package/es6/components/DataFilters/stories/Simple.js +2 -6
- package/es6/components/DataSearch/stories/Drop.js +7 -12
- package/es6/components/DataSearch/stories/Responsive.js +7 -13
- package/es6/components/DataSearch/stories/Simple.js +6 -11
- package/es6/components/DataSearch/stories/UpdateOnSubmit.js +6 -8
- package/es6/components/DataSort/stories/Drop.js +2 -6
- package/es6/components/DataSort/stories/Simple.js +2 -6
- package/es6/components/DataSummary/stories/Simple.js +2 -6
- package/es6/components/DataTableColumns/stories/Simple.js +2 -6
- package/es6/components/DataTableGroupBy/stories/Simple.js +5 -7
- package/es6/components/DataView/stories/Simple.js +6 -8
- package/es6/components/DateInput/DateInput.js +61 -17
- package/es6/components/DateInput/index.d.ts +1 -0
- package/es6/components/DateInput/propTypes.js +1 -0
- package/es6/components/DateInput/stories/ReadOnly.js +31 -0
- package/es6/components/DateInput/utils.js +2 -2
- package/es6/components/Form/Form.js +34 -1
- package/es6/components/FormField/FormField.js +21 -2
- package/es6/components/FormField/README.md +1 -644
- package/es6/components/FormField/index.d.ts +5 -1
- package/es6/components/FormField/propTypes.js +4 -1
- package/es6/components/FormField/stories/ThresholdValidation.js +46 -0
- package/es6/components/Grommet/Grommet.js +1 -1
- package/es6/components/Grommet/index.d.ts +12 -0
- package/es6/components/Grommet/propTypes.js +12 -0
- package/es6/components/Layer/LayerContainer.js +1 -1
- package/es6/components/List/List.js +33 -30
- package/es6/components/Pagination/Pagination.js +52 -9
- package/es6/components/Pagination/PaginationStep.js +35 -0
- package/es6/components/Pagination/PaginationSummary.js +27 -0
- package/es6/components/Pagination/index.d.ts +2 -0
- package/es6/components/Pagination/propTypes.js +3 -1
- package/es6/components/Pagination/stories/Steps.js +35 -0
- package/es6/components/RangeInput/RangeInput.js +19 -12
- package/es6/components/TextInput/CopyButton.js +48 -0
- package/es6/components/TextInput/StyledTextInput.js +14 -3
- package/es6/components/TextInput/TextInput.js +46 -12
- package/es6/components/TextInput/index.d.ts +1 -0
- package/es6/components/TextInput/propTypes.js +1 -0
- package/es6/components/TextInput/stories/ReadOnly.js +38 -0
- package/es6/components/Toolbar/stories/Simple.js +2 -5
- package/es6/languages/default.json +23 -0
- package/es6/themes/base.d.ts +8 -0
- package/es6/themes/base.js +12 -1
- package/es6/utils/index.js +1 -0
- package/es6/utils/readOnly.js +10 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +23 -0
- package/package.json +31 -32
- package/themes/base.d.ts +8 -0
- package/themes/base.js +12 -1
- package/utils/index.js +6 -0
- package/utils/readOnly.js +14 -0
- package/components/Data/stories/Controlled.js +0 -92
- package/components/Data/stories/DataTable.js +0 -49
- package/components/DataFilters/stories/Inline.js +0 -53
- package/es6/components/Data/stories/Controlled.js +0 -86
- package/es6/components/Data/stories/DataTable.js +0 -44
- package/es6/components/DataFilters/stories/Inline.js +0 -48
|
@@ -1,645 +1,2 @@
|
|
|
1
1
|
## FormField
|
|
2
|
-
|
|
3
|
-
a label, help, and/or error messaging. It typically contains an input
|
|
4
|
-
control like TextInput, TextArea, Select, etc.
|
|
5
|
-
|
|
6
|
-
[](https://storybook.grommet.io/?selectedKind=Input-FormField&full=0&stories=1&panelRight=0) [](https://codesandbox.io/s/github/grommet/grommet-sandbox?initialpath=/formfield&module=%2Fsrc%2FFormField.js)
|
|
7
|
-
## Usage
|
|
8
|
-
|
|
9
|
-
```javascript
|
|
10
|
-
import { FormField } from 'grommet';
|
|
11
|
-
<FormField />
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Properties
|
|
15
|
-
|
|
16
|
-
**a11yTitle**
|
|
17
|
-
|
|
18
|
-
Custom label to be used by screen readers.
|
|
19
|
-
Should only be provided if FormField has no children.
|
|
20
|
-
When a11yTitle is provided an aria-label will be added to the element
|
|
21
|
-
if it has no children.
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
string
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**component**
|
|
28
|
-
|
|
29
|
-
The component to insert in the FormField. Grommet will add update the
|
|
30
|
-
form values when this field changes. Any additional properties
|
|
31
|
-
(such as initial value) you pass to FormField will be forwarded to this
|
|
32
|
-
component. The component may be custom as long it supports the properties
|
|
33
|
-
of name, value, onChange (event => {}), while event has either event.value
|
|
34
|
-
or event.target.value.
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
function
|
|
38
|
-
object
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
**contentProps**
|
|
42
|
-
|
|
43
|
-
Any valid Box property. These
|
|
44
|
-
properties are applied to the FormField contents container and will
|
|
45
|
-
override properties from the theme.
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
object
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
**disabled**
|
|
52
|
-
|
|
53
|
-
Whether the field should look disabled.
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
boolean
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**error**
|
|
60
|
-
|
|
61
|
-
Any error text describing issues with the field's value
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
string
|
|
65
|
-
node
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**help**
|
|
69
|
-
|
|
70
|
-
Any help text describing how the field works
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
string
|
|
74
|
-
node
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**htmlFor**
|
|
78
|
-
|
|
79
|
-
The id of the input element contained in this field
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
string
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**info**
|
|
86
|
-
|
|
87
|
-
Any informational text regarding the field's value
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
string
|
|
91
|
-
node
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
**label**
|
|
95
|
-
|
|
96
|
-
A short label describing the field
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
string
|
|
100
|
-
node
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
**name**
|
|
104
|
-
|
|
105
|
-
The name of the value data when in a Form and the name of
|
|
106
|
-
the input field.
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
string
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
**margin**
|
|
113
|
-
|
|
114
|
-
The amount of margin around the component. An object can
|
|
115
|
-
be specified to distinguish horizontal margin, vertical margin, and
|
|
116
|
-
margin on a particular side.
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
none
|
|
120
|
-
xxsmall
|
|
121
|
-
xsmall
|
|
122
|
-
small
|
|
123
|
-
medium
|
|
124
|
-
large
|
|
125
|
-
xlarge
|
|
126
|
-
{
|
|
127
|
-
bottom:
|
|
128
|
-
xxsmall
|
|
129
|
-
xsmall
|
|
130
|
-
small
|
|
131
|
-
medium
|
|
132
|
-
large
|
|
133
|
-
xlarge
|
|
134
|
-
string,
|
|
135
|
-
end:
|
|
136
|
-
xxsmall
|
|
137
|
-
xsmall
|
|
138
|
-
small
|
|
139
|
-
medium
|
|
140
|
-
large
|
|
141
|
-
xlarge
|
|
142
|
-
string,
|
|
143
|
-
horizontal:
|
|
144
|
-
xxsmall
|
|
145
|
-
xsmall
|
|
146
|
-
small
|
|
147
|
-
medium
|
|
148
|
-
large
|
|
149
|
-
xlarge
|
|
150
|
-
string,
|
|
151
|
-
left:
|
|
152
|
-
xxsmall
|
|
153
|
-
xsmall
|
|
154
|
-
small
|
|
155
|
-
medium
|
|
156
|
-
large
|
|
157
|
-
xlarge
|
|
158
|
-
string,
|
|
159
|
-
right:
|
|
160
|
-
xxsmall
|
|
161
|
-
xsmall
|
|
162
|
-
small
|
|
163
|
-
medium
|
|
164
|
-
large
|
|
165
|
-
xlarge
|
|
166
|
-
string,
|
|
167
|
-
start:
|
|
168
|
-
xxsmall
|
|
169
|
-
xsmall
|
|
170
|
-
small
|
|
171
|
-
medium
|
|
172
|
-
large
|
|
173
|
-
xlarge
|
|
174
|
-
string,
|
|
175
|
-
top:
|
|
176
|
-
xxsmall
|
|
177
|
-
xsmall
|
|
178
|
-
small
|
|
179
|
-
medium
|
|
180
|
-
large
|
|
181
|
-
xlarge
|
|
182
|
-
string,
|
|
183
|
-
vertical:
|
|
184
|
-
xxsmall
|
|
185
|
-
xsmall
|
|
186
|
-
small
|
|
187
|
-
medium
|
|
188
|
-
large
|
|
189
|
-
xlarge
|
|
190
|
-
string
|
|
191
|
-
}
|
|
192
|
-
string
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
**pad**
|
|
196
|
-
|
|
197
|
-
Whether to add padding to align with the padding of TextInput.
|
|
198
|
-
|
|
199
|
-
```
|
|
200
|
-
boolean
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
**required**
|
|
204
|
-
|
|
205
|
-
Whether the field is required.
|
|
206
|
-
|
|
207
|
-
```
|
|
208
|
-
boolean
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
**validate**
|
|
212
|
-
|
|
213
|
-
Validation rule when used within a grommet Form. Provide an object
|
|
214
|
-
with a regular expression, a function, or an array of these. If a
|
|
215
|
-
function is provided, it will be called with two arguments, the value
|
|
216
|
-
for this field and the entire value object. This permits validation to
|
|
217
|
-
encompass multiple fields. The function should return a string message
|
|
218
|
-
describing the validation issue, if any, or an object with 'message'
|
|
219
|
-
and 'status' properties.
|
|
220
|
-
|
|
221
|
-
```
|
|
222
|
-
{
|
|
223
|
-
regexp: new RegExp(...),
|
|
224
|
-
message:
|
|
225
|
-
string
|
|
226
|
-
node,
|
|
227
|
-
status:
|
|
228
|
-
error
|
|
229
|
-
info
|
|
230
|
-
}
|
|
231
|
-
function
|
|
232
|
-
[
|
|
233
|
-
{
|
|
234
|
-
regexp: new RegExp(...),
|
|
235
|
-
message:
|
|
236
|
-
string
|
|
237
|
-
node,
|
|
238
|
-
status:
|
|
239
|
-
error
|
|
240
|
-
info
|
|
241
|
-
}
|
|
242
|
-
function
|
|
243
|
-
]
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
## Intrinsic element
|
|
247
|
-
|
|
248
|
-
```
|
|
249
|
-
div
|
|
250
|
-
```
|
|
251
|
-
## Theme
|
|
252
|
-
|
|
253
|
-
**formField.border.color**
|
|
254
|
-
|
|
255
|
-
The border color. Expects `string | { 'dark': string, 'light': string }`.
|
|
256
|
-
|
|
257
|
-
Defaults to
|
|
258
|
-
|
|
259
|
-
```
|
|
260
|
-
border
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
**formField.border.error.color**
|
|
264
|
-
|
|
265
|
-
The border color of the error. Deprecated, use
|
|
266
|
-
error.border.color instead. Expects `string | {'dark': string, 'light': string}`.
|
|
267
|
-
|
|
268
|
-
Defaults to
|
|
269
|
-
|
|
270
|
-
```
|
|
271
|
-
{ dark: 'white', light: 'status-critical' },
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
**formField.border.position**
|
|
275
|
-
|
|
276
|
-
The border position. Expects `string`.
|
|
277
|
-
|
|
278
|
-
Defaults to
|
|
279
|
-
|
|
280
|
-
```
|
|
281
|
-
inner
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
**formField.border.side**
|
|
285
|
-
|
|
286
|
-
The border side of the FormField. Expects `string`.
|
|
287
|
-
|
|
288
|
-
Defaults to
|
|
289
|
-
|
|
290
|
-
```
|
|
291
|
-
bottom
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
**formField.content.margin**
|
|
295
|
-
|
|
296
|
-
The margin of the FormField content. Expects `object`.
|
|
297
|
-
|
|
298
|
-
Defaults to
|
|
299
|
-
|
|
300
|
-
```
|
|
301
|
-
undefined
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
**formField.content.pad**
|
|
305
|
-
|
|
306
|
-
The pad of the FormField content. Expects `object`.
|
|
307
|
-
|
|
308
|
-
Defaults to
|
|
309
|
-
|
|
310
|
-
```
|
|
311
|
-
small
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
**formField.disabled.background.color**
|
|
315
|
-
|
|
316
|
-
The color of the FormField background when it is disabled. Expects `string | {'dark': string, 'light': string}`.
|
|
317
|
-
|
|
318
|
-
Defaults to
|
|
319
|
-
|
|
320
|
-
```
|
|
321
|
-
undefined
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
**formField.disabled.background.opacity**
|
|
325
|
-
|
|
326
|
-
The opacity of the FormField background when it is disabled. Expects `string | boolean | number`.
|
|
327
|
-
|
|
328
|
-
Defaults to
|
|
329
|
-
|
|
330
|
-
```
|
|
331
|
-
undefined
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
**formField.disabled.border.color**
|
|
335
|
-
|
|
336
|
-
The color of the FormField border when it is disabled. Expects `string | {'dark': string, 'light': string}`.
|
|
337
|
-
|
|
338
|
-
Defaults to
|
|
339
|
-
|
|
340
|
-
```
|
|
341
|
-
undefined
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
**formField.disabled.label.color**
|
|
345
|
-
|
|
346
|
-
The color of the FormField label when it is disabled. Expects `string | {'dark': string, 'light': string}`.
|
|
347
|
-
|
|
348
|
-
Defaults to
|
|
349
|
-
|
|
350
|
-
```
|
|
351
|
-
undefined
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
**formField.error.background.color**
|
|
355
|
-
|
|
356
|
-
The color of the FormField background when there is an error. Expects `string | {'dark': string, 'light': string}`.
|
|
357
|
-
|
|
358
|
-
Defaults to
|
|
359
|
-
|
|
360
|
-
```
|
|
361
|
-
undefined
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
**formField.error.background.opacity**
|
|
365
|
-
|
|
366
|
-
The opacity of the FormField background when there is an error. Expects `string | boolean | number`.
|
|
367
|
-
|
|
368
|
-
Defaults to
|
|
369
|
-
|
|
370
|
-
```
|
|
371
|
-
undefined
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
**formField.error.border.color**
|
|
375
|
-
|
|
376
|
-
The border color of the error. Expects `string | {'dark': string, 'light': string}`.
|
|
377
|
-
|
|
378
|
-
Defaults to
|
|
379
|
-
|
|
380
|
-
```
|
|
381
|
-
{ dark: 'white', light: 'status-critical' },
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
**formField.error.color**
|
|
385
|
-
|
|
386
|
-
The color of the FormField error. Expects `string | {'dark': string, 'light': string}`.
|
|
387
|
-
|
|
388
|
-
Defaults to
|
|
389
|
-
|
|
390
|
-
```
|
|
391
|
-
status-critical
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
**formField.error.container**
|
|
395
|
-
|
|
396
|
-
Any valid Box props for the container surrounding the error
|
|
397
|
-
message and icon. Expects `object`.
|
|
398
|
-
|
|
399
|
-
Defaults to
|
|
400
|
-
|
|
401
|
-
```
|
|
402
|
-
undefined
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
**formField.error.icon**
|
|
406
|
-
|
|
407
|
-
An icon placed in a row with the error message. Expects `React.Element`.
|
|
408
|
-
|
|
409
|
-
Defaults to
|
|
410
|
-
|
|
411
|
-
```
|
|
412
|
-
undefined
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
**formField.error.size**
|
|
416
|
-
|
|
417
|
-
The size of the error message to be displayed.
|
|
418
|
-
The default size is medium. Expects `string`.
|
|
419
|
-
|
|
420
|
-
Defaults to
|
|
421
|
-
|
|
422
|
-
```
|
|
423
|
-
medium
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
**formField.error.size.xsmall**
|
|
427
|
-
|
|
428
|
-
The size of a 'xsmall' error message. Expects `string`.
|
|
429
|
-
|
|
430
|
-
Defaults to
|
|
431
|
-
|
|
432
|
-
```
|
|
433
|
-
12px
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
**formField.error.size.small**
|
|
437
|
-
|
|
438
|
-
The size of a 'small' error message. Expects `string`.
|
|
439
|
-
|
|
440
|
-
Defaults to
|
|
441
|
-
|
|
442
|
-
```
|
|
443
|
-
14px
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
**formField.error.size.medium**
|
|
447
|
-
|
|
448
|
-
The size of a 'medium' error message. Expects `string`.
|
|
449
|
-
|
|
450
|
-
Defaults to
|
|
451
|
-
|
|
452
|
-
```
|
|
453
|
-
18px
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
**formField.error.size.large**
|
|
457
|
-
|
|
458
|
-
The size of a 'large' error message. Expects `string`.
|
|
459
|
-
|
|
460
|
-
Defaults to
|
|
461
|
-
|
|
462
|
-
```
|
|
463
|
-
22px
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
**formField.error.size.xlarge**
|
|
467
|
-
|
|
468
|
-
The size of a 'xlarge' error message. Expects `string`.
|
|
469
|
-
|
|
470
|
-
Defaults to
|
|
471
|
-
|
|
472
|
-
```
|
|
473
|
-
26px
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
**formField.info.container**
|
|
477
|
-
|
|
478
|
-
Any valid Box props for the container surrounding the info
|
|
479
|
-
message and icon. Expects `object`.
|
|
480
|
-
|
|
481
|
-
Defaults to
|
|
482
|
-
|
|
483
|
-
```
|
|
484
|
-
undefined
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
**formField.info.icon**
|
|
488
|
-
|
|
489
|
-
An icon placed in a row with the info message. Expects `React.Element`.
|
|
490
|
-
|
|
491
|
-
Defaults to
|
|
492
|
-
|
|
493
|
-
```
|
|
494
|
-
undefined
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
**formField.error.margin**
|
|
498
|
-
|
|
499
|
-
The margin used for the FormField error. Expects `string | object`.
|
|
500
|
-
|
|
501
|
-
Defaults to
|
|
502
|
-
|
|
503
|
-
```
|
|
504
|
-
{ vertical: 'xsmall', horizontal: 'small' }
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
**formField.focus.background.color**
|
|
508
|
-
|
|
509
|
-
The color of the FormField background when it is in focus. Expects `string | {'dark': string, 'light': string}`.
|
|
510
|
-
|
|
511
|
-
Defaults to
|
|
512
|
-
|
|
513
|
-
```
|
|
514
|
-
undefined
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
**formField.focus.border.color**
|
|
518
|
-
|
|
519
|
-
The color of the FormField border when it is in focus. Expects `string | {'dark': string, 'light': string}`.
|
|
520
|
-
|
|
521
|
-
Defaults to
|
|
522
|
-
|
|
523
|
-
```
|
|
524
|
-
undefined
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
**formField.extend**
|
|
528
|
-
|
|
529
|
-
Any additional style for FormField. Expects `string | (props) => {}`.
|
|
530
|
-
|
|
531
|
-
Defaults to
|
|
532
|
-
|
|
533
|
-
```
|
|
534
|
-
undefined
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
**formField.help.color**
|
|
538
|
-
|
|
539
|
-
The color of the FormField help. Expects `string | {'dark': string, 'light': string}`.
|
|
540
|
-
|
|
541
|
-
Defaults to
|
|
542
|
-
|
|
543
|
-
```
|
|
544
|
-
{ dark: 'dark-3', light: 'dark-3' }
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
**formField.help.margin**
|
|
548
|
-
|
|
549
|
-
The margin for the FormField help. Expects `string | object`.
|
|
550
|
-
|
|
551
|
-
Defaults to
|
|
552
|
-
|
|
553
|
-
```
|
|
554
|
-
{ left: 'small' }
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
**formField.info.color**
|
|
558
|
-
|
|
559
|
-
The color of the FormField info. Expects `string | {'dark': string, 'light': string}`.
|
|
560
|
-
|
|
561
|
-
Defaults to
|
|
562
|
-
|
|
563
|
-
```
|
|
564
|
-
text-xweak
|
|
565
|
-
```
|
|
566
|
-
|
|
567
|
-
**formField.info.margin**
|
|
568
|
-
|
|
569
|
-
The margin used for the FormField info. Expects `string | object`.
|
|
570
|
-
|
|
571
|
-
Defaults to
|
|
572
|
-
|
|
573
|
-
```
|
|
574
|
-
{ vertical: 'xsmall', horizontal: 'small' }
|
|
575
|
-
```
|
|
576
|
-
|
|
577
|
-
**formField.label**
|
|
578
|
-
|
|
579
|
-
Any props of Text that will be applied on the FormField label. Expects `object`.
|
|
580
|
-
|
|
581
|
-
Defaults to
|
|
582
|
-
|
|
583
|
-
```
|
|
584
|
-
undefined
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
**formField.label.margin**
|
|
588
|
-
|
|
589
|
-
The margin for the FormField label. Expects `string | object`.
|
|
590
|
-
|
|
591
|
-
Defaults to
|
|
592
|
-
|
|
593
|
-
```
|
|
594
|
-
{ vertical: 'xsmall', horizontal: 'small' }
|
|
595
|
-
```
|
|
596
|
-
|
|
597
|
-
**formField.label.requiredIndicator**
|
|
598
|
-
|
|
599
|
-
Whether an asterisk (*) indicating that an input is required
|
|
600
|
-
should be displayed adjacent to the FormField's label. If providing a
|
|
601
|
-
custom element, for accessibility it is recommended that you include
|
|
602
|
-
an a11yTitle of "required" to assist screen readers. If using "true", the
|
|
603
|
-
a11yTitle is automatically applied. Expects `boolean | element | string`.
|
|
604
|
-
|
|
605
|
-
Defaults to
|
|
606
|
-
|
|
607
|
-
```
|
|
608
|
-
undefined
|
|
609
|
-
```
|
|
610
|
-
|
|
611
|
-
**formField.margin**
|
|
612
|
-
|
|
613
|
-
The margin of FormField. Expects `string | object`.
|
|
614
|
-
|
|
615
|
-
Defaults to
|
|
616
|
-
|
|
617
|
-
```
|
|
618
|
-
{ bottom: 'small' }
|
|
619
|
-
```
|
|
620
|
-
|
|
621
|
-
**formField.round**
|
|
622
|
-
|
|
623
|
-
The rounding of the FormField. Expects `boolean | string | object`.
|
|
624
|
-
|
|
625
|
-
Defaults to
|
|
626
|
-
|
|
627
|
-
```
|
|
628
|
-
undefined
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
**global.borderSize**
|
|
632
|
-
|
|
633
|
-
The possible border sizes for FormField. Expects `object`.
|
|
634
|
-
|
|
635
|
-
Defaults to
|
|
636
|
-
|
|
637
|
-
```
|
|
638
|
-
{
|
|
639
|
-
xsmall: '1px',
|
|
640
|
-
small: '2px',
|
|
641
|
-
medium: '4px',
|
|
642
|
-
large: '12px',
|
|
643
|
-
xlarge: '24px,
|
|
644
|
-
}
|
|
645
|
-
```
|
|
2
|
+
Documentation for this component: https://v2.grommet.io/formfield
|
|
@@ -33,7 +33,10 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
33
33
|
// regular expression
|
|
34
34
|
message: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]),
|
|
35
35
|
status: _propTypes["default"].oneOf(['error', 'info'])
|
|
36
|
-
}), _propTypes["default"].func]
|
|
36
|
+
}), _propTypes["default"].func, _propTypes["default"].shape({
|
|
37
|
+
max: _propTypes["default"].number,
|
|
38
|
+
threshold: _propTypes["default"].number
|
|
39
|
+
})]))]),
|
|
37
40
|
validateOn: _propTypes["default"].oneOf(['blur', 'submit', 'change'])
|
|
38
41
|
};
|
|
39
42
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.ThresholdValidation = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _grommet = require("grommet");
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
+
var ThresholdValidation = exports.ThresholdValidation = function ThresholdValidation() {
|
|
9
|
+
return (
|
|
10
|
+
/*#__PURE__*/
|
|
11
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
12
|
+
// <Grommet theme={...}>
|
|
13
|
+
_react["default"].createElement(_grommet.Box, {
|
|
14
|
+
align: "center",
|
|
15
|
+
pad: "large"
|
|
16
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Form, {
|
|
17
|
+
validate: "change"
|
|
18
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.FormField, {
|
|
19
|
+
label: "Label",
|
|
20
|
+
validate: {
|
|
21
|
+
max: 10,
|
|
22
|
+
threshold: 0.25
|
|
23
|
+
},
|
|
24
|
+
name: "issue-description",
|
|
25
|
+
htmlFor: "issue-description"
|
|
26
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.TextInput, {
|
|
27
|
+
id: "issue-description",
|
|
28
|
+
name: "issue-description",
|
|
29
|
+
placeholder: "placeholder"
|
|
30
|
+
})), /*#__PURE__*/_react["default"].createElement(_grommet.FormField, {
|
|
31
|
+
label: "Label with default threshold",
|
|
32
|
+
validate: {
|
|
33
|
+
max: 10
|
|
34
|
+
},
|
|
35
|
+
name: "issue-description-with-default-threshold",
|
|
36
|
+
htmlFor: "issue-description-with-default-threshold"
|
|
37
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.TextInput, {
|
|
38
|
+
id: "issue-description-with-default-threshold",
|
|
39
|
+
name: "issue-description-with-default-threshold",
|
|
40
|
+
placeholder: "placeholder"
|
|
41
|
+
}))))
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
ThresholdValidation.parameters = {
|
|
45
|
+
chromatic: {
|
|
46
|
+
disable: true
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var _default = exports["default"] = {
|
|
50
|
+
title: 'Input/FormField/ThresholdValidation'
|
|
51
|
+
};
|
|
@@ -75,7 +75,7 @@ var Grommet = exports.Grommet = /*#__PURE__*/(0, _react.forwardRef)(function (pr
|
|
|
75
75
|
}
|
|
76
76
|
var themeBackground = nextTheme.global.colors.background;
|
|
77
77
|
nextTheme.dark = (themeMode || nextTheme.defaultMode) === 'dark';
|
|
78
|
-
if (themeMode === 'auto' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
78
|
+
if (themeMode === 'auto' && typeof window !== 'undefined' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
79
79
|
nextTheme.dark = true;
|
|
80
80
|
}
|
|
81
81
|
var color = (0, _utils.normalizeColor)(background || themeBackground, nextTheme);
|