@acusti/dropdown 1.0.0-rc.4 → 1.0.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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { c } from "react/compiler-runtime";
2
2
  import useKeyboardEvents, { NON_TEXT_INPUT_TYPES, isEventTargetUsingKeyEvent } from "@acusti/use-keyboard-events";
3
3
  import clsx from "clsx";
4
- import { Children, Fragment, cloneElement, createContext, isValidElement, useContext, useEffect, useId, useLayoutEffect, useReducer, useRef, useState } from "react";
4
+ import { Children, Fragment, cloneElement, createContext, isValidElement, useContext, useEffect, useEffectEvent, useId, useLayoutEffect, useReducer, useRef, useState } from "react";
5
5
  import { getBestMatch } from "@acusti/matchmaking";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/context.ts
@@ -569,7 +569,7 @@ function Dropdown(props) {
569
569
  return t0;
570
570
  }
571
571
  function RootDropdown(t0) {
572
- const $ = c(190);
572
+ const $ = c(193);
573
573
  const { allowCreate, allowEmpty: t1, children, className, disabled, hasItems: t2, isOpenOnMount, isSearchable, itemAs: itemElementName, keepOpenOnSubmit: t3, label, name, onActiveItem, onClick, onClose, onMouseDown, onMouseUp, onOpen, onSubmitItem, openOnHover, placeholder, style: styleFromProps, tabIndex, value } = t0;
574
574
  const allowEmpty = t1 === void 0 ? true : t1;
575
575
  const hasItems = t2 === void 0 ? true : t2;
@@ -592,7 +592,6 @@ function RootDropdown(t0) {
592
592
  } else t4 = $[4];
593
593
  const valueLabel = t4;
594
594
  const [isOpen, setIsOpen] = useState(isOpenOnMount ?? false);
595
- const [isOpening, setIsOpening] = useState(!isOpenOnMount);
596
595
  const [dropdownElement, setDropdownElement] = useState(null);
597
596
  const bodyId = useId();
598
597
  const triggerId = `${bodyId}-trigger`;
@@ -611,6 +610,7 @@ function RootDropdown(t0) {
611
610
  } else t5 = $[5];
612
611
  const annotatedElementsRef = useRef(t5);
613
612
  const closingTimerRef = useRef(null);
613
+ const isOpeningRef = useRef(false);
614
614
  const isOpeningTimerRef = useRef(null);
615
615
  const currentInputMethodRef = useRef("mouse");
616
616
  const clearEnteredCharactersTimerRef = useRef(null);
@@ -631,71 +631,65 @@ function RootDropdown(t0) {
631
631
  const wasInSafeAreaRef = useRef(false);
632
632
  const hoverCloseTimerRef = useRef(null);
633
633
  const isOpenRef = useRef(isOpen);
634
- const isOpeningRef = useRef(isOpening);
635
- const onCloseRef = useRef(onClose);
636
- const onOpenRef = useRef(onOpen);
637
634
  let t7;
638
635
  let t8;
639
- if ($[7] !== isOpen || $[8] !== isOpening || $[9] !== onClose || $[10] !== onOpen) {
636
+ if ($[7] !== isOpen) {
640
637
  t7 = () => {
641
638
  isOpenRef.current = isOpen;
642
- isOpeningRef.current = isOpening;
643
- onCloseRef.current = onClose;
644
- onOpenRef.current = onOpen;
645
639
  };
646
- t8 = [
647
- isOpen,
648
- isOpening,
649
- onClose,
650
- onOpen
651
- ];
640
+ t8 = [isOpen];
652
641
  $[7] = isOpen;
653
- $[8] = isOpening;
654
- $[9] = onClose;
655
- $[10] = onOpen;
656
- $[11] = t7;
657
- $[12] = t8;
642
+ $[8] = t7;
643
+ $[9] = t8;
658
644
  } else {
659
- t7 = $[11];
660
- t8 = $[12];
645
+ t7 = $[8];
646
+ t8 = $[9];
661
647
  }
662
- useEffect(t7, t8);
648
+ useLayoutEffect(t7, t8);
663
649
  let t9;
664
- if ($[13] !== dropdownElement || $[14] !== isOpen) {
650
+ if ($[10] !== dropdownElement || $[11] !== isOpen) {
665
651
  t9 = () => {
666
652
  if (isOpen) syncActiveDescendant(dropdownElement);
667
653
  };
668
- $[13] = dropdownElement;
669
- $[14] = isOpen;
670
- $[15] = t9;
671
- } else t9 = $[15];
654
+ $[10] = dropdownElement;
655
+ $[11] = isOpen;
656
+ $[12] = t9;
657
+ } else t9 = $[12];
672
658
  useLayoutEffect(t9);
673
659
  useWarnOnce(itemElementName === void 0 ? null : "itemAs only applies to a submenu Dropdown (one nested in a dropdown where hasItems is true) and is ignored anywhere else.");
674
- const isMountedRef = useRef(false);
675
660
  let t10;
661
+ if ($[13] !== onClose || $[14] !== onOpen) {
662
+ t10 = (nextIsOpen) => {
663
+ if (nextIsOpen) onOpen?.();
664
+ else onClose?.();
665
+ };
666
+ $[13] = onClose;
667
+ $[14] = onOpen;
668
+ $[15] = t10;
669
+ } else t10 = $[15];
670
+ const handleOpenChange = useEffectEvent(t10);
671
+ const reportedIsOpenRef = useRef(false);
676
672
  let t11;
677
- if ($[16] !== isOpen) {
678
- t10 = () => {
679
- if (!isMountedRef.current) {
680
- isMountedRef.current = true;
681
- if (isOpenRef.current && onOpenRef.current) onOpenRef.current();
682
- return;
683
- }
684
- if (isOpen && onOpenRef.current) onOpenRef.current();
685
- else if (!isOpen && onCloseRef.current) onCloseRef.current();
673
+ if ($[16] !== handleOpenChange || $[17] !== isOpen) {
674
+ t11 = () => {
675
+ if (reportedIsOpenRef.current === isOpen) return;
676
+ reportedIsOpenRef.current = isOpen;
677
+ handleOpenChange(isOpen);
686
678
  };
687
- t11 = [isOpen];
688
- $[16] = isOpen;
689
- $[17] = t10;
679
+ $[16] = handleOpenChange;
680
+ $[17] = isOpen;
690
681
  $[18] = t11;
691
- } else {
692
- t10 = $[17];
693
- t11 = $[18];
694
- }
695
- useEffect(t10, t11);
682
+ } else t11 = $[18];
696
683
  let t12;
697
- if ($[19] !== popupRole) {
698
- t12 = { registerSubmenu(registration) {
684
+ if ($[19] !== isOpen) {
685
+ t12 = [isOpen];
686
+ $[19] = isOpen;
687
+ $[20] = t12;
688
+ } else t12 = $[20];
689
+ useEffect(t11, t12);
690
+ let t13;
691
+ if ($[21] !== popupRole) {
692
+ t13 = { registerSubmenu(registration) {
699
693
  submenuRegistrationsRef.current.add(registration);
700
694
  const { element } = registration;
701
695
  if (!annotatedElementsRef.current.has(element)) {
@@ -707,32 +701,32 @@ function RootDropdown(t0) {
707
701
  submenuRegistrationsRef.current.delete(registration);
708
702
  };
709
703
  } };
710
- $[19] = popupRole;
711
- $[20] = t12;
712
- } else t12 = $[20];
713
- const dropdownContextValue = t12;
714
- let t13;
715
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
716
- t13 = (key, payload) => {
704
+ $[21] = popupRole;
705
+ $[22] = t13;
706
+ } else t13 = $[22];
707
+ const dropdownContextValue = t13;
708
+ let t14;
709
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
710
+ t14 = (key, payload) => {
717
711
  if (!payload.element) return;
718
712
  for (const registration_0 of submenuRegistrationsRef.current) if (registration_0.element.contains(payload.element)) registration_0[key]?.(payload);
719
713
  };
720
- $[21] = t13;
721
- } else t13 = $[21];
722
- const dispatchToSubmenus = t13;
723
- let t14;
724
- if ($[22] !== onActiveItem) {
725
- t14 = (payload_0) => {
726
- onActiveItem?.(payload_0);
727
- dispatchToSubmenus("onActiveItem", payload_0);
728
- };
729
- $[22] = onActiveItem;
730
714
  $[23] = t14;
731
715
  } else t14 = $[23];
732
- const handleActiveItem = t14;
716
+ const dispatchToSubmenus = t14;
733
717
  let t15;
734
- if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
735
- t15 = (item, isExpanded) => {
718
+ if ($[24] !== onActiveItem) {
719
+ t15 = (payload_0) => {
720
+ onActiveItem?.(payload_0);
721
+ dispatchToSubmenus("onActiveItem", payload_0);
722
+ };
723
+ $[24] = onActiveItem;
724
+ $[25] = t15;
725
+ } else t15 = $[25];
726
+ const handleActiveItem = t15;
727
+ let t16;
728
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
729
+ t16 = (item, isExpanded) => {
736
730
  const submenu = getSubmenuOfItem(item);
737
731
  if (submenu) {
738
732
  const isShown = submenu.matches(":popover-open");
@@ -741,36 +735,36 @@ function RootDropdown(t0) {
741
735
  }
742
736
  for (const registration_1 of submenuRegistrationsRef.current) if (registration_1.element === item) (isExpanded ? registration_1.onOpen : registration_1.onClose)?.();
743
737
  };
744
- $[24] = t15;
745
- } else t15 = $[24];
746
- const handleToggleSubmenu = t15;
747
- let t16;
748
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
749
- t16 = () => {
738
+ $[26] = t16;
739
+ } else t16 = $[26];
740
+ const handleToggleSubmenu = t16;
741
+ let t17;
742
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
743
+ t17 = () => {
750
744
  if (disclosureTimerRef.current != null) {
751
745
  clearTimeout(disclosureTimerRef.current);
752
746
  disclosureTimerRef.current = null;
753
747
  }
754
748
  pendingDisclosureItemRef.current = null;
755
749
  };
756
- $[25] = t16;
757
- } else t16 = $[25];
758
- const clearDisclosureTimer = t16;
759
- let t17;
750
+ $[27] = t17;
751
+ } else t17 = $[27];
752
+ const clearDisclosureTimer = t17;
760
753
  let t18;
761
- if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
762
- t17 = () => clearDisclosureTimer;
763
- t18 = [];
764
- $[26] = t17;
765
- $[27] = t18;
754
+ let t19;
755
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
756
+ t18 = () => clearDisclosureTimer;
757
+ t19 = [];
758
+ $[28] = t18;
759
+ $[29] = t19;
766
760
  } else {
767
- t17 = $[26];
768
- t18 = $[27];
761
+ t18 = $[28];
762
+ t19 = $[29];
769
763
  }
770
- useEffect(t17, t18);
771
- let t19;
772
- if ($[28] !== dropdownElement) {
773
- t19 = () => {
764
+ useEffect(t18, t19);
765
+ let t20;
766
+ if ($[30] !== dropdownElement) {
767
+ t20 = () => {
774
768
  if (!dropdownElement) return;
775
769
  const activeElement = getActiveItemElement(dropdownElement);
776
770
  collapseItemsOutsidePath(dropdownElement, activeElement, handleToggleSubmenu);
@@ -789,36 +783,36 @@ function RootDropdown(t0) {
789
783
  }
790
784
  clearDisclosureTimer();
791
785
  };
792
- $[28] = dropdownElement;
793
- $[29] = t19;
794
- } else t19 = $[29];
795
- const syncSubmenuDisclosure = t19;
796
- let t20;
797
- if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
798
- t20 = () => {
786
+ $[30] = dropdownElement;
787
+ $[31] = t20;
788
+ } else t20 = $[31];
789
+ const syncSubmenuDisclosure = t20;
790
+ let t21;
791
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
792
+ t21 = () => {
799
793
  if (safeAreaTimerRef.current != null) {
800
794
  clearTimeout(safeAreaTimerRef.current);
801
795
  safeAreaTimerRef.current = null;
802
796
  }
803
797
  };
804
- $[30] = t20;
805
- } else t20 = $[30];
806
- const clearSafeAreaTimer = t20;
807
- let t21;
798
+ $[32] = t21;
799
+ } else t21 = $[32];
800
+ const clearSafeAreaTimer = t21;
808
801
  let t22;
809
- if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
810
- t21 = () => clearSafeAreaTimer;
811
- t22 = [];
812
- $[31] = t21;
813
- $[32] = t22;
814
- } else {
815
- t21 = $[31];
816
- t22 = $[32];
817
- }
818
- useEffect(t21, t22);
819
802
  let t23;
820
803
  if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
821
- t23 = (x, y) => {
804
+ t22 = () => clearSafeAreaTimer;
805
+ t23 = [];
806
+ $[33] = t22;
807
+ $[34] = t23;
808
+ } else {
809
+ t22 = $[33];
810
+ t23 = $[34];
811
+ }
812
+ useEffect(t22, t23);
813
+ let t24;
814
+ if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
815
+ t24 = (x, y) => {
822
816
  const safeArea = safeAreaRef.current;
823
817
  if (!safeArea || !isItemExpanded(safeArea.parent)) return false;
824
818
  const submenu_1 = getSubmenuOfItem(safeArea.parent);
@@ -837,12 +831,12 @@ function RootDropdown(t0) {
837
831
  y: submenuRect.bottom
838
832
  });
839
833
  };
840
- $[33] = t23;
841
- } else t23 = $[33];
842
- const isPointerInSafeArea = t23;
843
- let t24;
844
- if ($[34] !== dropdownElement || $[35] !== handleActiveItem || $[36] !== syncSubmenuDisclosure) {
845
- t24 = (targetElement) => {
834
+ $[35] = t24;
835
+ } else t24 = $[35];
836
+ const isPointerInSafeArea = t24;
837
+ let t25;
838
+ if ($[36] !== dropdownElement || $[37] !== handleActiveItem || $[38] !== syncSubmenuDisclosure) {
839
+ t25 = (targetElement) => {
846
840
  clearSafeAreaTimer();
847
841
  safeAreaRef.current = null;
848
842
  wasInSafeAreaRef.current = false;
@@ -859,15 +853,15 @@ function RootDropdown(t0) {
859
853
  });
860
854
  syncSubmenuDisclosure();
861
855
  };
862
- $[34] = dropdownElement;
863
- $[35] = handleActiveItem;
864
- $[36] = syncSubmenuDisclosure;
865
- $[37] = t24;
866
- } else t24 = $[37];
867
- const commitPointerTarget = t24;
868
- let t25;
869
- if ($[38] !== commitPointerTarget || $[39] !== dropdownElement || $[40] !== hasItems) {
870
- t25 = (event_0) => {
856
+ $[36] = dropdownElement;
857
+ $[37] = handleActiveItem;
858
+ $[38] = syncSubmenuDisclosure;
859
+ $[39] = t25;
860
+ } else t25 = $[39];
861
+ const commitPointerTarget = t25;
862
+ let t26;
863
+ if ($[40] !== commitPointerTarget || $[41] !== dropdownElement || $[42] !== hasItems) {
864
+ t26 = (event_0) => {
871
865
  if (!dropdownElement || !isOpenRef.current || !hasItems) return;
872
866
  const pointer_0 = {
873
867
  x: event_0.clientX,
@@ -900,41 +894,53 @@ function RootDropdown(t0) {
900
894
  safeAreaTimerRef.current = setTimeout(commitPointerTarget, SAFE_AREA_TIMEOUT);
901
895
  } else if (wasInSafeAreaRef.current) commitPointerTarget(target_0);
902
896
  };
903
- $[38] = commitPointerTarget;
904
- $[39] = dropdownElement;
905
- $[40] = hasItems;
906
- $[41] = t25;
907
- } else t25 = $[41];
908
- const trackSafeArea = t25;
909
- let t26;
910
- if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
911
- t26 = () => {
897
+ $[40] = commitPointerTarget;
898
+ $[41] = dropdownElement;
899
+ $[42] = hasItems;
900
+ $[43] = t26;
901
+ } else t26 = $[43];
902
+ const trackSafeArea = t26;
903
+ let t27;
904
+ if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
905
+ t27 = () => {
912
906
  if (hoverCloseTimerRef.current != null) {
913
907
  clearTimeout(hoverCloseTimerRef.current);
914
908
  hoverCloseTimerRef.current = null;
915
909
  }
916
910
  };
917
- $[42] = t26;
918
- } else t26 = $[42];
919
- const clearHoverCloseTimer = t26;
920
- let t27;
911
+ $[44] = t27;
912
+ } else t27 = $[44];
913
+ const clearHoverCloseTimer = t27;
921
914
  let t28;
922
- if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
923
- t27 = () => clearHoverCloseTimer;
924
- t28 = [];
925
- $[43] = t27;
926
- $[44] = t28;
915
+ let t29;
916
+ if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
917
+ t28 = () => clearHoverCloseTimer;
918
+ t29 = [];
919
+ $[45] = t28;
920
+ $[46] = t29;
927
921
  } else {
928
- t27 = $[43];
929
- t28 = $[44];
922
+ t28 = $[45];
923
+ t29 = $[46];
930
924
  }
931
- useEffect(t27, t28);
932
- let t29;
933
- if ($[45] !== dropdownElement || $[46] !== menubar) {
934
- t29 = (options) => {
925
+ useEffect(t28, t29);
926
+ let t30;
927
+ if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
928
+ t30 = () => {
929
+ isOpeningRef.current = false;
930
+ if (isOpeningTimerRef.current != null) {
931
+ clearTimeout(isOpeningTimerRef.current);
932
+ isOpeningTimerRef.current = null;
933
+ }
934
+ };
935
+ $[47] = t30;
936
+ } else t30 = $[47];
937
+ const endOpeningPress = t30;
938
+ let t31;
939
+ if ($[48] !== dropdownElement || $[49] !== menubar) {
940
+ t31 = (options) => {
935
941
  getTriggerElement(dropdownElement)?.removeAttribute("aria-activedescendant");
936
942
  setIsOpen(false);
937
- setIsOpening(false);
943
+ endOpeningPress();
938
944
  mouseDownPositionRef.current = null;
939
945
  clearDisclosureTimer();
940
946
  clearSafeAreaTimer();
@@ -947,50 +953,50 @@ function RootDropdown(t0) {
947
953
  }
948
954
  if (menubar && dropdownElement && !options?.keepMenubarEngaged) menubar.notifyClosed(dropdownElement);
949
955
  };
950
- $[45] = dropdownElement;
951
- $[46] = menubar;
952
- $[47] = t29;
953
- } else t29 = $[47];
954
- const closeDropdown = t29;
955
- let t30;
956
- if ($[48] !== disabled || $[49] !== openOnHover) {
957
- t30 = () => {
956
+ $[48] = dropdownElement;
957
+ $[49] = menubar;
958
+ $[50] = t31;
959
+ } else t31 = $[50];
960
+ const closeDropdown = t31;
961
+ let t32;
962
+ if ($[51] !== disabled || $[52] !== openOnHover) {
963
+ t32 = () => {
958
964
  clearHoverCloseTimer();
959
965
  if (disabled || !openOnHover || isOpenRef.current) return;
960
966
  setIsOpen(true);
961
- setIsOpening(false);
967
+ endOpeningPress();
962
968
  };
963
- $[48] = disabled;
964
- $[49] = openOnHover;
965
- $[50] = t30;
966
- } else t30 = $[50];
967
- const handleDropdownMouseEnter = t30;
968
- let t31;
969
- if ($[51] !== closeDropdown || $[52] !== openOnHover) {
970
- t31 = () => {
969
+ $[51] = disabled;
970
+ $[52] = openOnHover;
971
+ $[53] = t32;
972
+ } else t32 = $[53];
973
+ const handleDropdownMouseEnter = t32;
974
+ let t33;
975
+ if ($[54] !== closeDropdown || $[55] !== openOnHover) {
976
+ t33 = () => {
971
977
  if (!openOnHover || !isOpenRef.current || hoverCloseTimerRef.current != null) return;
972
978
  hoverCloseTimerRef.current = setTimeout(() => {
973
979
  hoverCloseTimerRef.current = null;
974
980
  closeDropdown();
975
981
  }, HOVER_CLOSE_DELAY);
976
982
  };
977
- $[51] = closeDropdown;
978
- $[52] = openOnHover;
979
- $[53] = t31;
980
- } else t31 = $[53];
981
- const handleDropdownMouseLeave = t31;
982
- let t32;
983
- if ($[54] !== dropdownElement) {
984
- t32 = () => {
983
+ $[54] = closeDropdown;
984
+ $[55] = openOnHover;
985
+ $[56] = t33;
986
+ } else t33 = $[56];
987
+ const handleDropdownMouseLeave = t33;
988
+ let t34;
989
+ if ($[57] !== dropdownElement) {
990
+ t34 = () => {
985
991
  getTriggerElement(dropdownElement)?.focus();
986
992
  };
987
- $[54] = dropdownElement;
988
- $[55] = t32;
989
- } else t32 = $[55];
990
- const focusTrigger = t32;
991
- let t33;
992
- if ($[56] !== closeDropdown || $[57] !== disabled || $[58] !== dropdownElement || $[59] !== focusTrigger || $[60] !== isMenubarItem || $[61] !== menubar) {
993
- t33 = () => {
993
+ $[57] = dropdownElement;
994
+ $[58] = t34;
995
+ } else t34 = $[58];
996
+ const focusTrigger = t34;
997
+ let t35;
998
+ if ($[59] !== closeDropdown || $[60] !== disabled || $[61] !== dropdownElement || $[62] !== focusTrigger || $[63] !== isMenubarItem || $[64] !== menubar) {
999
+ t35 = () => {
994
1000
  if (!menubar || !dropdownElement) return;
995
1001
  return menubar.registerMember({
996
1002
  close: () => closeDropdown({ keepMenubarEngaged: true }),
@@ -1005,39 +1011,39 @@ function RootDropdown(t0) {
1005
1011
  }
1006
1012
  });
1007
1013
  };
1008
- $[56] = closeDropdown;
1009
- $[57] = disabled;
1010
- $[58] = dropdownElement;
1011
- $[59] = focusTrigger;
1012
- $[60] = isMenubarItem;
1013
- $[61] = menubar;
1014
- $[62] = t33;
1015
- } else t33 = $[62];
1016
- useEffect(t33);
1017
- let t34;
1018
- let t35;
1019
- if ($[63] !== dropdownElement || $[64] !== isOpen || $[65] !== menubar) {
1020
- t34 = () => {
1014
+ $[59] = closeDropdown;
1015
+ $[60] = disabled;
1016
+ $[61] = dropdownElement;
1017
+ $[62] = focusTrigger;
1018
+ $[63] = isMenubarItem;
1019
+ $[64] = menubar;
1020
+ $[65] = t35;
1021
+ } else t35 = $[65];
1022
+ useEffect(t35);
1023
+ let t36;
1024
+ let t37;
1025
+ if ($[66] !== dropdownElement || $[67] !== isOpen || $[68] !== menubar) {
1026
+ t36 = () => {
1021
1027
  if (isOpen && menubar && dropdownElement) menubar.notifyOpened(dropdownElement);
1022
1028
  };
1023
- t35 = [
1029
+ t37 = [
1024
1030
  dropdownElement,
1025
1031
  isOpen,
1026
1032
  menubar
1027
1033
  ];
1028
- $[63] = dropdownElement;
1029
- $[64] = isOpen;
1030
- $[65] = menubar;
1031
- $[66] = t34;
1032
- $[67] = t35;
1034
+ $[66] = dropdownElement;
1035
+ $[67] = isOpen;
1036
+ $[68] = menubar;
1037
+ $[69] = t36;
1038
+ $[70] = t37;
1033
1039
  } else {
1034
- t34 = $[66];
1035
- t35 = $[67];
1040
+ t36 = $[69];
1041
+ t37 = $[70];
1036
1042
  }
1037
- useEffect(t34, t35);
1038
- let t36;
1039
- if ($[68] !== allowCreate || $[69] !== allowEmpty || $[70] !== closeDropdown || $[71] !== dropdownElement || $[72] !== handleActiveItem || $[73] !== hasItems || $[74] !== keepOpenOnSubmit || $[75] !== onSubmitItem || $[76] !== popupRole || $[77] !== valueIdentity) {
1040
- t36 = (event_1) => {
1043
+ useEffect(t36, t37);
1044
+ let t38;
1045
+ if ($[71] !== allowCreate || $[72] !== allowEmpty || $[73] !== closeDropdown || $[74] !== dropdownElement || $[75] !== handleActiveItem || $[76] !== hasItems || $[77] !== keepOpenOnSubmit || $[78] !== onSubmitItem || $[79] !== popupRole || $[80] !== valueIdentity) {
1046
+ t38 = (event_1) => {
1041
1047
  const element_0 = hasItems ? getActiveItemElement(dropdownElement) : null;
1042
1048
  const submenuOfActive = element_0 ? getSubmenuOfItem(element_0) : null;
1043
1049
  if (element_0 && submenuOfActive) {
@@ -1097,37 +1103,37 @@ function RootDropdown(t0) {
1097
1103
  onSubmitItem?.(payload_1);
1098
1104
  dispatchToSubmenus("onSubmitItem", payload_1);
1099
1105
  };
1100
- $[68] = allowCreate;
1101
- $[69] = allowEmpty;
1102
- $[70] = closeDropdown;
1103
- $[71] = dropdownElement;
1104
- $[72] = handleActiveItem;
1105
- $[73] = hasItems;
1106
- $[74] = keepOpenOnSubmit;
1107
- $[75] = onSubmitItem;
1108
- $[76] = popupRole;
1109
- $[77] = valueIdentity;
1110
- $[78] = t36;
1111
- } else t36 = $[78];
1112
- const handleSubmitItem = t36;
1113
- let t37;
1114
- if ($[79] !== trackSafeArea) {
1115
- t37 = (event_2) => {
1106
+ $[71] = allowCreate;
1107
+ $[72] = allowEmpty;
1108
+ $[73] = closeDropdown;
1109
+ $[74] = dropdownElement;
1110
+ $[75] = handleActiveItem;
1111
+ $[76] = hasItems;
1112
+ $[77] = keepOpenOnSubmit;
1113
+ $[78] = onSubmitItem;
1114
+ $[79] = popupRole;
1115
+ $[80] = valueIdentity;
1116
+ $[81] = t38;
1117
+ } else t38 = $[81];
1118
+ const handleSubmitItem = t38;
1119
+ let t39;
1120
+ if ($[82] !== trackSafeArea) {
1121
+ t39 = (event_2) => {
1116
1122
  const { clientX, clientY } = event_2;
1117
1123
  currentInputMethodRef.current = "mouse";
1118
1124
  trackSafeArea(event_2);
1119
1125
  const initialPosition = mouseDownPositionRef.current;
1120
1126
  if (!initialPosition) return;
1121
1127
  if (Math.abs(initialPosition.clientX - clientX) < 12 && Math.abs(initialPosition.clientY - clientY) < 12) return;
1122
- setIsOpening(false);
1128
+ endOpeningPress();
1123
1129
  };
1124
- $[79] = trackSafeArea;
1125
- $[80] = t37;
1126
- } else t37 = $[80];
1127
- const handleMouseMove = t37;
1128
- let t38;
1129
- if ($[81] !== dropdownElement || $[82] !== handleActiveItem || $[83] !== hasItems || $[84] !== syncSubmenuDisclosure) {
1130
- t38 = (event_3) => {
1130
+ $[82] = trackSafeArea;
1131
+ $[83] = t39;
1132
+ } else t39 = $[83];
1133
+ const handleMouseMove = t39;
1134
+ let t40;
1135
+ if ($[84] !== dropdownElement || $[85] !== handleActiveItem || $[86] !== hasItems || $[87] !== syncSubmenuDisclosure) {
1136
+ t40 = (event_3) => {
1131
1137
  if (!hasItems) return;
1132
1138
  if (currentInputMethodRef.current !== "mouse") return;
1133
1139
  if (!dropdownElement) return;
@@ -1146,16 +1152,16 @@ function RootDropdown(t0) {
1146
1152
  });
1147
1153
  syncSubmenuDisclosure();
1148
1154
  };
1149
- $[81] = dropdownElement;
1150
- $[82] = handleActiveItem;
1151
- $[83] = hasItems;
1152
- $[84] = syncSubmenuDisclosure;
1153
- $[85] = t38;
1154
- } else t38 = $[85];
1155
- const handleMouseOver = t38;
1156
- let t39;
1157
- if ($[86] !== dropdownElement || $[87] !== hasItems || $[88] !== syncSubmenuDisclosure) {
1158
- t39 = (event_4) => {
1155
+ $[84] = dropdownElement;
1156
+ $[85] = handleActiveItem;
1157
+ $[86] = hasItems;
1158
+ $[87] = syncSubmenuDisclosure;
1159
+ $[88] = t40;
1160
+ } else t40 = $[88];
1161
+ const handleMouseOver = t40;
1162
+ let t41;
1163
+ if ($[89] !== dropdownElement || $[90] !== hasItems || $[91] !== syncSubmenuDisclosure) {
1164
+ t41 = (event_4) => {
1159
1165
  if (!hasItems) return;
1160
1166
  const relatedTarget = event_4.relatedTarget;
1161
1167
  if (!dropdownElement?.contains(relatedTarget)) {
@@ -1171,36 +1177,36 @@ function RootDropdown(t0) {
1171
1177
  clearActiveItems(dropdownElement, activeItem);
1172
1178
  syncSubmenuDisclosure();
1173
1179
  };
1174
- $[86] = dropdownElement;
1175
- $[87] = hasItems;
1176
- $[88] = syncSubmenuDisclosure;
1177
- $[89] = t39;
1178
- } else t39 = $[89];
1179
- const handleMouseOut = t39;
1180
- let t40;
1181
- if ($[90] !== disabled || $[91] !== onMouseDown) {
1182
- t40 = (event_5) => {
1180
+ $[89] = dropdownElement;
1181
+ $[90] = hasItems;
1182
+ $[91] = syncSubmenuDisclosure;
1183
+ $[92] = t41;
1184
+ } else t41 = $[92];
1185
+ const handleMouseOut = t41;
1186
+ let t42;
1187
+ if ($[93] !== disabled || $[94] !== onMouseDown) {
1188
+ t42 = (event_5) => {
1183
1189
  if (onMouseDown) onMouseDown(event_5);
1184
1190
  if (disabled || isOpenRef.current) return;
1185
1191
  setIsOpen(true);
1186
- setIsOpening(true);
1192
+ isOpeningRef.current = true;
1187
1193
  mouseDownPositionRef.current = {
1188
1194
  clientX: event_5.clientX,
1189
1195
  clientY: event_5.clientY
1190
1196
  };
1191
1197
  isOpeningTimerRef.current = setTimeout(() => {
1192
- setIsOpening(false);
1198
+ isOpeningRef.current = false;
1193
1199
  isOpeningTimerRef.current = null;
1194
1200
  }, 1e3);
1195
1201
  };
1196
- $[90] = disabled;
1197
- $[91] = onMouseDown;
1198
- $[92] = t40;
1199
- } else t40 = $[92];
1200
- const handleMouseDown = t40;
1201
- let t41;
1202
- if ($[93] !== closeDropdown || $[94] !== dropdownElement || $[95] !== handleActiveItem || $[96] !== handleSubmitItem || $[97] !== hasItems || $[98] !== onMouseUp) {
1203
- t41 = (event_6) => {
1202
+ $[93] = disabled;
1203
+ $[94] = onMouseDown;
1204
+ $[95] = t42;
1205
+ } else t42 = $[95];
1206
+ const handleMouseDown = t42;
1207
+ let t43;
1208
+ if ($[96] !== closeDropdown || $[97] !== dropdownElement || $[98] !== handleActiveItem || $[99] !== handleSubmitItem || $[100] !== hasItems || $[101] !== onMouseUp) {
1209
+ t43 = (event_6) => {
1204
1210
  if (onMouseUp) onMouseUp(event_6);
1205
1211
  if (isOpeningRef.current || !isOpenRef.current || closingTimerRef.current != null) return;
1206
1212
  const eventTarget_1 = event_6.target;
@@ -1208,7 +1214,7 @@ function RootDropdown(t0) {
1208
1214
  if (clickedRoot !== dropdownElement && clickedRoot?.classList.contains("is-open") && dropdownElement?.contains(clickedRoot)) return;
1209
1215
  const targetBody = eventTarget_1.closest(BODY_SELECTOR);
1210
1216
  if (!Boolean(targetBody && targetBody.closest(".uktdropdown") === dropdownElement)) {
1211
- if (!isOpeningRef.current && inputElementRef.current !== eventTarget_1.ownerDocument.activeElement) closeDropdown();
1217
+ if (inputElementRef.current !== eventTarget_1.ownerDocument.activeElement) closeDropdown();
1212
1218
  return;
1213
1219
  }
1214
1220
  if (!hasItems) return;
@@ -1224,18 +1230,18 @@ function RootDropdown(t0) {
1224
1230
  }
1225
1231
  handleSubmitItem(event_6);
1226
1232
  };
1227
- $[93] = closeDropdown;
1228
- $[94] = dropdownElement;
1229
- $[95] = handleActiveItem;
1230
- $[96] = handleSubmitItem;
1231
- $[97] = hasItems;
1232
- $[98] = onMouseUp;
1233
- $[99] = t41;
1234
- } else t41 = $[99];
1235
- const handleMouseUp = t41;
1236
- let t42;
1237
- if ($[100] !== allowCreate || $[101] !== closeDropdown || $[102] !== disabled || $[103] !== dropdownElement || $[104] !== focusTrigger || $[105] !== handleActiveItem || $[106] !== handleSubmitItem || $[107] !== hasItems || $[108] !== menubar || $[109] !== syncSubmenuDisclosure) {
1238
- t42 = (event_7) => {
1233
+ $[96] = closeDropdown;
1234
+ $[97] = dropdownElement;
1235
+ $[98] = handleActiveItem;
1236
+ $[99] = handleSubmitItem;
1237
+ $[100] = hasItems;
1238
+ $[101] = onMouseUp;
1239
+ $[102] = t43;
1240
+ } else t43 = $[102];
1241
+ const handleMouseUp = t43;
1242
+ let t44;
1243
+ if ($[103] !== allowCreate || $[104] !== closeDropdown || $[105] !== disabled || $[106] !== dropdownElement || $[107] !== focusTrigger || $[108] !== handleActiveItem || $[109] !== handleSubmitItem || $[110] !== hasItems || $[111] !== menubar || $[112] !== syncSubmenuDisclosure) {
1244
+ t44 = (event_7) => {
1239
1245
  const { altKey, ctrlKey, key: key_0, metaKey } = event_7;
1240
1246
  const eventTarget_2 = event_7.target;
1241
1247
  if (!dropdownElement) return;
@@ -1380,32 +1386,32 @@ function RootDropdown(t0) {
1380
1386
  }
1381
1387
  }
1382
1388
  };
1383
- $[100] = allowCreate;
1384
- $[101] = closeDropdown;
1385
- $[102] = disabled;
1386
- $[103] = dropdownElement;
1387
- $[104] = focusTrigger;
1388
- $[105] = handleActiveItem;
1389
- $[106] = handleSubmitItem;
1390
- $[107] = hasItems;
1391
- $[108] = menubar;
1392
- $[109] = syncSubmenuDisclosure;
1393
- $[110] = t42;
1394
- } else t42 = $[110];
1395
- const handleKeyDown = t42;
1396
- let t43;
1397
- if ($[111] !== handleKeyDown) {
1398
- t43 = {
1389
+ $[103] = allowCreate;
1390
+ $[104] = closeDropdown;
1391
+ $[105] = disabled;
1392
+ $[106] = dropdownElement;
1393
+ $[107] = focusTrigger;
1394
+ $[108] = handleActiveItem;
1395
+ $[109] = handleSubmitItem;
1396
+ $[110] = hasItems;
1397
+ $[111] = menubar;
1398
+ $[112] = syncSubmenuDisclosure;
1399
+ $[113] = t44;
1400
+ } else t44 = $[113];
1401
+ const handleKeyDown = t44;
1402
+ let t45;
1403
+ if ($[114] !== handleKeyDown) {
1404
+ t45 = {
1399
1405
  ignoreUsedKeyboardEvents: false,
1400
1406
  onKeyDown: handleKeyDown
1401
1407
  };
1402
- $[111] = handleKeyDown;
1403
- $[112] = t43;
1404
- } else t43 = $[112];
1405
- useKeyboardEvents(t43);
1406
- let t44;
1407
- if ($[113] !== allowCreate || $[114] !== closeDropdown || $[115] !== disabled || $[116] !== handleActiveItem) {
1408
- t44 = (ref) => {
1408
+ $[114] = handleKeyDown;
1409
+ $[115] = t45;
1410
+ } else t45 = $[115];
1411
+ useKeyboardEvents(t45);
1412
+ let t46;
1413
+ if ($[116] !== allowCreate || $[117] !== closeDropdown || $[118] !== disabled || $[119] !== handleActiveItem) {
1414
+ t46 = (ref) => {
1409
1415
  setDropdownElement(ref);
1410
1416
  if (!ref) return;
1411
1417
  const { ownerDocument } = ref;
@@ -1415,27 +1421,23 @@ function RootDropdown(t0) {
1415
1421
  else inputElement = ref.firstElementChild.querySelector(TEXT_INPUT_SELECTOR);
1416
1422
  inputElementRef.current = inputElement;
1417
1423
  }
1418
- const handleGlobalMouseDown = (t45) => {
1419
- const { target: target_1 } = t45;
1424
+ const handleGlobalMouseDown = (t47) => {
1425
+ const { target: target_1 } = t47;
1420
1426
  const eventTarget_3 = target_1;
1421
1427
  if (!ref.contains(eventTarget_3)) closeDropdown();
1422
1428
  };
1423
- const handleGlobalMouseUp = (t46) => {
1424
- const { target: target_2 } = t46;
1429
+ const handleGlobalMouseUp = (t48) => {
1430
+ const { target: target_2 } = t48;
1425
1431
  if (!isOpenRef.current || closingTimerRef.current != null) return;
1426
1432
  if (isOpeningRef.current) {
1427
- setIsOpening(false);
1428
- if (isOpeningTimerRef.current != null) {
1429
- clearTimeout(isOpeningTimerRef.current);
1430
- isOpeningTimerRef.current = null;
1431
- }
1433
+ endOpeningPress();
1432
1434
  return;
1433
1435
  }
1434
1436
  const eventTarget_4 = target_2;
1435
1437
  if (!ref.contains(eventTarget_4)) closeDropdown();
1436
1438
  };
1437
- const handleGlobalFocusIn = (t47) => {
1438
- const { target: target_3 } = t47;
1439
+ const handleGlobalFocusIn = (t49) => {
1440
+ const { target: target_3 } = t49;
1439
1441
  if (!isOpenRef.current) return;
1440
1442
  const eventTarget_5 = target_3;
1441
1443
  if (ref.contains(eventTarget_5) || eventTarget_5.contains(ref)) return;
@@ -1477,16 +1479,16 @@ function RootDropdown(t0) {
1477
1479
  if (inputElement) inputElement.removeEventListener("input", handleInput);
1478
1480
  };
1479
1481
  };
1480
- $[113] = allowCreate;
1481
- $[114] = closeDropdown;
1482
- $[115] = disabled;
1483
- $[116] = handleActiveItem;
1484
- $[117] = t44;
1485
- } else t44 = $[117];
1486
- const handleRef = t44;
1487
- let t45;
1488
- if ($[118] !== dropdownElement || $[119] !== popupRole || $[120] !== valueIdentity) {
1489
- t45 = (ref_0) => {
1482
+ $[116] = allowCreate;
1483
+ $[117] = closeDropdown;
1484
+ $[118] = disabled;
1485
+ $[119] = handleActiveItem;
1486
+ $[120] = t46;
1487
+ } else t46 = $[120];
1488
+ const handleRef = t46;
1489
+ let t47;
1490
+ if ($[121] !== dropdownElement || $[122] !== popupRole || $[123] !== valueIdentity) {
1491
+ t47 = (ref_0) => {
1490
1492
  if (!ref_0) return;
1491
1493
  if (annotatedElementsRef.current.has(ref_0)) return;
1492
1494
  annotatedElementsRef.current.add(ref_0);
@@ -1504,82 +1506,82 @@ function RootDropdown(t0) {
1504
1506
  }
1505
1507
  }
1506
1508
  };
1507
- $[118] = dropdownElement;
1508
- $[119] = popupRole;
1509
- $[120] = valueIdentity;
1510
- $[121] = t45;
1511
- } else t45 = $[121];
1512
- const handleBodyRef = t45;
1509
+ $[121] = dropdownElement;
1510
+ $[122] = popupRole;
1511
+ $[123] = valueIdentity;
1512
+ $[124] = t47;
1513
+ } else t47 = $[124];
1514
+ const handleBodyRef = t47;
1513
1515
  let bodyLabelledBy;
1514
1516
  if (!isValidElement(trigger)) {
1515
1517
  if (isSearchable) {
1516
- const t46 = valueLabel ?? "";
1517
- let t47;
1518
- if ($[122] === Symbol.for("react.memo_cache_sentinel")) {
1519
- t47 = () => setIsOpen(true);
1520
- $[122] = t47;
1521
- } else t47 = $[122];
1522
- let t48;
1523
- if ($[123] !== bodyId || $[124] !== disabled || $[125] !== isOpen || $[126] !== name || $[127] !== placeholder || $[128] !== popupRole || $[129] !== t46 || $[130] !== tabIndex || $[131] !== triggerId) {
1524
- t48 = /* @__PURE__ */ jsx("input", {
1518
+ const t48 = valueLabel ?? "";
1519
+ let t49;
1520
+ if ($[125] === Symbol.for("react.memo_cache_sentinel")) {
1521
+ t49 = () => setIsOpen(true);
1522
+ $[125] = t49;
1523
+ } else t49 = $[125];
1524
+ let t50;
1525
+ if ($[126] !== bodyId || $[127] !== disabled || $[128] !== isOpen || $[129] !== name || $[130] !== placeholder || $[131] !== popupRole || $[132] !== t48 || $[133] !== tabIndex || $[134] !== triggerId) {
1526
+ t50 = /* @__PURE__ */ jsx("input", {
1525
1527
  "aria-autocomplete": "list",
1526
1528
  "aria-controls": bodyId,
1527
1529
  "aria-expanded": isOpen,
1528
1530
  "aria-haspopup": popupRole,
1529
1531
  autoComplete: "off",
1530
1532
  className: "uktdropdown-trigger",
1531
- defaultValue: t46,
1533
+ defaultValue: t48,
1532
1534
  disabled,
1533
1535
  id: triggerId,
1534
1536
  name,
1535
- onFocus: t47,
1537
+ onFocus: t49,
1536
1538
  placeholder,
1537
1539
  ref: inputElementRef,
1538
1540
  role: "combobox",
1539
1541
  tabIndex,
1540
1542
  type: "text"
1541
1543
  });
1542
- $[123] = bodyId;
1543
- $[124] = disabled;
1544
- $[125] = isOpen;
1545
- $[126] = name;
1546
- $[127] = placeholder;
1547
- $[128] = popupRole;
1548
- $[129] = t46;
1549
- $[130] = tabIndex;
1550
- $[131] = triggerId;
1544
+ $[126] = bodyId;
1545
+ $[127] = disabled;
1546
+ $[128] = isOpen;
1547
+ $[129] = name;
1548
+ $[130] = placeholder;
1549
+ $[131] = popupRole;
1551
1550
  $[132] = t48;
1552
- } else t48 = $[132];
1553
- trigger = t48;
1551
+ $[133] = tabIndex;
1552
+ $[134] = triggerId;
1553
+ $[135] = t50;
1554
+ } else t50 = $[135];
1555
+ trigger = t50;
1554
1556
  } else {
1555
1557
  bodyLabelledBy = triggerId;
1556
- const t46 = isMenubarItem ? "menuitem" : void 0;
1557
- const t47 = menubarTabIndex ?? 0;
1558
- let t48;
1559
- if ($[133] !== bodyId || $[134] !== disabled || $[135] !== isOpen || $[136] !== popupRole || $[137] !== t46 || $[138] !== t47 || $[139] !== trigger || $[140] !== triggerId) {
1560
- t48 = /* @__PURE__ */ jsx("button", {
1558
+ const t48 = isMenubarItem ? "menuitem" : void 0;
1559
+ const t49 = menubarTabIndex ?? 0;
1560
+ let t50;
1561
+ if ($[136] !== bodyId || $[137] !== disabled || $[138] !== isOpen || $[139] !== popupRole || $[140] !== t48 || $[141] !== t49 || $[142] !== trigger || $[143] !== triggerId) {
1562
+ t50 = /* @__PURE__ */ jsx("button", {
1561
1563
  "aria-controls": bodyId,
1562
1564
  "aria-expanded": isOpen,
1563
1565
  "aria-haspopup": popupRole,
1564
1566
  className: "uktdropdown-trigger",
1565
1567
  disabled,
1566
1568
  id: triggerId,
1567
- role: t46,
1568
- tabIndex: t47,
1569
+ role: t48,
1570
+ tabIndex: t49,
1569
1571
  type: "button",
1570
1572
  children: trigger
1571
1573
  });
1572
- $[133] = bodyId;
1573
- $[134] = disabled;
1574
- $[135] = isOpen;
1575
- $[136] = popupRole;
1576
- $[137] = t46;
1577
- $[138] = t47;
1578
- $[139] = trigger;
1579
- $[140] = triggerId;
1580
- $[141] = t48;
1581
- } else t48 = $[141];
1582
- trigger = t48;
1574
+ $[136] = bodyId;
1575
+ $[137] = disabled;
1576
+ $[138] = isOpen;
1577
+ $[139] = popupRole;
1578
+ $[140] = t48;
1579
+ $[141] = t49;
1580
+ $[142] = trigger;
1581
+ $[143] = triggerId;
1582
+ $[144] = t50;
1583
+ } else t50 = $[144];
1584
+ trigger = t50;
1583
1585
  }
1584
1586
  } else {
1585
1587
  const triggerProps = trigger.props;
@@ -1589,95 +1591,95 @@ function RootDropdown(t0) {
1589
1591
  const isCombobox = isSearchable && isTextInputTrigger && trigger.type !== "textarea";
1590
1592
  const triggerRole = triggerProps.role ?? (isCombobox ? "combobox" : isMenubarItem ? "menuitem" : void 0);
1591
1593
  const canExpand = !isTextInputTrigger || triggerRole != null;
1592
- const t46 = trigger;
1593
- const t47 = triggerProps["aria-autocomplete"] ?? (isCombobox ? "list" : void 0);
1594
- const t48 = triggerProps["aria-controls"] ?? bodyId;
1595
- const t49 = triggerProps["aria-disabled"] ?? (disabled || void 0);
1596
- const t50 = triggerProps["aria-expanded"] ?? (canExpand ? isOpen : void 0);
1597
- const t51 = triggerProps["aria-haspopup"] ?? popupRole;
1598
- const t52 = triggerProps.tabIndex ?? menubarTabIndex;
1599
- let t53;
1600
- if ($[142] !== resolvedTriggerId || $[143] !== t46 || $[144] !== t47 || $[145] !== t48 || $[146] !== t49 || $[147] !== t50 || $[148] !== t51 || $[149] !== t52 || $[150] !== triggerRole) {
1601
- t53 = cloneElement(t46, {
1602
- "aria-autocomplete": t47,
1603
- "aria-controls": t48,
1604
- "aria-disabled": t49,
1605
- "aria-expanded": t50,
1606
- "aria-haspopup": t51,
1594
+ const t48 = trigger;
1595
+ const t49 = triggerProps["aria-autocomplete"] ?? (isCombobox ? "list" : void 0);
1596
+ const t50 = triggerProps["aria-controls"] ?? bodyId;
1597
+ const t51 = triggerProps["aria-disabled"] ?? (disabled || void 0);
1598
+ const t52 = triggerProps["aria-expanded"] ?? (canExpand ? isOpen : void 0);
1599
+ const t53 = triggerProps["aria-haspopup"] ?? popupRole;
1600
+ const t54 = triggerProps.tabIndex ?? menubarTabIndex;
1601
+ let t55;
1602
+ if ($[145] !== resolvedTriggerId || $[146] !== t48 || $[147] !== t49 || $[148] !== t50 || $[149] !== t51 || $[150] !== t52 || $[151] !== t53 || $[152] !== t54 || $[153] !== triggerRole) {
1603
+ t55 = cloneElement(t48, {
1604
+ "aria-autocomplete": t49,
1605
+ "aria-controls": t50,
1606
+ "aria-disabled": t51,
1607
+ "aria-expanded": t52,
1608
+ "aria-haspopup": t53,
1607
1609
  id: resolvedTriggerId,
1608
1610
  role: triggerRole,
1609
- tabIndex: t52
1611
+ tabIndex: t54
1610
1612
  });
1611
- $[142] = resolvedTriggerId;
1612
- $[143] = t46;
1613
- $[144] = t47;
1614
- $[145] = t48;
1615
- $[146] = t49;
1616
- $[147] = t50;
1617
- $[148] = t51;
1618
- $[149] = t52;
1619
- $[150] = triggerRole;
1613
+ $[145] = resolvedTriggerId;
1614
+ $[146] = t48;
1615
+ $[147] = t49;
1616
+ $[148] = t50;
1617
+ $[149] = t51;
1618
+ $[150] = t52;
1620
1619
  $[151] = t53;
1621
- } else t53 = $[151];
1622
- trigger = t53;
1620
+ $[152] = t54;
1621
+ $[153] = triggerRole;
1622
+ $[154] = t55;
1623
+ } else t55 = $[154];
1624
+ trigger = t55;
1623
1625
  }
1624
1626
  if (label != null) {
1625
1627
  bodyLabelledBy = labelId;
1626
- const t46 = isMenubarMember ? "none" : void 0;
1627
- const t47 = isMenubarMember ? "none" : void 0;
1628
- let t48;
1629
- if ($[152] !== label || $[153] !== labelId || $[154] !== t47) {
1630
- t48 = /* @__PURE__ */ jsx("div", {
1628
+ const t48 = isMenubarMember ? "none" : void 0;
1629
+ const t49 = isMenubarMember ? "none" : void 0;
1630
+ let t50;
1631
+ if ($[155] !== label || $[156] !== labelId || $[157] !== t49) {
1632
+ t50 = /* @__PURE__ */ jsx("div", {
1631
1633
  className: "uktdropdown-label-text",
1632
1634
  id: labelId,
1633
- role: t47,
1635
+ role: t49,
1634
1636
  children: label
1635
1637
  });
1636
- $[152] = label;
1637
- $[153] = labelId;
1638
- $[154] = t47;
1639
- $[155] = t48;
1640
- } else t48 = $[155];
1641
- let t49;
1642
- if ($[156] !== t46 || $[157] !== t48 || $[158] !== trigger) {
1643
- t49 = /* @__PURE__ */ jsxs("label", {
1638
+ $[155] = label;
1639
+ $[156] = labelId;
1640
+ $[157] = t49;
1641
+ $[158] = t50;
1642
+ } else t50 = $[158];
1643
+ let t51;
1644
+ if ($[159] !== t48 || $[160] !== t50 || $[161] !== trigger) {
1645
+ t51 = /* @__PURE__ */ jsxs("label", {
1644
1646
  className: "uktdropdown-label",
1645
- role: t46,
1646
- children: [t48, trigger]
1647
+ role: t48,
1648
+ children: [t50, trigger]
1647
1649
  });
1648
- $[156] = t46;
1649
- $[157] = t48;
1650
- $[158] = trigger;
1651
- $[159] = t49;
1652
- } else t49 = $[159];
1653
- trigger = t49;
1650
+ $[159] = t48;
1651
+ $[160] = t50;
1652
+ $[161] = trigger;
1653
+ $[162] = t51;
1654
+ } else t51 = $[162];
1655
+ trigger = t51;
1654
1656
  }
1655
- let t46;
1656
- if ($[160] === Symbol.for("react.memo_cache_sentinel")) {
1657
- t46 = /* @__PURE__ */ jsx("style", {
1657
+ let t48;
1658
+ if ($[163] === Symbol.for("react.memo_cache_sentinel")) {
1659
+ t48 = /* @__PURE__ */ jsx("style", {
1658
1660
  href: "@acusti/dropdown/Dropdown",
1659
1661
  precedence: "medium",
1660
1662
  children: Dropdown_default
1661
1663
  });
1662
- $[160] = t46;
1663
- } else t46 = $[160];
1664
- let t47;
1665
- if ($[161] !== className || $[162] !== disabled || $[163] !== isOpen || $[164] !== isSearchable) {
1666
- t47 = clsx("uktdropdown", className, {
1664
+ $[163] = t48;
1665
+ } else t48 = $[163];
1666
+ let t49;
1667
+ if ($[164] !== className || $[165] !== disabled || $[166] !== isOpen || $[167] !== isSearchable) {
1668
+ t49 = clsx("uktdropdown", className, {
1667
1669
  "is-disabled": disabled,
1668
1670
  "is-open": isOpen,
1669
1671
  "is-searchable": isSearchable
1670
1672
  });
1671
- $[161] = className;
1672
- $[162] = disabled;
1673
- $[163] = isOpen;
1674
- $[164] = isSearchable;
1675
- $[165] = t47;
1676
- } else t47 = $[165];
1677
- const t48 = isMenubarMember ? "none" : void 0;
1678
- let t49;
1679
- if ($[166] !== body || $[167] !== bodyId || $[168] !== bodyLabelledBy || $[169] !== dropdownContextValue || $[170] !== handleBodyRef || $[171] !== hasItems || $[172] !== isOpen || $[173] !== popupRole) {
1680
- t49 = isOpen ? /* @__PURE__ */ jsx("div", {
1673
+ $[164] = className;
1674
+ $[165] = disabled;
1675
+ $[166] = isOpen;
1676
+ $[167] = isSearchable;
1677
+ $[168] = t49;
1678
+ } else t49 = $[168];
1679
+ const t50 = isMenubarMember ? "none" : void 0;
1680
+ let t51;
1681
+ if ($[169] !== body || $[170] !== bodyId || $[171] !== bodyLabelledBy || $[172] !== dropdownContextValue || $[173] !== handleBodyRef || $[174] !== hasItems || $[175] !== isOpen || $[176] !== popupRole) {
1682
+ t51 = isOpen ? /* @__PURE__ */ jsx("div", {
1681
1683
  "aria-labelledby": bodyLabelledBy,
1682
1684
  className: clsx("uktdropdown-body", { "has-items": hasItems }),
1683
1685
  id: bodyId,
@@ -1692,22 +1694,22 @@ function RootDropdown(t0) {
1692
1694
  })
1693
1695
  })
1694
1696
  }) : null;
1695
- $[166] = body;
1696
- $[167] = bodyId;
1697
- $[168] = bodyLabelledBy;
1698
- $[169] = dropdownContextValue;
1699
- $[170] = handleBodyRef;
1700
- $[171] = hasItems;
1701
- $[172] = isOpen;
1702
- $[173] = popupRole;
1703
- $[174] = t49;
1704
- } else t49 = $[174];
1705
- let t50;
1706
- if ($[175] !== handleDropdownMouseEnter || $[176] !== handleDropdownMouseLeave || $[177] !== handleMouseDown || $[178] !== handleMouseMove || $[179] !== handleMouseOut || $[180] !== handleMouseOver || $[181] !== handleMouseUp || $[182] !== handleRef || $[183] !== onClick || $[184] !== styleFromProps || $[185] !== t47 || $[186] !== t48 || $[187] !== t49 || $[188] !== trigger) {
1707
- t50 = /* @__PURE__ */ jsxs(Fragment, { children: [t46, /* @__PURE__ */ jsxs("div", {
1708
- className: t47,
1697
+ $[169] = body;
1698
+ $[170] = bodyId;
1699
+ $[171] = bodyLabelledBy;
1700
+ $[172] = dropdownContextValue;
1701
+ $[173] = handleBodyRef;
1702
+ $[174] = hasItems;
1703
+ $[175] = isOpen;
1704
+ $[176] = popupRole;
1705
+ $[177] = t51;
1706
+ } else t51 = $[177];
1707
+ let t52;
1708
+ if ($[178] !== handleDropdownMouseEnter || $[179] !== handleDropdownMouseLeave || $[180] !== handleMouseDown || $[181] !== handleMouseMove || $[182] !== handleMouseOut || $[183] !== handleMouseOver || $[184] !== handleMouseUp || $[185] !== handleRef || $[186] !== onClick || $[187] !== styleFromProps || $[188] !== t49 || $[189] !== t50 || $[190] !== t51 || $[191] !== trigger) {
1709
+ t52 = /* @__PURE__ */ jsxs(Fragment, { children: [t48, /* @__PURE__ */ jsxs("div", {
1710
+ className: t49,
1709
1711
  onClick,
1710
- role: t48,
1712
+ role: t50,
1711
1713
  onMouseDown: handleMouseDown,
1712
1714
  onMouseEnter: handleDropdownMouseEnter,
1713
1715
  onMouseLeave: handleDropdownMouseLeave,
@@ -1717,25 +1719,25 @@ function RootDropdown(t0) {
1717
1719
  onMouseUp: handleMouseUp,
1718
1720
  ref: handleRef,
1719
1721
  style: styleFromProps,
1720
- children: [trigger, t49]
1722
+ children: [trigger, t51]
1721
1723
  })] });
1722
- $[175] = handleDropdownMouseEnter;
1723
- $[176] = handleDropdownMouseLeave;
1724
- $[177] = handleMouseDown;
1725
- $[178] = handleMouseMove;
1726
- $[179] = handleMouseOut;
1727
- $[180] = handleMouseOver;
1728
- $[181] = handleMouseUp;
1729
- $[182] = handleRef;
1730
- $[183] = onClick;
1731
- $[184] = styleFromProps;
1732
- $[185] = t47;
1733
- $[186] = t48;
1734
- $[187] = t49;
1735
- $[188] = trigger;
1724
+ $[178] = handleDropdownMouseEnter;
1725
+ $[179] = handleDropdownMouseLeave;
1726
+ $[180] = handleMouseDown;
1727
+ $[181] = handleMouseMove;
1728
+ $[182] = handleMouseOut;
1729
+ $[183] = handleMouseOver;
1730
+ $[184] = handleMouseUp;
1731
+ $[185] = handleRef;
1732
+ $[186] = onClick;
1733
+ $[187] = styleFromProps;
1734
+ $[188] = t49;
1736
1735
  $[189] = t50;
1737
- } else t50 = $[189];
1738
- return t50;
1736
+ $[190] = t51;
1737
+ $[191] = trigger;
1738
+ $[192] = t52;
1739
+ } else t52 = $[192];
1740
+ return t52;
1739
1741
  }
1740
1742
  var INERT_SUBMENU_PROPS = [
1741
1743
  "allowCreate",