@entur/dropdown 7.0.2 → 7.1.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/README.md +2 -2
- package/dist/Dropdown.d.ts +3 -1
- package/dist/MultiSelect.d.ts +4 -73
- package/dist/SearchableDropdown.d.ts +5 -81
- package/dist/dropdown.cjs.development.js +21 -14
- 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 +21 -14
- package/dist/dropdown.esm.js.map +1 -1
- package/package.json +11 -11
package/dist/dropdown.esm.js
CHANGED
|
@@ -687,7 +687,7 @@ debounceTimeout) {
|
|
|
687
687
|
_context.next = 11;
|
|
688
688
|
break;
|
|
689
689
|
}
|
|
690
|
-
console.warn('Avbryt den asynkrone funksjonen din med signalet fra AbortController-en for å for å unngå minnelekkasje.', 'Funksjonen bør kaste en DOMException med navnet "AbortError" når den avbrytes.', '', '\n\nSe eksempel her: https://
|
|
690
|
+
console.warn('Avbryt den asynkrone funksjonen din med signalet fra AbortController-en for å for å unngå minnelekkasje.', 'Funksjonen bør kaste en DOMException med navnet "AbortError" når den avbrytes.', '', '\n\nSe eksempel her: https://linje.entur.no/komponenter/skjemaelementer/dropdown#s%C3%B8kbar-dropdown-med-valg-fra-nettverkskall-bassert-p%C3%A5-tekstinput', '\nLes mer om AbortController her: https://developer.mozilla.org/en-US/docs/Web/API/AbortController');
|
|
691
691
|
return _context.abrupt("return");
|
|
692
692
|
case 11:
|
|
693
693
|
setLoading(false);
|
|
@@ -867,7 +867,7 @@ function getA11yStatusMessage(options) {
|
|
|
867
867
|
}
|
|
868
868
|
/* end a11y utils */
|
|
869
869
|
|
|
870
|
-
var _excluded$3 = ["ariaLabelChosenSingular", "ariaLabelCloseList", "ariaLabelOpenList", "ariaLabelSelectedItem", "className", "clearable", "debounceTimeout", "disabled", "disableLabelAnimation", "feedback", "items", "itemFilter", "label", "labelClearSelectedItem", "labelTooltip", "listStyle", "loadingText", "noMatchesText", "onChange", "placeholder", "prepend", "readOnly", "selectedItem", "selectOnBlur", "selectOnTab", "style", "variant"];
|
|
870
|
+
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"];
|
|
871
871
|
var SearchableDropdown = function SearchableDropdown(_ref) {
|
|
872
872
|
var _document, _selectedItem$label;
|
|
873
873
|
var ariaLabelChosenSingular = _ref.ariaLabelChosenSingular,
|
|
@@ -891,6 +891,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
|
|
|
891
891
|
labelClearSelectedItem = _ref$labelClearSelect === void 0 ? 'fjern valgt' : _ref$labelClearSelect,
|
|
892
892
|
labelTooltip = _ref.labelTooltip,
|
|
893
893
|
listStyle = _ref.listStyle,
|
|
894
|
+
loading = _ref.loading,
|
|
894
895
|
loadingText = _ref.loadingText,
|
|
895
896
|
noMatchesText = _ref.noMatchesText,
|
|
896
897
|
_ref$onChange = _ref.onChange,
|
|
@@ -919,7 +920,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
|
|
|
919
920
|
var inputRef = useRef(null);
|
|
920
921
|
var _useResolvedItems = useResolvedItems(initialItems, debounceTimeout),
|
|
921
922
|
normalizedItems = _useResolvedItems.items,
|
|
922
|
-
|
|
923
|
+
resolvedItemsLoading = _useResolvedItems.loading,
|
|
923
924
|
fetchItems = _useResolvedItems.fetchItems;
|
|
924
925
|
var _useState3 = useState(normalizedItems),
|
|
925
926
|
listItems = _useState3[0],
|
|
@@ -1084,7 +1085,7 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
|
|
|
1084
1085
|
focusable: false,
|
|
1085
1086
|
getToggleButtonProps: getToggleButtonProps,
|
|
1086
1087
|
isOpen: isOpen,
|
|
1087
|
-
loading: loading,
|
|
1088
|
+
loading: loading != null ? loading : resolvedItemsLoading,
|
|
1088
1089
|
loadingText: loadingText,
|
|
1089
1090
|
onClear: handleOnClear,
|
|
1090
1091
|
selectedItems: [selectedItem]
|
|
@@ -1147,14 +1148,14 @@ var SearchableDropdown = function SearchableDropdown(_ref) {
|
|
|
1147
1148
|
listItems: listItems,
|
|
1148
1149
|
style: listStyle,
|
|
1149
1150
|
setListRef: refs.setFloating,
|
|
1150
|
-
loading: loading,
|
|
1151
|
+
loading: loading != null ? loading : resolvedItemsLoading,
|
|
1151
1152
|
loadingText: loadingText,
|
|
1152
1153
|
noMatchesText: noMatchesText,
|
|
1153
1154
|
selectedItems: selectedItem !== null ? [selectedItem] : []
|
|
1154
1155
|
}));
|
|
1155
1156
|
};
|
|
1156
1157
|
|
|
1157
|
-
var _excluded$2 = ["className", "clearable", "clearInputOnSelect", "debounceTimeout", "disabled", "disableLabelAnimation", "feedback", "hideSelectAll", "items", "itemFilter", "label", "labelAllItemsSelected", "labelClearAllItems", "labelSelectAll", "labelTooltip", "listStyle", "loadingText", "maxChips", "noMatchesText", "onChange", "placeholder", "readOnly", "selectedItems", "selectOnBlur", "selectOnTab", "style", "variant", "ariaLabelChosenSingular", "ariaLabelChosenPlural", "ariaLabelCloseList", "ariaLabelJumpToInput", "ariaLabelOpenList", "ariaLabelRemoveSelected", "ariaLabelSelectedItem"];
|
|
1158
|
+
var _excluded$2 = ["className", "clearable", "clearInputOnSelect", "debounceTimeout", "disabled", "disableLabelAnimation", "feedback", "hideSelectAll", "items", "itemFilter", "label", "labelAllItemsSelected", "labelClearAllItems", "labelSelectAll", "labelTooltip", "listStyle", "loading", "loadingText", "maxChips", "noMatchesText", "onChange", "placeholder", "readOnly", "selectedItems", "selectOnBlur", "selectOnTab", "style", "variant", "ariaLabelChosenSingular", "ariaLabelChosenPlural", "ariaLabelCloseList", "ariaLabelJumpToInput", "ariaLabelOpenList", "ariaLabelRemoveSelected", "ariaLabelSelectedItem"];
|
|
1158
1159
|
var MultiSelect = function MultiSelect(_ref) {
|
|
1159
1160
|
var className = _ref.className,
|
|
1160
1161
|
_ref$clearable = _ref.clearable,
|
|
@@ -1180,6 +1181,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
1180
1181
|
labelSelectAll = _ref$labelSelectAll === void 0 ? 'Velg alle' : _ref$labelSelectAll,
|
|
1181
1182
|
labelTooltip = _ref.labelTooltip,
|
|
1182
1183
|
listStyle = _ref.listStyle,
|
|
1184
|
+
loading = _ref.loading,
|
|
1183
1185
|
loadingText = _ref.loadingText,
|
|
1184
1186
|
_ref$maxChips = _ref.maxChips,
|
|
1185
1187
|
maxChips = _ref$maxChips === void 0 ? 10 : _ref$maxChips,
|
|
@@ -1222,7 +1224,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
1222
1224
|
}, [rest.selectedItem]);
|
|
1223
1225
|
var _useResolvedItems = useResolvedItems(initialItems, debounceTimeout),
|
|
1224
1226
|
normalizedItems = _useResolvedItems.items,
|
|
1225
|
-
|
|
1227
|
+
resolvedItemsLoading = _useResolvedItems.loading,
|
|
1226
1228
|
fetchItems = _useResolvedItems.fetchItems;
|
|
1227
1229
|
var isAllNonAsyncItemsSelected = typeof initialItems !== 'function' && selectedItems.length === normalizedItems.length;
|
|
1228
1230
|
// special 'item' used as Select All entry in the dropdown list
|
|
@@ -1443,7 +1445,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
1443
1445
|
clearable: clearable,
|
|
1444
1446
|
labelClearSelectedItems: labelClearAllItems,
|
|
1445
1447
|
focusable: false,
|
|
1446
|
-
loading: loading,
|
|
1448
|
+
loading: loading != null ? loading : resolvedItemsLoading,
|
|
1447
1449
|
loadingText: loadingText,
|
|
1448
1450
|
disabled: readOnly || disabled,
|
|
1449
1451
|
onClear: handleOnClear,
|
|
@@ -1539,7 +1541,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
1539
1541
|
listItems: listItems,
|
|
1540
1542
|
style: listStyle,
|
|
1541
1543
|
setListRef: refs.setFloating,
|
|
1542
|
-
loading: loading,
|
|
1544
|
+
loading: loading != null ? loading : resolvedItemsLoading,
|
|
1543
1545
|
loadingText: loadingText,
|
|
1544
1546
|
noMatchesText: noMatchesText,
|
|
1545
1547
|
selectAllCheckboxState: selectAllCheckboxState,
|
|
@@ -1548,7 +1550,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
1548
1550
|
}));
|
|
1549
1551
|
};
|
|
1550
1552
|
|
|
1551
|
-
var _excluded$1 = ["ariaLabelChosenSingular", "ariaLabelCloseList", "ariaLabelOpenList", "ariaLabelSelectedItem", "className", "clearable", "disabled", "disableLabelAnimation", "feedback", "items", "label", "labelClearSelectedItem", "labelTooltip", "listStyle", "loadingText", "noMatchesText", "onChange", "placeholder", "prepend", "readOnly", "selectedItem", "selectOnBlur", "selectOnTab", "style", "variant"];
|
|
1553
|
+
var _excluded$1 = ["ariaLabelChosenSingular", "ariaLabelCloseList", "ariaLabelOpenList", "ariaLabelSelectedItem", "className", "clearable", "disabled", "disableLabelAnimation", "feedback", "items", "label", "labelClearSelectedItem", "labelTooltip", "listStyle", "loading", "loadingText", "noMatchesText", "onChange", "placeholder", "prepend", "readOnly", "selectedItem", "selectOnBlur", "selectOnTab", "style", "variant"];
|
|
1552
1554
|
var Dropdown = function Dropdown(_ref) {
|
|
1553
1555
|
var _ref3, _selectedItem$label;
|
|
1554
1556
|
var ariaLabelChosenSingular = _ref.ariaLabelChosenSingular,
|
|
@@ -1568,6 +1570,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1568
1570
|
labelClearSelectedItem = _ref$labelClearSelect === void 0 ? 'fjern valgt' : _ref$labelClearSelect,
|
|
1569
1571
|
labelTooltip = _ref.labelTooltip,
|
|
1570
1572
|
listStyle = _ref.listStyle,
|
|
1573
|
+
loading = _ref.loading,
|
|
1571
1574
|
loadingText = _ref.loadingText,
|
|
1572
1575
|
_ref$noMatchesText = _ref.noMatchesText,
|
|
1573
1576
|
noMatchesText = _ref$noMatchesText === void 0 ? 'Ingen tilgjengelige valg …' : _ref$noMatchesText,
|
|
@@ -1587,7 +1590,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1587
1590
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1588
1591
|
var _useResolvedItems = useResolvedItems(initialItems),
|
|
1589
1592
|
normalizedItems = _useResolvedItems.items,
|
|
1590
|
-
|
|
1593
|
+
resolvedItemsLoading = _useResolvedItems.loading;
|
|
1591
1594
|
var toggleButtonRef = useRef(null);
|
|
1592
1595
|
var isFilled = selectedItem !== null || placeholder !== undefined;
|
|
1593
1596
|
var _useSelect = useSelect({
|
|
@@ -1647,7 +1650,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1647
1650
|
focusable: false,
|
|
1648
1651
|
getToggleButtonProps: getToggleButtonProps,
|
|
1649
1652
|
isOpen: isOpen,
|
|
1650
|
-
loading: loading,
|
|
1653
|
+
loading: loading != null ? loading : resolvedItemsLoading,
|
|
1651
1654
|
loadingText: loadingText,
|
|
1652
1655
|
onClear: function onClear() {
|
|
1653
1656
|
var _toggleButtonRef$curr;
|
|
@@ -1689,7 +1692,11 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1689
1692
|
}
|
|
1690
1693
|
}
|
|
1691
1694
|
},
|
|
1692
|
-
ref: toggleButtonRef
|
|
1695
|
+
ref: toggleButtonRef,
|
|
1696
|
+
'aria-disabled': disabled,
|
|
1697
|
+
'aria-label': disabled ? 'Disabled dropdown' : '',
|
|
1698
|
+
disabled: disabled,
|
|
1699
|
+
tabIndex: disabled ? -1 : 0
|
|
1693
1700
|
})), (_ref3 = (_selectedItem$label = selectedItem == null ? void 0 : selectedItem.label) != null ? _selectedItem$label : React.createElement("div", {
|
|
1694
1701
|
className: classNames('eds-dropdown__selected-item__placeholder', {
|
|
1695
1702
|
'eds-dropdown__selected-item__placeholder--readonly': readOnly
|
|
@@ -1706,7 +1713,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1706
1713
|
noMatchesText: noMatchesText,
|
|
1707
1714
|
style: listStyle,
|
|
1708
1715
|
setListRef: refs.setFloating,
|
|
1709
|
-
loading: loading,
|
|
1716
|
+
loading: loading != null ? loading : resolvedItemsLoading,
|
|
1710
1717
|
loadingText: loadingText,
|
|
1711
1718
|
selectedItems: selectedItem !== null ? [selectedItem] : []
|
|
1712
1719
|
}));
|