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
|
@@ -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,29 +30,33 @@ var ObjectOptions = function ObjectOptions() {
|
|
|
32
30
|
value = _useState[0],
|
|
33
31
|
setValue = _useState[1];
|
|
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
|
-
|
|
33
|
+
return (
|
|
34
|
+
/*#__PURE__*/
|
|
35
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
36
|
+
// <Grommet theme={...}>
|
|
37
|
+
_react["default"].createElement(_grommet.Box, {
|
|
38
|
+
fill: true,
|
|
39
|
+
align: "center",
|
|
40
|
+
justify: "start",
|
|
41
|
+
pad: "large"
|
|
42
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
43
|
+
id: "select",
|
|
44
|
+
name: "select",
|
|
45
|
+
placeholder: "Select",
|
|
46
|
+
labelKey: "label",
|
|
47
|
+
valueKey: {
|
|
48
|
+
key: 'value',
|
|
49
|
+
reduce: true
|
|
50
|
+
},
|
|
51
|
+
value: value,
|
|
52
|
+
options: objectOptions,
|
|
53
|
+
onChange: function onChange(_ref) {
|
|
54
|
+
var nextValue = _ref.value;
|
|
55
|
+
return setValue(nextValue);
|
|
56
|
+
}
|
|
57
|
+
})) // </Grommet>
|
|
58
|
+
|
|
59
|
+
);
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
exports.ObjectOptions = ObjectOptions;
|
|
@@ -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,64 +30,67 @@ var Search = function Search() {
|
|
|
32
30
|
valueMultiple = _useState3[0],
|
|
33
31
|
setValueMultiple = _useState3[1];
|
|
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
|
+
pad: "large",
|
|
39
|
+
gap: "medium",
|
|
40
|
+
direction: "row"
|
|
41
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
42
|
+
size: "medium",
|
|
43
|
+
placeholder: "Select single option",
|
|
44
|
+
value: value,
|
|
45
|
+
options: options,
|
|
46
|
+
onChange: function onChange(_ref) {
|
|
47
|
+
var option = _ref.option;
|
|
48
|
+
return setValue(option);
|
|
49
|
+
},
|
|
50
|
+
onClose: function onClose() {
|
|
51
|
+
return setOptions(defaultOptions);
|
|
52
|
+
},
|
|
53
|
+
onSearch: function onSearch(text) {
|
|
54
|
+
// The line below escapes regular expression special characters:
|
|
55
|
+
// [ \ ^ $ . | ? * + ( )
|
|
56
|
+
var escapedText = text.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); // Create the regular expression with modified value which
|
|
57
|
+
// handles escaping special characters. Without escaping special
|
|
58
|
+
// characters, errors will appear in the console
|
|
59
|
+
|
|
60
|
+
var exp = new RegExp(escapedText, 'i');
|
|
61
|
+
setOptions(defaultOptions.filter(function (o) {
|
|
62
|
+
return exp.test(o);
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
}), /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
66
|
+
multiple: true,
|
|
67
|
+
size: "medium",
|
|
68
|
+
placeholder: "Select multiple options",
|
|
69
|
+
value: valueMultiple,
|
|
70
|
+
options: options,
|
|
71
|
+
onChange: function onChange(_ref2) {
|
|
72
|
+
var nextValue = _ref2.value;
|
|
73
|
+
return setValueMultiple(nextValue);
|
|
74
|
+
},
|
|
75
|
+
closeOnChange: false,
|
|
76
|
+
onClose: function onClose() {
|
|
77
|
+
return setOptions(defaultOptions);
|
|
78
|
+
},
|
|
79
|
+
onSearch: function onSearch(text) {
|
|
80
|
+
// The line below escapes regular expression special characters:
|
|
81
|
+
// [ \ ^ $ . | ? * + ( )
|
|
82
|
+
var escapedText = text.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); // Create the regular expression with modified value which
|
|
83
|
+
// handles escaping special characters. Without escaping special
|
|
84
|
+
// characters, errors will appear in the console
|
|
60
85
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
multiple: true,
|
|
68
|
-
size: "medium",
|
|
69
|
-
placeholder: "Select multiple options",
|
|
70
|
-
value: valueMultiple,
|
|
71
|
-
options: options,
|
|
72
|
-
onChange: function onChange(_ref2) {
|
|
73
|
-
var nextValue = _ref2.value;
|
|
74
|
-
return setValueMultiple(nextValue);
|
|
75
|
-
},
|
|
76
|
-
closeOnChange: false,
|
|
77
|
-
onClose: function onClose() {
|
|
78
|
-
return setOptions(defaultOptions);
|
|
79
|
-
},
|
|
80
|
-
onSearch: function onSearch(text) {
|
|
81
|
-
// The line below escapes regular expression special characters:
|
|
82
|
-
// [ \ ^ $ . | ? * + ( )
|
|
83
|
-
var escapedText = text.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); // Create the regular expression with modified value which
|
|
84
|
-
// handles escaping special characters. Without escaping special
|
|
85
|
-
// characters, errors will appear in the console
|
|
86
|
+
var exp = new RegExp(escapedText, 'i');
|
|
87
|
+
setOptions(defaultOptions.filter(function (o) {
|
|
88
|
+
return exp.test(o);
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
})) // </Grommet>
|
|
86
92
|
|
|
87
|
-
|
|
88
|
-
setOptions(defaultOptions.filter(function (o) {
|
|
89
|
-
return exp.test(o);
|
|
90
|
-
}));
|
|
91
|
-
}
|
|
92
|
-
})));
|
|
93
|
+
);
|
|
93
94
|
};
|
|
94
95
|
|
|
95
96
|
exports.Search = Search;
|
|
@@ -98,6 +99,9 @@ Search.parameters = {
|
|
|
98
99
|
disable: true
|
|
99
100
|
}
|
|
100
101
|
};
|
|
102
|
+
Search.args = {
|
|
103
|
+
full: true
|
|
104
|
+
};
|
|
101
105
|
var _default = {
|
|
102
106
|
title: 'Input/Select/Search'
|
|
103
107
|
};
|
|
@@ -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,29 +18,35 @@ var Simple = function Simple() {
|
|
|
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
|
-
|
|
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.Select, {
|
|
32
|
+
id: "select",
|
|
33
|
+
name: "select",
|
|
34
|
+
placeholder: "Select",
|
|
35
|
+
value: value,
|
|
36
|
+
options: options,
|
|
37
|
+
onChange: function onChange(_ref) {
|
|
38
|
+
var option = _ref.option;
|
|
39
|
+
return setValue(option);
|
|
40
|
+
}
|
|
41
|
+
})) // </Grommet>
|
|
42
|
+
|
|
43
|
+
);
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
exports.Simple = Simple;
|
|
47
|
+
Simple.args = {
|
|
48
|
+
full: true
|
|
49
|
+
};
|
|
46
50
|
var _default = {
|
|
47
51
|
title: 'Input/Select/Simple'
|
|
48
52
|
};
|
|
@@ -7,29 +7,30 @@ 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 Uncontrolled = function Uncontrolled() {
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
return (
|
|
14
|
+
/*#__PURE__*/
|
|
15
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
16
|
+
// <Grommet theme={...}>
|
|
17
|
+
_react["default"].createElement(_grommet.Box, {
|
|
18
|
+
fill: true,
|
|
19
|
+
align: "center",
|
|
20
|
+
justify: "start",
|
|
21
|
+
pad: "large"
|
|
22
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
23
|
+
id: "select",
|
|
24
|
+
name: "select",
|
|
25
|
+
placeholder: "Select",
|
|
26
|
+
options: ['one', 'two'],
|
|
27
|
+
onChange: function onChange(_ref) {
|
|
28
|
+
var option = _ref.option;
|
|
29
|
+
return console.log(option);
|
|
30
|
+
}
|
|
31
|
+
})) // </Grommet>
|
|
32
|
+
|
|
33
|
+
);
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
exports.Uncontrolled = Uncontrolled;
|
|
@@ -38,6 +39,9 @@ Uncontrolled.parameters = {
|
|
|
38
39
|
disable: true
|
|
39
40
|
}
|
|
40
41
|
};
|
|
42
|
+
Uncontrolled.args = {
|
|
43
|
+
full: true
|
|
44
|
+
};
|
|
41
45
|
var _default = {
|
|
42
46
|
title: 'Input/Select/Uncontrolled'
|
|
43
47
|
};
|
|
@@ -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; }
|
|
@@ -22,44 +20,50 @@ var ValueLabel = function ValueLabel() {
|
|
|
22
20
|
value = _useState[0],
|
|
23
21
|
setValue = _useState[1];
|
|
24
22
|
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
justify: "start",
|
|
32
|
-
pad: "large"
|
|
33
|
-
}, /*#__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
|
-
plain: true,
|
|
44
|
-
valueLabel: /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
45
|
-
width: "small",
|
|
46
|
-
overflow: "hidden",
|
|
23
|
+
return (
|
|
24
|
+
/*#__PURE__*/
|
|
25
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
26
|
+
// <Grommet theme={...}>
|
|
27
|
+
_react["default"].createElement(_grommet.Box, {
|
|
28
|
+
fill: true,
|
|
47
29
|
align: "center",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
30
|
+
justify: "start",
|
|
31
|
+
pad: "large"
|
|
32
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Select, {
|
|
33
|
+
id: "select",
|
|
34
|
+
name: "select",
|
|
35
|
+
placeholder: "Select",
|
|
36
|
+
value: value,
|
|
37
|
+
options: options,
|
|
38
|
+
onChange: function onChange(_ref) {
|
|
39
|
+
var option = _ref.option;
|
|
40
|
+
return setValue(option);
|
|
41
|
+
},
|
|
42
|
+
plain: true,
|
|
43
|
+
valueLabel: /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
44
|
+
width: "small",
|
|
45
|
+
overflow: "hidden",
|
|
46
|
+
align: "center",
|
|
47
|
+
border: {
|
|
48
|
+
color: 'dark-3',
|
|
49
|
+
size: 'xsmall',
|
|
50
|
+
style: 'solid',
|
|
51
|
+
side: 'bottom'
|
|
52
|
+
}
|
|
53
|
+
}, value || 'Select...'),
|
|
54
|
+
icon: /*#__PURE__*/_react["default"].createElement(_grommet.Box, null, /*#__PURE__*/_react["default"].createElement(_grommetIcons.CaretDown, {
|
|
55
|
+
size: "small",
|
|
56
|
+
color: "black"
|
|
57
|
+
}))
|
|
58
|
+
})) // </Grommet>
|
|
59
|
+
|
|
60
|
+
);
|
|
60
61
|
};
|
|
61
62
|
|
|
62
63
|
exports.ValueLabel = ValueLabel;
|
|
64
|
+
ValueLabel.args = {
|
|
65
|
+
full: true
|
|
66
|
+
};
|
|
63
67
|
var _default = {
|
|
64
68
|
title: 'Input/Select/Value Label'
|
|
65
69
|
};
|
|
@@ -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
|
|
|
5
4
|
// the prefix name of the Create option entry
|
|
6
5
|
const prefix = 'Create';
|
|
@@ -20,7 +19,7 @@ const updateCreateOption = (text: string) => {
|
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
// improving Search support of special characters
|
|
23
|
-
const getRegExp = text => {
|
|
22
|
+
const getRegExp = (text) => {
|
|
24
23
|
// The line below escapes regular expression special characters:
|
|
25
24
|
// [ \ ^ $ . | ? * + ( )
|
|
26
25
|
const escapedText = text.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
@@ -37,38 +36,43 @@ export const CreateOption = () => {
|
|
|
37
36
|
const [searchValue, setSearchValue] = useState('');
|
|
38
37
|
|
|
39
38
|
return (
|
|
40
|
-
<Grommet
|
|
41
|
-
|
|
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
|
-
</
|
|
39
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
40
|
+
// <Grommet theme={...}>
|
|
41
|
+
<Box fill align="center" justify="start" pad="large">
|
|
42
|
+
<Select
|
|
43
|
+
open
|
|
44
|
+
size="medium"
|
|
45
|
+
placeholder="Select"
|
|
46
|
+
value={value}
|
|
47
|
+
options={options}
|
|
48
|
+
onChange={({ option }) => {
|
|
49
|
+
if (option.includes(prefix)) {
|
|
50
|
+
defaultOptions.pop(); // remove Create option
|
|
51
|
+
defaultOptions.push(searchValue);
|
|
52
|
+
setValue(searchValue);
|
|
53
|
+
} else {
|
|
54
|
+
setValue(option);
|
|
55
|
+
}
|
|
56
|
+
}}
|
|
57
|
+
onClose={() => setOptions(defaultOptions)}
|
|
58
|
+
onSearch={(text: string) => {
|
|
59
|
+
updateCreateOption(text);
|
|
60
|
+
const exp = getRegExp(text);
|
|
61
|
+
setOptions(defaultOptions.filter((o) => exp.test(o)));
|
|
62
|
+
setSearchValue(text);
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
65
|
+
</Box>
|
|
66
|
+
// </Grommet>
|
|
67
67
|
);
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
CreateOption.storyName = 'Create option';
|
|
71
71
|
|
|
72
|
+
CreateOption.args = {
|
|
73
|
+
full: true,
|
|
74
|
+
};
|
|
75
|
+
|
|
72
76
|
export default {
|
|
73
77
|
title: 'Input/Select/Create option',
|
|
74
78
|
};
|
|
@@ -95,28 +95,34 @@ var MainNavigation = function MainNavigation() {
|
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
var Labels = function Labels() {
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
98
|
+
return (
|
|
99
|
+
/*#__PURE__*/
|
|
100
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
101
|
+
// <Grommet theme={...}>
|
|
102
|
+
_react["default"].createElement(_grommet.Box, {
|
|
103
|
+
direction: "row",
|
|
104
|
+
height: {
|
|
105
|
+
min: '100%'
|
|
106
|
+
}
|
|
107
|
+
}, /*#__PURE__*/_react["default"].createElement(_Sidebar.Sidebar, {
|
|
108
|
+
responsive: false,
|
|
109
|
+
background: "neutral-2",
|
|
110
|
+
header: /*#__PURE__*/_react["default"].createElement(SidebarHeader, null),
|
|
111
|
+
footer: /*#__PURE__*/_react["default"].createElement(SidebarFooter, null),
|
|
112
|
+
pad: {
|
|
113
|
+
left: 'medium',
|
|
114
|
+
right: 'large',
|
|
115
|
+
vertical: 'medium'
|
|
116
|
+
}
|
|
117
|
+
}, /*#__PURE__*/_react["default"].createElement(MainNavigation, null))) // </Grommet>
|
|
118
|
+
|
|
119
|
+
);
|
|
117
120
|
};
|
|
118
121
|
|
|
119
122
|
exports.Labels = Labels;
|
|
123
|
+
Labels.args = {
|
|
124
|
+
full: true
|
|
125
|
+
};
|
|
120
126
|
var _default = {
|
|
121
127
|
title: 'Layout/Sidebar/Labels'
|
|
122
128
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Avatar, Button, Box,
|
|
3
|
+
import { Avatar, Button, Box, Nav, Sidebar } from 'grommet';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
Analytics,
|
|
@@ -43,21 +43,26 @@ const MainNavigation = () => (
|
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
export const SidebarIcons = () => (
|
|
46
|
-
<Grommet
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</
|
|
56
|
-
</
|
|
46
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
47
|
+
// <Grommet theme={...}>
|
|
48
|
+
<Box direction="row" height={{ min: '100%' }}>
|
|
49
|
+
<Sidebar
|
|
50
|
+
background="accent-1"
|
|
51
|
+
header={<SidebarHeader />}
|
|
52
|
+
footer={<SidebarFooter />}
|
|
53
|
+
>
|
|
54
|
+
<MainNavigation />
|
|
55
|
+
</Sidebar>
|
|
56
|
+
</Box>
|
|
57
|
+
// </Grommet>
|
|
57
58
|
);
|
|
58
59
|
|
|
59
60
|
SidebarIcons.storyName = 'Icons';
|
|
60
61
|
|
|
62
|
+
SidebarIcons.args = {
|
|
63
|
+
full: true,
|
|
64
|
+
};
|
|
65
|
+
|
|
61
66
|
export default {
|
|
62
67
|
title: 'Layout/Sidebar/Icons',
|
|
63
68
|
};
|