@entur/dropdown 7.2.1 → 7.2.3-beta.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/dist/components/DropdownList.d.ts +2 -1
- package/dist/dropdown.cjs.development.js +23 -13
- package/dist/dropdown.cjs.development.js.map +1 -1
- package/dist/dropdown.cjs.production.min.js +1 -1
- package/dist/dropdown.cjs.production.min.js.map +1 -1
- package/dist/dropdown.esm.js +23 -13
- package/dist/dropdown.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +8 -8
package/dist/dropdown.esm.js
CHANGED
|
@@ -357,7 +357,7 @@ function _regeneratorRuntime() {
|
|
|
357
357
|
}, e;
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
var _excluded$5 = ["ariaLabelChosenSingular", "ariaLabelSelectedItem", "getItemProps", "getMenuProps", "isOpen", "highlightedIndex", "listItems", "floatingStyles", "setListRef", "loading", "loadingText", "noMatchesText", "selectAllCheckboxState", "selectAllItem", "selectedItems"];
|
|
360
|
+
var _excluded$5 = ["ariaLabelChosenSingular", "ariaLabelSelectedItem", "getItemProps", "getMenuProps", "isOpen", "highlightedIndex", "listItems", "floatingStyles", "setListRef", "loading", "loadingText", "noMatchesText", "selectAllCheckboxState", "selectAllItem", "selectedItems", "readOnly"];
|
|
361
361
|
var DropdownList = function DropdownList(_ref) {
|
|
362
362
|
var _listItems$;
|
|
363
363
|
var _ref$ariaLabelChosenS = _ref.ariaLabelChosenSingular,
|
|
@@ -380,6 +380,8 @@ var DropdownList = function DropdownList(_ref) {
|
|
|
380
380
|
selectAllCheckboxState = _ref.selectAllCheckboxState,
|
|
381
381
|
selectAllItem = _ref.selectAllItem,
|
|
382
382
|
selectedItems = _ref.selectedItems,
|
|
383
|
+
_ref$readOnly = _ref.readOnly,
|
|
384
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
383
385
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
384
386
|
var isMultiselect = selectAllItem !== undefined;
|
|
385
387
|
var isNoMatches = !loading && (listItems.length === 0 || (listItems == null ? void 0 : listItems.length) === 1 && (listItems == null || (_listItems$ = listItems[0]) == null ? void 0 : _listItems$.value) === (selectAllItem == null ? void 0 : selectAllItem.value));
|
|
@@ -454,10 +456,10 @@ var DropdownList = function DropdownList(_ref) {
|
|
|
454
456
|
ref: setListRef,
|
|
455
457
|
className: 'eds-dropdown__list',
|
|
456
458
|
style: _extends({}, floatingStyles, {
|
|
457
|
-
display: isOpen ? undefined : 'none'
|
|
459
|
+
display: isOpen && !readOnly ? undefined : 'none'
|
|
458
460
|
}, rest.style)
|
|
459
461
|
})), function () {
|
|
460
|
-
if (!isOpen) {
|
|
462
|
+
if (!isOpen || readOnly) {
|
|
461
463
|
return null;
|
|
462
464
|
}
|
|
463
465
|
if (loading) {
|
|
@@ -874,7 +876,7 @@ function getA11yStatusMessage(options) {
|
|
|
874
876
|
|
|
875
877
|
var _excluded$3 = ["ariaLabelChosenSingular", "ariaLabelCloseList", "ariaLabelOpenList", "ariaLabelSelectedItem", "className", "clearable", "debounceTimeout", "disabled", "disableLabelAnimation", "feedback", "items", "itemFilter", "label", "labelClearSelectedItem", "labelTooltip", "listStyle", "loading", "loadingText", "noMatchesText", "onChange", "placeholder", "prepend", "readOnly", "selectedItem", "selectOnBlur", "selectOnTab", "style", "variant"];
|
|
876
878
|
var SearchableDropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
877
|
-
var _document,
|
|
879
|
+
var _document, _selectedItem$label;
|
|
878
880
|
var ariaLabelChosenSingular = _ref.ariaLabelChosenSingular,
|
|
879
881
|
_ref$ariaLabelCloseLi = _ref.ariaLabelCloseList,
|
|
880
882
|
ariaLabelCloseList = _ref$ariaLabelCloseLi === void 0 ? 'Lukk liste med valg' : _ref$ariaLabelCloseLi,
|
|
@@ -1112,9 +1114,6 @@ var SearchableDropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1112
1114
|
labelId: getLabelProps().id,
|
|
1113
1115
|
labelProps: getLabelProps(),
|
|
1114
1116
|
labelTooltip: labelTooltip,
|
|
1115
|
-
onBlur: function onBlur() {
|
|
1116
|
-
return setInputValue('');
|
|
1117
|
-
},
|
|
1118
1117
|
onClick: function onClick(e) {
|
|
1119
1118
|
if (e.target === e.currentTarget) {
|
|
1120
1119
|
var _getInputProps;
|
|
@@ -1141,7 +1140,8 @@ var SearchableDropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1141
1140
|
loading: loading != null ? loading : resolvedItemsLoading,
|
|
1142
1141
|
loadingText: loadingText,
|
|
1143
1142
|
noMatchesText: noMatchesText,
|
|
1144
|
-
selectedItems: selectedItem !== null ? [selectedItem] : []
|
|
1143
|
+
selectedItems: selectedItem !== null ? [selectedItem] : [],
|
|
1144
|
+
readOnly: readOnly
|
|
1145
1145
|
})
|
|
1146
1146
|
}, rest, {
|
|
1147
1147
|
// Append is not supported as of now
|
|
@@ -1150,8 +1150,14 @@ var SearchableDropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1150
1150
|
className: classNames('eds-dropdown--searchable__selected-item', {
|
|
1151
1151
|
'eds-dropdown--searchable__selected-item--hidden': !showSelectedItem
|
|
1152
1152
|
}),
|
|
1153
|
-
|
|
1154
|
-
|
|
1153
|
+
onClick: function onClick(event) {
|
|
1154
|
+
if (!disabled && !readOnly) {
|
|
1155
|
+
var _inputRef$current2, _getInputProps2;
|
|
1156
|
+
(_inputRef$current2 = inputRef.current) == null || _inputRef$current2.focus();
|
|
1157
|
+
(_getInputProps2 = getInputProps()) == null || _getInputProps2.onClick == null || _getInputProps2.onClick(event);
|
|
1158
|
+
}
|
|
1159
|
+
},
|
|
1160
|
+
tabIndex: readOnly ? 0 : -1
|
|
1155
1161
|
}, showSelectedItem ? selectedItem == null ? void 0 : selectedItem.label : ''), React.createElement("input", _extends({
|
|
1156
1162
|
className: classNames('eds-dropdown__input eds-form-control', {
|
|
1157
1163
|
'eds-dropdown__input--hidden': showSelectedItem
|
|
@@ -1172,7 +1178,9 @@ var SearchableDropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1172
1178
|
if (selectedItem !== null) setShowSelectedItem(true);
|
|
1173
1179
|
},
|
|
1174
1180
|
onFocus: function onFocus() {
|
|
1175
|
-
|
|
1181
|
+
if (!readOnly) {
|
|
1182
|
+
setShowSelectedItem(false);
|
|
1183
|
+
}
|
|
1176
1184
|
},
|
|
1177
1185
|
disabled: disabled,
|
|
1178
1186
|
readOnly: readOnly,
|
|
@@ -1510,7 +1518,8 @@ var MultiSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1510
1518
|
noMatchesText: noMatchesText,
|
|
1511
1519
|
selectAllCheckboxState: selectAllCheckboxState,
|
|
1512
1520
|
selectAllItem: selectAll,
|
|
1513
|
-
selectedItems: selectedItems
|
|
1521
|
+
selectedItems: selectedItems,
|
|
1522
|
+
readOnly: readOnly
|
|
1514
1523
|
})
|
|
1515
1524
|
}, rest), React.createElement("div", {
|
|
1516
1525
|
className: classNames('eds-dropdown--multiselect__selected-items-and-input', {
|
|
@@ -1752,7 +1761,8 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1752
1761
|
setListRef: refs.setFloating,
|
|
1753
1762
|
loading: loading != null ? loading : resolvedItemsLoading,
|
|
1754
1763
|
loadingText: loadingText,
|
|
1755
|
-
selectedItems: selectedItem !== null ? [selectedItem] : []
|
|
1764
|
+
selectedItems: selectedItem !== null ? [selectedItem] : [],
|
|
1765
|
+
readOnly: readOnly
|
|
1756
1766
|
})
|
|
1757
1767
|
}, rest, {
|
|
1758
1768
|
// Append is not supported as of now
|