grommet 2.50.0 → 2.51.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/Grommet/index.d.ts +3 -0
- package/components/Grommet/propTypes.js +3 -0
- package/components/List/List.js +6 -4
- 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/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/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 +1 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +3 -0
- package/package.json +41 -41
- package/themes/base.d.ts +1 -0
|
@@ -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
|
}
|
|
@@ -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,
|
|
@@ -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
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
var _excluded = ["clear", "onClear", "name", "theme"];
|
|
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 (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import React, { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import React, { forwardRef, useCallback, useEffect, useRef, useState, useContext } from 'react';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
|
+
import { Search } from 'grommet-icons/icons/Search';
|
|
6
7
|
import { setFocusWithoutScroll, getHoverIndicatorStyle, containsFocus } from '../../utils';
|
|
8
|
+
import { MessageContext } from '../../contexts/MessageContext';
|
|
7
9
|
import { Box } from '../Box';
|
|
8
10
|
import { Button } from '../Button';
|
|
9
11
|
import { InfiniteScroll } from '../InfiniteScroll';
|
|
@@ -71,7 +73,7 @@ var ClearButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
71
73
|
});
|
|
72
74
|
});
|
|
73
75
|
var SelectContainer = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
74
|
-
var _theme$select;
|
|
76
|
+
var _theme$select$icons, _theme$select;
|
|
75
77
|
var clear = _ref3.clear,
|
|
76
78
|
_ref3$children = _ref3.children,
|
|
77
79
|
children = _ref3$children === void 0 ? null : _ref3$children,
|
|
@@ -82,6 +84,7 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
82
84
|
emptySearchMessage = _ref3$emptySearchMess === void 0 ? 'No matches found' : _ref3$emptySearchMess,
|
|
83
85
|
id = _ref3.id,
|
|
84
86
|
labelKey = _ref3.labelKey,
|
|
87
|
+
messages = _ref3.messages,
|
|
85
88
|
multiple = _ref3.multiple,
|
|
86
89
|
name = _ref3.name,
|
|
87
90
|
onChange = _ref3.onChange,
|
|
@@ -120,6 +123,11 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
120
123
|
var optionsRef = useRef();
|
|
121
124
|
var clearRef = useRef();
|
|
122
125
|
var activeRef = useRef();
|
|
126
|
+
var _useContext = useContext(MessageContext),
|
|
127
|
+
format = _useContext.format;
|
|
128
|
+
var searchIcon = ((_theme$select$icons = theme.select.icons) == null ? void 0 : _theme$select$icons.search) || /*#__PURE__*/React.createElement(Search, {
|
|
129
|
+
"aria-hidden": true
|
|
130
|
+
});
|
|
123
131
|
|
|
124
132
|
// for keyboard/screenreader, keep the active option in focus
|
|
125
133
|
useEffect(function () {
|
|
@@ -302,6 +310,10 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
302
310
|
pad: !customSearchInput ? (_theme$select = theme.select) == null || (_theme$select = _theme$select.search) == null ? void 0 : _theme$select.pad : undefined,
|
|
303
311
|
flex: false
|
|
304
312
|
}, /*#__PURE__*/React.createElement(SelectTextInput, {
|
|
313
|
+
"aria-label": format({
|
|
314
|
+
id: 'select.searchA11y',
|
|
315
|
+
messages: messages
|
|
316
|
+
}),
|
|
305
317
|
focusIndicator: !customSearchInput,
|
|
306
318
|
size: "small",
|
|
307
319
|
ref: searchRef,
|
|
@@ -316,7 +328,8 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
316
328
|
},
|
|
317
329
|
onFocus: function onFocus() {
|
|
318
330
|
return setActiveIndex(-1);
|
|
319
|
-
}
|
|
331
|
+
},
|
|
332
|
+
icon: searchIcon
|
|
320
333
|
})), shouldShowClearButton('top') && /*#__PURE__*/React.createElement(ClearButton, {
|
|
321
334
|
ref: clearRef,
|
|
322
335
|
clear: clear,
|
|
@@ -330,6 +343,10 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
330
343
|
},
|
|
331
344
|
theme: theme
|
|
332
345
|
}), options.length > 0 ? /*#__PURE__*/React.createElement(OptionsContainer, {
|
|
346
|
+
"aria-label": format({
|
|
347
|
+
id: 'select.optionsA11y',
|
|
348
|
+
messages: messages
|
|
349
|
+
}),
|
|
333
350
|
role: "listbox",
|
|
334
351
|
tabIndex: "-1",
|
|
335
352
|
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;
|
|
@@ -19,7 +19,10 @@ export var genericSelectProps = _extends({}, genericProps, {
|
|
|
19
19
|
icon: PropTypes.oneOfType([PropTypes.bool, PropTypes.func, PropTypes.node, PropTypes.elementType]),
|
|
20
20
|
labelKey: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
21
21
|
messages: PropTypes.shape({
|
|
22
|
-
|
|
22
|
+
optionsA11y: PropTypes.string,
|
|
23
|
+
multiple: PropTypes.string,
|
|
24
|
+
searchA11y: PropTypes.string,
|
|
25
|
+
selected: PropTypes.string
|
|
23
26
|
}),
|
|
24
27
|
name: PropTypes.string,
|
|
25
28
|
onChange: PropTypes.func,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
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); }
|
|
2
2
|
import React, { forwardRef, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Search } from 'grommet-icons/icons/Search';
|
|
3
4
|
import { setFocusWithoutScroll } from '../../utils';
|
|
4
5
|
import { Box } from '../Box';
|
|
5
6
|
import { Button } from '../Button';
|
|
@@ -15,7 +16,7 @@ import { EmptySearchOption } from '../Select/EmptySearchOption';
|
|
|
15
16
|
import { MessageContext } from '../../contexts/MessageContext';
|
|
16
17
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
17
18
|
var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
18
|
-
var _theme$selectMultiple2;
|
|
19
|
+
var _theme$select$icons, _theme$selectMultiple2;
|
|
19
20
|
var allOptions = _ref.allOptions,
|
|
20
21
|
_ref$children = _ref.children,
|
|
21
22
|
children = _ref$children === void 0 ? null : _ref$children,
|
|
@@ -74,6 +75,9 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
74
75
|
setShowA11yLimit = _useState4[1];
|
|
75
76
|
var clearRef = useRef();
|
|
76
77
|
var isDisabled = useDisabled(disabled, disabledKey, options, valueKey || labelKey);
|
|
78
|
+
var searchIcon = ((_theme$select$icons = theme.select.icons) == null ? void 0 : _theme$select$icons.search) || /*#__PURE__*/React.createElement(Search, {
|
|
79
|
+
"aria-hidden": true
|
|
80
|
+
});
|
|
77
81
|
|
|
78
82
|
// for keyboard/screenreader, keep the active option in focus
|
|
79
83
|
useEffect(function () {
|
|
@@ -331,8 +335,13 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
331
335
|
},
|
|
332
336
|
onFocus: function onFocus() {
|
|
333
337
|
return setActiveIndex(-1);
|
|
334
|
-
}
|
|
338
|
+
},
|
|
339
|
+
icon: searchIcon
|
|
335
340
|
}))), helpContent, (options == null ? void 0 : options.length) > 0 ? /*#__PURE__*/React.createElement(OptionsContainer, {
|
|
341
|
+
"aria-label": format({
|
|
342
|
+
id: 'selectMultiple.optionsA11y',
|
|
343
|
+
messages: messages
|
|
344
|
+
}),
|
|
336
345
|
role: "listbox",
|
|
337
346
|
tabIndex: "-1",
|
|
338
347
|
ref: optionsRef,
|
|
@@ -16,6 +16,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
16
16
|
open: PropTypes.string,
|
|
17
17
|
optionNotSelected: PropTypes.string,
|
|
18
18
|
optionSelected: PropTypes.string,
|
|
19
|
+
optionsA11y: PropTypes.string,
|
|
19
20
|
search: PropTypes.string,
|
|
20
21
|
selectAll: PropTypes.string,
|
|
21
22
|
selectAllA11y: PropTypes.string,
|
|
@@ -166,7 +166,9 @@
|
|
|
166
166
|
"upper": "Upper Bounds"
|
|
167
167
|
},
|
|
168
168
|
"select": {
|
|
169
|
+
"optionsA11y": "list of options",
|
|
169
170
|
"multiple": "multiple",
|
|
171
|
+
"searchA11y": "Search options",
|
|
170
172
|
"selected": "; Selected: {currentSelectedValue}"
|
|
171
173
|
},
|
|
172
174
|
"selectMultiple": {
|
|
@@ -174,6 +176,7 @@
|
|
|
174
176
|
"clearAllA11y": "{selected} options selected. Clear all?",
|
|
175
177
|
"open": "Open drop",
|
|
176
178
|
"optionNotSelected": "{optionLabel} not selected",
|
|
179
|
+
"optionsA11y": "list of options",
|
|
177
180
|
"optionSelected": "{optionLabel} selected",
|
|
178
181
|
"search": "Search to filter options",
|
|
179
182
|
"selectAll": "Select All",
|
package/es6/themes/base.d.ts
CHANGED