grommet 2.49.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/DataTable/ExpanderCell.js +6 -3
- package/components/DataTable/Header.js +2 -1
- package/components/DataTable/Resizer.js +18 -7
- package/components/DataTable/stories/ResizePinned.stories.js +321 -0
- 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/DataTable/ExpanderCell.js +4 -1
- package/es6/components/DataTable/Header.js +2 -1
- package/es6/components/DataTable/Resizer.js +18 -7
- package/es6/components/DataTable/stories/ResizePinned.stories.js +316 -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 +4 -0
- package/es6/themes/base.js +4 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +3 -0
- package/package.json +42 -42
- package/themes/base.d.ts +4 -0
- package/themes/base.js +4 -1
|
@@ -398,7 +398,8 @@ var Header = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
398
398
|
style: {
|
|
399
399
|
width: widths != null && widths[property] ? widths[property] + "px" : undefined,
|
|
400
400
|
boxSizing: _onResize ? 'border-box' : undefined,
|
|
401
|
-
|
|
401
|
+
// Don't override positioning when DataTable has pin prop
|
|
402
|
+
position: _onResize && !columnPin && !pinProp ? 'relative' : undefined,
|
|
402
403
|
overflow: _onResize ? 'visible' : undefined
|
|
403
404
|
},
|
|
404
405
|
onResize: _onResize,
|
|
@@ -8,23 +8,33 @@ import { DropButton } from '../DropButton';
|
|
|
8
8
|
import { Keyboard } from '../Keyboard';
|
|
9
9
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
10
10
|
import { MessageContext } from '../../contexts/MessageContext';
|
|
11
|
+
import { edgeStyle } from '../../utils/styles';
|
|
11
12
|
|
|
12
13
|
// We determined 12 empirically as being wide enough to hit but
|
|
13
14
|
// not too wide to cause false hits.
|
|
14
15
|
var STEP = 12; // Used to determine the width change on resize
|
|
16
|
+
var resizerWidth = 24; // minimum width required for WCAG compliance
|
|
15
17
|
|
|
16
18
|
var StyledResizer = styled(DropButton).withConfig({
|
|
17
19
|
displayName: "Resizer__StyledResizer",
|
|
18
20
|
componentId: "sc-8l808w-0"
|
|
19
|
-
})(["display:flex;justify-content:center;
|
|
20
|
-
|
|
21
|
+
})(["display:flex;justify-content:center;", ";", ";", " ", " ", " ", " position:absolute;width:", "px;height:100%;top:0;cursor:col-resize;z-index:1;"], function (props) {
|
|
22
|
+
var _props$theme$dataTabl;
|
|
23
|
+
return edgeStyle('padding-top', (_props$theme$dataTabl = props.theme.dataTable) == null || (_props$theme$dataTabl = _props$theme$dataTabl.resize) == null || (_props$theme$dataTabl = _props$theme$dataTabl.padding) == null ? void 0 : _props$theme$dataTabl.vertical, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
|
|
21
24
|
}, function (props) {
|
|
22
|
-
|
|
25
|
+
var _props$theme$dataTabl2;
|
|
26
|
+
return edgeStyle('padding-bottom', (_props$theme$dataTabl2 = props.theme.dataTable) == null || (_props$theme$dataTabl2 = _props$theme$dataTabl2.resize) == null || (_props$theme$dataTabl2 = _props$theme$dataTabl2.padding) == null ? void 0 : _props$theme$dataTabl2.vertical, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
|
|
23
27
|
}, function (props) {
|
|
24
|
-
return props.theme.global.
|
|
25
|
-
})
|
|
28
|
+
return props.side === 'start' && "margin-left: -" + (resizerWidth / 2 - props.theme.global.borderSize.xsmall.replace('px', '')) + "px;";
|
|
29
|
+
}, function (props) {
|
|
30
|
+
return props.side === 'start' && "left: 0;";
|
|
31
|
+
}, function (props) {
|
|
32
|
+
return props.side === 'end' && "margin-right: -" + (resizerWidth / 2 - props.theme.global.borderSize.xsmall.replace('px', '')) + "px;";
|
|
33
|
+
}, function (props) {
|
|
34
|
+
return props.side === 'end' && "right: 0;";
|
|
35
|
+
}, resizerWidth);
|
|
26
36
|
var Resizer = function Resizer(_ref) {
|
|
27
|
-
var _theme$dataTable$icon, _theme$dataTable$icon2;
|
|
37
|
+
var _theme$dataTable$icon, _theme$dataTable$icon2, _border;
|
|
28
38
|
var onResize = _ref.onResize,
|
|
29
39
|
property = _ref.property,
|
|
30
40
|
headerText = _ref.headerText,
|
|
@@ -214,7 +224,8 @@ var Resizer = function Resizer(_ref) {
|
|
|
214
224
|
})),
|
|
215
225
|
dropAlign: {
|
|
216
226
|
top: 'bottom'
|
|
217
|
-
}
|
|
227
|
+
},
|
|
228
|
+
side: (_border = border) == null ? void 0 : _border.side
|
|
218
229
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
219
230
|
border: hover || active ? hoverBorder : border,
|
|
220
231
|
height: "100%",
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, DataTable, Heading, Text } from 'grommet';
|
|
3
|
+
var data = [{
|
|
4
|
+
id: 'b0:2a:43:52:48:c5',
|
|
5
|
+
macAddress: 'b0:2a:43:52:48:c5',
|
|
6
|
+
ipAddress: '192.168.0.20',
|
|
7
|
+
hostname: 'wh7-dureal50',
|
|
8
|
+
connectionType: 'Wireless',
|
|
9
|
+
category: 'Network',
|
|
10
|
+
status: 'Active',
|
|
11
|
+
deviceName: 'Chromecast',
|
|
12
|
+
networkBand: {
|
|
13
|
+
value: 2.4,
|
|
14
|
+
unit: 'GHz'
|
|
15
|
+
},
|
|
16
|
+
linkRate: {
|
|
17
|
+
value: 72,
|
|
18
|
+
unit: 'Mbps'
|
|
19
|
+
}
|
|
20
|
+
}, {
|
|
21
|
+
id: '00:d0:2d:32:b6:cd',
|
|
22
|
+
macAddress: '00:d0:2d:32:b6:cd',
|
|
23
|
+
ipAddress: '192.168.0.24',
|
|
24
|
+
hostname: 'wh7-dureal50',
|
|
25
|
+
connectionType: 'Wireless',
|
|
26
|
+
category: 'Network',
|
|
27
|
+
status: 'Active',
|
|
28
|
+
deviceName: 'Gateway32B6CD',
|
|
29
|
+
networkBand: {
|
|
30
|
+
value: 2.4,
|
|
31
|
+
unit: 'GHz'
|
|
32
|
+
},
|
|
33
|
+
linkRate: {
|
|
34
|
+
value: 72,
|
|
35
|
+
unit: 'Mbps'
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
id: 'd8:6c:63:46:13:03',
|
|
39
|
+
macAddress: 'd8:6c:63:46:13:03',
|
|
40
|
+
ipAddress: '192.168.0.19',
|
|
41
|
+
hostname: 'wh7-dureal50',
|
|
42
|
+
connectionType: 'Wireless',
|
|
43
|
+
category: 'Network',
|
|
44
|
+
status: 'Active',
|
|
45
|
+
deviceName: 'Amazon-Firestick',
|
|
46
|
+
networkBand: {
|
|
47
|
+
value: 2.4,
|
|
48
|
+
unit: 'GHz'
|
|
49
|
+
},
|
|
50
|
+
linkRate: {
|
|
51
|
+
value: 72,
|
|
52
|
+
unit: 'Mbps'
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
id: 'f4:f5:d8:c0:e2:9c',
|
|
56
|
+
macAddress: 'f4:f5:d8:c0:e2:9c',
|
|
57
|
+
ipAddress: '192.168.0.21',
|
|
58
|
+
hostname: 'wh7-dureal50',
|
|
59
|
+
connectionType: 'Wireless',
|
|
60
|
+
category: 'Network',
|
|
61
|
+
status: 'Active',
|
|
62
|
+
deviceName: 'Google-Home',
|
|
63
|
+
networkBand: {
|
|
64
|
+
value: 2.4,
|
|
65
|
+
unit: 'GHz'
|
|
66
|
+
},
|
|
67
|
+
linkRate: {
|
|
68
|
+
value: 72,
|
|
69
|
+
unit: 'Mbps'
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
id: '38:f9:d3:b7:09:4e',
|
|
73
|
+
macAddress: '38:f9:d3:b7:09:4e',
|
|
74
|
+
ipAddress: '192.168.0.21',
|
|
75
|
+
hostname: 'wh7-dureal50',
|
|
76
|
+
connectionType: 'Wireless',
|
|
77
|
+
category: 'Network',
|
|
78
|
+
status: 'Active',
|
|
79
|
+
deviceName: 'Daras-MBP',
|
|
80
|
+
networkBand: {
|
|
81
|
+
value: 5,
|
|
82
|
+
unit: 'GHz'
|
|
83
|
+
},
|
|
84
|
+
linkRate: {
|
|
85
|
+
value: 702,
|
|
86
|
+
unit: 'Mbps'
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
id: '10:40:f3:85:67:44',
|
|
90
|
+
macAddress: '10:40:f3:85:67:44',
|
|
91
|
+
ipAddress: '192.168.0.13',
|
|
92
|
+
hostname: 'wh7-dureal50',
|
|
93
|
+
connectionType: 'Wireless',
|
|
94
|
+
category: 'Network',
|
|
95
|
+
status: 'Active',
|
|
96
|
+
deviceName: 'Daras-Air',
|
|
97
|
+
networkBand: {
|
|
98
|
+
value: 2.4,
|
|
99
|
+
unit: 'GHz'
|
|
100
|
+
},
|
|
101
|
+
linkRate: {
|
|
102
|
+
value: 78,
|
|
103
|
+
unit: 'Mbps'
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
id: 'a4:f1:e8:27:e7:1c',
|
|
107
|
+
macAddress: 'a4:f1:e8:27:e7:1c',
|
|
108
|
+
ipAddress: '192.168.0.11',
|
|
109
|
+
hostname: 'wh7-dureal50',
|
|
110
|
+
connectionType: 'Wireless',
|
|
111
|
+
category: 'Network',
|
|
112
|
+
status: 'Active',
|
|
113
|
+
deviceName: 'iPhone',
|
|
114
|
+
networkBand: {
|
|
115
|
+
value: 2.4,
|
|
116
|
+
unit: 'GHz'
|
|
117
|
+
},
|
|
118
|
+
linkRate: {
|
|
119
|
+
value: 24,
|
|
120
|
+
unit: 'Mbps'
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
id: '10:e7:c6:cb:f8:58',
|
|
124
|
+
macAddress: '10:e7:c6:cb:f8:58',
|
|
125
|
+
ipAddress: '192.168.0.22',
|
|
126
|
+
hostname: 'wh7-dureal50',
|
|
127
|
+
connectionType: 'Wireless',
|
|
128
|
+
category: 'Network',
|
|
129
|
+
status: 'Active',
|
|
130
|
+
deviceName: 'HPCBF857',
|
|
131
|
+
networkBand: {
|
|
132
|
+
value: 2.4,
|
|
133
|
+
unit: 'GHz'
|
|
134
|
+
},
|
|
135
|
+
linkRate: {
|
|
136
|
+
value: 24,
|
|
137
|
+
unit: 'Mbps'
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
id: '44:07:0b:ba:1e:eb',
|
|
141
|
+
macAddress: '44:07:0b:ba:1e:eb',
|
|
142
|
+
ipAddress: '192.168.0.18',
|
|
143
|
+
hostname: 'wh7-dureal50',
|
|
144
|
+
connectionType: 'Wireless',
|
|
145
|
+
category: 'Network',
|
|
146
|
+
status: 'Active',
|
|
147
|
+
deviceName: 'Google-Home-Mini',
|
|
148
|
+
networkBand: {
|
|
149
|
+
value: 2.4,
|
|
150
|
+
unit: 'GHz'
|
|
151
|
+
},
|
|
152
|
+
linkRate: {
|
|
153
|
+
value: 72,
|
|
154
|
+
unit: 'Mbps'
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
id: '00:f6:20:60:15:d0',
|
|
158
|
+
macAddress: '00:f6:20:60:15:d0',
|
|
159
|
+
ipAddress: '192.168.0.17',
|
|
160
|
+
hostname: 'wh7-dureal50',
|
|
161
|
+
connectionType: 'Wireless',
|
|
162
|
+
category: 'Network',
|
|
163
|
+
status: 'Active',
|
|
164
|
+
deviceName: 'Amazon-Alexa',
|
|
165
|
+
networkBand: {
|
|
166
|
+
value: 2.4,
|
|
167
|
+
unit: 'GHz'
|
|
168
|
+
},
|
|
169
|
+
linkRate: {
|
|
170
|
+
value: 72,
|
|
171
|
+
unit: 'Mbps'
|
|
172
|
+
}
|
|
173
|
+
}, {
|
|
174
|
+
id: '30:fd:38:88:49:f4',
|
|
175
|
+
macAddress: '30:fd:38:88:49:f4',
|
|
176
|
+
ipAddress: '192.168.0.16',
|
|
177
|
+
hostname: 'wh7-dureal50',
|
|
178
|
+
connectionType: 'Wireless',
|
|
179
|
+
category: 'Network',
|
|
180
|
+
status: 'Active',
|
|
181
|
+
deviceName: 'Google-Home-Mini',
|
|
182
|
+
networkBand: {
|
|
183
|
+
value: 2.4,
|
|
184
|
+
unit: 'GHz'
|
|
185
|
+
},
|
|
186
|
+
linkRate: {
|
|
187
|
+
value: 292,
|
|
188
|
+
unit: 'Mbps'
|
|
189
|
+
}
|
|
190
|
+
}, {
|
|
191
|
+
id: '7c:b0:c2:5c:94:a5',
|
|
192
|
+
macAddress: '7c:b0:c2:5c:94:a5',
|
|
193
|
+
ipAddress: '192.168.0.26',
|
|
194
|
+
hostname: 'wh7-dureal50',
|
|
195
|
+
connectionType: 'Wireless',
|
|
196
|
+
category: 'Network',
|
|
197
|
+
status: 'Active',
|
|
198
|
+
deviceName: 'N/A',
|
|
199
|
+
networkBand: {
|
|
200
|
+
value: 2.4,
|
|
201
|
+
unit: 'GHz'
|
|
202
|
+
},
|
|
203
|
+
linkRate: {
|
|
204
|
+
value: 6,
|
|
205
|
+
unit: 'Mbps'
|
|
206
|
+
}
|
|
207
|
+
}, {
|
|
208
|
+
id: 'E0:5F:45:96:F4:DD',
|
|
209
|
+
macAddress: 'E0:5F:45:96:F4:DD',
|
|
210
|
+
ipAddress: '192.168.0.25',
|
|
211
|
+
hostname: 'wh7-dureal50',
|
|
212
|
+
connectionType: 'Wireless',
|
|
213
|
+
category: 'Network',
|
|
214
|
+
status: 'Active',
|
|
215
|
+
deviceName: 'N/A',
|
|
216
|
+
networkBand: {
|
|
217
|
+
value: 2.4,
|
|
218
|
+
unit: 'GHz'
|
|
219
|
+
},
|
|
220
|
+
linkRate: {
|
|
221
|
+
value: 1,
|
|
222
|
+
unit: 'Mbps'
|
|
223
|
+
}
|
|
224
|
+
}];
|
|
225
|
+
var columns = [{
|
|
226
|
+
primary: true,
|
|
227
|
+
property: 'macAddress',
|
|
228
|
+
header: 'MAC address',
|
|
229
|
+
render: function render(datum) {
|
|
230
|
+
return datum.macAddress;
|
|
231
|
+
},
|
|
232
|
+
pin: true
|
|
233
|
+
}, {
|
|
234
|
+
property: 'ipAddress',
|
|
235
|
+
header: 'IP V4',
|
|
236
|
+
render: function render(datum) {
|
|
237
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
238
|
+
truncate: "tip"
|
|
239
|
+
}, datum.ipAddress);
|
|
240
|
+
},
|
|
241
|
+
size: 'xsmall',
|
|
242
|
+
align: 'end'
|
|
243
|
+
}, {
|
|
244
|
+
property: 'hostname',
|
|
245
|
+
header: 'Hostname',
|
|
246
|
+
render: function render(datum) {
|
|
247
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
248
|
+
truncate: "tip"
|
|
249
|
+
}, datum.hostname);
|
|
250
|
+
},
|
|
251
|
+
size: 'xsmall'
|
|
252
|
+
}, {
|
|
253
|
+
property: 'connectionType',
|
|
254
|
+
header: 'Connection type'
|
|
255
|
+
}, {
|
|
256
|
+
property: 'category',
|
|
257
|
+
header: 'Category'
|
|
258
|
+
}, {
|
|
259
|
+
property: 'deviceName',
|
|
260
|
+
header: 'Device name',
|
|
261
|
+
render: function render(datum) {
|
|
262
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
263
|
+
truncate: "tip"
|
|
264
|
+
}, datum.deviceName);
|
|
265
|
+
},
|
|
266
|
+
size: 'xsmall'
|
|
267
|
+
}, {
|
|
268
|
+
property: 'status',
|
|
269
|
+
header: 'Status'
|
|
270
|
+
}, {
|
|
271
|
+
property: 'networkBand.value',
|
|
272
|
+
header: 'Network band',
|
|
273
|
+
units: 'GHz',
|
|
274
|
+
render: function render(datum) {
|
|
275
|
+
return datum.networkBand.value;
|
|
276
|
+
},
|
|
277
|
+
align: 'end'
|
|
278
|
+
}, {
|
|
279
|
+
property: 'linkRate.value',
|
|
280
|
+
header: 'Link rate',
|
|
281
|
+
units: 'Mbps',
|
|
282
|
+
render: function render(datum) {
|
|
283
|
+
return datum.linkRate.value;
|
|
284
|
+
},
|
|
285
|
+
align: 'end'
|
|
286
|
+
}];
|
|
287
|
+
export var ResizablePinnedDataTable = function ResizablePinnedDataTable() {
|
|
288
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
289
|
+
align: "center",
|
|
290
|
+
pad: "large"
|
|
291
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
292
|
+
level: "3"
|
|
293
|
+
}, "Table with resizable & column sizes"), /*#__PURE__*/React.createElement(Box, {
|
|
294
|
+
align: "start",
|
|
295
|
+
height: "medium"
|
|
296
|
+
// restricting width to demonstrate pinned column behavior
|
|
297
|
+
,
|
|
298
|
+
width: {
|
|
299
|
+
width: 'xxlarge',
|
|
300
|
+
max: '100%'
|
|
301
|
+
},
|
|
302
|
+
overflow: "auto"
|
|
303
|
+
}, /*#__PURE__*/React.createElement(DataTable, {
|
|
304
|
+
"aria-describedby": "connected-heading",
|
|
305
|
+
data: data,
|
|
306
|
+
columns: columns,
|
|
307
|
+
pin: true,
|
|
308
|
+
resizeable: true
|
|
309
|
+
})))
|
|
310
|
+
// </Grommet>
|
|
311
|
+
;
|
|
312
|
+
};
|
|
313
|
+
ResizablePinnedDataTable.storyName = 'Resizable pinned columns';
|
|
314
|
+
export default {
|
|
315
|
+
title: 'Visualizations/DataTable/Resizable pinned columns'
|
|
316
|
+
};
|
|
@@ -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
|
@@ -1058,6 +1058,9 @@ export interface ThemeType {
|
|
|
1058
1058
|
size: string;
|
|
1059
1059
|
};
|
|
1060
1060
|
};
|
|
1061
|
+
padding?: {
|
|
1062
|
+
vertical?: string;
|
|
1063
|
+
};
|
|
1061
1064
|
};
|
|
1062
1065
|
primary?: {
|
|
1063
1066
|
weight?: string;
|
|
@@ -1925,6 +1928,7 @@ export interface ThemeType {
|
|
|
1925
1928
|
down?: React.ReactNode | Icon;
|
|
1926
1929
|
up?: React.ReactNode | Icon;
|
|
1927
1930
|
margin?: MarginType;
|
|
1931
|
+
search?: React.ReactNode | Icon;
|
|
1928
1932
|
};
|
|
1929
1933
|
listbox?: {
|
|
1930
1934
|
extend?: ExtendType;
|
package/es6/themes/base.js
CHANGED
|
@@ -1204,7 +1204,7 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1204
1204
|
border: {
|
|
1205
1205
|
color: 'border',
|
|
1206
1206
|
side: 'end'
|
|
1207
|
-
}
|
|
1207
|
+
},
|
|
1208
1208
|
// hover: {
|
|
1209
1209
|
// border: {
|
|
1210
1210
|
// color: undefined,
|
|
@@ -1212,6 +1212,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1212
1212
|
// size: undefined,
|
|
1213
1213
|
// },
|
|
1214
1214
|
// },
|
|
1215
|
+
padding: {
|
|
1216
|
+
vertical: 'xsmall'
|
|
1217
|
+
}
|
|
1215
1218
|
},
|
|
1216
1219
|
search: {
|
|
1217
1220
|
pad: {
|