@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/README.md +3 -0
- package/dist/Dropdown.js +466 -464
- package/dist/Dropdown.js.map +1 -1
- package/package.json +7 -7
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(
|
|
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
|
|
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] =
|
|
654
|
-
$[9] =
|
|
655
|
-
$[10] = onOpen;
|
|
656
|
-
$[11] = t7;
|
|
657
|
-
$[12] = t8;
|
|
642
|
+
$[8] = t7;
|
|
643
|
+
$[9] = t8;
|
|
658
644
|
} else {
|
|
659
|
-
t7 = $[
|
|
660
|
-
t8 = $[
|
|
645
|
+
t7 = $[8];
|
|
646
|
+
t8 = $[9];
|
|
661
647
|
}
|
|
662
|
-
|
|
648
|
+
useLayoutEffect(t7, t8);
|
|
663
649
|
let t9;
|
|
664
|
-
if ($[
|
|
650
|
+
if ($[10] !== dropdownElement || $[11] !== isOpen) {
|
|
665
651
|
t9 = () => {
|
|
666
652
|
if (isOpen) syncActiveDescendant(dropdownElement);
|
|
667
653
|
};
|
|
668
|
-
$[
|
|
669
|
-
$[
|
|
670
|
-
$[
|
|
671
|
-
} else t9 = $[
|
|
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
|
-
|
|
679
|
-
if (
|
|
680
|
-
|
|
681
|
-
|
|
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
|
-
|
|
688
|
-
$[
|
|
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] !==
|
|
698
|
-
t12 =
|
|
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
|
-
$[
|
|
711
|
-
$[
|
|
712
|
-
} else
|
|
713
|
-
const dropdownContextValue =
|
|
714
|
-
let
|
|
715
|
-
if ($[
|
|
716
|
-
|
|
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
|
|
716
|
+
const dispatchToSubmenus = t14;
|
|
733
717
|
let t15;
|
|
734
|
-
if ($[24]
|
|
735
|
-
t15 = (
|
|
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
|
-
$[
|
|
745
|
-
} else
|
|
746
|
-
const handleToggleSubmenu =
|
|
747
|
-
let
|
|
748
|
-
if ($[
|
|
749
|
-
|
|
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
|
-
$[
|
|
757
|
-
} else
|
|
758
|
-
const clearDisclosureTimer =
|
|
759
|
-
let t17;
|
|
750
|
+
$[27] = t17;
|
|
751
|
+
} else t17 = $[27];
|
|
752
|
+
const clearDisclosureTimer = t17;
|
|
760
753
|
let t18;
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
t18 =
|
|
764
|
-
|
|
765
|
-
$[
|
|
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
|
-
|
|
768
|
-
|
|
761
|
+
t18 = $[28];
|
|
762
|
+
t19 = $[29];
|
|
769
763
|
}
|
|
770
|
-
useEffect(
|
|
771
|
-
let
|
|
772
|
-
if ($[
|
|
773
|
-
|
|
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
|
-
$[
|
|
793
|
-
$[
|
|
794
|
-
} else
|
|
795
|
-
const syncSubmenuDisclosure =
|
|
796
|
-
let
|
|
797
|
-
if ($[
|
|
798
|
-
|
|
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
|
-
$[
|
|
805
|
-
} else
|
|
806
|
-
const clearSafeAreaTimer =
|
|
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
|
-
|
|
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
|
-
$[
|
|
841
|
-
} else
|
|
842
|
-
const isPointerInSafeArea =
|
|
843
|
-
let
|
|
844
|
-
if ($[
|
|
845
|
-
|
|
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
|
-
$[
|
|
863
|
-
$[
|
|
864
|
-
$[
|
|
865
|
-
$[
|
|
866
|
-
} else
|
|
867
|
-
const commitPointerTarget =
|
|
868
|
-
let
|
|
869
|
-
if ($[
|
|
870
|
-
|
|
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
|
-
$[
|
|
904
|
-
$[
|
|
905
|
-
$[
|
|
906
|
-
$[
|
|
907
|
-
} else
|
|
908
|
-
const trackSafeArea =
|
|
909
|
-
let
|
|
910
|
-
if ($[
|
|
911
|
-
|
|
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
|
-
$[
|
|
918
|
-
} else
|
|
919
|
-
const clearHoverCloseTimer =
|
|
920
|
-
let t27;
|
|
911
|
+
$[44] = t27;
|
|
912
|
+
} else t27 = $[44];
|
|
913
|
+
const clearHoverCloseTimer = t27;
|
|
921
914
|
let t28;
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
t28 =
|
|
925
|
-
|
|
926
|
-
$[
|
|
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
|
-
|
|
929
|
-
|
|
922
|
+
t28 = $[45];
|
|
923
|
+
t29 = $[46];
|
|
930
924
|
}
|
|
931
|
-
useEffect(
|
|
932
|
-
let
|
|
933
|
-
if ($[
|
|
934
|
-
|
|
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
|
-
|
|
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
|
-
$[
|
|
951
|
-
$[
|
|
952
|
-
$[
|
|
953
|
-
} else
|
|
954
|
-
const closeDropdown =
|
|
955
|
-
let
|
|
956
|
-
if ($[
|
|
957
|
-
|
|
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
|
-
|
|
967
|
+
endOpeningPress();
|
|
962
968
|
};
|
|
963
|
-
$[
|
|
964
|
-
$[
|
|
965
|
-
$[
|
|
966
|
-
} else
|
|
967
|
-
const handleDropdownMouseEnter =
|
|
968
|
-
let
|
|
969
|
-
if ($[
|
|
970
|
-
|
|
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
|
-
$[
|
|
978
|
-
$[
|
|
979
|
-
$[
|
|
980
|
-
} else
|
|
981
|
-
const handleDropdownMouseLeave =
|
|
982
|
-
let
|
|
983
|
-
if ($[
|
|
984
|
-
|
|
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
|
-
$[
|
|
988
|
-
$[
|
|
989
|
-
} else
|
|
990
|
-
const focusTrigger =
|
|
991
|
-
let
|
|
992
|
-
if ($[
|
|
993
|
-
|
|
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
|
-
$[
|
|
1009
|
-
$[
|
|
1010
|
-
$[
|
|
1011
|
-
$[
|
|
1012
|
-
$[
|
|
1013
|
-
$[
|
|
1014
|
-
$[
|
|
1015
|
-
} else
|
|
1016
|
-
useEffect(
|
|
1017
|
-
let
|
|
1018
|
-
let
|
|
1019
|
-
if ($[
|
|
1020
|
-
|
|
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
|
-
|
|
1029
|
+
t37 = [
|
|
1024
1030
|
dropdownElement,
|
|
1025
1031
|
isOpen,
|
|
1026
1032
|
menubar
|
|
1027
1033
|
];
|
|
1028
|
-
$[
|
|
1029
|
-
$[
|
|
1030
|
-
$[
|
|
1031
|
-
$[
|
|
1032
|
-
$[
|
|
1034
|
+
$[66] = dropdownElement;
|
|
1035
|
+
$[67] = isOpen;
|
|
1036
|
+
$[68] = menubar;
|
|
1037
|
+
$[69] = t36;
|
|
1038
|
+
$[70] = t37;
|
|
1033
1039
|
} else {
|
|
1034
|
-
|
|
1035
|
-
|
|
1040
|
+
t36 = $[69];
|
|
1041
|
+
t37 = $[70];
|
|
1036
1042
|
}
|
|
1037
|
-
useEffect(
|
|
1038
|
-
let
|
|
1039
|
-
if ($[
|
|
1040
|
-
|
|
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
|
-
$[
|
|
1101
|
-
$[
|
|
1102
|
-
$[
|
|
1103
|
-
$[
|
|
1104
|
-
$[
|
|
1105
|
-
$[
|
|
1106
|
-
$[
|
|
1107
|
-
$[
|
|
1108
|
-
$[
|
|
1109
|
-
$[
|
|
1110
|
-
$[
|
|
1111
|
-
} else
|
|
1112
|
-
const handleSubmitItem =
|
|
1113
|
-
let
|
|
1114
|
-
if ($[
|
|
1115
|
-
|
|
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
|
-
|
|
1128
|
+
endOpeningPress();
|
|
1123
1129
|
};
|
|
1124
|
-
$[
|
|
1125
|
-
$[
|
|
1126
|
-
} else
|
|
1127
|
-
const handleMouseMove =
|
|
1128
|
-
let
|
|
1129
|
-
if ($[
|
|
1130
|
-
|
|
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
|
-
$[
|
|
1150
|
-
$[
|
|
1151
|
-
$[
|
|
1152
|
-
$[
|
|
1153
|
-
$[
|
|
1154
|
-
} else
|
|
1155
|
-
const handleMouseOver =
|
|
1156
|
-
let
|
|
1157
|
-
if ($[
|
|
1158
|
-
|
|
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
|
-
$[
|
|
1175
|
-
$[
|
|
1176
|
-
$[
|
|
1177
|
-
$[
|
|
1178
|
-
} else
|
|
1179
|
-
const handleMouseOut =
|
|
1180
|
-
let
|
|
1181
|
-
if ($[
|
|
1182
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1198
|
+
isOpeningRef.current = false;
|
|
1193
1199
|
isOpeningTimerRef.current = null;
|
|
1194
1200
|
}, 1e3);
|
|
1195
1201
|
};
|
|
1196
|
-
$[
|
|
1197
|
-
$[
|
|
1198
|
-
$[
|
|
1199
|
-
} else
|
|
1200
|
-
const handleMouseDown =
|
|
1201
|
-
let
|
|
1202
|
-
if ($[
|
|
1203
|
-
|
|
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 (
|
|
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
|
-
$[
|
|
1228
|
-
$[
|
|
1229
|
-
$[
|
|
1230
|
-
$[
|
|
1231
|
-
$[
|
|
1232
|
-
$[
|
|
1233
|
-
$[
|
|
1234
|
-
} else
|
|
1235
|
-
const handleMouseUp =
|
|
1236
|
-
let
|
|
1237
|
-
if ($[
|
|
1238
|
-
|
|
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
|
-
$[
|
|
1384
|
-
$[
|
|
1385
|
-
$[
|
|
1386
|
-
$[
|
|
1387
|
-
$[
|
|
1388
|
-
$[
|
|
1389
|
-
$[
|
|
1390
|
-
$[
|
|
1391
|
-
$[
|
|
1392
|
-
$[
|
|
1393
|
-
$[
|
|
1394
|
-
} else
|
|
1395
|
-
const handleKeyDown =
|
|
1396
|
-
let
|
|
1397
|
-
if ($[
|
|
1398
|
-
|
|
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
|
-
$[
|
|
1403
|
-
$[
|
|
1404
|
-
} else
|
|
1405
|
-
useKeyboardEvents(
|
|
1406
|
-
let
|
|
1407
|
-
if ($[
|
|
1408
|
-
|
|
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 = (
|
|
1419
|
-
const { target: target_1 } =
|
|
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 = (
|
|
1424
|
-
const { target: target_2 } =
|
|
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
|
-
|
|
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 = (
|
|
1438
|
-
const { target: target_3 } =
|
|
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
|
-
$[
|
|
1481
|
-
$[
|
|
1482
|
-
$[
|
|
1483
|
-
$[
|
|
1484
|
-
$[
|
|
1485
|
-
} else
|
|
1486
|
-
const handleRef =
|
|
1487
|
-
let
|
|
1488
|
-
if ($[
|
|
1489
|
-
|
|
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
|
-
$[
|
|
1508
|
-
$[
|
|
1509
|
-
$[
|
|
1510
|
-
$[
|
|
1511
|
-
} else
|
|
1512
|
-
const handleBodyRef =
|
|
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
|
|
1517
|
-
let
|
|
1518
|
-
if ($[
|
|
1519
|
-
|
|
1520
|
-
$[
|
|
1521
|
-
} else
|
|
1522
|
-
let
|
|
1523
|
-
if ($[
|
|
1524
|
-
|
|
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:
|
|
1533
|
+
defaultValue: t48,
|
|
1532
1534
|
disabled,
|
|
1533
1535
|
id: triggerId,
|
|
1534
1536
|
name,
|
|
1535
|
-
onFocus:
|
|
1537
|
+
onFocus: t49,
|
|
1536
1538
|
placeholder,
|
|
1537
1539
|
ref: inputElementRef,
|
|
1538
1540
|
role: "combobox",
|
|
1539
1541
|
tabIndex,
|
|
1540
1542
|
type: "text"
|
|
1541
1543
|
});
|
|
1542
|
-
$[
|
|
1543
|
-
$[
|
|
1544
|
-
$[
|
|
1545
|
-
$[
|
|
1546
|
-
$[
|
|
1547
|
-
$[
|
|
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
|
-
|
|
1553
|
-
|
|
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
|
|
1557
|
-
const
|
|
1558
|
-
let
|
|
1559
|
-
if ($[
|
|
1560
|
-
|
|
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:
|
|
1568
|
-
tabIndex:
|
|
1569
|
+
role: t48,
|
|
1570
|
+
tabIndex: t49,
|
|
1569
1571
|
type: "button",
|
|
1570
1572
|
children: trigger
|
|
1571
1573
|
});
|
|
1572
|
-
$[
|
|
1573
|
-
$[
|
|
1574
|
-
$[
|
|
1575
|
-
$[
|
|
1576
|
-
$[
|
|
1577
|
-
$[
|
|
1578
|
-
$[
|
|
1579
|
-
$[
|
|
1580
|
-
$[
|
|
1581
|
-
} else
|
|
1582
|
-
trigger =
|
|
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
|
|
1593
|
-
const
|
|
1594
|
-
const
|
|
1595
|
-
const
|
|
1596
|
-
const
|
|
1597
|
-
const
|
|
1598
|
-
const
|
|
1599
|
-
let
|
|
1600
|
-
if ($[
|
|
1601
|
-
|
|
1602
|
-
"aria-autocomplete":
|
|
1603
|
-
"aria-controls":
|
|
1604
|
-
"aria-disabled":
|
|
1605
|
-
"aria-expanded":
|
|
1606
|
-
"aria-haspopup":
|
|
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:
|
|
1611
|
+
tabIndex: t54
|
|
1610
1612
|
});
|
|
1611
|
-
$[
|
|
1612
|
-
$[
|
|
1613
|
-
$[
|
|
1614
|
-
$[
|
|
1615
|
-
$[
|
|
1616
|
-
$[
|
|
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
|
-
|
|
1622
|
-
|
|
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
|
|
1627
|
-
const
|
|
1628
|
-
let
|
|
1629
|
-
if ($[
|
|
1630
|
-
|
|
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:
|
|
1635
|
+
role: t49,
|
|
1634
1636
|
children: label
|
|
1635
1637
|
});
|
|
1636
|
-
$[
|
|
1637
|
-
$[
|
|
1638
|
-
$[
|
|
1639
|
-
$[
|
|
1640
|
-
} else
|
|
1641
|
-
let
|
|
1642
|
-
if ($[
|
|
1643
|
-
|
|
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:
|
|
1646
|
-
children: [
|
|
1647
|
+
role: t48,
|
|
1648
|
+
children: [t50, trigger]
|
|
1647
1649
|
});
|
|
1648
|
-
$[
|
|
1649
|
-
$[
|
|
1650
|
-
$[
|
|
1651
|
-
$[
|
|
1652
|
-
} else
|
|
1653
|
-
trigger =
|
|
1650
|
+
$[159] = t48;
|
|
1651
|
+
$[160] = t50;
|
|
1652
|
+
$[161] = trigger;
|
|
1653
|
+
$[162] = t51;
|
|
1654
|
+
} else t51 = $[162];
|
|
1655
|
+
trigger = t51;
|
|
1654
1656
|
}
|
|
1655
|
-
let
|
|
1656
|
-
if ($[
|
|
1657
|
-
|
|
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
|
-
$[
|
|
1663
|
-
} else
|
|
1664
|
-
let
|
|
1665
|
-
if ($[
|
|
1666
|
-
|
|
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
|
-
$[
|
|
1672
|
-
$[
|
|
1673
|
-
$[
|
|
1674
|
-
$[
|
|
1675
|
-
$[
|
|
1676
|
-
} else
|
|
1677
|
-
const
|
|
1678
|
-
let
|
|
1679
|
-
if ($[
|
|
1680
|
-
|
|
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
|
-
$[
|
|
1696
|
-
$[
|
|
1697
|
-
$[
|
|
1698
|
-
$[
|
|
1699
|
-
$[
|
|
1700
|
-
$[
|
|
1701
|
-
$[
|
|
1702
|
-
$[
|
|
1703
|
-
$[
|
|
1704
|
-
} else
|
|
1705
|
-
let
|
|
1706
|
-
if ($[
|
|
1707
|
-
|
|
1708
|
-
className:
|
|
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:
|
|
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,
|
|
1722
|
+
children: [trigger, t51]
|
|
1721
1723
|
})] });
|
|
1722
|
-
$[
|
|
1723
|
-
$[
|
|
1724
|
-
$[
|
|
1725
|
-
$[
|
|
1726
|
-
$[
|
|
1727
|
-
$[
|
|
1728
|
-
$[
|
|
1729
|
-
$[
|
|
1730
|
-
$[
|
|
1731
|
-
$[
|
|
1732
|
-
$[
|
|
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
|
-
|
|
1738
|
-
|
|
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",
|