grommet 2.50.0 → 2.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Anchor/stories/Gap.stories.js +6 -0
- package/components/Box/Box.js +19 -0
- package/components/Button/Button.js +10 -1
- package/components/Calendar/Calendar.js +8 -5
- package/components/Grommet/index.d.ts +3 -0
- package/components/Grommet/propTypes.js +3 -0
- package/components/List/List.js +6 -4
- package/components/Meter/Meter.js +3 -6
- package/components/Select/Select.js +1 -0
- package/components/Select/SelectContainer.js +19 -2
- package/components/Select/index.d.ts +6 -1
- package/components/Select/propTypes.js +4 -1
- package/components/SelectMultiple/SelectMultipleContainer.js +11 -2
- package/components/SelectMultiple/index.d.ts +1 -0
- package/components/SelectMultiple/propTypes.js +1 -0
- package/es6/components/Anchor/stories/Gap.stories.js +6 -0
- package/es6/components/Box/Box.js +19 -0
- package/es6/components/Button/Button.js +10 -1
- package/es6/components/Calendar/Calendar.js +8 -5
- package/es6/components/Grommet/index.d.ts +3 -0
- package/es6/components/Grommet/propTypes.js +3 -0
- package/es6/components/List/List.js +6 -4
- package/es6/components/Meter/Meter.js +3 -6
- package/es6/components/Select/Select.js +1 -0
- package/es6/components/Select/SelectContainer.js +20 -3
- package/es6/components/Select/index.d.ts +6 -1
- package/es6/components/Select/propTypes.js +4 -1
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +11 -2
- package/es6/components/SelectMultiple/index.d.ts +1 -0
- package/es6/components/SelectMultiple/propTypes.js +1 -0
- package/es6/languages/default.json +3 -0
- package/es6/themes/base.d.ts +9 -0
- package/es6/themes/base.js +27 -1
- package/es6/utils/colors.js +29 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +3 -0
- package/package.json +43 -43
- package/themes/base.d.ts +9 -0
- package/themes/base.js +27 -1
- package/utils/colors.js +29 -0
|
@@ -25,6 +25,11 @@ var GapAnchor = function GapAnchor() {
|
|
|
25
25
|
label: "Large Gap",
|
|
26
26
|
href: "#",
|
|
27
27
|
gap: "large"
|
|
28
|
+
}), /*#__PURE__*/_react["default"].createElement(_grommet.Anchor, {
|
|
29
|
+
icon: /*#__PURE__*/_react["default"].createElement(_grommetIcons.Upload, null),
|
|
30
|
+
label: "xLarge Gap",
|
|
31
|
+
href: "#",
|
|
32
|
+
gap: "xlarge"
|
|
28
33
|
}), /*#__PURE__*/_react["default"].createElement(_grommet.Anchor, {
|
|
29
34
|
icon: /*#__PURE__*/_react["default"].createElement(_grommetIcons.Upload, null),
|
|
30
35
|
label: "5px Gap",
|
|
@@ -35,6 +40,7 @@ var GapAnchor = function GapAnchor() {
|
|
|
35
40
|
var Gap = exports.Gap = function Gap() {
|
|
36
41
|
return /*#__PURE__*/_react["default"].createElement(GapAnchor, null);
|
|
37
42
|
};
|
|
43
|
+
Gap.tags = ['internal'];
|
|
38
44
|
var _default = exports["default"] = {
|
|
39
45
|
title: 'Controls/Anchor/Gap'
|
|
40
46
|
};
|
package/components/Box/Box.js
CHANGED
|
@@ -21,6 +21,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
21
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
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; }
|
|
23
23
|
var Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, refProp) {
|
|
24
|
+
var _theme$global$depreca2;
|
|
24
25
|
var a11yTitle = _ref.a11yTitle,
|
|
25
26
|
backgroundProp = _ref.background,
|
|
26
27
|
border = _ref.border,
|
|
@@ -60,6 +61,24 @@ var Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, refP
|
|
|
60
61
|
var responsiveContainer = (0, _react.useContext)(_contexts.ResponsiveContainerContext);
|
|
61
62
|
var responsive = responsiveContainer && responsiveProp ? 'container' : responsiveProp;
|
|
62
63
|
var background = backgroundProp;
|
|
64
|
+
(0, _react.useEffect)(function () {
|
|
65
|
+
var _theme$global$depreca;
|
|
66
|
+
if (process.env.NODE_ENV !== 'production' && backgroundProp && (_theme$global$depreca = theme.global.deprecated) != null && _theme$global$depreca.backgrounds) {
|
|
67
|
+
var deprecatedBackground;
|
|
68
|
+
if (typeof backgroundProp === 'string') {
|
|
69
|
+
deprecatedBackground = theme.global.deprecated.backgrounds.find(function (item) {
|
|
70
|
+
return item.name === backgroundProp;
|
|
71
|
+
});
|
|
72
|
+
} else if (typeof backgroundProp === 'object') {
|
|
73
|
+
deprecatedBackground = theme.global.deprecated.backgrounds.find(function (item) {
|
|
74
|
+
return item.name === backgroundProp.image || item.name === backgroundProp.color;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (deprecatedBackground) {
|
|
78
|
+
console.warn(deprecatedBackground.message || "The background " + deprecatedBackground.name + " is deprecated.");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}, [backgroundProp, (_theme$global$depreca2 = theme.global.deprecated) == null ? void 0 : _theme$global$depreca2.backgrounds]);
|
|
63
82
|
var announce = (0, _react.useContext)(_AnnounceContext.AnnounceContext);
|
|
64
83
|
var containerRef = (0, _utils.useForwardedRef)(refProp);
|
|
65
84
|
|
|
@@ -145,7 +145,7 @@ var getPropertyColor = function getPropertyColor(property, paths, theme, kind, p
|
|
|
145
145
|
return result;
|
|
146
146
|
};
|
|
147
147
|
var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
148
|
-
var _theme$button$kind, _theme$button2;
|
|
148
|
+
var _theme$global$depreca2, _theme$button$kind, _theme$button2;
|
|
149
149
|
var active = _ref.active,
|
|
150
150
|
_ref$align = _ref.align,
|
|
151
151
|
align = _ref$align === void 0 ? 'center' : _ref$align,
|
|
@@ -212,6 +212,15 @@ var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
212
212
|
if ((icon || label) && children) {
|
|
213
213
|
console.warn('Button should not have children if icon or label is provided');
|
|
214
214
|
}
|
|
215
|
+
(0, _react.useEffect)(function () {
|
|
216
|
+
var _theme$global$depreca;
|
|
217
|
+
if (process.env.NODE_ENV !== 'production' && (_theme$global$depreca = theme.global.deprecated) != null && (_theme$global$depreca = _theme$global$depreca.button) != null && _theme$global$depreca.kind && kindArg) {
|
|
218
|
+
var deprecatedKind = theme.global.deprecated.button.kind.find(function (item) {
|
|
219
|
+
return item.name === kindArg;
|
|
220
|
+
});
|
|
221
|
+
if (deprecatedKind) console.warn(deprecatedKind.message || kindArg + " is deprecated.");
|
|
222
|
+
}
|
|
223
|
+
}, [kindArg, (_theme$global$depreca2 = theme.global.deprecated) == null || (_theme$global$depreca2 = _theme$global$depreca2.button) == null ? void 0 : _theme$global$depreca2.kind]);
|
|
215
224
|
var skeleton = (0, _Skeleton.useSkeleton)();
|
|
216
225
|
var sendAnalytics = (0, _AnalyticsContext.useAnalytics)();
|
|
217
226
|
var onClick = (0, _react.useCallback)(function (event) {
|
|
@@ -512,6 +512,8 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
512
512
|
return result;
|
|
513
513
|
}, [activeDate, value, range]);
|
|
514
514
|
var selectDate = (0, _react.useCallback)(function (selectedDate) {
|
|
515
|
+
// If no onSelect prop is provided, the calendar should be read-only
|
|
516
|
+
if (!onSelect) return;
|
|
515
517
|
var nextValue;
|
|
516
518
|
if (range || Array.isArray(value == null ? void 0 : value[0])) {
|
|
517
519
|
nextValue = handleRange(selectedDate);
|
|
@@ -706,9 +708,9 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
706
708
|
disabledProp: dayDisabled,
|
|
707
709
|
buttonProps: {
|
|
708
710
|
a11yTitle: day.toDateString(),
|
|
709
|
-
onClick: dayDisabled
|
|
711
|
+
onClick: !dayDisabled && !!onSelect ? function () {
|
|
710
712
|
return onClick(dateObject);
|
|
711
|
-
}
|
|
713
|
+
} : function () {}
|
|
712
714
|
},
|
|
713
715
|
isInRange: inRange,
|
|
714
716
|
isSelected: selected,
|
|
@@ -723,14 +725,15 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
723
725
|
days.push(/*#__PURE__*/_react["default"].createElement(CalendarCustomDay, {
|
|
724
726
|
key: day.getTime(),
|
|
725
727
|
"aria-selected": selected,
|
|
726
|
-
buttonProps:
|
|
727
|
-
a11yTitle: day.toDateString()
|
|
728
|
+
buttonProps: _extends({
|
|
729
|
+
a11yTitle: day.toDateString()
|
|
730
|
+
}, onSelect ? {
|
|
728
731
|
active: active && active.getTime() === day.getTime(),
|
|
729
732
|
disabled: dayDisabled,
|
|
730
733
|
onClick: dayDisabled ? function () {} : function () {
|
|
731
734
|
return onClick(dateObject);
|
|
732
735
|
}
|
|
733
|
-
} :
|
|
736
|
+
} : {}),
|
|
734
737
|
size: size,
|
|
735
738
|
fill: fill,
|
|
736
739
|
responsive: responsive
|
|
@@ -188,7 +188,9 @@ export interface GrommetProps {
|
|
|
188
188
|
};
|
|
189
189
|
};
|
|
190
190
|
select?: {
|
|
191
|
+
optionsA11y?: string;
|
|
191
192
|
multiple?: string;
|
|
193
|
+
searchA11y?: string;
|
|
192
194
|
selected?: string;
|
|
193
195
|
};
|
|
194
196
|
selectMultiple?: {
|
|
@@ -197,6 +199,7 @@ export interface GrommetProps {
|
|
|
197
199
|
open?: string;
|
|
198
200
|
optionNotSelected?: string;
|
|
199
201
|
optionSelected?: string;
|
|
202
|
+
optionsA11y?: string;
|
|
200
203
|
search?: string;
|
|
201
204
|
selectAll?: string;
|
|
202
205
|
selectAllA11y?: string;
|
|
@@ -189,7 +189,9 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
189
189
|
upper: _propTypes["default"].string
|
|
190
190
|
}),
|
|
191
191
|
select: _propTypes["default"].shape({
|
|
192
|
+
optionsA11y: _propTypes["default"].string,
|
|
192
193
|
multiple: _propTypes["default"].string,
|
|
194
|
+
searchA11y: _propTypes["default"].string,
|
|
193
195
|
selected: _propTypes["default"].string
|
|
194
196
|
}),
|
|
195
197
|
selectMultiple: _propTypes["default"].shape({
|
|
@@ -198,6 +200,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
198
200
|
open: _propTypes["default"].string,
|
|
199
201
|
optionSelected: _propTypes["default"].string,
|
|
200
202
|
optionNotSelected: _propTypes["default"].string,
|
|
203
|
+
optionsA11y: _propTypes["default"].string,
|
|
201
204
|
search: _propTypes["default"].string,
|
|
202
205
|
selectAll: _propTypes["default"].string,
|
|
203
206
|
selectAllA11y: _propTypes["default"].string,
|
package/components/List/List.js
CHANGED
|
@@ -259,15 +259,17 @@ var List = exports.List = /*#__PURE__*/_react["default"].forwardRef(function (_r
|
|
|
259
259
|
event.persist();
|
|
260
260
|
updateFocused(nextFocused);
|
|
261
261
|
var adjustedEvent = event;
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
// When paginated, use 'items'
|
|
263
|
+
var currentItems = !paginate ? orderingData || data : items;
|
|
264
|
+
adjustedEvent.item = currentItems[nextFocused];
|
|
265
|
+
adjustedEvent.index = !paginate ? nextFocused : (paginationProps.page - 1) * step + nextFocused;
|
|
264
266
|
onClickItem(adjustedEvent);
|
|
265
267
|
sendAnalytics({
|
|
266
268
|
type: 'listItemClick',
|
|
267
269
|
element: listRef.current,
|
|
268
270
|
event: adjustedEvent,
|
|
269
|
-
item:
|
|
270
|
-
index:
|
|
271
|
+
item: adjustedEvent.item,
|
|
272
|
+
index: adjustedEvent.index
|
|
271
273
|
});
|
|
272
274
|
}
|
|
273
275
|
}
|
|
@@ -13,13 +13,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
13
13
|
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); }
|
|
14
14
|
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; }
|
|
15
15
|
var Meter = exports.Meter = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
16
|
-
var _messages$meter;
|
|
16
|
+
var _theme$meter, _messages$meter;
|
|
17
17
|
var ariaLabel = _ref['aria-label'],
|
|
18
|
-
|
|
19
|
-
background = _ref$background === void 0 ? {
|
|
20
|
-
color: 'light-2',
|
|
21
|
-
opacity: 'medium'
|
|
22
|
-
} : _ref$background,
|
|
18
|
+
backgroundProp = _ref.background,
|
|
23
19
|
color = _ref.color,
|
|
24
20
|
_ref$direction = _ref.direction,
|
|
25
21
|
direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
|
|
@@ -39,6 +35,7 @@ var Meter = exports.Meter = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
|
|
|
39
35
|
theme = _useThemeValue.theme;
|
|
40
36
|
var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
41
37
|
format = _useContext.format;
|
|
38
|
+
var background = backgroundProp || ((_theme$meter = theme.meter) == null ? void 0 : _theme$meter.background);
|
|
42
39
|
|
|
43
40
|
// normalize values to an array of objects
|
|
44
41
|
var values = (0, _react.useMemo)(function () {
|
|
@@ -306,6 +306,7 @@ var Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
306
306
|
emptySearchMessage: emptySearchMessage,
|
|
307
307
|
id: id,
|
|
308
308
|
labelKey: labelKey,
|
|
309
|
+
messages: messages,
|
|
309
310
|
multiple: multiple,
|
|
310
311
|
name: name,
|
|
311
312
|
onChange: onSelectChange,
|
|
@@ -4,7 +4,9 @@ exports.__esModule = true;
|
|
|
4
4
|
exports.SelectContainer = void 0;
|
|
5
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
6
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
|
+
var _Search = require("grommet-icons/icons/Search");
|
|
7
8
|
var _utils = require("../../utils");
|
|
9
|
+
var _MessageContext = require("../../contexts/MessageContext");
|
|
8
10
|
var _Box = require("../Box");
|
|
9
11
|
var _Button = require("../Button");
|
|
10
12
|
var _InfiniteScroll = require("../InfiniteScroll");
|
|
@@ -76,7 +78,7 @@ var ClearButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
76
78
|
});
|
|
77
79
|
});
|
|
78
80
|
var SelectContainer = exports.SelectContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
79
|
-
var _theme$select;
|
|
81
|
+
var _theme$select$icons, _theme$select;
|
|
80
82
|
var clear = _ref3.clear,
|
|
81
83
|
_ref3$children = _ref3.children,
|
|
82
84
|
children = _ref3$children === void 0 ? null : _ref3$children,
|
|
@@ -87,6 +89,7 @@ var SelectContainer = exports.SelectContainer = /*#__PURE__*/(0, _react.forwardR
|
|
|
87
89
|
emptySearchMessage = _ref3$emptySearchMess === void 0 ? 'No matches found' : _ref3$emptySearchMess,
|
|
88
90
|
id = _ref3.id,
|
|
89
91
|
labelKey = _ref3.labelKey,
|
|
92
|
+
messages = _ref3.messages,
|
|
90
93
|
multiple = _ref3.multiple,
|
|
91
94
|
name = _ref3.name,
|
|
92
95
|
onChange = _ref3.onChange,
|
|
@@ -125,6 +128,11 @@ var SelectContainer = exports.SelectContainer = /*#__PURE__*/(0, _react.forwardR
|
|
|
125
128
|
var optionsRef = (0, _react.useRef)();
|
|
126
129
|
var clearRef = (0, _react.useRef)();
|
|
127
130
|
var activeRef = (0, _react.useRef)();
|
|
131
|
+
var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
132
|
+
format = _useContext.format;
|
|
133
|
+
var searchIcon = ((_theme$select$icons = theme.select.icons) == null ? void 0 : _theme$select$icons.search) || /*#__PURE__*/_react["default"].createElement(_Search.Search, {
|
|
134
|
+
"aria-hidden": true
|
|
135
|
+
});
|
|
128
136
|
|
|
129
137
|
// for keyboard/screenreader, keep the active option in focus
|
|
130
138
|
(0, _react.useEffect)(function () {
|
|
@@ -307,6 +315,10 @@ var SelectContainer = exports.SelectContainer = /*#__PURE__*/(0, _react.forwardR
|
|
|
307
315
|
pad: !customSearchInput ? (_theme$select = theme.select) == null || (_theme$select = _theme$select.search) == null ? void 0 : _theme$select.pad : undefined,
|
|
308
316
|
flex: false
|
|
309
317
|
}, /*#__PURE__*/_react["default"].createElement(SelectTextInput, {
|
|
318
|
+
"aria-label": format({
|
|
319
|
+
id: 'select.searchA11y',
|
|
320
|
+
messages: messages
|
|
321
|
+
}),
|
|
310
322
|
focusIndicator: !customSearchInput,
|
|
311
323
|
size: "small",
|
|
312
324
|
ref: searchRef,
|
|
@@ -321,7 +333,8 @@ var SelectContainer = exports.SelectContainer = /*#__PURE__*/(0, _react.forwardR
|
|
|
321
333
|
},
|
|
322
334
|
onFocus: function onFocus() {
|
|
323
335
|
return setActiveIndex(-1);
|
|
324
|
-
}
|
|
336
|
+
},
|
|
337
|
+
icon: searchIcon
|
|
325
338
|
})), shouldShowClearButton('top') && /*#__PURE__*/_react["default"].createElement(ClearButton, {
|
|
326
339
|
ref: clearRef,
|
|
327
340
|
clear: clear,
|
|
@@ -335,6 +348,10 @@ var SelectContainer = exports.SelectContainer = /*#__PURE__*/(0, _react.forwardR
|
|
|
335
348
|
},
|
|
336
349
|
theme: theme
|
|
337
350
|
}), options.length > 0 ? /*#__PURE__*/_react["default"].createElement(_StyledSelect.OptionsContainer, {
|
|
351
|
+
"aria-label": format({
|
|
352
|
+
id: 'select.optionsA11y',
|
|
353
|
+
messages: messages
|
|
354
|
+
}),
|
|
338
355
|
role: "listbox",
|
|
339
356
|
tabIndex: "-1",
|
|
340
357
|
ref: optionsRef,
|
|
@@ -30,7 +30,12 @@ export interface BasicSelectProps {
|
|
|
30
30
|
id?: string;
|
|
31
31
|
labelKey?: string | ((...args: any[]) => string | React.ReactNode);
|
|
32
32
|
margin?: MarginType;
|
|
33
|
-
messages?: {
|
|
33
|
+
messages?: {
|
|
34
|
+
optionsA11y?: string;
|
|
35
|
+
multiple?: string;
|
|
36
|
+
searchA11y?: string;
|
|
37
|
+
selected?: string;
|
|
38
|
+
};
|
|
34
39
|
name?: string;
|
|
35
40
|
onChange?: (...args: any[]) => void;
|
|
36
41
|
onClose?: (...args: any[]) => any;
|
|
@@ -24,7 +24,10 @@ var genericSelectProps = exports.genericSelectProps = _extends({}, _generalPropT
|
|
|
24
24
|
icon: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].func, _propTypes["default"].node, _propTypes["default"].elementType]),
|
|
25
25
|
labelKey: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].func]),
|
|
26
26
|
messages: _propTypes["default"].shape({
|
|
27
|
-
|
|
27
|
+
optionsA11y: _propTypes["default"].string,
|
|
28
|
+
multiple: _propTypes["default"].string,
|
|
29
|
+
searchA11y: _propTypes["default"].string,
|
|
30
|
+
selected: _propTypes["default"].string
|
|
28
31
|
}),
|
|
29
32
|
name: _propTypes["default"].string,
|
|
30
33
|
onChange: _propTypes["default"].func,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.SelectMultipleContainer = void 0;
|
|
5
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _Search = require("grommet-icons/icons/Search");
|
|
6
7
|
var _utils = require("../../utils");
|
|
7
8
|
var _Box = require("../Box");
|
|
8
9
|
var _Button = require("../Button");
|
|
@@ -20,7 +21,7 @@ var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
|
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 _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
23
|
var SelectMultipleContainer = exports.SelectMultipleContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
23
|
-
var _theme$selectMultiple2;
|
|
24
|
+
var _theme$select$icons, _theme$selectMultiple2;
|
|
24
25
|
var allOptions = _ref.allOptions,
|
|
25
26
|
_ref$children = _ref.children,
|
|
26
27
|
children = _ref$children === void 0 ? null : _ref$children,
|
|
@@ -79,6 +80,9 @@ var SelectMultipleContainer = exports.SelectMultipleContainer = /*#__PURE__*/(0,
|
|
|
79
80
|
setShowA11yLimit = _useState4[1];
|
|
80
81
|
var clearRef = (0, _react.useRef)();
|
|
81
82
|
var isDisabled = (0, _utils2.useDisabled)(disabled, disabledKey, options, valueKey || labelKey);
|
|
83
|
+
var searchIcon = ((_theme$select$icons = theme.select.icons) == null ? void 0 : _theme$select$icons.search) || /*#__PURE__*/_react["default"].createElement(_Search.Search, {
|
|
84
|
+
"aria-hidden": true
|
|
85
|
+
});
|
|
82
86
|
|
|
83
87
|
// for keyboard/screenreader, keep the active option in focus
|
|
84
88
|
(0, _react.useEffect)(function () {
|
|
@@ -336,8 +340,13 @@ var SelectMultipleContainer = exports.SelectMultipleContainer = /*#__PURE__*/(0,
|
|
|
336
340
|
},
|
|
337
341
|
onFocus: function onFocus() {
|
|
338
342
|
return setActiveIndex(-1);
|
|
339
|
-
}
|
|
343
|
+
},
|
|
344
|
+
icon: searchIcon
|
|
340
345
|
}))), helpContent, (options == null ? void 0 : options.length) > 0 ? /*#__PURE__*/_react["default"].createElement(_StyledSelect.OptionsContainer, {
|
|
346
|
+
"aria-label": format({
|
|
347
|
+
id: 'selectMultiple.optionsA11y',
|
|
348
|
+
messages: messages
|
|
349
|
+
}),
|
|
341
350
|
role: "listbox",
|
|
342
351
|
tabIndex: "-1",
|
|
343
352
|
ref: optionsRef,
|
|
@@ -21,6 +21,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
21
21
|
open: _propTypes["default"].string,
|
|
22
22
|
optionNotSelected: _propTypes["default"].string,
|
|
23
23
|
optionSelected: _propTypes["default"].string,
|
|
24
|
+
optionsA11y: _propTypes["default"].string,
|
|
24
25
|
search: _propTypes["default"].string,
|
|
25
26
|
selectAll: _propTypes["default"].string,
|
|
26
27
|
selectAllA11y: _propTypes["default"].string,
|
|
@@ -20,6 +20,11 @@ var GapAnchor = function GapAnchor() {
|
|
|
20
20
|
label: "Large Gap",
|
|
21
21
|
href: "#",
|
|
22
22
|
gap: "large"
|
|
23
|
+
}), /*#__PURE__*/React.createElement(Anchor, {
|
|
24
|
+
icon: /*#__PURE__*/React.createElement(Upload, null),
|
|
25
|
+
label: "xLarge Gap",
|
|
26
|
+
href: "#",
|
|
27
|
+
gap: "xlarge"
|
|
23
28
|
}), /*#__PURE__*/React.createElement(Anchor, {
|
|
24
29
|
icon: /*#__PURE__*/React.createElement(Upload, null),
|
|
25
30
|
label: "5px Gap",
|
|
@@ -30,6 +35,7 @@ var GapAnchor = function GapAnchor() {
|
|
|
30
35
|
export var Gap = function Gap() {
|
|
31
36
|
return /*#__PURE__*/React.createElement(GapAnchor, null);
|
|
32
37
|
};
|
|
38
|
+
Gap.tags = ['internal'];
|
|
33
39
|
export default {
|
|
34
40
|
title: 'Controls/Anchor/Gap'
|
|
35
41
|
};
|
|
@@ -16,6 +16,7 @@ import { ResponsiveContainerProvider } from './ResponsiveContainerProvider';
|
|
|
16
16
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
17
17
|
import { supportsContainerQueries } from '../../utils/responsive';
|
|
18
18
|
var Box = /*#__PURE__*/forwardRef(function (_ref, refProp) {
|
|
19
|
+
var _theme$global$depreca2;
|
|
19
20
|
var a11yTitle = _ref.a11yTitle,
|
|
20
21
|
backgroundProp = _ref.background,
|
|
21
22
|
border = _ref.border,
|
|
@@ -55,6 +56,24 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, refProp) {
|
|
|
55
56
|
var responsiveContainer = useContext(ResponsiveContainerContext);
|
|
56
57
|
var responsive = responsiveContainer && responsiveProp ? 'container' : responsiveProp;
|
|
57
58
|
var background = backgroundProp;
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
var _theme$global$depreca;
|
|
61
|
+
if (process.env.NODE_ENV !== 'production' && backgroundProp && (_theme$global$depreca = theme.global.deprecated) != null && _theme$global$depreca.backgrounds) {
|
|
62
|
+
var deprecatedBackground;
|
|
63
|
+
if (typeof backgroundProp === 'string') {
|
|
64
|
+
deprecatedBackground = theme.global.deprecated.backgrounds.find(function (item) {
|
|
65
|
+
return item.name === backgroundProp;
|
|
66
|
+
});
|
|
67
|
+
} else if (typeof backgroundProp === 'object') {
|
|
68
|
+
deprecatedBackground = theme.global.deprecated.backgrounds.find(function (item) {
|
|
69
|
+
return item.name === backgroundProp.image || item.name === backgroundProp.color;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (deprecatedBackground) {
|
|
73
|
+
console.warn(deprecatedBackground.message || "The background " + deprecatedBackground.name + " is deprecated.");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, [backgroundProp, (_theme$global$depreca2 = theme.global.deprecated) == null ? void 0 : _theme$global$depreca2.backgrounds]);
|
|
58
77
|
var announce = useContext(AnnounceContext);
|
|
59
78
|
var containerRef = useForwardedRef(refProp);
|
|
60
79
|
|
|
@@ -139,7 +139,7 @@ var getPropertyColor = function getPropertyColor(property, paths, theme, kind, p
|
|
|
139
139
|
return result;
|
|
140
140
|
};
|
|
141
141
|
var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
142
|
-
var _theme$button$kind, _theme$button2;
|
|
142
|
+
var _theme$global$depreca2, _theme$button$kind, _theme$button2;
|
|
143
143
|
var active = _ref.active,
|
|
144
144
|
_ref$align = _ref.align,
|
|
145
145
|
align = _ref$align === void 0 ? 'center' : _ref$align,
|
|
@@ -206,6 +206,15 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
206
206
|
if ((icon || label) && children) {
|
|
207
207
|
console.warn('Button should not have children if icon or label is provided');
|
|
208
208
|
}
|
|
209
|
+
useEffect(function () {
|
|
210
|
+
var _theme$global$depreca;
|
|
211
|
+
if (process.env.NODE_ENV !== 'production' && (_theme$global$depreca = theme.global.deprecated) != null && (_theme$global$depreca = _theme$global$depreca.button) != null && _theme$global$depreca.kind && kindArg) {
|
|
212
|
+
var deprecatedKind = theme.global.deprecated.button.kind.find(function (item) {
|
|
213
|
+
return item.name === kindArg;
|
|
214
|
+
});
|
|
215
|
+
if (deprecatedKind) console.warn(deprecatedKind.message || kindArg + " is deprecated.");
|
|
216
|
+
}
|
|
217
|
+
}, [kindArg, (_theme$global$depreca2 = theme.global.deprecated) == null || (_theme$global$depreca2 = _theme$global$depreca2.button) == null ? void 0 : _theme$global$depreca2.kind]);
|
|
209
218
|
var skeleton = useSkeleton();
|
|
210
219
|
var sendAnalytics = useAnalytics();
|
|
211
220
|
var onClick = useCallback(function (event) {
|
|
@@ -508,6 +508,8 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
|
508
508
|
return result;
|
|
509
509
|
}, [activeDate, value, range]);
|
|
510
510
|
var selectDate = useCallback(function (selectedDate) {
|
|
511
|
+
// If no onSelect prop is provided, the calendar should be read-only
|
|
512
|
+
if (!onSelect) return;
|
|
511
513
|
var nextValue;
|
|
512
514
|
if (range || Array.isArray(value == null ? void 0 : value[0])) {
|
|
513
515
|
nextValue = handleRange(selectedDate);
|
|
@@ -702,9 +704,9 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
|
702
704
|
disabledProp: dayDisabled,
|
|
703
705
|
buttonProps: {
|
|
704
706
|
a11yTitle: day.toDateString(),
|
|
705
|
-
onClick: dayDisabled
|
|
707
|
+
onClick: !dayDisabled && !!onSelect ? function () {
|
|
706
708
|
return onClick(dateObject);
|
|
707
|
-
}
|
|
709
|
+
} : function () {}
|
|
708
710
|
},
|
|
709
711
|
isInRange: inRange,
|
|
710
712
|
isSelected: selected,
|
|
@@ -719,14 +721,15 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
|
719
721
|
days.push(/*#__PURE__*/React.createElement(CalendarCustomDay, {
|
|
720
722
|
key: day.getTime(),
|
|
721
723
|
"aria-selected": selected,
|
|
722
|
-
buttonProps:
|
|
723
|
-
a11yTitle: day.toDateString()
|
|
724
|
+
buttonProps: _extends({
|
|
725
|
+
a11yTitle: day.toDateString()
|
|
726
|
+
}, onSelect ? {
|
|
724
727
|
active: active && active.getTime() === day.getTime(),
|
|
725
728
|
disabled: dayDisabled,
|
|
726
729
|
onClick: dayDisabled ? function () {} : function () {
|
|
727
730
|
return onClick(dateObject);
|
|
728
731
|
}
|
|
729
|
-
} :
|
|
732
|
+
} : {}),
|
|
730
733
|
size: size,
|
|
731
734
|
fill: fill,
|
|
732
735
|
responsive: responsive
|
|
@@ -188,7 +188,9 @@ export interface GrommetProps {
|
|
|
188
188
|
};
|
|
189
189
|
};
|
|
190
190
|
select?: {
|
|
191
|
+
optionsA11y?: string;
|
|
191
192
|
multiple?: string;
|
|
193
|
+
searchA11y?: string;
|
|
192
194
|
selected?: string;
|
|
193
195
|
};
|
|
194
196
|
selectMultiple?: {
|
|
@@ -197,6 +199,7 @@ export interface GrommetProps {
|
|
|
197
199
|
open?: string;
|
|
198
200
|
optionNotSelected?: string;
|
|
199
201
|
optionSelected?: string;
|
|
202
|
+
optionsA11y?: string;
|
|
200
203
|
search?: string;
|
|
201
204
|
selectAll?: string;
|
|
202
205
|
selectAllA11y?: string;
|
|
@@ -184,7 +184,9 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
184
184
|
upper: PropTypes.string
|
|
185
185
|
}),
|
|
186
186
|
select: PropTypes.shape({
|
|
187
|
+
optionsA11y: PropTypes.string,
|
|
187
188
|
multiple: PropTypes.string,
|
|
189
|
+
searchA11y: PropTypes.string,
|
|
188
190
|
selected: PropTypes.string
|
|
189
191
|
}),
|
|
190
192
|
selectMultiple: PropTypes.shape({
|
|
@@ -193,6 +195,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
193
195
|
open: PropTypes.string,
|
|
194
196
|
optionSelected: PropTypes.string,
|
|
195
197
|
optionNotSelected: PropTypes.string,
|
|
198
|
+
optionsA11y: PropTypes.string,
|
|
196
199
|
search: PropTypes.string,
|
|
197
200
|
selectAll: PropTypes.string,
|
|
198
201
|
selectAllA11y: PropTypes.string,
|
|
@@ -253,15 +253,17 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
253
253
|
event.persist();
|
|
254
254
|
updateFocused(nextFocused);
|
|
255
255
|
var adjustedEvent = event;
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
// When paginated, use 'items'
|
|
257
|
+
var currentItems = !paginate ? orderingData || data : items;
|
|
258
|
+
adjustedEvent.item = currentItems[nextFocused];
|
|
259
|
+
adjustedEvent.index = !paginate ? nextFocused : (paginationProps.page - 1) * step + nextFocused;
|
|
258
260
|
onClickItem(adjustedEvent);
|
|
259
261
|
sendAnalytics({
|
|
260
262
|
type: 'listItemClick',
|
|
261
263
|
element: listRef.current,
|
|
262
264
|
event: adjustedEvent,
|
|
263
|
-
item:
|
|
264
|
-
index:
|
|
265
|
+
item: adjustedEvent.item,
|
|
266
|
+
index: adjustedEvent.index
|
|
265
267
|
});
|
|
266
268
|
}
|
|
267
269
|
}
|
|
@@ -8,13 +8,9 @@ import { MeterPropTypes } from './propTypes';
|
|
|
8
8
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
9
9
|
import { MessageContext } from '../../contexts/MessageContext';
|
|
10
10
|
var Meter = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
11
|
-
var _messages$meter;
|
|
11
|
+
var _theme$meter, _messages$meter;
|
|
12
12
|
var ariaLabel = _ref['aria-label'],
|
|
13
|
-
|
|
14
|
-
background = _ref$background === void 0 ? {
|
|
15
|
-
color: 'light-2',
|
|
16
|
-
opacity: 'medium'
|
|
17
|
-
} : _ref$background,
|
|
13
|
+
backgroundProp = _ref.background,
|
|
18
14
|
color = _ref.color,
|
|
19
15
|
_ref$direction = _ref.direction,
|
|
20
16
|
direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
|
|
@@ -34,6 +30,7 @@ var Meter = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
34
30
|
theme = _useThemeValue.theme;
|
|
35
31
|
var _useContext = useContext(MessageContext),
|
|
36
32
|
format = _useContext.format;
|
|
33
|
+
var background = backgroundProp || ((_theme$meter = theme.meter) == null ? void 0 : _theme$meter.background);
|
|
37
34
|
|
|
38
35
|
// normalize values to an array of objects
|
|
39
36
|
var values = useMemo(function () {
|