grommet 2.41.0 → 2.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all/stories/Colors.js +6 -6
- package/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
- package/components/AccordionPanel/AccordionPanel.js +1 -7
- package/components/Box/Box.js +1 -1
- package/components/Box/StyledBox.js +1 -6
- package/components/Box/index.d.ts +1 -0
- package/components/Box/propTypes.js +1 -0
- package/components/Box/stories/Background.js +4 -10
- package/components/Button/Button.js +1 -0
- package/components/Button/StyledButton.js +3 -2
- package/components/Calendar/Calendar.js +96 -59
- package/components/Calendar/StyledCalendar.js +89 -7
- package/components/Calendar/utils.js +16 -2
- package/components/Card/stories/Simple.js +2 -2
- package/components/Carousel/Carousel.js +1 -1
- package/components/Chart/Chart.js +3 -3
- package/components/CheckBox/CheckBox.js +3 -2
- package/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/components/Clock/Digital.js +1 -1
- package/components/Data/stories/Cards.js +3 -2
- package/components/Data/stories/Infinite.js +2 -2
- package/components/Data/stories/OnSelect.js +2 -2
- package/components/Data/stories/Properties.js +3 -2
- package/components/Data/stories/SpaceX.js +2 -2
- package/components/Data/stories/StarWars.js +1 -1
- package/components/DataFilter/DataFilter.js +1 -1
- package/components/DataSort/DataSort.js +46 -14
- package/components/DataSort/stories/Simple.js +10 -1
- package/components/DataTable/Body.js +14 -8
- package/components/DataTable/GroupedBody.js +3 -3
- package/components/DataTable/buildState.js +5 -1
- package/components/DataTable/stories/SpaceX.js +2 -2
- package/components/DataTable/stories/SpaceXUngrouped.js +1 -1
- package/components/FileInput/index.d.ts +2 -3
- package/components/FormField/FormField.js +9 -2
- package/components/FormField/stories/ThresholdValidation.js +5 -1
- package/components/Grommet/index.d.ts +19 -1
- package/components/Grommet/propTypes.js +18 -0
- package/components/Grommet/stories/Theme.js +1 -1
- package/components/Grommet/stories/Vars.js +2 -2
- package/components/Layer/Layer.js +1 -1
- package/components/Layer/index.d.ts +2 -0
- package/components/List/List.js +43 -13
- package/components/List/stories/RenderedList.js +1 -1
- package/components/Meter/Circle.js +2 -2
- package/components/Meter/Meter.js +36 -17
- package/components/Meter/index.d.ts +18 -0
- package/components/Meter/propTypes.js +18 -0
- package/components/Notification/Notification.js +18 -6
- package/components/Notification/index.d.ts +1 -0
- package/components/Notification/propTypes.js +1 -0
- package/components/Pagination/Pagination.js +4 -2
- package/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
- package/components/Pagination/stories/NumberEdgePages.js +2 -0
- package/components/Pagination/stories/NumberMiddlePages.js +2 -0
- package/components/Pagination/stories/Simple.js +4 -2
- package/components/Pagination/stories/Size.js +3 -0
- package/components/Pagination/stories/Steps.js +3 -0
- package/components/RadioButton/RadioButton.js +14 -3
- package/components/RadioButton/stories/Children.js +16 -3
- package/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/components/RadioButtonGroup/stories/Children.js +13 -1
- package/components/Select/Select.js +7 -3
- package/components/Select/SelectContainer.js +41 -34
- package/components/Select/index.d.ts +1 -1
- package/components/Select/utils.js +13 -2
- package/components/SelectMultiple/SelectMultiple.js +10 -0
- package/components/SelectMultiple/SelectMultipleContainer.js +28 -2
- package/components/SelectMultiple/SelectMultipleValue.js +14 -1
- package/components/SkipLinks/index.d.ts +1 -0
- package/components/SkipLinks/propTypes.js +1 -0
- package/components/Tab/Tab.js +1 -1
- package/components/Tabs/stories/Scrollable.js +2 -1
- package/components/Tag/Tag.js +11 -7
- package/components/TextInput/TextInput.js +7 -2
- package/components/ToggleGroup/StyledToggleGroup.js +12 -5
- package/components/ToggleGroup/ToggleGroup.js +21 -10
- package/components/WorldMap/WorldMap.js +1 -1
- package/es6/all/stories/Colors.js +6 -6
- package/es6/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
- package/es6/components/AccordionPanel/AccordionPanel.js +2 -9
- package/es6/components/Box/Box.js +1 -1
- package/es6/components/Box/StyledBox.js +1 -6
- package/es6/components/Box/index.d.ts +1 -0
- package/es6/components/Box/propTypes.js +1 -0
- package/es6/components/Box/stories/Background.js +4 -10
- package/es6/components/Button/Button.js +1 -0
- package/es6/components/Button/StyledButton.js +4 -3
- package/es6/components/Calendar/Calendar.js +95 -59
- package/es6/components/Calendar/StyledCalendar.js +90 -8
- package/es6/components/Calendar/utils.js +15 -1
- package/es6/components/Card/stories/Simple.js +3 -3
- package/es6/components/Carousel/Carousel.js +1 -1
- package/es6/components/Chart/Chart.js +3 -3
- package/es6/components/CheckBox/CheckBox.js +3 -2
- package/es6/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/es6/components/Clock/Digital.js +1 -1
- package/es6/components/Data/stories/Cards.js +4 -3
- package/es6/components/Data/stories/Infinite.js +2 -2
- package/es6/components/Data/stories/OnSelect.js +2 -2
- package/es6/components/Data/stories/Properties.js +4 -3
- package/es6/components/Data/stories/SpaceX.js +2 -2
- package/es6/components/Data/stories/StarWars.js +1 -1
- package/es6/components/DataFilter/DataFilter.js +1 -1
- package/es6/components/DataSort/DataSort.js +46 -14
- package/es6/components/DataSort/stories/Simple.js +10 -1
- package/es6/components/DataTable/Body.js +14 -8
- package/es6/components/DataTable/GroupedBody.js +3 -3
- package/es6/components/DataTable/buildState.js +5 -1
- package/es6/components/DataTable/stories/SpaceX.js +2 -2
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +1 -1
- package/es6/components/FileInput/index.d.ts +2 -3
- package/es6/components/FormField/FormField.js +10 -3
- package/es6/components/FormField/stories/ThresholdValidation.js +5 -1
- package/es6/components/Grommet/index.d.ts +19 -1
- package/es6/components/Grommet/propTypes.js +18 -0
- package/es6/components/Grommet/stories/Theme.js +1 -1
- package/es6/components/Grommet/stories/Vars.js +2 -2
- package/es6/components/Layer/Layer.js +1 -1
- package/es6/components/Layer/index.d.ts +2 -0
- package/es6/components/List/List.js +43 -13
- package/es6/components/List/stories/RenderedList.js +1 -1
- package/es6/components/Meter/Circle.js +2 -2
- package/es6/components/Meter/Meter.js +37 -18
- package/es6/components/Meter/index.d.ts +18 -0
- package/es6/components/Meter/propTypes.js +18 -0
- package/es6/components/Notification/Notification.js +18 -6
- package/es6/components/Notification/index.d.ts +1 -0
- package/es6/components/Notification/propTypes.js +1 -0
- package/es6/components/Pagination/Pagination.js +4 -2
- package/es6/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
- package/es6/components/Pagination/stories/NumberEdgePages.js +2 -0
- package/es6/components/Pagination/stories/NumberMiddlePages.js +2 -0
- package/es6/components/Pagination/stories/Simple.js +4 -2
- package/es6/components/Pagination/stories/Size.js +3 -0
- package/es6/components/Pagination/stories/Steps.js +3 -0
- package/es6/components/RadioButton/RadioButton.js +15 -4
- package/es6/components/RadioButton/stories/Children.js +16 -3
- package/es6/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es6/components/RadioButtonGroup/stories/Children.js +12 -1
- package/es6/components/Select/Select.js +8 -4
- package/es6/components/Select/SelectContainer.js +41 -34
- package/es6/components/Select/index.d.ts +1 -1
- package/es6/components/Select/utils.js +15 -3
- package/es6/components/SelectMultiple/SelectMultiple.js +10 -0
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +28 -2
- package/es6/components/SelectMultiple/SelectMultipleValue.js +14 -1
- package/es6/components/SkipLinks/index.d.ts +1 -0
- package/es6/components/SkipLinks/propTypes.js +1 -0
- package/es6/components/Tab/Tab.js +1 -1
- package/es6/components/Tabs/stories/Scrollable.js +2 -1
- package/es6/components/Tag/Tag.js +11 -7
- package/es6/components/TextInput/TextInput.js +7 -2
- package/es6/components/ToggleGroup/StyledToggleGroup.js +12 -5
- package/es6/components/ToggleGroup/ToggleGroup.js +22 -11
- package/es6/components/WorldMap/WorldMap.js +1 -1
- package/es6/languages/default.json +18 -0
- package/es6/themes/base.d.ts +204 -6
- package/es6/themes/base.js +165 -1
- package/es6/utils/background.js +1 -1
- package/es6/utils/index.js +2 -1
- package/es6/utils/styles.js +8 -0
- package/es6/utils/useId.js +17 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +18 -0
- package/package.json +36 -36
- package/themes/base.d.ts +204 -6
- package/themes/base.js +165 -1
- package/utils/background.js +1 -1
- package/utils/index.js +6 -0
- package/utils/styles.js +9 -1
- package/utils/useId.js +22 -0
- package/components/CheckBox/stories/InsideButton.js +0 -38
- package/es6/components/CheckBox/stories/InsideButton.js +0 -32
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.withinDates = exports.subtractMonths = exports.subtractDays = exports.startOfMonth = exports.sameDayOrBefore = exports.sameDayOrAfter = exports.sameDay = exports.handleOffset = exports.endOfMonth = exports.daysApart = exports.betweenDates = exports.addMonths = exports.addDays = void 0;
|
|
4
|
+
exports.withinDates = exports.subtractMonths = exports.subtractDays = exports.startOfMonth = exports.sameDayOrBefore = exports.sameDayOrAfter = exports.sameDay = exports.handleOffset = exports.getRangePosition = exports.endOfMonth = exports.daysApart = exports.betweenDates = exports.addMonths = exports.addDays = void 0;
|
|
5
5
|
// Utility functions for the Calendar.
|
|
6
6
|
// Just what's needed to avoid having to include a dependency like momentjs.
|
|
7
7
|
|
|
@@ -82,6 +82,18 @@ var betweenDates = exports.betweenDates = function betweenDates(date, dates) {
|
|
|
82
82
|
}
|
|
83
83
|
return result;
|
|
84
84
|
};
|
|
85
|
+
var getRangePosition = exports.getRangePosition = function getRangePosition(date, dates) {
|
|
86
|
+
var rangePosition;
|
|
87
|
+
if (dates) {
|
|
88
|
+
var _ref2 = Array.isArray(dates) ? dates.map(function (d) {
|
|
89
|
+
return d ? new Date(d) : undefined;
|
|
90
|
+
}) : [dates, undefined],
|
|
91
|
+
from = _ref2[0],
|
|
92
|
+
to = _ref2[1];
|
|
93
|
+
if (from && sameDay(date, from)) rangePosition = 'start';else if (to && sameDay(date, to)) rangePosition = 'end';
|
|
94
|
+
}
|
|
95
|
+
return rangePosition;
|
|
96
|
+
};
|
|
85
97
|
|
|
86
98
|
// withinDates takes an array of string dates or 2 element arrays and
|
|
87
99
|
// checks whether the supplied date matches any string or is between
|
|
@@ -89,6 +101,7 @@ var betweenDates = exports.betweenDates = function betweenDates(date, dates) {
|
|
|
89
101
|
// returns 2 if exact match, 1 if between, undefined otherwise
|
|
90
102
|
var withinDates = exports.withinDates = function withinDates(date, dates) {
|
|
91
103
|
var result;
|
|
104
|
+
var rangePosition;
|
|
92
105
|
if (dates) {
|
|
93
106
|
if (Array.isArray(dates)) {
|
|
94
107
|
dates.some(function (d) {
|
|
@@ -98,6 +111,7 @@ var withinDates = exports.withinDates = function withinDates(date, dates) {
|
|
|
98
111
|
}
|
|
99
112
|
} else {
|
|
100
113
|
result = betweenDates(date, d);
|
|
114
|
+
rangePosition = getRangePosition(date, d);
|
|
101
115
|
}
|
|
102
116
|
return result;
|
|
103
117
|
});
|
|
@@ -105,7 +119,7 @@ var withinDates = exports.withinDates = function withinDates(date, dates) {
|
|
|
105
119
|
result = 2;
|
|
106
120
|
}
|
|
107
121
|
}
|
|
108
|
-
return result;
|
|
122
|
+
return [result, rangePosition];
|
|
109
123
|
};
|
|
110
124
|
var handleOffset = exports.handleOffset = function handleOffset(date) {
|
|
111
125
|
var normalizedDate = new Date(date);
|
|
@@ -10,7 +10,7 @@ var Simple = exports.Simple = function Simple() {
|
|
|
10
10
|
/*#__PURE__*/
|
|
11
11
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
12
12
|
// <Grommet theme={...}>
|
|
13
|
-
_react["default"].createElement(_grommet.Box, {
|
|
13
|
+
_react["default"].createElement(_grommet.Main, null, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
14
14
|
pad: "large",
|
|
15
15
|
gap: "medium",
|
|
16
16
|
width: "medium"
|
|
@@ -29,7 +29,7 @@ var Simple = exports.Simple = function Simple() {
|
|
|
29
29
|
pad: "small",
|
|
30
30
|
gap: "medium",
|
|
31
31
|
background: "light-1"
|
|
32
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "text - random component"), /*#__PURE__*/_react["default"].createElement(_grommet.Box, null, "box - random component")))
|
|
32
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "text - random component"), /*#__PURE__*/_react["default"].createElement(_grommet.Box, null, "box - random component"))))
|
|
33
33
|
// </Grommet>
|
|
34
34
|
);
|
|
35
35
|
};
|
|
@@ -162,7 +162,7 @@ var Carousel = exports.Carousel = function Carousel(_ref) {
|
|
|
162
162
|
var iconColor = (0, _utils.normalizeColor)(theme.carousel.icons.color || 'control', theme);
|
|
163
163
|
var selectors = [];
|
|
164
164
|
var wrappedChildren = _react.Children.map(children, function (child, index) {
|
|
165
|
-
selectors.push(
|
|
165
|
+
selectors.push(/*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
166
166
|
a11yTitle: format({
|
|
167
167
|
id: 'carousel.jump',
|
|
168
168
|
values: {
|
|
@@ -481,7 +481,7 @@ var Chart = exports.Chart = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
|
481
481
|
}).join('-');
|
|
482
482
|
var gradientId = uniqueGradientId + "-" + id + "-gradient";
|
|
483
483
|
var maskId = uniqueGradientId + "-" + id + "-mask";
|
|
484
|
-
defs.push(
|
|
484
|
+
defs.push(/*#__PURE__*/_react["default"].createElement("linearGradient", {
|
|
485
485
|
key: "gradientId",
|
|
486
486
|
id: gradientId,
|
|
487
487
|
x1: 0,
|
|
@@ -499,7 +499,7 @@ var Chart = exports.Chart = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
|
499
499
|
stopColor: (0, _utils.normalizeColor)(gradientColor, theme)
|
|
500
500
|
});
|
|
501
501
|
})));
|
|
502
|
-
defs.push(
|
|
502
|
+
defs.push(/*#__PURE__*/_react["default"].createElement("mask", {
|
|
503
503
|
key: "mask",
|
|
504
504
|
id: maskId
|
|
505
505
|
}, drawing));
|
|
@@ -558,7 +558,7 @@ var Chart = exports.Chart = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
|
558
558
|
strokeWidth: strokeWidth
|
|
559
559
|
});
|
|
560
560
|
}
|
|
561
|
-
defs.push(
|
|
561
|
+
defs.push(/*#__PURE__*/_react["default"].createElement("pattern", {
|
|
562
562
|
key: patternId,
|
|
563
563
|
id: patternId,
|
|
564
564
|
width: _double,
|
|
@@ -9,7 +9,7 @@ var _propTypes = require("./propTypes");
|
|
|
9
9
|
var _StyledCheckBox = require("./StyledCheckBox");
|
|
10
10
|
var _utils = require("../../utils");
|
|
11
11
|
var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
12
|
-
var _excluded = ["a11yTitle", "aria-label", "checked", "children", "defaultChecked", "disabled", "fill", "focus", "focusIndicator", "id", "label", "name", "onBlur", "onChange", "onFocus", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver", "pad", "reverse", "toggle", "indeterminate"];
|
|
12
|
+
var _excluded = ["a11yTitle", "aria-label", "checked", "children", "containerProps", "defaultChecked", "disabled", "fill", "focus", "focusIndicator", "id", "label", "name", "onBlur", "onChange", "onFocus", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver", "pad", "reverse", "toggle", "indeterminate"];
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
15
15
|
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); }
|
|
@@ -27,6 +27,7 @@ var CheckBox = exports.CheckBox = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
27
27
|
ariaLabel = _ref['aria-label'],
|
|
28
28
|
checkedProp = _ref.checked,
|
|
29
29
|
children = _ref.children,
|
|
30
|
+
containerProps = _ref.containerProps,
|
|
30
31
|
_ref$defaultChecked = _ref.defaultChecked,
|
|
31
32
|
defaultChecked = _ref$defaultChecked === void 0 ? false : _ref$defaultChecked,
|
|
32
33
|
disabled = _ref.disabled,
|
|
@@ -193,7 +194,7 @@ var CheckBox = exports.CheckBox = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
193
194
|
onMouseOut: function onMouseOut(event) {
|
|
194
195
|
return _onMouseOut == null ? void 0 : _onMouseOut(event);
|
|
195
196
|
}
|
|
196
|
-
}, passThemeFlag, themeableProps), first, second);
|
|
197
|
+
}, passThemeFlag, themeableProps, containerProps), first, second);
|
|
197
198
|
});
|
|
198
199
|
CheckBox.displayName = 'CheckBox';
|
|
199
200
|
CheckBox.propTypes = _propTypes.CheckBoxPropTypes;
|
|
@@ -81,7 +81,7 @@ var CheckBoxGroup = exports.CheckBoxGroup = /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
81
81
|
var checked = value.indexOf(valueOption) >= 0;
|
|
82
82
|
var disabled = disabledProp || option.disabled;
|
|
83
83
|
var key = label + "-" + valueOption;
|
|
84
|
-
if (option.checked) console.warn(
|
|
84
|
+
if (option.checked) console.warn(// eslint-disable-next-line max-len
|
|
85
85
|
"'checked' prop of an individual CheckBox shouldn't be used in a CheckBoxGroup component. Use the CheckBoxGroup 'value' prop instead.");
|
|
86
86
|
// value shouldn't propagate the input field and the onChange option
|
|
87
87
|
var omit = option.value,
|
|
@@ -71,7 +71,7 @@ var Element = function Element(_ref2) {
|
|
|
71
71
|
number: ones
|
|
72
72
|
})];
|
|
73
73
|
if (sep) {
|
|
74
|
-
result.unshift(
|
|
74
|
+
result.unshift(/*#__PURE__*/_react["default"].createElement(_StyledClock.StyledDigitalDigit, _extends({
|
|
75
75
|
key: "sep",
|
|
76
76
|
size: size
|
|
77
77
|
}, passThemeFlag), ":"));
|
|
@@ -11,7 +11,7 @@ var Example = exports.Example = function Example() {
|
|
|
11
11
|
/*#__PURE__*/
|
|
12
12
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
13
13
|
// <Grommet theme={...}>
|
|
14
|
-
_react["default"].createElement(_grommet.Box, {
|
|
14
|
+
_react["default"].createElement(_grommet.Main, null, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
15
15
|
pad: "large"
|
|
16
16
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.Data, {
|
|
17
17
|
data: _data.DATA,
|
|
@@ -20,13 +20,14 @@ var Example = exports.Example = function Example() {
|
|
|
20
20
|
size: "medium"
|
|
21
21
|
}, function (item) {
|
|
22
22
|
return /*#__PURE__*/_react["default"].createElement(_grommet.Card, {
|
|
23
|
+
as: "li",
|
|
23
24
|
key: item.name,
|
|
24
25
|
pad: "small"
|
|
25
26
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.CardBody, null, /*#__PURE__*/_react["default"].createElement(_grommet.Heading, {
|
|
26
27
|
level: 2,
|
|
27
28
|
margin: "none"
|
|
28
29
|
}, item.name)), /*#__PURE__*/_react["default"].createElement(_grommet.CardFooter, null, item.location || '--'));
|
|
29
|
-
})))
|
|
30
|
+
}))))
|
|
30
31
|
// </Grommet>
|
|
31
32
|
);
|
|
32
33
|
};
|
|
@@ -35,7 +35,7 @@ var buildQuery = function buildQuery(view) {
|
|
|
35
35
|
return query;
|
|
36
36
|
};
|
|
37
37
|
var fetchLaunches = /*#__PURE__*/function () {
|
|
38
|
-
var _ref = _asyncToGenerator(
|
|
38
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
|
|
39
39
|
var _view$sort, _view$sort2, _sort;
|
|
40
40
|
var query, sort, body;
|
|
41
41
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -77,7 +77,7 @@ var fetchLaunches = /*#__PURE__*/function () {
|
|
|
77
77
|
};
|
|
78
78
|
}();
|
|
79
79
|
var fetchRockets = /*#__PURE__*/function () {
|
|
80
|
-
var _ref2 = _asyncToGenerator(
|
|
80
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
81
81
|
var body;
|
|
82
82
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
83
83
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -35,7 +35,7 @@ var buildQuery = function buildQuery(view) {
|
|
|
35
35
|
return query;
|
|
36
36
|
};
|
|
37
37
|
var fetchLaunches = /*#__PURE__*/function () {
|
|
38
|
-
var _ref = _asyncToGenerator(
|
|
38
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
|
|
39
39
|
var _view$sort, _view$sort2, _sort;
|
|
40
40
|
var query, sort, body;
|
|
41
41
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -78,7 +78,7 @@ var fetchLaunches = /*#__PURE__*/function () {
|
|
|
78
78
|
};
|
|
79
79
|
}();
|
|
80
80
|
var fetchRockets = /*#__PURE__*/function () {
|
|
81
|
-
var _ref2 = _asyncToGenerator(
|
|
81
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
82
82
|
var body;
|
|
83
83
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
84
84
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -17,7 +17,7 @@ var Properties = exports.Properties = function Properties() {
|
|
|
17
17
|
/*#__PURE__*/
|
|
18
18
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
19
19
|
// <Grommet theme={...}>
|
|
20
|
-
_react["default"].createElement(_grommet.Box, {
|
|
20
|
+
_react["default"].createElement(_grommet.Main, null, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
21
21
|
pad: "large"
|
|
22
22
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.Data, {
|
|
23
23
|
data: _data.DATA,
|
|
@@ -50,13 +50,14 @@ var Properties = exports.Properties = function Properties() {
|
|
|
50
50
|
size: "medium"
|
|
51
51
|
}, function (item) {
|
|
52
52
|
return /*#__PURE__*/_react["default"].createElement(_grommet.Card, {
|
|
53
|
+
as: "li",
|
|
53
54
|
key: item.name,
|
|
54
55
|
pad: "small"
|
|
55
56
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.CardBody, null, /*#__PURE__*/_react["default"].createElement(_grommet.Heading, {
|
|
56
57
|
level: 2,
|
|
57
58
|
margin: "none"
|
|
58
59
|
}, item.name), /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, amountFormatter.format(item.paid / 100))), /*#__PURE__*/_react["default"].createElement(_grommet.CardFooter, null, item.location || '--'));
|
|
59
|
-
})))
|
|
60
|
+
}))))
|
|
60
61
|
// </Grommet>
|
|
61
62
|
);
|
|
62
63
|
};
|
|
@@ -35,7 +35,7 @@ var buildQuery = function buildQuery(view) {
|
|
|
35
35
|
return query;
|
|
36
36
|
};
|
|
37
37
|
var fetchLaunches = /*#__PURE__*/function () {
|
|
38
|
-
var _ref = _asyncToGenerator(
|
|
38
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
|
|
39
39
|
var _view$sort, _view$sort2, _sort;
|
|
40
40
|
var query, sort, body;
|
|
41
41
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -78,7 +78,7 @@ var fetchLaunches = /*#__PURE__*/function () {
|
|
|
78
78
|
};
|
|
79
79
|
}();
|
|
80
80
|
var fetchRockets = /*#__PURE__*/function () {
|
|
81
|
-
var _ref2 = _asyncToGenerator(
|
|
81
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
82
82
|
var body;
|
|
83
83
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
84
84
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -14,7 +14,7 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
|
|
|
14
14
|
var step = 10; // default for https://swapi.dev
|
|
15
15
|
|
|
16
16
|
var fetchData = /*#__PURE__*/function () {
|
|
17
|
-
var _ref = _asyncToGenerator(
|
|
17
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view, signal) {
|
|
18
18
|
var params, url;
|
|
19
19
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -140,7 +140,7 @@ var DataFilter = exports.DataFilter = function DataFilter(_ref) {
|
|
|
140
140
|
var _properties$property4;
|
|
141
141
|
var step =
|
|
142
142
|
// from `range` on DataFilter
|
|
143
|
-
(rangeProp == null ? void 0 : rangeProp.step) || (
|
|
143
|
+
(rangeProp == null ? void 0 : rangeProp.step) || (// from range in Data `properties`
|
|
144
144
|
properties == null || (_properties$property4 = properties[property]) == null || (_properties$property4 = _properties$property4.range) == null ? void 0 : _properties$property4.step);
|
|
145
145
|
if (!step) {
|
|
146
146
|
// avoid floating point issues where 4.4 - 2 returns 2.4000000000000004
|
|
@@ -18,8 +18,8 @@ var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
|
18
18
|
var _excluded = ["drop", "options"];
|
|
19
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
21
|
-
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); }
|
|
22
21
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
22
|
+
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
23
|
var dropProps = {
|
|
24
24
|
align: {
|
|
25
25
|
top: 'bottom',
|
|
@@ -35,11 +35,44 @@ var Content = function Content(_ref) {
|
|
|
35
35
|
properties = _useContext.properties;
|
|
36
36
|
var _useContext2 = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
37
37
|
format = _useContext2.format;
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
var selectProps = (0, _react.useMemo)(function () {
|
|
39
|
+
var props = {};
|
|
40
|
+
if (optionsArg) {
|
|
41
|
+
props = {
|
|
42
|
+
options: optionsArg
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (properties && Array.isArray(properties)) {
|
|
46
|
+
props = {
|
|
47
|
+
options: properties
|
|
48
|
+
};
|
|
49
|
+
} else if (properties && typeof properties === 'object') {
|
|
50
|
+
props = {
|
|
51
|
+
options: Object.entries(properties).filter(function (_ref2) {
|
|
52
|
+
var sort = _ref2[1].sort;
|
|
53
|
+
return !(sort === false);
|
|
54
|
+
}).map(function (_ref3) {
|
|
55
|
+
var key = _ref3[0],
|
|
56
|
+
label = _ref3[1].label;
|
|
57
|
+
return {
|
|
58
|
+
key: key,
|
|
59
|
+
label: label || key
|
|
60
|
+
};
|
|
61
|
+
}).sort(function (a, b) {
|
|
62
|
+
return a.label.localeCompare(b.label);
|
|
63
|
+
}),
|
|
64
|
+
valueKey: {
|
|
65
|
+
key: 'key',
|
|
66
|
+
reduce: true
|
|
67
|
+
},
|
|
68
|
+
labelKey: 'label'
|
|
69
|
+
};
|
|
70
|
+
} else {
|
|
71
|
+
props = {
|
|
72
|
+
options: data.length > 0 && Object.keys(data[0]).sort() || data
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return props;
|
|
43
76
|
}, [data, optionsArg, properties]);
|
|
44
77
|
var directionOptions = [{
|
|
45
78
|
label: format({
|
|
@@ -63,11 +96,10 @@ var Content = function Content(_ref) {
|
|
|
63
96
|
id: 'dataSort.by',
|
|
64
97
|
messages: messages == null ? void 0 : messages.dataSort
|
|
65
98
|
})
|
|
66
|
-
}, /*#__PURE__*/_react["default"].createElement(_Select.Select, {
|
|
99
|
+
}, /*#__PURE__*/_react["default"].createElement(_Select.Select, _extends({
|
|
67
100
|
id: sortPropertyId,
|
|
68
|
-
name: "_sort.property"
|
|
69
|
-
|
|
70
|
-
})), /*#__PURE__*/_react["default"].createElement(_FormField.FormField, {
|
|
101
|
+
name: "_sort.property"
|
|
102
|
+
}, selectProps))), /*#__PURE__*/_react["default"].createElement(_FormField.FormField, {
|
|
71
103
|
key: "dir",
|
|
72
104
|
htmlFor: sortDirectionId,
|
|
73
105
|
label: format({
|
|
@@ -80,11 +112,11 @@ var Content = function Content(_ref) {
|
|
|
80
112
|
options: directionOptions
|
|
81
113
|
}))];
|
|
82
114
|
};
|
|
83
|
-
var DataSort = exports.DataSort = function DataSort(
|
|
115
|
+
var DataSort = exports.DataSort = function DataSort(_ref4) {
|
|
84
116
|
var _theme$data$button;
|
|
85
|
-
var drop =
|
|
86
|
-
options =
|
|
87
|
-
rest = _objectWithoutPropertiesLoose(
|
|
117
|
+
var drop = _ref4.drop,
|
|
118
|
+
options = _ref4.options,
|
|
119
|
+
rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
|
|
88
120
|
var _useContext3 = (0, _react.useContext)(_DataContext.DataContext),
|
|
89
121
|
dataId = _useContext3.id,
|
|
90
122
|
messages = _useContext3.messages;
|
|
@@ -6,6 +6,14 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
var _grommet = require("grommet");
|
|
7
7
|
var _data = require("../../DataTable/stories/data");
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
var properties = {};
|
|
10
|
+
_data.columns.forEach(function (_ref) {
|
|
11
|
+
var property = _ref.property,
|
|
12
|
+
header = _ref.header;
|
|
13
|
+
properties[property] = {
|
|
14
|
+
label: typeof header === 'string' ? header : property
|
|
15
|
+
};
|
|
16
|
+
});
|
|
9
17
|
var Simple = exports.Simple = function Simple() {
|
|
10
18
|
return (
|
|
11
19
|
/*#__PURE__*/
|
|
@@ -17,7 +25,8 @@ var Simple = exports.Simple = function Simple() {
|
|
|
17
25
|
pad: "large",
|
|
18
26
|
gap: "medium"
|
|
19
27
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.Data, {
|
|
20
|
-
data: _data.DATA
|
|
28
|
+
data: _data.DATA,
|
|
29
|
+
properties: properties
|
|
21
30
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.DataSort, null), /*#__PURE__*/_react["default"].createElement(_grommet.DataTable, {
|
|
22
31
|
columns: _data.columns
|
|
23
32
|
})))
|
|
@@ -73,7 +73,7 @@ var Row = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
73
73
|
return setActive(undefined);
|
|
74
74
|
} : undefined
|
|
75
75
|
}, (selected || onSelect) && /*#__PURE__*/_react["default"].createElement(_Cell.Cell, {
|
|
76
|
-
background: (pinnedOffset == null ? void 0 : pinnedOffset._grommetDataTableSelect) && cellProps.pinned.background || cellProps.background,
|
|
76
|
+
background: isSelected && cellProps.selected.background || (pinnedOffset == null ? void 0 : pinnedOffset._grommetDataTableSelect) && cellProps.pinned.background || cellProps.background,
|
|
77
77
|
border: cellProps.pinned.border || cellProps.border,
|
|
78
78
|
pinnedOffset: pinnedOffset == null ? void 0 : pinnedOffset._grommetDataTableSelect,
|
|
79
79
|
"aria-disabled": isDisabled || !onSelect || undefined,
|
|
@@ -100,6 +100,7 @@ var Row = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
100
100
|
},
|
|
101
101
|
verticalAlign: verticalAlign
|
|
102
102
|
}), rowDetails && /*#__PURE__*/_react["default"].createElement(_ExpanderCell.ExpanderCell, {
|
|
103
|
+
background: isSelected && cellProps.selected.background,
|
|
103
104
|
context: isRowExpanded ? 'groupHeader' : 'body',
|
|
104
105
|
expanded: isRowExpanded,
|
|
105
106
|
onToggle: function onToggle() {
|
|
@@ -116,11 +117,12 @@ var Row = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
116
117
|
}), columns.map(function (column) {
|
|
117
118
|
return /*#__PURE__*/_react["default"].createElement(_Cell.Cell, {
|
|
118
119
|
key: column.property,
|
|
119
|
-
background: column.pin && cellProps.pinned.background || cellProps.background,
|
|
120
|
+
background: isSelected && cellProps.selected.background || column.pin && cellProps.pinned.background || cellProps.background,
|
|
120
121
|
border: column.pin && cellProps.pinned.border || cellProps.border,
|
|
121
122
|
context: "body",
|
|
122
123
|
column: column,
|
|
123
124
|
datum: datum,
|
|
125
|
+
isSelected: isSelected,
|
|
124
126
|
pad: column.pin && cellProps.pinned.pad || cellProps.pad,
|
|
125
127
|
pinnedOffset: pinnedOffset && pinnedOffset[column.property],
|
|
126
128
|
primaryProperty: primaryProperty,
|
|
@@ -194,13 +196,17 @@ var Body = exports.Body = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, r
|
|
|
194
196
|
} : undefined
|
|
195
197
|
// The WCAG recommendation for checkboxes is to select them with "Space"
|
|
196
198
|
,
|
|
197
|
-
onSpace: function
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
onSpace: clickableRow ? function (event) {
|
|
200
|
+
event.preventDefault();
|
|
201
|
+
if (typeof onClickRow === 'function') {
|
|
202
|
+
event.persist();
|
|
203
|
+
var adjustedEvent = event;
|
|
204
|
+
adjustedEvent.datum = data == null ? void 0 : data[active];
|
|
205
|
+
onClickRow(adjustedEvent);
|
|
206
|
+
} else if (onClickRow === 'select') {
|
|
207
|
+
selectRow();
|
|
202
208
|
}
|
|
203
|
-
},
|
|
209
|
+
} : undefined,
|
|
204
210
|
onUp: onClickRow && active ? function () {
|
|
205
211
|
return setActive(active - 1);
|
|
206
212
|
} : undefined,
|
|
@@ -139,7 +139,7 @@ var GroupedBody = exports.GroupedBody = /*#__PURE__*/(0, _react.forwardRef)(func
|
|
|
139
139
|
key: key,
|
|
140
140
|
size: size
|
|
141
141
|
}, /*#__PURE__*/_react["default"].createElement(_ExpanderCell.ExpanderCell, {
|
|
142
|
-
background: cellProps.background,
|
|
142
|
+
background: isSelected && cellProps.selected.background || cellProps.background,
|
|
143
143
|
border: cellProps.border,
|
|
144
144
|
context: context,
|
|
145
145
|
pad: cellProps.pad,
|
|
@@ -147,7 +147,7 @@ var GroupedBody = exports.GroupedBody = /*#__PURE__*/(0, _react.forwardRef)(func
|
|
|
147
147
|
expanded: expanded,
|
|
148
148
|
verticalAlign: verticalAlign
|
|
149
149
|
}), (selected || onSelect) && /*#__PURE__*/_react["default"].createElement(_TableCell.TableCell, {
|
|
150
|
-
background: cellProps.background,
|
|
150
|
+
background: isSelected && cellProps.selected.background || cellProps.background,
|
|
151
151
|
border: cellProps.pinned.border || cellProps.border,
|
|
152
152
|
plain: "noPad",
|
|
153
153
|
size: "auto",
|
|
@@ -169,7 +169,7 @@ var GroupedBody = exports.GroupedBody = /*#__PURE__*/(0, _react.forwardRef)(func
|
|
|
169
169
|
}
|
|
170
170
|
return /*#__PURE__*/_react["default"].createElement(_Cell.Cell, {
|
|
171
171
|
key: column.property,
|
|
172
|
-
background: cellProps.background,
|
|
172
|
+
background: isSelected && cellProps.selected.background || cellProps.background,
|
|
173
173
|
border: cellProps.border,
|
|
174
174
|
context: context,
|
|
175
175
|
column: column,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.set = exports.normalizeRowProp = exports.normalizeRowCellProps = exports.normalizePrimaryProperty = exports.normalizeCellProps = exports.normalizeBackgroundColor = exports.initializeFilters = exports.filterAndSortData = exports.datumValue = exports.buildGroups = exports.buildGroupState = exports.buildFooterValues = void 0;
|
|
5
|
+
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); }
|
|
5
6
|
// This file contains helper functions for DataTable, to keep the component
|
|
6
7
|
// files simpler.
|
|
7
8
|
|
|
@@ -265,6 +266,7 @@ var cellPropertyNames = ['background', 'border', 'pad'];
|
|
|
265
266
|
// For example, background={{ header: { background } }}
|
|
266
267
|
// will become cellProps.header.background
|
|
267
268
|
var normalizeCellProps = exports.normalizeCellProps = function normalizeCellProps(props, theme) {
|
|
269
|
+
var _theme$dataTable3;
|
|
268
270
|
var result = {};
|
|
269
271
|
tableContextNames.forEach(function (context) {
|
|
270
272
|
result[context] = {
|
|
@@ -300,11 +302,13 @@ var normalizeCellProps = exports.normalizeCellProps = function normalizeCellProp
|
|
|
300
302
|
}
|
|
301
303
|
});
|
|
302
304
|
});
|
|
305
|
+
result.body.selected = _extends({}, theme == null || (_theme$dataTable3 = theme.dataTable) == null || (_theme$dataTable3 = _theme$dataTable3.body) == null ? void 0 : _theme$dataTable3.selected);
|
|
303
306
|
return result;
|
|
304
307
|
};
|
|
305
308
|
var normalizeRowCellProps = exports.normalizeRowCellProps = function normalizeRowCellProps(rowProps, cellProps, primaryKey, index) {
|
|
306
309
|
var result = {
|
|
307
|
-
pinned: {}
|
|
310
|
+
pinned: {},
|
|
311
|
+
selected: cellProps.selected
|
|
308
312
|
};
|
|
309
313
|
['background', 'border', 'pad'].forEach(function (propName) {
|
|
310
314
|
var _rowProps$primaryKey;
|
|
@@ -120,7 +120,7 @@ var SpaceX = exports.SpaceX = function SpaceX() {
|
|
|
120
120
|
}, [groups]);
|
|
121
121
|
(0, _react.useEffect)(function () {
|
|
122
122
|
var fetchData = /*#__PURE__*/function () {
|
|
123
|
-
var _ref5 = _asyncToGenerator(
|
|
123
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
124
124
|
var query;
|
|
125
125
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
126
126
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -157,7 +157,7 @@ var SpaceX = exports.SpaceX = function SpaceX() {
|
|
|
157
157
|
}, []);
|
|
158
158
|
(0, _react.useEffect)(function () {
|
|
159
159
|
var fetchData = /*#__PURE__*/function () {
|
|
160
|
-
var _ref6 = _asyncToGenerator(
|
|
160
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
161
161
|
var _sort;
|
|
162
162
|
var query;
|
|
163
163
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -70,7 +70,7 @@ var SpaceXUngrouped = exports.SpaceXUngrouped = function SpaceXUngrouped() {
|
|
|
70
70
|
setLimit = _useState3[1];
|
|
71
71
|
(0, _react.useEffect)(function () {
|
|
72
72
|
var fetchData = /*#__PURE__*/function () {
|
|
73
|
-
var _ref2 = _asyncToGenerator(
|
|
73
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
74
74
|
var _sort;
|
|
75
75
|
var query;
|
|
76
76
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -23,9 +23,8 @@ export interface FileInputProps {
|
|
|
23
23
|
multiple?: boolean | { aggregateThreshold?: number; max?: number };
|
|
24
24
|
name?: string;
|
|
25
25
|
onChange?: (
|
|
26
|
-
event
|
|
27
|
-
{ files }
|
|
28
|
-
{ target }?: { target: { files: FileList } },
|
|
26
|
+
event: React.ChangeEvent<HTMLInputElement>,
|
|
27
|
+
{ files }: { files: File[] },
|
|
29
28
|
) => void;
|
|
30
29
|
renderFile?: (...args: any[]) => void;
|
|
31
30
|
}
|
|
@@ -18,6 +18,7 @@ var _TextInput = require("../TextInput");
|
|
|
18
18
|
var _FormContext = require("../Form/FormContext");
|
|
19
19
|
var _propTypes = require("./propTypes");
|
|
20
20
|
var _useThemeValue3 = require("../../utils/useThemeValue");
|
|
21
|
+
var _AnnounceContext = require("../../contexts/AnnounceContext");
|
|
21
22
|
var _excluded = ["error", "info", "message", "type"],
|
|
22
23
|
_excluded2 = ["component", "disabled", "invalid", "name", "onChange"],
|
|
23
24
|
_excluded3 = ["children", "className", "component", "contentProps", "disabled", "error", "help", "htmlFor", "info", "label", "margin", "name", "onBlur", "onChange", "onFocus", "pad", "required", "style", "validate", "validateOn"];
|
|
@@ -26,8 +27,8 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
26
27
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
27
28
|
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); }
|
|
28
29
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
29
|
-
var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'SelectMultiple', 'TextArea', 'DateInput', 'FileInput', 'RadioButtonGroup', 'RangeInput', 'RangeSelector', 'StarRating', 'ThumbsRating'];
|
|
30
|
-
var grommetInputPadNames = ['CheckBox', 'CheckBoxGroup', 'RadioButtonGroup', 'RangeInput', 'RangeSelector'];
|
|
30
|
+
var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'SelectMultiple', 'TextArea', 'DateInput', 'FileInput', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector', 'StarRating', 'ThumbsRating'];
|
|
31
|
+
var grommetInputPadNames = ['CheckBox', 'CheckBoxGroup', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector'];
|
|
31
32
|
var isGrommetInput = function isGrommetInput(comp) {
|
|
32
33
|
return comp && (grommetInputNames.indexOf(comp.displayName) !== -1 || grommetInputPadNames.indexOf(comp.displayName) !== -1);
|
|
33
34
|
};
|
|
@@ -177,6 +178,12 @@ var FormField = exports.FormField = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
177
178
|
var themeBorder = formFieldTheme.border;
|
|
178
179
|
var debounce = (0, _useDebounce.useDebounce)();
|
|
179
180
|
var portalContext = (0, _react.useContext)(_utils.PortalContext);
|
|
181
|
+
var announce = (0, _react.useContext)(_AnnounceContext.AnnounceContext);
|
|
182
|
+
(0, _react.useEffect)(function () {
|
|
183
|
+
if (error && validate != null && validate.max) {
|
|
184
|
+
announce(error, 'polite', 5000);
|
|
185
|
+
}
|
|
186
|
+
}, [error, announce, validate == null ? void 0 : validate.max]);
|
|
180
187
|
var readOnlyField = (0, _react.useMemo)(function () {
|
|
181
188
|
var readOnly = false;
|
|
182
189
|
if (children) {
|
|
@@ -23,7 +23,10 @@ var ThresholdValidation = exports.ThresholdValidation = function ThresholdValida
|
|
|
23
23
|
},
|
|
24
24
|
name: "issue-description",
|
|
25
25
|
htmlFor: "issue-description"
|
|
26
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.TextInput
|
|
26
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.TextInput
|
|
27
|
+
// eslint-disable-next-line max-len
|
|
28
|
+
, {
|
|
29
|
+
"aria-label": "text input with limit of 10 characters and threshold of 0.25",
|
|
27
30
|
id: "issue-description",
|
|
28
31
|
name: "issue-description",
|
|
29
32
|
placeholder: "placeholder"
|
|
@@ -35,6 +38,7 @@ var ThresholdValidation = exports.ThresholdValidation = function ThresholdValida
|
|
|
35
38
|
name: "issue-description-with-default-threshold",
|
|
36
39
|
htmlFor: "issue-description-with-default-threshold"
|
|
37
40
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.TextInput, {
|
|
41
|
+
"aria-label": "text input with limit of 10 characters",
|
|
38
42
|
id: "issue-description-with-default-threshold",
|
|
39
43
|
name: "issue-description-with-default-threshold",
|
|
40
44
|
placeholder: "placeholder"
|