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