primereact 10.4.0 → 10.5.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/calendar/calendar.cjs.js +12 -4
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +12 -4
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +12 -4
- package/calendar/calendar.min.js +1 -1
- package/checkbox/checkbox.cjs.js +2 -0
- package/checkbox/checkbox.cjs.min.js +1 -1
- package/checkbox/checkbox.esm.js +2 -0
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +2 -0
- package/checkbox/checkbox.min.js +1 -1
- package/chips/chips.cjs.js +109 -20
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.esm.js +109 -20
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +109 -20
- package/chips/chips.min.js +1 -1
- package/core/core.js +643 -465
- package/core/core.min.js +4 -4
- package/dropdown/dropdown.cjs.js +313 -141
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +313 -141
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +313 -141
- package/dropdown/dropdown.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +21 -17
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +21 -17
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +21 -17
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/inputswitch.cjs.js +3 -1
- package/inputswitch/inputswitch.cjs.min.js +1 -1
- package/inputswitch/inputswitch.esm.js +3 -1
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +3 -1
- package/inputswitch/inputswitch.min.js +1 -1
- package/knob/knob.cjs.js +62 -0
- package/knob/knob.cjs.min.js +1 -1
- package/knob/knob.esm.js +62 -0
- package/knob/knob.esm.min.js +1 -1
- package/knob/knob.js +62 -0
- package/knob/knob.min.js +1 -1
- package/listbox/listbox.cjs.js +362 -92
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.esm.js +363 -93
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +362 -92
- package/listbox/listbox.min.js +1 -1
- package/menu/menu.cjs.js +4 -2
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +4 -2
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +5 -4
- package/menu/menu.min.js +1 -1
- package/multiselect/multiselect.cjs.js +377 -107
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.esm.js +377 -107
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +377 -107
- package/multiselect/multiselect.min.js +1 -1
- package/package.json +1 -1
- package/paginator/paginator.cjs.js +251 -251
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +258 -258
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +251 -251
- package/paginator/paginator.min.js +1 -1
- package/panelmenu/panelmenu.cjs.js +2 -1
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +2 -1
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +3 -3
- package/panelmenu/panelmenu.min.js +1 -1
- package/passthrough/tailwind/index.cjs.js +3 -2
- package/passthrough/tailwind/index.cjs.min.js +1 -1
- package/passthrough/tailwind/index.esm.js +3 -2
- package/passthrough/tailwind/index.esm.min.js +1 -1
- package/passthrough/tailwind/index.js +3 -2
- package/passthrough/tailwind/index.min.js +1 -1
- package/password/password.cjs.js +22 -20
- package/password/password.cjs.min.js +1 -1
- package/password/password.esm.js +22 -20
- package/password/password.esm.min.js +1 -1
- package/password/password.js +22 -20
- package/password/password.min.js +1 -1
- package/primereact.all.cjs.js +1473 -485
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +1473 -485
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +1473 -485
- package/primereact.all.min.js +1 -1
- package/radiobutton/radiobutton.cjs.js +1 -0
- package/radiobutton/radiobutton.cjs.min.js +1 -1
- package/radiobutton/radiobutton.esm.js +1 -0
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +1 -0
- package/radiobutton/radiobutton.min.js +1 -1
- package/rating/rating.cjs.js +103 -4
- package/rating/rating.cjs.min.js +1 -1
- package/rating/rating.esm.js +103 -4
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +103 -4
- package/rating/rating.min.js +1 -1
- package/resources/themes/arya-blue/theme.css +328 -67
- package/resources/themes/arya-green/theme.css +328 -67
- package/resources/themes/arya-orange/theme.css +328 -67
- package/resources/themes/arya-purple/theme.css +26 -6
- package/resources/themes/bootstrap4-dark-blue/theme.css +328 -67
- package/resources/themes/bootstrap4-dark-purple/theme.css +26 -6
- package/resources/themes/bootstrap4-light-blue/theme.css +328 -67
- package/resources/themes/bootstrap4-light-purple/theme.css +26 -6
- package/resources/themes/fluent-light/theme.css +327 -66
- package/resources/themes/lara-dark-amber/theme.css +328 -67
- package/resources/themes/lara-dark-blue/theme.css +328 -67
- package/resources/themes/lara-dark-cyan/theme.css +328 -67
- package/resources/themes/lara-dark-green/theme.css +328 -67
- package/resources/themes/lara-dark-indigo/theme.css +328 -67
- package/resources/themes/lara-dark-pink/theme.css +328 -67
- package/resources/themes/lara-dark-purple/theme.css +26 -6
- package/resources/themes/lara-dark-teal/theme.css +328 -67
- package/resources/themes/lara-light-amber/theme.css +328 -67
- package/resources/themes/lara-light-blue/theme.css +328 -67
- package/resources/themes/lara-light-cyan/theme.css +328 -67
- package/resources/themes/lara-light-green/theme.css +328 -67
- package/resources/themes/lara-light-indigo/theme.css +328 -67
- package/resources/themes/lara-light-pink/theme.css +328 -67
- package/resources/themes/lara-light-purple/theme.css +26 -6
- package/resources/themes/lara-light-teal/theme.css +328 -67
- package/resources/themes/luna-amber/theme.css +328 -67
- package/resources/themes/luna-blue/theme.css +328 -67
- package/resources/themes/luna-green/theme.css +328 -67
- package/resources/themes/luna-pink/theme.css +328 -67
- package/resources/themes/md-dark-deeppurple/theme.css +158 -138
- package/resources/themes/md-dark-indigo/theme.css +454 -193
- package/resources/themes/md-light-deeppurple/theme.css +26 -6
- package/resources/themes/md-light-indigo/theme.css +328 -67
- package/resources/themes/mdc-dark-deeppurple/theme.css +158 -138
- package/resources/themes/mdc-dark-indigo/theme.css +454 -193
- package/resources/themes/mdc-light-deeppurple/theme.css +26 -6
- package/resources/themes/mdc-light-indigo/theme.css +328 -67
- package/resources/themes/mira/theme.css +328 -67
- package/resources/themes/nano/theme.css +328 -67
- package/resources/themes/nova/theme.css +328 -67
- package/resources/themes/nova-accent/theme.css +328 -67
- package/resources/themes/nova-alt/theme.css +328 -67
- package/resources/themes/rhea/theme.css +328 -67
- package/resources/themes/saga-blue/theme.css +328 -67
- package/resources/themes/saga-green/theme.css +328 -67
- package/resources/themes/saga-orange/theme.css +328 -67
- package/resources/themes/saga-purple/theme.css +26 -6
- package/resources/themes/soho-dark/theme.css +353 -92
- package/resources/themes/soho-light/theme.css +328 -67
- package/resources/themes/tailwind-light/theme.css +329 -71
- package/resources/themes/vela-blue/theme.css +328 -67
- package/resources/themes/vela-green/theme.css +328 -67
- package/resources/themes/vela-orange/theme.css +328 -67
- package/resources/themes/vela-purple/theme.css +26 -6
- package/resources/themes/viva-dark/theme.css +328 -67
- package/resources/themes/viva-light/theme.css +328 -67
- package/selectbutton/selectbutton.cjs.js +96 -50
- package/selectbutton/selectbutton.cjs.min.js +1 -1
- package/selectbutton/selectbutton.esm.js +96 -50
- package/selectbutton/selectbutton.esm.min.js +1 -1
- package/selectbutton/selectbutton.js +96 -50
- package/selectbutton/selectbutton.min.js +1 -1
- package/slider/slider.cjs.js +25 -4
- package/slider/slider.cjs.min.js +1 -1
- package/slider/slider.esm.js +25 -4
- package/slider/slider.esm.min.js +1 -1
- package/slider/slider.js +25 -4
- package/slider/slider.min.js +1 -1
- package/splitter/splitter.cjs.js +16 -15
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +16 -15
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +16 -15
- package/splitter/splitter.min.js +1 -1
- package/tabview/tabview.cjs.js +6 -5
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.d.ts +39 -34
- package/tabview/tabview.esm.js +6 -5
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +6 -5
- package/tabview/tabview.min.js +1 -1
- package/togglebutton/togglebutton.cjs.js +15 -14
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.esm.js +14 -13
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +15 -14
- package/togglebutton/togglebutton.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.cjs.js +3 -2
- package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +3 -2
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +3 -2
- package/tristatecheckbox/tristatecheckbox.min.js +1 -1
- package/web-types.json +1 -1
package/listbox/listbox.js
CHANGED
|
@@ -109,6 +109,10 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
109
109
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread();
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
function _readOnlyError(name) {
|
|
113
|
+
throw new TypeError("\"" + name + "\" is read-only");
|
|
114
|
+
}
|
|
115
|
+
|
|
112
116
|
function _arrayWithHoles(arr) {
|
|
113
117
|
if (Array.isArray(arr)) return arr;
|
|
114
118
|
}
|
|
@@ -149,28 +153,26 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
149
153
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
|
|
150
154
|
}
|
|
151
155
|
|
|
156
|
+
var _defaultProps;
|
|
152
157
|
var classes = {
|
|
153
158
|
itemGroup: 'p-listbox-item-group',
|
|
154
159
|
emptyMessage: 'p-listbox-empty-message',
|
|
155
|
-
list:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return props.virtualScrollerOptions ? utils.classNames('p-listbox-list', options.className) : 'p-listbox-list';
|
|
159
|
-
},
|
|
160
|
-
wrapper: function wrapper(_ref2) {
|
|
161
|
-
var props = _ref2.props;
|
|
160
|
+
list: 'p-listbox-list',
|
|
161
|
+
wrapper: function wrapper(_ref) {
|
|
162
|
+
var props = _ref.props;
|
|
162
163
|
return utils.classNames('p-listbox-list-wrapper', props.listClassName);
|
|
163
164
|
},
|
|
164
|
-
root: function root(
|
|
165
|
-
var props =
|
|
165
|
+
root: function root(_ref2) {
|
|
166
|
+
var props = _ref2.props;
|
|
166
167
|
return utils.classNames('p-listbox p-component', {
|
|
167
168
|
'p-disabled': props.disabled
|
|
168
169
|
}, props.className);
|
|
169
170
|
},
|
|
170
|
-
item: function item(
|
|
171
|
-
var props =
|
|
171
|
+
item: function item(_ref3) {
|
|
172
|
+
var props = _ref3.props;
|
|
172
173
|
return utils.classNames('p-listbox-item', {
|
|
173
174
|
'p-highlight': props.selected,
|
|
175
|
+
'p-focus': props.focusedOptionIndex === props.index,
|
|
174
176
|
'p-disabled': props.disabled
|
|
175
177
|
}, props.option.className);
|
|
176
178
|
},
|
|
@@ -179,22 +181,22 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
179
181
|
filterInput: 'p-listbox-filter',
|
|
180
182
|
header: 'p-listbox-header'
|
|
181
183
|
};
|
|
182
|
-
var styles = "\n@layer primereact {\n .p-listbox-list-wrapper {\n overflow: auto;\n }\n \n .p-listbox-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n }\n \n .p-listbox-item {\n cursor: pointer;\n position: relative;\n overflow: hidden;\n }\n \n .p-listbox-filter-container {\n position: relative;\n }\n \n .p-listbox-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-listbox-filter {\n width: 100%;\n }\n}\n";
|
|
184
|
+
var styles = "\n@layer primereact {\n .p-listbox-list-wrapper {\n overflow: auto;\n }\n \n .p-listbox-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n }\n \n .p-listbox-item {\n cursor: pointer;\n position: relative;\n overflow: hidden;\n outline: none;\n }\n \n .p-listbox-filter-container {\n position: relative;\n }\n \n .p-listbox-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-listbox-filter {\n width: 100%;\n }\n}\n";
|
|
183
185
|
var inlineStyles = {
|
|
184
|
-
itemGroup: function itemGroup(
|
|
185
|
-
var scrollerOptions =
|
|
186
|
+
itemGroup: function itemGroup(_ref4) {
|
|
187
|
+
var scrollerOptions = _ref4.scrollerOptions;
|
|
186
188
|
return {
|
|
187
189
|
height: scrollerOptions.props ? scrollerOptions.props.itemSize : undefined
|
|
188
190
|
};
|
|
189
191
|
},
|
|
190
|
-
list: function list(
|
|
191
|
-
var options =
|
|
192
|
-
props =
|
|
192
|
+
list: function list(_ref5) {
|
|
193
|
+
var options = _ref5.options,
|
|
194
|
+
props = _ref5.props;
|
|
193
195
|
return props.virtualScrollerOptions ? options.style : undefined;
|
|
194
196
|
}
|
|
195
197
|
};
|
|
196
198
|
var ListBoxBase = componentbase.ComponentBase.extend({
|
|
197
|
-
defaultProps: {
|
|
199
|
+
defaultProps: (_defaultProps = {
|
|
198
200
|
__TYPE: 'ListBox',
|
|
199
201
|
className: null,
|
|
200
202
|
dataKey: null,
|
|
@@ -210,29 +212,13 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
210
212
|
filterPlaceholder: null,
|
|
211
213
|
filterTemplate: null,
|
|
212
214
|
filterValue: null,
|
|
215
|
+
selectOnFocus: false,
|
|
213
216
|
id: null,
|
|
214
217
|
itemTemplate: null,
|
|
215
218
|
listClassName: null,
|
|
216
219
|
listStyle: null,
|
|
217
|
-
metaKeySelection: false
|
|
218
|
-
|
|
219
|
-
onChange: null,
|
|
220
|
-
onFilterValueChange: null,
|
|
221
|
-
optionDisabled: null,
|
|
222
|
-
optionGroupChildren: null,
|
|
223
|
-
optionGroupLabel: null,
|
|
224
|
-
optionGroupTemplate: null,
|
|
225
|
-
optionLabel: null,
|
|
226
|
-
optionValue: null,
|
|
227
|
-
options: null,
|
|
228
|
-
style: null,
|
|
229
|
-
tabIndex: 0,
|
|
230
|
-
tooltip: null,
|
|
231
|
-
tooltipOptions: null,
|
|
232
|
-
value: null,
|
|
233
|
-
virtualScrollerOptions: null,
|
|
234
|
-
children: undefined
|
|
235
|
-
},
|
|
220
|
+
metaKeySelection: false
|
|
221
|
+
}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defaultProps, "selectOnFocus", false), "autoOptionFocus", true), "multiple", false), "onChange", null), "onFilterValueChange", null), "optionDisabled", null), "optionGroupChildren", null), "optionGroupLabel", null), "optionGroupTemplate", null), "optionLabel", null), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defaultProps, "optionValue", null), "options", null), "style", null), "tabIndex", 0), "tooltip", null), "tooltipOptions", null), "value", null), "virtualScrollerOptions", null), "children", undefined)),
|
|
236
222
|
css: {
|
|
237
223
|
classes: classes,
|
|
238
224
|
styles: styles,
|
|
@@ -329,7 +315,8 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
329
315
|
context: {
|
|
330
316
|
selected: props.selected,
|
|
331
317
|
disabled: props.disabled,
|
|
332
|
-
focused: focusedState
|
|
318
|
+
focused: focusedState,
|
|
319
|
+
focusedOptionIndex: props.focusedOptionIndex
|
|
333
320
|
}
|
|
334
321
|
});
|
|
335
322
|
};
|
|
@@ -339,15 +326,6 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
339
326
|
var onBlur = function onBlur(event) {
|
|
340
327
|
setFocusedState(false);
|
|
341
328
|
};
|
|
342
|
-
var onClick = function onClick(event) {
|
|
343
|
-
if (props.onClick) {
|
|
344
|
-
props.onClick({
|
|
345
|
-
originalEvent: event,
|
|
346
|
-
option: props.option
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
event.preventDefault();
|
|
350
|
-
};
|
|
351
329
|
var onTouchEnd = function onTouchEnd(event) {
|
|
352
330
|
if (props.onTouchEnd) {
|
|
353
331
|
props.onTouchEnd({
|
|
@@ -356,47 +334,17 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
356
334
|
});
|
|
357
335
|
}
|
|
358
336
|
};
|
|
359
|
-
var onKeyDown = function onKeyDown(event) {
|
|
360
|
-
var item = event.currentTarget;
|
|
361
|
-
switch (event.which) {
|
|
362
|
-
//down
|
|
363
|
-
case 40:
|
|
364
|
-
var nextItem = findNextItem(item);
|
|
365
|
-
nextItem && nextItem.focus();
|
|
366
|
-
event.preventDefault();
|
|
367
|
-
break;
|
|
368
|
-
|
|
369
|
-
//up
|
|
370
|
-
case 38:
|
|
371
|
-
var prevItem = findPrevItem(item);
|
|
372
|
-
prevItem && prevItem.focus();
|
|
373
|
-
event.preventDefault();
|
|
374
|
-
break;
|
|
375
|
-
|
|
376
|
-
//enter
|
|
377
|
-
case 13:
|
|
378
|
-
onClick(event);
|
|
379
|
-
event.preventDefault();
|
|
380
|
-
break;
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
var findNextItem = function findNextItem(item) {
|
|
384
|
-
var nextItem = item.nextElementSibling;
|
|
385
|
-
return nextItem ? utils.DomHandler.isAttributeEquals(nextItem, 'data-p-disabled', true) || utils.DomHandler.isAttributeEquals(nextItem, 'data-pc-section', 'itemgroup') ? findNextItem(nextItem) : nextItem : null;
|
|
386
|
-
};
|
|
387
|
-
var findPrevItem = function findPrevItem(item) {
|
|
388
|
-
var prevItem = item.previousElementSibling;
|
|
389
|
-
return prevItem ? utils.DomHandler.isAttributeEquals(prevItem, 'data-p-disabled', true) || utils.DomHandler.isAttributeEquals(prevItem, 'data-pc-section', 'itemgroup') ? findPrevItem(prevItem) : prevItem : null;
|
|
390
|
-
};
|
|
391
337
|
var content = props.template ? utils.ObjectUtils.getJSXElement(props.template, props.option) : props.label;
|
|
392
338
|
var itemProps = mergeProps({
|
|
339
|
+
id: props.id,
|
|
393
340
|
className: cx('item', {
|
|
394
341
|
props: props
|
|
395
342
|
}),
|
|
396
343
|
style: props.style,
|
|
397
|
-
onClick: onClick
|
|
344
|
+
onClick: function onClick(event) {
|
|
345
|
+
return props.onClick(event, props.option, props.index);
|
|
346
|
+
},
|
|
398
347
|
onTouchEnd: onTouchEnd,
|
|
399
|
-
onKeyDown: onKeyDown,
|
|
400
348
|
onFocus: onFocus,
|
|
401
349
|
onBlur: onBlur,
|
|
402
350
|
tabIndex: '-1',
|
|
@@ -420,12 +368,25 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
420
368
|
var mergeProps = hooks.useMergeProps();
|
|
421
369
|
var context = React__namespace.useContext(api.PrimeReactContext);
|
|
422
370
|
var props = ListBoxBase.getProps(inProps, context);
|
|
423
|
-
var _React$useState = React__namespace.useState(
|
|
371
|
+
var _React$useState = React__namespace.useState(null),
|
|
424
372
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
425
|
-
|
|
426
|
-
|
|
373
|
+
focusedOptionIndex = _React$useState2[0],
|
|
374
|
+
setFocusedOptionIndex = _React$useState2[1];
|
|
375
|
+
var searchTimeout = React__namespace.useRef(null);
|
|
376
|
+
var firstHiddenFocusableElement = React__namespace.useRef(null);
|
|
377
|
+
var lastHiddenFocusableElement = React__namespace.useRef(null);
|
|
378
|
+
var _React$useState3 = React__namespace.useState(-1),
|
|
379
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
380
|
+
startRangeIndex = _React$useState4[0],
|
|
381
|
+
setStartRangeIndex = _React$useState4[1];
|
|
382
|
+
var _React$useState5 = React__namespace.useState(''),
|
|
383
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
384
|
+
filterValueState = _React$useState6[0],
|
|
385
|
+
setFilterValueState = _React$useState6[1];
|
|
427
386
|
var elementRef = React__namespace.useRef(null);
|
|
428
387
|
var virtualScrollerRef = React__namespace.useRef(null);
|
|
388
|
+
var id = React__namespace.useRef(utils.UniqueComponentId());
|
|
389
|
+
var listRef = React__namespace.useRef(null);
|
|
429
390
|
var optionTouched = React__namespace.useRef(false);
|
|
430
391
|
var filteredValue = (props.onFilterValueChange ? props.filterValue : filterValueState) || '';
|
|
431
392
|
var hasFilter = filteredValue && filteredValue.trim().length > 0;
|
|
@@ -439,13 +400,14 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
439
400
|
componentbase.useHandleStyle(ListBoxBase.css.styles, ptCallbacks.isUnstyled, {
|
|
440
401
|
name: 'listbox'
|
|
441
402
|
});
|
|
442
|
-
var onOptionSelect = function onOptionSelect(event) {
|
|
443
|
-
var
|
|
403
|
+
var onOptionSelect = function onOptionSelect(event, option) {
|
|
404
|
+
var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
444
405
|
if (props.disabled || isOptionDisabled(option)) {
|
|
445
406
|
return;
|
|
446
407
|
}
|
|
447
408
|
props.multiple ? onOptionSelectMultiple(event.originalEvent, option) : onOptionSelectSingle(event.originalEvent, option);
|
|
448
409
|
optionTouched.current = false;
|
|
410
|
+
index !== -1 && setFocusedOptionIndex(index);
|
|
449
411
|
};
|
|
450
412
|
var onOptionTouchEnd = function onOptionTouchEnd() {
|
|
451
413
|
if (props.disabled) {
|
|
@@ -514,6 +476,269 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
514
476
|
});
|
|
515
477
|
}
|
|
516
478
|
};
|
|
479
|
+
var hasSelectedOption = function hasSelectedOption() {
|
|
480
|
+
return utils.ObjectUtils.isNotEmpty(props.value);
|
|
481
|
+
};
|
|
482
|
+
var isOptionGroup = function isOptionGroup(option) {
|
|
483
|
+
return props.optionGroupLabel && option.optionGroup && option.group;
|
|
484
|
+
};
|
|
485
|
+
var isValidOption = function isValidOption(option) {
|
|
486
|
+
return utils.ObjectUtils.isNotEmpty(option) && !(isOptionDisabled(option) || isOptionGroup(option));
|
|
487
|
+
};
|
|
488
|
+
var isValidSelectedOption = function isValidSelectedOption(option) {
|
|
489
|
+
return isValidOption(option) && isSelected(option);
|
|
490
|
+
};
|
|
491
|
+
var findFirstOptionIndex = function findFirstOptionIndex() {
|
|
492
|
+
return visibleOptions.findIndex(function (option) {
|
|
493
|
+
return isValidOption(option);
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
var findLastOptionIndex = function findLastOptionIndex() {
|
|
497
|
+
return utils.ObjectUtils.findLastIndex(visibleOptions, function (option) {
|
|
498
|
+
return isValidOption(option);
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
var findNextOptionIndex = function findNextOptionIndex(index) {
|
|
502
|
+
var matchedOptionIndex = index < visibleOptions.length - 1 ? visibleOptions.slice(index + 1).findIndex(function (option) {
|
|
503
|
+
return isValidOption(option);
|
|
504
|
+
}) : -1;
|
|
505
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;
|
|
506
|
+
};
|
|
507
|
+
var findPrevOptionIndex = function findPrevOptionIndex(index) {
|
|
508
|
+
var matchedOptionIndex = index > 0 ? utils.ObjectUtils.findLastIndex(visibleOptions.slice(0, index), function (option) {
|
|
509
|
+
return isValidOption(option);
|
|
510
|
+
}) : -1;
|
|
511
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex : index;
|
|
512
|
+
};
|
|
513
|
+
var focusedOptionId = function focusedOptionId() {
|
|
514
|
+
return focusedOptionIndex !== -1 ? "".concat(id.current, "_").concat(focusedOptionIndex) : null;
|
|
515
|
+
};
|
|
516
|
+
var findNearestSelectedOptionIndex = function findNearestSelectedOptionIndex(index) {
|
|
517
|
+
var firstCheckUp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
518
|
+
var matchedOptionIndex = -1;
|
|
519
|
+
if (hasSelectedOption) {
|
|
520
|
+
if (firstCheckUp) {
|
|
521
|
+
matchedOptionIndex = findPrevSelectedOptionIndex(index);
|
|
522
|
+
matchedOptionIndex = matchedOptionIndex === -1 ? findNextSelectedOptionIndex(index) : matchedOptionIndex;
|
|
523
|
+
} else {
|
|
524
|
+
matchedOptionIndex = findNextSelectedOptionIndex(index);
|
|
525
|
+
matchedOptionIndex = matchedOptionIndex === -1 ? findPrevSelectedOptionIndex(index) : matchedOptionIndex;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex : index;
|
|
529
|
+
};
|
|
530
|
+
var isOptionMatched = function isOptionMatched(option) {
|
|
531
|
+
var _getOptionLabel;
|
|
532
|
+
return isValidOption(option) && ((_getOptionLabel = getOptionLabel(option)) === null || _getOptionLabel === void 0 ? void 0 : _getOptionLabel.toLocaleLowerCase(props.filterLocale).startsWith(searchValue.toLocaleLowerCase(props.filterLocale)));
|
|
533
|
+
};
|
|
534
|
+
var searchOptions = function searchOptions(event, _char) {
|
|
535
|
+
searchValue = (searchValue || '') + _char;
|
|
536
|
+
var optionIndex = -1;
|
|
537
|
+
if (utils.ObjectUtils.isNotEmpty(searchValue)) {
|
|
538
|
+
if (focusedOptionIndex !== -1) {
|
|
539
|
+
optionIndex = visibleOptions.slice(focusedOptionIndex).findIndex(function (option) {
|
|
540
|
+
return isOptionMatched(option);
|
|
541
|
+
});
|
|
542
|
+
optionIndex = optionIndex === -1 ? visibleOptions.slice(0, focusedOptionIndex).findIndex(function (option) {
|
|
543
|
+
return isOptionMatched(option);
|
|
544
|
+
}) : optionIndex + focusedOptionIndex;
|
|
545
|
+
} else {
|
|
546
|
+
optionIndex = visibleOptions.findIndex(function (option) {
|
|
547
|
+
return isOptionMatched(option);
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
if (optionIndex === -1 && focusedOptionIndex === -1) {
|
|
551
|
+
optionIndex = findFirstFocusedOptionIndex();
|
|
552
|
+
}
|
|
553
|
+
if (optionIndex !== -1) {
|
|
554
|
+
changeFocusedOptionIndex(event, optionIndex);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
if (searchTimeout.current) {
|
|
558
|
+
clearTimeout(searchTimeout.current);
|
|
559
|
+
}
|
|
560
|
+
searchTimeout.current = setTimeout(function () {
|
|
561
|
+
searchValue = '';
|
|
562
|
+
searchTimeout.current = null;
|
|
563
|
+
}, 500);
|
|
564
|
+
};
|
|
565
|
+
var findNextSelectedOptionIndex = function findNextSelectedOptionIndex(index) {
|
|
566
|
+
var matchedOptionIndex = hasSelectedOption && index < visibleOptions.length - 1 ? visibleOptions.slice(index + 1).findIndex(function (option) {
|
|
567
|
+
return isValidSelectedOption(option);
|
|
568
|
+
}) : -1;
|
|
569
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : -1;
|
|
570
|
+
};
|
|
571
|
+
var findPrevSelectedOptionIndex = function findPrevSelectedOptionIndex(index) {
|
|
572
|
+
var matchedOptionIndex = hasSelectedOption && index > 0 ? utils.ObjectUtils.findLastIndex(visibleOptions.slice(0, index), function (option) {
|
|
573
|
+
return isValidSelectedOption(option);
|
|
574
|
+
}) : -1;
|
|
575
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex : -1;
|
|
576
|
+
};
|
|
577
|
+
var onOptionSelectRange = function onOptionSelectRange(event) {
|
|
578
|
+
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
|
579
|
+
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
580
|
+
start === -1 && (start = findNearestSelectedOptionIndex(end, true));
|
|
581
|
+
end === -1 && (end = findNearestSelectedOptionIndex(start));
|
|
582
|
+
if (start !== -1 && end !== -1) {
|
|
583
|
+
var rangeStart = Math.min(start, end);
|
|
584
|
+
var rangeEnd = Math.max(start, end);
|
|
585
|
+
var value = visibleOptions.slice(rangeStart, rangeEnd + 1).filter(function (option) {
|
|
586
|
+
return isValidOption(option);
|
|
587
|
+
}).map(function (option) {
|
|
588
|
+
return getOptionValue(option);
|
|
589
|
+
});
|
|
590
|
+
updateModel(event, value);
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
var findFirstFocusedOptionIndex = function findFirstFocusedOptionIndex() {
|
|
594
|
+
var selectedIndex = findFirstSelectedOptionIndex();
|
|
595
|
+
return selectedIndex < 0 ? findFirstOptionIndex() : selectedIndex;
|
|
596
|
+
};
|
|
597
|
+
var changeFocusedOptionIndex = function changeFocusedOptionIndex(event, index) {
|
|
598
|
+
if (focusedOptionIndex !== index) {
|
|
599
|
+
setFocusedOptionIndex(index);
|
|
600
|
+
scrollInView();
|
|
601
|
+
if (props.selectOnFocus && !props.multiple) {
|
|
602
|
+
onOptionSelect(event, visibleOptions[index]);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
var onArrowDownKey = function onArrowDownKey(event) {
|
|
607
|
+
var optionIndex = focusedOptionIndex !== -1 ? findNextOptionIndex(focusedOptionIndex) : findFirstFocusedOptionIndex();
|
|
608
|
+
if (props.multiple && event.shiftKey) {
|
|
609
|
+
onOptionSelectRange(event, startRangeIndex, optionIndex);
|
|
610
|
+
}
|
|
611
|
+
changeFocusedOptionIndex(event, optionIndex);
|
|
612
|
+
event.preventDefault();
|
|
613
|
+
};
|
|
614
|
+
var onArrowUpKey = function onArrowUpKey(event) {
|
|
615
|
+
var optionIndex = focusedOptionIndex !== -1 ? findPrevOptionIndex(focusedOptionIndex) : findLastFocusedOptionIndex();
|
|
616
|
+
if (props.multiple && event.shiftKey) {
|
|
617
|
+
onOptionSelectRange(event, optionIndex, startRangeIndex);
|
|
618
|
+
}
|
|
619
|
+
changeFocusedOptionIndex(event, optionIndex);
|
|
620
|
+
event.preventDefault();
|
|
621
|
+
};
|
|
622
|
+
var onEnterKey = function onEnterKey(event) {
|
|
623
|
+
if (focusedOptionIndex !== -1) {
|
|
624
|
+
if (props.multiple && event.shiftKey) onOptionSelectRange(event, focusedOptionIndex);else onOptionSelect(event, visibleOptions[focusedOptionIndex]);
|
|
625
|
+
}
|
|
626
|
+
event.preventDefault();
|
|
627
|
+
};
|
|
628
|
+
var onSpaceKey = function onSpaceKey(event) {
|
|
629
|
+
onEnterKey(event);
|
|
630
|
+
};
|
|
631
|
+
var onShiftKey = function onShiftKey() {
|
|
632
|
+
setStartRangeIndex(focusedOptionIndex);
|
|
633
|
+
};
|
|
634
|
+
var onHomeKey = function onHomeKey(event) {
|
|
635
|
+
var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
636
|
+
if (pressedInInputText) {
|
|
637
|
+
event.currentTarget.setSelectionRange(0, 0);
|
|
638
|
+
setFocusedOptionIndex(-1);
|
|
639
|
+
} else {
|
|
640
|
+
var metaKey = event.metaKey || event.ctrlKey;
|
|
641
|
+
var optionIndex = findFirstOptionIndex();
|
|
642
|
+
if (props.multiple && event.shiftKey && metaKey) {
|
|
643
|
+
onOptionSelectRange(event, optionIndex, startRangeIndex);
|
|
644
|
+
}
|
|
645
|
+
changeFocusedOptionIndex(event, optionIndex);
|
|
646
|
+
}
|
|
647
|
+
event.preventDefault();
|
|
648
|
+
};
|
|
649
|
+
var onEndKey = function onEndKey(event) {
|
|
650
|
+
var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
651
|
+
if (pressedInInputText) {
|
|
652
|
+
var target = event.currentTarget;
|
|
653
|
+
var len = target.value.length;
|
|
654
|
+
target.setSelectionRange(len, len);
|
|
655
|
+
_readOnlyError("focusedOptionIndex");
|
|
656
|
+
} else {
|
|
657
|
+
var metaKey = event.metaKey || event.ctrlKey;
|
|
658
|
+
var optionIndex = findLastOptionIndex();
|
|
659
|
+
if (props.multiple && event.shiftKey && metaKey) {
|
|
660
|
+
onOptionSelectRange(event, startRangeIndex, optionIndex);
|
|
661
|
+
}
|
|
662
|
+
changeFocusedOptionIndex(event, optionIndex);
|
|
663
|
+
}
|
|
664
|
+
event.preventDefault();
|
|
665
|
+
};
|
|
666
|
+
var onPageUpKey = function onPageUpKey(event) {
|
|
667
|
+
scrollInView(0);
|
|
668
|
+
event.preventDefault();
|
|
669
|
+
};
|
|
670
|
+
var onPageDownKey = function onPageDownKey(event) {
|
|
671
|
+
scrollInView(visibleOptions.length - 1);
|
|
672
|
+
event.preventDefault();
|
|
673
|
+
};
|
|
674
|
+
var onKeyDown = function onKeyDown(event) {
|
|
675
|
+
var metaKey = event.metaKey || event.ctrlKey;
|
|
676
|
+
switch (event.code) {
|
|
677
|
+
case 'ArrowDown':
|
|
678
|
+
onArrowDownKey(event);
|
|
679
|
+
break;
|
|
680
|
+
case 'ArrowUp':
|
|
681
|
+
onArrowUpKey(event);
|
|
682
|
+
break;
|
|
683
|
+
case 'Home':
|
|
684
|
+
onHomeKey(event);
|
|
685
|
+
break;
|
|
686
|
+
case 'End':
|
|
687
|
+
onEndKey(event);
|
|
688
|
+
break;
|
|
689
|
+
case 'PageDown':
|
|
690
|
+
onPageDownKey(event);
|
|
691
|
+
break;
|
|
692
|
+
case 'PageUp':
|
|
693
|
+
onPageUpKey(event);
|
|
694
|
+
break;
|
|
695
|
+
case 'Enter':
|
|
696
|
+
case 'NumpadEnter':
|
|
697
|
+
case 'Space':
|
|
698
|
+
onSpaceKey(event);
|
|
699
|
+
event.preventDefault();
|
|
700
|
+
break;
|
|
701
|
+
case 'Tab':
|
|
702
|
+
//NOOP
|
|
703
|
+
break;
|
|
704
|
+
case 'ShiftLeft':
|
|
705
|
+
case 'ShiftRight':
|
|
706
|
+
onShiftKey();
|
|
707
|
+
break;
|
|
708
|
+
default:
|
|
709
|
+
if (props.multiple && event.code === 'KeyA' && metaKey) {
|
|
710
|
+
var value = visibleOptions.filter(function (option) {
|
|
711
|
+
return isValidOption(option);
|
|
712
|
+
}).map(function (option) {
|
|
713
|
+
return getOptionValue(option);
|
|
714
|
+
});
|
|
715
|
+
updateModel(event, value);
|
|
716
|
+
event.preventDefault();
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
if (!metaKey && utils.ObjectUtils.isPrintableCharacter(event.key)) {
|
|
720
|
+
searchOptions(event, event.key);
|
|
721
|
+
event.preventDefault();
|
|
722
|
+
}
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
var scrollInView = function scrollInView() {
|
|
727
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
728
|
+
setTimeout(function () {
|
|
729
|
+
var idx = index !== -1 ? "".concat(id.current, "_").concat(index) : focusedOptionId();
|
|
730
|
+
var element = listRef.current.querySelector("li[id=\"".concat(idx, "\"]"));
|
|
731
|
+
if (element) {
|
|
732
|
+
element.scrollIntoView({
|
|
733
|
+
block: 'nearest',
|
|
734
|
+
inline: 'nearest',
|
|
735
|
+
behavior: 'smooth'
|
|
736
|
+
});
|
|
737
|
+
} else if (props.virtualScrollerOptions) {
|
|
738
|
+
virtualScrollerRef.current && virtualScrollerRef.current.scrollToIndex(index !== -1 ? index : props.focusedOptionIndex);
|
|
739
|
+
}
|
|
740
|
+
}, 0);
|
|
741
|
+
};
|
|
517
742
|
var onFilter = function onFilter(event) {
|
|
518
743
|
virtualScrollerRef.current && virtualScrollerRef.current.scrollToIndex(0);
|
|
519
744
|
var originalEvent = event.originalEvent,
|
|
@@ -606,6 +831,23 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
606
831
|
}
|
|
607
832
|
return option && option['disabled'] !== undefined ? option['disabled'] : false;
|
|
608
833
|
};
|
|
834
|
+
var onFirstHiddenFocus = function onFirstHiddenFocus() {
|
|
835
|
+
utils.DomHandler.focus(listRef.current);
|
|
836
|
+
var firstFocusableEl = utils.DomHandler.getFirstFocusableElement(elementRef.current, ':not([data-p-hidden-focusable="true"])');
|
|
837
|
+
lastHiddenFocusableElement.current.tabIndex = utils.DomHandler.isElement(firstFocusableEl) ? undefined : -1;
|
|
838
|
+
firstHiddenFocusableElement.current.tabIndex = -1;
|
|
839
|
+
};
|
|
840
|
+
var onLastHiddenFocus = function onLastHiddenFocus(event) {
|
|
841
|
+
var relatedTarget = event.relatedTarget;
|
|
842
|
+
if (relatedTarget === listRef.current) {
|
|
843
|
+
var firstFocusableEl = utils.DomHandler.getFirstFocusableElement(elementRef.current, ':not([data-p-hidden-focusable="true"])');
|
|
844
|
+
utils.DomHandler.focus(firstFocusableEl);
|
|
845
|
+
firstHiddenFocusableElement.current.tabIndex = undefined;
|
|
846
|
+
} else {
|
|
847
|
+
utils.DomHandler.focus(firstHiddenFocusableElement.current);
|
|
848
|
+
}
|
|
849
|
+
astHiddenFocusableElement.current.tabIndex = -1;
|
|
850
|
+
};
|
|
609
851
|
var getOptionGroupRenderKey = function getOptionGroupRenderKey(optionGroup) {
|
|
610
852
|
return utils.ObjectUtils.resolveFieldData(optionGroup, props.optionGroupLabel);
|
|
611
853
|
};
|
|
@@ -694,8 +936,9 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
694
936
|
var optionLabel = getOptionLabel(option);
|
|
695
937
|
var optionKey = j + '_' + getOptionRenderKey(option);
|
|
696
938
|
var disabled = isOptionDisabled(option);
|
|
697
|
-
|
|
939
|
+
disabled ? null : props.tabIndex || 0;
|
|
698
940
|
return /*#__PURE__*/React__namespace.createElement(ListBoxItem, {
|
|
941
|
+
id: id.current + '_' + j,
|
|
699
942
|
hostName: "ListBox",
|
|
700
943
|
key: optionKey,
|
|
701
944
|
label: optionLabel,
|
|
@@ -704,8 +947,9 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
704
947
|
template: props.itemTemplate,
|
|
705
948
|
selected: isSelected(option),
|
|
706
949
|
onClick: onOptionSelect,
|
|
950
|
+
index: j,
|
|
951
|
+
focusedOptionIndex: focusedOptionIndex,
|
|
707
952
|
onTouchEnd: onOptionTouchEnd,
|
|
708
|
-
tabIndex: tabIndex,
|
|
709
953
|
disabled: disabled,
|
|
710
954
|
ptCallbacks: ptCallbacks,
|
|
711
955
|
metaData: metaData
|
|
@@ -735,18 +979,20 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
735
979
|
var optionLabel = getOptionLabel(option);
|
|
736
980
|
var optionKey = index + '_' + getOptionRenderKey(option);
|
|
737
981
|
var disabled = isOptionDisabled(option);
|
|
738
|
-
|
|
982
|
+
disabled ? null : props.tabIndex || 0;
|
|
739
983
|
return /*#__PURE__*/React__namespace.createElement(ListBoxItem, {
|
|
984
|
+
id: id.current + '_' + index,
|
|
740
985
|
hostName: "ListBox",
|
|
741
986
|
key: optionKey,
|
|
742
987
|
label: optionLabel,
|
|
988
|
+
index: index,
|
|
989
|
+
focusedOptionIndex: focusedOptionIndex,
|
|
743
990
|
option: option,
|
|
744
991
|
style: style,
|
|
745
992
|
template: props.itemTemplate,
|
|
746
993
|
selected: isSelected(option),
|
|
747
994
|
onClick: onOptionSelect,
|
|
748
995
|
onTouchEnd: onOptionTouchEnd,
|
|
749
|
-
tabIndex: tabIndex,
|
|
750
996
|
disabled: disabled,
|
|
751
997
|
ptCallbacks: ptCallbacks,
|
|
752
998
|
metaData: metaData
|
|
@@ -790,6 +1036,7 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
790
1036
|
options: options
|
|
791
1037
|
}),
|
|
792
1038
|
role: 'listbox',
|
|
1039
|
+
tabIndex: '-1',
|
|
793
1040
|
'aria-multiselectable': props.multiple
|
|
794
1041
|
}, ariaProps), ptCallbacks.ptm('list'));
|
|
795
1042
|
return /*#__PURE__*/React__namespace.createElement("ul", listProps, options.children);
|
|
@@ -803,9 +1050,12 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
803
1050
|
} else {
|
|
804
1051
|
var items = createItems();
|
|
805
1052
|
var listProps = mergeProps(_objectSpread({
|
|
1053
|
+
ref: listRef,
|
|
806
1054
|
className: ptCallbacks.cx('list'),
|
|
807
1055
|
role: 'listbox',
|
|
808
|
-
'aria-multiselectable': props.multiple
|
|
1056
|
+
'aria-multiselectable': props.multiple,
|
|
1057
|
+
tabIndex: '-1',
|
|
1058
|
+
onKeyDown: onKeyDown
|
|
809
1059
|
}, ariaProps), ptCallbacks.ptm('list'));
|
|
810
1060
|
return /*#__PURE__*/React__namespace.createElement("ul", listProps, items);
|
|
811
1061
|
}
|
|
@@ -826,7 +1076,27 @@ this.primereact.listbox = (function (exports, React, api, componentbase, hooks,
|
|
|
826
1076
|
className: ptCallbacks.cx('root'),
|
|
827
1077
|
style: props.style
|
|
828
1078
|
}, ListBoxBase.getOtherProps(props), ptCallbacks.ptm('root'));
|
|
829
|
-
|
|
1079
|
+
var hiddenFirstElement = mergeProps({
|
|
1080
|
+
ref: firstHiddenFocusableElement,
|
|
1081
|
+
role: 'presentation',
|
|
1082
|
+
'aria-hidden': 'true',
|
|
1083
|
+
className: 'p-hidden-accessible p-hidden-focusable',
|
|
1084
|
+
tabIndex: !props.disabled ? props.tabIndex : -1,
|
|
1085
|
+
onFocus: onFirstHiddenFocus,
|
|
1086
|
+
'data-p-hidden-accessible': true,
|
|
1087
|
+
'data-p-hidden-focusable': true
|
|
1088
|
+
}, ptCallbacks.ptm('hiddenFirstFocusableEl'));
|
|
1089
|
+
var hiddenLastElement = mergeProps({
|
|
1090
|
+
ref: lastHiddenFocusableElement,
|
|
1091
|
+
role: 'presentation',
|
|
1092
|
+
'aria-hidden': 'true',
|
|
1093
|
+
className: 'p-hidden-accessible p-hidden-focusable',
|
|
1094
|
+
tabIndex: !props.disabled ? props.tabIndex : -1,
|
|
1095
|
+
onFocus: onLastHiddenFocus,
|
|
1096
|
+
'data-p-hidden-accessible': true,
|
|
1097
|
+
'data-p-hidden-focusable': true
|
|
1098
|
+
}, ptCallbacks.ptm('hiddenFirstFocusableEl'));
|
|
1099
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("div", rootProps, /*#__PURE__*/React__namespace.createElement("span", hiddenFirstElement), header, /*#__PURE__*/React__namespace.createElement("div", wrapperProps, list), /*#__PURE__*/React__namespace.createElement("span", hiddenLastElement)), hasTooltip && /*#__PURE__*/React__namespace.createElement(tooltip.Tooltip, _extends({
|
|
830
1100
|
target: elementRef,
|
|
831
1101
|
content: props.tooltip
|
|
832
1102
|
}, props.tooltipOptions, {
|