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.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import { PrimeReactContext, FilterService, localeOption } from 'primereact/api';
|
|
|
4
4
|
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
5
5
|
import { useMergeProps, useMountEffect } from 'primereact/hooks';
|
|
6
6
|
import { Tooltip } from 'primereact/tooltip';
|
|
7
|
-
import { classNames, IconUtils, ObjectUtils, DomHandler } from 'primereact/utils';
|
|
7
|
+
import { classNames, IconUtils, ObjectUtils, UniqueComponentId, DomHandler } from 'primereact/utils';
|
|
8
8
|
import { VirtualScroller } from 'primereact/virtualscroller';
|
|
9
9
|
import { SearchIcon } from 'primereact/icons/search';
|
|
10
10
|
import { InputText } from 'primereact/inputtext';
|
|
@@ -97,6 +97,10 @@ function _toConsumableArray(arr) {
|
|
|
97
97
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread();
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
function _readOnlyError(name) {
|
|
101
|
+
throw new TypeError("\"" + name + "\" is read-only");
|
|
102
|
+
}
|
|
103
|
+
|
|
100
104
|
function _arrayWithHoles(arr) {
|
|
101
105
|
if (Array.isArray(arr)) return arr;
|
|
102
106
|
}
|
|
@@ -137,28 +141,26 @@ function _slicedToArray(arr, i) {
|
|
|
137
141
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
|
|
138
142
|
}
|
|
139
143
|
|
|
144
|
+
var _defaultProps;
|
|
140
145
|
var classes = {
|
|
141
146
|
itemGroup: 'p-listbox-item-group',
|
|
142
147
|
emptyMessage: 'p-listbox-empty-message',
|
|
143
|
-
list:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return props.virtualScrollerOptions ? classNames('p-listbox-list', options.className) : 'p-listbox-list';
|
|
147
|
-
},
|
|
148
|
-
wrapper: function wrapper(_ref2) {
|
|
149
|
-
var props = _ref2.props;
|
|
148
|
+
list: 'p-listbox-list',
|
|
149
|
+
wrapper: function wrapper(_ref) {
|
|
150
|
+
var props = _ref.props;
|
|
150
151
|
return classNames('p-listbox-list-wrapper', props.listClassName);
|
|
151
152
|
},
|
|
152
|
-
root: function root(
|
|
153
|
-
var props =
|
|
153
|
+
root: function root(_ref2) {
|
|
154
|
+
var props = _ref2.props;
|
|
154
155
|
return classNames('p-listbox p-component', {
|
|
155
156
|
'p-disabled': props.disabled
|
|
156
157
|
}, props.className);
|
|
157
158
|
},
|
|
158
|
-
item: function item(
|
|
159
|
-
var props =
|
|
159
|
+
item: function item(_ref3) {
|
|
160
|
+
var props = _ref3.props;
|
|
160
161
|
return classNames('p-listbox-item', {
|
|
161
162
|
'p-highlight': props.selected,
|
|
163
|
+
'p-focus': props.focusedOptionIndex === props.index,
|
|
162
164
|
'p-disabled': props.disabled
|
|
163
165
|
}, props.option.className);
|
|
164
166
|
},
|
|
@@ -167,22 +169,22 @@ var classes = {
|
|
|
167
169
|
filterInput: 'p-listbox-filter',
|
|
168
170
|
header: 'p-listbox-header'
|
|
169
171
|
};
|
|
170
|
-
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";
|
|
172
|
+
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";
|
|
171
173
|
var inlineStyles = {
|
|
172
|
-
itemGroup: function itemGroup(
|
|
173
|
-
var scrollerOptions =
|
|
174
|
+
itemGroup: function itemGroup(_ref4) {
|
|
175
|
+
var scrollerOptions = _ref4.scrollerOptions;
|
|
174
176
|
return {
|
|
175
177
|
height: scrollerOptions.props ? scrollerOptions.props.itemSize : undefined
|
|
176
178
|
};
|
|
177
179
|
},
|
|
178
|
-
list: function list(
|
|
179
|
-
var options =
|
|
180
|
-
props =
|
|
180
|
+
list: function list(_ref5) {
|
|
181
|
+
var options = _ref5.options,
|
|
182
|
+
props = _ref5.props;
|
|
181
183
|
return props.virtualScrollerOptions ? options.style : undefined;
|
|
182
184
|
}
|
|
183
185
|
};
|
|
184
186
|
var ListBoxBase = ComponentBase.extend({
|
|
185
|
-
defaultProps: {
|
|
187
|
+
defaultProps: (_defaultProps = {
|
|
186
188
|
__TYPE: 'ListBox',
|
|
187
189
|
className: null,
|
|
188
190
|
dataKey: null,
|
|
@@ -198,29 +200,13 @@ var ListBoxBase = ComponentBase.extend({
|
|
|
198
200
|
filterPlaceholder: null,
|
|
199
201
|
filterTemplate: null,
|
|
200
202
|
filterValue: null,
|
|
203
|
+
selectOnFocus: false,
|
|
201
204
|
id: null,
|
|
202
205
|
itemTemplate: null,
|
|
203
206
|
listClassName: null,
|
|
204
207
|
listStyle: null,
|
|
205
|
-
metaKeySelection: false
|
|
206
|
-
|
|
207
|
-
onChange: null,
|
|
208
|
-
onFilterValueChange: null,
|
|
209
|
-
optionDisabled: null,
|
|
210
|
-
optionGroupChildren: null,
|
|
211
|
-
optionGroupLabel: null,
|
|
212
|
-
optionGroupTemplate: null,
|
|
213
|
-
optionLabel: null,
|
|
214
|
-
optionValue: null,
|
|
215
|
-
options: null,
|
|
216
|
-
style: null,
|
|
217
|
-
tabIndex: 0,
|
|
218
|
-
tooltip: null,
|
|
219
|
-
tooltipOptions: null,
|
|
220
|
-
value: null,
|
|
221
|
-
virtualScrollerOptions: null,
|
|
222
|
-
children: undefined
|
|
223
|
-
},
|
|
208
|
+
metaKeySelection: false
|
|
209
|
+
}, _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)),
|
|
224
210
|
css: {
|
|
225
211
|
classes: classes,
|
|
226
212
|
styles: styles,
|
|
@@ -317,7 +303,8 @@ var ListBoxItem = /*#__PURE__*/React.memo(function (props) {
|
|
|
317
303
|
context: {
|
|
318
304
|
selected: props.selected,
|
|
319
305
|
disabled: props.disabled,
|
|
320
|
-
focused: focusedState
|
|
306
|
+
focused: focusedState,
|
|
307
|
+
focusedOptionIndex: props.focusedOptionIndex
|
|
321
308
|
}
|
|
322
309
|
});
|
|
323
310
|
};
|
|
@@ -327,15 +314,6 @@ var ListBoxItem = /*#__PURE__*/React.memo(function (props) {
|
|
|
327
314
|
var onBlur = function onBlur(event) {
|
|
328
315
|
setFocusedState(false);
|
|
329
316
|
};
|
|
330
|
-
var onClick = function onClick(event) {
|
|
331
|
-
if (props.onClick) {
|
|
332
|
-
props.onClick({
|
|
333
|
-
originalEvent: event,
|
|
334
|
-
option: props.option
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
event.preventDefault();
|
|
338
|
-
};
|
|
339
317
|
var onTouchEnd = function onTouchEnd(event) {
|
|
340
318
|
if (props.onTouchEnd) {
|
|
341
319
|
props.onTouchEnd({
|
|
@@ -344,47 +322,17 @@ var ListBoxItem = /*#__PURE__*/React.memo(function (props) {
|
|
|
344
322
|
});
|
|
345
323
|
}
|
|
346
324
|
};
|
|
347
|
-
var onKeyDown = function onKeyDown(event) {
|
|
348
|
-
var item = event.currentTarget;
|
|
349
|
-
switch (event.which) {
|
|
350
|
-
//down
|
|
351
|
-
case 40:
|
|
352
|
-
var nextItem = findNextItem(item);
|
|
353
|
-
nextItem && nextItem.focus();
|
|
354
|
-
event.preventDefault();
|
|
355
|
-
break;
|
|
356
|
-
|
|
357
|
-
//up
|
|
358
|
-
case 38:
|
|
359
|
-
var prevItem = findPrevItem(item);
|
|
360
|
-
prevItem && prevItem.focus();
|
|
361
|
-
event.preventDefault();
|
|
362
|
-
break;
|
|
363
|
-
|
|
364
|
-
//enter
|
|
365
|
-
case 13:
|
|
366
|
-
onClick(event);
|
|
367
|
-
event.preventDefault();
|
|
368
|
-
break;
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
var findNextItem = function findNextItem(item) {
|
|
372
|
-
var nextItem = item.nextElementSibling;
|
|
373
|
-
return nextItem ? DomHandler.isAttributeEquals(nextItem, 'data-p-disabled', true) || DomHandler.isAttributeEquals(nextItem, 'data-pc-section', 'itemgroup') ? findNextItem(nextItem) : nextItem : null;
|
|
374
|
-
};
|
|
375
|
-
var findPrevItem = function findPrevItem(item) {
|
|
376
|
-
var prevItem = item.previousElementSibling;
|
|
377
|
-
return prevItem ? DomHandler.isAttributeEquals(prevItem, 'data-p-disabled', true) || DomHandler.isAttributeEquals(prevItem, 'data-pc-section', 'itemgroup') ? findPrevItem(prevItem) : prevItem : null;
|
|
378
|
-
};
|
|
379
325
|
var content = props.template ? ObjectUtils.getJSXElement(props.template, props.option) : props.label;
|
|
380
326
|
var itemProps = mergeProps({
|
|
327
|
+
id: props.id,
|
|
381
328
|
className: cx('item', {
|
|
382
329
|
props: props
|
|
383
330
|
}),
|
|
384
331
|
style: props.style,
|
|
385
|
-
onClick: onClick
|
|
332
|
+
onClick: function onClick(event) {
|
|
333
|
+
return props.onClick(event, props.option, props.index);
|
|
334
|
+
},
|
|
386
335
|
onTouchEnd: onTouchEnd,
|
|
387
|
-
onKeyDown: onKeyDown,
|
|
388
336
|
onFocus: onFocus,
|
|
389
337
|
onBlur: onBlur,
|
|
390
338
|
tabIndex: '-1',
|
|
@@ -408,12 +356,25 @@ var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (i
|
|
|
408
356
|
var mergeProps = useMergeProps();
|
|
409
357
|
var context = React.useContext(PrimeReactContext);
|
|
410
358
|
var props = ListBoxBase.getProps(inProps, context);
|
|
411
|
-
var _React$useState = React.useState(
|
|
359
|
+
var _React$useState = React.useState(null),
|
|
412
360
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
413
|
-
|
|
414
|
-
|
|
361
|
+
focusedOptionIndex = _React$useState2[0],
|
|
362
|
+
setFocusedOptionIndex = _React$useState2[1];
|
|
363
|
+
var searchTimeout = React.useRef(null);
|
|
364
|
+
var firstHiddenFocusableElement = React.useRef(null);
|
|
365
|
+
var lastHiddenFocusableElement = React.useRef(null);
|
|
366
|
+
var _React$useState3 = React.useState(-1),
|
|
367
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
368
|
+
startRangeIndex = _React$useState4[0],
|
|
369
|
+
setStartRangeIndex = _React$useState4[1];
|
|
370
|
+
var _React$useState5 = React.useState(''),
|
|
371
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
372
|
+
filterValueState = _React$useState6[0],
|
|
373
|
+
setFilterValueState = _React$useState6[1];
|
|
415
374
|
var elementRef = React.useRef(null);
|
|
416
375
|
var virtualScrollerRef = React.useRef(null);
|
|
376
|
+
var id = React.useRef(UniqueComponentId());
|
|
377
|
+
var listRef = React.useRef(null);
|
|
417
378
|
var optionTouched = React.useRef(false);
|
|
418
379
|
var filteredValue = (props.onFilterValueChange ? props.filterValue : filterValueState) || '';
|
|
419
380
|
var hasFilter = filteredValue && filteredValue.trim().length > 0;
|
|
@@ -427,13 +388,14 @@ var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (i
|
|
|
427
388
|
useHandleStyle(ListBoxBase.css.styles, ptCallbacks.isUnstyled, {
|
|
428
389
|
name: 'listbox'
|
|
429
390
|
});
|
|
430
|
-
var onOptionSelect = function onOptionSelect(event) {
|
|
431
|
-
var
|
|
391
|
+
var onOptionSelect = function onOptionSelect(event, option) {
|
|
392
|
+
var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
432
393
|
if (props.disabled || isOptionDisabled(option)) {
|
|
433
394
|
return;
|
|
434
395
|
}
|
|
435
396
|
props.multiple ? onOptionSelectMultiple(event.originalEvent, option) : onOptionSelectSingle(event.originalEvent, option);
|
|
436
397
|
optionTouched.current = false;
|
|
398
|
+
index !== -1 && setFocusedOptionIndex(index);
|
|
437
399
|
};
|
|
438
400
|
var onOptionTouchEnd = function onOptionTouchEnd() {
|
|
439
401
|
if (props.disabled) {
|
|
@@ -502,6 +464,269 @@ var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (i
|
|
|
502
464
|
});
|
|
503
465
|
}
|
|
504
466
|
};
|
|
467
|
+
var hasSelectedOption = function hasSelectedOption() {
|
|
468
|
+
return ObjectUtils.isNotEmpty(props.value);
|
|
469
|
+
};
|
|
470
|
+
var isOptionGroup = function isOptionGroup(option) {
|
|
471
|
+
return props.optionGroupLabel && option.optionGroup && option.group;
|
|
472
|
+
};
|
|
473
|
+
var isValidOption = function isValidOption(option) {
|
|
474
|
+
return ObjectUtils.isNotEmpty(option) && !(isOptionDisabled(option) || isOptionGroup(option));
|
|
475
|
+
};
|
|
476
|
+
var isValidSelectedOption = function isValidSelectedOption(option) {
|
|
477
|
+
return isValidOption(option) && isSelected(option);
|
|
478
|
+
};
|
|
479
|
+
var findFirstOptionIndex = function findFirstOptionIndex() {
|
|
480
|
+
return visibleOptions.findIndex(function (option) {
|
|
481
|
+
return isValidOption(option);
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
var findLastOptionIndex = function findLastOptionIndex() {
|
|
485
|
+
return ObjectUtils.findLastIndex(visibleOptions, function (option) {
|
|
486
|
+
return isValidOption(option);
|
|
487
|
+
});
|
|
488
|
+
};
|
|
489
|
+
var findNextOptionIndex = function findNextOptionIndex(index) {
|
|
490
|
+
var matchedOptionIndex = index < visibleOptions.length - 1 ? visibleOptions.slice(index + 1).findIndex(function (option) {
|
|
491
|
+
return isValidOption(option);
|
|
492
|
+
}) : -1;
|
|
493
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;
|
|
494
|
+
};
|
|
495
|
+
var findPrevOptionIndex = function findPrevOptionIndex(index) {
|
|
496
|
+
var matchedOptionIndex = index > 0 ? ObjectUtils.findLastIndex(visibleOptions.slice(0, index), function (option) {
|
|
497
|
+
return isValidOption(option);
|
|
498
|
+
}) : -1;
|
|
499
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex : index;
|
|
500
|
+
};
|
|
501
|
+
var focusedOptionId = function focusedOptionId() {
|
|
502
|
+
return focusedOptionIndex !== -1 ? "".concat(id.current, "_").concat(focusedOptionIndex) : null;
|
|
503
|
+
};
|
|
504
|
+
var findNearestSelectedOptionIndex = function findNearestSelectedOptionIndex(index) {
|
|
505
|
+
var firstCheckUp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
506
|
+
var matchedOptionIndex = -1;
|
|
507
|
+
if (hasSelectedOption) {
|
|
508
|
+
if (firstCheckUp) {
|
|
509
|
+
matchedOptionIndex = findPrevSelectedOptionIndex(index);
|
|
510
|
+
matchedOptionIndex = matchedOptionIndex === -1 ? findNextSelectedOptionIndex(index) : matchedOptionIndex;
|
|
511
|
+
} else {
|
|
512
|
+
matchedOptionIndex = findNextSelectedOptionIndex(index);
|
|
513
|
+
matchedOptionIndex = matchedOptionIndex === -1 ? findPrevSelectedOptionIndex(index) : matchedOptionIndex;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex : index;
|
|
517
|
+
};
|
|
518
|
+
var isOptionMatched = function isOptionMatched(option) {
|
|
519
|
+
var _getOptionLabel;
|
|
520
|
+
return isValidOption(option) && ((_getOptionLabel = getOptionLabel(option)) === null || _getOptionLabel === void 0 ? void 0 : _getOptionLabel.toLocaleLowerCase(props.filterLocale).startsWith(searchValue.toLocaleLowerCase(props.filterLocale)));
|
|
521
|
+
};
|
|
522
|
+
var searchOptions = function searchOptions(event, _char) {
|
|
523
|
+
searchValue = (searchValue || '') + _char;
|
|
524
|
+
var optionIndex = -1;
|
|
525
|
+
if (ObjectUtils.isNotEmpty(searchValue)) {
|
|
526
|
+
if (focusedOptionIndex !== -1) {
|
|
527
|
+
optionIndex = visibleOptions.slice(focusedOptionIndex).findIndex(function (option) {
|
|
528
|
+
return isOptionMatched(option);
|
|
529
|
+
});
|
|
530
|
+
optionIndex = optionIndex === -1 ? visibleOptions.slice(0, focusedOptionIndex).findIndex(function (option) {
|
|
531
|
+
return isOptionMatched(option);
|
|
532
|
+
}) : optionIndex + focusedOptionIndex;
|
|
533
|
+
} else {
|
|
534
|
+
optionIndex = visibleOptions.findIndex(function (option) {
|
|
535
|
+
return isOptionMatched(option);
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
if (optionIndex === -1 && focusedOptionIndex === -1) {
|
|
539
|
+
optionIndex = findFirstFocusedOptionIndex();
|
|
540
|
+
}
|
|
541
|
+
if (optionIndex !== -1) {
|
|
542
|
+
changeFocusedOptionIndex(event, optionIndex);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (searchTimeout.current) {
|
|
546
|
+
clearTimeout(searchTimeout.current);
|
|
547
|
+
}
|
|
548
|
+
searchTimeout.current = setTimeout(function () {
|
|
549
|
+
searchValue = '';
|
|
550
|
+
searchTimeout.current = null;
|
|
551
|
+
}, 500);
|
|
552
|
+
};
|
|
553
|
+
var findNextSelectedOptionIndex = function findNextSelectedOptionIndex(index) {
|
|
554
|
+
var matchedOptionIndex = hasSelectedOption && index < visibleOptions.length - 1 ? visibleOptions.slice(index + 1).findIndex(function (option) {
|
|
555
|
+
return isValidSelectedOption(option);
|
|
556
|
+
}) : -1;
|
|
557
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : -1;
|
|
558
|
+
};
|
|
559
|
+
var findPrevSelectedOptionIndex = function findPrevSelectedOptionIndex(index) {
|
|
560
|
+
var matchedOptionIndex = hasSelectedOption && index > 0 ? ObjectUtils.findLastIndex(visibleOptions.slice(0, index), function (option) {
|
|
561
|
+
return isValidSelectedOption(option);
|
|
562
|
+
}) : -1;
|
|
563
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex : -1;
|
|
564
|
+
};
|
|
565
|
+
var onOptionSelectRange = function onOptionSelectRange(event) {
|
|
566
|
+
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
|
567
|
+
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
568
|
+
start === -1 && (start = findNearestSelectedOptionIndex(end, true));
|
|
569
|
+
end === -1 && (end = findNearestSelectedOptionIndex(start));
|
|
570
|
+
if (start !== -1 && end !== -1) {
|
|
571
|
+
var rangeStart = Math.min(start, end);
|
|
572
|
+
var rangeEnd = Math.max(start, end);
|
|
573
|
+
var value = visibleOptions.slice(rangeStart, rangeEnd + 1).filter(function (option) {
|
|
574
|
+
return isValidOption(option);
|
|
575
|
+
}).map(function (option) {
|
|
576
|
+
return getOptionValue(option);
|
|
577
|
+
});
|
|
578
|
+
updateModel(event, value);
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
var findFirstFocusedOptionIndex = function findFirstFocusedOptionIndex() {
|
|
582
|
+
var selectedIndex = findFirstSelectedOptionIndex();
|
|
583
|
+
return selectedIndex < 0 ? findFirstOptionIndex() : selectedIndex;
|
|
584
|
+
};
|
|
585
|
+
var changeFocusedOptionIndex = function changeFocusedOptionIndex(event, index) {
|
|
586
|
+
if (focusedOptionIndex !== index) {
|
|
587
|
+
setFocusedOptionIndex(index);
|
|
588
|
+
scrollInView();
|
|
589
|
+
if (props.selectOnFocus && !props.multiple) {
|
|
590
|
+
onOptionSelect(event, visibleOptions[index]);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
var onArrowDownKey = function onArrowDownKey(event) {
|
|
595
|
+
var optionIndex = focusedOptionIndex !== -1 ? findNextOptionIndex(focusedOptionIndex) : findFirstFocusedOptionIndex();
|
|
596
|
+
if (props.multiple && event.shiftKey) {
|
|
597
|
+
onOptionSelectRange(event, startRangeIndex, optionIndex);
|
|
598
|
+
}
|
|
599
|
+
changeFocusedOptionIndex(event, optionIndex);
|
|
600
|
+
event.preventDefault();
|
|
601
|
+
};
|
|
602
|
+
var onArrowUpKey = function onArrowUpKey(event) {
|
|
603
|
+
var optionIndex = focusedOptionIndex !== -1 ? findPrevOptionIndex(focusedOptionIndex) : findLastFocusedOptionIndex();
|
|
604
|
+
if (props.multiple && event.shiftKey) {
|
|
605
|
+
onOptionSelectRange(event, optionIndex, startRangeIndex);
|
|
606
|
+
}
|
|
607
|
+
changeFocusedOptionIndex(event, optionIndex);
|
|
608
|
+
event.preventDefault();
|
|
609
|
+
};
|
|
610
|
+
var onEnterKey = function onEnterKey(event) {
|
|
611
|
+
if (focusedOptionIndex !== -1) {
|
|
612
|
+
if (props.multiple && event.shiftKey) onOptionSelectRange(event, focusedOptionIndex);else onOptionSelect(event, visibleOptions[focusedOptionIndex]);
|
|
613
|
+
}
|
|
614
|
+
event.preventDefault();
|
|
615
|
+
};
|
|
616
|
+
var onSpaceKey = function onSpaceKey(event) {
|
|
617
|
+
onEnterKey(event);
|
|
618
|
+
};
|
|
619
|
+
var onShiftKey = function onShiftKey() {
|
|
620
|
+
setStartRangeIndex(focusedOptionIndex);
|
|
621
|
+
};
|
|
622
|
+
var onHomeKey = function onHomeKey(event) {
|
|
623
|
+
var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
624
|
+
if (pressedInInputText) {
|
|
625
|
+
event.currentTarget.setSelectionRange(0, 0);
|
|
626
|
+
setFocusedOptionIndex(-1);
|
|
627
|
+
} else {
|
|
628
|
+
var metaKey = event.metaKey || event.ctrlKey;
|
|
629
|
+
var optionIndex = findFirstOptionIndex();
|
|
630
|
+
if (props.multiple && event.shiftKey && metaKey) {
|
|
631
|
+
onOptionSelectRange(event, optionIndex, startRangeIndex);
|
|
632
|
+
}
|
|
633
|
+
changeFocusedOptionIndex(event, optionIndex);
|
|
634
|
+
}
|
|
635
|
+
event.preventDefault();
|
|
636
|
+
};
|
|
637
|
+
var onEndKey = function onEndKey(event) {
|
|
638
|
+
var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
639
|
+
if (pressedInInputText) {
|
|
640
|
+
var target = event.currentTarget;
|
|
641
|
+
var len = target.value.length;
|
|
642
|
+
target.setSelectionRange(len, len);
|
|
643
|
+
_readOnlyError("focusedOptionIndex");
|
|
644
|
+
} else {
|
|
645
|
+
var metaKey = event.metaKey || event.ctrlKey;
|
|
646
|
+
var optionIndex = findLastOptionIndex();
|
|
647
|
+
if (props.multiple && event.shiftKey && metaKey) {
|
|
648
|
+
onOptionSelectRange(event, startRangeIndex, optionIndex);
|
|
649
|
+
}
|
|
650
|
+
changeFocusedOptionIndex(event, optionIndex);
|
|
651
|
+
}
|
|
652
|
+
event.preventDefault();
|
|
653
|
+
};
|
|
654
|
+
var onPageUpKey = function onPageUpKey(event) {
|
|
655
|
+
scrollInView(0);
|
|
656
|
+
event.preventDefault();
|
|
657
|
+
};
|
|
658
|
+
var onPageDownKey = function onPageDownKey(event) {
|
|
659
|
+
scrollInView(visibleOptions.length - 1);
|
|
660
|
+
event.preventDefault();
|
|
661
|
+
};
|
|
662
|
+
var onKeyDown = function onKeyDown(event) {
|
|
663
|
+
var metaKey = event.metaKey || event.ctrlKey;
|
|
664
|
+
switch (event.code) {
|
|
665
|
+
case 'ArrowDown':
|
|
666
|
+
onArrowDownKey(event);
|
|
667
|
+
break;
|
|
668
|
+
case 'ArrowUp':
|
|
669
|
+
onArrowUpKey(event);
|
|
670
|
+
break;
|
|
671
|
+
case 'Home':
|
|
672
|
+
onHomeKey(event);
|
|
673
|
+
break;
|
|
674
|
+
case 'End':
|
|
675
|
+
onEndKey(event);
|
|
676
|
+
break;
|
|
677
|
+
case 'PageDown':
|
|
678
|
+
onPageDownKey(event);
|
|
679
|
+
break;
|
|
680
|
+
case 'PageUp':
|
|
681
|
+
onPageUpKey(event);
|
|
682
|
+
break;
|
|
683
|
+
case 'Enter':
|
|
684
|
+
case 'NumpadEnter':
|
|
685
|
+
case 'Space':
|
|
686
|
+
onSpaceKey(event);
|
|
687
|
+
event.preventDefault();
|
|
688
|
+
break;
|
|
689
|
+
case 'Tab':
|
|
690
|
+
//NOOP
|
|
691
|
+
break;
|
|
692
|
+
case 'ShiftLeft':
|
|
693
|
+
case 'ShiftRight':
|
|
694
|
+
onShiftKey();
|
|
695
|
+
break;
|
|
696
|
+
default:
|
|
697
|
+
if (props.multiple && event.code === 'KeyA' && metaKey) {
|
|
698
|
+
var value = visibleOptions.filter(function (option) {
|
|
699
|
+
return isValidOption(option);
|
|
700
|
+
}).map(function (option) {
|
|
701
|
+
return getOptionValue(option);
|
|
702
|
+
});
|
|
703
|
+
updateModel(event, value);
|
|
704
|
+
event.preventDefault();
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
if (!metaKey && ObjectUtils.isPrintableCharacter(event.key)) {
|
|
708
|
+
searchOptions(event, event.key);
|
|
709
|
+
event.preventDefault();
|
|
710
|
+
}
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
var scrollInView = function scrollInView() {
|
|
715
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
716
|
+
setTimeout(function () {
|
|
717
|
+
var idx = index !== -1 ? "".concat(id.current, "_").concat(index) : focusedOptionId();
|
|
718
|
+
var element = listRef.current.querySelector("li[id=\"".concat(idx, "\"]"));
|
|
719
|
+
if (element) {
|
|
720
|
+
element.scrollIntoView({
|
|
721
|
+
block: 'nearest',
|
|
722
|
+
inline: 'nearest',
|
|
723
|
+
behavior: 'smooth'
|
|
724
|
+
});
|
|
725
|
+
} else if (props.virtualScrollerOptions) {
|
|
726
|
+
virtualScrollerRef.current && virtualScrollerRef.current.scrollToIndex(index !== -1 ? index : props.focusedOptionIndex);
|
|
727
|
+
}
|
|
728
|
+
}, 0);
|
|
729
|
+
};
|
|
505
730
|
var onFilter = function onFilter(event) {
|
|
506
731
|
virtualScrollerRef.current && virtualScrollerRef.current.scrollToIndex(0);
|
|
507
732
|
var originalEvent = event.originalEvent,
|
|
@@ -594,6 +819,23 @@ var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (i
|
|
|
594
819
|
}
|
|
595
820
|
return option && option['disabled'] !== undefined ? option['disabled'] : false;
|
|
596
821
|
};
|
|
822
|
+
var onFirstHiddenFocus = function onFirstHiddenFocus() {
|
|
823
|
+
DomHandler.focus(listRef.current);
|
|
824
|
+
var firstFocusableEl = DomHandler.getFirstFocusableElement(elementRef.current, ':not([data-p-hidden-focusable="true"])');
|
|
825
|
+
lastHiddenFocusableElement.current.tabIndex = DomHandler.isElement(firstFocusableEl) ? undefined : -1;
|
|
826
|
+
firstHiddenFocusableElement.current.tabIndex = -1;
|
|
827
|
+
};
|
|
828
|
+
var onLastHiddenFocus = function onLastHiddenFocus(event) {
|
|
829
|
+
var relatedTarget = event.relatedTarget;
|
|
830
|
+
if (relatedTarget === listRef.current) {
|
|
831
|
+
var firstFocusableEl = DomHandler.getFirstFocusableElement(elementRef.current, ':not([data-p-hidden-focusable="true"])');
|
|
832
|
+
DomHandler.focus(firstFocusableEl);
|
|
833
|
+
firstHiddenFocusableElement.current.tabIndex = undefined;
|
|
834
|
+
} else {
|
|
835
|
+
DomHandler.focus(firstHiddenFocusableElement.current);
|
|
836
|
+
}
|
|
837
|
+
astHiddenFocusableElement.current.tabIndex = -1;
|
|
838
|
+
};
|
|
597
839
|
var getOptionGroupRenderKey = function getOptionGroupRenderKey(optionGroup) {
|
|
598
840
|
return ObjectUtils.resolveFieldData(optionGroup, props.optionGroupLabel);
|
|
599
841
|
};
|
|
@@ -682,8 +924,9 @@ var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (i
|
|
|
682
924
|
var optionLabel = getOptionLabel(option);
|
|
683
925
|
var optionKey = j + '_' + getOptionRenderKey(option);
|
|
684
926
|
var disabled = isOptionDisabled(option);
|
|
685
|
-
|
|
927
|
+
disabled ? null : props.tabIndex || 0;
|
|
686
928
|
return /*#__PURE__*/React.createElement(ListBoxItem, {
|
|
929
|
+
id: id.current + '_' + j,
|
|
687
930
|
hostName: "ListBox",
|
|
688
931
|
key: optionKey,
|
|
689
932
|
label: optionLabel,
|
|
@@ -692,8 +935,9 @@ var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (i
|
|
|
692
935
|
template: props.itemTemplate,
|
|
693
936
|
selected: isSelected(option),
|
|
694
937
|
onClick: onOptionSelect,
|
|
938
|
+
index: j,
|
|
939
|
+
focusedOptionIndex: focusedOptionIndex,
|
|
695
940
|
onTouchEnd: onOptionTouchEnd,
|
|
696
|
-
tabIndex: tabIndex,
|
|
697
941
|
disabled: disabled,
|
|
698
942
|
ptCallbacks: ptCallbacks,
|
|
699
943
|
metaData: metaData
|
|
@@ -723,18 +967,20 @@ var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (i
|
|
|
723
967
|
var optionLabel = getOptionLabel(option);
|
|
724
968
|
var optionKey = index + '_' + getOptionRenderKey(option);
|
|
725
969
|
var disabled = isOptionDisabled(option);
|
|
726
|
-
|
|
970
|
+
disabled ? null : props.tabIndex || 0;
|
|
727
971
|
return /*#__PURE__*/React.createElement(ListBoxItem, {
|
|
972
|
+
id: id.current + '_' + index,
|
|
728
973
|
hostName: "ListBox",
|
|
729
974
|
key: optionKey,
|
|
730
975
|
label: optionLabel,
|
|
976
|
+
index: index,
|
|
977
|
+
focusedOptionIndex: focusedOptionIndex,
|
|
731
978
|
option: option,
|
|
732
979
|
style: style,
|
|
733
980
|
template: props.itemTemplate,
|
|
734
981
|
selected: isSelected(option),
|
|
735
982
|
onClick: onOptionSelect,
|
|
736
983
|
onTouchEnd: onOptionTouchEnd,
|
|
737
|
-
tabIndex: tabIndex,
|
|
738
984
|
disabled: disabled,
|
|
739
985
|
ptCallbacks: ptCallbacks,
|
|
740
986
|
metaData: metaData
|
|
@@ -778,6 +1024,7 @@ var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (i
|
|
|
778
1024
|
options: options
|
|
779
1025
|
}),
|
|
780
1026
|
role: 'listbox',
|
|
1027
|
+
tabIndex: '-1',
|
|
781
1028
|
'aria-multiselectable': props.multiple
|
|
782
1029
|
}, ariaProps), ptCallbacks.ptm('list'));
|
|
783
1030
|
return /*#__PURE__*/React.createElement("ul", listProps, options.children);
|
|
@@ -791,9 +1038,12 @@ var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (i
|
|
|
791
1038
|
} else {
|
|
792
1039
|
var items = createItems();
|
|
793
1040
|
var listProps = mergeProps(_objectSpread({
|
|
1041
|
+
ref: listRef,
|
|
794
1042
|
className: ptCallbacks.cx('list'),
|
|
795
1043
|
role: 'listbox',
|
|
796
|
-
'aria-multiselectable': props.multiple
|
|
1044
|
+
'aria-multiselectable': props.multiple,
|
|
1045
|
+
tabIndex: '-1',
|
|
1046
|
+
onKeyDown: onKeyDown
|
|
797
1047
|
}, ariaProps), ptCallbacks.ptm('list'));
|
|
798
1048
|
return /*#__PURE__*/React.createElement("ul", listProps, items);
|
|
799
1049
|
}
|
|
@@ -814,7 +1064,27 @@ var ListBox = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (i
|
|
|
814
1064
|
className: ptCallbacks.cx('root'),
|
|
815
1065
|
style: props.style
|
|
816
1066
|
}, ListBoxBase.getOtherProps(props), ptCallbacks.ptm('root'));
|
|
817
|
-
|
|
1067
|
+
var hiddenFirstElement = mergeProps({
|
|
1068
|
+
ref: firstHiddenFocusableElement,
|
|
1069
|
+
role: 'presentation',
|
|
1070
|
+
'aria-hidden': 'true',
|
|
1071
|
+
className: 'p-hidden-accessible p-hidden-focusable',
|
|
1072
|
+
tabIndex: !props.disabled ? props.tabIndex : -1,
|
|
1073
|
+
onFocus: onFirstHiddenFocus,
|
|
1074
|
+
'data-p-hidden-accessible': true,
|
|
1075
|
+
'data-p-hidden-focusable': true
|
|
1076
|
+
}, ptCallbacks.ptm('hiddenFirstFocusableEl'));
|
|
1077
|
+
var hiddenLastElement = mergeProps({
|
|
1078
|
+
ref: lastHiddenFocusableElement,
|
|
1079
|
+
role: 'presentation',
|
|
1080
|
+
'aria-hidden': 'true',
|
|
1081
|
+
className: 'p-hidden-accessible p-hidden-focusable',
|
|
1082
|
+
tabIndex: !props.disabled ? props.tabIndex : -1,
|
|
1083
|
+
onFocus: onLastHiddenFocus,
|
|
1084
|
+
'data-p-hidden-accessible': true,
|
|
1085
|
+
'data-p-hidden-focusable': true
|
|
1086
|
+
}, ptCallbacks.ptm('hiddenFirstFocusableEl'));
|
|
1087
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", rootProps, /*#__PURE__*/React.createElement("span", hiddenFirstElement), header, /*#__PURE__*/React.createElement("div", wrapperProps, list), /*#__PURE__*/React.createElement("span", hiddenLastElement)), hasTooltip && /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
818
1088
|
target: elementRef,
|
|
819
1089
|
content: props.tooltip
|
|
820
1090
|
}, props.tooltipOptions, {
|