@entur/dropdown 8.0.6 → 8.0.7-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/dropdown.cjs.js +109 -104
- package/dist/dropdown.cjs.js.map +1 -1
- package/dist/dropdown.esm.js +109 -104
- package/dist/dropdown.esm.js.map +1 -1
- package/package.json +5 -5
package/dist/dropdown.cjs.js
CHANGED
|
@@ -500,40 +500,41 @@ function getA11yStatusMessage(options) {
|
|
|
500
500
|
return `${resultCountWithoutSelectAll} resultat${resultCountWithoutSelectAll === 1 ? "" : "er"} tilgjengelig, naviger med pil opp eller ned, velg elementer med Enter.`;
|
|
501
501
|
}
|
|
502
502
|
const SearchableDropdown = React.forwardRef(
|
|
503
|
-
({
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
503
|
+
(props, ref) => {
|
|
504
|
+
const {
|
|
505
|
+
ariaLabelChosenSingular,
|
|
506
|
+
ariaLabelCloseList = "Lukk liste med valg",
|
|
507
|
+
ariaLabelOpenList = "Åpne liste med valg",
|
|
508
|
+
ariaLabelSelectedItem,
|
|
509
|
+
className,
|
|
510
|
+
clearable = true,
|
|
511
|
+
debounceTimeout,
|
|
512
|
+
disabled = false,
|
|
513
|
+
disableLabelAnimation = false,
|
|
514
|
+
feedback,
|
|
515
|
+
items: initialItems,
|
|
516
|
+
itemFilter = isFunctionWithQueryArgument(initialItems) ? noFilter : lowerCaseFilterTest,
|
|
517
|
+
label,
|
|
518
|
+
labelClearSelectedItem = "fjern valgt",
|
|
519
|
+
labelTooltip,
|
|
520
|
+
listStyle,
|
|
521
|
+
loading,
|
|
522
|
+
loadingText = "Laster resultater …",
|
|
523
|
+
noMatchesText = "Ingen tilgjengelige valg …",
|
|
524
|
+
onChange = () => void 0,
|
|
525
|
+
placeholder,
|
|
526
|
+
prepend,
|
|
527
|
+
readOnly = false,
|
|
528
|
+
selectedItem: value,
|
|
529
|
+
selectOnTab = false,
|
|
530
|
+
style,
|
|
531
|
+
variant = "info",
|
|
532
|
+
onBlur,
|
|
533
|
+
onClick,
|
|
534
|
+
onKeyDown,
|
|
535
|
+
onFocus,
|
|
536
|
+
...rest
|
|
537
|
+
} = props;
|
|
537
538
|
const [showSelectedItem, setShowSelectedItem] = React.useState(value !== null);
|
|
538
539
|
const [lastHighlightedIndex, setLastHighlightedIndex] = React.useState(0);
|
|
539
540
|
const inputRef = React.useRef(null);
|
|
@@ -809,47 +810,48 @@ const SearchableDropdown = React.forwardRef(
|
|
|
809
810
|
}
|
|
810
811
|
);
|
|
811
812
|
const MultiSelect = React.forwardRef(
|
|
812
|
-
({
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
813
|
+
(props, ref) => {
|
|
814
|
+
const {
|
|
815
|
+
className,
|
|
816
|
+
clearable = true,
|
|
817
|
+
clearInputOnSelect = false,
|
|
818
|
+
debounceTimeout,
|
|
819
|
+
disabled = false,
|
|
820
|
+
disableLabelAnimation,
|
|
821
|
+
feedback,
|
|
822
|
+
hideSelectAll = false,
|
|
823
|
+
items: initialItems,
|
|
824
|
+
itemFilter = isFunctionWithQueryArgument(initialItems) ? noFilter : lowerCaseFilterTest,
|
|
825
|
+
label,
|
|
826
|
+
labelAllItemsSelected = "Alle valgt",
|
|
827
|
+
labelClearAllItems = "Fjern valgte",
|
|
828
|
+
labelSelectAll = "Velg alle",
|
|
829
|
+
labelTooltip,
|
|
830
|
+
listStyle,
|
|
831
|
+
loading,
|
|
832
|
+
loadingText = "Laster resultater …",
|
|
833
|
+
maxChips = 10,
|
|
834
|
+
noMatchesText,
|
|
835
|
+
onChange = () => void 0,
|
|
836
|
+
placeholder,
|
|
837
|
+
readOnly = false,
|
|
838
|
+
selectedItems = [],
|
|
839
|
+
selectOnTab = false,
|
|
840
|
+
style,
|
|
841
|
+
variant = "information",
|
|
842
|
+
ariaLabelChosenSingular,
|
|
843
|
+
ariaLabelChosenPlural = "valgte",
|
|
844
|
+
ariaLabelCloseList = "Lukk liste med valg",
|
|
845
|
+
ariaLabelJumpToInput = `${selectedItems.length} valgte elementer, trykk for å hoppe til tekstfeltet`,
|
|
846
|
+
ariaLabelOpenList = "Åpne liste med valg",
|
|
847
|
+
ariaLabelRemoveSelected = "trykk for å fjerne valg",
|
|
848
|
+
ariaLabelSelectedItem,
|
|
849
|
+
onBlur,
|
|
850
|
+
onClick,
|
|
851
|
+
onKeyDown,
|
|
852
|
+
onFocus,
|
|
853
|
+
...rest
|
|
854
|
+
} = props;
|
|
853
855
|
const [lastHighlightedIndex, setLastHighlightedIndex] = React.useState(0);
|
|
854
856
|
const inputRef = React.useRef(null);
|
|
855
857
|
React.useEffect(() => {
|
|
@@ -1202,36 +1204,38 @@ const MultiSelect = React.forwardRef(
|
|
|
1202
1204
|
}
|
|
1203
1205
|
);
|
|
1204
1206
|
const Dropdown = React.forwardRef(
|
|
1205
|
-
({
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1207
|
+
(props, ref) => {
|
|
1208
|
+
const {
|
|
1209
|
+
ariaLabelChosenSingular,
|
|
1210
|
+
ariaLabelCloseList = "Lukk liste med valg",
|
|
1211
|
+
ariaLabelOpenList = "Åpne liste med valg",
|
|
1212
|
+
ariaLabelSelectedItem,
|
|
1213
|
+
className,
|
|
1214
|
+
clearable,
|
|
1215
|
+
disabled = false,
|
|
1216
|
+
disableLabelAnimation,
|
|
1217
|
+
feedback,
|
|
1218
|
+
items: initialItems,
|
|
1219
|
+
label,
|
|
1220
|
+
labelClearSelectedItem = "fjern valgt",
|
|
1221
|
+
labelTooltip,
|
|
1222
|
+
listStyle,
|
|
1223
|
+
loading,
|
|
1224
|
+
loadingText = "Laster resultater …",
|
|
1225
|
+
noMatchesText = "Ingen tilgjengelige valg …",
|
|
1226
|
+
onChange,
|
|
1227
|
+
placeholder,
|
|
1228
|
+
prepend,
|
|
1229
|
+
readOnly = false,
|
|
1230
|
+
selectedItem,
|
|
1231
|
+
selectOnTab = false,
|
|
1232
|
+
style,
|
|
1233
|
+
variant = "information",
|
|
1234
|
+
...rest
|
|
1235
|
+
} = props;
|
|
1233
1236
|
const { items: normalizedItems, loading: resolvedItemsLoading } = useResolvedItems(initialItems);
|
|
1234
1237
|
const isFilled = selectedItem !== null || placeholder !== void 0;
|
|
1238
|
+
let floatingRefs;
|
|
1235
1239
|
const {
|
|
1236
1240
|
isOpen,
|
|
1237
1241
|
getItemProps,
|
|
@@ -1246,7 +1250,7 @@ const Dropdown = React.forwardRef(
|
|
|
1246
1250
|
defaultHighlightedIndex: selectedItem ? void 0 : 0,
|
|
1247
1251
|
selectedItem,
|
|
1248
1252
|
stateReducer(state, { changes, type }) {
|
|
1249
|
-
const toggleButtonIsFocused = typeof document !== "undefined" && document.activeElement ===
|
|
1253
|
+
const toggleButtonIsFocused = typeof document !== "undefined" && document.activeElement === floatingRefs?.reference.current;
|
|
1250
1254
|
switch (type) {
|
|
1251
1255
|
case downshift.useSelect.stateChangeTypes.ToggleButtonKeyDownArrowDown:
|
|
1252
1256
|
case downshift.useSelect.stateChangeTypes.ToggleButtonKeyDownArrowUp:
|
|
@@ -1279,6 +1283,7 @@ const Dropdown = React.forwardRef(
|
|
|
1279
1283
|
reactDom.flip({ fallbackStrategy: "initialPlacement" })
|
|
1280
1284
|
]
|
|
1281
1285
|
});
|
|
1286
|
+
floatingRefs = refs;
|
|
1282
1287
|
React.useLayoutEffect(() => {
|
|
1283
1288
|
if (isOpen && refs.reference.current && refs.floating.current) {
|
|
1284
1289
|
return reactDom.autoUpdate(
|