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
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Data, DataTable, Notification, Toolbar } from 'grommet';
|
|
3
|
+
import { DataTableColumns } from '../DataTableColumns';
|
|
4
|
+
import { columns, DATA } from '../../DataTable/stories/data';
|
|
5
|
+
|
|
6
|
+
// simplify option label for name property
|
|
7
|
+
var options = columns.map(function (_ref) {
|
|
8
|
+
var header = _ref.header,
|
|
9
|
+
property = _ref.property;
|
|
10
|
+
return {
|
|
11
|
+
property: property,
|
|
12
|
+
label: property === 'name' ? 'Name' : header
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
export var Simple = function Simple() {
|
|
16
|
+
return (
|
|
17
|
+
/*#__PURE__*/
|
|
18
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
19
|
+
// <Grommet theme={...}>
|
|
20
|
+
React.createElement(Box, {
|
|
21
|
+
align: "center",
|
|
22
|
+
justify: "start",
|
|
23
|
+
pad: "large",
|
|
24
|
+
gap: "medium"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
26
|
+
status: "info",
|
|
27
|
+
message: "Data is in 'beta'. The API surface is subject to change."
|
|
28
|
+
}), /*#__PURE__*/React.createElement(Data, {
|
|
29
|
+
data: DATA,
|
|
30
|
+
updateOn: "change"
|
|
31
|
+
}, /*#__PURE__*/React.createElement(Toolbar, null, /*#__PURE__*/React.createElement(DataTableColumns, {
|
|
32
|
+
drop: true,
|
|
33
|
+
options: options
|
|
34
|
+
})), /*#__PURE__*/React.createElement(DataTable, {
|
|
35
|
+
columns: columns
|
|
36
|
+
})))
|
|
37
|
+
// </Grommet>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
Simple.args = {
|
|
42
|
+
full: true
|
|
43
|
+
};
|
|
44
|
+
export default {
|
|
45
|
+
title: 'Data/DataTableColumns/Simple'
|
|
46
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var _excluded = ["id"];
|
|
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
|
+
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, { useContext, useEffect } from 'react';
|
|
5
|
+
import { DataForm } from '../Data/DataForm';
|
|
6
|
+
import { DataContext } from '../../contexts/DataContext';
|
|
7
|
+
import { FormContext } from '../Form/FormContext';
|
|
8
|
+
import { FormField } from '../FormField';
|
|
9
|
+
import { RadioButtonGroup } from '../RadioButtonGroup';
|
|
10
|
+
import { Select } from '../Select';
|
|
11
|
+
import { MessageContext } from '../../contexts/MessageContext';
|
|
12
|
+
import { DataViewPropTypes } from './propTypes';
|
|
13
|
+
export var DataView = function DataView(_ref) {
|
|
14
|
+
var idProp = _ref.id,
|
|
15
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
16
|
+
var _useContext = useContext(DataContext),
|
|
17
|
+
dataId = _useContext.id,
|
|
18
|
+
messages = _useContext.messages,
|
|
19
|
+
view = _useContext.view,
|
|
20
|
+
views = _useContext.views,
|
|
21
|
+
addToolbarKey = _useContext.addToolbarKey;
|
|
22
|
+
var _useContext2 = useContext(FormContext),
|
|
23
|
+
noForm = _useContext2.noForm;
|
|
24
|
+
var _useContext3 = useContext(MessageContext),
|
|
25
|
+
format = _useContext3.format;
|
|
26
|
+
var id = idProp || dataId + "--view";
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
if (noForm) addToolbarKey('_view');
|
|
29
|
+
}, [addToolbarKey, noForm]);
|
|
30
|
+
if (!views) return null;
|
|
31
|
+
var names = views.map(function (v) {
|
|
32
|
+
return v.name;
|
|
33
|
+
});
|
|
34
|
+
var content;
|
|
35
|
+
if (!noForm && names.length < 7) {
|
|
36
|
+
content = /*#__PURE__*/React.createElement(RadioButtonGroup, _extends({
|
|
37
|
+
id: id,
|
|
38
|
+
name: "_view",
|
|
39
|
+
options: names,
|
|
40
|
+
value: view == null ? void 0 : view.name
|
|
41
|
+
}, rest));
|
|
42
|
+
} else {
|
|
43
|
+
content = /*#__PURE__*/React.createElement(Select, _extends({
|
|
44
|
+
id: id,
|
|
45
|
+
name: "_view",
|
|
46
|
+
showSelectedInline: true,
|
|
47
|
+
placeholder: noForm ? 'Select view ...' : undefined,
|
|
48
|
+
options: names,
|
|
49
|
+
value: view == null ? void 0 : view.name
|
|
50
|
+
}, rest));
|
|
51
|
+
}
|
|
52
|
+
if (noForm)
|
|
53
|
+
// likely in Toolbar
|
|
54
|
+
content = /*#__PURE__*/React.createElement(DataForm, {
|
|
55
|
+
footer: false,
|
|
56
|
+
updateOn: "change"
|
|
57
|
+
}, content);else content = /*#__PURE__*/React.createElement(FormField, {
|
|
58
|
+
htmlFor: id,
|
|
59
|
+
label: format({
|
|
60
|
+
id: 'dataView.label',
|
|
61
|
+
messages: messages == null ? void 0 : messages.dataView
|
|
62
|
+
})
|
|
63
|
+
}, content);
|
|
64
|
+
return content;
|
|
65
|
+
};
|
|
66
|
+
DataView.propTypes = DataViewPropTypes;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BoxProps } from '../Box/index';
|
|
3
|
+
|
|
4
|
+
export interface DataViewProps {}
|
|
5
|
+
|
|
6
|
+
type divProps = Omit<JSX.IntrinsicElements['div'], 'onClick' | 'property'>;
|
|
7
|
+
|
|
8
|
+
export interface DataViewExtendedProps
|
|
9
|
+
extends BoxProps,
|
|
10
|
+
DataViewProps,
|
|
11
|
+
divProps {}
|
|
12
|
+
|
|
13
|
+
declare const DataView: React.FC<DataViewExtendedProps>;
|
|
14
|
+
|
|
15
|
+
export { DataView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataView } from './DataView';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Data, DataTable, Notification } from 'grommet';
|
|
3
|
+
import { DataView } from '../DataView';
|
|
4
|
+
import { DATA } from '../../DataTable/stories/data';
|
|
5
|
+
export var Simple = function Simple() {
|
|
6
|
+
return (
|
|
7
|
+
/*#__PURE__*/
|
|
8
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
9
|
+
// <Grommet theme={...}>
|
|
10
|
+
React.createElement(Box, {
|
|
11
|
+
align: "center",
|
|
12
|
+
justify: "start",
|
|
13
|
+
pad: "large",
|
|
14
|
+
gap: "medium"
|
|
15
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
16
|
+
status: "info",
|
|
17
|
+
message: "Data is in 'beta'. The API surface is subject to change."
|
|
18
|
+
}), /*#__PURE__*/React.createElement(Data, {
|
|
19
|
+
data: DATA,
|
|
20
|
+
views: [{
|
|
21
|
+
name: 'latest',
|
|
22
|
+
sort: {
|
|
23
|
+
property: 'date',
|
|
24
|
+
direction: 'desc'
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
name: 'behind',
|
|
28
|
+
properties: {
|
|
29
|
+
percent: {
|
|
30
|
+
min: 0,
|
|
31
|
+
max: 30
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}]
|
|
35
|
+
}, /*#__PURE__*/React.createElement(DataView, null), /*#__PURE__*/React.createElement(DataTable, null)))
|
|
36
|
+
// </Grommet>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
Simple.args = {
|
|
41
|
+
full: true
|
|
42
|
+
};
|
|
43
|
+
export default {
|
|
44
|
+
title: 'Data/DataView/Simple'
|
|
45
|
+
};
|
|
@@ -115,9 +115,7 @@ var charCodeZero = '0'.charCodeAt(0);
|
|
|
115
115
|
var charCodeNine = '9'.charCodeAt(0);
|
|
116
116
|
var pullDigits = function pullDigits(text, index) {
|
|
117
117
|
var end = index;
|
|
118
|
-
while (text.charCodeAt(end) >= charCodeZero && text.charCodeAt(end) <= charCodeNine)
|
|
119
|
-
end += 1;
|
|
120
|
-
}
|
|
118
|
+
while (text.charCodeAt(end) >= charCodeZero && text.charCodeAt(end) <= charCodeNine) end += 1;
|
|
121
119
|
return text.slice(index, end);
|
|
122
120
|
};
|
|
123
121
|
export var validateBounds = function validateBounds(dateBounds, selectedDate) {
|
|
@@ -48,7 +48,7 @@ var Distribution = function Distribution(_ref2) {
|
|
|
48
48
|
var subTotal = 0;
|
|
49
49
|
var subIndex;
|
|
50
50
|
values.some(function (v, index) {
|
|
51
|
-
subTotal += Object.prototype.hasOwnProperty.call(v, 'value')
|
|
51
|
+
subTotal += Object.prototype.hasOwnProperty.call(v, 'value') && v.value || 0;
|
|
52
52
|
if (subTotal >= total * 0.4) {
|
|
53
53
|
subIndex = index + 1;
|
|
54
54
|
return true;
|
|
@@ -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';
|
|
@@ -23,7 +23,6 @@ var defaultAlign = {
|
|
|
23
23
|
top: 'top',
|
|
24
24
|
left: 'left'
|
|
25
25
|
};
|
|
26
|
-
var defaultPortalContext = [];
|
|
27
26
|
var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
28
27
|
var a11yTitle = _ref.a11yTitle,
|
|
29
28
|
ariaLabel = _ref['aria-label'],
|
|
@@ -40,7 +39,8 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
40
39
|
_ref$overflow = _ref.overflow,
|
|
41
40
|
overflow = _ref$overflow === void 0 ? 'auto' : _ref$overflow,
|
|
42
41
|
plain = _ref.plain,
|
|
43
|
-
responsive = _ref.responsive,
|
|
42
|
+
_ref$responsive = _ref.responsive,
|
|
43
|
+
responsive = _ref$responsive === void 0 ? true : _ref$responsive,
|
|
44
44
|
restrictFocus = _ref.restrictFocus,
|
|
45
45
|
_ref$stretch = _ref.stretch,
|
|
46
46
|
stretch = _ref$stretch === void 0 ? 'width' : _ref$stretch,
|
|
@@ -48,17 +48,40 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
48
48
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
49
49
|
var containerTarget = useContext(ContainerTargetContext);
|
|
50
50
|
var theme = useContext(ThemeContext) || defaultProps.theme;
|
|
51
|
-
var portalContext = useContext(PortalContext)
|
|
51
|
+
var portalContext = useContext(PortalContext);
|
|
52
52
|
var portalId = useMemo(function () {
|
|
53
53
|
return portalContext.length;
|
|
54
54
|
}, [portalContext]);
|
|
55
55
|
var nextPortalContext = useMemo(function () {
|
|
56
56
|
return [].concat(portalContext, [portalId]);
|
|
57
57
|
}, [portalContext, portalId]);
|
|
58
|
-
var dropRef =
|
|
58
|
+
var dropRef = useForwardedRef(ref);
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
var onClickDocument = function onClickDocument(event) {
|
|
61
|
+
// determine which portal id the target is in, if any
|
|
62
|
+
var clickedPortalId = null;
|
|
63
|
+
var node = containerTarget === document.body ? event.target : event == null ? void 0 : event.composedPath()[0];
|
|
64
|
+
while (clickedPortalId === null && node !== document) {
|
|
65
|
+
var attr = node.getAttribute('data-g-portal-id');
|
|
66
|
+
if (attr !== null) clickedPortalId = parseInt(attr, 10);
|
|
67
|
+
node = node.parentNode;
|
|
68
|
+
}
|
|
69
|
+
if (clickedPortalId === null || portalContext.indexOf(clickedPortalId) !== -1) {
|
|
70
|
+
onClickOutside(event);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
if (onClickOutside) {
|
|
74
|
+
document.addEventListener('mousedown', onClickDocument);
|
|
75
|
+
}
|
|
76
|
+
return function () {
|
|
77
|
+
if (onClickOutside) {
|
|
78
|
+
document.removeEventListener('mousedown', onClickDocument);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}, [onClickOutside, containerTarget, portalContext]);
|
|
59
82
|
useEffect(function () {
|
|
60
83
|
var notifyAlign = function notifyAlign() {
|
|
61
|
-
var styleCurrent =
|
|
84
|
+
var styleCurrent = dropRef.current.style;
|
|
62
85
|
var alignControl = styleCurrent.top !== '' ? 'top' : 'bottom';
|
|
63
86
|
onAlign(alignControl);
|
|
64
87
|
};
|
|
@@ -69,8 +92,8 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
69
92
|
var place = function place(preserveHeight) {
|
|
70
93
|
var windowWidth = window.innerWidth;
|
|
71
94
|
var windowHeight = window.innerHeight;
|
|
72
|
-
var target = dropTarget;
|
|
73
|
-
var container =
|
|
95
|
+
var target = (dropTarget == null ? void 0 : dropTarget.current) || dropTarget;
|
|
96
|
+
var container = dropRef.current;
|
|
74
97
|
if (container && target) {
|
|
75
98
|
// clear prior styling
|
|
76
99
|
container.style.left = '';
|
|
@@ -116,80 +139,32 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
116
139
|
var top;
|
|
117
140
|
var bottom;
|
|
118
141
|
var maxHeight = containerRect.height;
|
|
119
|
-
if (align.top) {
|
|
120
|
-
if (align.top === 'top') {
|
|
121
|
-
top = targetRect.top;
|
|
122
|
-
} else {
|
|
123
|
-
top = targetRect.bottom;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Calculate visible area underneath the control w.r.t window height
|
|
127
|
-
var percentVisibleAreaBelow = 100 - targetRect.bottom / windowHeight * 100;
|
|
128
142
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
maxHeight = windowHeight - top;
|
|
152
|
-
}
|
|
153
|
-
} else if (align.bottom) {
|
|
154
|
-
if (align.bottom === 'bottom') {
|
|
155
|
-
bottom = targetRect.bottom;
|
|
156
|
-
} else {
|
|
157
|
-
bottom = targetRect.top;
|
|
158
|
-
}
|
|
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;
|
|
159
165
|
maxHeight = bottom;
|
|
160
|
-
container.style.maxHeight = maxHeight + "px";
|
|
161
166
|
} else {
|
|
162
|
-
// center
|
|
163
167
|
top = targetRect.top + targetRect.height / 2 - containerRect.height / 2;
|
|
164
|
-
maxHeight = windowHeight - top;
|
|
165
|
-
}
|
|
166
|
-
// if we can't fit it all, or we're rather close,
|
|
167
|
-
// see if there's more room the other direction
|
|
168
|
-
if (responsive && (containerRect.height > maxHeight || maxHeight < windowHeight / 10)) {
|
|
169
|
-
// We need more room than we have.
|
|
170
|
-
if (align.top && top > windowHeight / 2) {
|
|
171
|
-
// We put it below, but there's more room above, put it above
|
|
172
|
-
top = '';
|
|
173
|
-
if (align.top === 'bottom') {
|
|
174
|
-
// top = Math.max(targetRect.top - containerRect.height, 0);
|
|
175
|
-
// maxHeight = targetRect.top - top;
|
|
176
|
-
bottom = targetRect.top;
|
|
177
|
-
} else {
|
|
178
|
-
// top = Math.max(targetRect.bottom - containerRect.height, 0);
|
|
179
|
-
// maxHeight = targetRect.bottom - top;
|
|
180
|
-
bottom = targetRect.bottom;
|
|
181
|
-
}
|
|
182
|
-
maxHeight = bottom;
|
|
183
|
-
} else if (align.bottom && maxHeight < windowHeight / 2) {
|
|
184
|
-
// We put it above but there's more room below, put it below
|
|
185
|
-
bottom = '';
|
|
186
|
-
if (align.bottom === 'bottom') {
|
|
187
|
-
top = targetRect.top;
|
|
188
|
-
} else {
|
|
189
|
-
top = targetRect.bottom;
|
|
190
|
-
}
|
|
191
|
-
maxHeight = windowHeight - top;
|
|
192
|
-
}
|
|
193
168
|
}
|
|
194
169
|
container.style.left = left + "px";
|
|
195
170
|
if (stretch) {
|
|
@@ -228,19 +203,6 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
228
203
|
});
|
|
229
204
|
scrollParents = [];
|
|
230
205
|
};
|
|
231
|
-
var onClickDocument = function onClickDocument(event) {
|
|
232
|
-
// determine which portal id the target is in, if any
|
|
233
|
-
var clickedPortalId = null;
|
|
234
|
-
var node = containerTarget === document.body ? event.target : event == null ? void 0 : event.composedPath()[0];
|
|
235
|
-
while (clickedPortalId === null && node !== document) {
|
|
236
|
-
var attr = node.getAttribute('data-g-portal-id');
|
|
237
|
-
if (attr !== null) clickedPortalId = parseInt(attr, 10);
|
|
238
|
-
node = node.parentNode;
|
|
239
|
-
}
|
|
240
|
-
if (clickedPortalId === null || portalContext.indexOf(clickedPortalId) !== -1) {
|
|
241
|
-
onClickOutside(event);
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
206
|
var onResize = function onResize() {
|
|
245
207
|
removeScrollListeners();
|
|
246
208
|
addScrollListeners();
|
|
@@ -248,26 +210,20 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
248
210
|
};
|
|
249
211
|
addScrollListeners();
|
|
250
212
|
window.addEventListener('resize', onResize);
|
|
251
|
-
if (onClickOutside) {
|
|
252
|
-
document.addEventListener('mousedown', onClickDocument);
|
|
253
|
-
}
|
|
254
213
|
place(false);
|
|
255
214
|
return function () {
|
|
256
215
|
removeScrollListeners();
|
|
257
216
|
window.removeEventListener('resize', onResize);
|
|
258
|
-
if (onClickOutside) {
|
|
259
|
-
document.removeEventListener('mousedown', onClickDocument);
|
|
260
|
-
}
|
|
261
217
|
};
|
|
262
|
-
}, [align, containerTarget, onAlign, dropTarget,
|
|
218
|
+
}, [align, containerTarget, onAlign, dropTarget, portalContext, portalId, responsive, restrictFocus, stretch, theme.drop, dropRef]);
|
|
263
219
|
useEffect(function () {
|
|
264
220
|
if (restrictFocus) {
|
|
265
|
-
|
|
221
|
+
dropRef.current.focus();
|
|
266
222
|
}
|
|
267
|
-
}, [
|
|
223
|
+
}, [dropRef, restrictFocus]);
|
|
268
224
|
var content = /*#__PURE__*/React.createElement(StyledDrop, _extends({
|
|
269
225
|
"aria-label": a11yTitle || ariaLabel,
|
|
270
|
-
ref:
|
|
226
|
+
ref: dropRef,
|
|
271
227
|
as: Box,
|
|
272
228
|
background: background,
|
|
273
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,
|