grommet 2.48.0 → 2.50.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/AccordionPanel/AccordionPanel.js +3 -6
- package/components/Anchor/StyledAnchor.js +1 -1
- package/components/Box/StyledBox.js +1 -1
- package/components/Button/BusyAnimation.js +5 -1
- package/components/Button/Button.js +3 -1
- package/components/Calendar/Calendar.js +7 -10
- package/components/Cards/Cards.js +3 -4
- package/components/Chart/Chart.js +11 -9
- package/components/Chart/calcs.js +21 -13
- package/components/CheckBox/CheckBox.js +1 -1
- package/components/CheckBoxGroup/CheckBoxGroup.js +2 -3
- package/components/Data/Data.js +5 -1
- package/components/Data/DataForm.js +6 -4
- package/components/Data/stories/Infinite.stories.js +10 -15
- package/components/Data/stories/OnSelect.stories.js +10 -15
- package/components/Data/stories/SpaceX.stories.js +10 -15
- package/components/Data/stories/StarWars.stories.js +6 -8
- package/components/DataChart/DataChart.js +14 -12
- package/components/DataChart/Detail.js +2 -2
- package/components/DataChart/Legend.js +8 -9
- package/components/DataChart/utils.js +15 -8
- package/components/DataFilter/DataFilter.js +10 -9
- package/components/DataFilters/DataFilters.js +9 -10
- package/components/DataSearch/DataSearch.js +5 -4
- package/components/DataSort/DataSort.js +4 -3
- package/components/DataSummary/DataSummary.js +6 -6
- package/components/DataTable/ExpanderCell.js +6 -3
- package/components/DataTable/Footer.js +6 -3
- package/components/DataTable/Header.js +6 -3
- package/components/DataTable/Resizer.js +22 -8
- package/components/DataTable/Searcher.js +5 -7
- package/components/DataTable/stories/ResizePinned.stories.js +321 -0
- package/components/DataTable/stories/SpaceX.stories.js +15 -16
- package/components/DataTable/stories/SpaceXUngrouped.stories.js +7 -7
- package/components/DataTable/stories/rowDetails.stories.js +6 -8
- package/components/DataTableColumns/DataTableColumns.js +24 -22
- package/components/DateInput/DateInput.js +7 -6
- package/components/Distribution/Distribution.js +8 -5
- package/components/FileInput/FileInput.js +41 -36
- package/components/Footer/Footer.js +5 -1
- package/components/Header/Header.js +2 -2
- package/components/Layer/Layer.js +10 -5
- package/components/Layer/StyledLayer.js +2 -2
- package/components/List/List.js +5 -4
- package/components/MaskedInput/MaskedInput.js +6 -1
- package/components/Menu/Menu.js +13 -1
- package/components/Meter/Bar.js +38 -17
- package/components/Meter/Circle.js +31 -46
- package/components/Meter/stories/Circle.stories.js +6 -8
- package/components/Meter/utils.js +15 -1
- package/components/Nav/Nav.js +5 -1
- package/components/Notification/Notification.js +6 -8
- package/components/Pagination/Pagination.js +5 -10
- package/components/Pagination/PaginationStep.js +2 -1
- package/components/Paragraph/ParagraphSkeleton.js +2 -1
- package/components/RadioButton/RadioButton.js +1 -1
- package/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
- package/components/RangeSelector/RangeSelector.js +2 -6
- package/components/Select/SelectContainer.js +2 -1
- package/components/SelectMultiple/SelectMultipleContainer.js +8 -4
- package/components/SelectMultiple/SelectMultipleValue.js +5 -7
- package/components/SelectMultiple/SelectionSummary.js +7 -8
- package/components/Sidebar/Sidebar.js +6 -3
- package/components/Spinner/Spinner.js +7 -4
- package/components/StarRating/StarRating.js +8 -5
- package/components/Tab/Tab.js +2 -1
- package/components/Table/StyledTable.js +2 -2
- package/components/Tabs/Tabs.js +8 -12
- package/components/Tag/StyledTag.js +9 -1
- package/components/TextInput/CopyButton.js +3 -2
- package/components/TextInput/TextInput.js +5 -0
- package/components/ThumbsRating/ThumbsRating.js +15 -10
- package/components/Toolbar/Toolbar.js +15 -11
- package/components/Video/Video.js +3 -5
- package/es6/components/AccordionPanel/AccordionPanel.js +3 -6
- package/es6/components/Anchor/StyledAnchor.js +2 -2
- package/es6/components/Box/StyledBox.js +1 -1
- package/es6/components/Button/BusyAnimation.js +5 -1
- package/es6/components/Button/Button.js +3 -1
- package/es6/components/Calendar/Calendar.js +7 -10
- package/es6/components/Cards/Cards.js +3 -4
- package/es6/components/Chart/Chart.js +11 -9
- package/es6/components/Chart/calcs.js +21 -13
- package/es6/components/CheckBox/CheckBox.js +1 -1
- package/es6/components/CheckBoxGroup/CheckBoxGroup.js +2 -3
- package/es6/components/Data/Data.js +5 -1
- package/es6/components/Data/DataForm.js +6 -4
- package/es6/components/Data/stories/Infinite.stories.js +10 -15
- package/es6/components/Data/stories/OnSelect.stories.js +10 -15
- package/es6/components/Data/stories/SpaceX.stories.js +10 -15
- package/es6/components/Data/stories/StarWars.stories.js +6 -8
- package/es6/components/DataChart/DataChart.js +14 -12
- package/es6/components/DataChart/Detail.js +2 -2
- package/es6/components/DataChart/Legend.js +8 -9
- package/es6/components/DataChart/utils.js +15 -8
- package/es6/components/DataFilter/DataFilter.js +10 -9
- package/es6/components/DataFilters/DataFilters.js +9 -10
- package/es6/components/DataSearch/DataSearch.js +5 -4
- package/es6/components/DataSort/DataSort.js +4 -3
- package/es6/components/DataSummary/DataSummary.js +6 -6
- package/es6/components/DataTable/ExpanderCell.js +4 -1
- package/es6/components/DataTable/Footer.js +4 -1
- package/es6/components/DataTable/Header.js +6 -3
- package/es6/components/DataTable/Resizer.js +22 -8
- package/es6/components/DataTable/Searcher.js +5 -7
- package/es6/components/DataTable/stories/ResizePinned.stories.js +316 -0
- package/es6/components/DataTable/stories/SpaceX.stories.js +15 -16
- package/es6/components/DataTable/stories/SpaceXUngrouped.stories.js +7 -7
- package/es6/components/DataTable/stories/rowDetails.stories.js +6 -8
- package/es6/components/DataTableColumns/DataTableColumns.js +23 -21
- package/es6/components/DateInput/DateInput.js +6 -5
- package/es6/components/Distribution/Distribution.js +8 -5
- package/es6/components/FileInput/FileInput.js +42 -37
- package/es6/components/Footer/Footer.js +5 -1
- package/es6/components/Header/Header.js +2 -2
- package/es6/components/Layer/Layer.js +10 -5
- package/es6/components/Layer/StyledLayer.js +3 -3
- package/es6/components/List/List.js +5 -4
- package/es6/components/MaskedInput/MaskedInput.js +6 -1
- package/es6/components/Menu/Menu.js +13 -1
- package/es6/components/Meter/Bar.js +39 -18
- package/es6/components/Meter/Circle.js +33 -48
- package/es6/components/Meter/stories/Circle.stories.js +7 -9
- package/es6/components/Meter/utils.js +14 -0
- package/es6/components/Nav/Nav.js +5 -1
- package/es6/components/Notification/Notification.js +6 -8
- package/es6/components/Pagination/Pagination.js +5 -10
- package/es6/components/Pagination/PaginationStep.js +2 -1
- package/es6/components/Paragraph/ParagraphSkeleton.js +2 -1
- package/es6/components/RadioButton/RadioButton.js +1 -1
- package/es6/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
- package/es6/components/RangeSelector/RangeSelector.js +2 -6
- package/es6/components/Select/SelectContainer.js +2 -1
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +8 -4
- package/es6/components/SelectMultiple/SelectMultipleValue.js +5 -7
- package/es6/components/SelectMultiple/SelectionSummary.js +7 -8
- package/es6/components/Sidebar/Sidebar.js +6 -3
- package/es6/components/Spinner/Spinner.js +6 -3
- package/es6/components/StarRating/StarRating.js +8 -5
- package/es6/components/Tab/Tab.js +2 -1
- package/es6/components/Table/StyledTable.js +2 -2
- package/es6/components/Tabs/Tabs.js +8 -12
- package/es6/components/Tag/StyledTag.js +10 -2
- package/es6/components/TextInput/CopyButton.js +3 -2
- package/es6/components/TextInput/TextInput.js +5 -0
- package/es6/components/ThumbsRating/ThumbsRating.js +15 -10
- package/es6/components/Toolbar/Toolbar.js +15 -11
- package/es6/components/Video/Video.js +3 -5
- package/es6/themes/base.d.ts +284 -4
- package/es6/themes/base.js +369 -21
- package/es6/utils/graphics.js +123 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/package.json +46 -46
- package/themes/base.d.ts +284 -4
- package/themes/base.js +369 -21
- package/utils/graphics.js +124 -1
|
@@ -16,6 +16,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
16
16
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
17
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
18
18
|
var AccordionPanel = exports.AccordionPanel = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
19
|
+
var _theme$accordion$labe, _theme$accordion$icon;
|
|
19
20
|
var children = _ref.children,
|
|
20
21
|
header = _ref.header,
|
|
21
22
|
id = _ref.id,
|
|
@@ -110,17 +111,13 @@ var AccordionPanel = exports.AccordionPanel = /*#__PURE__*/(0, _react.forwardRef
|
|
|
110
111
|
justify: "between",
|
|
111
112
|
id: id
|
|
112
113
|
}, rest), typeof label === 'string' ? /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
113
|
-
pad:
|
|
114
|
-
horizontal: 'xsmall'
|
|
115
|
-
}
|
|
114
|
+
pad: (_theme$accordion$labe = theme.accordion.label) == null || (_theme$accordion$labe = _theme$accordion$labe.container) == null ? void 0 : _theme$accordion$labe.pad
|
|
116
115
|
}, /*#__PURE__*/_react["default"].createElement(_Heading.Heading, {
|
|
117
116
|
level: level || theme.accordion.heading && theme.accordion.heading.level || 4,
|
|
118
117
|
margin: theme.accordion.heading && theme.accordion.heading.margin || undefined,
|
|
119
118
|
color: hover
|
|
120
119
|
}, label)) : label, AccordionIcon && /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
121
|
-
pad:
|
|
122
|
-
horizontal: 'small'
|
|
123
|
-
},
|
|
120
|
+
pad: (_theme$accordion$icon = theme.accordion.icon) == null || (_theme$accordion$icon = _theme$accordion$icon.container) == null ? void 0 : _theme$accordion$icon.pad,
|
|
124
121
|
width: {
|
|
125
122
|
min: 'fit-content'
|
|
126
123
|
}
|
|
@@ -31,7 +31,7 @@ var StyledAnchor = exports.StyledAnchor = _styledComponents["default"].a.withCon
|
|
|
31
31
|
}, _utils.genericStyles, function (props) {
|
|
32
32
|
return !props.disabled && props.theme.anchor.hover && (0, _styledComponents.css)(["&:hover{", " ", " ", "}"], props.theme.anchor.hover.textDecoration && "text-decoration: " + props.theme.anchor.hover.textDecoration + ";", props.theme.anchor.hover.fontWeight && "font-weight: " + props.theme.anchor.hover.fontWeight + ";", props.theme.anchor.hover.extend);
|
|
33
33
|
}, function (props) {
|
|
34
|
-
return props.hasIcon && !props.hasLabel &&
|
|
34
|
+
return props.hasIcon && !props.hasLabel && (0, _utils.edgeStyle)('padding', props.theme.anchor.iconOnly.pad, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
|
|
35
35
|
}, function (props) {
|
|
36
36
|
return props.disabled && disabledStyle;
|
|
37
37
|
}, function (props) {
|
|
@@ -249,7 +249,7 @@ var gapGapStyle = function gapGapStyle(directionProp, gap, responsive, border, t
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
if (border === 'between' || border && border.side === 'between') {
|
|
252
|
-
var borderSize = border.size ||
|
|
252
|
+
var borderSize = border.size || theme.box.border.offset;
|
|
253
253
|
var borderMetric = theme.global.borderSize[borderSize] || borderSize;
|
|
254
254
|
var borderOffset = (0, _utils.parseMetricToNum)(metric) / 2 - (0, _utils.parseMetricToNum)(borderMetric) / 2 + "px";
|
|
255
255
|
var responsiveBorderMetric = responsive && breakpoint && (breakpoint.borderSize[borderSize] || borderSize);
|
|
@@ -7,6 +7,7 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
7
7
|
var _Checkmark = require("grommet-icons/icons/Checkmark");
|
|
8
8
|
var _Box = require("../Box");
|
|
9
9
|
var _styles = require("../../utils/styles");
|
|
10
|
+
var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
10
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
13
|
var bounceDelay = (0, _styledComponents.keyframes)(["0%,80%,100%{transform:scale(0.4);}40%{transform:scale(0.8);}"]);
|
|
@@ -18,6 +19,9 @@ var Dot = (0, _styledComponents["default"])(_Box.Box).withConfig({
|
|
|
18
19
|
return props.delay && "animation-delay: " + props.delay + ";";
|
|
19
20
|
});
|
|
20
21
|
var EllipsisAnimation = exports.EllipsisAnimation = function EllipsisAnimation() {
|
|
22
|
+
var _theme$button;
|
|
23
|
+
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
24
|
+
theme = _useThemeValue.theme;
|
|
21
25
|
return /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
22
26
|
style: {
|
|
23
27
|
position: 'absolute'
|
|
@@ -28,7 +32,7 @@ var EllipsisAnimation = exports.EllipsisAnimation = function EllipsisAnimation()
|
|
|
28
32
|
}, /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
29
33
|
alignSelf: "center",
|
|
30
34
|
direction: "row",
|
|
31
|
-
gap:
|
|
35
|
+
gap: (_theme$button = theme.button) == null || (_theme$button = _theme$button.busy) == null ? void 0 : _theme$button.gap
|
|
32
36
|
}, /*#__PURE__*/_react["default"].createElement(Dot, {
|
|
33
37
|
delay: "-0.32s"
|
|
34
38
|
}), /*#__PURE__*/_react["default"].createElement(Dot, {
|
|
@@ -367,6 +367,7 @@ var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
367
367
|
}, contents);
|
|
368
368
|
}
|
|
369
369
|
if (busy || success) {
|
|
370
|
+
var _theme$button3;
|
|
370
371
|
// match what the label will use
|
|
371
372
|
var animationColor;
|
|
372
373
|
if (kind) {
|
|
@@ -391,7 +392,8 @@ var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
391
392
|
justify: "center"
|
|
392
393
|
}, /*#__PURE__*/_react["default"].createElement(_BusyAnimation.GrowCheckmark, {
|
|
393
394
|
color: animationColor,
|
|
394
|
-
"aria-hidden": true
|
|
395
|
+
"aria-hidden": true,
|
|
396
|
+
as: (_theme$button3 = theme.button) == null || (_theme$button3 = _theme$button3.busy) == null || (_theme$button3 = _theme$button3.icons) == null ? void 0 : _theme$button3.success
|
|
395
397
|
})), /*#__PURE__*/_react["default"].createElement(_BusyAnimation.StyledBusyContents, {
|
|
396
398
|
animating: busy || success
|
|
397
399
|
}, contents));
|
|
@@ -16,15 +16,11 @@ var _StyledCalendar = require("./StyledCalendar");
|
|
|
16
16
|
var _utils = require("./utils");
|
|
17
17
|
var _dates = require("../../utils/dates");
|
|
18
18
|
var _useThemeValue3 = require("../../utils/useThemeValue");
|
|
19
|
-
var _excluded = ["activeDate", "animate", "bounds", "children", "date", "dates", "daysOfWeek", "disabled", "initialFocus", "fill", "firstDayOfWeek", "header", "level", "locale", "messages", "onReference", "onSelect", "range", "reference", "responsive", "showAdjacentDays", "size", "timestamp"]
|
|
19
|
+
var _excluded = ["activeDate", "animate", "bounds", "children", "date", "dates", "daysOfWeek", "disabled", "initialFocus", "fill", "firstDayOfWeek", "header", "level", "locale", "messages", "onReference", "onSelect", "range", "reference", "responsive", "showAdjacentDays", "size", "timestamp"],
|
|
20
|
+
_excluded2 = ["container"];
|
|
20
21
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
21
22
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
22
23
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
23
|
-
var headingPadMap = {
|
|
24
|
-
small: 'xsmall',
|
|
25
|
-
medium: 'small',
|
|
26
|
-
large: 'medium'
|
|
27
|
-
};
|
|
28
24
|
var getLocaleString = function getLocaleString(value, locale) {
|
|
29
25
|
return value == null ? void 0 : value.toLocaleDateString(locale, {
|
|
30
26
|
month: 'long',
|
|
@@ -551,16 +547,17 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
551
547
|
} else {
|
|
552
548
|
headingLevel = (theme.calendar.heading && theme.calendar.heading.level || 4) - 1;
|
|
553
549
|
}
|
|
550
|
+
var _ref5 = ((_theme$calendar$size = theme.calendar[size]) == null ? void 0 : _theme$calendar$size.title) || undefined,
|
|
551
|
+
containerTheme = _ref5.container,
|
|
552
|
+
textTheme = _objectWithoutPropertiesLoose(_ref5, _excluded2);
|
|
554
553
|
return /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
555
554
|
direction: "row",
|
|
556
555
|
justify: "between",
|
|
557
556
|
align: "center"
|
|
558
557
|
}, /*#__PURE__*/_react["default"].createElement(_Header.Header, {
|
|
559
558
|
flex: true,
|
|
560
|
-
pad:
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
}, (_theme$calendar$size = theme.calendar[size]) != null && _theme$calendar$size.title ? /*#__PURE__*/_react["default"].createElement(_Text.Text, theme.calendar[size].title, monthAndYear) : /*#__PURE__*/_react["default"].createElement(_Heading.Heading, {
|
|
559
|
+
pad: containerTheme.pad
|
|
560
|
+
}, Object.keys(textTheme).length !== 0 ? /*#__PURE__*/_react["default"].createElement(_Text.Text, textTheme, monthAndYear) : /*#__PURE__*/_react["default"].createElement(_Heading.Heading, {
|
|
564
561
|
level: headingLevel,
|
|
565
562
|
size: size,
|
|
566
563
|
margin: "none",
|
|
@@ -28,8 +28,7 @@ var Cards = exports.Cards = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
|
28
28
|
pad = _ref.pad,
|
|
29
29
|
paginate = _ref.paginate,
|
|
30
30
|
showProp = _ref.show,
|
|
31
|
-
|
|
32
|
-
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
31
|
+
size = _ref.size,
|
|
33
32
|
_ref$step = _ref.step,
|
|
34
33
|
step = _ref$step === void 0 ? paginate ? 50 : undefined : _ref$step,
|
|
35
34
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
@@ -53,8 +52,8 @@ var Cards = exports.Cards = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
|
53
52
|
return /*#__PURE__*/_react["default"].createElement(Container, containerProps, /*#__PURE__*/_react["default"].createElement(_Grid.Grid, _extends({
|
|
54
53
|
ref: ref,
|
|
55
54
|
as: as,
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
gap: theme.cards.grid.gap,
|
|
56
|
+
columns: size || theme.cards.grid.columns,
|
|
58
57
|
margin: !paginate && margin || 'none',
|
|
59
58
|
pad: !paginate && pad || 'none'
|
|
60
59
|
}, rest), /*#__PURE__*/_react["default"].createElement(_InfiniteScroll.InfiniteScroll, {
|
|
@@ -18,12 +18,9 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
18
18
|
var gradientMaskColor = '#ffffff';
|
|
19
19
|
|
|
20
20
|
// use constants so re-renders don't re-trigger effects
|
|
21
|
-
var defaultSize = {
|
|
22
|
-
height: 'small',
|
|
23
|
-
width: 'medium'
|
|
24
|
-
};
|
|
25
21
|
var defaultValues = [];
|
|
26
22
|
var Chart = exports.Chart = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
23
|
+
var _theme$chart, _theme$chart4, _theme$chart5;
|
|
27
24
|
var a11yTitle = _ref.a11yTitle,
|
|
28
25
|
boundsProp = _ref.bounds,
|
|
29
26
|
color = _ref.color,
|
|
@@ -42,8 +39,7 @@ var Chart = exports.Chart = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
|
42
39
|
point = _ref.point,
|
|
43
40
|
round = _ref.round,
|
|
44
41
|
sizeProp = _ref.size,
|
|
45
|
-
|
|
46
|
-
thickness = _ref$thickness === void 0 ? 'medium' : _ref$thickness,
|
|
42
|
+
thickness = _ref.thickness,
|
|
47
43
|
_ref$type = _ref.type,
|
|
48
44
|
type = _ref$type === void 0 ? 'bar' : _ref$type,
|
|
49
45
|
_ref$values = _ref.values,
|
|
@@ -53,6 +49,7 @@ var Chart = exports.Chart = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
|
53
49
|
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
54
50
|
theme = _useThemeValue.theme,
|
|
55
51
|
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
52
|
+
var thicknessValue = thickness || ((_theme$chart = theme.chart) == null ? void 0 : _theme$chart.thickness);
|
|
56
53
|
var values = (0, _react.useMemo)(function () {
|
|
57
54
|
return (0, _utils2.normalizeValues)(valuesProp);
|
|
58
55
|
}, [valuesProp]);
|
|
@@ -65,8 +62,8 @@ var Chart = exports.Chart = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
|
65
62
|
return (0, _utils2.normalizeBounds)(boundsProp, values, direction);
|
|
66
63
|
}, [direction, boundsProp, values]);
|
|
67
64
|
var strokeWidth = (0, _react.useMemo)(function () {
|
|
68
|
-
return (0, _utils.parseMetricToNum)(theme.global.edgeSize[
|
|
69
|
-
}, [theme.global.edgeSize,
|
|
65
|
+
return (0, _utils.parseMetricToNum)(theme.global.edgeSize[thicknessValue] || thicknessValue);
|
|
66
|
+
}, [theme.global.edgeSize, thicknessValue]);
|
|
70
67
|
|
|
71
68
|
// inset is { top, left, bottom, right }
|
|
72
69
|
var inset = (0, _react.useMemo)(function () {
|
|
@@ -122,6 +119,11 @@ var Chart = exports.Chart = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
|
122
119
|
|
|
123
120
|
// size is { width, height }
|
|
124
121
|
var size = (0, _react.useMemo)(function () {
|
|
122
|
+
var _theme$chart2, _theme$chart3;
|
|
123
|
+
var defaultSize = {
|
|
124
|
+
height: (_theme$chart2 = theme.chart) == null ? void 0 : _theme$chart2.height,
|
|
125
|
+
width: (_theme$chart3 = theme.chart) == null ? void 0 : _theme$chart3.width
|
|
126
|
+
};
|
|
125
127
|
var gapWidth = gap ? (0, _utils.parseMetricToNum)(theme.global.edgeSize[gap] || gap) : strokeWidth;
|
|
126
128
|
|
|
127
129
|
// autoSize is how wide or tall we'd pefer based on the number of values
|
|
@@ -148,7 +150,7 @@ var Chart = exports.Chart = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
|
148
150
|
width: width,
|
|
149
151
|
height: height
|
|
150
152
|
};
|
|
151
|
-
}, [containerSize, gap, horizontal, sizeProp, strokeWidth, theme.global.edgeSize, theme.global.size, values]);
|
|
153
|
+
}, [containerSize, gap, horizontal, sizeProp, strokeWidth, theme.global.edgeSize, theme.global.size, (_theme$chart4 = theme.chart) == null ? void 0 : _theme$chart4.height, (_theme$chart5 = theme.chart) == null ? void 0 : _theme$chart5.width, values]);
|
|
152
154
|
|
|
153
155
|
// scale is { x, y }
|
|
154
156
|
var scale = (0, _react.useMemo)(function () {
|
|
@@ -3,13 +3,6 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.round = exports.calcs = exports.calcBounds = void 0;
|
|
5
5
|
var _utils = require("./utils");
|
|
6
|
-
var thicknessPad = {
|
|
7
|
-
xlarge: 'large',
|
|
8
|
-
large: 'medium',
|
|
9
|
-
medium: 'small',
|
|
10
|
-
small: 'xsmall',
|
|
11
|
-
xsmall: 'xxsmall'
|
|
12
|
-
};
|
|
13
6
|
var round = exports.round = function round(value, decimals) {
|
|
14
7
|
return Number(Math.round(value + "e" + decimals) + "e-" + decimals);
|
|
15
8
|
};
|
|
@@ -160,12 +153,14 @@ var calcBounds = exports.calcBounds = function calcBounds(valuesArg, options) {
|
|
|
160
153
|
// object structure. If options.direction is not present, the results are
|
|
161
154
|
// delivered in [x, y] array structure, for backwards compatibility
|
|
162
155
|
var calcs = exports.calcs = function calcs(values, options) {
|
|
156
|
+
var _theme$dataChart, _theme$dataChart2, _theme$dataChart3, _theme$dataChart4, _theme$dataChart5;
|
|
163
157
|
if (values === void 0) {
|
|
164
158
|
values = [];
|
|
165
159
|
}
|
|
166
160
|
if (options === void 0) {
|
|
167
161
|
options = {};
|
|
168
162
|
}
|
|
163
|
+
var theme = options.theme || {};
|
|
169
164
|
var horizontal = options.direction === 'horizontal';
|
|
170
165
|
|
|
171
166
|
// the number of steps is one less than the number of labels
|
|
@@ -227,6 +222,13 @@ var calcs = exports.calcs = function calcs(values, options) {
|
|
|
227
222
|
xAxis.push(round(x, 2));
|
|
228
223
|
x += xStepInterval;
|
|
229
224
|
}
|
|
225
|
+
var thicknessPad = {
|
|
226
|
+
xlarge: ((_theme$dataChart = theme.dataChart) == null || (_theme$dataChart = _theme$dataChart.thicknessPad) == null ? void 0 : _theme$dataChart.xlarge) || 'large',
|
|
227
|
+
large: ((_theme$dataChart2 = theme.dataChart) == null || (_theme$dataChart2 = _theme$dataChart2.thicknessPad) == null ? void 0 : _theme$dataChart2.large) || 'medium',
|
|
228
|
+
medium: ((_theme$dataChart3 = theme.dataChart) == null || (_theme$dataChart3 = _theme$dataChart3.thicknessPad) == null ? void 0 : _theme$dataChart3.medium) || 'small',
|
|
229
|
+
small: ((_theme$dataChart4 = theme.dataChart) == null || (_theme$dataChart4 = _theme$dataChart4.thicknessPad) == null ? void 0 : _theme$dataChart4.small) || 'xsmall',
|
|
230
|
+
xsmall: ((_theme$dataChart5 = theme.dataChart) == null || (_theme$dataChart5 = _theme$dataChart5.thicknessPad) == null ? void 0 : _theme$dataChart5.xsmall) || 'xxsmall'
|
|
231
|
+
};
|
|
230
232
|
var _options = options,
|
|
231
233
|
thickness = _options.thickness;
|
|
232
234
|
if (!thickness) {
|
|
@@ -235,17 +237,23 @@ var calcs = exports.calcs = function calcs(values, options) {
|
|
|
235
237
|
// These values were emirically determined, trying to balance visibility
|
|
236
238
|
// and overlap across resolutions.
|
|
237
239
|
if (values.length < 5) {
|
|
238
|
-
|
|
240
|
+
var _theme$dataChart6;
|
|
241
|
+
thickness = ((_theme$dataChart6 = theme.dataChart) == null || (_theme$dataChart6 = _theme$dataChart6.thickness) == null ? void 0 : _theme$dataChart6.sparse) || 'xlarge';
|
|
239
242
|
} else if (values.length < 11) {
|
|
240
|
-
|
|
243
|
+
var _theme$dataChart7;
|
|
244
|
+
thickness = ((_theme$dataChart7 = theme.dataChart) == null || (_theme$dataChart7 = _theme$dataChart7.thickness) == null ? void 0 : _theme$dataChart7.light) || 'large';
|
|
241
245
|
} else if (values.length < 21) {
|
|
242
|
-
|
|
246
|
+
var _theme$dataChart8;
|
|
247
|
+
thickness = ((_theme$dataChart8 = theme.dataChart) == null || (_theme$dataChart8 = _theme$dataChart8.thickness) == null ? void 0 : _theme$dataChart8.moderate) || 'medium';
|
|
243
248
|
} else if (values.length < 61) {
|
|
244
|
-
|
|
249
|
+
var _theme$dataChart9;
|
|
250
|
+
thickness = ((_theme$dataChart9 = theme.dataChart) == null || (_theme$dataChart9 = _theme$dataChart9.thickness) == null ? void 0 : _theme$dataChart9.heavy) || 'small';
|
|
245
251
|
} else if (values.length < 121) {
|
|
246
|
-
|
|
252
|
+
var _theme$dataChart0;
|
|
253
|
+
thickness = ((_theme$dataChart0 = theme.dataChart) == null || (_theme$dataChart0 = _theme$dataChart0.thickness) == null ? void 0 : _theme$dataChart0.dense) || 'xsmall';
|
|
247
254
|
} else {
|
|
248
|
-
|
|
255
|
+
var _theme$dataChart1;
|
|
256
|
+
thickness = ((_theme$dataChart1 = theme.dataChart) == null || (_theme$dataChart1 = _theme$dataChart1.thickness) == null ? void 0 : _theme$dataChart1.veryDense) || 'hair';
|
|
249
257
|
}
|
|
250
258
|
}
|
|
251
259
|
var pad = thicknessPad[thickness];
|
|
@@ -139,7 +139,7 @@ var CheckBox = exports.CheckBox = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
139
139
|
var checkBoxNode = /*#__PURE__*/_react["default"].createElement(_StyledCheckBox.StyledCheckBox, _extends({
|
|
140
140
|
align: "center",
|
|
141
141
|
justify: "center",
|
|
142
|
-
margin: label && (_ref2 = {}, _ref2[side] = theme.checkBox.gap
|
|
142
|
+
margin: label && (_ref2 = {}, _ref2[side] = theme.checkBox.gap, _ref2)
|
|
143
143
|
}, themeableProps), /*#__PURE__*/_react["default"].createElement(_StyledCheckBox.StyledCheckBoxInput, _extends({
|
|
144
144
|
"aria-label": ariaLabel || a11yTitle
|
|
145
145
|
}, passThemeFlag, rest, {
|
|
@@ -14,7 +14,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
14
14
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
15
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
16
|
var CheckBoxGroup = exports.CheckBoxGroup = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
17
|
-
var _formContext$useFormF;
|
|
17
|
+
var _formContext$useFormF, _theme$checkBoxGroup;
|
|
18
18
|
var ariaLabelProp = _ref['aria-label'],
|
|
19
19
|
ariaLabelledByProp = _ref['aria-labelledby'],
|
|
20
20
|
children = _ref.children,
|
|
@@ -82,8 +82,7 @@ var CheckBoxGroup = exports.CheckBoxGroup = /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
82
82
|
"aria-labelledby": ariaLabelledByProp || ariaLabelledBy,
|
|
83
83
|
role: "group"
|
|
84
84
|
}, theme.checkBoxGroup.container, {
|
|
85
|
-
gap: gap || (
|
|
86
|
-
,
|
|
85
|
+
gap: gap || ((_theme$checkBoxGroup = theme.checkBoxGroup) == null || (_theme$checkBoxGroup = _theme$checkBoxGroup.container) == null ? void 0 : _theme$checkBoxGroup.gap),
|
|
87
86
|
id: id
|
|
88
87
|
}, passThemeFlag, rest), options.map(function (option, index) {
|
|
89
88
|
var optionValue = option.value;
|
package/components/Data/Data.js
CHANGED
|
@@ -14,6 +14,7 @@ var _DataContext = require("../../contexts/DataContext");
|
|
|
14
14
|
var _propTypes = require("./propTypes");
|
|
15
15
|
var _MessageContext = require("../../contexts/MessageContext");
|
|
16
16
|
var _filter = require("./filter");
|
|
17
|
+
var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
17
18
|
var _excluded = ["children", "data", "defaultView", "filteredTotal", "id", "messages", "onView", "properties", "toolbar", "total", "view", "views"];
|
|
18
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
20
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
@@ -74,6 +75,8 @@ var Data = exports.Data = function Data(_ref) {
|
|
|
74
75
|
var announce = (0, _react.useContext)(_contexts.AnnounceContext);
|
|
75
76
|
var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
76
77
|
format = _useContext.format;
|
|
78
|
+
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
79
|
+
theme = _useThemeValue.theme;
|
|
77
80
|
// Announce to screen readers when search or filters are
|
|
78
81
|
// applied and affect the underlying result set
|
|
79
82
|
(0, _react.useEffect)(function () {
|
|
@@ -144,9 +147,10 @@ var Data = exports.Data = function Data(_ref) {
|
|
|
144
147
|
}, [id, messages, filtersCleared, onView, properties, result, selected, toolbarKeys, view, views]);
|
|
145
148
|
var toolbarContent;
|
|
146
149
|
if (toolbar) {
|
|
150
|
+
var _theme$data;
|
|
147
151
|
toolbarContent = [/*#__PURE__*/_react["default"].createElement(_Toolbar.Toolbar, {
|
|
148
152
|
key: "toolbar",
|
|
149
|
-
gap:
|
|
153
|
+
gap: (_theme$data = theme.data) == null || (_theme$data = _theme$data.toolbar) == null ? void 0 : _theme$data.gap
|
|
150
154
|
}, /*#__PURE__*/_react["default"].createElement(_Toolbar.Toolbar, null, (toolbar === true || toolbar === 'search') && /*#__PURE__*/_react["default"].createElement(_DataSearch.DataSearch, null), (toolbar === true || toolbar === 'filters') && /*#__PURE__*/_react["default"].createElement(_DataFilters.DataFilters, {
|
|
151
155
|
layer: true
|
|
152
156
|
})), (toolbar === true || toolbar === 'view') && /*#__PURE__*/_react["default"].createElement(_DataView.DataView, null)), /*#__PURE__*/_react["default"].createElement(_DataSummary.DataSummary, {
|
|
@@ -12,6 +12,7 @@ var _DataContext = require("../../contexts/DataContext");
|
|
|
12
12
|
var _DataFormContext = require("../../contexts/DataFormContext");
|
|
13
13
|
var _MessageContext = require("../../contexts/MessageContext");
|
|
14
14
|
var _useDebounce = require("../../utils/use-debounce");
|
|
15
|
+
var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
15
16
|
var _excluded = ["children", "footer", "onDone", "pad", "updateOn"];
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
17
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -241,6 +242,8 @@ var DataForm = exports.DataForm = function DataForm(_ref) {
|
|
|
241
242
|
};
|
|
242
243
|
}, []);
|
|
243
244
|
var debounce = (0, _useDebounce.useDebounce)(DEBOUNCE_TIMEOUT);
|
|
245
|
+
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
246
|
+
theme = _useThemeValue.theme;
|
|
244
247
|
var onSubmit = (0, _react.useCallback)(function (_ref2) {
|
|
245
248
|
var value = _ref2.value;
|
|
246
249
|
var nextValue = normalizeValue(value, formValue, views, pendingReset);
|
|
@@ -272,6 +275,7 @@ var DataForm = exports.DataForm = function DataForm(_ref) {
|
|
|
272
275
|
}, [view]);
|
|
273
276
|
var content = children;
|
|
274
277
|
if (footer !== false && updateOn === 'submit' || pad) {
|
|
278
|
+
var _theme$dataFilters, _theme$dataFilters2;
|
|
275
279
|
content = /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
276
280
|
fill: "vertical"
|
|
277
281
|
}, /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
@@ -285,14 +289,12 @@ var DataForm = exports.DataForm = function DataForm(_ref) {
|
|
|
285
289
|
flex: false
|
|
286
290
|
}, content)), footer !== false && updateOn === 'submit' && /*#__PURE__*/_react["default"].createElement(_Footer.Footer, {
|
|
287
291
|
flex: false,
|
|
288
|
-
margin: {
|
|
289
|
-
top: 'medium'
|
|
290
|
-
},
|
|
291
292
|
pad: {
|
|
292
293
|
horizontal: pad,
|
|
293
294
|
bottom: pad
|
|
294
295
|
},
|
|
295
|
-
|
|
296
|
+
margin: (_theme$dataFilters = theme.dataFilters) == null || (_theme$dataFilters = _theme$dataFilters.footer) == null || (_theme$dataFilters = _theme$dataFilters.actions) == null ? void 0 : _theme$dataFilters.margin,
|
|
297
|
+
gap: (_theme$dataFilters2 = theme.dataFilters) == null || (_theme$dataFilters2 = _theme$dataFilters2.footer) == null || (_theme$dataFilters2 = _theme$dataFilters2.actions) == null ? void 0 : _theme$dataFilters2.gap
|
|
296
298
|
}, /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
297
299
|
label: format({
|
|
298
300
|
id: 'dataForm.submit',
|
|
@@ -6,7 +6,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
6
6
|
var _grommet = require("grommet");
|
|
7
7
|
var _grommetIcons = require("grommet-icons");
|
|
8
8
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
9
|
-
function
|
|
9
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
10
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
10
11
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
11
12
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
12
13
|
var buildQuery = function buildQuery(view) {
|
|
@@ -34,11 +35,11 @@ var buildQuery = function buildQuery(view) {
|
|
|
34
35
|
return query;
|
|
35
36
|
};
|
|
36
37
|
var fetchLaunches = /*#__PURE__*/function () {
|
|
37
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
38
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(view) {
|
|
38
39
|
var _view$sort, _view$sort2, _sort;
|
|
39
40
|
var query, sort, body;
|
|
40
|
-
return
|
|
41
|
-
while (1) switch (_context.
|
|
41
|
+
return _regenerator().w(function (_context) {
|
|
42
|
+
while (1) switch (_context.n) {
|
|
42
43
|
case 0:
|
|
43
44
|
query = buildQuery(view);
|
|
44
45
|
sort = (_sort = {}, _sort[(view == null || (_view$sort = view.sort) == null ? void 0 : _view$sort.property) || 'name'] = (view == null || (_view$sort2 = view.sort) == null ? void 0 : _view$sort2.direction) || 'asc', _sort);
|
|
@@ -56,7 +57,7 @@ var fetchLaunches = /*#__PURE__*/function () {
|
|
|
56
57
|
},
|
|
57
58
|
query: query
|
|
58
59
|
};
|
|
59
|
-
return _context.
|
|
60
|
+
return _context.a(2, fetch('https://api.spacexdata.com/v4/launches/query', {
|
|
60
61
|
method: 'POST',
|
|
61
62
|
headers: {
|
|
62
63
|
'Content-Type': 'application/json'
|
|
@@ -65,9 +66,6 @@ var fetchLaunches = /*#__PURE__*/function () {
|
|
|
65
66
|
}).then(function (response) {
|
|
66
67
|
return response.json();
|
|
67
68
|
}));
|
|
68
|
-
case 4:
|
|
69
|
-
case "end":
|
|
70
|
-
return _context.stop();
|
|
71
69
|
}
|
|
72
70
|
}, _callee);
|
|
73
71
|
}));
|
|
@@ -76,10 +74,10 @@ var fetchLaunches = /*#__PURE__*/function () {
|
|
|
76
74
|
};
|
|
77
75
|
}();
|
|
78
76
|
var fetchRockets = /*#__PURE__*/function () {
|
|
79
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
77
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
80
78
|
var body;
|
|
81
|
-
return
|
|
82
|
-
while (1) switch (_context2.
|
|
79
|
+
return _regenerator().w(function (_context2) {
|
|
80
|
+
while (1) switch (_context2.n) {
|
|
83
81
|
case 0:
|
|
84
82
|
body = {
|
|
85
83
|
options: {
|
|
@@ -89,7 +87,7 @@ var fetchRockets = /*#__PURE__*/function () {
|
|
|
89
87
|
select: ['name', 'id']
|
|
90
88
|
}
|
|
91
89
|
};
|
|
92
|
-
return _context2.
|
|
90
|
+
return _context2.a(2, fetch('https://api.spacexdata.com/v4/rockets/query', {
|
|
93
91
|
method: 'POST',
|
|
94
92
|
headers: {
|
|
95
93
|
'Content-Type': 'application/json'
|
|
@@ -98,9 +96,6 @@ var fetchRockets = /*#__PURE__*/function () {
|
|
|
98
96
|
}).then(function (response) {
|
|
99
97
|
return response.json();
|
|
100
98
|
}));
|
|
101
|
-
case 2:
|
|
102
|
-
case "end":
|
|
103
|
-
return _context2.stop();
|
|
104
99
|
}
|
|
105
100
|
}, _callee2);
|
|
106
101
|
}));
|