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
|
@@ -9,8 +9,6 @@ var _grommetIcons = require("grommet-icons");
|
|
|
9
9
|
|
|
10
10
|
var _grommet = require("grommet");
|
|
11
11
|
|
|
12
|
-
var _themes = require("grommet/themes");
|
|
13
|
-
|
|
14
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
13
|
|
|
16
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -75,37 +73,40 @@ var Children = function Children() {
|
|
|
75
73
|
}, option);
|
|
76
74
|
};
|
|
77
75
|
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
76
|
+
return (
|
|
77
|
+
/*#__PURE__*/
|
|
78
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
79
|
+
// <Grommet theme={...}>
|
|
80
|
+
_react["default"].createElement(_grommet.Box, {
|
|
81
|
+
fill: true,
|
|
82
|
+
align: "center",
|
|
83
|
+
justify: "center"
|
|
84
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
85
|
+
closeOnChange: false,
|
|
86
|
+
multiple: true,
|
|
87
|
+
value: /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
88
|
+
wrap: true,
|
|
89
|
+
direction: "row",
|
|
90
|
+
width: "small"
|
|
91
|
+
}, selected && selected.length ? selected.map(function (index) {
|
|
92
|
+
return renderSeason(allSeasons[index]);
|
|
93
|
+
}) : /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
94
|
+
pad: {
|
|
95
|
+
vertical: 'xsmall',
|
|
96
|
+
horizontal: 'small'
|
|
97
|
+
},
|
|
98
|
+
margin: "xsmall"
|
|
99
|
+
}, "Select Season")),
|
|
100
|
+
options: allSeasons,
|
|
101
|
+
selected: selected,
|
|
102
|
+
disabled: [2, 6],
|
|
103
|
+
onChange: function onChange(_ref) {
|
|
104
|
+
var nextSelected = _ref.selected;
|
|
105
|
+
setSelected([].concat(nextSelected).sort());
|
|
106
|
+
}
|
|
107
|
+
}, renderOption)) // </Grommet>
|
|
108
|
+
|
|
109
|
+
);
|
|
109
110
|
};
|
|
110
111
|
|
|
111
112
|
exports.Children = Children;
|
|
@@ -114,6 +115,9 @@ Children.parameters = {
|
|
|
114
115
|
disable: true
|
|
115
116
|
}
|
|
116
117
|
};
|
|
118
|
+
Children.args = {
|
|
119
|
+
full: true
|
|
120
|
+
};
|
|
117
121
|
var _default = {
|
|
118
122
|
title: 'Input/Select/Children'
|
|
119
123
|
};
|
|
@@ -37,9 +37,13 @@ var ClearTop = function ClearTop() {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
var Clear = function Clear() {
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
return (
|
|
41
|
+
/*#__PURE__*/
|
|
42
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
43
|
+
// <Grommet theme={...}>
|
|
44
|
+
_react["default"].createElement(ClearTop, null) // </Grommet>
|
|
45
|
+
|
|
46
|
+
);
|
|
43
47
|
};
|
|
44
48
|
|
|
45
49
|
exports.Clear = Clear;
|
|
@@ -7,8 +7,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
11
|
|
|
14
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -24,35 +22,41 @@ var Controlled = function Controlled() {
|
|
|
24
22
|
open = _useState2[0],
|
|
25
23
|
setOpen = _useState2[1];
|
|
26
24
|
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
25
|
+
return (
|
|
26
|
+
/*#__PURE__*/
|
|
27
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
28
|
+
// <Grommet theme={...}>
|
|
29
|
+
_react["default"].createElement(_grommet.Box, {
|
|
30
|
+
fill: true,
|
|
31
|
+
align: "center",
|
|
32
|
+
justify: "start",
|
|
33
|
+
pad: "large",
|
|
34
|
+
gap: "small"
|
|
35
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Button, {
|
|
36
|
+
onClick: function onClick() {
|
|
37
|
+
return setOpen(!open);
|
|
38
|
+
},
|
|
39
|
+
label: "Control the select"
|
|
40
|
+
}), /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
41
|
+
id: "select",
|
|
42
|
+
name: "select",
|
|
43
|
+
placeholder: "Select",
|
|
44
|
+
open: open,
|
|
45
|
+
value: value,
|
|
46
|
+
options: options,
|
|
47
|
+
onChange: function onChange(_ref) {
|
|
48
|
+
var option = _ref.option;
|
|
49
|
+
return setValue(option);
|
|
50
|
+
}
|
|
51
|
+
})) // </Grommet>
|
|
52
|
+
|
|
53
|
+
);
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
exports.Controlled = Controlled;
|
|
57
|
+
Controlled.args = {
|
|
58
|
+
full: true
|
|
59
|
+
};
|
|
56
60
|
var _default = {
|
|
57
61
|
title: 'Input/Select/Controlled'
|
|
58
62
|
};
|
|
@@ -9,7 +9,7 @@ var _grommetIcons = require("grommet-icons");
|
|
|
9
9
|
|
|
10
10
|
var _grommet = require("grommet");
|
|
11
11
|
|
|
12
|
-
var _theme = require("
|
|
12
|
+
var _theme = require("../theme");
|
|
13
13
|
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
|
|
@@ -233,6 +233,6 @@ var CustomSearch = function CustomSearch() {
|
|
|
233
233
|
exports.CustomSearch = CustomSearch;
|
|
234
234
|
CustomSearch.storyName = 'Custom search';
|
|
235
235
|
var _default = {
|
|
236
|
-
title: 'Input/Select/Custom search'
|
|
236
|
+
title: 'Input/Select/Custom Themed/Custom search'
|
|
237
237
|
};
|
|
238
238
|
exports["default"] = _default;
|
|
@@ -7,8 +7,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
11
|
|
|
14
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -20,32 +18,38 @@ var Disabled = function Disabled() {
|
|
|
20
18
|
value = _useState[0],
|
|
21
19
|
setValue = _useState[1];
|
|
22
20
|
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
21
|
+
return (
|
|
22
|
+
/*#__PURE__*/
|
|
23
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
24
|
+
// <Grommet theme={...}>
|
|
25
|
+
_react["default"].createElement(_grommet.Box, {
|
|
26
|
+
fill: true,
|
|
27
|
+
align: "center",
|
|
28
|
+
justify: "start",
|
|
29
|
+
pad: "large",
|
|
30
|
+
gap: "medium"
|
|
31
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
32
|
+
weight: "bold"
|
|
33
|
+
}, "Disabled"), /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
34
|
+
id: "select",
|
|
35
|
+
name: "select",
|
|
36
|
+
placeholder: "Select",
|
|
37
|
+
value: value,
|
|
38
|
+
options: options,
|
|
39
|
+
onChange: function onChange(_ref) {
|
|
40
|
+
var option = _ref.option;
|
|
41
|
+
return setValue(option);
|
|
42
|
+
},
|
|
43
|
+
disabled: true
|
|
44
|
+
})) // </Grommet>
|
|
45
|
+
|
|
46
|
+
);
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
exports.Disabled = Disabled;
|
|
50
|
+
Disabled.args = {
|
|
51
|
+
full: true
|
|
52
|
+
};
|
|
49
53
|
var _default = {
|
|
50
54
|
title: 'Input/Select/Disabled'
|
|
51
55
|
};
|
|
@@ -7,8 +7,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
11
|
|
|
14
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -32,31 +30,35 @@ var InsideFormField = function InsideFormField() {
|
|
|
32
30
|
var onChange = (0, _react.useCallback)(function (nextValue) {
|
|
33
31
|
return setValue(nextValue);
|
|
34
32
|
}, []);
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
33
|
+
return (
|
|
34
|
+
/*#__PURE__*/
|
|
35
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
36
|
+
// <Grommet theme={...}>
|
|
37
|
+
_react["default"].createElement(_grommet.Box, {
|
|
38
|
+
align: "center",
|
|
39
|
+
pad: "large"
|
|
40
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Form, {
|
|
41
|
+
value: value,
|
|
42
|
+
onChange: onChange,
|
|
43
|
+
onSubmit: function onSubmit() {
|
|
44
|
+
return console.log('Submit', value);
|
|
45
|
+
}
|
|
46
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.FormField, {
|
|
47
|
+
label: "Label",
|
|
48
|
+
name: "select"
|
|
49
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
50
|
+
name: "select",
|
|
51
|
+
placeholder: "placeholder",
|
|
52
|
+
options: options,
|
|
53
|
+
labelKey: "label",
|
|
54
|
+
valueKey: "value"
|
|
55
|
+
})), /*#__PURE__*/_react["default"].createElement(_grommet.Button, {
|
|
56
|
+
type: "submit",
|
|
57
|
+
label: "Update",
|
|
58
|
+
primary: true
|
|
59
|
+
}))) // </Grommet>
|
|
60
|
+
|
|
61
|
+
);
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
exports.InsideFormField = InsideFormField;
|
|
@@ -7,8 +7,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
11
|
|
|
14
12
|
var dummyOptions = Array(2000).fill().map(function (_, i) {
|
|
@@ -75,29 +73,33 @@ var LazyLoadingOptions = function LazyLoadingOptions() {
|
|
|
75
73
|
return setSelected(nextSelected);
|
|
76
74
|
};
|
|
77
75
|
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
76
|
+
return (
|
|
77
|
+
/*#__PURE__*/
|
|
78
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
79
|
+
// <Grommet theme={...}>
|
|
80
|
+
_react["default"].createElement(_grommet.Box, {
|
|
81
|
+
fill: true,
|
|
82
|
+
align: "center",
|
|
83
|
+
justify: "start",
|
|
84
|
+
pad: "large"
|
|
85
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
86
|
+
multiple: true,
|
|
87
|
+
closeOnChange: false,
|
|
88
|
+
placeholder: "select an option...",
|
|
89
|
+
selected: selected,
|
|
90
|
+
options: options,
|
|
91
|
+
dropHeight: "medium",
|
|
92
|
+
onMore: onMore,
|
|
93
|
+
onClose: onClose,
|
|
94
|
+
onChange: onChange
|
|
95
|
+
}, function (option, index) {
|
|
96
|
+
return /*#__PURE__*/_react["default"].createElement(Option, {
|
|
97
|
+
value: option,
|
|
98
|
+
selected: selected.indexOf(index) !== -1
|
|
99
|
+
});
|
|
100
|
+
})) // </Grommet>
|
|
101
|
+
|
|
102
|
+
);
|
|
101
103
|
};
|
|
102
104
|
|
|
103
105
|
exports.LazyLoadingOptions = LazyLoadingOptions;
|
|
@@ -7,8 +7,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
11
|
|
|
14
12
|
var Option = /*#__PURE__*/_react["default"].memo(function (_ref) {
|
|
@@ -44,50 +42,53 @@ var ManyOptions = function ManyOptions() {
|
|
|
44
42
|
options = _React$useState2[0],
|
|
45
43
|
setOptions = _React$useState2[1];
|
|
46
44
|
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
45
|
+
return (
|
|
46
|
+
/*#__PURE__*/
|
|
47
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
48
|
+
// <Grommet theme={...}>
|
|
49
|
+
_react["default"].createElement(_grommet.Box, {
|
|
50
|
+
fill: true,
|
|
51
|
+
align: "center",
|
|
52
|
+
justify: "start",
|
|
53
|
+
pad: "large"
|
|
54
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
55
|
+
multiple: true,
|
|
56
|
+
closeOnChange: false,
|
|
57
|
+
placeholder: "select an option...",
|
|
58
|
+
selected: selected,
|
|
59
|
+
options: options,
|
|
60
|
+
dropHeight: "medium",
|
|
61
|
+
onClose: function onClose() {
|
|
62
|
+
return setOptions(options.sort(function (p1, p2) {
|
|
63
|
+
var p1Exists = selected.includes(p1);
|
|
64
|
+
var p2Exists = selected.includes(p2);
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
if (!p1Exists && p2Exists) {
|
|
67
|
+
return 1;
|
|
68
|
+
}
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
if (p1Exists && !p2Exists) {
|
|
71
|
+
return -1;
|
|
72
|
+
}
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
74
|
+
return p1.localeCompare(p2, undefined, {
|
|
75
|
+
numeric: true,
|
|
76
|
+
sensitivity: 'base'
|
|
77
|
+
});
|
|
78
|
+
}));
|
|
79
|
+
},
|
|
80
|
+
onChange: function onChange(_ref2) {
|
|
81
|
+
var nextSelected = _ref2.selected;
|
|
82
|
+
setSelected(nextSelected);
|
|
83
|
+
}
|
|
84
|
+
}, function (option, index) {
|
|
85
|
+
return /*#__PURE__*/_react["default"].createElement(Option, {
|
|
86
|
+
value: option,
|
|
87
|
+
selected: selected.indexOf(index) !== -1
|
|
88
|
+
});
|
|
89
|
+
})) // </Grommet>
|
|
90
|
+
|
|
91
|
+
);
|
|
91
92
|
};
|
|
92
93
|
|
|
93
94
|
exports.ManyOptions = ManyOptions;
|
|
@@ -97,6 +98,9 @@ ManyOptions.parameters = {
|
|
|
97
98
|
disable: true
|
|
98
99
|
}
|
|
99
100
|
};
|
|
101
|
+
ManyOptions.args = {
|
|
102
|
+
full: true
|
|
103
|
+
};
|
|
100
104
|
var _default = {
|
|
101
105
|
title: 'Input/Select/Many options'
|
|
102
106
|
};
|
|
@@ -7,8 +7,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _grommet = require("grommet");
|
|
9
9
|
|
|
10
|
-
var _themes = require("grommet/themes");
|
|
11
|
-
|
|
12
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
11
|
|
|
14
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -20,25 +18,28 @@ var Multiple = function Multiple() {
|
|
|
20
18
|
value = _useState[0],
|
|
21
19
|
setValue = _useState[1];
|
|
22
20
|
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
return (
|
|
22
|
+
/*#__PURE__*/
|
|
23
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
24
|
+
// <Grommet theme={...}>
|
|
25
|
+
_react["default"].createElement(_grommet.Box, {
|
|
26
|
+
fill: true,
|
|
27
|
+
align: "center",
|
|
28
|
+
justify: "start",
|
|
29
|
+
pad: "large"
|
|
30
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
31
|
+
placeholder: "Select",
|
|
32
|
+
multiple: true,
|
|
33
|
+
closeOnChange: false,
|
|
34
|
+
value: value,
|
|
35
|
+
options: options,
|
|
36
|
+
onChange: function onChange(_ref) {
|
|
37
|
+
var nextValue = _ref.value;
|
|
38
|
+
return setValue(nextValue);
|
|
39
|
+
}
|
|
40
|
+
})) // </Grommet>
|
|
41
|
+
|
|
42
|
+
);
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
exports.Multiple = Multiple;
|
|
@@ -47,6 +48,9 @@ Multiple.parameters = {
|
|
|
47
48
|
disable: true
|
|
48
49
|
}
|
|
49
50
|
};
|
|
51
|
+
Multiple.args = {
|
|
52
|
+
full: true
|
|
53
|
+
};
|
|
50
54
|
var _default = {
|
|
51
55
|
title: 'Input/Select/Multiple'
|
|
52
56
|
};
|