@acusti/dropdown 1.0.0-alpha.2 → 1.0.0-alpha.3
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 +36 -3
- package/dist/Dropdown.d.ts +8 -0
- package/dist/Dropdown.js +290 -233
- package/dist/Dropdown.js.map +1 -1
- package/package.json +1 -1
package/dist/Dropdown.js
CHANGED
|
@@ -371,6 +371,7 @@ var FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, [tabindex]";
|
|
|
371
371
|
var TEXT_INPUT_SELECTOR = "input:not([type=radio]):not([type=checkbox]):not([type=range]),textarea";
|
|
372
372
|
var SUBMENU_DISCLOSURE_DELAY = 200;
|
|
373
373
|
var SAFE_AREA_TIMEOUT = 300;
|
|
374
|
+
var HOVER_CLOSE_DELAY = 150;
|
|
374
375
|
function Dropdown(props) {
|
|
375
376
|
const $ = c(5);
|
|
376
377
|
const parentDropdown = useContext(DropdownContext);
|
|
@@ -396,8 +397,8 @@ function Dropdown(props) {
|
|
|
396
397
|
return t0;
|
|
397
398
|
}
|
|
398
399
|
function RootDropdown(t0) {
|
|
399
|
-
const $ = c(
|
|
400
|
-
const { allowCreate, allowEmpty: t1, children, className, disabled, hasItems: t2, isOpenOnMount, isSearchable, keepOpenOnSubmit: t3, label, name, onActiveItem, onClick, onClose, onMouseDown, onMouseUp, onOpen, onSubmitItem, placeholder, style: styleFromProps, tabIndex, value } = t0;
|
|
400
|
+
const $ = c(147);
|
|
401
|
+
const { allowCreate, allowEmpty: t1, children, className, disabled, hasItems: t2, isOpenOnMount, isSearchable, keepOpenOnSubmit: t3, label, name, onActiveItem, onClick, onClose, onMouseDown, onMouseUp, onOpen, onSubmitItem, openOnHover, placeholder, style: styleFromProps, tabIndex, value } = t0;
|
|
401
402
|
const allowEmpty = t1 === void 0 ? true : t1;
|
|
402
403
|
const hasItems = t2 === void 0 ? true : t2;
|
|
403
404
|
const keepOpenOnSubmit = t3 === void 0 ? !hasItems : t3;
|
|
@@ -434,6 +435,7 @@ function RootDropdown(t0) {
|
|
|
434
435
|
const safeAreaRef = useRef(null);
|
|
435
436
|
const safeAreaTimerRef = useRef(null);
|
|
436
437
|
const wasInSafeAreaRef = useRef(false);
|
|
438
|
+
const hoverCloseTimerRef = useRef(null);
|
|
437
439
|
const allowCreateRef = useRef(allowCreate);
|
|
438
440
|
const allowEmptyRef = useRef(allowEmpty);
|
|
439
441
|
const hasItemsRef = useRef(hasItems);
|
|
@@ -710,13 +712,37 @@ function RootDropdown(t0) {
|
|
|
710
712
|
} else t22 = $[36];
|
|
711
713
|
const trackSafeArea = t22;
|
|
712
714
|
let t23;
|
|
713
|
-
if ($[37]
|
|
714
|
-
t23 = (
|
|
715
|
+
if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
|
|
716
|
+
t23 = () => {
|
|
717
|
+
if (hoverCloseTimerRef.current != null) {
|
|
718
|
+
clearTimeout(hoverCloseTimerRef.current);
|
|
719
|
+
hoverCloseTimerRef.current = null;
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
$[37] = t23;
|
|
723
|
+
} else t23 = $[37];
|
|
724
|
+
const clearHoverCloseTimer = t23;
|
|
725
|
+
let t24;
|
|
726
|
+
let t25;
|
|
727
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
728
|
+
t24 = () => clearHoverCloseTimer;
|
|
729
|
+
t25 = [];
|
|
730
|
+
$[38] = t24;
|
|
731
|
+
$[39] = t25;
|
|
732
|
+
} else {
|
|
733
|
+
t24 = $[38];
|
|
734
|
+
t25 = $[39];
|
|
735
|
+
}
|
|
736
|
+
useEffect(t24, t25);
|
|
737
|
+
let t26;
|
|
738
|
+
if ($[40] !== dropdownElement || $[41] !== menubar) {
|
|
739
|
+
t26 = (options) => {
|
|
715
740
|
setIsOpen(false);
|
|
716
741
|
setIsOpening(false);
|
|
717
742
|
mouseDownPositionRef.current = null;
|
|
718
743
|
clearDisclosureTimer();
|
|
719
744
|
clearSafeAreaTimer();
|
|
745
|
+
clearHoverCloseTimer();
|
|
720
746
|
safeAreaRef.current = null;
|
|
721
747
|
wasInSafeAreaRef.current = false;
|
|
722
748
|
if (closingTimerRef.current != null) {
|
|
@@ -725,25 +751,51 @@ function RootDropdown(t0) {
|
|
|
725
751
|
}
|
|
726
752
|
if (menubar && dropdownElement && !options?.keepMenubarEngaged) menubar.notifyClosed(dropdownElement);
|
|
727
753
|
};
|
|
728
|
-
$[
|
|
729
|
-
$[
|
|
730
|
-
$[
|
|
731
|
-
} else
|
|
732
|
-
const closeDropdown =
|
|
733
|
-
let
|
|
734
|
-
if ($[
|
|
735
|
-
|
|
754
|
+
$[40] = dropdownElement;
|
|
755
|
+
$[41] = menubar;
|
|
756
|
+
$[42] = t26;
|
|
757
|
+
} else t26 = $[42];
|
|
758
|
+
const closeDropdown = t26;
|
|
759
|
+
let t27;
|
|
760
|
+
if ($[43] !== openOnHover) {
|
|
761
|
+
t27 = () => {
|
|
762
|
+
clearHoverCloseTimer();
|
|
763
|
+
if (!openOnHover || isOpenRef.current) return;
|
|
764
|
+
setIsOpen(true);
|
|
765
|
+
setIsOpening(false);
|
|
766
|
+
};
|
|
767
|
+
$[43] = openOnHover;
|
|
768
|
+
$[44] = t27;
|
|
769
|
+
} else t27 = $[44];
|
|
770
|
+
const handleDropdownMouseEnter = t27;
|
|
771
|
+
let t28;
|
|
772
|
+
if ($[45] !== closeDropdown || $[46] !== openOnHover) {
|
|
773
|
+
t28 = () => {
|
|
774
|
+
if (!openOnHover || !isOpenRef.current || hoverCloseTimerRef.current != null) return;
|
|
775
|
+
hoverCloseTimerRef.current = setTimeout(() => {
|
|
776
|
+
hoverCloseTimerRef.current = null;
|
|
777
|
+
closeDropdown();
|
|
778
|
+
}, HOVER_CLOSE_DELAY);
|
|
779
|
+
};
|
|
780
|
+
$[45] = closeDropdown;
|
|
781
|
+
$[46] = openOnHover;
|
|
782
|
+
$[47] = t28;
|
|
783
|
+
} else t28 = $[47];
|
|
784
|
+
const handleDropdownMouseLeave = t28;
|
|
785
|
+
let t29;
|
|
786
|
+
if ($[48] !== dropdownElement?.firstElementChild) {
|
|
787
|
+
t29 = () => {
|
|
736
788
|
const firstChild = dropdownElement?.firstElementChild;
|
|
737
789
|
if (!firstChild) return;
|
|
738
790
|
(firstChild.matches(FOCUSABLE_SELECTOR) ? firstChild : firstChild.querySelector(FOCUSABLE_SELECTOR))?.focus();
|
|
739
791
|
};
|
|
740
|
-
$[
|
|
741
|
-
$[
|
|
742
|
-
} else
|
|
743
|
-
const focusTrigger =
|
|
744
|
-
let
|
|
745
|
-
if ($[
|
|
746
|
-
|
|
792
|
+
$[48] = dropdownElement?.firstElementChild;
|
|
793
|
+
$[49] = t29;
|
|
794
|
+
} else t29 = $[49];
|
|
795
|
+
const focusTrigger = t29;
|
|
796
|
+
let t30;
|
|
797
|
+
if ($[50] !== closeDropdown || $[51] !== dropdownElement || $[52] !== focusTrigger || $[53] !== menubar) {
|
|
798
|
+
t30 = () => {
|
|
747
799
|
if (!menubar || !dropdownElement) return;
|
|
748
800
|
return menubar.registerMember({
|
|
749
801
|
close: () => closeDropdown({ keepMenubarEngaged: true }),
|
|
@@ -753,37 +805,37 @@ function RootDropdown(t0) {
|
|
|
753
805
|
open: () => setIsOpen(true)
|
|
754
806
|
});
|
|
755
807
|
};
|
|
756
|
-
$[
|
|
757
|
-
$[
|
|
758
|
-
$[
|
|
759
|
-
$[
|
|
760
|
-
$[
|
|
761
|
-
} else
|
|
762
|
-
useEffect(
|
|
763
|
-
let
|
|
764
|
-
let
|
|
765
|
-
if ($[
|
|
766
|
-
|
|
808
|
+
$[50] = closeDropdown;
|
|
809
|
+
$[51] = dropdownElement;
|
|
810
|
+
$[52] = focusTrigger;
|
|
811
|
+
$[53] = menubar;
|
|
812
|
+
$[54] = t30;
|
|
813
|
+
} else t30 = $[54];
|
|
814
|
+
useEffect(t30);
|
|
815
|
+
let t31;
|
|
816
|
+
let t32;
|
|
817
|
+
if ($[55] !== dropdownElement || $[56] !== isOpen || $[57] !== menubar) {
|
|
818
|
+
t31 = () => {
|
|
767
819
|
if (isOpen && menubar && dropdownElement) menubar.notifyOpened(dropdownElement);
|
|
768
820
|
};
|
|
769
|
-
|
|
821
|
+
t32 = [
|
|
770
822
|
dropdownElement,
|
|
771
823
|
isOpen,
|
|
772
824
|
menubar
|
|
773
825
|
];
|
|
774
|
-
$[
|
|
775
|
-
$[
|
|
776
|
-
$[
|
|
777
|
-
$[
|
|
778
|
-
$[
|
|
826
|
+
$[55] = dropdownElement;
|
|
827
|
+
$[56] = isOpen;
|
|
828
|
+
$[57] = menubar;
|
|
829
|
+
$[58] = t31;
|
|
830
|
+
$[59] = t32;
|
|
779
831
|
} else {
|
|
780
|
-
|
|
781
|
-
|
|
832
|
+
t31 = $[58];
|
|
833
|
+
t32 = $[59];
|
|
782
834
|
}
|
|
783
|
-
useEffect(
|
|
784
|
-
let
|
|
785
|
-
if ($[
|
|
786
|
-
|
|
835
|
+
useEffect(t31, t32);
|
|
836
|
+
let t33;
|
|
837
|
+
if ($[60] !== closeDropdown || $[61] !== dropdownElement || $[62] !== handleActiveItem) {
|
|
838
|
+
t33 = (event_1) => {
|
|
787
839
|
const element = hasItemsRef.current ? getActiveItemElement(dropdownElement) : null;
|
|
788
840
|
const submenuOfActive = element ? getSubmenuOfItem(element) : null;
|
|
789
841
|
if (element && submenuOfActive) {
|
|
@@ -838,15 +890,15 @@ function RootDropdown(t0) {
|
|
|
838
890
|
onSubmitItemRef.current?.(payload_1);
|
|
839
891
|
dispatchToSubmenus("onSubmitItem", payload_1);
|
|
840
892
|
};
|
|
841
|
-
$[
|
|
842
|
-
$[
|
|
843
|
-
$[
|
|
844
|
-
$[
|
|
845
|
-
} else
|
|
846
|
-
const handleSubmitItem =
|
|
847
|
-
let
|
|
848
|
-
if ($[
|
|
849
|
-
|
|
893
|
+
$[60] = closeDropdown;
|
|
894
|
+
$[61] = dropdownElement;
|
|
895
|
+
$[62] = handleActiveItem;
|
|
896
|
+
$[63] = t33;
|
|
897
|
+
} else t33 = $[63];
|
|
898
|
+
const handleSubmitItem = t33;
|
|
899
|
+
let t34;
|
|
900
|
+
if ($[64] !== trackSafeArea) {
|
|
901
|
+
t34 = (event_2) => {
|
|
850
902
|
const { clientX, clientY } = event_2;
|
|
851
903
|
currentInputMethodRef.current = "mouse";
|
|
852
904
|
trackSafeArea(event_2);
|
|
@@ -855,13 +907,13 @@ function RootDropdown(t0) {
|
|
|
855
907
|
if (Math.abs(initialPosition.clientX - clientX) < 12 && Math.abs(initialPosition.clientY - clientY) < 12) return;
|
|
856
908
|
setIsOpening(false);
|
|
857
909
|
};
|
|
858
|
-
$[
|
|
859
|
-
$[
|
|
860
|
-
} else
|
|
861
|
-
const handleMouseMove =
|
|
862
|
-
let
|
|
863
|
-
if ($[
|
|
864
|
-
|
|
910
|
+
$[64] = trackSafeArea;
|
|
911
|
+
$[65] = t34;
|
|
912
|
+
} else t34 = $[65];
|
|
913
|
+
const handleMouseMove = t34;
|
|
914
|
+
let t35;
|
|
915
|
+
if ($[66] !== dropdownElement || $[67] !== handleActiveItem || $[68] !== syncSubmenuDisclosure) {
|
|
916
|
+
t35 = (event_3) => {
|
|
865
917
|
if (!hasItemsRef.current) return;
|
|
866
918
|
if (currentInputMethodRef.current !== "mouse") return;
|
|
867
919
|
if (!dropdownElement) return;
|
|
@@ -880,15 +932,15 @@ function RootDropdown(t0) {
|
|
|
880
932
|
});
|
|
881
933
|
syncSubmenuDisclosure();
|
|
882
934
|
};
|
|
883
|
-
$[
|
|
884
|
-
$[
|
|
885
|
-
$[
|
|
886
|
-
$[
|
|
887
|
-
} else
|
|
888
|
-
const handleMouseOver =
|
|
889
|
-
let
|
|
890
|
-
if ($[
|
|
891
|
-
|
|
935
|
+
$[66] = dropdownElement;
|
|
936
|
+
$[67] = handleActiveItem;
|
|
937
|
+
$[68] = syncSubmenuDisclosure;
|
|
938
|
+
$[69] = t35;
|
|
939
|
+
} else t35 = $[69];
|
|
940
|
+
const handleMouseOver = t35;
|
|
941
|
+
let t36;
|
|
942
|
+
if ($[70] !== dropdownElement || $[71] !== syncSubmenuDisclosure) {
|
|
943
|
+
t36 = (event_4) => {
|
|
892
944
|
if (!hasItemsRef.current) return;
|
|
893
945
|
const relatedTarget = event_4.relatedTarget;
|
|
894
946
|
if (!dropdownElement?.contains(relatedTarget)) {
|
|
@@ -904,14 +956,14 @@ function RootDropdown(t0) {
|
|
|
904
956
|
delete activeItem.dataset.uktActive;
|
|
905
957
|
syncSubmenuDisclosure();
|
|
906
958
|
};
|
|
907
|
-
$[
|
|
908
|
-
$[
|
|
909
|
-
$[
|
|
910
|
-
} else
|
|
911
|
-
const handleMouseOut =
|
|
912
|
-
let
|
|
913
|
-
if ($[
|
|
914
|
-
|
|
959
|
+
$[70] = dropdownElement;
|
|
960
|
+
$[71] = syncSubmenuDisclosure;
|
|
961
|
+
$[72] = t36;
|
|
962
|
+
} else t36 = $[72];
|
|
963
|
+
const handleMouseOut = t36;
|
|
964
|
+
let t37;
|
|
965
|
+
if ($[73] !== onMouseDown) {
|
|
966
|
+
t37 = (event_5) => {
|
|
915
967
|
if (onMouseDown) onMouseDown(event_5);
|
|
916
968
|
if (isOpenRef.current) return;
|
|
917
969
|
setIsOpen(true);
|
|
@@ -925,13 +977,13 @@ function RootDropdown(t0) {
|
|
|
925
977
|
isOpeningTimerRef.current = null;
|
|
926
978
|
}, 1e3);
|
|
927
979
|
};
|
|
928
|
-
$[
|
|
929
|
-
$[
|
|
930
|
-
} else
|
|
931
|
-
const handleMouseDown =
|
|
932
|
-
let
|
|
933
|
-
if ($[
|
|
934
|
-
|
|
980
|
+
$[73] = onMouseDown;
|
|
981
|
+
$[74] = t37;
|
|
982
|
+
} else t37 = $[74];
|
|
983
|
+
const handleMouseDown = t37;
|
|
984
|
+
let t38;
|
|
985
|
+
if ($[75] !== closeDropdown || $[76] !== dropdownElement || $[77] !== handleActiveItem || $[78] !== handleSubmitItem || $[79] !== onMouseUp) {
|
|
986
|
+
t38 = (event_6) => {
|
|
935
987
|
if (onMouseUp) onMouseUp(event_6);
|
|
936
988
|
if (isOpeningRef.current || !isOpenRef.current || closingTimerRef.current != null) return;
|
|
937
989
|
const eventTarget_1 = event_6.target;
|
|
@@ -955,17 +1007,17 @@ function RootDropdown(t0) {
|
|
|
955
1007
|
}
|
|
956
1008
|
handleSubmitItem(event_6);
|
|
957
1009
|
};
|
|
958
|
-
$[
|
|
959
|
-
$[
|
|
960
|
-
$[
|
|
961
|
-
$[
|
|
962
|
-
$[
|
|
963
|
-
$[
|
|
964
|
-
} else
|
|
965
|
-
const handleMouseUp =
|
|
966
|
-
let
|
|
967
|
-
if ($[
|
|
968
|
-
|
|
1010
|
+
$[75] = closeDropdown;
|
|
1011
|
+
$[76] = dropdownElement;
|
|
1012
|
+
$[77] = handleActiveItem;
|
|
1013
|
+
$[78] = handleSubmitItem;
|
|
1014
|
+
$[79] = onMouseUp;
|
|
1015
|
+
$[80] = t38;
|
|
1016
|
+
} else t38 = $[80];
|
|
1017
|
+
const handleMouseUp = t38;
|
|
1018
|
+
let t39;
|
|
1019
|
+
if ($[81] !== closeDropdown || $[82] !== dropdownElement || $[83] !== focusTrigger || $[84] !== handleActiveItem || $[85] !== handleSubmitItem || $[86] !== menubar || $[87] !== syncSubmenuDisclosure) {
|
|
1020
|
+
t39 = (event_7) => {
|
|
969
1021
|
const { altKey, ctrlKey, key: key_0, metaKey } = event_7;
|
|
970
1022
|
const eventTarget_2 = event_7.target;
|
|
971
1023
|
if (!dropdownElement) return;
|
|
@@ -1098,29 +1150,29 @@ function RootDropdown(t0) {
|
|
|
1098
1150
|
}
|
|
1099
1151
|
}
|
|
1100
1152
|
};
|
|
1101
|
-
$[
|
|
1102
|
-
$[
|
|
1103
|
-
$[
|
|
1104
|
-
$[
|
|
1105
|
-
$[
|
|
1106
|
-
$[
|
|
1107
|
-
$[
|
|
1108
|
-
$[
|
|
1109
|
-
} else
|
|
1110
|
-
const handleKeyDown =
|
|
1111
|
-
let
|
|
1112
|
-
if ($[
|
|
1113
|
-
|
|
1153
|
+
$[81] = closeDropdown;
|
|
1154
|
+
$[82] = dropdownElement;
|
|
1155
|
+
$[83] = focusTrigger;
|
|
1156
|
+
$[84] = handleActiveItem;
|
|
1157
|
+
$[85] = handleSubmitItem;
|
|
1158
|
+
$[86] = menubar;
|
|
1159
|
+
$[87] = syncSubmenuDisclosure;
|
|
1160
|
+
$[88] = t39;
|
|
1161
|
+
} else t39 = $[88];
|
|
1162
|
+
const handleKeyDown = t39;
|
|
1163
|
+
let t40;
|
|
1164
|
+
if ($[89] !== handleKeyDown) {
|
|
1165
|
+
t40 = {
|
|
1114
1166
|
ignoreUsedKeyboardEvents: false,
|
|
1115
1167
|
onKeyDown: handleKeyDown
|
|
1116
1168
|
};
|
|
1117
|
-
$[
|
|
1118
|
-
$[
|
|
1119
|
-
} else
|
|
1120
|
-
useKeyboardEvents(
|
|
1121
|
-
let
|
|
1122
|
-
if ($[
|
|
1123
|
-
|
|
1169
|
+
$[89] = handleKeyDown;
|
|
1170
|
+
$[90] = t40;
|
|
1171
|
+
} else t40 = $[90];
|
|
1172
|
+
useKeyboardEvents(t40);
|
|
1173
|
+
let t41;
|
|
1174
|
+
if ($[91] !== closeDropdown || $[92] !== handleActiveItem || $[93] !== isOpenOnMount) {
|
|
1175
|
+
t41 = (ref) => {
|
|
1124
1176
|
setDropdownElement(ref);
|
|
1125
1177
|
if (!ref) return;
|
|
1126
1178
|
const { ownerDocument } = ref;
|
|
@@ -1130,13 +1182,13 @@ function RootDropdown(t0) {
|
|
|
1130
1182
|
else inputElement = ref.firstElementChild.querySelector(TEXT_INPUT_SELECTOR);
|
|
1131
1183
|
inputElementRef.current = inputElement;
|
|
1132
1184
|
}
|
|
1133
|
-
const handleGlobalMouseDown = (
|
|
1134
|
-
const { target: target_1 } =
|
|
1185
|
+
const handleGlobalMouseDown = (t42) => {
|
|
1186
|
+
const { target: target_1 } = t42;
|
|
1135
1187
|
const eventTarget_3 = target_1;
|
|
1136
1188
|
if (!ref.contains(eventTarget_3)) closeDropdown();
|
|
1137
1189
|
};
|
|
1138
|
-
const handleGlobalMouseUp = (
|
|
1139
|
-
const { target: target_2 } =
|
|
1190
|
+
const handleGlobalMouseUp = (t43) => {
|
|
1191
|
+
const { target: target_2 } = t43;
|
|
1140
1192
|
if (!isOpenRef.current || closingTimerRef.current != null) return;
|
|
1141
1193
|
if (isOpeningRef.current) {
|
|
1142
1194
|
setIsOpening(false);
|
|
@@ -1149,8 +1201,8 @@ function RootDropdown(t0) {
|
|
|
1149
1201
|
const eventTarget_4 = target_2;
|
|
1150
1202
|
if (!ref.contains(eventTarget_4)) closeDropdown();
|
|
1151
1203
|
};
|
|
1152
|
-
const handleGlobalFocusIn = (
|
|
1153
|
-
const { target: target_3 } =
|
|
1204
|
+
const handleGlobalFocusIn = (t44) => {
|
|
1205
|
+
const { target: target_3 } = t44;
|
|
1154
1206
|
if (!isOpenRef.current) return;
|
|
1155
1207
|
const eventTarget_5 = target_3;
|
|
1156
1208
|
if (ref.contains(eventTarget_5) || eventTarget_5.contains(ref)) return;
|
|
@@ -1192,52 +1244,52 @@ function RootDropdown(t0) {
|
|
|
1192
1244
|
if (inputElement) inputElement.removeEventListener("input", handleInput);
|
|
1193
1245
|
};
|
|
1194
1246
|
};
|
|
1195
|
-
$[
|
|
1196
|
-
$[
|
|
1197
|
-
$[
|
|
1198
|
-
$[
|
|
1199
|
-
} else
|
|
1200
|
-
const handleRef =
|
|
1247
|
+
$[91] = closeDropdown;
|
|
1248
|
+
$[92] = handleActiveItem;
|
|
1249
|
+
$[93] = isOpenOnMount;
|
|
1250
|
+
$[94] = t41;
|
|
1251
|
+
} else t41 = $[94];
|
|
1252
|
+
const handleRef = t41;
|
|
1201
1253
|
const handleBodyRef = _temp;
|
|
1202
1254
|
if (!isValidElement(trigger)) if (isSearchable) {
|
|
1203
|
-
const
|
|
1204
|
-
let
|
|
1205
|
-
if ($[
|
|
1206
|
-
|
|
1207
|
-
$[
|
|
1208
|
-
} else
|
|
1209
|
-
let
|
|
1210
|
-
if ($[
|
|
1211
|
-
|
|
1255
|
+
const t42 = value ?? "";
|
|
1256
|
+
let t43;
|
|
1257
|
+
if ($[95] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1258
|
+
t43 = () => setIsOpen(true);
|
|
1259
|
+
$[95] = t43;
|
|
1260
|
+
} else t43 = $[95];
|
|
1261
|
+
let t44;
|
|
1262
|
+
if ($[96] !== bodyId || $[97] !== disabled || $[98] !== isOpen || $[99] !== name || $[100] !== placeholder || $[101] !== popupRole || $[102] !== t42 || $[103] !== tabIndex) {
|
|
1263
|
+
t44 = /* @__PURE__ */ jsx("input", {
|
|
1212
1264
|
"aria-controls": bodyId,
|
|
1213
1265
|
"aria-expanded": isOpen,
|
|
1214
1266
|
"aria-haspopup": popupRole,
|
|
1215
1267
|
autoComplete: "off",
|
|
1216
1268
|
className: "uktdropdown-trigger",
|
|
1217
|
-
defaultValue:
|
|
1269
|
+
defaultValue: t42,
|
|
1218
1270
|
disabled,
|
|
1219
1271
|
name,
|
|
1220
|
-
onFocus:
|
|
1272
|
+
onFocus: t43,
|
|
1221
1273
|
placeholder,
|
|
1222
1274
|
ref: inputElementRef,
|
|
1223
1275
|
tabIndex,
|
|
1224
1276
|
type: "text"
|
|
1225
1277
|
});
|
|
1226
|
-
$[
|
|
1227
|
-
$[
|
|
1228
|
-
$[
|
|
1229
|
-
$[
|
|
1230
|
-
$[
|
|
1231
|
-
$[
|
|
1232
|
-
$[
|
|
1233
|
-
$[
|
|
1234
|
-
$[
|
|
1235
|
-
} else
|
|
1236
|
-
trigger =
|
|
1278
|
+
$[96] = bodyId;
|
|
1279
|
+
$[97] = disabled;
|
|
1280
|
+
$[98] = isOpen;
|
|
1281
|
+
$[99] = name;
|
|
1282
|
+
$[100] = placeholder;
|
|
1283
|
+
$[101] = popupRole;
|
|
1284
|
+
$[102] = t42;
|
|
1285
|
+
$[103] = tabIndex;
|
|
1286
|
+
$[104] = t44;
|
|
1287
|
+
} else t44 = $[104];
|
|
1288
|
+
trigger = t44;
|
|
1237
1289
|
} else {
|
|
1238
|
-
let
|
|
1239
|
-
if ($[
|
|
1240
|
-
|
|
1290
|
+
let t42;
|
|
1291
|
+
if ($[105] !== bodyId || $[106] !== isOpen || $[107] !== popupRole || $[108] !== trigger) {
|
|
1292
|
+
t42 = /* @__PURE__ */ jsx("button", {
|
|
1241
1293
|
"aria-controls": bodyId,
|
|
1242
1294
|
"aria-expanded": isOpen,
|
|
1243
1295
|
"aria-haspopup": popupRole,
|
|
@@ -1246,82 +1298,82 @@ function RootDropdown(t0) {
|
|
|
1246
1298
|
type: "button",
|
|
1247
1299
|
children: trigger
|
|
1248
1300
|
});
|
|
1249
|
-
$[
|
|
1250
|
-
$[
|
|
1251
|
-
$[
|
|
1252
|
-
$[
|
|
1253
|
-
$[
|
|
1254
|
-
} else
|
|
1255
|
-
trigger =
|
|
1301
|
+
$[105] = bodyId;
|
|
1302
|
+
$[106] = isOpen;
|
|
1303
|
+
$[107] = popupRole;
|
|
1304
|
+
$[108] = trigger;
|
|
1305
|
+
$[109] = t42;
|
|
1306
|
+
} else t42 = $[109];
|
|
1307
|
+
trigger = t42;
|
|
1256
1308
|
}
|
|
1257
1309
|
else {
|
|
1258
1310
|
const triggerProps = trigger.props;
|
|
1259
|
-
const
|
|
1260
|
-
const
|
|
1261
|
-
const
|
|
1262
|
-
const
|
|
1263
|
-
let
|
|
1264
|
-
if ($[
|
|
1265
|
-
|
|
1266
|
-
"aria-controls":
|
|
1267
|
-
"aria-expanded":
|
|
1268
|
-
"aria-haspopup":
|
|
1311
|
+
const t42 = trigger;
|
|
1312
|
+
const t43 = triggerProps["aria-controls"] ?? bodyId;
|
|
1313
|
+
const t44 = triggerProps["aria-expanded"] ?? isOpen;
|
|
1314
|
+
const t45 = triggerProps["aria-haspopup"] ?? popupRole;
|
|
1315
|
+
let t46;
|
|
1316
|
+
if ($[110] !== t42 || $[111] !== t43 || $[112] !== t44 || $[113] !== t45) {
|
|
1317
|
+
t46 = cloneElement(t42, {
|
|
1318
|
+
"aria-controls": t43,
|
|
1319
|
+
"aria-expanded": t44,
|
|
1320
|
+
"aria-haspopup": t45
|
|
1269
1321
|
});
|
|
1270
|
-
$[
|
|
1271
|
-
$[
|
|
1272
|
-
$[
|
|
1273
|
-
$[
|
|
1274
|
-
$[
|
|
1275
|
-
} else
|
|
1276
|
-
trigger =
|
|
1322
|
+
$[110] = t42;
|
|
1323
|
+
$[111] = t43;
|
|
1324
|
+
$[112] = t44;
|
|
1325
|
+
$[113] = t45;
|
|
1326
|
+
$[114] = t46;
|
|
1327
|
+
} else t46 = $[114];
|
|
1328
|
+
trigger = t46;
|
|
1277
1329
|
}
|
|
1278
1330
|
if (label != null) {
|
|
1279
|
-
let
|
|
1280
|
-
if ($[
|
|
1281
|
-
|
|
1331
|
+
let t42;
|
|
1332
|
+
if ($[115] !== label) {
|
|
1333
|
+
t42 = /* @__PURE__ */ jsx("div", {
|
|
1282
1334
|
className: "uktdropdown-label-text",
|
|
1283
1335
|
children: label
|
|
1284
1336
|
});
|
|
1285
|
-
$[
|
|
1286
|
-
$[
|
|
1287
|
-
} else
|
|
1288
|
-
let
|
|
1289
|
-
if ($[
|
|
1290
|
-
|
|
1337
|
+
$[115] = label;
|
|
1338
|
+
$[116] = t42;
|
|
1339
|
+
} else t42 = $[116];
|
|
1340
|
+
let t43;
|
|
1341
|
+
if ($[117] !== t42 || $[118] !== trigger) {
|
|
1342
|
+
t43 = /* @__PURE__ */ jsxs("label", {
|
|
1291
1343
|
className: "uktdropdown-label",
|
|
1292
|
-
children: [
|
|
1344
|
+
children: [t42, trigger]
|
|
1293
1345
|
});
|
|
1294
|
-
$[
|
|
1295
|
-
$[
|
|
1296
|
-
$[
|
|
1297
|
-
} else
|
|
1298
|
-
trigger =
|
|
1346
|
+
$[117] = t42;
|
|
1347
|
+
$[118] = trigger;
|
|
1348
|
+
$[119] = t43;
|
|
1349
|
+
} else t43 = $[119];
|
|
1350
|
+
trigger = t43;
|
|
1299
1351
|
}
|
|
1300
|
-
let
|
|
1301
|
-
if ($[
|
|
1302
|
-
|
|
1352
|
+
let t42;
|
|
1353
|
+
if ($[120] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1354
|
+
t42 = /* @__PURE__ */ jsx("style", {
|
|
1303
1355
|
href: "@acusti/dropdown/Dropdown",
|
|
1304
1356
|
precedence: "medium",
|
|
1305
1357
|
children: Dropdown_default
|
|
1306
1358
|
});
|
|
1307
|
-
$[
|
|
1308
|
-
} else
|
|
1309
|
-
let
|
|
1310
|
-
if ($[
|
|
1311
|
-
|
|
1359
|
+
$[120] = t42;
|
|
1360
|
+
} else t42 = $[120];
|
|
1361
|
+
let t43;
|
|
1362
|
+
if ($[121] !== className || $[122] !== disabled || $[123] !== isOpen || $[124] !== isSearchable) {
|
|
1363
|
+
t43 = clsx("uktdropdown", className, {
|
|
1312
1364
|
disabled,
|
|
1313
1365
|
"is-open": isOpen,
|
|
1314
1366
|
"is-searchable": isSearchable
|
|
1315
1367
|
});
|
|
1316
|
-
$[
|
|
1317
|
-
$[
|
|
1318
|
-
$[
|
|
1319
|
-
$[
|
|
1320
|
-
$[
|
|
1321
|
-
} else
|
|
1322
|
-
let
|
|
1323
|
-
if ($[
|
|
1324
|
-
|
|
1368
|
+
$[121] = className;
|
|
1369
|
+
$[122] = disabled;
|
|
1370
|
+
$[123] = isOpen;
|
|
1371
|
+
$[124] = isSearchable;
|
|
1372
|
+
$[125] = t43;
|
|
1373
|
+
} else t43 = $[125];
|
|
1374
|
+
let t44;
|
|
1375
|
+
if ($[126] !== bodyId || $[127] !== children || $[128] !== childrenCount || $[129] !== hasItems || $[130] !== isOpen || $[131] !== popupRole) {
|
|
1376
|
+
t44 = isOpen ? /* @__PURE__ */ jsx("div", {
|
|
1325
1377
|
className: clsx("uktdropdown-body", { "has-items": hasItems }),
|
|
1326
1378
|
id: bodyId,
|
|
1327
1379
|
popover: "manual",
|
|
@@ -1335,42 +1387,46 @@ function RootDropdown(t0) {
|
|
|
1335
1387
|
})
|
|
1336
1388
|
})
|
|
1337
1389
|
}) : null;
|
|
1338
|
-
$[
|
|
1339
|
-
$[
|
|
1340
|
-
$[
|
|
1341
|
-
$[
|
|
1342
|
-
$[
|
|
1343
|
-
$[
|
|
1344
|
-
$[
|
|
1345
|
-
} else
|
|
1346
|
-
let
|
|
1347
|
-
if ($[
|
|
1348
|
-
|
|
1349
|
-
className:
|
|
1390
|
+
$[126] = bodyId;
|
|
1391
|
+
$[127] = children;
|
|
1392
|
+
$[128] = childrenCount;
|
|
1393
|
+
$[129] = hasItems;
|
|
1394
|
+
$[130] = isOpen;
|
|
1395
|
+
$[131] = popupRole;
|
|
1396
|
+
$[132] = t44;
|
|
1397
|
+
} else t44 = $[132];
|
|
1398
|
+
let t45;
|
|
1399
|
+
if ($[133] !== handleDropdownMouseEnter || $[134] !== handleDropdownMouseLeave || $[135] !== handleMouseDown || $[136] !== handleMouseMove || $[137] !== handleMouseOut || $[138] !== handleMouseOver || $[139] !== handleMouseUp || $[140] !== handleRef || $[141] !== onClick || $[142] !== styleFromProps || $[143] !== t43 || $[144] !== t44 || $[145] !== trigger) {
|
|
1400
|
+
t45 = /* @__PURE__ */ jsxs(Fragment, { children: [t42, /* @__PURE__ */ jsxs("div", {
|
|
1401
|
+
className: t43,
|
|
1350
1402
|
onClick,
|
|
1351
1403
|
onMouseDown: handleMouseDown,
|
|
1404
|
+
onMouseEnter: handleDropdownMouseEnter,
|
|
1405
|
+
onMouseLeave: handleDropdownMouseLeave,
|
|
1352
1406
|
onMouseMove: handleMouseMove,
|
|
1353
1407
|
onMouseOut: handleMouseOut,
|
|
1354
1408
|
onMouseOver: handleMouseOver,
|
|
1355
1409
|
onMouseUp: handleMouseUp,
|
|
1356
1410
|
ref: handleRef,
|
|
1357
1411
|
style: styleFromProps,
|
|
1358
|
-
children: [trigger,
|
|
1412
|
+
children: [trigger, t44]
|
|
1359
1413
|
})] });
|
|
1360
|
-
$[
|
|
1361
|
-
$[
|
|
1362
|
-
$[
|
|
1363
|
-
$[
|
|
1364
|
-
$[
|
|
1365
|
-
$[
|
|
1366
|
-
$[
|
|
1367
|
-
$[
|
|
1368
|
-
$[
|
|
1369
|
-
$[
|
|
1370
|
-
$[
|
|
1371
|
-
$[
|
|
1372
|
-
|
|
1373
|
-
|
|
1414
|
+
$[133] = handleDropdownMouseEnter;
|
|
1415
|
+
$[134] = handleDropdownMouseLeave;
|
|
1416
|
+
$[135] = handleMouseDown;
|
|
1417
|
+
$[136] = handleMouseMove;
|
|
1418
|
+
$[137] = handleMouseOut;
|
|
1419
|
+
$[138] = handleMouseOver;
|
|
1420
|
+
$[139] = handleMouseUp;
|
|
1421
|
+
$[140] = handleRef;
|
|
1422
|
+
$[141] = onClick;
|
|
1423
|
+
$[142] = styleFromProps;
|
|
1424
|
+
$[143] = t43;
|
|
1425
|
+
$[144] = t44;
|
|
1426
|
+
$[145] = trigger;
|
|
1427
|
+
$[146] = t45;
|
|
1428
|
+
} else t45 = $[146];
|
|
1429
|
+
return t45;
|
|
1374
1430
|
}
|
|
1375
1431
|
function _temp(ref_0) {
|
|
1376
1432
|
if (!ref_0) return;
|
|
@@ -1384,6 +1440,7 @@ var INERT_SUBMENU_PROPS = [
|
|
|
1384
1440
|
"isSearchable",
|
|
1385
1441
|
"keepOpenOnSubmit",
|
|
1386
1442
|
"name",
|
|
1443
|
+
"openOnHover",
|
|
1387
1444
|
"placeholder",
|
|
1388
1445
|
"tabIndex",
|
|
1389
1446
|
"value"
|