grommet 2.29.1 → 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 +6 -2
- package/components/Button/StyledButtonKind.js +20 -6
- package/components/Calendar/Calendar.js +14 -6
- package/components/Data/DataForm.js +75 -10
- 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 +1 -1
- 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 +1 -1
- package/components/Data/stories/StarWars.js +18 -24
- package/components/Data/stories/Views.js +1 -1
- package/components/DataFilter/DataFilter.js +32 -42
- package/components/DataFilter/stories/Simple.js +7 -4
- package/components/DataFilters/DataFilters.js +76 -32
- 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 +57 -9
- 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 +61 -12
- 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/stories/Simple.js +7 -4
- package/components/DataTable/GroupedBody.js +1 -0
- package/components/DataTable/StyledDataTable.js +2 -2
- package/components/DataTableColumns/DataTableColumns.js +2 -1
- package/components/DataTableColumns/stories/Simple.js +9 -5
- package/components/DataView/DataView.js +21 -6
- package/components/DataView/stories/Simple.js +8 -5
- package/components/Distribution/Distribution.js +1 -1
- package/components/Drop/DropContainer.js +32 -79
- 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/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 +1 -0
- package/components/Layer/LayerContainer.js +1 -1
- package/components/Layer/StyledLayer.js +3 -1
- package/components/Pagination/Pagination.js +8 -0
- package/components/Paragraph/Paragraph.js +18 -6
- 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/WorldMap/WorldMap.js +17 -14
- package/es6/components/Anchor/Anchor.js +9 -3
- package/es6/components/Anchor/StyledAnchor.js +6 -3
- package/es6/components/Button/Button.js +6 -2
- package/es6/components/Button/StyledButtonKind.js +20 -6
- package/es6/components/Calendar/Calendar.js +14 -6
- package/es6/components/Data/DataForm.js +75 -10
- 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 +1 -1
- 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 +1 -1
- package/es6/components/Data/stories/StarWars.js +18 -24
- package/es6/components/Data/stories/Views.js +1 -1
- package/es6/components/DataFilter/DataFilter.js +32 -42
- package/es6/components/DataFilter/stories/Simple.js +8 -5
- package/es6/components/DataFilters/DataFilters.js +76 -32
- 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 +58 -10
- 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 +62 -13
- 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/stories/Simple.js +8 -5
- package/es6/components/DataTable/GroupedBody.js +1 -0
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DataTableColumns/DataTableColumns.js +2 -1
- package/es6/components/DataTableColumns/stories/Simple.js +10 -6
- package/es6/components/DataView/DataView.js +21 -6
- package/es6/components/DataView/stories/Simple.js +9 -6
- package/es6/components/Distribution/Distribution.js +1 -1
- package/es6/components/Drop/DropContainer.js +34 -81
- 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/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 +1 -0
- package/es6/components/Layer/LayerContainer.js +1 -1
- package/es6/components/Layer/StyledLayer.js +3 -1
- package/es6/components/Pagination/Pagination.js +8 -0
- package/es6/components/Paragraph/Paragraph.js +19 -7
- 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/WorldMap/WorldMap.js +17 -14
- package/es6/languages/default.json +7 -2
- package/es6/themes/base.d.ts +31 -0
- package/es6/themes/base.js +31 -1
- package/es6/utils/DOM.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 +7 -2
- package/package.json +13 -11
- package/themes/base.d.ts +31 -0
- package/themes/base.js +31 -1
- package/utils/DOM.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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var _excluded = ["a11yTitle", "aria-label", "align", "background", "onAlign", "children", "dropTarget", "elevation", "onClickOutside", "onEsc", "onKeyDown", "overflow", "plain", "responsive", "restrictFocus", "stretch", "trapFocus"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
-
import React, { forwardRef, useContext, useEffect, useMemo
|
|
4
|
+
import React, { forwardRef, useContext, useEffect, useMemo } from 'react';
|
|
5
5
|
import { ThemeContext } from 'styled-components';
|
|
6
6
|
import { ContainerTargetContext } from '../../contexts/ContainerTargetContext';
|
|
7
7
|
import { FocusedContainer } from '../FocusedContainer';
|
|
8
|
-
import { backgroundIsDark, findScrollParents, parseMetricToNum, PortalContext } from '../../utils';
|
|
8
|
+
import { backgroundIsDark, findScrollParents, parseMetricToNum, PortalContext, useForwardedRef } from '../../utils';
|
|
9
9
|
import { defaultProps } from '../../default-props';
|
|
10
10
|
import { Box } from '../Box';
|
|
11
11
|
import { Keyboard } from '../Keyboard';
|
|
@@ -39,7 +39,8 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
39
39
|
_ref$overflow = _ref.overflow,
|
|
40
40
|
overflow = _ref$overflow === void 0 ? 'auto' : _ref$overflow,
|
|
41
41
|
plain = _ref.plain,
|
|
42
|
-
responsive = _ref.responsive,
|
|
42
|
+
_ref$responsive = _ref.responsive,
|
|
43
|
+
responsive = _ref$responsive === void 0 ? true : _ref$responsive,
|
|
43
44
|
restrictFocus = _ref.restrictFocus,
|
|
44
45
|
_ref$stretch = _ref.stretch,
|
|
45
46
|
stretch = _ref$stretch === void 0 ? 'width' : _ref$stretch,
|
|
@@ -54,7 +55,7 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
54
55
|
var nextPortalContext = useMemo(function () {
|
|
55
56
|
return [].concat(portalContext, [portalId]);
|
|
56
57
|
}, [portalContext, portalId]);
|
|
57
|
-
var dropRef =
|
|
58
|
+
var dropRef = useForwardedRef(ref);
|
|
58
59
|
useEffect(function () {
|
|
59
60
|
var onClickDocument = function onClickDocument(event) {
|
|
60
61
|
// determine which portal id the target is in, if any
|
|
@@ -80,7 +81,7 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
80
81
|
}, [onClickOutside, containerTarget, portalContext]);
|
|
81
82
|
useEffect(function () {
|
|
82
83
|
var notifyAlign = function notifyAlign() {
|
|
83
|
-
var styleCurrent =
|
|
84
|
+
var styleCurrent = dropRef.current.style;
|
|
84
85
|
var alignControl = styleCurrent.top !== '' ? 'top' : 'bottom';
|
|
85
86
|
onAlign(alignControl);
|
|
86
87
|
};
|
|
@@ -91,8 +92,8 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
91
92
|
var place = function place(preserveHeight) {
|
|
92
93
|
var windowWidth = window.innerWidth;
|
|
93
94
|
var windowHeight = window.innerHeight;
|
|
94
|
-
var target = dropTarget;
|
|
95
|
-
var container =
|
|
95
|
+
var target = (dropTarget == null ? void 0 : dropTarget.current) || dropTarget;
|
|
96
|
+
var container = dropRef.current;
|
|
96
97
|
if (container && target) {
|
|
97
98
|
// clear prior styling
|
|
98
99
|
container.style.left = '';
|
|
@@ -138,80 +139,32 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
138
139
|
var top;
|
|
139
140
|
var bottom;
|
|
140
141
|
var maxHeight = containerRect.height;
|
|
141
|
-
if (align.top) {
|
|
142
|
-
if (align.top === 'top') {
|
|
143
|
-
top = targetRect.top;
|
|
144
|
-
} else {
|
|
145
|
-
top = targetRect.bottom;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Calculate visible area underneath the control w.r.t window height
|
|
149
|
-
var percentVisibleAreaBelow = 100 - targetRect.bottom / windowHeight * 100;
|
|
150
142
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
maxHeight = windowHeight - top;
|
|
174
|
-
}
|
|
175
|
-
} else if (align.bottom) {
|
|
176
|
-
if (align.bottom === 'bottom') {
|
|
177
|
-
bottom = targetRect.bottom;
|
|
178
|
-
} else {
|
|
179
|
-
bottom = targetRect.top;
|
|
180
|
-
}
|
|
143
|
+
/* If responsive is true and the Drop doesn't have enough room
|
|
144
|
+
to be fully visible and there is more room in the other
|
|
145
|
+
direction, change the Drop to display above/below. If there is
|
|
146
|
+
less room in the other direction leave the Drop in its current
|
|
147
|
+
position. */
|
|
148
|
+
if (responsive && (align.top === 'top' && targetRect.top < 0 || align.bottom === 'top' && targetRect.top - containerRect.height <= 0 && targetRect.bottom + containerRect.height < windowHeight)) {
|
|
149
|
+
top = targetRect.bottom;
|
|
150
|
+
maxHeight = top;
|
|
151
|
+
} else if (responsive && (align.bottom === 'bottom' && targetRect.bottom > windowHeight || align.top === 'bottom' && targetRect.bottom + containerRect.height >= windowHeight && targetRect.top - containerRect.height > 0)) {
|
|
152
|
+
bottom = targetRect.top;
|
|
153
|
+
maxHeight = bottom;
|
|
154
|
+
} else if (align.top === 'top') {
|
|
155
|
+
top = targetRect.top;
|
|
156
|
+
maxHeight = windowHeight - top;
|
|
157
|
+
} else if (align.top === 'bottom') {
|
|
158
|
+
top = targetRect.bottom;
|
|
159
|
+
maxHeight = windowHeight - top;
|
|
160
|
+
} else if (align.bottom === 'top') {
|
|
161
|
+
bottom = targetRect.top;
|
|
162
|
+
maxHeight = bottom;
|
|
163
|
+
} else if (align.bottom === 'bottom') {
|
|
164
|
+
bottom = targetRect.bottom;
|
|
181
165
|
maxHeight = bottom;
|
|
182
|
-
container.style.maxHeight = maxHeight + "px";
|
|
183
166
|
} else {
|
|
184
|
-
// center
|
|
185
167
|
top = targetRect.top + targetRect.height / 2 - containerRect.height / 2;
|
|
186
|
-
maxHeight = windowHeight - top;
|
|
187
|
-
}
|
|
188
|
-
// if we can't fit it all, or we're rather close,
|
|
189
|
-
// see if there's more room the other direction
|
|
190
|
-
if (responsive && (containerRect.height > maxHeight || maxHeight < windowHeight / 10)) {
|
|
191
|
-
// We need more room than we have.
|
|
192
|
-
if (align.top && top > windowHeight / 2) {
|
|
193
|
-
// We put it below, but there's more room above, put it above
|
|
194
|
-
top = '';
|
|
195
|
-
if (align.top === 'bottom') {
|
|
196
|
-
// top = Math.max(targetRect.top - containerRect.height, 0);
|
|
197
|
-
// maxHeight = targetRect.top - top;
|
|
198
|
-
bottom = targetRect.top;
|
|
199
|
-
} else {
|
|
200
|
-
// top = Math.max(targetRect.bottom - containerRect.height, 0);
|
|
201
|
-
// maxHeight = targetRect.bottom - top;
|
|
202
|
-
bottom = targetRect.bottom;
|
|
203
|
-
}
|
|
204
|
-
maxHeight = bottom;
|
|
205
|
-
} else if (align.bottom && maxHeight < windowHeight / 2) {
|
|
206
|
-
// We put it above but there's more room below, put it below
|
|
207
|
-
bottom = '';
|
|
208
|
-
if (align.bottom === 'bottom') {
|
|
209
|
-
top = targetRect.top;
|
|
210
|
-
} else {
|
|
211
|
-
top = targetRect.bottom;
|
|
212
|
-
}
|
|
213
|
-
maxHeight = windowHeight - top;
|
|
214
|
-
}
|
|
215
168
|
}
|
|
216
169
|
container.style.left = left + "px";
|
|
217
170
|
if (stretch) {
|
|
@@ -262,15 +215,15 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
262
215
|
removeScrollListeners();
|
|
263
216
|
window.removeEventListener('resize', onResize);
|
|
264
217
|
};
|
|
265
|
-
}, [align, containerTarget, onAlign, dropTarget, portalContext, portalId,
|
|
218
|
+
}, [align, containerTarget, onAlign, dropTarget, portalContext, portalId, responsive, restrictFocus, stretch, theme.drop, dropRef]);
|
|
266
219
|
useEffect(function () {
|
|
267
220
|
if (restrictFocus) {
|
|
268
|
-
|
|
221
|
+
dropRef.current.focus();
|
|
269
222
|
}
|
|
270
|
-
}, [
|
|
223
|
+
}, [dropRef, restrictFocus]);
|
|
271
224
|
var content = /*#__PURE__*/React.createElement(StyledDrop, _extends({
|
|
272
225
|
"aria-label": a11yTitle || ariaLabel,
|
|
273
|
-
ref:
|
|
226
|
+
ref: dropRef,
|
|
274
227
|
as: Box,
|
|
275
228
|
background: background,
|
|
276
229
|
plain: plain,
|
|
@@ -70,7 +70,7 @@ var DropButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
70
70
|
onAlign: onAlign,
|
|
71
71
|
restrictFocus: true,
|
|
72
72
|
align: dropAlign,
|
|
73
|
-
target: dropTarget || buttonRef
|
|
73
|
+
target: dropTarget || buttonRef,
|
|
74
74
|
onClickOutside: onDropClose,
|
|
75
75
|
onEsc: onDropClose
|
|
76
76
|
}, dropProps), dropContent));
|
|
@@ -19,9 +19,9 @@ export var Controlled = function Controlled() {
|
|
|
19
19
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
20
20
|
// <Grommet theme={...}>
|
|
21
21
|
React.createElement(Box, {
|
|
22
|
-
fill: true,
|
|
23
22
|
align: "center",
|
|
24
|
-
justify: "center"
|
|
23
|
+
justify: "center",
|
|
24
|
+
pad: "large"
|
|
25
25
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
26
26
|
width: "medium"
|
|
27
27
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
@@ -39,8 +39,10 @@ export var Controlled = function Controlled() {
|
|
|
39
39
|
}
|
|
40
40
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
41
41
|
label: "Name",
|
|
42
|
+
htmlFor: "name",
|
|
42
43
|
name: "name"
|
|
43
44
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
45
|
+
id: "name",
|
|
44
46
|
name: "name",
|
|
45
47
|
suggestions: suggestions
|
|
46
48
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
@@ -77,20 +79,27 @@ export var Controlled = function Controlled() {
|
|
|
77
79
|
options: ['morning', 'evening']
|
|
78
80
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
79
81
|
label: "Size",
|
|
82
|
+
htmlFor: "size",
|
|
80
83
|
name: "size"
|
|
81
84
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
85
|
+
id: "size",
|
|
86
|
+
"aria-label": "size",
|
|
82
87
|
name: "size",
|
|
83
88
|
options: ['small', 'medium', 'large']
|
|
84
89
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
85
90
|
label: "Comments",
|
|
91
|
+
htmlFor: "comments",
|
|
86
92
|
name: "comments"
|
|
87
93
|
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
94
|
+
id: "comments",
|
|
88
95
|
name: "comments"
|
|
89
96
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
90
97
|
label: "Age",
|
|
98
|
+
htmlFor: "age",
|
|
91
99
|
name: "age",
|
|
92
100
|
pad: true
|
|
93
101
|
}, /*#__PURE__*/React.createElement(RangeInput, {
|
|
102
|
+
id: "age",
|
|
94
103
|
name: "age",
|
|
95
104
|
min: 15,
|
|
96
105
|
max: 75
|
|
@@ -27,9 +27,9 @@ export var ControlledInput = function ControlledInput() {
|
|
|
27
27
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
28
28
|
// <Grommet theme={...}>
|
|
29
29
|
React.createElement(Box, {
|
|
30
|
-
fill: true,
|
|
31
30
|
align: "center",
|
|
32
|
-
justify: "center"
|
|
31
|
+
justify: "center",
|
|
32
|
+
pad: "large"
|
|
33
33
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
34
34
|
width: "medium"
|
|
35
35
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
@@ -50,8 +50,10 @@ export var ControlledInput = function ControlledInput() {
|
|
|
50
50
|
}
|
|
51
51
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
52
52
|
label: "Name",
|
|
53
|
+
htmlFor: "name",
|
|
53
54
|
name: "name"
|
|
54
55
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
56
|
+
id: "name",
|
|
55
57
|
name: "name",
|
|
56
58
|
value: name,
|
|
57
59
|
onChange: function onChange(event) {
|
|
@@ -59,9 +61,11 @@ export var ControlledInput = function ControlledInput() {
|
|
|
59
61
|
}
|
|
60
62
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
61
63
|
label: "Email",
|
|
64
|
+
htmlFor: "email",
|
|
62
65
|
name: "email",
|
|
63
66
|
required: true
|
|
64
67
|
}, /*#__PURE__*/React.createElement(MaskedInput, {
|
|
68
|
+
id: "email",
|
|
65
69
|
name: "email",
|
|
66
70
|
mask: [{
|
|
67
71
|
regexp: /^[\w\-_.]+$/,
|
|
@@ -101,8 +105,11 @@ export var ControlledInput = function ControlledInput() {
|
|
|
101
105
|
}
|
|
102
106
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
103
107
|
label: "Size",
|
|
108
|
+
htmlFor: "size",
|
|
104
109
|
name: "size"
|
|
105
110
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
111
|
+
id: "size",
|
|
112
|
+
"aria-label": "size",
|
|
106
113
|
name: "size",
|
|
107
114
|
options: ['small', 'medium', 'large'],
|
|
108
115
|
value: size,
|
|
@@ -111,8 +118,10 @@ export var ControlledInput = function ControlledInput() {
|
|
|
111
118
|
}
|
|
112
119
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
113
120
|
label: "Comments",
|
|
121
|
+
htmlFor: "comments",
|
|
114
122
|
name: "comments"
|
|
115
123
|
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
124
|
+
id: "comments",
|
|
116
125
|
name: "comments",
|
|
117
126
|
value: comments,
|
|
118
127
|
onChange: function onChange(event) {
|
|
@@ -120,9 +129,11 @@ export var ControlledInput = function ControlledInput() {
|
|
|
120
129
|
}
|
|
121
130
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
122
131
|
label: "Age",
|
|
132
|
+
htmlFor: "age",
|
|
123
133
|
name: "age",
|
|
124
134
|
pad: true
|
|
125
135
|
}, /*#__PURE__*/React.createElement(RangeInput, {
|
|
136
|
+
id: "age",
|
|
126
137
|
name: "age",
|
|
127
138
|
min: 15,
|
|
128
139
|
max: 75,
|
|
@@ -36,9 +36,9 @@ export var ControlledInputLazy = function ControlledInputLazy() {
|
|
|
36
36
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
37
37
|
// <Grommet theme={...}>
|
|
38
38
|
React.createElement(Box, {
|
|
39
|
-
fill: true,
|
|
40
39
|
align: "center",
|
|
41
|
-
justify: "center"
|
|
40
|
+
justify: "center",
|
|
41
|
+
pad: "large"
|
|
42
42
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
43
43
|
width: "medium"
|
|
44
44
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
@@ -59,8 +59,10 @@ export var ControlledInputLazy = function ControlledInputLazy() {
|
|
|
59
59
|
}
|
|
60
60
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
61
61
|
label: "Name",
|
|
62
|
+
htmlFor: "name",
|
|
62
63
|
name: "name"
|
|
63
64
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
65
|
+
id: "name",
|
|
64
66
|
name: "name",
|
|
65
67
|
value: name,
|
|
66
68
|
onChange: function onChange(event) {
|
|
@@ -68,9 +70,11 @@ export var ControlledInputLazy = function ControlledInputLazy() {
|
|
|
68
70
|
}
|
|
69
71
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
70
72
|
label: "Email",
|
|
73
|
+
htmlFor: "email",
|
|
71
74
|
name: "email",
|
|
72
75
|
required: true
|
|
73
76
|
}, /*#__PURE__*/React.createElement(MaskedInput, {
|
|
77
|
+
id: "email",
|
|
74
78
|
name: "email",
|
|
75
79
|
mask: [{
|
|
76
80
|
regexp: /^[\w\-_.]+$/,
|
|
@@ -110,8 +114,11 @@ export var ControlledInputLazy = function ControlledInputLazy() {
|
|
|
110
114
|
}
|
|
111
115
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
112
116
|
label: "Size",
|
|
117
|
+
htmlFor: "size",
|
|
113
118
|
name: "size"
|
|
114
119
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
120
|
+
id: "size",
|
|
121
|
+
"aria-label": "size",
|
|
115
122
|
name: "size",
|
|
116
123
|
options: ['small', 'medium', 'large'],
|
|
117
124
|
value: size,
|
|
@@ -120,8 +127,10 @@ export var ControlledInputLazy = function ControlledInputLazy() {
|
|
|
120
127
|
}
|
|
121
128
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
122
129
|
label: "Comments",
|
|
130
|
+
htmlFor: "comments",
|
|
123
131
|
name: "comments"
|
|
124
132
|
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
133
|
+
id: "comments",
|
|
125
134
|
name: "comments",
|
|
126
135
|
value: comments,
|
|
127
136
|
onChange: function onChange(event) {
|
|
@@ -129,9 +138,11 @@ export var ControlledInputLazy = function ControlledInputLazy() {
|
|
|
129
138
|
}
|
|
130
139
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
131
140
|
label: "Age",
|
|
141
|
+
htmlFor: "age",
|
|
132
142
|
name: "age",
|
|
133
143
|
pad: true
|
|
134
144
|
}, /*#__PURE__*/React.createElement(RangeInput, {
|
|
145
|
+
id: "age",
|
|
135
146
|
name: "age",
|
|
136
147
|
min: 15,
|
|
137
148
|
max: 75,
|
|
@@ -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",
|
|
@@ -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",
|