grommet 2.29.1 → 2.30.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/Anchor/Anchor.js +9 -3
- package/components/Anchor/StyledAnchor.js +6 -3
- package/components/Button/Button.js +6 -2
- package/components/Button/StyledButtonKind.js +20 -6
- package/components/Calendar/Calendar.js +14 -6
- package/components/Data/DataForm.js +75 -10
- package/components/Data/stories/Cards.js +1 -1
- package/components/Data/stories/Complex.js +84 -0
- package/components/Data/stories/Controlled.js +1 -1
- package/components/Data/stories/DataTable.js +11 -4
- package/components/Data/stories/Infinite.js +1 -1
- package/components/Data/stories/Inline.js +7 -2
- package/components/Data/stories/List.js +1 -1
- package/components/Data/stories/Simple.js +1 -1
- package/components/Data/stories/SpaceX.js +1 -1
- package/components/Data/stories/StarWars.js +18 -24
- package/components/Data/stories/Views.js +1 -1
- package/components/DataFilter/DataFilter.js +32 -42
- package/components/DataFilter/stories/Simple.js +7 -4
- package/components/DataFilters/DataFilters.js +76 -32
- package/components/DataFilters/index.d.ts +1 -0
- package/components/DataFilters/propTypes.js +2 -1
- package/components/DataFilters/stories/Drop.js +7 -4
- package/components/DataFilters/stories/Inline.js +24 -6
- package/components/DataFilters/stories/Layer.js +46 -0
- package/components/DataFilters/stories/Simple.js +7 -4
- package/components/DataSearch/DataSearch.js +57 -9
- package/components/DataSearch/index.d.ts +10 -1
- package/components/DataSearch/propTypes.js +6 -1
- package/components/DataSearch/stories/Drop.js +42 -0
- package/components/DataSearch/stories/Responsive.js +42 -0
- package/components/DataSearch/stories/Simple.js +5 -2
- package/components/DataSort/DataSort.js +61 -12
- package/components/DataSort/index.d.ts +4 -8
- package/components/DataSort/propTypes.js +9 -2
- package/components/DataSort/stories/Drop.js +41 -0
- package/components/DataSort/stories/Simple.js +9 -5
- package/components/DataSummary/stories/Simple.js +7 -4
- package/components/DataTable/GroupedBody.js +1 -0
- package/components/DataTable/StyledDataTable.js +2 -2
- package/components/DataTableColumns/DataTableColumns.js +2 -1
- package/components/DataTableColumns/stories/Simple.js +9 -5
- package/components/DataView/DataView.js +21 -6
- package/components/DataView/stories/Simple.js +8 -5
- package/components/Distribution/Distribution.js +1 -1
- package/components/Drop/DropContainer.js +32 -79
- package/components/Drop/stories/Overflow.js +1 -0
- package/components/DropButton/DropButton.js +1 -1
- package/components/Form/stories/Controlled.js +11 -2
- package/components/Form/stories/ControlledInput.js +13 -2
- package/components/Form/stories/ControlledInputLazy.js +13 -2
- package/components/Form/stories/ControlledLazy.js +13 -2
- package/components/Form/stories/FieldWithChildren.js +13 -2
- package/components/Form/stories/FieldWithComponentProp.js +17 -1
- package/components/Form/stories/Uncontrolled.js +15 -2
- package/components/Form/stories/ValidateOnChange.js +6 -0
- package/components/Form/stories/ValidateOnMount.js +4 -0
- package/components/Form/stories/typescript/TypedForm.tsx +25 -3
- package/components/FormField/FormField.js +1 -0
- package/components/Layer/LayerContainer.js +1 -1
- package/components/Layer/StyledLayer.js +3 -1
- package/components/Pagination/Pagination.js +8 -0
- package/components/Paragraph/Paragraph.js +18 -6
- package/components/Tabs/Tabs.js +2 -1
- package/components/Text/Text.js +9 -1
- package/components/Text/TextContext.js +8 -0
- package/components/TextInput/StyledTextInput.js +3 -1
- package/components/TextInput/TextInput.js +4 -2
- package/components/TextInput/index.d.ts +3 -1
- package/components/TextInput/propTypes.js +3 -1
- package/components/Toolbar/stories/Simple.js +1 -1
- package/components/WorldMap/WorldMap.js +17 -14
- package/es6/components/Anchor/Anchor.js +9 -3
- package/es6/components/Anchor/StyledAnchor.js +6 -3
- package/es6/components/Button/Button.js +6 -2
- package/es6/components/Button/StyledButtonKind.js +20 -6
- package/es6/components/Calendar/Calendar.js +14 -6
- package/es6/components/Data/DataForm.js +75 -10
- package/es6/components/Data/stories/Cards.js +1 -1
- package/es6/components/Data/stories/Complex.js +78 -0
- package/es6/components/Data/stories/Controlled.js +1 -1
- package/es6/components/Data/stories/DataTable.js +12 -5
- package/es6/components/Data/stories/Infinite.js +1 -1
- package/es6/components/Data/stories/Inline.js +7 -2
- package/es6/components/Data/stories/List.js +1 -1
- package/es6/components/Data/stories/Simple.js +1 -1
- package/es6/components/Data/stories/SpaceX.js +1 -1
- package/es6/components/Data/stories/StarWars.js +18 -24
- package/es6/components/Data/stories/Views.js +1 -1
- package/es6/components/DataFilter/DataFilter.js +32 -42
- package/es6/components/DataFilter/stories/Simple.js +8 -5
- package/es6/components/DataFilters/DataFilters.js +76 -32
- package/es6/components/DataFilters/index.d.ts +1 -0
- package/es6/components/DataFilters/propTypes.js +2 -1
- package/es6/components/DataFilters/stories/Drop.js +8 -5
- package/es6/components/DataFilters/stories/Inline.js +25 -7
- package/es6/components/DataFilters/stories/Layer.js +40 -0
- package/es6/components/DataFilters/stories/Simple.js +8 -5
- package/es6/components/DataSearch/DataSearch.js +58 -10
- package/es6/components/DataSearch/index.d.ts +10 -1
- package/es6/components/DataSearch/propTypes.js +5 -1
- package/es6/components/DataSearch/stories/Drop.js +36 -0
- package/es6/components/DataSearch/stories/Responsive.js +36 -0
- package/es6/components/DataSearch/stories/Simple.js +6 -3
- package/es6/components/DataSort/DataSort.js +62 -13
- package/es6/components/DataSort/index.d.ts +4 -8
- package/es6/components/DataSort/propTypes.js +8 -2
- package/es6/components/DataSort/stories/Drop.js +35 -0
- package/es6/components/DataSort/stories/Simple.js +10 -6
- package/es6/components/DataSummary/stories/Simple.js +8 -5
- package/es6/components/DataTable/GroupedBody.js +1 -0
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DataTableColumns/DataTableColumns.js +2 -1
- package/es6/components/DataTableColumns/stories/Simple.js +10 -6
- package/es6/components/DataView/DataView.js +21 -6
- package/es6/components/DataView/stories/Simple.js +9 -6
- package/es6/components/Distribution/Distribution.js +1 -1
- package/es6/components/Drop/DropContainer.js +34 -81
- package/es6/components/Drop/stories/Overflow.js +1 -0
- package/es6/components/DropButton/DropButton.js +1 -1
- package/es6/components/Form/stories/Controlled.js +11 -2
- package/es6/components/Form/stories/ControlledInput.js +13 -2
- package/es6/components/Form/stories/ControlledInputLazy.js +13 -2
- package/es6/components/Form/stories/ControlledLazy.js +13 -2
- package/es6/components/Form/stories/FieldWithChildren.js +13 -2
- package/es6/components/Form/stories/FieldWithComponentProp.js +17 -1
- package/es6/components/Form/stories/Uncontrolled.js +15 -2
- package/es6/components/Form/stories/ValidateOnChange.js +6 -0
- package/es6/components/Form/stories/ValidateOnMount.js +4 -0
- package/es6/components/Form/stories/typescript/TypedForm.tsx +25 -3
- package/es6/components/FormField/FormField.js +1 -0
- package/es6/components/Layer/LayerContainer.js +1 -1
- package/es6/components/Layer/StyledLayer.js +3 -1
- package/es6/components/Pagination/Pagination.js +8 -0
- package/es6/components/Paragraph/Paragraph.js +19 -7
- package/es6/components/Tabs/Tabs.js +2 -1
- package/es6/components/Text/Text.js +10 -2
- package/es6/components/Text/TextContext.js +2 -0
- package/es6/components/TextInput/StyledTextInput.js +4 -2
- package/es6/components/TextInput/TextInput.js +4 -2
- package/es6/components/TextInput/index.d.ts +3 -1
- package/es6/components/TextInput/propTypes.js +3 -1
- package/es6/components/Toolbar/stories/Simple.js +1 -1
- package/es6/components/WorldMap/WorldMap.js +17 -14
- package/es6/languages/default.json +7 -2
- package/es6/themes/base.d.ts +31 -0
- package/es6/themes/base.js +31 -1
- package/es6/utils/DOM.js +1 -1
- package/es6/utils/background.js +9 -1
- package/es6/utils/colors.js +2 -2
- package/es6/utils/general-prop-types.js +1 -1
- package/es6/utils/index.d.ts +7 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +7 -2
- package/package.json +13 -11
- package/themes/base.d.ts +31 -0
- package/themes/base.js +31 -1
- package/utils/DOM.js +1 -1
- package/utils/background.js +8 -0
- package/utils/colors.js +3 -1
- package/utils/general-prop-types.js +1 -1
- package/utils/index.d.ts +7 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Data, DataSummary, DataTable, Grid, Notification, Paragraph } from 'grommet';
|
|
3
|
+
import { DataSearch } from '../DataSearch';
|
|
4
|
+
import { columns, DATA } from '../../DataTable/stories/data';
|
|
5
|
+
export var Drop = function Drop() {
|
|
6
|
+
return (
|
|
7
|
+
/*#__PURE__*/
|
|
8
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
9
|
+
// <Grommet theme={...}>
|
|
10
|
+
React.createElement(Grid, {
|
|
11
|
+
pad: "large",
|
|
12
|
+
columns: ['large'],
|
|
13
|
+
justifyContent: "center"
|
|
14
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
15
|
+
status: "info",
|
|
16
|
+
message: "Data is in 'beta'. The API surface is subject to change."
|
|
17
|
+
}), /*#__PURE__*/React.createElement(Paragraph, {
|
|
18
|
+
color: "text-weak"
|
|
19
|
+
}, "Note: Results are filtered as you type, checking all fields."), /*#__PURE__*/React.createElement(Data, {
|
|
20
|
+
data: DATA,
|
|
21
|
+
updateOn: "change"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(DataSearch, {
|
|
23
|
+
drop: true
|
|
24
|
+
}), /*#__PURE__*/React.createElement(DataSummary, null), /*#__PURE__*/React.createElement(DataTable, {
|
|
25
|
+
columns: columns
|
|
26
|
+
})))
|
|
27
|
+
// </Grommet>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
Drop.args = {
|
|
32
|
+
full: true
|
|
33
|
+
};
|
|
34
|
+
export default {
|
|
35
|
+
title: 'Data/DataSearch/Drop'
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Data, DataSummary, DataTable, Grid, Notification, Paragraph } from 'grommet';
|
|
3
|
+
import { DataSearch } from '../DataSearch';
|
|
4
|
+
import { columns, DATA } from '../../DataTable/stories/data';
|
|
5
|
+
export var Responsive = function Responsive() {
|
|
6
|
+
return (
|
|
7
|
+
/*#__PURE__*/
|
|
8
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
9
|
+
// <Grommet theme={...}>
|
|
10
|
+
React.createElement(Grid, {
|
|
11
|
+
pad: "large",
|
|
12
|
+
columns: [['medium', 'large']],
|
|
13
|
+
justifyContent: "center"
|
|
14
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
15
|
+
status: "info",
|
|
16
|
+
message: "Data is in 'beta'. The API surface is subject to change."
|
|
17
|
+
}), /*#__PURE__*/React.createElement(Paragraph, {
|
|
18
|
+
color: "text-weak"
|
|
19
|
+
}, "Note: Results are filtered as you type, checking all fields."), /*#__PURE__*/React.createElement(Data, {
|
|
20
|
+
data: DATA,
|
|
21
|
+
updateOn: "change"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(DataSearch, {
|
|
23
|
+
responsive: true
|
|
24
|
+
}), /*#__PURE__*/React.createElement(DataSummary, null), /*#__PURE__*/React.createElement(DataTable, {
|
|
25
|
+
columns: columns
|
|
26
|
+
})))
|
|
27
|
+
// </Grommet>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
Responsive.args = {
|
|
32
|
+
full: true
|
|
33
|
+
};
|
|
34
|
+
export default {
|
|
35
|
+
title: 'Data/DataSearch/Responsive'
|
|
36
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Data, DataSummary, DataTable, Grid, Paragraph } from 'grommet';
|
|
2
|
+
import { Data, DataSummary, DataTable, Grid, Notification, Paragraph } from 'grommet';
|
|
3
3
|
import { DataSearch } from '../DataSearch';
|
|
4
4
|
import { columns, DATA } from '../../DataTable/stories/data';
|
|
5
5
|
export var Simple = function Simple() {
|
|
@@ -11,7 +11,10 @@ export var Simple = function Simple() {
|
|
|
11
11
|
pad: "large",
|
|
12
12
|
columns: ['large'],
|
|
13
13
|
justifyContent: "center"
|
|
14
|
-
}, /*#__PURE__*/React.createElement(
|
|
14
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
15
|
+
status: "info",
|
|
16
|
+
message: "Data is in 'beta'. The API surface is subject to change."
|
|
17
|
+
}), /*#__PURE__*/React.createElement(Paragraph, {
|
|
15
18
|
color: "text-weak"
|
|
16
19
|
}, "Note: Results are filtered as you type, checking all fields."), /*#__PURE__*/React.createElement(Data, {
|
|
17
20
|
data: DATA,
|
|
@@ -27,5 +30,5 @@ Simple.args = {
|
|
|
27
30
|
full: true
|
|
28
31
|
};
|
|
29
32
|
export default {
|
|
30
|
-
title: '
|
|
33
|
+
title: 'Data/DataSearch/Simple'
|
|
31
34
|
};
|
|
@@ -1,47 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["drop", "options"];
|
|
2
|
+
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); }
|
|
3
|
+
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; }
|
|
4
|
+
import React, { useContext, useMemo, useState } from 'react';
|
|
5
|
+
import { Descend } from 'grommet-icons/icons/Descend';
|
|
2
6
|
import { DataContext } from '../../contexts/DataContext';
|
|
3
|
-
import {
|
|
7
|
+
import { Box } from '../Box';
|
|
4
8
|
import { DataForm } from '../Data/DataForm';
|
|
9
|
+
import { DropButton } from '../DropButton';
|
|
5
10
|
import { FormContext } from '../Form/FormContext';
|
|
6
11
|
import { FormField } from '../FormField';
|
|
12
|
+
import { RadioButtonGroup } from '../RadioButtonGroup';
|
|
7
13
|
import { Select } from '../Select';
|
|
8
14
|
import { MessageContext } from '../../contexts/MessageContext';
|
|
9
15
|
import { DataSortPropTypes } from './propTypes';
|
|
10
|
-
|
|
16
|
+
var dropProps = {
|
|
17
|
+
align: {
|
|
18
|
+
top: 'bottom',
|
|
19
|
+
left: 'left'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var Content = function Content(_ref) {
|
|
11
23
|
var optionsArg = _ref.options;
|
|
12
24
|
var _useContext = useContext(DataContext),
|
|
13
25
|
data = _useContext.data,
|
|
14
26
|
dataId = _useContext.id,
|
|
15
27
|
messages = _useContext.messages,
|
|
16
28
|
properties = _useContext.properties;
|
|
17
|
-
var _useContext2 = useContext(
|
|
18
|
-
|
|
19
|
-
var _useContext3 = useContext(MessageContext),
|
|
20
|
-
format = _useContext3.format;
|
|
29
|
+
var _useContext2 = useContext(MessageContext),
|
|
30
|
+
format = _useContext2.format;
|
|
21
31
|
var options = useMemo(function () {
|
|
22
32
|
return optionsArg || properties && Object.keys(properties).sort() || Object.keys(data[0]).sort();
|
|
23
33
|
}, [data, optionsArg, properties]);
|
|
24
34
|
var directionOptions = [{
|
|
25
35
|
label: format({
|
|
26
36
|
id: 'dataSort.ascending',
|
|
27
|
-
messages: messages == null ? void 0 : messages.
|
|
37
|
+
messages: messages == null ? void 0 : messages.dataSort
|
|
28
38
|
}),
|
|
29
39
|
value: 'asc'
|
|
30
40
|
}, {
|
|
31
41
|
label: format({
|
|
32
42
|
id: 'dataSort.descending',
|
|
33
|
-
messages: messages == null ? void 0 : messages.
|
|
43
|
+
messages: messages == null ? void 0 : messages.dataSort
|
|
34
44
|
}),
|
|
35
45
|
value: 'desc'
|
|
36
46
|
}];
|
|
37
47
|
var sortPropertyId = dataId + "--sort-property";
|
|
38
48
|
var sortDirectionId = dataId + "--sort-direction";
|
|
39
|
-
|
|
49
|
+
return [/*#__PURE__*/React.createElement(FormField, {
|
|
40
50
|
key: "by",
|
|
41
51
|
htmlFor: sortPropertyId,
|
|
42
52
|
label: format({
|
|
43
53
|
id: 'dataSort.by',
|
|
44
|
-
messages: messages == null ? void 0 : messages.
|
|
54
|
+
messages: messages == null ? void 0 : messages.dataSort
|
|
45
55
|
})
|
|
46
56
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
47
57
|
id: sortPropertyId,
|
|
@@ -52,16 +62,55 @@ export var DataSort = function DataSort(_ref) {
|
|
|
52
62
|
htmlFor: sortDirectionId,
|
|
53
63
|
label: format({
|
|
54
64
|
id: 'dataSort.direction',
|
|
55
|
-
messages: messages == null ? void 0 : messages.
|
|
65
|
+
messages: messages == null ? void 0 : messages.dataSort
|
|
56
66
|
})
|
|
57
67
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
58
68
|
id: sortDirectionId,
|
|
59
69
|
name: "_sort.direction",
|
|
60
70
|
options: directionOptions
|
|
61
71
|
}))];
|
|
72
|
+
};
|
|
73
|
+
export var DataSort = function DataSort(_ref2) {
|
|
74
|
+
var drop = _ref2.drop,
|
|
75
|
+
options = _ref2.options,
|
|
76
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
77
|
+
var _useContext3 = useContext(DataContext),
|
|
78
|
+
dataId = _useContext3.id,
|
|
79
|
+
messages = _useContext3.messages;
|
|
80
|
+
var _useContext4 = useContext(FormContext),
|
|
81
|
+
noForm = _useContext4.noForm;
|
|
82
|
+
var _useContext5 = useContext(MessageContext),
|
|
83
|
+
format = _useContext5.format;
|
|
84
|
+
var _useState = useState(),
|
|
85
|
+
showContent = _useState[0],
|
|
86
|
+
setShowContent = _useState[1];
|
|
87
|
+
var content = /*#__PURE__*/React.createElement(Content, {
|
|
88
|
+
options: options
|
|
89
|
+
});
|
|
62
90
|
if (noForm) content = /*#__PURE__*/React.createElement(DataForm, {
|
|
63
91
|
footer: false
|
|
64
92
|
}, content);
|
|
65
|
-
return content;
|
|
93
|
+
if (!drop) return content;
|
|
94
|
+
var control = /*#__PURE__*/React.createElement(DropButton, _extends({
|
|
95
|
+
id: dataId + "--sort-control",
|
|
96
|
+
"aria-label": format({
|
|
97
|
+
id: 'dataSort.open',
|
|
98
|
+
messages: messages == null ? void 0 : messages.dataSort
|
|
99
|
+
}),
|
|
100
|
+
kind: "toolbar",
|
|
101
|
+
icon: /*#__PURE__*/React.createElement(Descend, null),
|
|
102
|
+
dropProps: dropProps,
|
|
103
|
+
dropContent: /*#__PURE__*/React.createElement(Box, {
|
|
104
|
+
pad: "small"
|
|
105
|
+
}, content),
|
|
106
|
+
open: showContent,
|
|
107
|
+
onOpen: function onOpen() {
|
|
108
|
+
return setShowContent(undefined);
|
|
109
|
+
},
|
|
110
|
+
onClose: function onClose() {
|
|
111
|
+
return setShowContent(undefined);
|
|
112
|
+
}
|
|
113
|
+
}, rest));
|
|
114
|
+
return control;
|
|
66
115
|
};
|
|
67
116
|
DataSort.propTypes = DataSortPropTypes;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BoxProps } from '../Box/index';
|
|
3
2
|
|
|
4
|
-
export interface DataSortProps {
|
|
3
|
+
export interface DataSortProps {
|
|
4
|
+
drop?: boolean;
|
|
5
|
+
}
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface DataSortExtendedProps
|
|
9
|
-
extends BoxProps,
|
|
10
|
-
DataSortProps,
|
|
11
|
-
divProps {}
|
|
7
|
+
export interface DataSortExtendedProps extends DataSortProps {}
|
|
12
8
|
|
|
13
9
|
declare const DataSort: React.FC<DataSortExtendedProps>;
|
|
14
10
|
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
var PropType = {};
|
|
3
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4
|
+
PropType = {
|
|
5
|
+
drop: PropTypes.bool
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export var DataSortPropTypes = PropType;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Data, DataTable, Notification, Toolbar } from 'grommet';
|
|
3
|
+
import { DataSort } from '../DataSort';
|
|
4
|
+
import { columns, DATA } from '../../DataTable/stories/data';
|
|
5
|
+
export var Drop = function Drop() {
|
|
6
|
+
return (
|
|
7
|
+
/*#__PURE__*/
|
|
8
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
9
|
+
// <Grommet theme={...}>
|
|
10
|
+
React.createElement(Box, {
|
|
11
|
+
align: "center",
|
|
12
|
+
justify: "start",
|
|
13
|
+
pad: "large",
|
|
14
|
+
gap: "medium"
|
|
15
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
16
|
+
status: "info",
|
|
17
|
+
message: "Data is in 'beta'. The API surface is subject to change."
|
|
18
|
+
}), /*#__PURE__*/React.createElement(Data, {
|
|
19
|
+
data: DATA,
|
|
20
|
+
updateOn: "change"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Toolbar, null, /*#__PURE__*/React.createElement(DataSort, {
|
|
22
|
+
drop: true
|
|
23
|
+
})), /*#__PURE__*/React.createElement(DataTable, {
|
|
24
|
+
columns: columns
|
|
25
|
+
})))
|
|
26
|
+
// </Grommet>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
Drop.args = {
|
|
31
|
+
full: true
|
|
32
|
+
};
|
|
33
|
+
export default {
|
|
34
|
+
title: 'Data/DataSort/Drop'
|
|
35
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Data, DataTable,
|
|
2
|
+
import { Box, Data, DataTable, Notification } from 'grommet';
|
|
3
3
|
import { DataSort } from '../DataSort';
|
|
4
4
|
import { columns, DATA } from '../../DataTable/stories/data';
|
|
5
5
|
export var Simple = function Simple() {
|
|
@@ -7,11 +7,15 @@ export var Simple = function Simple() {
|
|
|
7
7
|
/*#__PURE__*/
|
|
8
8
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
9
9
|
// <Grommet theme={...}>
|
|
10
|
-
React.createElement(
|
|
10
|
+
React.createElement(Box, {
|
|
11
|
+
align: "center",
|
|
12
|
+
justify: "start",
|
|
11
13
|
pad: "large",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
gap: "medium"
|
|
15
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
16
|
+
status: "info",
|
|
17
|
+
message: "Data is in 'beta'. The API surface is subject to change."
|
|
18
|
+
}), /*#__PURE__*/React.createElement(Data, {
|
|
15
19
|
data: DATA,
|
|
16
20
|
updateOn: "change"
|
|
17
21
|
}, /*#__PURE__*/React.createElement(DataSort, null), /*#__PURE__*/React.createElement(DataTable, {
|
|
@@ -25,5 +29,5 @@ Simple.args = {
|
|
|
25
29
|
full: true
|
|
26
30
|
};
|
|
27
31
|
export default {
|
|
28
|
-
title: '
|
|
32
|
+
title: 'Data/DataSort/Simple'
|
|
29
33
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box, Data, DataTable } from 'grommet';
|
|
2
|
+
import { Box, Data, DataTable, Notification } from 'grommet';
|
|
3
3
|
import { DataSummary } from '../DataSummary';
|
|
4
4
|
import { columns, DATA } from '../../DataTable/stories/data';
|
|
5
5
|
export var Simple = function Simple() {
|
|
@@ -8,11 +8,14 @@ export var Simple = function Simple() {
|
|
|
8
8
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
9
9
|
// <Grommet theme={...}>
|
|
10
10
|
React.createElement(Box, {
|
|
11
|
-
fill: true,
|
|
12
11
|
align: "center",
|
|
13
12
|
justify: "start",
|
|
14
|
-
pad: "large"
|
|
15
|
-
|
|
13
|
+
pad: "large",
|
|
14
|
+
gap: "medium"
|
|
15
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
16
|
+
status: "info",
|
|
17
|
+
message: "Data is in 'beta'. The API surface is subject to change."
|
|
18
|
+
}), /*#__PURE__*/React.createElement(Data, {
|
|
16
19
|
data: DATA
|
|
17
20
|
}, /*#__PURE__*/React.createElement(DataSummary, null), /*#__PURE__*/React.createElement(DataTable, {
|
|
18
21
|
columns: columns
|
|
@@ -25,5 +28,5 @@ Simple.args = {
|
|
|
25
28
|
full: true
|
|
26
29
|
};
|
|
27
30
|
export default {
|
|
28
|
-
title: '
|
|
31
|
+
title: 'Data/DataSummary/Simple'
|
|
29
32
|
};
|
|
@@ -13,7 +13,7 @@ import { TableFooter } from '../TableFooter';
|
|
|
13
13
|
var StyledDataTable = styled(Table).withConfig({
|
|
14
14
|
displayName: "StyledDataTable",
|
|
15
15
|
componentId: "sc-xrlyjm-0"
|
|
16
|
-
})(["position:relative;border-spacing:0;border-collapse:separate;
|
|
16
|
+
})(["position:relative;border-spacing:0;border-collapse:separate;", " ", " ", ";"], genericStyles, function (props) {
|
|
17
17
|
return props.fillProp && fillStyle(props.fillProp);
|
|
18
18
|
}, function (props) {
|
|
19
19
|
return props.theme.dataTable && props.theme.dataTable.body && props.theme.dataTable.body.extend;
|
|
@@ -53,7 +53,7 @@ var StyledDataTableBody = styled(TableBody).withConfig({
|
|
|
53
53
|
displayName: "StyledDataTable__StyledDataTableBody",
|
|
54
54
|
componentId: "sc-xrlyjm-3"
|
|
55
55
|
})(["", " &:focus{", "}&:focus:not(:focus-visible){", "}"], function (props) {
|
|
56
|
-
return props.size && "\n display: block;\n width: 100%;\n max-height: " + props.theme.global.size[props.size] + ";\n overflow: auto;\n ";
|
|
56
|
+
return props.size && "\n display: block;\n width: 100%;\n max-height: " + (props.theme.global.size[props.size] || props.size) + ";\n overflow: auto;\n ";
|
|
57
57
|
}, focusStyle({
|
|
58
58
|
skipSvgChildren: true,
|
|
59
59
|
forceOutline: true
|
|
@@ -192,7 +192,8 @@ export var DataTableColumns = function DataTableColumns(_ref5) {
|
|
|
192
192
|
options: options
|
|
193
193
|
});
|
|
194
194
|
if (noForm) content = /*#__PURE__*/React.createElement(DataForm, {
|
|
195
|
-
footer: false
|
|
195
|
+
footer: false,
|
|
196
|
+
updateOn: "change"
|
|
196
197
|
}, content);
|
|
197
198
|
if (!drop) return content;
|
|
198
199
|
var control = /*#__PURE__*/React.createElement(DropButton, _extends({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Data, DataTable,
|
|
2
|
+
import { Box, Data, DataTable, Notification, Toolbar } from 'grommet';
|
|
3
3
|
import { DataTableColumns } from '../DataTableColumns';
|
|
4
4
|
import { columns, DATA } from '../../DataTable/stories/data';
|
|
5
5
|
|
|
@@ -17,11 +17,15 @@ export var Simple = function Simple() {
|
|
|
17
17
|
/*#__PURE__*/
|
|
18
18
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
19
19
|
// <Grommet theme={...}>
|
|
20
|
-
React.createElement(
|
|
20
|
+
React.createElement(Box, {
|
|
21
|
+
align: "center",
|
|
22
|
+
justify: "start",
|
|
21
23
|
pad: "large",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
gap: "medium"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
26
|
+
status: "info",
|
|
27
|
+
message: "Data is in 'beta'. The API surface is subject to change."
|
|
28
|
+
}), /*#__PURE__*/React.createElement(Data, {
|
|
25
29
|
data: DATA,
|
|
26
30
|
updateOn: "change"
|
|
27
31
|
}, /*#__PURE__*/React.createElement(Toolbar, null, /*#__PURE__*/React.createElement(DataTableColumns, {
|
|
@@ -38,5 +42,5 @@ Simple.args = {
|
|
|
38
42
|
full: true
|
|
39
43
|
};
|
|
40
44
|
export default {
|
|
41
|
-
title: '
|
|
45
|
+
title: 'Data/DataTableColumns/Simple'
|
|
42
46
|
};
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["id"];
|
|
2
2
|
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); }
|
|
3
|
+
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; }
|
|
3
4
|
import React, { useContext, useEffect } from 'react';
|
|
4
5
|
import { DataForm } from '../Data/DataForm';
|
|
5
6
|
import { DataContext } from '../../contexts/DataContext';
|
|
6
7
|
import { FormContext } from '../Form/FormContext';
|
|
8
|
+
import { FormField } from '../FormField';
|
|
7
9
|
import { RadioButtonGroup } from '../RadioButtonGroup';
|
|
8
10
|
import { Select } from '../Select';
|
|
11
|
+
import { MessageContext } from '../../contexts/MessageContext';
|
|
9
12
|
import { DataViewPropTypes } from './propTypes';
|
|
10
13
|
export var DataView = function DataView(_ref) {
|
|
11
|
-
var
|
|
14
|
+
var idProp = _ref.id,
|
|
15
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
12
16
|
var _useContext = useContext(DataContext),
|
|
13
17
|
dataId = _useContext.id,
|
|
18
|
+
messages = _useContext.messages,
|
|
14
19
|
view = _useContext.view,
|
|
15
20
|
views = _useContext.views,
|
|
16
21
|
addToolbarKey = _useContext.addToolbarKey;
|
|
17
22
|
var _useContext2 = useContext(FormContext),
|
|
18
23
|
noForm = _useContext2.noForm;
|
|
24
|
+
var _useContext3 = useContext(MessageContext),
|
|
25
|
+
format = _useContext3.format;
|
|
26
|
+
var id = idProp || dataId + "--view";
|
|
19
27
|
useEffect(function () {
|
|
20
28
|
if (noForm) addToolbarKey('_view');
|
|
21
29
|
}, [addToolbarKey, noForm]);
|
|
@@ -23,7 +31,6 @@ export var DataView = function DataView(_ref) {
|
|
|
23
31
|
var names = views.map(function (v) {
|
|
24
32
|
return v.name;
|
|
25
33
|
});
|
|
26
|
-
var id = dataId + "-view";
|
|
27
34
|
var content;
|
|
28
35
|
if (!noForm && names.length < 7) {
|
|
29
36
|
content = /*#__PURE__*/React.createElement(RadioButtonGroup, _extends({
|
|
@@ -42,9 +49,17 @@ export var DataView = function DataView(_ref) {
|
|
|
42
49
|
value: view == null ? void 0 : view.name
|
|
43
50
|
}, rest));
|
|
44
51
|
}
|
|
45
|
-
if (noForm)
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
if (noForm)
|
|
53
|
+
// likely in Toolbar
|
|
54
|
+
content = /*#__PURE__*/React.createElement(DataForm, {
|
|
55
|
+
footer: false,
|
|
56
|
+
updateOn: "change"
|
|
57
|
+
}, content);else content = /*#__PURE__*/React.createElement(FormField, {
|
|
58
|
+
htmlFor: id,
|
|
59
|
+
label: format({
|
|
60
|
+
id: 'dataView.label',
|
|
61
|
+
messages: messages == null ? void 0 : messages.dataView
|
|
62
|
+
})
|
|
48
63
|
}, content);
|
|
49
64
|
return content;
|
|
50
65
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box, Data } from 'grommet';
|
|
2
|
+
import { Box, Data, DataTable, Notification } from 'grommet';
|
|
3
3
|
import { DataView } from '../DataView';
|
|
4
4
|
import { DATA } from '../../DataTable/stories/data';
|
|
5
5
|
export var Simple = function Simple() {
|
|
@@ -8,11 +8,14 @@ export var Simple = function Simple() {
|
|
|
8
8
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
9
9
|
// <Grommet theme={...}>
|
|
10
10
|
React.createElement(Box, {
|
|
11
|
-
fill: true,
|
|
12
11
|
align: "center",
|
|
13
12
|
justify: "start",
|
|
14
|
-
pad: "large"
|
|
15
|
-
|
|
13
|
+
pad: "large",
|
|
14
|
+
gap: "medium"
|
|
15
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
16
|
+
status: "info",
|
|
17
|
+
message: "Data is in 'beta'. The API surface is subject to change."
|
|
18
|
+
}), /*#__PURE__*/React.createElement(Data, {
|
|
16
19
|
data: DATA,
|
|
17
20
|
views: [{
|
|
18
21
|
name: 'latest',
|
|
@@ -29,7 +32,7 @@ export var Simple = function Simple() {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
}]
|
|
32
|
-
}, /*#__PURE__*/React.createElement(DataView, null)))
|
|
35
|
+
}, /*#__PURE__*/React.createElement(DataView, null), /*#__PURE__*/React.createElement(DataTable, null)))
|
|
33
36
|
// </Grommet>
|
|
34
37
|
);
|
|
35
38
|
};
|
|
@@ -38,5 +41,5 @@ Simple.args = {
|
|
|
38
41
|
full: true
|
|
39
42
|
};
|
|
40
43
|
export default {
|
|
41
|
-
title: '
|
|
44
|
+
title: 'Data/DataView/Simple'
|
|
42
45
|
};
|
|
@@ -48,7 +48,7 @@ var Distribution = function Distribution(_ref2) {
|
|
|
48
48
|
var subTotal = 0;
|
|
49
49
|
var subIndex;
|
|
50
50
|
values.some(function (v, index) {
|
|
51
|
-
subTotal += Object.prototype.hasOwnProperty.call(v, 'value')
|
|
51
|
+
subTotal += Object.prototype.hasOwnProperty.call(v, 'value') && v.value || 0;
|
|
52
52
|
if (subTotal >= total * 0.4) {
|
|
53
53
|
subIndex = index + 1;
|
|
54
54
|
return true;
|