grommet 2.25.3 → 2.27.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/all/stories/AllComponents.js +19 -126
- package/components/Accordion/stories/CustomHeader.js +3 -1
- package/components/Avatar/Avatar.js +22 -9
- package/components/Box/stories/BackgroundThemed.js +54 -0
- package/components/Box/stories/CustomThemed/ThemedBackground.tsx +176 -0
- package/components/Calendar/Calendar.js +2 -1
- package/components/CheckBox/StyledCheckBox.js +9 -5
- package/components/CheckBoxGroup/CheckBoxGroup.js +3 -2
- package/components/CheckBoxGroup/index.d.ts +2 -1
- package/components/CheckBoxGroup/propTypes.js +1 -0
- package/components/DataChart/Detail.js +3 -1
- package/components/DataTable/index.d.ts +6 -6
- package/components/DateInput/DateInput.js +1 -1
- package/components/Diagram/Diagram.js +2 -1
- package/components/Drop/stories/Inline.js +1 -1
- package/components/Drop/stories/Overflow.js +1 -1
- package/components/Drop/stories/Plain.js +1 -1
- package/components/Drop/stories/Simple.js +1 -1
- package/components/Drop/stories/Styled.js +1 -1
- package/components/FormField/FormField.js +1 -1
- package/components/Heading/Heading.js +31 -2
- package/components/Heading/StyledHeading.js +1 -1
- package/components/Heading/index.d.ts +1 -0
- package/components/Heading/propTypes.js +1 -0
- package/components/Heading/stories/All.js +4 -1
- package/components/List/List.js +125 -41
- package/components/List/index.d.ts +1 -0
- package/components/List/propTypes.js +1 -0
- package/components/List/stories/Order.js +1 -0
- package/components/List/stories/Pinned.js +37 -0
- package/components/List/stories/Selection.js +1 -0
- package/components/List/stories/onClickItem.js +1 -0
- package/components/Notification/Notification.js +2 -2
- package/components/Notification/index.d.ts +1 -1
- package/components/Notification/propTypes.js +1 -1
- package/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -2
- package/components/RadioButton/README.md +1 -279
- package/components/RadioButton/RadioButton.js +1 -0
- package/components/Select/DefaultSelectTextInput.js +43 -0
- package/components/Select/EmptySearchOption.js +34 -0
- package/components/Select/Select.js +38 -99
- package/components/Select/SelectContainer.js +20 -60
- package/components/Select/StyledSelect.js +58 -2
- package/components/Select/index.d.ts +11 -9
- package/components/Select/propTypes.js +44 -40
- package/components/Select/utils.js +129 -3
- package/components/SelectMultiple/README.md +2 -0
- package/components/SelectMultiple/SelectMultiple.js +476 -0
- package/components/SelectMultiple/SelectMultipleContainer.js +483 -0
- package/components/SelectMultiple/SelectMultipleValue.js +163 -0
- package/components/SelectMultiple/SelectionSummary.js +104 -0
- package/components/SelectMultiple/index.d.ts +21 -0
- package/components/SelectMultiple/index.js +8 -0
- package/components/SelectMultiple/propTypes.js +28 -0
- package/components/SelectMultiple/stories/Default.js +76 -0
- package/components/SelectMultiple/stories/Disabled.js +84 -0
- package/components/SelectMultiple/stories/FormField.js +66 -0
- package/components/SelectMultiple/stories/Limited.js +68 -0
- package/components/SelectMultiple/stories/LongList.js +76 -0
- package/components/SelectMultiple/stories/ObjectOptions.js +104 -0
- package/components/SelectMultiple/stories/ShowSelectedInline.js +76 -0
- package/components/SelectMultiple/stories/typescript/Children.tsx +106 -0
- package/components/Sidebar/stories/Labels.js +4 -1
- package/components/TextArea/stories/NonResizable.js +1 -0
- package/components/TextArea/stories/Simple.js +1 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +8 -0
- package/es6/all/stories/AllComponents.js +21 -121
- package/es6/components/Accordion/stories/CustomHeader.js +3 -1
- package/es6/components/Avatar/Avatar.js +21 -9
- package/es6/components/Box/stories/BackgroundThemed.js +39 -0
- package/es6/components/Box/stories/CustomThemed/ThemedBackground.tsx +176 -0
- package/es6/components/Calendar/Calendar.js +2 -1
- package/es6/components/CheckBox/StyledCheckBox.js +9 -5
- package/es6/components/CheckBoxGroup/CheckBoxGroup.js +3 -2
- package/es6/components/CheckBoxGroup/index.d.ts +2 -1
- package/es6/components/CheckBoxGroup/propTypes.js +1 -0
- package/es6/components/DataChart/Detail.js +3 -1
- package/es6/components/DataTable/index.d.ts +6 -6
- package/es6/components/DateInput/DateInput.js +1 -1
- package/es6/components/Diagram/Diagram.js +2 -1
- package/es6/components/Drop/stories/Inline.js +1 -1
- package/es6/components/Drop/stories/Overflow.js +1 -1
- package/es6/components/Drop/stories/Plain.js +1 -1
- package/es6/components/Drop/stories/Simple.js +1 -1
- package/es6/components/Drop/stories/Styled.js +1 -1
- package/es6/components/FormField/FormField.js +1 -1
- package/es6/components/Heading/Heading.js +30 -3
- package/es6/components/Heading/StyledHeading.js +1 -1
- package/es6/components/Heading/index.d.ts +1 -0
- package/es6/components/Heading/propTypes.js +1 -0
- package/es6/components/Heading/stories/All.js +4 -1
- package/es6/components/List/List.js +126 -42
- package/es6/components/List/index.d.ts +1 -0
- package/es6/components/List/propTypes.js +1 -0
- package/es6/components/List/stories/Order.js +1 -0
- package/es6/components/List/stories/Pinned.js +22 -0
- package/es6/components/List/stories/Selection.js +1 -0
- package/es6/components/List/stories/onClickItem.js +1 -0
- package/es6/components/Notification/Notification.js +2 -2
- package/es6/components/Notification/index.d.ts +1 -1
- package/es6/components/Notification/propTypes.js +1 -1
- package/es6/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -2
- package/es6/components/RadioButton/README.md +1 -279
- package/es6/components/RadioButton/RadioButton.js +1 -0
- package/es6/components/Select/DefaultSelectTextInput.js +31 -0
- package/es6/components/Select/EmptySearchOption.js +21 -0
- package/es6/components/Select/Select.js +34 -93
- package/es6/components/Select/SelectContainer.js +20 -59
- package/es6/components/Select/StyledSelect.js +45 -1
- package/es6/components/Select/index.d.ts +11 -9
- package/es6/components/Select/propTypes.js +41 -39
- package/es6/components/Select/utils.js +95 -1
- package/es6/components/SelectMultiple/README.md +2 -0
- package/es6/components/SelectMultiple/SelectMultiple.js +447 -0
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +455 -0
- package/es6/components/SelectMultiple/SelectMultipleValue.js +149 -0
- package/es6/components/SelectMultiple/SelectionSummary.js +91 -0
- package/es6/components/SelectMultiple/index.d.ts +21 -0
- package/es6/components/SelectMultiple/index.js +1 -0
- package/es6/components/SelectMultiple/propTypes.js +18 -0
- package/es6/components/SelectMultiple/stories/Default.js +60 -0
- package/es6/components/SelectMultiple/stories/Disabled.js +68 -0
- package/es6/components/SelectMultiple/stories/FormField.js +50 -0
- package/es6/components/SelectMultiple/stories/Limited.js +53 -0
- package/es6/components/SelectMultiple/stories/LongList.js +63 -0
- package/es6/components/SelectMultiple/stories/ObjectOptions.js +88 -0
- package/es6/components/SelectMultiple/stories/ShowSelectedInline.js +61 -0
- package/es6/components/SelectMultiple/stories/typescript/Children.tsx +106 -0
- package/es6/components/Sidebar/stories/Labels.js +4 -1
- package/es6/components/TextArea/stories/NonResizable.js +1 -0
- package/es6/components/TextArea/stories/Simple.js +1 -0
- package/es6/components/index.d.ts +1 -0
- package/es6/components/index.js +1 -0
- package/es6/index.d.ts +1 -0
- package/es6/themes/base.d.ts +16 -5
- package/es6/themes/base.js +60 -39
- package/es6/themes/grommet.js +15 -0
- package/es6/themes/hacktoberfest2022.js +129 -0
- package/es6/themes/index.js +2 -1
- package/es6/utils/background.js +65 -12
- package/es6/utils/general-prop-types.js +2 -0
- package/es6/utils/index.d.ts +2 -0
- package/es6/utils/styles.js +3 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +44 -41
- package/themes/base.d.ts +16 -5
- package/themes/base.js +61 -39
- package/themes/grommet.js +15 -0
- package/themes/hacktoberfest2022.js +137 -0
- package/themes/index.js +6 -2
- package/tools/grommet-babel-preset-es2015.js +1 -12
- package/tools/pack.js +1 -94
- package/tools/release-stable.js +1 -27
- package/utils/background.js +64 -12
- package/utils/general-prop-types.js +2 -0
- package/utils/index.d.ts +2 -0
- package/utils/styles.js +3 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.ShowSelectedInline = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
|
|
8
|
+
var _grommet = require("grommet");
|
|
9
|
+
|
|
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); }
|
|
11
|
+
|
|
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; }
|
|
13
|
+
|
|
14
|
+
var defaultOptions = ['Apple', 'Orange', 'Banana', 'Grape', 'Melon', 'Strawberry', 'Kiwi', 'Mango', 'Raspberry', 'Rhubarb'];
|
|
15
|
+
|
|
16
|
+
var ShowSelectedInline = function ShowSelectedInline() {
|
|
17
|
+
var _useState = (0, _react.useState)(defaultOptions),
|
|
18
|
+
options = _useState[0],
|
|
19
|
+
setOptions = _useState[1];
|
|
20
|
+
|
|
21
|
+
var _useState2 = (0, _react.useState)([]),
|
|
22
|
+
valueMultiple = _useState2[0],
|
|
23
|
+
setValueMultiple = _useState2[1];
|
|
24
|
+
|
|
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
|
+
pad: "large",
|
|
33
|
+
gap: "large"
|
|
34
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "SelectMultiple showSelectedInline"), /*#__PURE__*/_react["default"].createElement(_grommet.SelectMultiple, {
|
|
35
|
+
showSelectedInline: true,
|
|
36
|
+
placeholder: "Select",
|
|
37
|
+
options: options,
|
|
38
|
+
onSearch: function onSearch(text) {
|
|
39
|
+
// The line below escapes regular expression special characters:
|
|
40
|
+
// [ \ ^ $ . | ? * + ( )
|
|
41
|
+
var escapedText = text.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); // Create the regular expression with modified value which
|
|
42
|
+
// handles escaping special characters. Without escaping special
|
|
43
|
+
// characters, errors will appear in the console
|
|
44
|
+
|
|
45
|
+
var exp = new RegExp(escapedText, 'i');
|
|
46
|
+
setOptions(defaultOptions.filter(function (o) {
|
|
47
|
+
return exp.test(o);
|
|
48
|
+
}));
|
|
49
|
+
},
|
|
50
|
+
onClose: function onClose() {
|
|
51
|
+
return setOptions(defaultOptions);
|
|
52
|
+
},
|
|
53
|
+
value: valueMultiple,
|
|
54
|
+
onChange: function onChange(_ref) {
|
|
55
|
+
var value = _ref.value;
|
|
56
|
+
setValueMultiple(value);
|
|
57
|
+
}
|
|
58
|
+
})) // </Grommet>
|
|
59
|
+
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.ShowSelectedInline = ShowSelectedInline;
|
|
64
|
+
ShowSelectedInline.storyName = 'showSelectedInline';
|
|
65
|
+
ShowSelectedInline.parameters = {
|
|
66
|
+
chromatic: {
|
|
67
|
+
disable: true
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
ShowSelectedInline.args = {
|
|
71
|
+
full: true
|
|
72
|
+
};
|
|
73
|
+
var _default = {
|
|
74
|
+
title: 'Input/SelectMultiple/showSelectedInline'
|
|
75
|
+
};
|
|
76
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { FormClose } from 'grommet-icons';
|
|
4
|
+
import { Box, Button, Text } from 'grommet';
|
|
5
|
+
import { SelectMultiple } from '../../SelectMultiple.js';
|
|
6
|
+
|
|
7
|
+
const allSeasons = [
|
|
8
|
+
'S01',
|
|
9
|
+
'S02',
|
|
10
|
+
'S03',
|
|
11
|
+
'S04',
|
|
12
|
+
'S05',
|
|
13
|
+
'S06',
|
|
14
|
+
'S07',
|
|
15
|
+
'S08',
|
|
16
|
+
'S09',
|
|
17
|
+
'S10',
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export const Children = () => {
|
|
21
|
+
const [selected, setSelected] = useState([]);
|
|
22
|
+
|
|
23
|
+
const onRemoveSeason = (season) => {
|
|
24
|
+
setSelected(selected.filter((selectedSeason) => selectedSeason !== season));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const renderSeason = (season) => (
|
|
28
|
+
<Button
|
|
29
|
+
key={`season_tag_${season}`}
|
|
30
|
+
onClick={(event) => {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
event.stopPropagation();
|
|
33
|
+
onRemoveSeason(season);
|
|
34
|
+
}}
|
|
35
|
+
onFocus={(event) => event.stopPropagation()}
|
|
36
|
+
a11yTitle={season}
|
|
37
|
+
>
|
|
38
|
+
<Box
|
|
39
|
+
align="center"
|
|
40
|
+
direction="row"
|
|
41
|
+
gap="xsmall"
|
|
42
|
+
pad={{ vertical: 'xsmall', horizontal: 'small' }}
|
|
43
|
+
margin="xsmall"
|
|
44
|
+
background="light-3"
|
|
45
|
+
round="large"
|
|
46
|
+
>
|
|
47
|
+
<Text size="small">{season}</Text>
|
|
48
|
+
<Box round="full" margin={{ left: 'xsmall' }}>
|
|
49
|
+
<FormClose size="small" style={{ width: '12px', height: '12px' }} />
|
|
50
|
+
</Box>
|
|
51
|
+
</Box>
|
|
52
|
+
</Button>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const renderOption = (option, state) => (
|
|
56
|
+
<Box pad="small" background={state.active ? 'active' : undefined}>
|
|
57
|
+
{option}
|
|
58
|
+
</Box>
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
63
|
+
// <Grommet theme={...}>
|
|
64
|
+
<Box fill align="center" pad="large" gap="large">
|
|
65
|
+
<Text>SelectMultiple with custom children</Text>
|
|
66
|
+
<SelectMultiple
|
|
67
|
+
sortSelectedOnClose={false}
|
|
68
|
+
showSelectedInline
|
|
69
|
+
valueLabel={(option) => (
|
|
70
|
+
<Box wrap direction="row" width="small">
|
|
71
|
+
{option && option.length ? (
|
|
72
|
+
<>
|
|
73
|
+
{option.map((i) => {
|
|
74
|
+
console.log(option);
|
|
75
|
+
return renderSeason(i);
|
|
76
|
+
})}
|
|
77
|
+
</>
|
|
78
|
+
) : (
|
|
79
|
+
<Text color="text-weak">Select Season</Text>
|
|
80
|
+
)}
|
|
81
|
+
</Box>
|
|
82
|
+
)}
|
|
83
|
+
options={allSeasons}
|
|
84
|
+
value={selected}
|
|
85
|
+
onChange={({ value }) => {
|
|
86
|
+
setSelected([...value]);
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
{renderOption}
|
|
90
|
+
</SelectMultiple>
|
|
91
|
+
</Box>
|
|
92
|
+
// </Grommet>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
Children.parameters = {
|
|
97
|
+
chromatic: { disable: true },
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
Children.args = {
|
|
101
|
+
full: true,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export default {
|
|
105
|
+
title: 'Input/SelectMultiple/Children',
|
|
106
|
+
};
|
|
@@ -60,7 +60,9 @@ var SidebarButton = function SidebarButton(_ref) {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
var SidebarFooter = function SidebarFooter() {
|
|
63
|
-
return /*#__PURE__*/_react["default"].createElement(_grommet.Nav,
|
|
63
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Nav, {
|
|
64
|
+
"aria-label": "sidebar footer"
|
|
65
|
+
}, /*#__PURE__*/_react["default"].createElement(SidebarButton, {
|
|
64
66
|
icon: /*#__PURE__*/_react["default"].createElement(_grommetIcons.Chat, null)
|
|
65
67
|
}), /*#__PURE__*/_react["default"].createElement(SidebarButton, {
|
|
66
68
|
icon: /*#__PURE__*/_react["default"].createElement(_grommetIcons.Help, null)
|
|
@@ -69,6 +71,7 @@ var SidebarFooter = function SidebarFooter() {
|
|
|
69
71
|
|
|
70
72
|
var MainNavigation = function MainNavigation() {
|
|
71
73
|
return /*#__PURE__*/_react["default"].createElement(_grommet.Nav, {
|
|
74
|
+
"aria-label": "main navigation",
|
|
72
75
|
gap: "large",
|
|
73
76
|
responsive: false
|
|
74
77
|
}, /*#__PURE__*/_react["default"].createElement(SidebarButton, {
|
package/components/index.d.ts
CHANGED
package/components/index.js
CHANGED
|
@@ -466,6 +466,14 @@ Object.keys(_Select).forEach(function (key) {
|
|
|
466
466
|
exports[key] = _Select[key];
|
|
467
467
|
});
|
|
468
468
|
|
|
469
|
+
var _SelectMultiple = require("./SelectMultiple");
|
|
470
|
+
|
|
471
|
+
Object.keys(_SelectMultiple).forEach(function (key) {
|
|
472
|
+
if (key === "default" || key === "__esModule") return;
|
|
473
|
+
if (key in exports && exports[key] === _SelectMultiple[key]) return;
|
|
474
|
+
exports[key] = _SelectMultiple[key];
|
|
475
|
+
});
|
|
476
|
+
|
|
469
477
|
var _Sidebar = require("./Sidebar");
|
|
470
478
|
|
|
471
479
|
Object.keys(_Sidebar).forEach(function (key) {
|
|
@@ -5,16 +5,9 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
5
5
|
|
|
6
6
|
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; }
|
|
7
7
|
|
|
8
|
-
import React, {
|
|
9
|
-
import {
|
|
8
|
+
import React, { useState } from 'react';
|
|
9
|
+
import { Accordion, AccordionPanel, Anchor, Box, Button, Calendar, Chart, CheckBox, Clock, DataTable, Diagram, Distribution, FormField, Grid, Heading, MaskedInput, Menu, Meter, Paragraph, RadioButtonGroup, RangeInput, RangeSelector, Select, Stack, Tab, Tabs, Text, TextArea, TextInput, Video } from 'grommet';
|
|
10
10
|
import { FormNext } from "grommet-icons/es6/icons/FormNext";
|
|
11
|
-
import { grommet } from 'grommet/themes';
|
|
12
|
-
import { generate } from 'grommet/themes/base';
|
|
13
|
-
import { deepMerge } from 'grommet/utils';
|
|
14
|
-
import { hpe } from 'grommet-theme-hpe';
|
|
15
|
-
import { aruba } from 'grommet-theme-aruba';
|
|
16
|
-
import { hp } from 'grommet-theme-hp';
|
|
17
|
-
import { dxc } from 'grommet-theme-dxc';
|
|
18
11
|
|
|
19
12
|
var Node = function Node(_ref) {
|
|
20
13
|
var id = _ref.id,
|
|
@@ -45,61 +38,31 @@ var connection = function connection(fromTarget, toTarget, _temp) {
|
|
|
45
38
|
}, rest);
|
|
46
39
|
};
|
|
47
40
|
|
|
48
|
-
var themes = {
|
|
49
|
-
grommet: grommet,
|
|
50
|
-
hpe: hpe,
|
|
51
|
-
aruba: aruba,
|
|
52
|
-
hp: hp,
|
|
53
|
-
dxc: dxc
|
|
54
|
-
};
|
|
55
|
-
|
|
56
41
|
var Components = function Components() {
|
|
57
|
-
var _useState = useState(
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
var _useState = useState(true),
|
|
43
|
+
checkBox = _useState[0],
|
|
44
|
+
setCheckBox = _useState[1];
|
|
60
45
|
|
|
61
|
-
var _useState2 = useState(
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
var _useState2 = useState(''),
|
|
47
|
+
textInput = _useState2[0],
|
|
48
|
+
setTextInput = _useState2[1];
|
|
64
49
|
|
|
65
50
|
var _useState3 = useState(''),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var _useState4 = useState(''),
|
|
70
|
-
maskedInput = _useState4[0],
|
|
71
|
-
setMaskedInput = _useState4[1];
|
|
72
|
-
|
|
73
|
-
var _useState5 = useState('RadioButton 1'),
|
|
74
|
-
radioButton = _useState5[0],
|
|
75
|
-
setRadioButton = _useState5[1];
|
|
51
|
+
maskedInput = _useState3[0],
|
|
52
|
+
setMaskedInput = _useState3[1];
|
|
76
53
|
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
54
|
+
var _useState4 = useState('RadioButton 1'),
|
|
55
|
+
radioButton = _useState4[0],
|
|
56
|
+
setRadioButton = _useState4[1];
|
|
80
57
|
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
58
|
+
var _useState5 = useState([1, 2]),
|
|
59
|
+
rangeSelector = _useState5[0],
|
|
60
|
+
setRangeSelector = _useState5[1];
|
|
84
61
|
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
62
|
+
var _useState6 = useState(0),
|
|
63
|
+
tabIndex = _useState6[0],
|
|
64
|
+
setTabIndex = _useState6[1];
|
|
88
65
|
|
|
89
|
-
var _useState9 = useState(undefined),
|
|
90
|
-
background = _useState9[0],
|
|
91
|
-
setBackground = _useState9[1];
|
|
92
|
-
|
|
93
|
-
var _useState10 = useState(0),
|
|
94
|
-
tabIndex = _useState10[0],
|
|
95
|
-
setTabIndex = _useState10[1];
|
|
96
|
-
|
|
97
|
-
var theme = useMemo(function () {
|
|
98
|
-
return deepMerge(generate(baseSize), themes[themeName]);
|
|
99
|
-
}, [baseSize, themeName]);
|
|
100
|
-
var themeCanMode = useMemo(function () {
|
|
101
|
-
return theme && theme.global.colors.background && theme.global.colors.background.dark;
|
|
102
|
-
}, [theme]);
|
|
103
66
|
var content = [/*#__PURE__*/React.createElement(Box, {
|
|
104
67
|
key: "type",
|
|
105
68
|
align: "start",
|
|
@@ -358,77 +321,14 @@ var Components = function Components() {
|
|
|
358
321
|
src: "http://techslides.com/demos/sample-videos/small.3gp",
|
|
359
322
|
type: "video/3gp"
|
|
360
323
|
})))];
|
|
361
|
-
return /*#__PURE__*/React.createElement(
|
|
362
|
-
style: {
|
|
363
|
-
height: '100vh',
|
|
364
|
-
display: 'flex',
|
|
365
|
-
flexDirection: 'column'
|
|
366
|
-
}
|
|
367
|
-
}, /*#__PURE__*/React.createElement(Grommet, {
|
|
368
|
-
theme: grommet,
|
|
369
|
-
style: {
|
|
370
|
-
flex: '0 0 auto'
|
|
371
|
-
}
|
|
372
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
373
|
-
direction: "row-responsive",
|
|
374
|
-
gap: "medium",
|
|
375
|
-
justify: "end",
|
|
376
|
-
align: "center",
|
|
377
|
-
margin: "small"
|
|
378
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
379
|
-
basis: "small"
|
|
380
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
381
|
-
plain: true,
|
|
382
|
-
size: "small",
|
|
383
|
-
options: Object.keys(themes),
|
|
384
|
-
value: themeName,
|
|
385
|
-
onChange: function onChange(event) {
|
|
386
|
-
return setThemeName(event.option);
|
|
387
|
-
}
|
|
388
|
-
})), themeCanMode && /*#__PURE__*/React.createElement(CheckBox, {
|
|
389
|
-
label: "dark",
|
|
390
|
-
checked: themeMode === 'dark',
|
|
391
|
-
onChange: function onChange() {
|
|
392
|
-
return setThemeMode(themeMode === 'dark' ? 'light' : 'dark');
|
|
393
|
-
}
|
|
394
|
-
}), !themeCanMode && /*#__PURE__*/React.createElement(Box, {
|
|
395
|
-
basis: "small"
|
|
396
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
397
|
-
plain: true,
|
|
398
|
-
placeholder: "background",
|
|
399
|
-
size: "small",
|
|
400
|
-
options: ['default', 'dark-1', 'light-1'],
|
|
401
|
-
value: background,
|
|
402
|
-
onChange: function onChange(event) {
|
|
403
|
-
return setBackground(event.option);
|
|
404
|
-
}
|
|
405
|
-
})), /*#__PURE__*/React.createElement(Box, {
|
|
406
|
-
basis: "small"
|
|
407
|
-
}, /*#__PURE__*/React.createElement(RangeInput, {
|
|
408
|
-
min: 16,
|
|
409
|
-
max: 36,
|
|
410
|
-
step: 2,
|
|
411
|
-
value: baseSize,
|
|
412
|
-
onChange: function onChange(event) {
|
|
413
|
-
return setBaseSize(parseInt(event.target.value, 10));
|
|
414
|
-
}
|
|
415
|
-
})), /*#__PURE__*/React.createElement(Text, {
|
|
416
|
-
size: "small"
|
|
417
|
-
}, baseSize + "px base spacing"))), /*#__PURE__*/React.createElement(Grommet, {
|
|
418
|
-
theme: theme,
|
|
419
|
-
themeMode: themeMode,
|
|
420
|
-
style: {
|
|
421
|
-
flex: '1 1'
|
|
422
|
-
}
|
|
423
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
324
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
424
325
|
fill: true,
|
|
425
326
|
pad: "medium",
|
|
426
|
-
background: background || theme.global.colors.background,
|
|
427
327
|
overflow: "auto"
|
|
428
328
|
}, /*#__PURE__*/React.createElement(Grid, {
|
|
429
329
|
columns: "small",
|
|
430
330
|
gap: "medium"
|
|
431
|
-
}, content))
|
|
331
|
+
}, content));
|
|
432
332
|
};
|
|
433
333
|
|
|
434
334
|
export var All = function All() {
|
|
@@ -34,7 +34,9 @@ var CustomHeaderAccordion = function CustomHeaderAccordion() {
|
|
|
34
34
|
style: {
|
|
35
35
|
height: '800px'
|
|
36
36
|
}
|
|
37
|
-
}, /*#__PURE__*/React.createElement(Text, null, "Panel 1 contents"), /*#__PURE__*/React.createElement(TextInput,
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Text, null, "Panel 1 contents"), /*#__PURE__*/React.createElement(TextInput, {
|
|
38
|
+
a11yTitle: "panel 1 text box"
|
|
39
|
+
}))), /*#__PURE__*/React.createElement(AccordionPanel, {
|
|
38
40
|
header: renderPanelHeader('Panel 2', activeIndex.includes(1))
|
|
39
41
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
40
42
|
pad: "medium",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["align", "children", "height", "justify", "round", "size", "src", "width"];
|
|
1
|
+
var _excluded = ["a11yTitle", "aria-label", "align", "children", "height", "justify", "round", "size", "src", "width"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -6,12 +6,15 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
6
6
|
|
|
7
7
|
import React, { useCallback, useContext, useMemo } from 'react';
|
|
8
8
|
import { ThemeContext } from 'styled-components';
|
|
9
|
+
import { Image } from '../Image';
|
|
9
10
|
import { defaultProps } from '../../default-props';
|
|
10
11
|
import { StyledAvatar, StyledAvatarText } from './StyledAvatar';
|
|
11
12
|
import { AvatarPropTypes } from './propTypes';
|
|
12
13
|
|
|
13
14
|
var Avatar = function Avatar(_ref) {
|
|
14
|
-
var
|
|
15
|
+
var a11yTitle = _ref.a11yTitle,
|
|
16
|
+
ariaLabel = _ref['aria-label'],
|
|
17
|
+
_ref$align = _ref.align,
|
|
15
18
|
align = _ref$align === void 0 ? 'center' : _ref$align,
|
|
16
19
|
children = _ref.children,
|
|
17
20
|
height = _ref.height,
|
|
@@ -46,17 +49,26 @@ var Avatar = function Avatar(_ref) {
|
|
|
46
49
|
console.warn('Avatar should use `size` instead of `height` or `width` props');
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
return /*#__PURE__*/React.createElement(StyledAvatar, _extends({}, avatarProps, rest, {
|
|
51
|
-
background: "url(" + src + ")"
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
52
|
+
var content;
|
|
54
53
|
|
|
55
54
|
if (typeof children === 'string') {
|
|
56
|
-
|
|
55
|
+
content = /*#__PURE__*/React.createElement(StyledAvatarText, {
|
|
57
56
|
alignSelf: "center",
|
|
58
57
|
size: avatarTextSize
|
|
59
|
-
}, children)
|
|
58
|
+
}, children);
|
|
59
|
+
} else if (typeof src === 'string') {
|
|
60
|
+
content = /*#__PURE__*/React.createElement(Image, {
|
|
61
|
+
role: "presentation",
|
|
62
|
+
fit: "contain",
|
|
63
|
+
src: src
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (typeof children === 'string' || typeof src === 'string') {
|
|
68
|
+
return /*#__PURE__*/React.createElement(StyledAvatar, _extends({
|
|
69
|
+
role: typeof src === 'string' ? 'figure' : undefined,
|
|
70
|
+
a11yTitle: a11yTitle || ariaLabel
|
|
71
|
+
}, avatarProps, rest), content);
|
|
60
72
|
}
|
|
61
73
|
|
|
62
74
|
return /*#__PURE__*/React.createElement(AvatarChildren, null);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { Box, Paragraph, Text, ThemeContext } from 'grommet';
|
|
3
|
+
import { Grid } from '../../Grid';
|
|
4
|
+
export var BackgroundThemed = function BackgroundThemed() {
|
|
5
|
+
var theme = useContext(ThemeContext);
|
|
6
|
+
var backgrounds = theme.global.backgrounds;
|
|
7
|
+
return (// Uncomment <Grommet> lines when using outside of storybook
|
|
8
|
+
// <Grommet>
|
|
9
|
+
backgrounds ? /*#__PURE__*/React.createElement(Grid, {
|
|
10
|
+
columns: "small",
|
|
11
|
+
rows: "small",
|
|
12
|
+
gap: "small",
|
|
13
|
+
pad: "large"
|
|
14
|
+
}, Object.entries(backgrounds).map(function (_ref) {
|
|
15
|
+
var key = _ref[0],
|
|
16
|
+
background = _ref[1];
|
|
17
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
18
|
+
key: key,
|
|
19
|
+
background: background,
|
|
20
|
+
fill: true,
|
|
21
|
+
pad: "medium",
|
|
22
|
+
justify: "center",
|
|
23
|
+
round: "small"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
25
|
+
weight: "bold",
|
|
26
|
+
size: "large"
|
|
27
|
+
}, key));
|
|
28
|
+
})) : /*#__PURE__*/React.createElement(Box, {
|
|
29
|
+
pad: "large"
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Paragraph, {
|
|
31
|
+
size: "large"
|
|
32
|
+
}, "There are no backgrounds defined at `theme.global.backgrounds` for the currently selected theme. Selecting \"grommet\" from the Theme menu above is a good place to start.")) // </Grommet>
|
|
33
|
+
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
BackgroundThemed.storyName = 'Background from theme';
|
|
37
|
+
export default {
|
|
38
|
+
title: 'Layout/Box/Background from theme'
|
|
39
|
+
};
|