grommet 2.42.0 → 2.44.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/all/stories/AllComponents.js +7 -2
- package/all/stories/Colors.js +6 -6
- package/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
- package/components/Box/stories/Background.js +5 -11
- package/components/Button/stories/CustomThemed/Typescript.tsx +1 -1
- package/components/Button/stories/Kind.js +6 -10
- package/components/Calendar/Calendar.js +21 -11
- package/components/Calendar/StyledCalendar.js +6 -5
- package/components/Calendar/index.d.ts +1 -0
- package/components/Calendar/propTypes.js +1 -0
- package/components/Calendar/stories/DaylightSavings.js +1 -1
- package/components/Calendar/stories/HeaderLevel.js +36 -0
- package/components/Calendar/stories/ShowAdjacentDays.js +3 -2
- package/components/Card/stories/CustomThemed/Clickable.js +2 -2
- package/components/Card/stories/CustomThemed/Stacked.js +2 -2
- package/components/Card/stories/CustomThemed/Themed.js +4 -4
- package/components/Card/stories/Simple.js +2 -2
- package/components/Cards/stories/Children.js +2 -2
- package/components/CheckBox/stories/CustomThemed/Custom.js +1 -1
- package/components/Data/stories/Cards.js +3 -2
- package/components/Data/stories/Properties.js +3 -2
- package/components/DataChart/Detail.js +55 -25
- package/components/DataChart/Legend.js +1 -0
- package/components/DataTable/Body.js +16 -2
- package/components/DataTable/stories/CustomThemed/Fill.js +1 -0
- package/components/Drop/stories/CustomThemed/Lazy.js +4 -4
- package/components/Drop/stories/CustomThemed/Themed.js +1 -1
- package/components/Form/stories/AggregateValidation.js +5 -2
- package/components/Form/stories/ArrayOfFormFields.js +19 -6
- package/components/Form/stories/Controlled.js +8 -1
- package/components/Form/stories/ControlledInput.js +8 -1
- package/components/Form/stories/ControlledInputLazy.js +5 -1
- package/components/Form/stories/ControlledLazy.js +5 -1
- package/components/Form/stories/CustomThemed/Custom.js +17 -1
- package/components/Form/stories/CustomThemed/FieldSpacingOptions.js +36 -36
- package/components/Form/stories/CustomThemed/RequiredLabel.js +3 -0
- package/components/Form/stories/CustomThemed/Themed.js +2 -2
- package/components/Form/stories/DynamicFields.js +9 -2
- package/components/Form/stories/FieldWithChildren.js +6 -1
- package/components/Form/stories/TriggerValidationUsingFormField.js +18 -6
- package/components/Form/stories/Uncontrolled.js +6 -1
- package/components/Form/stories/ValidateOnBlur.js +10 -3
- package/components/Form/stories/ValidateOnChange.js +11 -5
- package/components/Form/stories/ValidateOnMount.js +11 -4
- package/components/Form/stories/typescript/TypedForm.tsx +39 -45
- package/components/FormField/FormField.js +9 -2
- package/components/FormField/stories/CustomThemed/Custom.tsx +1 -1
- package/components/FormField/stories/ThresholdValidation.js +5 -1
- package/components/Grid/stories/AreasPropAlternative.js +4 -1
- package/components/Grommet/index.d.ts +23 -1
- package/components/Grommet/propTypes.js +22 -0
- package/components/Grommet/stories/Theme.js +1 -1
- package/components/Grommet/stories/Vars.js +2 -2
- package/components/Layer/LayerContainer.js +3 -14
- package/components/List/List.js +27 -3
- package/components/List/stories/RenderedList.js +1 -1
- package/components/Meter/Meter.js +36 -17
- package/components/Meter/index.d.ts +18 -0
- package/components/Meter/propTypes.js +18 -0
- package/components/Nav/stories/CustomThemed/JustifySidebar.js +1 -1
- package/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -1
- package/components/PageHeader/stories/Level.js +2 -2
- package/components/PageHeader/stories/Size.js +3 -2
- package/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
- package/components/Pagination/stories/NumberEdgePages.js +2 -0
- package/components/Pagination/stories/NumberMiddlePages.js +2 -0
- package/components/Pagination/stories/Simple.js +4 -2
- package/components/Pagination/stories/Size.js +3 -0
- package/components/Pagination/stories/Steps.js +3 -0
- package/components/RadioButton/RadioButton.js +14 -3
- package/components/RadioButton/stories/Children.js +16 -3
- package/components/RadioButtonGroup/stories/Children.js +13 -1
- package/components/Skeleton/stories/CustomThemed/Custom.js +2 -0
- package/components/Skeleton/stories/GridContainer.js +1 -1
- package/components/Skeleton/stories/Group.js +1 -1
- package/components/Skeleton/stories/Individual.js +1 -2
- package/components/Skeleton/stories/Simple.js +1 -0
- package/components/SkipLinks/stories/CustomThemed/Themed.js +1 -1
- package/components/StarRating/StarRating.js +17 -3
- package/components/Tabs/Tabs.js +1 -1
- package/components/Tabs/stories/CustomThemed/Custom.js +3 -3
- package/components/Tabs/stories/Scrollable.js +2 -1
- package/components/TextArea/stories/CustomThemed/Themed.js +1 -0
- package/components/TextInput/TextInput.js +7 -2
- package/components/TextInput/stories/Simple.js +1 -6
- package/components/ThumbsRating/ThumbsRating.js +20 -5
- package/es6/all/stories/AllComponents.js +7 -2
- package/es6/all/stories/Colors.js +6 -6
- package/es6/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
- package/es6/components/Box/stories/Background.js +5 -11
- package/es6/components/Button/stories/CustomThemed/Typescript.tsx +1 -1
- package/es6/components/Button/stories/Kind.js +6 -10
- package/es6/components/Calendar/Calendar.js +21 -11
- package/es6/components/Calendar/StyledCalendar.js +6 -5
- package/es6/components/Calendar/index.d.ts +1 -0
- package/es6/components/Calendar/propTypes.js +1 -0
- package/es6/components/Calendar/stories/DaylightSavings.js +2 -2
- package/es6/components/Calendar/stories/HeaderLevel.js +30 -0
- package/es6/components/Calendar/stories/ShowAdjacentDays.js +3 -2
- package/es6/components/Card/stories/CustomThemed/Clickable.js +3 -3
- package/es6/components/Card/stories/CustomThemed/Stacked.js +3 -3
- package/es6/components/Card/stories/CustomThemed/Themed.js +5 -5
- package/es6/components/Card/stories/Simple.js +3 -3
- package/es6/components/Cards/stories/Children.js +3 -3
- package/es6/components/CheckBox/stories/CustomThemed/Custom.js +1 -1
- package/es6/components/Data/stories/Cards.js +4 -3
- package/es6/components/Data/stories/Properties.js +4 -3
- package/es6/components/DataChart/Detail.js +55 -25
- package/es6/components/DataChart/Legend.js +1 -0
- package/es6/components/DataTable/Body.js +18 -4
- package/es6/components/DataTable/stories/CustomThemed/Fill.js +1 -0
- package/es6/components/Drop/stories/CustomThemed/Lazy.js +4 -4
- package/es6/components/Drop/stories/CustomThemed/Themed.js +1 -1
- package/es6/components/Form/stories/AggregateValidation.js +5 -2
- package/es6/components/Form/stories/ArrayOfFormFields.js +20 -7
- package/es6/components/Form/stories/Controlled.js +8 -1
- package/es6/components/Form/stories/ControlledInput.js +8 -1
- package/es6/components/Form/stories/ControlledInputLazy.js +5 -1
- package/es6/components/Form/stories/ControlledLazy.js +5 -1
- package/es6/components/Form/stories/CustomThemed/Custom.js +17 -1
- package/es6/components/Form/stories/CustomThemed/FieldSpacingOptions.js +36 -36
- package/es6/components/Form/stories/CustomThemed/RequiredLabel.js +3 -0
- package/es6/components/Form/stories/CustomThemed/Themed.js +2 -2
- package/es6/components/Form/stories/DynamicFields.js +9 -2
- package/es6/components/Form/stories/FieldWithChildren.js +6 -1
- package/es6/components/Form/stories/TriggerValidationUsingFormField.js +19 -7
- package/es6/components/Form/stories/Uncontrolled.js +6 -1
- package/es6/components/Form/stories/ValidateOnBlur.js +10 -3
- package/es6/components/Form/stories/ValidateOnChange.js +12 -6
- package/es6/components/Form/stories/ValidateOnMount.js +11 -4
- package/es6/components/Form/stories/typescript/TypedForm.tsx +39 -45
- package/es6/components/FormField/FormField.js +10 -3
- package/es6/components/FormField/stories/CustomThemed/Custom.tsx +1 -1
- package/es6/components/FormField/stories/ThresholdValidation.js +5 -1
- package/es6/components/Grid/stories/AreasPropAlternative.js +4 -1
- package/es6/components/Grommet/index.d.ts +23 -1
- package/es6/components/Grommet/propTypes.js +22 -0
- package/es6/components/Grommet/stories/Theme.js +1 -1
- package/es6/components/Grommet/stories/Vars.js +2 -2
- package/es6/components/Layer/LayerContainer.js +4 -15
- package/es6/components/List/List.js +27 -3
- package/es6/components/List/stories/RenderedList.js +1 -1
- package/es6/components/Meter/Meter.js +37 -18
- package/es6/components/Meter/index.d.ts +18 -0
- package/es6/components/Meter/propTypes.js +18 -0
- package/es6/components/Nav/stories/CustomThemed/JustifySidebar.js +1 -1
- package/es6/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -1
- package/es6/components/PageHeader/stories/Level.js +3 -3
- package/es6/components/PageHeader/stories/Size.js +3 -2
- package/es6/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
- package/es6/components/Pagination/stories/NumberEdgePages.js +2 -0
- package/es6/components/Pagination/stories/NumberMiddlePages.js +2 -0
- package/es6/components/Pagination/stories/Simple.js +4 -2
- package/es6/components/Pagination/stories/Size.js +3 -0
- package/es6/components/Pagination/stories/Steps.js +3 -0
- package/es6/components/RadioButton/RadioButton.js +15 -4
- package/es6/components/RadioButton/stories/Children.js +16 -3
- package/es6/components/RadioButtonGroup/stories/Children.js +12 -1
- package/es6/components/Skeleton/stories/CustomThemed/Custom.js +2 -0
- package/es6/components/Skeleton/stories/GridContainer.js +2 -2
- package/es6/components/Skeleton/stories/Group.js +2 -2
- package/es6/components/Skeleton/stories/Individual.js +2 -3
- package/es6/components/Skeleton/stories/Simple.js +1 -0
- package/es6/components/SkipLinks/stories/CustomThemed/Themed.js +1 -1
- package/es6/components/StarRating/StarRating.js +16 -3
- package/es6/components/Tabs/Tabs.js +1 -1
- package/es6/components/Tabs/stories/CustomThemed/Custom.js +3 -3
- package/es6/components/Tabs/stories/Scrollable.js +2 -1
- package/es6/components/TextArea/stories/CustomThemed/Themed.js +1 -0
- package/es6/components/TextInput/TextInput.js +7 -2
- package/es6/components/TextInput/stories/Simple.js +2 -7
- package/es6/components/ThumbsRating/ThumbsRating.js +20 -5
- package/es6/languages/default.json +22 -0
- package/es6/themes/base.d.ts +3 -0
- package/es6/themes/base.js +8 -5
- package/es6/utils/useId.js +3 -2
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +22 -0
- package/package.json +28 -28
- package/themes/base.d.ts +3 -0
- package/themes/base.js +8 -5
- package/tools/release-stable.js +1 -1
- package/utils/useId.js +5 -2
- package/components/CheckBox/stories/InsideButton.js +0 -38
- package/components/Form/stories/FieldWithComponentProp.js +0 -138
- package/es6/components/CheckBox/stories/InsideButton.js +0 -32
- package/es6/components/Form/stories/FieldWithComponentProp.js +0 -133
|
@@ -33,6 +33,7 @@ export var Uncontrolled = function Uncontrolled() {
|
|
|
33
33
|
name: "email",
|
|
34
34
|
required: true
|
|
35
35
|
}, /*#__PURE__*/React.createElement(MaskedInput, {
|
|
36
|
+
"aria-required": true,
|
|
36
37
|
id: "email",
|
|
37
38
|
name: "email",
|
|
38
39
|
mask: [{
|
|
@@ -50,13 +51,17 @@ export var Uncontrolled = function Uncontrolled() {
|
|
|
50
51
|
placeholder: 'com'
|
|
51
52
|
}]
|
|
52
53
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
54
|
+
htmlFor: "subscribe",
|
|
53
55
|
name: "subscribe"
|
|
54
56
|
}, /*#__PURE__*/React.createElement(CheckBox, {
|
|
57
|
+
id: "subscribe",
|
|
55
58
|
name: "subscribe",
|
|
56
59
|
label: "Subscribe?"
|
|
57
60
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
61
|
+
htmlFor: "ampm",
|
|
58
62
|
name: "ampm"
|
|
59
63
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
64
|
+
id: "ampm",
|
|
60
65
|
name: "ampm",
|
|
61
66
|
options: ['morning', 'evening']
|
|
62
67
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
@@ -65,7 +70,6 @@ export var Uncontrolled = function Uncontrolled() {
|
|
|
65
70
|
name: "size"
|
|
66
71
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
67
72
|
id: "size",
|
|
68
|
-
"aria-label": "size",
|
|
69
73
|
name: "size",
|
|
70
74
|
options: ['small', 'medium', 'large']
|
|
71
75
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
@@ -91,6 +95,7 @@ export var Uncontrolled = function Uncontrolled() {
|
|
|
91
95
|
htmlFor: "image",
|
|
92
96
|
name: "image"
|
|
93
97
|
}, /*#__PURE__*/React.createElement(FileInput, {
|
|
98
|
+
"aria-required": true,
|
|
94
99
|
id: "image",
|
|
95
100
|
name: "image"
|
|
96
101
|
})), /*#__PURE__*/React.createElement(Box, {
|
|
@@ -23,8 +23,8 @@ export var ValidateOnBlur = function ValidateOnBlur() {
|
|
|
23
23
|
}
|
|
24
24
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
25
25
|
label: "Name",
|
|
26
|
-
"aria-label": "name",
|
|
27
26
|
name: "name",
|
|
27
|
+
htmlFor: "name",
|
|
28
28
|
required: true,
|
|
29
29
|
validate: [{
|
|
30
30
|
regexp: /^[a-z]/i
|
|
@@ -40,13 +40,19 @@ export var ValidateOnBlur = function ValidateOnBlur() {
|
|
|
40
40
|
};
|
|
41
41
|
return undefined;
|
|
42
42
|
}]
|
|
43
|
-
}
|
|
43
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
44
|
+
id: "name",
|
|
45
|
+
"aria-required": true,
|
|
46
|
+
name: "name"
|
|
47
|
+
})), /*#__PURE__*/React.createElement(FormField, {
|
|
48
|
+
htmlFor: "email",
|
|
44
49
|
label: "Email",
|
|
45
50
|
name: "email",
|
|
46
51
|
required: true
|
|
47
52
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
53
|
+
"aria-required": true,
|
|
48
54
|
name: "email",
|
|
49
|
-
|
|
55
|
+
id: "email",
|
|
50
56
|
type: "email"
|
|
51
57
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
52
58
|
label: "Size",
|
|
@@ -64,6 +70,7 @@ export var ValidateOnBlur = function ValidateOnBlur() {
|
|
|
64
70
|
}
|
|
65
71
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
66
72
|
name: "select-size",
|
|
73
|
+
"aria-required": true,
|
|
67
74
|
id: "select-size",
|
|
68
75
|
options: ['small', 'medium', 'large']
|
|
69
76
|
})), /*#__PURE__*/React.createElement(Box, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Box, Button, Form, FormField, Select } from 'grommet';
|
|
2
|
+
import { Box, Button, Form, FormField, TextInput, Select } from 'grommet';
|
|
3
3
|
export var ValidateOnChange = function ValidateOnChange() {
|
|
4
4
|
var _useState = useState(false),
|
|
5
5
|
valid = _useState[0],
|
|
@@ -30,7 +30,6 @@ export var ValidateOnChange = function ValidateOnChange() {
|
|
|
30
30
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
31
31
|
label: "First Name",
|
|
32
32
|
htmlFor: "firstName",
|
|
33
|
-
id: "firstName",
|
|
34
33
|
name: "firstName",
|
|
35
34
|
required: true,
|
|
36
35
|
validate: [{
|
|
@@ -39,10 +38,13 @@ export var ValidateOnChange = function ValidateOnChange() {
|
|
|
39
38
|
if (firstName && firstName.length === 1) return 'must be >1 character';
|
|
40
39
|
return undefined;
|
|
41
40
|
}]
|
|
42
|
-
}
|
|
41
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
42
|
+
"aria-required": true,
|
|
43
|
+
id: "firstName",
|
|
44
|
+
name: "firstName"
|
|
45
|
+
})), /*#__PURE__*/React.createElement(FormField, {
|
|
43
46
|
label: "Last Name",
|
|
44
47
|
htmlFor: "lastName",
|
|
45
|
-
id: "lastName",
|
|
46
48
|
name: "lastName",
|
|
47
49
|
required: true,
|
|
48
50
|
validate: [{
|
|
@@ -51,7 +53,11 @@ export var ValidateOnChange = function ValidateOnChange() {
|
|
|
51
53
|
if (lastName && lastName.length === 1) return 'must be >1 character';
|
|
52
54
|
return undefined;
|
|
53
55
|
}]
|
|
54
|
-
}
|
|
56
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
57
|
+
"aria-required": true,
|
|
58
|
+
id: "lastName",
|
|
59
|
+
name: "lastName"
|
|
60
|
+
})), /*#__PURE__*/React.createElement(FormField, {
|
|
55
61
|
label: "Size",
|
|
56
62
|
name: "select-size",
|
|
57
63
|
htmlFor: "select-size",
|
|
@@ -68,8 +74,8 @@ export var ValidateOnChange = function ValidateOnChange() {
|
|
|
68
74
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
69
75
|
name: "select-size",
|
|
70
76
|
htmlFor: "select-size",
|
|
77
|
+
"aria-required": true,
|
|
71
78
|
id: "select-size",
|
|
72
|
-
"aria-label": "select-size",
|
|
73
79
|
options: ['small', 'medium', 'large']
|
|
74
80
|
})), /*#__PURE__*/React.createElement(Box, {
|
|
75
81
|
direction: "row",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Box, Button, Form, FormField } from 'grommet';
|
|
3
|
+
import { TextInput } from '../../TextInput';
|
|
3
4
|
export var ValidateOnMount = function ValidateOnMount() {
|
|
4
5
|
var defaultValue = {
|
|
5
6
|
firstName: 'J',
|
|
@@ -39,7 +40,6 @@ export var ValidateOnMount = function ValidateOnMount() {
|
|
|
39
40
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
40
41
|
label: "First Name",
|
|
41
42
|
htmlFor: "firstName",
|
|
42
|
-
id: "firstName",
|
|
43
43
|
name: "firstName",
|
|
44
44
|
required: true,
|
|
45
45
|
validate: [{
|
|
@@ -48,10 +48,13 @@ export var ValidateOnMount = function ValidateOnMount() {
|
|
|
48
48
|
if (firstName && firstName.length === 1) return 'must be >1 character';
|
|
49
49
|
return undefined;
|
|
50
50
|
}]
|
|
51
|
-
}
|
|
51
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
52
|
+
"aria-required": true,
|
|
53
|
+
id: "firstName",
|
|
54
|
+
name: "firstName"
|
|
55
|
+
})), /*#__PURE__*/React.createElement(FormField, {
|
|
52
56
|
label: "Last Name",
|
|
53
57
|
htmlFor: "lastName",
|
|
54
|
-
id: "lastName",
|
|
55
58
|
name: "lastName",
|
|
56
59
|
required: true,
|
|
57
60
|
validate: [{
|
|
@@ -60,7 +63,11 @@ export var ValidateOnMount = function ValidateOnMount() {
|
|
|
60
63
|
if (lastName && lastName.length === 1) return 'must be >1 character';
|
|
61
64
|
return undefined;
|
|
62
65
|
}]
|
|
63
|
-
}
|
|
66
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
67
|
+
"aria-required": true,
|
|
68
|
+
id: "lastName",
|
|
69
|
+
name: "lastName"
|
|
70
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
64
71
|
direction: "row",
|
|
65
72
|
justify: "between",
|
|
66
73
|
margin: {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
RangeInput,
|
|
11
11
|
Select,
|
|
12
12
|
TextArea,
|
|
13
|
+
TextInput,
|
|
13
14
|
} from 'grommet';
|
|
14
15
|
import { useState } from 'react';
|
|
15
16
|
|
|
@@ -51,66 +52,59 @@ export const TypedForm = () => {
|
|
|
51
52
|
<FormField
|
|
52
53
|
label="Name"
|
|
53
54
|
htmlFor="name"
|
|
54
|
-
id="name"
|
|
55
55
|
name="name"
|
|
56
56
|
required
|
|
57
57
|
validate={{ regexp: /^[a-z]/i }}
|
|
58
|
-
|
|
58
|
+
>
|
|
59
|
+
<TextInput aria-required name="name" id="name" type="name" />
|
|
60
|
+
</FormField>
|
|
59
61
|
<FormField
|
|
60
62
|
label="Email"
|
|
61
63
|
htmlFor="email"
|
|
62
|
-
id="email"
|
|
63
64
|
name="email"
|
|
64
65
|
type="email"
|
|
65
66
|
required
|
|
66
|
-
|
|
67
|
+
>
|
|
68
|
+
<TextInput aria-required name="email" type="email" id="email" />
|
|
69
|
+
</FormField>
|
|
67
70
|
<FormField
|
|
68
71
|
label="Employee ID"
|
|
69
72
|
htmlFor="employeeId"
|
|
70
|
-
id="employeeId"
|
|
71
73
|
name="employeeId"
|
|
72
74
|
required
|
|
73
75
|
validate={{ regexp: /^[0-9]{4,6}$/, message: '4-6 digits' }}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
name="comments"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
htmlFor="age"
|
|
107
|
-
id="age"
|
|
108
|
-
name="age"
|
|
109
|
-
component={RangeInput}
|
|
110
|
-
pad
|
|
111
|
-
min={15}
|
|
112
|
-
max={75}
|
|
113
|
-
/>
|
|
76
|
+
>
|
|
77
|
+
<TextInput
|
|
78
|
+
aria-required
|
|
79
|
+
id="employeeId"
|
|
80
|
+
name="employeeId"
|
|
81
|
+
type="employeeId"
|
|
82
|
+
/>
|
|
83
|
+
</FormField>
|
|
84
|
+
<FormField name="subscribe" pad>
|
|
85
|
+
<CheckBox label="Subscribe?" name="subscribe" id="subscribe" />
|
|
86
|
+
</FormField>
|
|
87
|
+
<FormField name="ampm" pad options={['morning', 'evening']}>
|
|
88
|
+
<RadioButtonGroup
|
|
89
|
+
name="ampm"
|
|
90
|
+
id="ampm"
|
|
91
|
+
options={['morning', 'evening']}
|
|
92
|
+
/>
|
|
93
|
+
</FormField>
|
|
94
|
+
<FormField label="Size" htmlFor="size" name="size">
|
|
95
|
+
<Select
|
|
96
|
+
id="size"
|
|
97
|
+
name="size"
|
|
98
|
+
onChange={(event) => console.log(event)}
|
|
99
|
+
options={['small', 'medium', 'large', 'xlarge']}
|
|
100
|
+
/>
|
|
101
|
+
</FormField>
|
|
102
|
+
<FormField label="Comments" htmlFor="comments" name="comments">
|
|
103
|
+
<TextArea name="comments" id="comments" />
|
|
104
|
+
</FormField>
|
|
105
|
+
<FormField label="Age" htmlFor="age" name="age" pad>
|
|
106
|
+
<RangeInput name="age" id="age" type="age" min={15} max={75} />
|
|
107
|
+
</FormField>
|
|
114
108
|
<Box direction="row" justify="between" margin={{ top: 'medium' }}>
|
|
115
109
|
<Button label="Cancel" />
|
|
116
110
|
<Button type="reset" label="Reset" />
|
|
@@ -3,7 +3,7 @@ var _excluded = ["error", "info", "message", "type"],
|
|
|
3
3
|
_excluded3 = ["children", "className", "component", "contentProps", "disabled", "error", "help", "htmlFor", "info", "label", "margin", "name", "onBlur", "onChange", "onFocus", "pad", "required", "style", "validate", "validateOn"];
|
|
4
4
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
5
5
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
6
|
-
import React, { Children, cloneElement, forwardRef, useContext, useMemo, useState } from 'react';
|
|
6
|
+
import React, { Children, cloneElement, forwardRef, useContext, useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { containsFocus, shouldKeepFocus, withinDropPortal, PortalContext } from '../../utils';
|
|
9
9
|
import { useDebounce } from '../../utils/use-debounce';
|
|
@@ -19,8 +19,9 @@ import { TextInput } from '../TextInput';
|
|
|
19
19
|
import { FormContext } from '../Form/FormContext';
|
|
20
20
|
import { FormFieldPropTypes } from './propTypes';
|
|
21
21
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
22
|
-
|
|
23
|
-
var
|
|
22
|
+
import { AnnounceContext } from '../../contexts/AnnounceContext';
|
|
23
|
+
var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'SelectMultiple', 'TextArea', 'DateInput', 'FileInput', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector', 'StarRating', 'ThumbsRating'];
|
|
24
|
+
var grommetInputPadNames = ['CheckBox', 'CheckBoxGroup', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector'];
|
|
24
25
|
var isGrommetInput = function isGrommetInput(comp) {
|
|
25
26
|
return comp && (grommetInputNames.indexOf(comp.displayName) !== -1 || grommetInputPadNames.indexOf(comp.displayName) !== -1);
|
|
26
27
|
};
|
|
@@ -170,6 +171,12 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
170
171
|
var themeBorder = formFieldTheme.border;
|
|
171
172
|
var debounce = useDebounce();
|
|
172
173
|
var portalContext = useContext(PortalContext);
|
|
174
|
+
var announce = useContext(AnnounceContext);
|
|
175
|
+
useEffect(function () {
|
|
176
|
+
if (error && validate != null && validate.max) {
|
|
177
|
+
announce(error, 'polite', 5000);
|
|
178
|
+
}
|
|
179
|
+
}, [error, announce, validate == null ? void 0 : validate.max]);
|
|
173
180
|
var readOnlyField = useMemo(function () {
|
|
174
181
|
var readOnly = false;
|
|
175
182
|
if (children) {
|
|
@@ -18,7 +18,10 @@ export var ThresholdValidation = function ThresholdValidation() {
|
|
|
18
18
|
},
|
|
19
19
|
name: "issue-description",
|
|
20
20
|
htmlFor: "issue-description"
|
|
21
|
-
}, /*#__PURE__*/React.createElement(TextInput
|
|
21
|
+
}, /*#__PURE__*/React.createElement(TextInput
|
|
22
|
+
// eslint-disable-next-line max-len
|
|
23
|
+
, {
|
|
24
|
+
"aria-label": "text input with limit of 10 characters and threshold of 0.25",
|
|
22
25
|
id: "issue-description",
|
|
23
26
|
name: "issue-description",
|
|
24
27
|
placeholder: "placeholder"
|
|
@@ -30,6 +33,7 @@ export var ThresholdValidation = function ThresholdValidation() {
|
|
|
30
33
|
name: "issue-description-with-default-threshold",
|
|
31
34
|
htmlFor: "issue-description-with-default-threshold"
|
|
32
35
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
36
|
+
"aria-label": "text input with limit of 10 characters",
|
|
33
37
|
id: "issue-description-with-default-threshold",
|
|
34
38
|
name: "issue-description-with-default-threshold",
|
|
35
39
|
placeholder: "placeholder"
|
|
@@ -10,8 +10,11 @@ export var GridAreasAlternative = function GridAreasAlternative() {
|
|
|
10
10
|
columns: ['1/4', '3/4'],
|
|
11
11
|
areas: [['header', 'header'], ['sidebar', 'main'], ['footer', 'footer']],
|
|
12
12
|
gap: "small"
|
|
13
|
+
// needed for keyboard accessibility of scroll region
|
|
14
|
+
,
|
|
15
|
+
tabIndex: 0
|
|
13
16
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
14
|
-
background: "
|
|
17
|
+
background: "dark-1",
|
|
15
18
|
gridArea: "header"
|
|
16
19
|
}, "Header"), /*#__PURE__*/React.createElement(Box, {
|
|
17
20
|
background: "light-5",
|
|
@@ -41,6 +41,10 @@ export interface GrommetProps {
|
|
|
41
41
|
enterCalendar?: string;
|
|
42
42
|
exitCalendar?: string;
|
|
43
43
|
};
|
|
44
|
+
dataChart?: {
|
|
45
|
+
detailTitle?: string;
|
|
46
|
+
detailFocus?: string;
|
|
47
|
+
};
|
|
44
48
|
dataFilters?: {
|
|
45
49
|
clear?: string;
|
|
46
50
|
heading?: string;
|
|
@@ -120,6 +124,24 @@ export interface GrommetProps {
|
|
|
120
124
|
openMenu?: string;
|
|
121
125
|
closeMenu?: string;
|
|
122
126
|
};
|
|
127
|
+
meter?: {
|
|
128
|
+
bar?: {
|
|
129
|
+
singular?: string;
|
|
130
|
+
plural?: string;
|
|
131
|
+
};
|
|
132
|
+
circle?: {
|
|
133
|
+
singular?: string;
|
|
134
|
+
plural?: string;
|
|
135
|
+
};
|
|
136
|
+
pie?: {
|
|
137
|
+
singular?: string;
|
|
138
|
+
plural?: string;
|
|
139
|
+
};
|
|
140
|
+
semicircle?: {
|
|
141
|
+
singular?: string;
|
|
142
|
+
plural?: string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
123
145
|
rangeSelector?: {
|
|
124
146
|
lower?: string;
|
|
125
147
|
upper?: string;
|
|
@@ -171,7 +193,7 @@ export interface GrommetProps {
|
|
|
171
193
|
volumeUp?: string;
|
|
172
194
|
};
|
|
173
195
|
};
|
|
174
|
-
format
|
|
196
|
+
format?: (...args: any[]) => void;
|
|
175
197
|
};
|
|
176
198
|
onAnalytics?: (data: any) => void;
|
|
177
199
|
plain?: boolean;
|
|
@@ -43,6 +43,10 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
43
43
|
enterCalendar: PropTypes.string,
|
|
44
44
|
exitCalendar: PropTypes.string
|
|
45
45
|
}),
|
|
46
|
+
dataChart: PropTypes.shape({
|
|
47
|
+
detailTitle: PropTypes.string,
|
|
48
|
+
detailFocus: PropTypes.string
|
|
49
|
+
}),
|
|
46
50
|
dataFilters: PropTypes.shape({
|
|
47
51
|
clear: PropTypes.string,
|
|
48
52
|
heading: PropTypes.string,
|
|
@@ -122,6 +126,24 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
122
126
|
openMenu: PropTypes.string,
|
|
123
127
|
closeMenu: PropTypes.string
|
|
124
128
|
}),
|
|
129
|
+
meter: PropTypes.shape({
|
|
130
|
+
bar: PropTypes.shape({
|
|
131
|
+
singular: PropTypes.string,
|
|
132
|
+
plural: PropTypes.string
|
|
133
|
+
}),
|
|
134
|
+
circle: PropTypes.shape({
|
|
135
|
+
singular: PropTypes.string,
|
|
136
|
+
plural: PropTypes.string
|
|
137
|
+
}),
|
|
138
|
+
pie: PropTypes.shape({
|
|
139
|
+
singular: PropTypes.string,
|
|
140
|
+
plural: PropTypes.string
|
|
141
|
+
}),
|
|
142
|
+
semicirlce: PropTypes.shape({
|
|
143
|
+
singular: PropTypes.string,
|
|
144
|
+
plural: PropTypes.string
|
|
145
|
+
})
|
|
146
|
+
}),
|
|
125
147
|
rangeSelector: PropTypes.shape({
|
|
126
148
|
lower: PropTypes.string,
|
|
127
149
|
upper: PropTypes.string
|
|
@@ -6,11 +6,11 @@ export var Vars = function Vars() {
|
|
|
6
6
|
cssVars: true
|
|
7
7
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
8
8
|
pad: "medium",
|
|
9
|
-
background: "var(--
|
|
9
|
+
background: "var(--light-6)",
|
|
10
10
|
gap: "medium"
|
|
11
11
|
}, /*#__PURE__*/React.createElement(Box, null, "Checkout Grommet variables, you can find them in the StyledGrommet DOM."), /*#__PURE__*/React.createElement(Box, {
|
|
12
12
|
"with": true
|
|
13
|
-
}, "For example, the background color in this Box is using var(--
|
|
13
|
+
}, "For example, the background color in this Box is using var(--light-6)")));
|
|
14
14
|
};
|
|
15
15
|
export default {
|
|
16
16
|
title: 'Utilities/Grommet/Vars'
|
|
@@ -2,20 +2,16 @@ var _excluded = ["background", "children", "full", "id", "margin", "modal", "onC
|
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { forwardRef, useContext, useEffect, useMemo, useRef } from 'react';
|
|
5
|
-
import
|
|
5
|
+
import { ThemeContext } from 'styled-components';
|
|
6
6
|
import { FocusedContainer } from '../FocusedContainer';
|
|
7
7
|
import { Keyboard } from '../Keyboard';
|
|
8
8
|
import { ResponsiveContext } from '../../contexts/ResponsiveContext';
|
|
9
9
|
import { OptionsContext } from '../../contexts/OptionsContext';
|
|
10
10
|
import { ContainerTargetContext } from '../../contexts/ContainerTargetContext';
|
|
11
11
|
import { useAnalytics } from '../../contexts/AnalyticsContext';
|
|
12
|
-
import { backgroundIsDark, findVisibleParent, PortalContext
|
|
12
|
+
import { backgroundIsDark, findVisibleParent, PortalContext } from '../../utils';
|
|
13
13
|
import { StyledLayer, StyledContainer, StyledOverlay } from './StyledLayer';
|
|
14
14
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
15
|
-
var HiddenAnchor = styled.a.withConfig(styledComponentsConfig).withConfig({
|
|
16
|
-
displayName: "LayerContainer__HiddenAnchor",
|
|
17
|
-
componentId: "sc-1srj14c-0"
|
|
18
|
-
})(["width:0;height:0;overflow:hidden;position:absolute;&:focus{outline:none;}"]);
|
|
19
15
|
var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
20
16
|
var background = _ref.background,
|
|
21
17
|
children = _ref.children,
|
|
@@ -44,7 +40,6 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
44
40
|
// should not be supported in v3
|
|
45
41
|
var _useContext = useContext(OptionsContext),
|
|
46
42
|
layerOptions = _useContext.layer;
|
|
47
|
-
var anchorRef = useRef();
|
|
48
43
|
var containerRef = useRef();
|
|
49
44
|
var layerRef = useRef();
|
|
50
45
|
var portalContext = useContext(PortalContext);
|
|
@@ -82,7 +77,8 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
82
77
|
// Once layer is open we make sure it has focus so that you
|
|
83
78
|
// can start tabbing inside the layer. If the caller put focus
|
|
84
79
|
// on an element already, we honor that. Otherwise, we put
|
|
85
|
-
// the focus
|
|
80
|
+
// the focus within the layer. Look at FocusedContainer.js for
|
|
81
|
+
// more details.
|
|
86
82
|
var element = document.activeElement;
|
|
87
83
|
while (element) {
|
|
88
84
|
if (element === containerRef.current) {
|
|
@@ -91,9 +87,6 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
91
87
|
}
|
|
92
88
|
element = element.parentElement;
|
|
93
89
|
}
|
|
94
|
-
if (modal && !element && anchorRef.current) {
|
|
95
|
-
anchorRef.current.focus();
|
|
96
|
-
}
|
|
97
90
|
}
|
|
98
91
|
}, [modal, position, ref]);
|
|
99
92
|
useEffect(function () {
|
|
@@ -193,10 +186,6 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
193
186
|
// or outside of the layer
|
|
194
187
|
,
|
|
195
188
|
"data-g-portal-id": portalId
|
|
196
|
-
}), /*#__PURE__*/React.createElement(HiddenAnchor, {
|
|
197
|
-
ref: anchorRef,
|
|
198
|
-
tabIndex: "-1",
|
|
199
|
-
"aria-hidden": "true"
|
|
200
189
|
}), children);
|
|
201
190
|
content = /*#__PURE__*/React.createElement(StyledLayer, _extends({
|
|
202
191
|
ref: layerRef,
|
|
@@ -208,7 +208,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
208
208
|
var draggingRef = useRef();
|
|
209
209
|
var sendAnalytics = useAnalytics();
|
|
210
210
|
var ariaProps = {
|
|
211
|
-
role: onClickItem
|
|
211
|
+
role: onClickItem ? 'listbox' : 'list'
|
|
212
212
|
};
|
|
213
213
|
if (active >= 0) {
|
|
214
214
|
var activeId;
|
|
@@ -268,7 +268,19 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
268
268
|
event.preventDefault();
|
|
269
269
|
if (active) {
|
|
270
270
|
var min = onOrder ? 1 : 0;
|
|
271
|
-
|
|
271
|
+
var activeElementIndex = Math.max(active - 1, min);
|
|
272
|
+
updateActive(activeElementIndex);
|
|
273
|
+
|
|
274
|
+
// Ensure the active item is in view
|
|
275
|
+
// setTimeout for activeElement to be updated
|
|
276
|
+
setTimeout(function () {
|
|
277
|
+
var _listRef$current;
|
|
278
|
+
// eslint-disable max-len
|
|
279
|
+
(_listRef$current = listRef.current) == null || (_listRef$current = _listRef$current.children[activeElementIndex]) == null || _listRef$current.scrollIntoView({
|
|
280
|
+
behavior: 'smooth',
|
|
281
|
+
block: 'nearest'
|
|
282
|
+
});
|
|
283
|
+
}, 0);
|
|
272
284
|
}
|
|
273
285
|
}
|
|
274
286
|
},
|
|
@@ -278,7 +290,19 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
278
290
|
if (orderableData && orderableData.length) {
|
|
279
291
|
var min = onOrder ? 1 : 0;
|
|
280
292
|
var max = onOrder ? orderableData.length * 2 - 2 : data.length - 1;
|
|
281
|
-
|
|
293
|
+
var activeElementIndex = active >= min ? Math.min(active + 1, max) : min;
|
|
294
|
+
updateActive(activeElementIndex);
|
|
295
|
+
|
|
296
|
+
// Ensure the active item is in view
|
|
297
|
+
// setTimeout for activeElement to be updated
|
|
298
|
+
setTimeout(function () {
|
|
299
|
+
var _listRef$current2;
|
|
300
|
+
// eslint-disable max-len
|
|
301
|
+
(_listRef$current2 = listRef.current) == null || (_listRef$current2 = _listRef$current2.children[activeElementIndex]) == null || _listRef$current2.scrollIntoView({
|
|
302
|
+
behavior: 'smooth',
|
|
303
|
+
block: 'nearest'
|
|
304
|
+
});
|
|
305
|
+
}, 0);
|
|
282
306
|
}
|
|
283
307
|
}
|
|
284
308
|
},
|