grommet 2.29.0 → 2.30.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 +9 -3
- package/components/Anchor/StyledAnchor.js +6 -3
- package/components/Button/Button.js +10 -14
- package/components/Button/StyledButtonKind.js +21 -9
- package/components/Calendar/Calendar.js +80 -71
- package/components/Data/Data.js +48 -26
- package/components/Data/DataForm.js +203 -48
- package/components/Data/filter.js +17 -6
- package/components/Data/index.d.ts +12 -7
- package/components/Data/index.js +6 -2
- package/components/Data/propTypes.js +3 -2
- package/components/Data/stories/Cards.js +1 -1
- package/components/Data/stories/Complex.js +84 -0
- package/components/Data/stories/Controlled.js +1 -1
- package/components/Data/stories/DataTable.js +11 -4
- package/components/Data/stories/Infinite.js +53 -57
- package/components/Data/stories/Inline.js +7 -2
- package/components/Data/stories/List.js +1 -1
- package/components/Data/stories/Simple.js +1 -1
- package/components/Data/stories/SpaceX.js +114 -140
- package/components/Data/stories/StarWars.js +127 -0
- package/components/Data/stories/Views.js +56 -0
- package/components/DataFilter/DataFilter.js +33 -42
- package/components/DataFilter/stories/Simple.js +7 -4
- package/components/DataFilters/DataFilters.js +117 -40
- package/components/DataFilters/index.d.ts +1 -0
- package/components/DataFilters/propTypes.js +2 -1
- package/components/DataFilters/stories/Drop.js +7 -4
- package/components/DataFilters/stories/Inline.js +24 -6
- package/components/DataFilters/stories/Layer.js +46 -0
- package/components/DataFilters/stories/Simple.js +7 -4
- package/components/DataSearch/DataSearch.js +70 -13
- package/components/DataSearch/index.d.ts +10 -1
- package/components/DataSearch/propTypes.js +6 -1
- package/components/DataSearch/stories/Drop.js +42 -0
- package/components/DataSearch/stories/Responsive.js +42 -0
- package/components/DataSearch/stories/Simple.js +5 -2
- package/components/DataSort/DataSort.js +67 -18
- package/components/DataSort/index.d.ts +4 -8
- package/components/DataSort/propTypes.js +9 -2
- package/components/DataSort/stories/Drop.js +41 -0
- package/components/DataSort/stories/Simple.js +9 -5
- package/components/DataSummary/DataSummary.js +4 -4
- package/components/DataSummary/index.d.ts +1 -1
- package/components/DataSummary/propTypes.js +2 -2
- package/components/DataSummary/stories/Simple.js +7 -4
- package/components/DataTable/Cell.js +1 -1
- package/components/DataTable/DataTable.js +23 -9
- package/components/DataTable/GroupedBody.js +1 -0
- package/components/DataTable/Resizer.js +1 -3
- package/components/DataTable/StyledDataTable.js +2 -2
- package/components/DataTable/index.d.ts +23 -6
- package/components/DataTable/stories/SpaceX.js +72 -76
- package/components/DataTable/stories/SpaceXUngrouped.js +33 -35
- package/components/DataTableColumns/DataTableColumns.js +226 -0
- package/components/DataTableColumns/README.md +2 -0
- package/components/DataTableColumns/index.d.ts +10 -0
- package/components/DataTableColumns/index.js +6 -0
- package/components/DataTableColumns/propTypes.js +18 -0
- package/components/DataTableColumns/stories/Simple.js +51 -0
- package/components/DataView/DataView.js +73 -0
- package/components/DataView/README.md +2 -0
- package/components/DataView/index.d.ts +15 -0
- package/components/DataView/index.js +6 -0
- package/components/DataView/propTypes.js +10 -0
- package/components/DataView/stories/Simple.js +51 -0
- package/components/DateInput/utils.js +1 -3
- package/components/Distribution/Distribution.js +1 -1
- package/components/Drop/DropContainer.js +56 -100
- package/components/Drop/stories/Overflow.js +1 -0
- package/components/DropButton/DropButton.js +1 -1
- package/components/Form/stories/Controlled.js +11 -2
- package/components/Form/stories/ControlledInput.js +13 -2
- package/components/Form/stories/ControlledInputLazy.js +13 -2
- package/components/Form/stories/ControlledLazy.js +13 -2
- package/components/Form/stories/FieldWithChildren.js +13 -2
- package/components/Form/stories/FieldWithComponentProp.js +17 -1
- package/components/Form/stories/Uncontrolled.js +15 -2
- package/components/Form/stories/ValidateOnBlur.js +18 -0
- package/components/Form/stories/ValidateOnChange.js +6 -0
- package/components/Form/stories/ValidateOnMount.js +4 -0
- package/components/Form/stories/typescript/TypedForm.tsx +25 -3
- package/components/FormField/FormField.js +15 -4
- package/components/Layer/LayerContainer.js +2 -3
- package/components/Layer/PortalContext.js +1 -1
- package/components/Layer/StyledLayer.js +3 -1
- package/components/Layer/stories/Form.js +54 -28
- package/components/List/List.js +1 -8
- package/components/Pagination/Pagination.js +27 -8
- package/components/Paragraph/Paragraph.js +18 -6
- package/components/Select/utils.js +1 -1
- package/components/Skeleton/stories/GridContainer.js +1 -3
- package/components/Tabs/Tabs.js +2 -1
- package/components/Text/Text.js +9 -1
- package/components/Text/TextContext.js +8 -0
- package/components/TextInput/StyledTextInput.js +3 -1
- package/components/TextInput/TextInput.js +4 -2
- package/components/TextInput/index.d.ts +3 -1
- package/components/TextInput/propTypes.js +3 -1
- package/components/Toolbar/stories/Simple.js +1 -1
- package/components/Video/Video.js +4 -8
- package/components/WorldMap/WorldMap.js +18 -17
- package/components/index.d.ts +2 -0
- package/components/index.js +18 -6
- package/es6/components/Anchor/Anchor.js +9 -3
- package/es6/components/Anchor/StyledAnchor.js +6 -3
- package/es6/components/Button/Button.js +10 -14
- package/es6/components/Button/StyledButtonKind.js +21 -9
- package/es6/components/Calendar/Calendar.js +80 -71
- package/es6/components/Data/Data.js +48 -26
- package/es6/components/Data/DataForm.js +199 -51
- package/es6/components/Data/filter.js +17 -6
- package/es6/components/Data/index.d.ts +12 -7
- package/es6/components/Data/index.js +1 -1
- package/es6/components/Data/propTypes.js +3 -2
- package/es6/components/Data/stories/Cards.js +1 -1
- package/es6/components/Data/stories/Complex.js +78 -0
- package/es6/components/Data/stories/Controlled.js +1 -1
- package/es6/components/Data/stories/DataTable.js +12 -5
- package/es6/components/Data/stories/Infinite.js +53 -57
- package/es6/components/Data/stories/Inline.js +7 -2
- package/es6/components/Data/stories/List.js +1 -1
- package/es6/components/Data/stories/Simple.js +1 -1
- package/es6/components/Data/stories/SpaceX.js +114 -140
- package/es6/components/Data/stories/StarWars.js +121 -0
- package/es6/components/Data/stories/Views.js +50 -0
- package/es6/components/DataFilter/DataFilter.js +33 -42
- package/es6/components/DataFilter/stories/Simple.js +8 -5
- package/es6/components/DataFilters/DataFilters.js +118 -41
- package/es6/components/DataFilters/index.d.ts +1 -0
- package/es6/components/DataFilters/propTypes.js +2 -1
- package/es6/components/DataFilters/stories/Drop.js +8 -5
- package/es6/components/DataFilters/stories/Inline.js +25 -7
- package/es6/components/DataFilters/stories/Layer.js +40 -0
- package/es6/components/DataFilters/stories/Simple.js +8 -5
- package/es6/components/DataSearch/DataSearch.js +71 -14
- package/es6/components/DataSearch/index.d.ts +10 -1
- package/es6/components/DataSearch/propTypes.js +5 -1
- package/es6/components/DataSearch/stories/Drop.js +36 -0
- package/es6/components/DataSearch/stories/Responsive.js +36 -0
- package/es6/components/DataSearch/stories/Simple.js +6 -3
- package/es6/components/DataSort/DataSort.js +67 -18
- package/es6/components/DataSort/index.d.ts +4 -8
- package/es6/components/DataSort/propTypes.js +8 -2
- package/es6/components/DataSort/stories/Drop.js +35 -0
- package/es6/components/DataSort/stories/Simple.js +10 -6
- package/es6/components/DataSummary/DataSummary.js +4 -4
- package/es6/components/DataSummary/index.d.ts +1 -1
- package/es6/components/DataSummary/propTypes.js +2 -2
- package/es6/components/DataSummary/stories/Simple.js +8 -5
- package/es6/components/DataTable/Cell.js +2 -2
- package/es6/components/DataTable/DataTable.js +23 -9
- package/es6/components/DataTable/GroupedBody.js +1 -0
- package/es6/components/DataTable/Resizer.js +1 -3
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DataTable/index.d.ts +23 -6
- package/es6/components/DataTable/stories/SpaceX.js +72 -76
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +33 -35
- package/es6/components/DataTableColumns/DataTableColumns.js +219 -0
- package/es6/components/DataTableColumns/README.md +2 -0
- package/es6/components/DataTableColumns/index.d.ts +10 -0
- package/es6/components/DataTableColumns/index.js +1 -0
- package/es6/components/DataTableColumns/propTypes.js +12 -0
- package/es6/components/DataTableColumns/stories/Simple.js +46 -0
- package/es6/components/DataView/DataView.js +66 -0
- package/es6/components/DataView/README.md +2 -0
- package/es6/components/DataView/index.d.ts +15 -0
- package/es6/components/DataView/index.js +1 -0
- package/es6/components/DataView/propTypes.js +5 -0
- package/es6/components/DataView/stories/Simple.js +45 -0
- package/es6/components/DateInput/utils.js +1 -3
- package/es6/components/Distribution/Distribution.js +1 -1
- package/es6/components/Drop/DropContainer.js +58 -102
- package/es6/components/Drop/stories/Overflow.js +1 -0
- package/es6/components/DropButton/DropButton.js +1 -1
- package/es6/components/Form/stories/Controlled.js +11 -2
- package/es6/components/Form/stories/ControlledInput.js +13 -2
- package/es6/components/Form/stories/ControlledInputLazy.js +13 -2
- package/es6/components/Form/stories/ControlledLazy.js +13 -2
- package/es6/components/Form/stories/FieldWithChildren.js +13 -2
- package/es6/components/Form/stories/FieldWithComponentProp.js +17 -1
- package/es6/components/Form/stories/Uncontrolled.js +15 -2
- package/es6/components/Form/stories/ValidateOnBlur.js +19 -1
- package/es6/components/Form/stories/ValidateOnChange.js +6 -0
- package/es6/components/Form/stories/ValidateOnMount.js +4 -0
- package/es6/components/Form/stories/typescript/TypedForm.tsx +25 -3
- package/es6/components/FormField/FormField.js +15 -4
- package/es6/components/Layer/LayerContainer.js +2 -3
- package/es6/components/Layer/PortalContext.js +1 -1
- package/es6/components/Layer/StyledLayer.js +3 -1
- package/es6/components/Layer/stories/Form.js +56 -29
- package/es6/components/List/List.js +1 -8
- package/es6/components/Pagination/Pagination.js +27 -8
- package/es6/components/Paragraph/Paragraph.js +19 -7
- package/es6/components/Select/utils.js +1 -1
- package/es6/components/Skeleton/stories/GridContainer.js +1 -3
- package/es6/components/Tabs/Tabs.js +2 -1
- package/es6/components/Text/Text.js +10 -2
- package/es6/components/Text/TextContext.js +2 -0
- package/es6/components/TextInput/StyledTextInput.js +4 -2
- package/es6/components/TextInput/TextInput.js +4 -2
- package/es6/components/TextInput/index.d.ts +3 -1
- package/es6/components/TextInput/propTypes.js +3 -1
- package/es6/components/Toolbar/stories/Simple.js +1 -1
- package/es6/components/Video/Video.js +4 -8
- package/es6/components/WorldMap/WorldMap.js +18 -17
- package/es6/components/index.d.ts +2 -0
- package/es6/components/index.js +3 -1
- package/es6/languages/default.json +14 -4
- package/es6/themes/base.d.ts +31 -0
- package/es6/themes/base.js +31 -1
- package/es6/utils/DOM.js +17 -0
- package/es6/utils/PortalContext.js +1 -1
- package/es6/utils/background.js +9 -1
- package/es6/utils/colors.js +2 -2
- package/es6/utils/general-prop-types.js +1 -1
- package/es6/utils/index.d.ts +7 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +14 -4
- package/package.json +42 -40
- package/themes/base.d.ts +31 -0
- package/themes/base.js +31 -1
- package/utils/DOM.js +20 -2
- package/utils/PortalContext.js +1 -1
- package/utils/background.js +8 -0
- package/utils/colors.js +3 -1
- package/utils/general-prop-types.js +1 -1
- package/utils/index.d.ts +7 -1
|
@@ -29,9 +29,9 @@ export var ControlledLazy = function ControlledLazy() {
|
|
|
29
29
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
30
30
|
// <Grommet theme={...}>
|
|
31
31
|
React.createElement(Box, {
|
|
32
|
-
fill: true,
|
|
33
32
|
align: "center",
|
|
34
|
-
justify: "center"
|
|
33
|
+
justify: "center",
|
|
34
|
+
pad: "large"
|
|
35
35
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
36
36
|
width: "medium"
|
|
37
37
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
@@ -48,14 +48,18 @@ export var ControlledLazy = function ControlledLazy() {
|
|
|
48
48
|
}
|
|
49
49
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
50
50
|
label: "Name",
|
|
51
|
+
htmlFor: "name",
|
|
51
52
|
name: "name"
|
|
52
53
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
54
|
+
id: "name",
|
|
53
55
|
name: "name"
|
|
54
56
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
55
57
|
label: "Email",
|
|
58
|
+
htmlFor: "email",
|
|
56
59
|
name: "email",
|
|
57
60
|
required: true
|
|
58
61
|
}, /*#__PURE__*/React.createElement(MaskedInput, {
|
|
62
|
+
id: "email",
|
|
59
63
|
name: "email",
|
|
60
64
|
mask: [{
|
|
61
65
|
regexp: /^[\w\-_.]+$/,
|
|
@@ -83,20 +87,27 @@ export var ControlledLazy = function ControlledLazy() {
|
|
|
83
87
|
options: ['morning', 'evening']
|
|
84
88
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
85
89
|
label: "Size",
|
|
90
|
+
htmlFor: "size",
|
|
86
91
|
name: "size"
|
|
87
92
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
93
|
+
id: "size",
|
|
94
|
+
"aria-label": "size",
|
|
88
95
|
name: "size",
|
|
89
96
|
options: ['small', 'medium', 'large']
|
|
90
97
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
91
98
|
label: "Comments",
|
|
99
|
+
htmlFor: "comments",
|
|
92
100
|
name: "comments"
|
|
93
101
|
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
102
|
+
id: "comments",
|
|
94
103
|
name: "comments"
|
|
95
104
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
96
105
|
label: "Age",
|
|
106
|
+
htmlFor: "age",
|
|
97
107
|
name: "age",
|
|
98
108
|
pad: true
|
|
99
109
|
}, /*#__PURE__*/React.createElement(RangeInput, {
|
|
110
|
+
id: "age",
|
|
100
111
|
name: "age",
|
|
101
112
|
min: 15,
|
|
102
113
|
max: 75
|
|
@@ -23,9 +23,9 @@ export var FieldWithChildren = function FieldWithChildren() {
|
|
|
23
23
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
24
24
|
// <Grommet theme={...}>
|
|
25
25
|
React.createElement(Box, {
|
|
26
|
-
fill: true,
|
|
27
26
|
align: "center",
|
|
28
|
-
justify: "center"
|
|
27
|
+
justify: "center",
|
|
28
|
+
pad: "large"
|
|
29
29
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
30
30
|
width: "medium"
|
|
31
31
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
@@ -43,15 +43,19 @@ export var FieldWithChildren = function FieldWithChildren() {
|
|
|
43
43
|
}
|
|
44
44
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
45
45
|
label: "Name",
|
|
46
|
+
htmlFor: "name",
|
|
46
47
|
name: "name",
|
|
47
48
|
required: true
|
|
48
49
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
50
|
+
id: "name",
|
|
49
51
|
name: "name"
|
|
50
52
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
51
53
|
label: "Email",
|
|
54
|
+
htmlFor: "email",
|
|
52
55
|
name: "email",
|
|
53
56
|
required: true
|
|
54
57
|
}, /*#__PURE__*/React.createElement(MaskedInput, {
|
|
58
|
+
id: "email",
|
|
55
59
|
name: "email",
|
|
56
60
|
mask: [{
|
|
57
61
|
regexp: /^[\w\-_.]+$/,
|
|
@@ -88,21 +92,28 @@ export var FieldWithChildren = function FieldWithChildren() {
|
|
|
88
92
|
options: ['morning', 'evening']
|
|
89
93
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
90
94
|
label: "Size",
|
|
95
|
+
htmlFor: "size",
|
|
91
96
|
name: "size"
|
|
92
97
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
98
|
+
id: "size",
|
|
99
|
+
"aria-label": "size",
|
|
93
100
|
name: "size",
|
|
94
101
|
multiple: true,
|
|
95
102
|
options: ['small', 'medium', 'large']
|
|
96
103
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
97
104
|
label: "Comments",
|
|
105
|
+
htmlFor: "comments",
|
|
98
106
|
name: "comments"
|
|
99
107
|
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
108
|
+
id: "comments",
|
|
100
109
|
name: "comments"
|
|
101
110
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
102
111
|
label: "Age",
|
|
112
|
+
htmlFor: "age",
|
|
103
113
|
name: "age",
|
|
104
114
|
pad: true
|
|
105
115
|
}, /*#__PURE__*/React.createElement(RangeInput, {
|
|
116
|
+
id: "age",
|
|
106
117
|
name: "age",
|
|
107
118
|
min: 15,
|
|
108
119
|
max: 75
|
|
@@ -6,7 +6,6 @@ export var FieldWithComponentProp = function FieldWithComponentProp() {
|
|
|
6
6
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
7
7
|
// <Grommet theme={...}>
|
|
8
8
|
React.createElement(Box, {
|
|
9
|
-
fill: true,
|
|
10
9
|
overflow: "auto",
|
|
11
10
|
align: "center",
|
|
12
11
|
justify: "center",
|
|
@@ -25,6 +24,8 @@ export var FieldWithComponentProp = function FieldWithComponentProp() {
|
|
|
25
24
|
}
|
|
26
25
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
27
26
|
label: "Name",
|
|
27
|
+
htmlFor: "name",
|
|
28
|
+
id: "name",
|
|
28
29
|
name: "name",
|
|
29
30
|
required: true,
|
|
30
31
|
validate: [{
|
|
@@ -41,11 +42,15 @@ export var FieldWithComponentProp = function FieldWithComponentProp() {
|
|
|
41
42
|
}]
|
|
42
43
|
}), /*#__PURE__*/React.createElement(FormField, {
|
|
43
44
|
label: "Email",
|
|
45
|
+
htmlFor: "email",
|
|
46
|
+
id: "email",
|
|
44
47
|
name: "email",
|
|
45
48
|
type: "email",
|
|
46
49
|
required: true
|
|
47
50
|
}), /*#__PURE__*/React.createElement(FormField, {
|
|
48
51
|
label: "Employee ID",
|
|
52
|
+
htmlFor: "employeeId",
|
|
53
|
+
id: "employeeId",
|
|
49
54
|
name: "employeeId",
|
|
50
55
|
required: true,
|
|
51
56
|
validate: {
|
|
@@ -62,6 +67,9 @@ export var FieldWithComponentProp = function FieldWithComponentProp() {
|
|
|
62
67
|
options: ['morning', 'evening']
|
|
63
68
|
}), /*#__PURE__*/React.createElement(FormField, {
|
|
64
69
|
label: "Size",
|
|
70
|
+
htmlFor: "size",
|
|
71
|
+
id: "size",
|
|
72
|
+
"aria-label": "size",
|
|
65
73
|
name: "size",
|
|
66
74
|
component: Select,
|
|
67
75
|
onChange: function onChange(event) {
|
|
@@ -70,10 +78,14 @@ export var FieldWithComponentProp = function FieldWithComponentProp() {
|
|
|
70
78
|
options: ['small', 'medium', 'large', 'xlarge']
|
|
71
79
|
}), /*#__PURE__*/React.createElement(FormField, {
|
|
72
80
|
label: "Comments",
|
|
81
|
+
htmlFor: "comments",
|
|
82
|
+
id: "comments",
|
|
73
83
|
name: "comments",
|
|
74
84
|
component: TextArea
|
|
75
85
|
}), /*#__PURE__*/React.createElement(FormField, {
|
|
76
86
|
label: "Age",
|
|
87
|
+
htmlFor: "age",
|
|
88
|
+
id: "age",
|
|
77
89
|
name: "age",
|
|
78
90
|
component: RangeInput,
|
|
79
91
|
pad: true,
|
|
@@ -81,10 +93,14 @@ export var FieldWithComponentProp = function FieldWithComponentProp() {
|
|
|
81
93
|
max: 75
|
|
82
94
|
}), /*#__PURE__*/React.createElement(FormField, {
|
|
83
95
|
label: "File",
|
|
96
|
+
htmlFor: "file",
|
|
97
|
+
id: "file",
|
|
84
98
|
name: "file",
|
|
85
99
|
component: FileInput
|
|
86
100
|
}), /*#__PURE__*/React.createElement(FormField, {
|
|
87
101
|
label: "Custom",
|
|
102
|
+
htmlFor: "custom",
|
|
103
|
+
id: "custom",
|
|
88
104
|
name: "custom",
|
|
89
105
|
component: function component(props) {
|
|
90
106
|
return /*#__PURE__*/React.createElement("input", props);
|
|
@@ -7,9 +7,9 @@ export var Uncontrolled = function Uncontrolled() {
|
|
|
7
7
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
8
8
|
// <Grommet theme={...}>
|
|
9
9
|
React.createElement(Box, {
|
|
10
|
-
fill: true,
|
|
11
10
|
align: "center",
|
|
12
|
-
justify: "center"
|
|
11
|
+
justify: "center",
|
|
12
|
+
pad: "large"
|
|
13
13
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
14
14
|
width: "medium"
|
|
15
15
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
@@ -21,15 +21,19 @@ export var Uncontrolled = function Uncontrolled() {
|
|
|
21
21
|
}
|
|
22
22
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
23
23
|
label: "Name",
|
|
24
|
+
htmlFor: "name",
|
|
24
25
|
name: "name"
|
|
25
26
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
27
|
+
id: "name",
|
|
26
28
|
name: "name",
|
|
27
29
|
suggestions: suggestions
|
|
28
30
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
29
31
|
label: "Email",
|
|
32
|
+
htmlFor: "email",
|
|
30
33
|
name: "email",
|
|
31
34
|
required: true
|
|
32
35
|
}, /*#__PURE__*/React.createElement(MaskedInput, {
|
|
36
|
+
id: "email",
|
|
33
37
|
name: "email",
|
|
34
38
|
mask: [{
|
|
35
39
|
regexp: /^[\w\-_.]+$/,
|
|
@@ -57,28 +61,37 @@ export var Uncontrolled = function Uncontrolled() {
|
|
|
57
61
|
options: ['morning', 'evening']
|
|
58
62
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
59
63
|
label: "Size",
|
|
64
|
+
htmlFor: "size",
|
|
60
65
|
name: "size"
|
|
61
66
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
67
|
+
id: "size",
|
|
68
|
+
"aria-label": "size",
|
|
62
69
|
name: "size",
|
|
63
70
|
options: ['small', 'medium', 'large']
|
|
64
71
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
65
72
|
label: "Comments",
|
|
73
|
+
htmlFor: "comments",
|
|
66
74
|
name: "comments"
|
|
67
75
|
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
76
|
+
id: "comments",
|
|
68
77
|
name: "comments"
|
|
69
78
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
70
79
|
label: "Age",
|
|
80
|
+
htmlFor: "age",
|
|
71
81
|
name: "age",
|
|
72
82
|
pad: true
|
|
73
83
|
}, /*#__PURE__*/React.createElement(RangeInput, {
|
|
84
|
+
id: "age",
|
|
74
85
|
name: "age",
|
|
75
86
|
min: 15,
|
|
76
87
|
max: 75
|
|
77
88
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
78
89
|
required: true,
|
|
79
90
|
label: "Image",
|
|
91
|
+
htmlFor: "image",
|
|
80
92
|
name: "image"
|
|
81
93
|
}, /*#__PURE__*/React.createElement(FileInput, {
|
|
94
|
+
id: "image",
|
|
82
95
|
name: "image"
|
|
83
96
|
})), /*#__PURE__*/React.createElement(Box, {
|
|
84
97
|
direction: "row",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StatusGood } from "grommet-icons/es6/icons/StatusGood";
|
|
3
|
-
import { Box, Button, Form, FormField, TextInput } from 'grommet';
|
|
3
|
+
import { Box, Button, Form, FormField, Select, TextInput } from 'grommet';
|
|
4
4
|
export var ValidateOnBlur = function ValidateOnBlur() {
|
|
5
5
|
return (
|
|
6
6
|
/*#__PURE__*/
|
|
@@ -48,6 +48,24 @@ export var ValidateOnBlur = function ValidateOnBlur() {
|
|
|
48
48
|
name: "email",
|
|
49
49
|
"aria-label": "email",
|
|
50
50
|
type: "email"
|
|
51
|
+
})), /*#__PURE__*/React.createElement(FormField, {
|
|
52
|
+
label: "Size",
|
|
53
|
+
name: "select-size",
|
|
54
|
+
htmlFor: "select-size__input",
|
|
55
|
+
required: true,
|
|
56
|
+
validate: function validate(val) {
|
|
57
|
+
if (val === 'small') {
|
|
58
|
+
return {
|
|
59
|
+
message: 'Only 10 left in stock!',
|
|
60
|
+
status: 'info'
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
66
|
+
name: "select-size",
|
|
67
|
+
id: "select-size",
|
|
68
|
+
options: ['small', 'medium', 'large']
|
|
51
69
|
})), /*#__PURE__*/React.createElement(Box, {
|
|
52
70
|
direction: "row",
|
|
53
71
|
justify: "between",
|
|
@@ -29,6 +29,8 @@ export var ValidateOnChange = function ValidateOnChange() {
|
|
|
29
29
|
}
|
|
30
30
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
31
31
|
label: "First Name",
|
|
32
|
+
htmlFor: "firstName",
|
|
33
|
+
id: "firstName",
|
|
32
34
|
name: "firstName",
|
|
33
35
|
required: true,
|
|
34
36
|
validate: [{
|
|
@@ -39,6 +41,8 @@ export var ValidateOnChange = function ValidateOnChange() {
|
|
|
39
41
|
}]
|
|
40
42
|
}), /*#__PURE__*/React.createElement(FormField, {
|
|
41
43
|
label: "Last Name",
|
|
44
|
+
htmlFor: "lastName",
|
|
45
|
+
id: "lastName",
|
|
42
46
|
name: "lastName",
|
|
43
47
|
required: true,
|
|
44
48
|
validate: [{
|
|
@@ -63,7 +67,9 @@ export var ValidateOnChange = function ValidateOnChange() {
|
|
|
63
67
|
}
|
|
64
68
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
65
69
|
name: "select-size",
|
|
70
|
+
htmlFor: "select-size",
|
|
66
71
|
id: "select-size",
|
|
72
|
+
"aria-label": "select-size",
|
|
67
73
|
options: ['small', 'medium', 'large']
|
|
68
74
|
})), /*#__PURE__*/React.createElement(Box, {
|
|
69
75
|
direction: "row",
|
|
@@ -38,6 +38,8 @@ export var ValidateOnMount = function ValidateOnMount() {
|
|
|
38
38
|
}
|
|
39
39
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
40
40
|
label: "First Name",
|
|
41
|
+
htmlFor: "firstName",
|
|
42
|
+
id: "firstName",
|
|
41
43
|
name: "firstName",
|
|
42
44
|
required: true,
|
|
43
45
|
validate: [{
|
|
@@ -48,6 +50,8 @@ export var ValidateOnMount = function ValidateOnMount() {
|
|
|
48
50
|
}]
|
|
49
51
|
}), /*#__PURE__*/React.createElement(FormField, {
|
|
50
52
|
label: "Last Name",
|
|
53
|
+
htmlFor: "lastName",
|
|
54
|
+
id: "lastName",
|
|
51
55
|
name: "lastName",
|
|
52
56
|
required: true,
|
|
53
57
|
validate: [{
|
|
@@ -31,7 +31,7 @@ export const TypedForm = () => {
|
|
|
31
31
|
return (
|
|
32
32
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
33
33
|
// <Grommet theme={...}>
|
|
34
|
-
<Box
|
|
34
|
+
<Box align="center" justify="center" pad="large">
|
|
35
35
|
<Box width="medium">
|
|
36
36
|
{/*
|
|
37
37
|
Type annotations can only be used in TypeScript files
|
|
@@ -50,13 +50,24 @@ export const TypedForm = () => {
|
|
|
50
50
|
>
|
|
51
51
|
<FormField
|
|
52
52
|
label="Name"
|
|
53
|
+
htmlFor="name"
|
|
54
|
+
id="name"
|
|
53
55
|
name="name"
|
|
54
56
|
required
|
|
55
57
|
validate={{ regexp: /^[a-z]/i }}
|
|
56
58
|
/>
|
|
57
|
-
<FormField
|
|
59
|
+
<FormField
|
|
60
|
+
label="Email"
|
|
61
|
+
htmlFor="email"
|
|
62
|
+
id="email"
|
|
63
|
+
name="email"
|
|
64
|
+
type="email"
|
|
65
|
+
required
|
|
66
|
+
/>
|
|
58
67
|
<FormField
|
|
59
68
|
label="Employee ID"
|
|
69
|
+
htmlFor="employeeId"
|
|
70
|
+
id="employeeId"
|
|
60
71
|
name="employeeId"
|
|
61
72
|
required
|
|
62
73
|
validate={{ regexp: /^[0-9]{4,6}$/, message: '4-6 digits' }}
|
|
@@ -75,14 +86,25 @@ export const TypedForm = () => {
|
|
|
75
86
|
/>
|
|
76
87
|
<FormField
|
|
77
88
|
label="Size"
|
|
89
|
+
htmlFor="size"
|
|
90
|
+
id="size"
|
|
91
|
+
aria-label="size"
|
|
78
92
|
name="size"
|
|
79
93
|
component={Select}
|
|
80
94
|
onChange={(event) => console.log(event)}
|
|
81
95
|
options={['small', 'medium', 'large', 'xlarge']}
|
|
82
96
|
/>
|
|
83
|
-
<FormField
|
|
97
|
+
<FormField
|
|
98
|
+
label="Comments"
|
|
99
|
+
htmlFor="comments"
|
|
100
|
+
id="comments"
|
|
101
|
+
name="comments"
|
|
102
|
+
component={TextArea}
|
|
103
|
+
/>
|
|
84
104
|
<FormField
|
|
85
105
|
label="Age"
|
|
106
|
+
htmlFor="age"
|
|
107
|
+
id="age"
|
|
86
108
|
name="age"
|
|
87
109
|
component={RangeInput}
|
|
88
110
|
pad
|
|
@@ -6,7 +6,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
6
6
|
import React, { Children, cloneElement, forwardRef, useContext, useState, useEffect } from 'react';
|
|
7
7
|
import styled, { ThemeContext } from 'styled-components';
|
|
8
8
|
import { defaultProps } from '../../default-props';
|
|
9
|
-
import { containsFocus, shouldKeepFocus } from '../../utils
|
|
9
|
+
import { containsFocus, shouldKeepFocus, withinDropPortal, PortalContext } from '../../utils';
|
|
10
10
|
import { focusStyle } from '../../utils/styles';
|
|
11
11
|
import { parseMetricToNum } from '../../utils/mixins';
|
|
12
12
|
import { useForwardedRef } from '../../utils/refs';
|
|
@@ -177,6 +177,7 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
177
177
|
var formFieldTheme = theme.formField;
|
|
178
178
|
var themeBorder = formFieldTheme.border;
|
|
179
179
|
var debounce = useDebounce();
|
|
180
|
+
var portalContext = useContext(PortalContext);
|
|
180
181
|
|
|
181
182
|
// This is here for backwards compatibility. In case the child is a grommet
|
|
182
183
|
// input component, set plain and focusIndicator props, if they aren't
|
|
@@ -331,18 +332,28 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
331
332
|
return /*#__PURE__*/React.createElement(FormFieldBox, _extends({
|
|
332
333
|
ref: formFieldRef,
|
|
333
334
|
className: className,
|
|
335
|
+
flex: false,
|
|
334
336
|
background: outerBackground,
|
|
335
337
|
margin: abut ? abutMargin : margin || _extends({}, formFieldTheme.margin)
|
|
336
338
|
}, outerProps, {
|
|
337
339
|
style: outerStyle,
|
|
338
340
|
onFocus: function onFocus(event) {
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
+
var _formFieldRef$current;
|
|
342
|
+
var root = (_formFieldRef$current = formFieldRef.current) == null ? void 0 : _formFieldRef$current.getRootNode();
|
|
343
|
+
if (root) {
|
|
344
|
+
setFocus(containsFocus(formFieldRef.current) && shouldKeepFocus(root));
|
|
345
|
+
}
|
|
341
346
|
if (_onFocus) _onFocus(event);
|
|
342
347
|
},
|
|
343
348
|
onBlur: function onBlur(event) {
|
|
344
349
|
setFocus(false);
|
|
345
|
-
|
|
350
|
+
|
|
351
|
+
// if input has a drop and focus is within drop
|
|
352
|
+
// prevent onBlur validation from running until
|
|
353
|
+
// focus is no longer within the drop or input
|
|
354
|
+
if (contextOnBlur && !formFieldRef.current.contains(event.relatedTarget) && !withinDropPortal(event.relatedTarget, portalContext)) {
|
|
355
|
+
contextOnBlur(event);
|
|
356
|
+
}
|
|
346
357
|
if (_onBlur) _onBlur(event);
|
|
347
358
|
},
|
|
348
359
|
onChange: contextOnChange || onChange ? function (event) {
|
|
@@ -16,7 +16,6 @@ var HiddenAnchor = styled.a.withConfig({
|
|
|
16
16
|
displayName: "LayerContainer__HiddenAnchor",
|
|
17
17
|
componentId: "sc-1srj14c-0"
|
|
18
18
|
})(["width:0;height:0;overflow:hidden;position:absolute;"]);
|
|
19
|
-
var defaultPortalContext = [];
|
|
20
19
|
var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
21
20
|
var background = _ref.background,
|
|
22
21
|
children = _ref.children,
|
|
@@ -46,7 +45,7 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
46
45
|
var anchorRef = useRef();
|
|
47
46
|
var containerRef = useRef();
|
|
48
47
|
var layerRef = useRef();
|
|
49
|
-
var portalContext = useContext(PortalContext)
|
|
48
|
+
var portalContext = useContext(PortalContext);
|
|
50
49
|
var portalId = useMemo(function () {
|
|
51
50
|
return portalContext.length;
|
|
52
51
|
}, [portalContext]);
|
|
@@ -251,7 +250,7 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
251
250
|
// restricting scroll could inhibit the user's
|
|
252
251
|
// ability to scroll the page while the layer is open.
|
|
253
252
|
,
|
|
254
|
-
restrictScroll: !layerTarget
|
|
253
|
+
restrictScroll: !layerTarget && hitResponsiveBreakpoint ? true : undefined,
|
|
255
254
|
trapFocus: true
|
|
256
255
|
}, content);
|
|
257
256
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export var PortalContext = /*#__PURE__*/React.createContext(
|
|
2
|
+
export var PortalContext = /*#__PURE__*/React.createContext([]);
|
|
@@ -28,12 +28,14 @@ Object.setPrototypeOf(StyledLayer.defaultProps, defaultProps);
|
|
|
28
28
|
var StyledOverlay = styled.div.withConfig({
|
|
29
29
|
displayName: "StyledLayer__StyledOverlay",
|
|
30
30
|
componentId: "sc-rmtehz-1"
|
|
31
|
-
})(["position:absolute;", " top:0px;left:0px;right:0px;bottom:0px;", " pointer-events:all;will-change:transform;"], function (props) {
|
|
31
|
+
})(["position:absolute;", " top:0px;left:0px;right:0px;bottom:0px;", " ", " pointer-events:all;will-change:transform;"], function (props) {
|
|
32
32
|
if (props.responsive && props.theme.layer.responsiveBreakpoint) {
|
|
33
33
|
var breakpoint = props.theme.global.breakpoints[props.theme.layer.responsiveBreakpoint];
|
|
34
34
|
return breakpointStyle(breakpoint, 'position: relative;');
|
|
35
35
|
}
|
|
36
36
|
return '';
|
|
37
|
+
}, function (props) {
|
|
38
|
+
return props.theme.layer.overlay.backdropFilter && "backdrop-filter: " + props.theme.layer.overlay.backdropFilter + ";";
|
|
37
39
|
}, function (props) {
|
|
38
40
|
return !props.plain && props.theme.layer.overlay.background && backgroundStyle(props.theme.layer.overlay.background, props.theme);
|
|
39
41
|
});
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Add } from "grommet-icons/es6/icons/Add";
|
|
3
3
|
import { Close } from "grommet-icons/es6/icons/Close";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { StatusGood } from "grommet-icons/es6/icons/StatusGood";
|
|
5
|
+
import { Box, Button, Form, FormField, Heading, Layer, Select, TextInput } from 'grommet';
|
|
6
6
|
export var FormLayer = function FormLayer() {
|
|
7
7
|
var _React$useState = React.useState(false),
|
|
8
8
|
open = _React$useState[0],
|
|
9
9
|
setOpen = _React$useState[1];
|
|
10
|
-
var _React$useState2 = React.useState(''),
|
|
11
|
-
select = _React$useState2[0],
|
|
12
|
-
setSelect = _React$useState2[1];
|
|
13
10
|
var onOpen = function onOpen() {
|
|
14
11
|
return setOpen(true);
|
|
15
12
|
};
|
|
@@ -35,12 +32,19 @@ export var FormLayer = function FormLayer() {
|
|
|
35
32
|
onClickOutside: onClose,
|
|
36
33
|
onEsc: onClose
|
|
37
34
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
38
|
-
as: "form",
|
|
39
35
|
fill: "vertical",
|
|
40
36
|
overflow: "auto",
|
|
41
37
|
width: "medium",
|
|
42
|
-
pad: "medium"
|
|
43
|
-
|
|
38
|
+
pad: "medium"
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
40
|
+
validate: "blur",
|
|
41
|
+
onReset: function onReset(event) {
|
|
42
|
+
return console.log(event);
|
|
43
|
+
},
|
|
44
|
+
onSubmit: function onSubmit(_ref) {
|
|
45
|
+
var value = _ref.value;
|
|
46
|
+
return console.log('Submit', value);
|
|
47
|
+
}
|
|
44
48
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
45
49
|
flex: false,
|
|
46
50
|
direction: "row",
|
|
@@ -51,29 +55,52 @@ export var FormLayer = function FormLayer() {
|
|
|
51
55
|
}, "Add"), /*#__PURE__*/React.createElement(Button, {
|
|
52
56
|
icon: /*#__PURE__*/React.createElement(Close, null),
|
|
53
57
|
onClick: onClose
|
|
54
|
-
})), /*#__PURE__*/React.createElement(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
})), /*#__PURE__*/React.createElement(FormField, {
|
|
59
|
+
label: "Name",
|
|
60
|
+
"aria-label": "name",
|
|
61
|
+
name: "name",
|
|
62
|
+
required: true,
|
|
63
|
+
validate: [{
|
|
64
|
+
regexp: /^[a-z]/i
|
|
65
|
+
}, function (name) {
|
|
66
|
+
if (name && name.length === 1) return 'must be >1 character';
|
|
67
|
+
return undefined;
|
|
68
|
+
}, function (name) {
|
|
69
|
+
if (name === 'good') return {
|
|
70
|
+
message: /*#__PURE__*/React.createElement(Box, {
|
|
71
|
+
align: "end"
|
|
72
|
+
}, /*#__PURE__*/React.createElement(StatusGood, null)),
|
|
73
|
+
status: 'info'
|
|
74
|
+
};
|
|
75
|
+
return undefined;
|
|
76
|
+
}]
|
|
77
|
+
}), /*#__PURE__*/React.createElement(FormField, {
|
|
78
|
+
label: "Email",
|
|
79
|
+
name: "email",
|
|
80
|
+
required: true
|
|
62
81
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
63
|
-
|
|
82
|
+
name: "email",
|
|
83
|
+
"aria-label": "email",
|
|
84
|
+
type: "email"
|
|
64
85
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
65
|
-
label: "
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
86
|
+
label: "Size",
|
|
87
|
+
name: "select-size",
|
|
88
|
+
htmlFor: "select-size__input",
|
|
89
|
+
required: true,
|
|
90
|
+
validate: function validate(val) {
|
|
91
|
+
if (val === 'small') {
|
|
92
|
+
return {
|
|
93
|
+
message: 'Only 10 left in stock!',
|
|
94
|
+
status: 'info'
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
73
98
|
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
99
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
100
|
+
name: "select-size",
|
|
101
|
+
id: "select-size",
|
|
102
|
+
options: ['small', 'medium', 'large']
|
|
103
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
77
104
|
flex: false,
|
|
78
105
|
as: "footer",
|
|
79
106
|
align: "start"
|
|
@@ -82,7 +109,7 @@ export var FormLayer = function FormLayer() {
|
|
|
82
109
|
label: "Submit",
|
|
83
110
|
onClick: onClose,
|
|
84
111
|
primary: true
|
|
85
|
-
})))))
|
|
112
|
+
}))))))
|
|
86
113
|
// </Grommet>
|
|
87
114
|
);
|
|
88
115
|
};
|
|
@@ -77,11 +77,7 @@ var getValue = function getValue(item, index, key) {
|
|
|
77
77
|
var reorder = function reorder(array, pinnedArray, source, target) {
|
|
78
78
|
var result = array.slice(0);
|
|
79
79
|
var tmp = result[source];
|
|
80
|
-
if (source < target) for (var i = source; i < target; i += 1)
|
|
81
|
-
result[i] = result[i + 1];
|
|
82
|
-
} else for (var _i = source; _i > target; _i -= 1) {
|
|
83
|
-
result[_i] = result[_i - 1];
|
|
84
|
-
}
|
|
80
|
+
if (source < target) for (var i = source; i < target; i += 1) result[i] = result[i + 1];else for (var _i = source; _i > target; _i -= 1) result[_i] = result[_i - 1];
|
|
85
81
|
result[target] = tmp;
|
|
86
82
|
|
|
87
83
|
// insert pinned items into their proper index within the orderable
|
|
@@ -394,9 +390,6 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
394
390
|
adjustedEvent.item = item;
|
|
395
391
|
adjustedEvent.index = index;
|
|
396
392
|
onClickItem(adjustedEvent);
|
|
397
|
-
// put focus on the List container to meet WCAG
|
|
398
|
-
// accessibility guidelines that focus remains on `ul`
|
|
399
|
-
listRef.current.focus();
|
|
400
393
|
sendAnalytics({
|
|
401
394
|
type: 'listItemClick',
|
|
402
395
|
element: listRef.current,
|