grommet 2.20.1 → 2.21.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/Button/Button.js +2 -3
- package/components/Chart/Chart.js +14 -6
- package/components/DataChart/DataChart.js +84 -21
- package/components/DataChart/Detail.js +8 -0
- package/components/DataChart/XAxis.js +19 -10
- package/components/DataChart/index.d.ts +10 -2
- package/components/DataChart/propTypes.js +2 -1
- package/components/DataChart/stories/Offset.js +82 -0
- package/components/DataChart/stories/StackedAreas.js +77 -0
- package/components/DataChart/stories/StackedLines.js +73 -0
- package/components/DateInput/DateInput.js +21 -9
- package/components/DateInput/index.d.ts +1 -0
- package/components/DateInput/propTypes.js +1 -0
- package/components/List/List.js +11 -2
- package/components/List/index.d.ts +1 -0
- package/components/List/propTypes.js +1 -0
- package/components/Markdown/Markdown.js +4 -2
- package/components/Menu/Menu.js +39 -12
- package/components/Notification/Notification.js +17 -6
- package/components/Notification/index.d.ts +7 -1
- package/components/Notification/propTypes.js +4 -1
- package/components/RangeInput/StyledRangeInput.js +1 -1
- package/components/RangeInput/stories/SimpleRange.js +2 -6
- package/components/Select/Select.js +44 -12
- package/components/Select/SelectContainer.js +22 -6
- package/components/Select/stories/ChildrenRender.js +37 -33
- package/components/Select/stories/Clear.js +7 -3
- package/components/Select/stories/Controlled.js +32 -28
- package/components/Select/stories/{CustomSearch.js → CustomThemed/CustomSearch.js} +2 -2
- package/components/Select/stories/Disabled.js +29 -25
- package/components/Select/stories/InsideFormField.js +29 -27
- package/components/Select/stories/LazyLoadingOptions.js +27 -25
- package/components/Select/stories/ManyOptions.js +47 -43
- package/components/Select/stories/Multiple.js +25 -21
- package/components/Select/stories/ObjectOptions.js +27 -25
- package/components/Select/stories/Search.js +62 -58
- package/components/Select/stories/Simple.js +26 -22
- package/components/Select/stories/Uncontrolled.js +24 -20
- package/components/Select/stories/ValueLabel.js +40 -36
- package/components/Select/stories/typescript/CreateOption.tsx +34 -30
- package/components/Sidebar/stories/Labels.js +25 -19
- package/components/Sidebar/stories/typescript/Simple.tsx +17 -12
- package/components/SkipLinks/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/components/SkipLinks/stories/Simple.js +82 -78
- package/components/Tab/Tab.js +6 -1
- package/components/Table/stories/Default.js +30 -28
- package/components/Table/stories/InfiniteScrollInTable.js +39 -35
- package/components/Table/stories/MeterInTable.js +26 -24
- package/components/Tag/Tag.js +17 -6
- package/components/Tag/index.d.ts +8 -0
- package/components/Tag/propTypes.js +2 -1
- package/components/Tag/stories/Size.js +45 -0
- package/components/TextArea/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/components/TextArea/stories/Fill.js +18 -16
- package/components/TextArea/stories/InsideFormField.js +43 -41
- package/components/TextArea/stories/NonResizable.js +13 -11
- package/components/TextArea/stories/Simple.js +13 -11
- package/components/TextInput/TextInput.js +5 -8
- package/{es6/components/TextInput/stories/typescript → components/TextInput/stories/CustomThemed}/CustomSuggestions.tsx +1 -1
- package/components/TextInput/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/components/TextInput/stories/DefaultSuggestion.js +20 -19
- package/components/TextInput/stories/Icon.js +22 -21
- package/components/TextInput/stories/InsideFormField.js +32 -30
- package/components/TextInput/stories/OnSelect.js +20 -19
- package/components/TextInput/stories/Password.js +30 -29
- package/components/TextInput/stories/Simple.js +17 -16
- package/components/TextInput/stories/StyledPlaceholder.js +10 -9
- package/components/TextInput/stories/Suggestions.js +19 -18
- package/components/TextInput/stories/Uncontrolled.js +18 -17
- package/components/TextInput/stories/WithTags.js +19 -18
- package/components/Tip/stories/Caret.js +37 -31
- package/components/Tip/stories/{ResponsiveTip.js → CustomThemed/ResponsiveTip.js} +1 -1
- package/components/Tip/stories/{SidebarTip.js → CustomThemed/SidebarTip.js} +1 -1
- package/components/Tip/stories/{typescript → CustomThemed}/Themed.tsx +1 -1
- package/components/Tip/stories/HeaderActions.js +66 -60
- package/components/Tip/stories/InfoTip.js +59 -56
- package/components/Tip/stories/typescript/Animated.tsx +26 -21
- package/components/Tip/stories/typescript/Children.tsx +52 -51
- package/components/Tip/stories/typescript/Simple.tsx +12 -7
- package/es6/components/Button/Button.js +2 -3
- package/es6/components/Chart/Chart.js +14 -6
- package/es6/components/DataChart/DataChart.js +84 -21
- package/es6/components/DataChart/Detail.js +7 -0
- package/es6/components/DataChart/XAxis.js +19 -10
- package/es6/components/DataChart/index.d.ts +10 -2
- package/es6/components/DataChart/propTypes.js +2 -1
- package/es6/components/DataChart/stories/Offset.js +70 -0
- package/es6/components/DataChart/stories/StackedAreas.js +65 -0
- package/es6/components/DataChart/stories/StackedLines.js +61 -0
- package/es6/components/DateInput/DateInput.js +21 -9
- package/es6/components/DateInput/index.d.ts +1 -0
- package/es6/components/DateInput/propTypes.js +1 -0
- package/es6/components/List/List.js +11 -2
- package/es6/components/List/index.d.ts +1 -0
- package/es6/components/List/propTypes.js +1 -0
- package/es6/components/Markdown/Markdown.js +4 -2
- package/es6/components/Menu/Menu.js +40 -13
- package/es6/components/Notification/Notification.js +18 -7
- package/es6/components/Notification/index.d.ts +7 -1
- package/es6/components/Notification/propTypes.js +4 -1
- package/es6/components/RangeInput/StyledRangeInput.js +1 -1
- package/es6/components/RangeInput/stories/SimpleRange.js +3 -6
- package/es6/components/Select/Select.js +44 -12
- package/es6/components/Select/SelectContainer.js +22 -6
- package/es6/components/Select/stories/ChildrenRender.js +38 -33
- package/es6/components/Select/stories/Clear.js +8 -4
- package/es6/components/Select/stories/Controlled.js +33 -28
- package/es6/components/Select/stories/{CustomSearch.js → CustomThemed/CustomSearch.js} +2 -2
- package/es6/components/Select/stories/Disabled.js +30 -25
- package/es6/components/Select/stories/InsideFormField.js +30 -27
- package/es6/components/Select/stories/LazyLoadingOptions.js +28 -25
- package/es6/components/Select/stories/ManyOptions.js +48 -43
- package/es6/components/Select/stories/Multiple.js +26 -21
- package/es6/components/Select/stories/ObjectOptions.js +28 -25
- package/es6/components/Select/stories/Search.js +63 -58
- package/es6/components/Select/stories/Simple.js +27 -22
- package/es6/components/Select/stories/Uncontrolled.js +25 -20
- package/es6/components/Select/stories/ValueLabel.js +41 -36
- package/es6/components/Select/stories/typescript/CreateOption.tsx +34 -30
- package/es6/components/Sidebar/stories/Labels.js +26 -20
- package/es6/components/Sidebar/stories/typescript/Simple.tsx +17 -12
- package/es6/components/SkipLinks/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/es6/components/SkipLinks/stories/Simple.js +83 -79
- package/es6/components/Tab/Tab.js +6 -1
- package/es6/components/Table/stories/Default.js +31 -28
- package/es6/components/Table/stories/InfiniteScrollInTable.js +40 -36
- package/es6/components/Table/stories/MeterInTable.js +27 -24
- package/es6/components/Tag/Tag.js +17 -6
- package/es6/components/Tag/index.d.ts +8 -0
- package/es6/components/Tag/propTypes.js +2 -1
- package/es6/components/Tag/stories/Size.js +33 -0
- package/es6/components/TextArea/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/es6/components/TextArea/stories/Fill.js +19 -16
- package/es6/components/TextArea/stories/InsideFormField.js +44 -41
- package/es6/components/TextArea/stories/NonResizable.js +14 -11
- package/es6/components/TextArea/stories/Simple.js +14 -11
- package/es6/components/TextInput/TextInput.js +5 -8
- package/{components/TextInput/stories/typescript → es6/components/TextInput/stories/CustomThemed}/CustomSuggestions.tsx +1 -1
- package/es6/components/TextInput/stories/{Themed.js → CustomThemed/Themed.js} +1 -1
- package/es6/components/TextInput/stories/DefaultSuggestion.js +21 -19
- package/es6/components/TextInput/stories/Icon.js +23 -21
- package/es6/components/TextInput/stories/InsideFormField.js +33 -30
- package/es6/components/TextInput/stories/OnSelect.js +21 -19
- package/es6/components/TextInput/stories/Password.js +31 -29
- package/es6/components/TextInput/stories/Simple.js +18 -16
- package/es6/components/TextInput/stories/StyledPlaceholder.js +11 -9
- package/es6/components/TextInput/stories/Suggestions.js +20 -18
- package/es6/components/TextInput/stories/Uncontrolled.js +19 -17
- package/es6/components/TextInput/stories/WithTags.js +20 -18
- package/es6/components/Tip/stories/Caret.js +38 -32
- package/es6/components/Tip/stories/{ResponsiveTip.js → CustomThemed/ResponsiveTip.js} +1 -1
- package/es6/components/Tip/stories/{SidebarTip.js → CustomThemed/SidebarTip.js} +1 -1
- package/es6/components/Tip/stories/{typescript → CustomThemed}/Themed.tsx +1 -1
- package/es6/components/Tip/stories/HeaderActions.js +67 -61
- package/es6/components/Tip/stories/InfoTip.js +60 -57
- package/es6/components/Tip/stories/typescript/Animated.tsx +26 -21
- package/es6/components/Tip/stories/typescript/Children.tsx +52 -51
- package/es6/components/Tip/stories/typescript/Simple.tsx +12 -7
- package/es6/languages/default.json +2 -1
- package/es6/themes/base.d.ts +34 -1
- package/es6/themes/base.js +39 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +2 -1
- package/package.json +4 -4
- package/themes/base.d.ts +34 -1
- package/themes/base.js +39 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Box, Button, Form, FormField,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, Button, Form, FormField, Text, TextArea } from 'grommet';
|
|
4
3
|
export var InsideFormField = function InsideFormField() {
|
|
5
4
|
var _useState = useState({
|
|
6
5
|
name: '',
|
|
@@ -10,45 +9,49 @@ export var InsideFormField = function InsideFormField() {
|
|
|
10
9
|
value = _useState[0],
|
|
11
10
|
setValue = _useState[1];
|
|
12
11
|
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
12
|
+
return (
|
|
13
|
+
/*#__PURE__*/
|
|
14
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
15
|
+
// <Grommet theme={...}>
|
|
16
|
+
React.createElement(Box, null, /*#__PURE__*/React.createElement(Box, {
|
|
17
|
+
align: "center",
|
|
18
|
+
pad: "large"
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
20
|
+
weight: "bold"
|
|
21
|
+
}, "TextArea as component prop of FormField"), /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(FormField, {
|
|
22
|
+
label: "FormField label",
|
|
23
|
+
htmlFor: "text-area",
|
|
24
|
+
component: TextArea,
|
|
25
|
+
placeholder: "placeholder from FormField"
|
|
26
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
27
|
+
type: "submit",
|
|
28
|
+
label: "submit"
|
|
29
|
+
}))), /*#__PURE__*/React.createElement(Box, {
|
|
30
|
+
align: "center",
|
|
31
|
+
pad: "large"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
33
|
+
weight: "bold"
|
|
34
|
+
}, "TextArea inside FormField"), /*#__PURE__*/React.createElement(Form, {
|
|
35
|
+
value: value,
|
|
36
|
+
onChange: function onChange(nextValue) {
|
|
37
|
+
return setValue(nextValue);
|
|
38
|
+
},
|
|
39
|
+
onSubmit: function onSubmit() {
|
|
40
|
+
return console.log(value);
|
|
41
|
+
}
|
|
42
|
+
}, /*#__PURE__*/React.createElement(FormField, {
|
|
43
|
+
name: "value",
|
|
44
|
+
label: "FormField label",
|
|
45
|
+
required: true
|
|
46
|
+
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
47
|
+
name: "value",
|
|
48
|
+
placeholder: "placeholder from TextArea"
|
|
49
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
50
|
+
type: "submit",
|
|
51
|
+
label: "submit"
|
|
52
|
+
})))) // </Grommet>
|
|
53
|
+
|
|
54
|
+
);
|
|
52
55
|
};
|
|
53
56
|
InsideFormField.storyName = 'Inside a FormField';
|
|
54
57
|
export default {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || 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); }
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
-
import { Box,
|
|
5
|
-
import { grommet } from 'grommet/themes';
|
|
4
|
+
import { Box, TextArea } from 'grommet';
|
|
6
5
|
|
|
7
6
|
var Resize = function Resize(props) {
|
|
8
7
|
var _useState = useState(''),
|
|
@@ -13,15 +12,19 @@ var Resize = function Resize(props) {
|
|
|
13
12
|
return setValue(event.target.value);
|
|
14
13
|
};
|
|
15
14
|
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
return (
|
|
16
|
+
/*#__PURE__*/
|
|
17
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
18
|
+
// <Grommet theme={...}>
|
|
19
|
+
React.createElement(Box, {
|
|
20
|
+
align: "center",
|
|
21
|
+
pad: "large"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(TextArea, _extends({
|
|
23
|
+
value: value,
|
|
24
|
+
onChange: onChange
|
|
25
|
+
}, props))) // </Grommet>
|
|
26
|
+
|
|
27
|
+
);
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
export var NonResizable = function NonResizable() {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || 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); }
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
-
import { Box,
|
|
5
|
-
import { grommet } from 'grommet/themes';
|
|
4
|
+
import { Box, TextArea } from 'grommet';
|
|
6
5
|
|
|
7
6
|
var Resize = function Resize(props) {
|
|
8
7
|
var _useState = useState(''),
|
|
@@ -13,15 +12,19 @@ var Resize = function Resize(props) {
|
|
|
13
12
|
return setValue(event.target.value);
|
|
14
13
|
};
|
|
15
14
|
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
return (
|
|
16
|
+
/*#__PURE__*/
|
|
17
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
18
|
+
// <Grommet theme={...}>
|
|
19
|
+
React.createElement(Box, {
|
|
20
|
+
align: "center",
|
|
21
|
+
pad: "large"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(TextArea, _extends({
|
|
23
|
+
value: value,
|
|
24
|
+
onChange: onChange
|
|
25
|
+
}, props))) // </Grommet>
|
|
26
|
+
|
|
27
|
+
);
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
export var Simple = function Simple() {
|
|
@@ -138,7 +138,10 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
138
138
|
|
|
139
139
|
setShowDrop(false);
|
|
140
140
|
if (onSuggestionsClose) onSuggestionsClose();
|
|
141
|
-
}, [onSuggestionsClose, suggestions]);
|
|
141
|
+
}, [onSuggestionsClose, suggestions]);
|
|
142
|
+
var clickOutside = useCallback(function (event) {
|
|
143
|
+
if (event.target !== inputRef.current) closeDrop();
|
|
144
|
+
}, [inputRef, closeDrop]); // Handle scenarios where we have focus, the drop isn't showing,
|
|
142
145
|
// and the suggestions change. We don't want to open the drop if
|
|
143
146
|
// the drop has been closed by onEsc and the suggestions haven't
|
|
144
147
|
// changed. So, we remember the suggestions we are showing when
|
|
@@ -267,13 +270,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
267
270
|
align: dropAlign,
|
|
268
271
|
responsive: false,
|
|
269
272
|
target: dropTarget || inputRef.current,
|
|
270
|
-
onClickOutside:
|
|
271
|
-
var target = _ref2.target;
|
|
272
|
-
|
|
273
|
-
if (target !== inputRef.current) {
|
|
274
|
-
closeDrop();
|
|
275
|
-
}
|
|
276
|
-
},
|
|
273
|
+
onClickOutside: clickOutside,
|
|
277
274
|
onEsc: closeDrop
|
|
278
275
|
}, dropProps), /*#__PURE__*/React.createElement(ContainerBox, {
|
|
279
276
|
overflow: "auto",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, TextInput } from 'grommet';
|
|
4
3
|
var suggestions = Array(100).fill().map(function (_, i) {
|
|
5
4
|
return "suggestion " + (i + 1);
|
|
6
5
|
});
|
|
@@ -17,23 +16,26 @@ export var DefaultSuggestion = function DefaultSuggestion() {
|
|
|
17
16
|
return setValue(event.suggestion);
|
|
18
17
|
};
|
|
19
18
|
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
return (
|
|
20
|
+
/*#__PURE__*/
|
|
21
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
22
|
+
// <Grommet theme={...}>
|
|
23
|
+
React.createElement(Box, {
|
|
24
|
+
fill: true,
|
|
25
|
+
align: "center",
|
|
26
|
+
justify: "start",
|
|
27
|
+
pad: "large"
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
29
|
+
width: "medium"
|
|
30
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
31
|
+
value: value,
|
|
32
|
+
onChange: onChange,
|
|
33
|
+
onSelect: onSelect,
|
|
34
|
+
suggestions: suggestions,
|
|
35
|
+
defaultSuggestion: 1
|
|
36
|
+
}))) // </Grommet>
|
|
37
|
+
|
|
38
|
+
);
|
|
37
39
|
};
|
|
38
40
|
DefaultSuggestion.storyName = 'Default suggestion';
|
|
39
41
|
DefaultSuggestion.parameters = {
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Search } from "grommet-icons/es6/icons/Search";
|
|
3
|
-
import { Box,
|
|
4
|
-
import { grommet } from 'grommet/themes';
|
|
3
|
+
import { Box, TextInput } from 'grommet';
|
|
5
4
|
export var Icon = function Icon() {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
return (
|
|
6
|
+
/*#__PURE__*/
|
|
7
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
8
|
+
// <Grommet theme={...}>
|
|
9
|
+
React.createElement(Box, {
|
|
10
|
+
fill: true,
|
|
11
|
+
align: "center",
|
|
12
|
+
justify: "start",
|
|
13
|
+
pad: "large"
|
|
14
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
15
|
+
width: "medium",
|
|
16
|
+
gap: "medium"
|
|
17
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
18
|
+
icon: /*#__PURE__*/React.createElement(Search, null),
|
|
19
|
+
placeholder: "search ..."
|
|
20
|
+
}), /*#__PURE__*/React.createElement(TextInput, {
|
|
21
|
+
icon: /*#__PURE__*/React.createElement(Search, null),
|
|
22
|
+
reverse: true,
|
|
23
|
+
placeholder: "search ..."
|
|
24
|
+
}))) // </Grommet>
|
|
25
|
+
|
|
26
|
+
);
|
|
25
27
|
};
|
|
26
28
|
export default {
|
|
27
29
|
title: 'Input/TextInput/Icon'
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || 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); }
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
-
import { Box, Button, Form, FormField,
|
|
5
|
-
import { grommet } from 'grommet/themes';
|
|
4
|
+
import { Box, Button, Form, FormField, TextInput } from 'grommet';
|
|
6
5
|
var allSuggestions = Array(100).fill().map(function (_, i) {
|
|
7
6
|
return "suggestion " + (i + 1);
|
|
8
7
|
});
|
|
@@ -38,34 +37,38 @@ export var InsideFormField = function InsideFormField(props) {
|
|
|
38
37
|
}));
|
|
39
38
|
};
|
|
40
39
|
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
40
|
+
return (
|
|
41
|
+
/*#__PURE__*/
|
|
42
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
43
|
+
// <Grommet theme={...}>
|
|
44
|
+
React.createElement(Box, {
|
|
45
|
+
align: "center",
|
|
46
|
+
pad: "large"
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
48
|
+
onSubmit: function onSubmit(_ref) {
|
|
49
|
+
var nextValue = _ref.value;
|
|
50
|
+
console.log(nextValue);
|
|
51
|
+
setState({
|
|
52
|
+
value: '',
|
|
53
|
+
suggestions: allSuggestions
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, /*#__PURE__*/React.createElement(FormField, _extends({
|
|
57
|
+
label: "Label",
|
|
58
|
+
htmlFor: "text-input"
|
|
59
|
+
}, props), /*#__PURE__*/React.createElement(TextInput, {
|
|
60
|
+
id: "text-input",
|
|
61
|
+
placeholder: "placeholder",
|
|
62
|
+
value: state.value,
|
|
63
|
+
onChange: onChange,
|
|
64
|
+
onSelect: onSelect,
|
|
65
|
+
suggestions: state.suggestions
|
|
66
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
67
|
+
type: "submit",
|
|
68
|
+
label: "submit"
|
|
69
|
+
}))) // </Grommet>
|
|
70
|
+
|
|
71
|
+
);
|
|
69
72
|
};
|
|
70
73
|
InsideFormField.storyName = 'Inside a FormField';
|
|
71
74
|
export default {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, TextInput } from 'grommet';
|
|
4
3
|
var suggestions = Array(100).fill().map(function (_, i) {
|
|
5
4
|
return "suggestion " + (i + 1);
|
|
6
5
|
});
|
|
@@ -23,23 +22,26 @@ export var OnSelect = function OnSelect() {
|
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
24
|
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
return (
|
|
26
|
+
/*#__PURE__*/
|
|
27
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
28
|
+
// <Grommet theme={...}>
|
|
29
|
+
React.createElement(Box, {
|
|
30
|
+
fill: true,
|
|
31
|
+
align: "center",
|
|
32
|
+
justify: "start",
|
|
33
|
+
pad: "large"
|
|
34
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
35
|
+
width: "medium"
|
|
36
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
37
|
+
value: value,
|
|
38
|
+
onChange: onChange,
|
|
39
|
+
onSelect: onHighlight,
|
|
40
|
+
onSuggestionSelect: onSelect,
|
|
41
|
+
suggestions: suggestions
|
|
42
|
+
}))) // </Grommet>
|
|
43
|
+
|
|
44
|
+
);
|
|
43
45
|
};
|
|
44
46
|
OnSelect.storyName = 'onSelect and onSuggestionSelect';
|
|
45
47
|
OnSelect.parameters = {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Hide } from "grommet-icons/es6/icons/Hide";
|
|
3
3
|
import { View } from "grommet-icons/es6/icons/View";
|
|
4
|
-
import { Box, Button,
|
|
5
|
-
import { grommet } from 'grommet/themes';
|
|
4
|
+
import { Box, Button, TextInput } from 'grommet';
|
|
6
5
|
export var Password = function Password() {
|
|
7
6
|
var _React$useState = React.useState(''),
|
|
8
7
|
value = _React$useState[0],
|
|
@@ -12,33 +11,36 @@ export var Password = function Password() {
|
|
|
12
11
|
reveal = _React$useState2[0],
|
|
13
12
|
setReveal = _React$useState2[1];
|
|
14
13
|
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
14
|
+
return (
|
|
15
|
+
/*#__PURE__*/
|
|
16
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
17
|
+
// <Grommet theme={...}>
|
|
18
|
+
React.createElement(Box, {
|
|
19
|
+
width: "medium",
|
|
20
|
+
direction: "row",
|
|
21
|
+
margin: "large",
|
|
22
|
+
align: "center",
|
|
23
|
+
round: "small",
|
|
24
|
+
border: true
|
|
25
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
26
|
+
plain: true,
|
|
27
|
+
type: reveal ? 'text' : 'password',
|
|
28
|
+
value: value,
|
|
29
|
+
onChange: function onChange(event) {
|
|
30
|
+
return setValue(event.target.value);
|
|
31
|
+
}
|
|
32
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
33
|
+
icon: reveal ? /*#__PURE__*/React.createElement(View, {
|
|
34
|
+
size: "medium"
|
|
35
|
+
}) : /*#__PURE__*/React.createElement(Hide, {
|
|
36
|
+
size: "medium"
|
|
37
|
+
}),
|
|
38
|
+
onClick: function onClick() {
|
|
39
|
+
return setReveal(!reveal);
|
|
40
|
+
}
|
|
41
|
+
})) // </Grommet>
|
|
42
|
+
|
|
43
|
+
);
|
|
42
44
|
};
|
|
43
45
|
export default {
|
|
44
46
|
title: 'Input/TextInput/Password'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, TextInput } from 'grommet';
|
|
4
3
|
export var Simple = function Simple() {
|
|
5
4
|
var _React$useState = React.useState(''),
|
|
6
5
|
value = _React$useState[0],
|
|
@@ -10,20 +9,23 @@ export var Simple = function Simple() {
|
|
|
10
9
|
return setValue(event.target.value);
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
return (
|
|
13
|
+
/*#__PURE__*/
|
|
14
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
15
|
+
// <Grommet theme={...}>
|
|
16
|
+
React.createElement(Box, {
|
|
17
|
+
fill: true,
|
|
18
|
+
align: "center",
|
|
19
|
+
justify: "start",
|
|
20
|
+
pad: "large"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
22
|
+
width: "medium"
|
|
23
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
24
|
+
value: value,
|
|
25
|
+
onChange: onChange
|
|
26
|
+
}))) // </Grommet>
|
|
27
|
+
|
|
28
|
+
);
|
|
27
29
|
};
|
|
28
30
|
Simple.parameters = {
|
|
29
31
|
chromatic: {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box, Form,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, Form, TextInput, Text } from 'grommet';
|
|
4
3
|
export var StyledPlaceholder = function StyledPlaceholder() {
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
return (
|
|
5
|
+
/*#__PURE__*/
|
|
6
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
7
|
+
// <Grommet theme={...}>
|
|
8
|
+
React.createElement(Box, null, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(TextInput, {
|
|
9
|
+
name: "name",
|
|
10
|
+
placeholder: /*#__PURE__*/React.createElement(Text, null, "placeholder")
|
|
11
|
+
}))) // </Grommet>
|
|
12
|
+
|
|
13
|
+
);
|
|
12
14
|
};
|
|
13
15
|
StyledPlaceholder.storyName = 'Styled placeholder';
|
|
14
16
|
export default {
|