@entur/dropdown 9.1.1 → 9.1.2

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.mjs CHANGED
@@ -251,7 +251,8 @@ const DropdownFieldAppendix = forwardRef(
251
251
  IconButton,
252
252
  {
253
253
  className: classNames("eds-dropdown__appendix__toggle-button", {
254
- "eds-dropdown__appendix__toggle-button--open": isOpen
254
+ "eds-dropdown__appendix__toggle-button--open": isOpen,
255
+ "eds-dropdown__appendix__toggle-button--loading": loading
255
256
  }),
256
257
  ref,
257
258
  "aria-label": getToggleAriaLabel(),
@@ -690,11 +691,18 @@ const SearchableDropdown = React.forwardRef(
690
691
  const { refs, floatingStyles, update } = useFloating({
691
692
  open: isOpen,
692
693
  placement: "bottom-start",
694
+ // Fixed takes the menu out of the field's scroll container, so shift()'s
695
+ // padding cannot become horizontal overflow there
696
+ strategy: "fixed",
693
697
  middleware: [
694
698
  offset(space.extraSmall2),
695
699
  shift({ padding: space.extraSmall }),
696
700
  size({
697
- apply({ elements, availableHeight }) {
701
+ apply({ elements, rects, availableHeight }) {
702
+ elements.floating.style.setProperty(
703
+ "--list-width",
704
+ `${rects.reference.width}px`
705
+ );
698
706
  elements.floating.style.setProperty(
699
707
  "--list-max-height",
700
708
  `${clamp(10 * 16, availableHeight, 20 * 16)}px`
@@ -1072,11 +1080,18 @@ const MultiSelect = React.forwardRef(
1072
1080
  const { refs, floatingStyles, update } = useFloating({
1073
1081
  open: isOpen,
1074
1082
  placement: "bottom-start",
1083
+ // Fixed takes the menu out of the field's scroll container, so shift()'s
1084
+ // padding cannot become horizontal overflow there
1085
+ strategy: "fixed",
1075
1086
  middleware: [
1076
1087
  offset(space.extraSmall2),
1077
1088
  shift({ padding: space.extraSmall }),
1078
1089
  size({
1079
- apply({ elements, availableHeight }) {
1090
+ apply({ elements, rects, availableHeight }) {
1091
+ elements.floating.style.setProperty(
1092
+ "--list-width",
1093
+ `${rects.reference.width}px`
1094
+ );
1080
1095
  elements.floating.style.setProperty(
1081
1096
  "--list-max-height",
1082
1097
  `${clamp(10 * 16, availableHeight, 20 * 16)}px`
@@ -1323,11 +1338,18 @@ const Dropdown = React.forwardRef(
1323
1338
  const { refs, floatingStyles, update } = useFloating({
1324
1339
  open: isOpen,
1325
1340
  placement: "bottom-start",
1341
+ // Fixed takes the menu out of the field's scroll container, so shift()'s
1342
+ // padding cannot become horizontal overflow there
1343
+ strategy: "fixed",
1326
1344
  middleware: [
1327
1345
  offset(space.extraSmall2),
1328
1346
  shift({ padding: space.extraSmall }),
1329
1347
  size({
1330
- apply({ elements, availableHeight }) {
1348
+ apply({ elements, rects, availableHeight }) {
1349
+ elements.floating.style.setProperty(
1350
+ "--list-width",
1351
+ `${rects.reference.width}px`
1352
+ );
1331
1353
  elements.floating.style.setProperty(
1332
1354
  "--list-max-height",
1333
1355
  `${clamp(10 * 16, availableHeight, 20 * 16)}px`