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,7 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { FormClose } from "grommet-icons/es6/icons/FormClose";
|
|
3
|
-
import { Box, Button,
|
|
4
|
-
import { grommet } from 'grommet/themes';
|
|
3
|
+
import { Box, Button, Select, Text } from 'grommet';
|
|
5
4
|
var allSeasons = ['S01', 'S02', 'S03', 'S04', 'S05', 'S06', 'S07', 'S08', 'S09', 'S10'];
|
|
6
5
|
export var Children = function Children() {
|
|
7
6
|
var _useState = useState([]),
|
|
@@ -61,43 +60,49 @@ export var Children = function Children() {
|
|
|
61
60
|
}, option);
|
|
62
61
|
};
|
|
63
62
|
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
63
|
+
return (
|
|
64
|
+
/*#__PURE__*/
|
|
65
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
66
|
+
// <Grommet theme={...}>
|
|
67
|
+
React.createElement(Box, {
|
|
68
|
+
fill: true,
|
|
69
|
+
align: "center",
|
|
70
|
+
justify: "center"
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
72
|
+
closeOnChange: false,
|
|
73
|
+
multiple: true,
|
|
74
|
+
value: /*#__PURE__*/React.createElement(Box, {
|
|
75
|
+
wrap: true,
|
|
76
|
+
direction: "row",
|
|
77
|
+
width: "small"
|
|
78
|
+
}, selected && selected.length ? selected.map(function (index) {
|
|
79
|
+
return renderSeason(allSeasons[index]);
|
|
80
|
+
}) : /*#__PURE__*/React.createElement(Box, {
|
|
81
|
+
pad: {
|
|
82
|
+
vertical: 'xsmall',
|
|
83
|
+
horizontal: 'small'
|
|
84
|
+
},
|
|
85
|
+
margin: "xsmall"
|
|
86
|
+
}, "Select Season")),
|
|
87
|
+
options: allSeasons,
|
|
88
|
+
selected: selected,
|
|
89
|
+
disabled: [2, 6],
|
|
90
|
+
onChange: function onChange(_ref) {
|
|
91
|
+
var nextSelected = _ref.selected;
|
|
92
|
+
setSelected([].concat(nextSelected).sort());
|
|
93
|
+
}
|
|
94
|
+
}, renderOption)) // </Grommet>
|
|
95
|
+
|
|
96
|
+
);
|
|
95
97
|
};
|
|
96
98
|
Children.parameters = {
|
|
97
99
|
chromatic: {
|
|
98
100
|
disable: true
|
|
99
101
|
}
|
|
100
102
|
};
|
|
103
|
+
Children.args = {
|
|
104
|
+
full: true
|
|
105
|
+
};
|
|
101
106
|
export default {
|
|
102
107
|
title: 'Input/Select/Children'
|
|
103
108
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Box,
|
|
2
|
+
import { Box, Select } from 'grommet';
|
|
3
3
|
var options = ['one', 'two', 'three'];
|
|
4
4
|
|
|
5
5
|
var ClearTop = function ClearTop() {
|
|
@@ -26,9 +26,13 @@ var ClearTop = function ClearTop() {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export var Clear = function Clear() {
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
return (
|
|
30
|
+
/*#__PURE__*/
|
|
31
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
32
|
+
// <Grommet theme={...}>
|
|
33
|
+
React.createElement(ClearTop, null) // </Grommet>
|
|
34
|
+
|
|
35
|
+
);
|
|
32
36
|
};
|
|
33
37
|
Clear.parameters = {
|
|
34
38
|
chromatic: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Box, Button,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, Button, Select } from 'grommet';
|
|
4
3
|
export var Controlled = function Controlled() {
|
|
5
4
|
var options = ['one', 'two'];
|
|
6
5
|
|
|
@@ -12,32 +11,38 @@ export var Controlled = function Controlled() {
|
|
|
12
11
|
open = _useState2[0],
|
|
13
12
|
setOpen = _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
|
-
|
|
14
|
+
return (
|
|
15
|
+
/*#__PURE__*/
|
|
16
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
17
|
+
// <Grommet theme={...}>
|
|
18
|
+
React.createElement(Box, {
|
|
19
|
+
fill: true,
|
|
20
|
+
align: "center",
|
|
21
|
+
justify: "start",
|
|
22
|
+
pad: "large",
|
|
23
|
+
gap: "small"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
25
|
+
onClick: function onClick() {
|
|
26
|
+
return setOpen(!open);
|
|
27
|
+
},
|
|
28
|
+
label: "Control the select"
|
|
29
|
+
}), /*#__PURE__*/React.createElement(Select, {
|
|
30
|
+
id: "select",
|
|
31
|
+
name: "select",
|
|
32
|
+
placeholder: "Select",
|
|
33
|
+
open: open,
|
|
34
|
+
value: value,
|
|
35
|
+
options: options,
|
|
36
|
+
onChange: function onChange(_ref) {
|
|
37
|
+
var option = _ref.option;
|
|
38
|
+
return setValue(option);
|
|
39
|
+
}
|
|
40
|
+
})) // </Grommet>
|
|
41
|
+
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
Controlled.args = {
|
|
45
|
+
full: true
|
|
41
46
|
};
|
|
42
47
|
export default {
|
|
43
48
|
title: 'Input/Select/Controlled'
|
|
@@ -2,7 +2,7 @@ import React, { useRef, useState, useEffect } from 'react';
|
|
|
2
2
|
import { FormClose } from "grommet-icons/es6/icons/FormClose";
|
|
3
3
|
import { Box, Button, CheckBox, Grommet, Select, Text } from 'grommet'; // https://github.com/grommet/grommet/blob/master/src/js/components/Select/stories/theme.js
|
|
4
4
|
|
|
5
|
-
import { theme as customSearchTheme } from '
|
|
5
|
+
import { theme as customSearchTheme } from '../theme';
|
|
6
6
|
var allContentPartners = [{
|
|
7
7
|
name: 'Test Partner',
|
|
8
8
|
id: '32131232'
|
|
@@ -217,5 +217,5 @@ export var CustomSearch = function CustomSearch() {
|
|
|
217
217
|
};
|
|
218
218
|
CustomSearch.storyName = 'Custom search';
|
|
219
219
|
export default {
|
|
220
|
-
title: 'Input/Select/Custom search'
|
|
220
|
+
title: 'Input/Select/Custom Themed/Custom search'
|
|
221
221
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Box,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, Select, Text } from 'grommet';
|
|
4
3
|
export var Disabled = function Disabled() {
|
|
5
4
|
var options = ['one', 'two'];
|
|
6
5
|
|
|
@@ -8,29 +7,35 @@ export var Disabled = function Disabled() {
|
|
|
8
7
|
value = _useState[0],
|
|
9
8
|
setValue = _useState[1];
|
|
10
9
|
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
10
|
+
return (
|
|
11
|
+
/*#__PURE__*/
|
|
12
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
13
|
+
// <Grommet theme={...}>
|
|
14
|
+
React.createElement(Box, {
|
|
15
|
+
fill: true,
|
|
16
|
+
align: "center",
|
|
17
|
+
justify: "start",
|
|
18
|
+
pad: "large",
|
|
19
|
+
gap: "medium"
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
21
|
+
weight: "bold"
|
|
22
|
+
}, "Disabled"), /*#__PURE__*/React.createElement(Select, {
|
|
23
|
+
id: "select",
|
|
24
|
+
name: "select",
|
|
25
|
+
placeholder: "Select",
|
|
26
|
+
value: value,
|
|
27
|
+
options: options,
|
|
28
|
+
onChange: function onChange(_ref) {
|
|
29
|
+
var option = _ref.option;
|
|
30
|
+
return setValue(option);
|
|
31
|
+
},
|
|
32
|
+
disabled: true
|
|
33
|
+
})) // </Grommet>
|
|
34
|
+
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
Disabled.args = {
|
|
38
|
+
full: true
|
|
34
39
|
};
|
|
35
40
|
export default {
|
|
36
41
|
title: 'Input/Select/Disabled'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
|
-
import { Box, Button, Form, FormField,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, Button, Form, FormField, Select } from 'grommet';
|
|
4
3
|
var options = [{
|
|
5
4
|
label: 'option 1',
|
|
6
5
|
value: 1
|
|
@@ -19,31 +18,35 @@ export var InsideFormField = function InsideFormField() {
|
|
|
19
18
|
var onChange = useCallback(function (nextValue) {
|
|
20
19
|
return setValue(nextValue);
|
|
21
20
|
}, []);
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
21
|
+
return (
|
|
22
|
+
/*#__PURE__*/
|
|
23
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
24
|
+
// <Grommet theme={...}>
|
|
25
|
+
React.createElement(Box, {
|
|
26
|
+
align: "center",
|
|
27
|
+
pad: "large"
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
29
|
+
value: value,
|
|
30
|
+
onChange: onChange,
|
|
31
|
+
onSubmit: function onSubmit() {
|
|
32
|
+
return console.log('Submit', value);
|
|
33
|
+
}
|
|
34
|
+
}, /*#__PURE__*/React.createElement(FormField, {
|
|
35
|
+
label: "Label",
|
|
36
|
+
name: "select"
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
38
|
+
name: "select",
|
|
39
|
+
placeholder: "placeholder",
|
|
40
|
+
options: options,
|
|
41
|
+
labelKey: "label",
|
|
42
|
+
valueKey: "value"
|
|
43
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
44
|
+
type: "submit",
|
|
45
|
+
label: "Update",
|
|
46
|
+
primary: true
|
|
47
|
+
}))) // </Grommet>
|
|
48
|
+
|
|
49
|
+
);
|
|
47
50
|
};
|
|
48
51
|
InsideFormField.storyName = 'Inside a FormField';
|
|
49
52
|
export default {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box, CheckBox,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, CheckBox, Select } from 'grommet';
|
|
4
3
|
var dummyOptions = Array(2000).fill().map(function (_, i) {
|
|
5
4
|
return "option " + i;
|
|
6
5
|
}).sort(function (a, b) {
|
|
@@ -65,29 +64,33 @@ export var LazyLoadingOptions = function LazyLoadingOptions() {
|
|
|
65
64
|
return setSelected(nextSelected);
|
|
66
65
|
};
|
|
67
66
|
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
67
|
+
return (
|
|
68
|
+
/*#__PURE__*/
|
|
69
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
70
|
+
// <Grommet theme={...}>
|
|
71
|
+
React.createElement(Box, {
|
|
72
|
+
fill: true,
|
|
73
|
+
align: "center",
|
|
74
|
+
justify: "start",
|
|
75
|
+
pad: "large"
|
|
76
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
77
|
+
multiple: true,
|
|
78
|
+
closeOnChange: false,
|
|
79
|
+
placeholder: "select an option...",
|
|
80
|
+
selected: selected,
|
|
81
|
+
options: options,
|
|
82
|
+
dropHeight: "medium",
|
|
83
|
+
onMore: onMore,
|
|
84
|
+
onClose: onClose,
|
|
85
|
+
onChange: onChange
|
|
86
|
+
}, function (option, index) {
|
|
87
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
88
|
+
value: option,
|
|
89
|
+
selected: selected.indexOf(index) !== -1
|
|
90
|
+
});
|
|
91
|
+
})) // </Grommet>
|
|
92
|
+
|
|
93
|
+
);
|
|
91
94
|
};
|
|
92
95
|
LazyLoadingOptions.storyName = 'Lazy loading options';
|
|
93
96
|
LazyLoadingOptions.parameters = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box, CheckBox,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, CheckBox, Select } from 'grommet';
|
|
4
3
|
var Option = /*#__PURE__*/React.memo(function (_ref) {
|
|
5
4
|
var value = _ref.value,
|
|
6
5
|
selected = _ref.selected;
|
|
@@ -32,50 +31,53 @@ export var ManyOptions = function ManyOptions() {
|
|
|
32
31
|
options = _React$useState2[0],
|
|
33
32
|
setOptions = _React$useState2[1];
|
|
34
33
|
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
34
|
+
return (
|
|
35
|
+
/*#__PURE__*/
|
|
36
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
37
|
+
// <Grommet theme={...}>
|
|
38
|
+
React.createElement(Box, {
|
|
39
|
+
fill: true,
|
|
40
|
+
align: "center",
|
|
41
|
+
justify: "start",
|
|
42
|
+
pad: "large"
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
44
|
+
multiple: true,
|
|
45
|
+
closeOnChange: false,
|
|
46
|
+
placeholder: "select an option...",
|
|
47
|
+
selected: selected,
|
|
48
|
+
options: options,
|
|
49
|
+
dropHeight: "medium",
|
|
50
|
+
onClose: function onClose() {
|
|
51
|
+
return setOptions(options.sort(function (p1, p2) {
|
|
52
|
+
var p1Exists = selected.includes(p1);
|
|
53
|
+
var p2Exists = selected.includes(p2);
|
|
54
|
+
|
|
55
|
+
if (!p1Exists && p2Exists) {
|
|
56
|
+
return 1;
|
|
57
|
+
}
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
if (p1Exists && !p2Exists) {
|
|
60
|
+
return -1;
|
|
61
|
+
}
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
return p1.localeCompare(p2, undefined, {
|
|
64
|
+
numeric: true,
|
|
65
|
+
sensitivity: 'base'
|
|
66
|
+
});
|
|
67
|
+
}));
|
|
68
|
+
},
|
|
69
|
+
onChange: function onChange(_ref2) {
|
|
70
|
+
var nextSelected = _ref2.selected;
|
|
71
|
+
setSelected(nextSelected);
|
|
72
|
+
}
|
|
73
|
+
}, function (option, index) {
|
|
74
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
75
|
+
value: option,
|
|
76
|
+
selected: selected.indexOf(index) !== -1
|
|
77
|
+
});
|
|
78
|
+
})) // </Grommet>
|
|
62
79
|
|
|
63
|
-
|
|
64
|
-
numeric: true,
|
|
65
|
-
sensitivity: 'base'
|
|
66
|
-
});
|
|
67
|
-
}));
|
|
68
|
-
},
|
|
69
|
-
onChange: function onChange(_ref2) {
|
|
70
|
-
var nextSelected = _ref2.selected;
|
|
71
|
-
setSelected(nextSelected);
|
|
72
|
-
}
|
|
73
|
-
}, function (option, index) {
|
|
74
|
-
return /*#__PURE__*/React.createElement(Option, {
|
|
75
|
-
value: option,
|
|
76
|
-
selected: selected.indexOf(index) !== -1
|
|
77
|
-
});
|
|
78
|
-
})));
|
|
80
|
+
);
|
|
79
81
|
};
|
|
80
82
|
ManyOptions.storyName = 'Many options';
|
|
81
83
|
ManyOptions.parameters = {
|
|
@@ -83,6 +85,9 @@ ManyOptions.parameters = {
|
|
|
83
85
|
disable: true
|
|
84
86
|
}
|
|
85
87
|
};
|
|
88
|
+
ManyOptions.args = {
|
|
89
|
+
full: true
|
|
90
|
+
};
|
|
86
91
|
export default {
|
|
87
92
|
title: 'Input/Select/Many options'
|
|
88
93
|
};
|
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Box,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, Select } from 'grommet';
|
|
4
3
|
var options = ['one', 'two'];
|
|
5
4
|
export var Multiple = function Multiple() {
|
|
6
5
|
var _useState = useState(['one']),
|
|
7
6
|
value = _useState[0],
|
|
8
7
|
setValue = _useState[1];
|
|
9
8
|
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
return (
|
|
10
|
+
/*#__PURE__*/
|
|
11
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
12
|
+
// <Grommet theme={...}>
|
|
13
|
+
React.createElement(Box, {
|
|
14
|
+
fill: true,
|
|
15
|
+
align: "center",
|
|
16
|
+
justify: "start",
|
|
17
|
+
pad: "large"
|
|
18
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
19
|
+
placeholder: "Select",
|
|
20
|
+
multiple: true,
|
|
21
|
+
closeOnChange: false,
|
|
22
|
+
value: value,
|
|
23
|
+
options: options,
|
|
24
|
+
onChange: function onChange(_ref) {
|
|
25
|
+
var nextValue = _ref.value;
|
|
26
|
+
return setValue(nextValue);
|
|
27
|
+
}
|
|
28
|
+
})) // </Grommet>
|
|
29
|
+
|
|
30
|
+
);
|
|
29
31
|
};
|
|
30
32
|
Multiple.parameters = {
|
|
31
33
|
chromatic: {
|
|
32
34
|
disable: true
|
|
33
35
|
}
|
|
34
36
|
};
|
|
37
|
+
Multiple.args = {
|
|
38
|
+
full: true
|
|
39
|
+
};
|
|
35
40
|
export default {
|
|
36
41
|
title: 'Input/Select/Multiple'
|
|
37
42
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Box,
|
|
3
|
-
import { grommet } from 'grommet/themes';
|
|
2
|
+
import { Box, Select } from 'grommet';
|
|
4
3
|
var objectOptions = [{
|
|
5
4
|
label: 'Male',
|
|
6
5
|
value: 1
|
|
@@ -19,29 +18,33 @@ export var ObjectOptions = function ObjectOptions() {
|
|
|
19
18
|
value = _useState[0],
|
|
20
19
|
setValue = _useState[1];
|
|
21
20
|
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
21
|
+
return (
|
|
22
|
+
/*#__PURE__*/
|
|
23
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
24
|
+
// <Grommet theme={...}>
|
|
25
|
+
React.createElement(Box, {
|
|
26
|
+
fill: true,
|
|
27
|
+
align: "center",
|
|
28
|
+
justify: "start",
|
|
29
|
+
pad: "large"
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
31
|
+
id: "select",
|
|
32
|
+
name: "select",
|
|
33
|
+
placeholder: "Select",
|
|
34
|
+
labelKey: "label",
|
|
35
|
+
valueKey: {
|
|
36
|
+
key: 'value',
|
|
37
|
+
reduce: true
|
|
38
|
+
},
|
|
39
|
+
value: value,
|
|
40
|
+
options: objectOptions,
|
|
41
|
+
onChange: function onChange(_ref) {
|
|
42
|
+
var nextValue = _ref.value;
|
|
43
|
+
return setValue(nextValue);
|
|
44
|
+
}
|
|
45
|
+
})) // </Grommet>
|
|
46
|
+
|
|
47
|
+
);
|
|
45
48
|
};
|
|
46
49
|
ObjectOptions.storyName = 'Object options';
|
|
47
50
|
ObjectOptions.parameters = {
|