grommet 2.28.0 → 2.29.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/Accordion/Accordion.js +1 -2
- package/components/AccordionPanel/AccordionPanel.js +1 -2
- package/components/Box/Box.js +11 -2
- package/components/Box/StyledBox.js +30 -5
- package/components/Cards/Cards.js +83 -0
- package/components/Cards/README.md +2 -0
- package/components/Cards/index.d.ts +38 -0
- package/components/Cards/index.js +6 -0
- package/components/Cards/propTypes.js +24 -0
- package/components/Cards/stories/Children.js +49 -0
- package/components/Cards/stories/Paginated.js +31 -0
- package/components/Cards/stories/Simple.js +28 -0
- package/components/Collapsible/Collapsible.js +1 -1
- package/components/Data/Data.js +91 -0
- package/components/Data/DataForm.js +153 -0
- package/components/Data/README.md +2 -0
- package/components/Data/filter.js +91 -0
- package/components/Data/index.d.ts +106 -0
- package/components/Data/index.js +8 -0
- package/components/Data/propTypes.js +28 -0
- package/components/Data/stories/Cards.js +51 -0
- package/components/Data/stories/Controlled.js +94 -0
- package/components/Data/stories/DataTable.js +44 -0
- package/components/Data/stories/Infinite.js +267 -0
- package/components/Data/stories/Inline.js +94 -0
- package/components/Data/stories/List.js +45 -0
- package/components/Data/stories/Simple.js +40 -0
- package/components/Data/stories/SpaceX.js +283 -0
- package/components/DataFilter/DataFilter.js +137 -0
- package/components/DataFilter/README.md +2 -0
- package/components/DataFilter/index.d.ts +29 -0
- package/components/DataFilter/index.js +6 -0
- package/components/DataFilter/propTypes.js +18 -0
- package/components/DataFilter/stories/Simple.js +35 -0
- package/components/DataFilters/DataFilters.js +112 -0
- package/components/DataFilters/README.md +2 -0
- package/components/DataFilters/index.d.ts +18 -0
- package/components/DataFilters/index.js +6 -0
- package/components/DataFilters/propTypes.js +15 -0
- package/components/DataFilters/stories/Drop.js +37 -0
- package/components/DataFilters/stories/Inline.js +37 -0
- package/components/DataFilters/stories/Simple.js +33 -0
- package/components/DataSearch/DataSearch.js +40 -0
- package/components/DataSearch/README.md +2 -0
- package/components/DataSearch/index.d.ts +6 -0
- package/components/DataSearch/index.js +6 -0
- package/components/DataSearch/propTypes.js +10 -0
- package/components/DataSearch/stories/Simple.js +37 -0
- package/components/DataSort/DataSort.js +74 -0
- package/components/DataSort/README.md +2 -0
- package/components/DataSort/index.d.ts +15 -0
- package/components/DataSort/index.js +6 -0
- package/components/DataSort/propTypes.js +7 -0
- package/components/DataSort/stories/Simple.js +35 -0
- package/components/DataSummary/DataSummary.js +42 -0
- package/components/DataSummary/README.md +2 -0
- package/components/DataSummary/index.d.ts +12 -0
- package/components/DataSummary/index.js +6 -0
- package/components/DataSummary/propTypes.js +17 -0
- package/components/DataSummary/stories/Simple.js +35 -0
- package/components/DataTable/DataTable.js +22 -4
- package/components/DataTable/Header.js +2 -1
- package/components/DataTable/buildState.js +2 -6
- package/components/DataTable/stories/SpaceX.js +1 -1
- package/components/DataTable/stories/SpaceXUngrouped.js +1 -1
- package/components/DateInput/DateInput.js +2 -1
- package/components/Distribution/stories/typescript/Simple.tsx +1 -1
- package/components/Footer/stories/Sitemap.js +5 -2
- package/components/Form/Form.js +22 -5
- package/components/Form/FormContext.js +2 -1
- package/components/Form/index.d.ts +1 -0
- package/components/Form/propTypes.js +1 -0
- package/components/Form/stories/Controlled.js +2 -0
- package/components/Form/stories/SolicitedFeedback.js +79 -0
- package/components/Form/stories/UnsolicitedFeedback.js +145 -0
- package/components/FormField/FormField.js +20 -9
- package/components/Grommet/index.d.ts +3 -0
- package/components/Header/stories/Sticky.js +3 -1
- package/components/Image/stories/Fallback.js +2 -1
- package/components/List/List.js +7 -2
- package/components/NameValueList/stories/Align.js +5 -4
- package/components/NameValueList/stories/CustomName.js +2 -2
- package/components/NameValueList/stories/CustomValue.js +4 -4
- package/components/NameValueList/stories/Layout.js +4 -4
- package/components/NameValueList/stories/PairProps.js +3 -3
- package/components/NameValueList/stories/Width.js +5 -5
- package/components/Pagination/stories/Size.js +5 -5
- package/components/RangeSelector/RangeSelector.js +87 -30
- package/components/RangeSelector/index.d.ts +3 -1
- package/components/RangeSelector/propTypes.js +3 -1
- package/components/RangeSelector/stories/Label.js +62 -0
- package/components/RangeSelector/stories/Simple.js +35 -0
- package/components/Select/index.d.ts +2 -2
- package/components/StarRating/README.MD +2 -0
- package/components/StarRating/StarRating.js +40 -0
- package/components/StarRating/index.d.ts +7 -0
- package/components/StarRating/index.js +6 -0
- package/components/StarRating/stories/simple.js +22 -0
- package/components/Tabs/Tabs.js +1 -1
- package/components/ThumbsRating/README.md +2 -0
- package/components/ThumbsRating/ThumbsRating.js +41 -0
- package/components/ThumbsRating/index.d.ts +7 -0
- package/components/ThumbsRating/index.js +6 -0
- package/components/ThumbsRating/stories/simple.js +22 -0
- package/components/Toolbar/README.md +2 -0
- package/components/Toolbar/Toolbar.js +37 -0
- package/components/Toolbar/index.d.ts +15 -0
- package/components/Toolbar/index.js +6 -0
- package/components/Toolbar/propTypes.js +10 -0
- package/components/Toolbar/stories/Simple.js +52 -0
- package/components/index.d.ts +9 -0
- package/components/index.js +60 -0
- package/contexts/DataContext.js +10 -0
- package/contexts/index.js +6 -0
- package/es6/components/Accordion/Accordion.js +1 -2
- package/es6/components/AccordionPanel/AccordionPanel.js +1 -2
- package/es6/components/Box/Box.js +11 -2
- package/es6/components/Box/StyledBox.js +30 -5
- package/es6/components/Cards/Cards.js +77 -0
- package/es6/components/Cards/README.md +2 -0
- package/es6/components/Cards/index.d.ts +38 -0
- package/es6/components/Cards/index.js +1 -0
- package/es6/components/Cards/propTypes.js +18 -0
- package/es6/components/Cards/stories/Children.js +42 -0
- package/es6/components/Cards/stories/Paginated.js +24 -0
- package/es6/components/Cards/stories/Simple.js +21 -0
- package/es6/components/Collapsible/Collapsible.js +1 -1
- package/es6/components/Data/Data.js +84 -0
- package/es6/components/Data/DataForm.js +145 -0
- package/es6/components/Data/README.md +2 -0
- package/es6/components/Data/filter.js +86 -0
- package/es6/components/Data/index.d.ts +106 -0
- package/es6/components/Data/index.js +2 -0
- package/es6/components/Data/propTypes.js +22 -0
- package/es6/components/Data/stories/Cards.js +45 -0
- package/es6/components/Data/stories/Controlled.js +87 -0
- package/es6/components/Data/stories/DataTable.js +38 -0
- package/es6/components/Data/stories/Infinite.js +260 -0
- package/es6/components/Data/stories/Inline.js +87 -0
- package/es6/components/Data/stories/List.js +39 -0
- package/es6/components/Data/stories/Simple.js +34 -0
- package/es6/components/Data/stories/SpaceX.js +276 -0
- package/es6/components/DataFilter/DataFilter.js +130 -0
- package/es6/components/DataFilter/README.md +2 -0
- package/es6/components/DataFilter/index.d.ts +29 -0
- package/es6/components/DataFilter/index.js +1 -0
- package/es6/components/DataFilter/propTypes.js +12 -0
- package/es6/components/DataFilter/stories/Simple.js +29 -0
- package/es6/components/DataFilters/DataFilters.js +105 -0
- package/es6/components/DataFilters/README.md +2 -0
- package/es6/components/DataFilters/index.d.ts +18 -0
- package/es6/components/DataFilters/index.js +1 -0
- package/es6/components/DataFilters/propTypes.js +9 -0
- package/es6/components/DataFilters/stories/Drop.js +31 -0
- package/es6/components/DataFilters/stories/Inline.js +31 -0
- package/es6/components/DataFilters/stories/Simple.js +27 -0
- package/es6/components/DataSearch/DataSearch.js +33 -0
- package/es6/components/DataSearch/README.md +2 -0
- package/es6/components/DataSearch/index.d.ts +6 -0
- package/es6/components/DataSearch/index.js +1 -0
- package/es6/components/DataSearch/propTypes.js +5 -0
- package/es6/components/DataSearch/stories/Simple.js +31 -0
- package/es6/components/DataSort/DataSort.js +67 -0
- package/es6/components/DataSort/README.md +2 -0
- package/es6/components/DataSort/index.d.ts +15 -0
- package/es6/components/DataSort/index.js +1 -0
- package/es6/components/DataSort/propTypes.js +2 -0
- package/es6/components/DataSort/stories/Simple.js +29 -0
- package/es6/components/DataSummary/DataSummary.js +35 -0
- package/es6/components/DataSummary/README.md +2 -0
- package/es6/components/DataSummary/index.d.ts +12 -0
- package/es6/components/DataSummary/index.js +1 -0
- package/es6/components/DataSummary/propTypes.js +11 -0
- package/es6/components/DataSummary/stories/Simple.js +29 -0
- package/es6/components/DataTable/DataTable.js +22 -4
- package/es6/components/DataTable/Header.js +2 -1
- package/es6/components/DataTable/buildState.js +2 -6
- package/es6/components/DataTable/stories/SpaceX.js +1 -1
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +1 -1
- package/es6/components/DateInput/DateInput.js +2 -1
- package/es6/components/Distribution/stories/typescript/Simple.tsx +1 -1
- package/es6/components/Footer/stories/Sitemap.js +5 -2
- package/es6/components/Form/Form.js +22 -5
- package/es6/components/Form/FormContext.js +2 -1
- package/es6/components/Form/index.d.ts +1 -0
- package/es6/components/Form/propTypes.js +1 -0
- package/es6/components/Form/stories/Controlled.js +2 -0
- package/es6/components/Form/stories/SolicitedFeedback.js +73 -0
- package/es6/components/Form/stories/UnsolicitedFeedback.js +138 -0
- package/es6/components/FormField/FormField.js +20 -9
- package/es6/components/Grommet/index.d.ts +3 -0
- package/es6/components/Header/stories/Sticky.js +3 -1
- package/es6/components/Image/stories/Fallback.js +2 -1
- package/es6/components/List/List.js +7 -2
- package/es6/components/NameValueList/stories/Align.js +5 -4
- package/es6/components/NameValueList/stories/CustomName.js +2 -2
- package/es6/components/NameValueList/stories/CustomValue.js +4 -4
- package/es6/components/NameValueList/stories/Layout.js +4 -4
- package/es6/components/NameValueList/stories/PairProps.js +3 -3
- package/es6/components/NameValueList/stories/Width.js +5 -5
- package/es6/components/Pagination/stories/Size.js +5 -5
- package/es6/components/RangeSelector/RangeSelector.js +87 -30
- package/es6/components/RangeSelector/index.d.ts +3 -1
- package/es6/components/RangeSelector/propTypes.js +3 -1
- package/es6/components/RangeSelector/stories/Label.js +55 -0
- package/es6/components/RangeSelector/stories/Simple.js +28 -0
- package/es6/components/Select/index.d.ts +2 -2
- package/es6/components/StarRating/README.MD +2 -0
- package/es6/components/StarRating/StarRating.js +34 -0
- package/es6/components/StarRating/index.d.ts +7 -0
- package/es6/components/StarRating/index.js +1 -0
- package/es6/components/StarRating/stories/simple.js +15 -0
- package/es6/components/Tabs/Tabs.js +1 -1
- package/es6/components/ThumbsRating/README.md +2 -0
- package/es6/components/ThumbsRating/ThumbsRating.js +35 -0
- package/es6/components/ThumbsRating/index.d.ts +7 -0
- package/es6/components/ThumbsRating/index.js +1 -0
- package/es6/components/ThumbsRating/stories/simple.js +15 -0
- package/es6/components/Toolbar/README.md +2 -0
- package/es6/components/Toolbar/Toolbar.js +30 -0
- package/es6/components/Toolbar/index.d.ts +15 -0
- package/es6/components/Toolbar/index.js +1 -0
- package/es6/components/Toolbar/propTypes.js +5 -0
- package/es6/components/Toolbar/stories/Simple.js +46 -0
- package/es6/components/index.d.ts +9 -0
- package/es6/components/index.js +10 -0
- package/es6/contexts/DataContext.js +4 -0
- package/es6/contexts/index.js +1 -0
- package/es6/index.d.ts +2 -0
- package/es6/languages/default.json +23 -0
- package/es6/themes/base.d.ts +14 -0
- package/es6/themes/base.js +29 -2
- package/es6/utils/DOM.js +4 -3
- package/es6/utils/refs.js +3 -19
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/index.d.ts +2 -0
- package/languages/default.json +23 -0
- package/package.json +34 -34
- package/themes/base.d.ts +14 -0
- package/themes/base.js +29 -2
- package/utils/DOM.js +4 -3
- package/utils/refs.js +2 -18
|
@@ -61,8 +61,7 @@ var Accordion = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
61
61
|
};
|
|
62
62
|
}, [activeIndexes, animate, multiple, onActive]);
|
|
63
63
|
return /*#__PURE__*/_react["default"].createElement(_Box.Box, _extends({
|
|
64
|
-
ref: ref
|
|
65
|
-
role: "tablist"
|
|
64
|
+
ref: ref
|
|
66
65
|
}, rest), _react.Children.toArray(children).filter(function (child) {
|
|
67
66
|
return child;
|
|
68
67
|
}).map(function (child, index) {
|
|
@@ -76,8 +76,6 @@ var AccordionPanel = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
76
76
|
border: panelBorder,
|
|
77
77
|
margin: abutMargin
|
|
78
78
|
}, /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
79
|
-
role: "tab",
|
|
80
|
-
"aria-selected": active,
|
|
81
79
|
"aria-expanded": active,
|
|
82
80
|
plain: theme.button["default"] ? true : undefined,
|
|
83
81
|
onClick: onPanelChange,
|
|
@@ -125,6 +123,7 @@ var AccordionPanel = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
125
123
|
}, /*#__PURE__*/_react["default"].createElement(AccordionIcon, {
|
|
126
124
|
color: iconColor
|
|
127
125
|
})))), /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
126
|
+
role: "region",
|
|
128
127
|
border: contentBorder
|
|
129
128
|
}, animate ? /*#__PURE__*/_react["default"].createElement(_Collapsible.Collapsible, {
|
|
130
129
|
open: active
|
package/components/Box/Box.js
CHANGED
|
@@ -11,7 +11,8 @@ var _StyledBox = require("./StyledBox");
|
|
|
11
11
|
var _propTypes = require("./propTypes");
|
|
12
12
|
var _Skeleton = require("../Skeleton");
|
|
13
13
|
var _AnnounceContext = require("../../contexts/AnnounceContext");
|
|
14
|
-
var
|
|
14
|
+
var _OptionsContext = require("../../contexts/OptionsContext");
|
|
15
|
+
var _excluded = ["a11yTitle", "background", "border", "children", "cssGap", "direction", "elevation", "fill", "gap", "kind", "onBlur", "onClick", "onFocus", "overflow", "responsive", "tag", "as", "wrap", "width", "height", "tabIndex", "skeleton"],
|
|
15
16
|
_excluded2 = ["colors", "size"];
|
|
16
17
|
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); }
|
|
17
18
|
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,6 +23,7 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
22
23
|
backgroundProp = _ref.background,
|
|
23
24
|
border = _ref.border,
|
|
24
25
|
children = _ref.children,
|
|
26
|
+
cssGap = _ref.cssGap,
|
|
25
27
|
_ref$direction = _ref.direction,
|
|
26
28
|
direction = _ref$direction === void 0 ? 'column' : _ref$direction,
|
|
27
29
|
elevation = _ref.elevation,
|
|
@@ -43,6 +45,10 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
43
45
|
skeletonProp = _ref.skeleton,
|
|
44
46
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
45
47
|
var theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _defaultProps.defaultProps.theme;
|
|
48
|
+
// boxOptions was created to preserve backwards compatibility but
|
|
49
|
+
// should not be supported in v3
|
|
50
|
+
var _useContext = (0, _react.useContext)(_OptionsContext.OptionsContext),
|
|
51
|
+
boxOptions = _useContext.box;
|
|
46
52
|
var skeleton = (0, _Skeleton.useSkeleton)();
|
|
47
53
|
var background = backgroundProp;
|
|
48
54
|
var announce = (0, _react.useContext)(_AnnounceContext.AnnounceContext);
|
|
@@ -89,7 +95,9 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
89
95
|
console.warn('Box must have a gap to use border between');
|
|
90
96
|
}
|
|
91
97
|
var contents = children;
|
|
92
|
-
if (gap && gap !== 'none')
|
|
98
|
+
if (gap && gap !== 'none' && (!(boxOptions != null && boxOptions.cssGap || cssGap) ||
|
|
99
|
+
// need this approach to show border between
|
|
100
|
+
border === 'between' || (border == null ? void 0 : border.side) === 'between')) {
|
|
93
101
|
var boxAs = !as && tag ? tag : as;
|
|
94
102
|
contents = [];
|
|
95
103
|
var firstIndex;
|
|
@@ -175,6 +183,7 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
175
183
|
elevationProp: elevation,
|
|
176
184
|
fillProp: fill,
|
|
177
185
|
focus: focus,
|
|
186
|
+
gap: ((boxOptions == null ? void 0 : boxOptions.cssGap) || cssGap) && gap && gap !== 'none' && border !== 'between' && (border == null ? void 0 : border.side) !== 'between' && gap,
|
|
178
187
|
kindProp: kind,
|
|
179
188
|
overflowProp: overflow,
|
|
180
189
|
wrapProp: wrap,
|
|
@@ -128,12 +128,35 @@ var interactiveStyle = (0, _styledComponents.css)(["cursor:pointer;&:hover{", "
|
|
|
128
128
|
}, function (props) {
|
|
129
129
|
return props.hoverIndicator && (0, _utils.getHoverIndicatorStyle)(props.hoverIndicator, props.theme);
|
|
130
130
|
});
|
|
131
|
+
var gapStyle = function gapStyle(directionProp, gap, responsive, wrap, theme) {
|
|
132
|
+
var metric = theme.global.edgeSize[gap] || gap;
|
|
133
|
+
var breakpoint = (0, _utils.getBreakpointStyle)(theme, theme.box.responsiveBreakpoint);
|
|
134
|
+
var responsiveMetric = responsive && breakpoint && breakpoint.edgeSize[gap];
|
|
135
|
+
var styles = [];
|
|
136
|
+
if (directionProp === 'column' || directionProp === 'column-reverse') {
|
|
137
|
+
styles.push("row-gap: " + metric + ";");
|
|
138
|
+
if (responsiveMetric) {
|
|
139
|
+
styles.push((0, _utils.breakpointStyle)(breakpoint, "row-gap: " + responsiveMetric + ";"));
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
styles.push("column-gap: " + metric + ";");
|
|
143
|
+
if (wrap) styles.push("row-gap: " + metric + ";");
|
|
144
|
+
if (responsiveMetric) {
|
|
145
|
+
if (directionProp === 'row' || directionProp === 'row-reverse') {
|
|
146
|
+
styles.push((0, _utils.breakpointStyle)(breakpoint, "column-gap: " + responsiveMetric + ";"));
|
|
147
|
+
} else if (directionProp === 'row-responsive') {
|
|
148
|
+
styles.push((0, _utils.breakpointStyle)(breakpoint, "\n row-gap: " + responsiveMetric + ";\n "));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return styles;
|
|
153
|
+
};
|
|
131
154
|
|
|
132
155
|
// NOTE: basis must be after flex! Otherwise, flex overrides basis
|
|
133
156
|
var StyledBox = _styledComponents["default"].div.withConfig({
|
|
134
157
|
displayName: "StyledBox",
|
|
135
158
|
componentId: "sc-13pk1d4-0"
|
|
136
|
-
})(["display:flex;box-sizing:border-box;", ";", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
|
|
159
|
+
})(["display:flex;box-sizing:border-box;", ";", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
|
|
137
160
|
return !props.basis && 'max-width: 100%;';
|
|
138
161
|
}, _utils.genericStyles, function (props) {
|
|
139
162
|
return props.align && _utils.alignStyle;
|
|
@@ -167,6 +190,8 @@ var StyledBox = _styledComponents["default"].div.withConfig({
|
|
|
167
190
|
return props.overflowProp && (0, _utils.overflowStyle)(props.overflowProp);
|
|
168
191
|
}, function (props) {
|
|
169
192
|
return props.elevationProp && elevationStyle(props.elevationProp);
|
|
193
|
+
}, function (props) {
|
|
194
|
+
return props.gap && gapStyle(props.directionProp, props.gap, props.responsive, props.wrapProp, props.theme);
|
|
170
195
|
}, function (props) {
|
|
171
196
|
return props.animation && animationStyle;
|
|
172
197
|
}, function (props) {
|
|
@@ -179,7 +204,9 @@ var StyledBox = _styledComponents["default"].div.withConfig({
|
|
|
179
204
|
return props.kindProp && props.kindProp.extend;
|
|
180
205
|
});
|
|
181
206
|
exports.StyledBox = StyledBox;
|
|
182
|
-
|
|
207
|
+
StyledBox.defaultProps = {};
|
|
208
|
+
Object.setPrototypeOf(StyledBox.defaultProps, _defaultProps.defaultProps);
|
|
209
|
+
var gapGapStyle = function gapGapStyle(directionProp, gap, responsive, border, theme) {
|
|
183
210
|
var metric = theme.global.edgeSize[gap] || gap;
|
|
184
211
|
var breakpoint = (0, _utils.getBreakpointStyle)(theme, theme.box.responsiveBreakpoint);
|
|
185
212
|
var responsiveMetric = responsive && breakpoint && breakpoint.edgeSize[gap];
|
|
@@ -232,13 +259,11 @@ var gapStyle = function gapStyle(directionProp, gap, responsive, border, theme)
|
|
|
232
259
|
}
|
|
233
260
|
return styles;
|
|
234
261
|
};
|
|
235
|
-
StyledBox.defaultProps = {};
|
|
236
|
-
Object.setPrototypeOf(StyledBox.defaultProps, _defaultProps.defaultProps);
|
|
237
262
|
var StyledBoxGap = _styledComponents["default"].div.withConfig({
|
|
238
263
|
displayName: "StyledBox__StyledBoxGap",
|
|
239
264
|
componentId: "sc-13pk1d4-1"
|
|
240
265
|
})(["flex:0 0 auto;align-self:stretch;", ";"], function (props) {
|
|
241
|
-
return props.gap &&
|
|
266
|
+
return props.gap && gapGapStyle(props.directionProp, props.gap, props.responsive, props.border, props.theme);
|
|
242
267
|
});
|
|
243
268
|
exports.StyledBoxGap = StyledBoxGap;
|
|
244
269
|
StyledBoxGap.defaultProps = {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Cards = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _styledComponents = require("styled-components");
|
|
7
|
+
var _DataContext = require("../../contexts/DataContext");
|
|
8
|
+
var _Box = require("../Box");
|
|
9
|
+
var _Card = require("../Card");
|
|
10
|
+
var _CardBody = require("../CardBody");
|
|
11
|
+
var _Grid = require("../Grid");
|
|
12
|
+
var _InfiniteScroll = require("../InfiniteScroll");
|
|
13
|
+
var _Pagination = require("../Pagination");
|
|
14
|
+
var _utils = require("../../utils");
|
|
15
|
+
var _propTypes = require("./propTypes");
|
|
16
|
+
var _excluded = ["as", "children", "data", "margin", "onMore", "pad", "paginate", "show", "size", "step"];
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
var emptyData = [];
|
|
22
|
+
var Cards = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
23
|
+
var _ref$as = _ref.as,
|
|
24
|
+
as = _ref$as === void 0 ? 'ul' : _ref$as,
|
|
25
|
+
children = _ref.children,
|
|
26
|
+
dataProp = _ref.data,
|
|
27
|
+
margin = _ref.margin,
|
|
28
|
+
onMore = _ref.onMore,
|
|
29
|
+
pad = _ref.pad,
|
|
30
|
+
paginate = _ref.paginate,
|
|
31
|
+
showProp = _ref.show,
|
|
32
|
+
_ref$size = _ref.size,
|
|
33
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
34
|
+
_ref$step = _ref.step,
|
|
35
|
+
step = _ref$step === void 0 ? paginate ? 50 : undefined : _ref$step,
|
|
36
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
37
|
+
var theme = (0, _react.useContext)(_styledComponents.ThemeContext);
|
|
38
|
+
var _useContext = (0, _react.useContext)(_DataContext.DataContext),
|
|
39
|
+
contextData = _useContext.data;
|
|
40
|
+
var data = dataProp || contextData || emptyData;
|
|
41
|
+
var _usePagination = (0, _utils.usePagination)(_extends({
|
|
42
|
+
data: data,
|
|
43
|
+
page: (0, _utils.normalizeShow)(showProp, step),
|
|
44
|
+
step: step
|
|
45
|
+
}, paginate)),
|
|
46
|
+
items = _usePagination[0],
|
|
47
|
+
paginationProps = _usePagination[1];
|
|
48
|
+
var Container = paginate ? _Box.Box : _react.Fragment;
|
|
49
|
+
var containerProps = paginate ? _extends({}, theme.cards.container, {
|
|
50
|
+
pad: pad,
|
|
51
|
+
margin: margin
|
|
52
|
+
}) : undefined;
|
|
53
|
+
return /*#__PURE__*/_react["default"].createElement(Container, containerProps, /*#__PURE__*/_react["default"].createElement(_Grid.Grid, _extends({
|
|
54
|
+
ref: ref,
|
|
55
|
+
as: as,
|
|
56
|
+
columns: size,
|
|
57
|
+
gap: "medium",
|
|
58
|
+
margin: !paginate && margin || 'none',
|
|
59
|
+
pad: !paginate && pad || 'none'
|
|
60
|
+
}, rest), /*#__PURE__*/_react["default"].createElement(_InfiniteScroll.InfiniteScroll, {
|
|
61
|
+
items: !paginate ? data : items,
|
|
62
|
+
onMore: onMore,
|
|
63
|
+
show: !paginate ? showProp : undefined,
|
|
64
|
+
step: step,
|
|
65
|
+
renderMarker: function renderMarker(marker) {
|
|
66
|
+
return /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
67
|
+
as: "li",
|
|
68
|
+
flex: false
|
|
69
|
+
}, marker);
|
|
70
|
+
}
|
|
71
|
+
}, function (item, index) {
|
|
72
|
+
var _ref2, _ref3;
|
|
73
|
+
return children ? children(item, index) : /*#__PURE__*/_react["default"].createElement(_Card.Card, {
|
|
74
|
+
key: index.toString(),
|
|
75
|
+
as: as === 'ul' ? 'li' : undefined
|
|
76
|
+
}, /*#__PURE__*/_react["default"].createElement(_CardBody.CardBody, null, (_ref2 = (_ref3 = typeof item === 'string' && item) != null ? _ref3 : typeof item === 'object' && Object.values(item)[0]) != null ? _ref2 : index));
|
|
77
|
+
})), paginate && data.length > step && items && items.length ? /*#__PURE__*/_react["default"].createElement(_Pagination.Pagination, _extends({
|
|
78
|
+
alignSelf: "end"
|
|
79
|
+
}, paginationProps)) : null);
|
|
80
|
+
});
|
|
81
|
+
exports.Cards = Cards;
|
|
82
|
+
Cards.displayName = 'Cards';
|
|
83
|
+
Cards.propTypes = _propTypes.CardsPropTypes;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
A11yTitleType,
|
|
4
|
+
AlignSelfType,
|
|
5
|
+
GridAreaType,
|
|
6
|
+
MarginType,
|
|
7
|
+
PadType,
|
|
8
|
+
} from '../../utils';
|
|
9
|
+
import { GridSizeType } from '../Grid';
|
|
10
|
+
import { PaginationType } from '../Pagination';
|
|
11
|
+
|
|
12
|
+
export interface CardsProps<CardType = any> {
|
|
13
|
+
a11yTitle?: A11yTitleType;
|
|
14
|
+
alignSelf?: AlignSelfType;
|
|
15
|
+
as?: string;
|
|
16
|
+
children?: (item: CardType, index: number) => JSX.Element;
|
|
17
|
+
data?: CardType[];
|
|
18
|
+
gridArea?: GridAreaType;
|
|
19
|
+
margin?: MarginType;
|
|
20
|
+
onMore?: () => void;
|
|
21
|
+
pad?: PadType;
|
|
22
|
+
paginate?: boolean | PaginationType;
|
|
23
|
+
show?: number | { page?: number };
|
|
24
|
+
size?: GridSizeType;
|
|
25
|
+
step?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type ulProps = Omit<JSX.IntrinsicElements['ul'], 'children'>;
|
|
29
|
+
|
|
30
|
+
export interface CardsExtendedProps<CardType>
|
|
31
|
+
extends CardsProps<CardType>,
|
|
32
|
+
ulProps {}
|
|
33
|
+
|
|
34
|
+
declare class Cards<CardType = any> extends React.Component<
|
|
35
|
+
CardsExtendedProps<CardType>
|
|
36
|
+
> {}
|
|
37
|
+
|
|
38
|
+
export { Cards };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.CardsPropTypes = void 0;
|
|
5
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
6
|
+
var _generalPropTypes = require("../../utils/general-prop-types");
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
+
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); }
|
|
9
|
+
var PropType = {};
|
|
10
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
11
|
+
PropType = _extends({}, _generalPropTypes.genericProps, {
|
|
12
|
+
as: _propTypes["default"].string,
|
|
13
|
+
data: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].shape({})])),
|
|
14
|
+
children: _propTypes["default"].func,
|
|
15
|
+
onMore: _propTypes["default"].func,
|
|
16
|
+
paginate: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].object]),
|
|
17
|
+
show: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].shape({
|
|
18
|
+
page: _propTypes["default"].number
|
|
19
|
+
})]),
|
|
20
|
+
step: _propTypes["default"].number
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
var CardsPropTypes = PropType;
|
|
24
|
+
exports.CardsPropTypes = CardsPropTypes;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Children = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _grommet = require("grommet");
|
|
7
|
+
var _Cards = require("../Cards");
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
var data = [{
|
|
10
|
+
city: 'Boise',
|
|
11
|
+
state: 'Idaho'
|
|
12
|
+
}, {
|
|
13
|
+
city: 'Fort Collins',
|
|
14
|
+
state: 'Colorado'
|
|
15
|
+
}, {
|
|
16
|
+
city: 'Bay Area',
|
|
17
|
+
state: 'California'
|
|
18
|
+
}, {
|
|
19
|
+
city: 'San Diego',
|
|
20
|
+
state: 'California'
|
|
21
|
+
}, {
|
|
22
|
+
city: 'San Francisco',
|
|
23
|
+
state: 'California'
|
|
24
|
+
}];
|
|
25
|
+
var Children = function Children() {
|
|
26
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Grid, {
|
|
27
|
+
pad: "large",
|
|
28
|
+
columns: [['medium', 'large']],
|
|
29
|
+
justifyContent: "center"
|
|
30
|
+
}, /*#__PURE__*/_react["default"].createElement(_Cards.Cards, {
|
|
31
|
+
data: data,
|
|
32
|
+
pad: "medium",
|
|
33
|
+
border: false
|
|
34
|
+
}, function (datum) {
|
|
35
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Card, {
|
|
36
|
+
key: datum.city,
|
|
37
|
+
as: "li"
|
|
38
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.CardBody, null, /*#__PURE__*/_react["default"].createElement(_grommet.Heading, {
|
|
39
|
+
level: 2,
|
|
40
|
+
size: "small",
|
|
41
|
+
margin: "none"
|
|
42
|
+
}, datum.city)), /*#__PURE__*/_react["default"].createElement(_grommet.CardFooter, null, datum.state));
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
exports.Children = Children;
|
|
46
|
+
var _default = {
|
|
47
|
+
title: 'Visualizations/Cards/Children'
|
|
48
|
+
};
|
|
49
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Paginated = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _grommet = require("grommet");
|
|
7
|
+
var _Cards = require("../Cards");
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
var data = [];
|
|
10
|
+
for (var i = 0; i < 95; i += 1) {
|
|
11
|
+
data.push("item " + (i + 1));
|
|
12
|
+
}
|
|
13
|
+
var Paginated = function Paginated() {
|
|
14
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Grid, {
|
|
15
|
+
pad: "large",
|
|
16
|
+
columns: [['medium', 'large']],
|
|
17
|
+
justifyContent: "center"
|
|
18
|
+
}, /*#__PURE__*/_react["default"].createElement(_Cards.Cards, {
|
|
19
|
+
data: data,
|
|
20
|
+
step: 9,
|
|
21
|
+
show: {
|
|
22
|
+
page: 7
|
|
23
|
+
},
|
|
24
|
+
paginate: true
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
exports.Paginated = Paginated;
|
|
28
|
+
var _default = {
|
|
29
|
+
title: 'Visualizations/Cards/Paginated'
|
|
30
|
+
};
|
|
31
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Simple = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _grommet = require("grommet");
|
|
7
|
+
var _Cards = require("../Cards");
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
var locations = ['Boise', 'Fort Collins', 'Los Gatos', 'Palo Alto', 'San Francisco'];
|
|
10
|
+
var Simple = function Simple() {
|
|
11
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Grid, {
|
|
12
|
+
pad: "large",
|
|
13
|
+
columns: [['medium', 'large']],
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
gap: "large"
|
|
16
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Notification, {
|
|
17
|
+
status: "info",
|
|
18
|
+
message: "Cards is in 'beta'. The API surface is subject to change."
|
|
19
|
+
}), /*#__PURE__*/_react["default"].createElement(_Cards.Cards, {
|
|
20
|
+
a11yTitle: "Locations",
|
|
21
|
+
data: locations
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
exports.Simple = Simple;
|
|
25
|
+
var _default = {
|
|
26
|
+
title: 'Visualizations/Cards/Simple'
|
|
27
|
+
};
|
|
28
|
+
exports["default"] = _default;
|
|
@@ -36,7 +36,7 @@ var Collapsible = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
36
36
|
return direction === 'horizontal' ? 'width' : 'height';
|
|
37
37
|
}, [direction]);
|
|
38
38
|
var containerRef = (0, _utils.useForwardedRef)(ref);
|
|
39
|
-
var sizeRef = (0, _react.useRef)();
|
|
39
|
+
var sizeRef = (0, _react.useRef)(0);
|
|
40
40
|
var shouldOpen = !open && openArg;
|
|
41
41
|
var shouldClose = open && !openArg;
|
|
42
42
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Data = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _Box = require("../Box");
|
|
7
|
+
var _DataFilters = require("../DataFilters");
|
|
8
|
+
var _DataSearch = require("../DataSearch");
|
|
9
|
+
var _DataSummary = require("../DataSummary");
|
|
10
|
+
var _Toolbar = require("../Toolbar");
|
|
11
|
+
var _DataContext = require("../../contexts/DataContext");
|
|
12
|
+
var _propTypes = require("./propTypes");
|
|
13
|
+
var _filter = require("./filter");
|
|
14
|
+
var _excluded = ["children", "data", "id", "messages", "onView", "properties", "toolbar", "total", "updateOn", "view"];
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
var defaultView = {
|
|
20
|
+
search: '',
|
|
21
|
+
properties: {}
|
|
22
|
+
};
|
|
23
|
+
var Data = function Data(_ref) {
|
|
24
|
+
var children = _ref.children,
|
|
25
|
+
dataProp = _ref.data,
|
|
26
|
+
_ref$id = _ref.id,
|
|
27
|
+
id = _ref$id === void 0 ? 'data' : _ref$id,
|
|
28
|
+
messages = _ref.messages,
|
|
29
|
+
onView = _ref.onView,
|
|
30
|
+
properties = _ref.properties,
|
|
31
|
+
toolbar = _ref.toolbar,
|
|
32
|
+
total = _ref.total,
|
|
33
|
+
_ref$updateOn = _ref.updateOn,
|
|
34
|
+
updateOn = _ref$updateOn === void 0 ? 'submit' : _ref$updateOn,
|
|
35
|
+
viewProp = _ref.view,
|
|
36
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
37
|
+
var _useState = (0, _react.useState)(viewProp),
|
|
38
|
+
view = _useState[0],
|
|
39
|
+
setView = _useState[1];
|
|
40
|
+
(0, _react.useEffect)(function () {
|
|
41
|
+
return setView(viewProp);
|
|
42
|
+
}, [viewProp]);
|
|
43
|
+
var data = (0, _react.useMemo)(function () {
|
|
44
|
+
if (onView) return dataProp;
|
|
45
|
+
return (0, _filter.filter)(dataProp, view, properties);
|
|
46
|
+
}, [dataProp, onView, properties, view]);
|
|
47
|
+
|
|
48
|
+
// what we use for DataContext value
|
|
49
|
+
var contextValue = (0, _react.useMemo)(function () {
|
|
50
|
+
var result = {
|
|
51
|
+
id: id,
|
|
52
|
+
messages: messages,
|
|
53
|
+
properties: properties,
|
|
54
|
+
updateOn: updateOn,
|
|
55
|
+
view: view
|
|
56
|
+
};
|
|
57
|
+
if (view != null && view.search || view != null && view.sort || view != null && view.properties && Object.keys(view.properties).length) {
|
|
58
|
+
result.clearFilters = function () {
|
|
59
|
+
var nextView = defaultView;
|
|
60
|
+
setView(nextView);
|
|
61
|
+
if (onView) onView(nextView);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
result.onView = function (nextView) {
|
|
65
|
+
setView(nextView);
|
|
66
|
+
if (onView) onView(nextView);
|
|
67
|
+
};
|
|
68
|
+
result.data = data;
|
|
69
|
+
result.unfilteredData = dataProp;
|
|
70
|
+
result.total = total !== undefined ? total : dataProp.length;
|
|
71
|
+
return result;
|
|
72
|
+
}, [data, dataProp, id, messages, onView, properties, total, updateOn, view]);
|
|
73
|
+
var toolbarContent;
|
|
74
|
+
if (toolbar) {
|
|
75
|
+
toolbarContent = [/*#__PURE__*/_react["default"].createElement(_Toolbar.Toolbar, {
|
|
76
|
+
key: "toolbar"
|
|
77
|
+
}, (toolbar === true || toolbar === 'search') && /*#__PURE__*/_react["default"].createElement(_DataSearch.DataSearch, null), (toolbar === true || toolbar === 'filters') && /*#__PURE__*/_react["default"].createElement(_DataFilters.DataFilters, {
|
|
78
|
+
drop: true
|
|
79
|
+
})), /*#__PURE__*/_react["default"].createElement(_DataSummary.DataSummary, {
|
|
80
|
+
key: "summary"
|
|
81
|
+
})];
|
|
82
|
+
}
|
|
83
|
+
return /*#__PURE__*/_react["default"].createElement(_DataContext.DataContext.Provider, {
|
|
84
|
+
value: contextValue
|
|
85
|
+
}, /*#__PURE__*/_react["default"].createElement(_Box.Box, _extends({
|
|
86
|
+
id: id,
|
|
87
|
+
flex: false
|
|
88
|
+
}, rest), toolbarContent, children));
|
|
89
|
+
};
|
|
90
|
+
exports.Data = Data;
|
|
91
|
+
Data.propTypes = _propTypes.DataPropTypes;
|