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
|
@@ -78,6 +78,18 @@ export var betweenDates = function betweenDates(date, dates) {
|
|
|
78
78
|
}
|
|
79
79
|
return result;
|
|
80
80
|
};
|
|
81
|
+
export var getRangePosition = function getRangePosition(date, dates) {
|
|
82
|
+
var rangePosition;
|
|
83
|
+
if (dates) {
|
|
84
|
+
var _ref2 = Array.isArray(dates) ? dates.map(function (d) {
|
|
85
|
+
return d ? new Date(d) : undefined;
|
|
86
|
+
}) : [dates, undefined],
|
|
87
|
+
from = _ref2[0],
|
|
88
|
+
to = _ref2[1];
|
|
89
|
+
if (from && sameDay(date, from)) rangePosition = 'start';else if (to && sameDay(date, to)) rangePosition = 'end';
|
|
90
|
+
}
|
|
91
|
+
return rangePosition;
|
|
92
|
+
};
|
|
81
93
|
|
|
82
94
|
// withinDates takes an array of string dates or 2 element arrays and
|
|
83
95
|
// checks whether the supplied date matches any string or is between
|
|
@@ -85,6 +97,7 @@ export var betweenDates = function betweenDates(date, dates) {
|
|
|
85
97
|
// returns 2 if exact match, 1 if between, undefined otherwise
|
|
86
98
|
export var withinDates = function withinDates(date, dates) {
|
|
87
99
|
var result;
|
|
100
|
+
var rangePosition;
|
|
88
101
|
if (dates) {
|
|
89
102
|
if (Array.isArray(dates)) {
|
|
90
103
|
dates.some(function (d) {
|
|
@@ -94,6 +107,7 @@ export var withinDates = function withinDates(date, dates) {
|
|
|
94
107
|
}
|
|
95
108
|
} else {
|
|
96
109
|
result = betweenDates(date, d);
|
|
110
|
+
rangePosition = getRangePosition(date, d);
|
|
97
111
|
}
|
|
98
112
|
return result;
|
|
99
113
|
});
|
|
@@ -101,7 +115,7 @@ export var withinDates = function withinDates(date, dates) {
|
|
|
101
115
|
result = 2;
|
|
102
116
|
}
|
|
103
117
|
}
|
|
104
|
-
return result;
|
|
118
|
+
return [result, rangePosition];
|
|
105
119
|
};
|
|
106
120
|
export var handleOffset = function handleOffset(date) {
|
|
107
121
|
var normalizedDate = new Date(date);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box, Card, CardBody, CardFooter, CardHeader, Text } from 'grommet';
|
|
2
|
+
import { Box, Card, CardBody, CardFooter, CardHeader, Main, Text } from 'grommet';
|
|
3
3
|
export var Simple = function Simple() {
|
|
4
4
|
return (
|
|
5
5
|
/*#__PURE__*/
|
|
6
6
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
7
7
|
// <Grommet theme={...}>
|
|
8
|
-
React.createElement(Box, {
|
|
8
|
+
React.createElement(Main, null, /*#__PURE__*/React.createElement(Box, {
|
|
9
9
|
pad: "large",
|
|
10
10
|
gap: "medium",
|
|
11
11
|
width: "medium"
|
|
@@ -24,7 +24,7 @@ export var Simple = function Simple() {
|
|
|
24
24
|
pad: "small",
|
|
25
25
|
gap: "medium",
|
|
26
26
|
background: "light-1"
|
|
27
|
-
}, /*#__PURE__*/React.createElement(Text, null, "text - random component"), /*#__PURE__*/React.createElement(Box, null, "box - random component")))
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Text, null, "text - random component"), /*#__PURE__*/React.createElement(Box, null, "box - random component"))))
|
|
28
28
|
// </Grommet>
|
|
29
29
|
);
|
|
30
30
|
};
|
|
@@ -156,7 +156,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
156
156
|
var iconColor = normalizeColor(theme.carousel.icons.color || 'control', theme);
|
|
157
157
|
var selectors = [];
|
|
158
158
|
var wrappedChildren = Children.map(children, function (child, index) {
|
|
159
|
-
selectors.push(
|
|
159
|
+
selectors.push(/*#__PURE__*/React.createElement(Button, {
|
|
160
160
|
a11yTitle: format({
|
|
161
161
|
id: 'carousel.jump',
|
|
162
162
|
values: {
|
|
@@ -475,7 +475,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
475
475
|
}).join('-');
|
|
476
476
|
var gradientId = uniqueGradientId + "-" + id + "-gradient";
|
|
477
477
|
var maskId = uniqueGradientId + "-" + id + "-mask";
|
|
478
|
-
defs.push(
|
|
478
|
+
defs.push(/*#__PURE__*/React.createElement("linearGradient", {
|
|
479
479
|
key: "gradientId",
|
|
480
480
|
id: gradientId,
|
|
481
481
|
x1: 0,
|
|
@@ -493,7 +493,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
493
493
|
stopColor: normalizeColor(gradientColor, theme)
|
|
494
494
|
});
|
|
495
495
|
})));
|
|
496
|
-
defs.push(
|
|
496
|
+
defs.push(/*#__PURE__*/React.createElement("mask", {
|
|
497
497
|
key: "mask",
|
|
498
498
|
id: maskId
|
|
499
499
|
}, drawing));
|
|
@@ -552,7 +552,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
552
552
|
strokeWidth: strokeWidth
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
|
-
defs.push(
|
|
555
|
+
defs.push(/*#__PURE__*/React.createElement("pattern", {
|
|
556
556
|
key: patternId,
|
|
557
557
|
id: patternId,
|
|
558
558
|
width: _double,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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"];
|
|
1
|
+
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"];
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
4
|
import React, { forwardRef, useContext, useEffect, useState } from 'react';
|
|
@@ -21,6 +21,7 @@ var CheckBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
21
21
|
ariaLabel = _ref['aria-label'],
|
|
22
22
|
checkedProp = _ref.checked,
|
|
23
23
|
children = _ref.children,
|
|
24
|
+
containerProps = _ref.containerProps,
|
|
24
25
|
_ref$defaultChecked = _ref.defaultChecked,
|
|
25
26
|
defaultChecked = _ref$defaultChecked === void 0 ? false : _ref$defaultChecked,
|
|
26
27
|
disabled = _ref.disabled,
|
|
@@ -187,7 +188,7 @@ var CheckBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
187
188
|
onMouseOut: function onMouseOut(event) {
|
|
188
189
|
return _onMouseOut == null ? void 0 : _onMouseOut(event);
|
|
189
190
|
}
|
|
190
|
-
}, passThemeFlag, themeableProps), first, second);
|
|
191
|
+
}, passThemeFlag, themeableProps, containerProps), first, second);
|
|
191
192
|
});
|
|
192
193
|
CheckBox.displayName = 'CheckBox';
|
|
193
194
|
CheckBox.propTypes = CheckBoxPropTypes;
|
|
@@ -75,7 +75,7 @@ var CheckBoxGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
75
75
|
var checked = value.indexOf(valueOption) >= 0;
|
|
76
76
|
var disabled = disabledProp || option.disabled;
|
|
77
77
|
var key = label + "-" + valueOption;
|
|
78
|
-
if (option.checked) console.warn(
|
|
78
|
+
if (option.checked) console.warn(// eslint-disable-next-line max-len
|
|
79
79
|
"'checked' prop of an individual CheckBox shouldn't be used in a CheckBoxGroup component. Use the CheckBoxGroup 'value' prop instead.");
|
|
80
80
|
// value shouldn't propagate the input field and the onChange option
|
|
81
81
|
var omit = option.value,
|
|
@@ -65,7 +65,7 @@ var Element = function Element(_ref2) {
|
|
|
65
65
|
number: ones
|
|
66
66
|
})];
|
|
67
67
|
if (sep) {
|
|
68
|
-
result.unshift(
|
|
68
|
+
result.unshift(/*#__PURE__*/React.createElement(StyledDigitalDigit, _extends({
|
|
69
69
|
key: "sep",
|
|
70
70
|
size: size
|
|
71
71
|
}, passThemeFlag), ":"));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box, Card, CardBody, CardFooter, Cards, Data, Heading } from 'grommet';
|
|
2
|
+
import { Box, Card, CardBody, CardFooter, Cards, Data, Heading, Main } from 'grommet';
|
|
3
3
|
import { DATA } from '../../DataTable/stories/data';
|
|
4
4
|
export var Example = function Example() {
|
|
5
5
|
return (
|
|
6
6
|
/*#__PURE__*/
|
|
7
7
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
8
8
|
// <Grommet theme={...}>
|
|
9
|
-
React.createElement(Box, {
|
|
9
|
+
React.createElement(Main, null, /*#__PURE__*/React.createElement(Box, {
|
|
10
10
|
pad: "large"
|
|
11
11
|
}, /*#__PURE__*/React.createElement(Data, {
|
|
12
12
|
data: DATA,
|
|
@@ -15,13 +15,14 @@ export var Example = function Example() {
|
|
|
15
15
|
size: "medium"
|
|
16
16
|
}, function (item) {
|
|
17
17
|
return /*#__PURE__*/React.createElement(Card, {
|
|
18
|
+
as: "li",
|
|
18
19
|
key: item.name,
|
|
19
20
|
pad: "small"
|
|
20
21
|
}, /*#__PURE__*/React.createElement(CardBody, null, /*#__PURE__*/React.createElement(Heading, {
|
|
21
22
|
level: 2,
|
|
22
23
|
margin: "none"
|
|
23
24
|
}, item.name)), /*#__PURE__*/React.createElement(CardFooter, null, item.location || '--'));
|
|
24
|
-
})))
|
|
25
|
+
}))))
|
|
25
26
|
// </Grommet>
|
|
26
27
|
);
|
|
27
28
|
};
|
|
@@ -30,7 +30,7 @@ var buildQuery = function buildQuery(view) {
|
|
|
30
30
|
return query;
|
|
31
31
|
};
|
|
32
32
|
var fetchLaunches = /*#__PURE__*/function () {
|
|
33
|
-
var _ref = _asyncToGenerator(
|
|
33
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
|
|
34
34
|
var _view$sort, _view$sort2, _sort;
|
|
35
35
|
var query, sort, body;
|
|
36
36
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -72,7 +72,7 @@ var fetchLaunches = /*#__PURE__*/function () {
|
|
|
72
72
|
};
|
|
73
73
|
}();
|
|
74
74
|
var fetchRockets = /*#__PURE__*/function () {
|
|
75
|
-
var _ref2 = _asyncToGenerator(
|
|
75
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
76
76
|
var body;
|
|
77
77
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
78
78
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -29,7 +29,7 @@ var buildQuery = function buildQuery(view) {
|
|
|
29
29
|
return query;
|
|
30
30
|
};
|
|
31
31
|
var fetchLaunches = /*#__PURE__*/function () {
|
|
32
|
-
var _ref = _asyncToGenerator(
|
|
32
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
|
|
33
33
|
var _view$sort, _view$sort2, _sort;
|
|
34
34
|
var query, sort, body;
|
|
35
35
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -72,7 +72,7 @@ var fetchLaunches = /*#__PURE__*/function () {
|
|
|
72
72
|
};
|
|
73
73
|
}();
|
|
74
74
|
var fetchRockets = /*#__PURE__*/function () {
|
|
75
|
-
var _ref2 = _asyncToGenerator(
|
|
75
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
76
76
|
var body;
|
|
77
77
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
78
78
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box, Cards, Card, CardBody, CardFooter, Heading, Data, DataSort, DataSearch, DataFilters, Text, Toolbar } from 'grommet';
|
|
2
|
+
import { Box, Cards, Card, CardBody, CardFooter, Heading, Data, DataSort, DataSearch, DataFilters, Main, Text, Toolbar } from 'grommet';
|
|
3
3
|
import { DATA } from '../../DataTable/stories/data';
|
|
4
4
|
import { DataSummary } from '../../DataSummary';
|
|
5
5
|
var amountFormatter = new Intl.NumberFormat('en-US', {
|
|
@@ -12,7 +12,7 @@ export var Properties = function Properties() {
|
|
|
12
12
|
/*#__PURE__*/
|
|
13
13
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
14
14
|
// <Grommet theme={...}>
|
|
15
|
-
React.createElement(Box, {
|
|
15
|
+
React.createElement(Main, null, /*#__PURE__*/React.createElement(Box, {
|
|
16
16
|
pad: "large"
|
|
17
17
|
}, /*#__PURE__*/React.createElement(Data, {
|
|
18
18
|
data: DATA,
|
|
@@ -45,13 +45,14 @@ export var Properties = function Properties() {
|
|
|
45
45
|
size: "medium"
|
|
46
46
|
}, function (item) {
|
|
47
47
|
return /*#__PURE__*/React.createElement(Card, {
|
|
48
|
+
as: "li",
|
|
48
49
|
key: item.name,
|
|
49
50
|
pad: "small"
|
|
50
51
|
}, /*#__PURE__*/React.createElement(CardBody, null, /*#__PURE__*/React.createElement(Heading, {
|
|
51
52
|
level: 2,
|
|
52
53
|
margin: "none"
|
|
53
54
|
}, item.name), /*#__PURE__*/React.createElement(Text, null, amountFormatter.format(item.paid / 100))), /*#__PURE__*/React.createElement(CardFooter, null, item.location || '--'));
|
|
54
|
-
})))
|
|
55
|
+
}))))
|
|
55
56
|
// </Grommet>
|
|
56
57
|
);
|
|
57
58
|
};
|
|
@@ -29,7 +29,7 @@ var buildQuery = function buildQuery(view) {
|
|
|
29
29
|
return query;
|
|
30
30
|
};
|
|
31
31
|
var fetchLaunches = /*#__PURE__*/function () {
|
|
32
|
-
var _ref = _asyncToGenerator(
|
|
32
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view) {
|
|
33
33
|
var _view$sort, _view$sort2, _sort;
|
|
34
34
|
var query, sort, body;
|
|
35
35
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -72,7 +72,7 @@ var fetchLaunches = /*#__PURE__*/function () {
|
|
|
72
72
|
};
|
|
73
73
|
}();
|
|
74
74
|
var fetchRockets = /*#__PURE__*/function () {
|
|
75
|
-
var _ref2 = _asyncToGenerator(
|
|
75
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
76
76
|
var body;
|
|
77
77
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
78
78
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -9,7 +9,7 @@ import { Box, Data, List, Pagination } from 'grommet';
|
|
|
9
9
|
var step = 10; // default for https://swapi.dev
|
|
10
10
|
|
|
11
11
|
var fetchData = /*#__PURE__*/function () {
|
|
12
|
-
var _ref = _asyncToGenerator(
|
|
12
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view, signal) {
|
|
13
13
|
var params, url;
|
|
14
14
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15
15
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -135,7 +135,7 @@ export var DataFilter = function DataFilter(_ref) {
|
|
|
135
135
|
var _properties$property4;
|
|
136
136
|
var step =
|
|
137
137
|
// from `range` on DataFilter
|
|
138
|
-
(rangeProp == null ? void 0 : rangeProp.step) || (
|
|
138
|
+
(rangeProp == null ? void 0 : rangeProp.step) || (// from range in Data `properties`
|
|
139
139
|
properties == null || (_properties$property4 = properties[property]) == null || (_properties$property4 = _properties$property4.range) == null ? void 0 : _properties$property4.step);
|
|
140
140
|
if (!step) {
|
|
141
141
|
// avoid floating point issues where 4.4 - 2 returns 2.4000000000000004
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["drop", "options"];
|
|
2
|
-
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); }
|
|
3
2
|
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; }
|
|
3
|
+
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); }
|
|
4
4
|
import React, { useContext, useMemo, useState } from 'react';
|
|
5
5
|
import { Descend } from 'grommet-icons/icons/Descend';
|
|
6
6
|
import { DataContext } from '../../contexts/DataContext';
|
|
@@ -29,11 +29,44 @@ var Content = function Content(_ref) {
|
|
|
29
29
|
properties = _useContext.properties;
|
|
30
30
|
var _useContext2 = useContext(MessageContext),
|
|
31
31
|
format = _useContext2.format;
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
var selectProps = useMemo(function () {
|
|
33
|
+
var props = {};
|
|
34
|
+
if (optionsArg) {
|
|
35
|
+
props = {
|
|
36
|
+
options: optionsArg
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (properties && Array.isArray(properties)) {
|
|
40
|
+
props = {
|
|
41
|
+
options: properties
|
|
42
|
+
};
|
|
43
|
+
} else if (properties && typeof properties === 'object') {
|
|
44
|
+
props = {
|
|
45
|
+
options: Object.entries(properties).filter(function (_ref2) {
|
|
46
|
+
var sort = _ref2[1].sort;
|
|
47
|
+
return !(sort === false);
|
|
48
|
+
}).map(function (_ref3) {
|
|
49
|
+
var key = _ref3[0],
|
|
50
|
+
label = _ref3[1].label;
|
|
51
|
+
return {
|
|
52
|
+
key: key,
|
|
53
|
+
label: label || key
|
|
54
|
+
};
|
|
55
|
+
}).sort(function (a, b) {
|
|
56
|
+
return a.label.localeCompare(b.label);
|
|
57
|
+
}),
|
|
58
|
+
valueKey: {
|
|
59
|
+
key: 'key',
|
|
60
|
+
reduce: true
|
|
61
|
+
},
|
|
62
|
+
labelKey: 'label'
|
|
63
|
+
};
|
|
64
|
+
} else {
|
|
65
|
+
props = {
|
|
66
|
+
options: data.length > 0 && Object.keys(data[0]).sort() || data
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return props;
|
|
37
70
|
}, [data, optionsArg, properties]);
|
|
38
71
|
var directionOptions = [{
|
|
39
72
|
label: format({
|
|
@@ -57,11 +90,10 @@ var Content = function Content(_ref) {
|
|
|
57
90
|
id: 'dataSort.by',
|
|
58
91
|
messages: messages == null ? void 0 : messages.dataSort
|
|
59
92
|
})
|
|
60
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
61
94
|
id: sortPropertyId,
|
|
62
|
-
name: "_sort.property"
|
|
63
|
-
|
|
64
|
-
})), /*#__PURE__*/React.createElement(FormField, {
|
|
95
|
+
name: "_sort.property"
|
|
96
|
+
}, selectProps))), /*#__PURE__*/React.createElement(FormField, {
|
|
65
97
|
key: "dir",
|
|
66
98
|
htmlFor: sortDirectionId,
|
|
67
99
|
label: format({
|
|
@@ -74,11 +106,11 @@ var Content = function Content(_ref) {
|
|
|
74
106
|
options: directionOptions
|
|
75
107
|
}))];
|
|
76
108
|
};
|
|
77
|
-
export var DataSort = function DataSort(
|
|
109
|
+
export var DataSort = function DataSort(_ref4) {
|
|
78
110
|
var _theme$data$button;
|
|
79
|
-
var drop =
|
|
80
|
-
options =
|
|
81
|
-
rest = _objectWithoutPropertiesLoose(
|
|
111
|
+
var drop = _ref4.drop,
|
|
112
|
+
options = _ref4.options,
|
|
113
|
+
rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
|
|
82
114
|
var _useContext3 = useContext(DataContext),
|
|
83
115
|
dataId = _useContext3.id,
|
|
84
116
|
messages = _useContext3.messages;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box, Data, DataSort, DataTable } from 'grommet';
|
|
3
3
|
import { columns, DATA } from '../../DataTable/stories/data';
|
|
4
|
+
var properties = {};
|
|
5
|
+
columns.forEach(function (_ref) {
|
|
6
|
+
var property = _ref.property,
|
|
7
|
+
header = _ref.header;
|
|
8
|
+
properties[property] = {
|
|
9
|
+
label: typeof header === 'string' ? header : property
|
|
10
|
+
};
|
|
11
|
+
});
|
|
4
12
|
export var Simple = function Simple() {
|
|
5
13
|
return (
|
|
6
14
|
/*#__PURE__*/
|
|
@@ -12,7 +20,8 @@ export var Simple = function Simple() {
|
|
|
12
20
|
pad: "large",
|
|
13
21
|
gap: "medium"
|
|
14
22
|
}, /*#__PURE__*/React.createElement(Data, {
|
|
15
|
-
data: DATA
|
|
23
|
+
data: DATA,
|
|
24
|
+
properties: properties
|
|
16
25
|
}, /*#__PURE__*/React.createElement(DataSort, null), /*#__PURE__*/React.createElement(DataTable, {
|
|
17
26
|
columns: columns
|
|
18
27
|
})))
|
|
@@ -67,7 +67,7 @@ var Row = /*#__PURE__*/memo(function (_ref) {
|
|
|
67
67
|
return setActive(undefined);
|
|
68
68
|
} : undefined
|
|
69
69
|
}, (selected || onSelect) && /*#__PURE__*/React.createElement(Cell, {
|
|
70
|
-
background: (pinnedOffset == null ? void 0 : pinnedOffset._grommetDataTableSelect) && cellProps.pinned.background || cellProps.background,
|
|
70
|
+
background: isSelected && cellProps.selected.background || (pinnedOffset == null ? void 0 : pinnedOffset._grommetDataTableSelect) && cellProps.pinned.background || cellProps.background,
|
|
71
71
|
border: cellProps.pinned.border || cellProps.border,
|
|
72
72
|
pinnedOffset: pinnedOffset == null ? void 0 : pinnedOffset._grommetDataTableSelect,
|
|
73
73
|
"aria-disabled": isDisabled || !onSelect || undefined,
|
|
@@ -94,6 +94,7 @@ var Row = /*#__PURE__*/memo(function (_ref) {
|
|
|
94
94
|
},
|
|
95
95
|
verticalAlign: verticalAlign
|
|
96
96
|
}), rowDetails && /*#__PURE__*/React.createElement(ExpanderCell, {
|
|
97
|
+
background: isSelected && cellProps.selected.background,
|
|
97
98
|
context: isRowExpanded ? 'groupHeader' : 'body',
|
|
98
99
|
expanded: isRowExpanded,
|
|
99
100
|
onToggle: function onToggle() {
|
|
@@ -110,11 +111,12 @@ var Row = /*#__PURE__*/memo(function (_ref) {
|
|
|
110
111
|
}), columns.map(function (column) {
|
|
111
112
|
return /*#__PURE__*/React.createElement(Cell, {
|
|
112
113
|
key: column.property,
|
|
113
|
-
background: column.pin && cellProps.pinned.background || cellProps.background,
|
|
114
|
+
background: isSelected && cellProps.selected.background || column.pin && cellProps.pinned.background || cellProps.background,
|
|
114
115
|
border: column.pin && cellProps.pinned.border || cellProps.border,
|
|
115
116
|
context: "body",
|
|
116
117
|
column: column,
|
|
117
118
|
datum: datum,
|
|
119
|
+
isSelected: isSelected,
|
|
118
120
|
pad: column.pin && cellProps.pinned.pad || cellProps.pad,
|
|
119
121
|
pinnedOffset: pinnedOffset && pinnedOffset[column.property],
|
|
120
122
|
primaryProperty: primaryProperty,
|
|
@@ -188,13 +190,17 @@ var Body = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
188
190
|
} : undefined
|
|
189
191
|
// The WCAG recommendation for checkboxes is to select them with "Space"
|
|
190
192
|
,
|
|
191
|
-
onSpace: function
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
onSpace: clickableRow ? function (event) {
|
|
194
|
+
event.preventDefault();
|
|
195
|
+
if (typeof onClickRow === 'function') {
|
|
196
|
+
event.persist();
|
|
197
|
+
var adjustedEvent = event;
|
|
198
|
+
adjustedEvent.datum = data == null ? void 0 : data[active];
|
|
199
|
+
onClickRow(adjustedEvent);
|
|
200
|
+
} else if (onClickRow === 'select') {
|
|
201
|
+
selectRow();
|
|
196
202
|
}
|
|
197
|
-
},
|
|
203
|
+
} : undefined,
|
|
198
204
|
onUp: onClickRow && active ? function () {
|
|
199
205
|
return setActive(active - 1);
|
|
200
206
|
} : undefined,
|
|
@@ -133,7 +133,7 @@ export var GroupedBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
133
133
|
key: key,
|
|
134
134
|
size: size
|
|
135
135
|
}, /*#__PURE__*/React.createElement(ExpanderCell, {
|
|
136
|
-
background: cellProps.background,
|
|
136
|
+
background: isSelected && cellProps.selected.background || cellProps.background,
|
|
137
137
|
border: cellProps.border,
|
|
138
138
|
context: context,
|
|
139
139
|
pad: cellProps.pad,
|
|
@@ -141,7 +141,7 @@ export var GroupedBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
141
141
|
expanded: expanded,
|
|
142
142
|
verticalAlign: verticalAlign
|
|
143
143
|
}), (selected || onSelect) && /*#__PURE__*/React.createElement(TableCell, {
|
|
144
|
-
background: cellProps.background,
|
|
144
|
+
background: isSelected && cellProps.selected.background || cellProps.background,
|
|
145
145
|
border: cellProps.pinned.border || cellProps.border,
|
|
146
146
|
plain: "noPad",
|
|
147
147
|
size: "auto",
|
|
@@ -163,7 +163,7 @@ export var GroupedBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
163
163
|
}
|
|
164
164
|
return /*#__PURE__*/React.createElement(Cell, {
|
|
165
165
|
key: column.property,
|
|
166
|
-
background: cellProps.background,
|
|
166
|
+
background: isSelected && cellProps.selected.background || cellProps.background,
|
|
167
167
|
border: cellProps.border,
|
|
168
168
|
context: context,
|
|
169
169
|
column: column,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
// This file contains helper functions for DataTable, to keep the component
|
|
2
3
|
// files simpler.
|
|
3
4
|
|
|
@@ -262,6 +263,7 @@ var cellPropertyNames = ['background', 'border', 'pad'];
|
|
|
262
263
|
// For example, background={{ header: { background } }}
|
|
263
264
|
// will become cellProps.header.background
|
|
264
265
|
export var normalizeCellProps = function normalizeCellProps(props, theme) {
|
|
266
|
+
var _theme$dataTable3;
|
|
265
267
|
var result = {};
|
|
266
268
|
tableContextNames.forEach(function (context) {
|
|
267
269
|
result[context] = {
|
|
@@ -297,11 +299,13 @@ export var normalizeCellProps = function normalizeCellProps(props, theme) {
|
|
|
297
299
|
}
|
|
298
300
|
});
|
|
299
301
|
});
|
|
302
|
+
result.body.selected = _extends({}, theme == null || (_theme$dataTable3 = theme.dataTable) == null || (_theme$dataTable3 = _theme$dataTable3.body) == null ? void 0 : _theme$dataTable3.selected);
|
|
300
303
|
return result;
|
|
301
304
|
};
|
|
302
305
|
export var normalizeRowCellProps = function normalizeRowCellProps(rowProps, cellProps, primaryKey, index) {
|
|
303
306
|
var result = {
|
|
304
|
-
pinned: {}
|
|
307
|
+
pinned: {},
|
|
308
|
+
selected: cellProps.selected
|
|
305
309
|
};
|
|
306
310
|
['background', 'border', 'pad'].forEach(function (propName) {
|
|
307
311
|
var _rowProps$primaryKey;
|
|
@@ -114,7 +114,7 @@ export var SpaceX = function SpaceX() {
|
|
|
114
114
|
}, [groups]);
|
|
115
115
|
useEffect(function () {
|
|
116
116
|
var fetchData = /*#__PURE__*/function () {
|
|
117
|
-
var _ref5 = _asyncToGenerator(
|
|
117
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
118
118
|
var query;
|
|
119
119
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
120
120
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -151,7 +151,7 @@ export var SpaceX = function SpaceX() {
|
|
|
151
151
|
}, []);
|
|
152
152
|
useEffect(function () {
|
|
153
153
|
var fetchData = /*#__PURE__*/function () {
|
|
154
|
-
var _ref6 = _asyncToGenerator(
|
|
154
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
155
155
|
var _sort;
|
|
156
156
|
var query;
|
|
157
157
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -64,7 +64,7 @@ export var SpaceXUngrouped = function SpaceXUngrouped() {
|
|
|
64
64
|
setLimit = _useState3[1];
|
|
65
65
|
useEffect(function () {
|
|
66
66
|
var fetchData = /*#__PURE__*/function () {
|
|
67
|
-
var _ref2 = _asyncToGenerator(
|
|
67
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
68
68
|
var _sort;
|
|
69
69
|
var query;
|
|
70
70
|
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
|
}
|
|
@@ -3,7 +3,7 @@ var _excluded = ["error", "info", "message", "type"],
|
|
|
3
3
|
_excluded3 = ["children", "className", "component", "contentProps", "disabled", "error", "help", "htmlFor", "info", "label", "margin", "name", "onBlur", "onChange", "onFocus", "pad", "required", "style", "validate", "validateOn"];
|
|
4
4
|
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
5
|
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; }
|
|
6
|
-
import React, { Children, cloneElement, forwardRef, useContext, useMemo, useState } from 'react';
|
|
6
|
+
import React, { Children, cloneElement, forwardRef, useContext, useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { containsFocus, shouldKeepFocus, withinDropPortal, PortalContext } from '../../utils';
|
|
9
9
|
import { useDebounce } from '../../utils/use-debounce';
|
|
@@ -19,8 +19,9 @@ import { TextInput } from '../TextInput';
|
|
|
19
19
|
import { FormContext } from '../Form/FormContext';
|
|
20
20
|
import { FormFieldPropTypes } from './propTypes';
|
|
21
21
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
22
|
-
|
|
23
|
-
var
|
|
22
|
+
import { AnnounceContext } from '../../contexts/AnnounceContext';
|
|
23
|
+
var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'SelectMultiple', 'TextArea', 'DateInput', 'FileInput', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector', 'StarRating', 'ThumbsRating'];
|
|
24
|
+
var grommetInputPadNames = ['CheckBox', 'CheckBoxGroup', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector'];
|
|
24
25
|
var isGrommetInput = function isGrommetInput(comp) {
|
|
25
26
|
return comp && (grommetInputNames.indexOf(comp.displayName) !== -1 || grommetInputPadNames.indexOf(comp.displayName) !== -1);
|
|
26
27
|
};
|
|
@@ -170,6 +171,12 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
170
171
|
var themeBorder = formFieldTheme.border;
|
|
171
172
|
var debounce = useDebounce();
|
|
172
173
|
var portalContext = useContext(PortalContext);
|
|
174
|
+
var announce = useContext(AnnounceContext);
|
|
175
|
+
useEffect(function () {
|
|
176
|
+
if (error && validate != null && validate.max) {
|
|
177
|
+
announce(error, 'polite', 5000);
|
|
178
|
+
}
|
|
179
|
+
}, [error, announce, validate == null ? void 0 : validate.max]);
|
|
173
180
|
var readOnlyField = useMemo(function () {
|
|
174
181
|
var readOnly = false;
|
|
175
182
|
if (children) {
|
|
@@ -18,7 +18,10 @@ export var ThresholdValidation = function ThresholdValidation() {
|
|
|
18
18
|
},
|
|
19
19
|
name: "issue-description",
|
|
20
20
|
htmlFor: "issue-description"
|
|
21
|
-
}, /*#__PURE__*/React.createElement(TextInput
|
|
21
|
+
}, /*#__PURE__*/React.createElement(TextInput
|
|
22
|
+
// eslint-disable-next-line max-len
|
|
23
|
+
, {
|
|
24
|
+
"aria-label": "text input with limit of 10 characters and threshold of 0.25",
|
|
22
25
|
id: "issue-description",
|
|
23
26
|
name: "issue-description",
|
|
24
27
|
placeholder: "placeholder"
|
|
@@ -30,6 +33,7 @@ export var ThresholdValidation = function ThresholdValidation() {
|
|
|
30
33
|
name: "issue-description-with-default-threshold",
|
|
31
34
|
htmlFor: "issue-description-with-default-threshold"
|
|
32
35
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
36
|
+
"aria-label": "text input with limit of 10 characters",
|
|
33
37
|
id: "issue-description-with-default-threshold",
|
|
34
38
|
name: "issue-description-with-default-threshold",
|
|
35
39
|
placeholder: "placeholder"
|
|
@@ -120,6 +120,24 @@ export interface GrommetProps {
|
|
|
120
120
|
openMenu?: string;
|
|
121
121
|
closeMenu?: string;
|
|
122
122
|
};
|
|
123
|
+
meter?: {
|
|
124
|
+
bar?: {
|
|
125
|
+
singular?: string;
|
|
126
|
+
plural?: string;
|
|
127
|
+
};
|
|
128
|
+
circle?: {
|
|
129
|
+
singular?: string;
|
|
130
|
+
plural?: string;
|
|
131
|
+
};
|
|
132
|
+
pie?: {
|
|
133
|
+
singular?: string;
|
|
134
|
+
plural?: string;
|
|
135
|
+
};
|
|
136
|
+
semicircle?: {
|
|
137
|
+
singular?: string;
|
|
138
|
+
plural?: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
123
141
|
rangeSelector?: {
|
|
124
142
|
lower?: string;
|
|
125
143
|
upper?: string;
|
|
@@ -171,7 +189,7 @@ export interface GrommetProps {
|
|
|
171
189
|
volumeUp?: string;
|
|
172
190
|
};
|
|
173
191
|
};
|
|
174
|
-
format
|
|
192
|
+
format?: (...args: any[]) => void;
|
|
175
193
|
};
|
|
176
194
|
onAnalytics?: (data: any) => void;
|
|
177
195
|
plain?: boolean;
|