@acusti/dropdown 1.2.0 → 1.2.1
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 +363 -332
- package/dist/Dropdown.js.map +1 -1
- package/package.json +2 -2
package/dist/Dropdown.js
CHANGED
|
@@ -577,7 +577,7 @@ function Dropdown(props) {
|
|
|
577
577
|
return t0;
|
|
578
578
|
}
|
|
579
579
|
function RootDropdown(t0) {
|
|
580
|
-
const $ = c(
|
|
580
|
+
const $ = c(205);
|
|
581
581
|
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;
|
|
582
582
|
const allowEmpty = t1 === void 0 ? true : t1;
|
|
583
583
|
const hasItems = t2 === void 0 ? true : t2;
|
|
@@ -934,18 +934,28 @@ function RootDropdown(t0) {
|
|
|
934
934
|
let t30;
|
|
935
935
|
if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
|
|
936
936
|
t30 = () => {
|
|
937
|
+
if (closingTimerRef.current == null) return;
|
|
938
|
+
clearTimeout(closingTimerRef.current);
|
|
939
|
+
closingTimerRef.current = null;
|
|
940
|
+
};
|
|
941
|
+
$[47] = t30;
|
|
942
|
+
} else t30 = $[47];
|
|
943
|
+
const clearClosingTimer = t30;
|
|
944
|
+
let t31;
|
|
945
|
+
if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
|
|
946
|
+
t31 = () => {
|
|
937
947
|
isOpeningRef.current = false;
|
|
938
948
|
if (isOpeningTimerRef.current != null) {
|
|
939
949
|
clearTimeout(isOpeningTimerRef.current);
|
|
940
950
|
isOpeningTimerRef.current = null;
|
|
941
951
|
}
|
|
942
952
|
};
|
|
943
|
-
$[
|
|
944
|
-
} else
|
|
945
|
-
const endOpeningPress =
|
|
946
|
-
let
|
|
947
|
-
if ($[
|
|
948
|
-
|
|
953
|
+
$[48] = t31;
|
|
954
|
+
} else t31 = $[48];
|
|
955
|
+
const endOpeningPress = t31;
|
|
956
|
+
let t32;
|
|
957
|
+
if ($[49] !== dropdownElement || $[50] !== menubar) {
|
|
958
|
+
t32 = (options) => {
|
|
949
959
|
getTriggerElement(dropdownElement)?.removeAttribute("aria-activedescendant");
|
|
950
960
|
setIsOpen(false);
|
|
951
961
|
endOpeningPress();
|
|
@@ -955,56 +965,74 @@ function RootDropdown(t0) {
|
|
|
955
965
|
clearHoverCloseTimer();
|
|
956
966
|
safeAreaRef.current = null;
|
|
957
967
|
wasInSafeAreaRef.current = false;
|
|
958
|
-
|
|
959
|
-
clearTimeout(closingTimerRef.current);
|
|
960
|
-
closingTimerRef.current = null;
|
|
961
|
-
}
|
|
968
|
+
clearClosingTimer();
|
|
962
969
|
if (menubar && dropdownElement && !options?.keepMenubarEngaged) menubar.notifyClosed(dropdownElement);
|
|
963
970
|
};
|
|
964
|
-
$[
|
|
965
|
-
$[
|
|
966
|
-
$[
|
|
967
|
-
} else
|
|
968
|
-
const closeDropdown =
|
|
969
|
-
let
|
|
970
|
-
if ($[
|
|
971
|
-
|
|
971
|
+
$[49] = dropdownElement;
|
|
972
|
+
$[50] = menubar;
|
|
973
|
+
$[51] = t32;
|
|
974
|
+
} else t32 = $[51];
|
|
975
|
+
const closeDropdown = t32;
|
|
976
|
+
let t33;
|
|
977
|
+
if ($[52] !== closeDropdown) {
|
|
978
|
+
t33 = () => {
|
|
979
|
+
if (closingTimerRef.current != null) closeDropdown();
|
|
980
|
+
};
|
|
981
|
+
$[52] = closeDropdown;
|
|
982
|
+
$[53] = t33;
|
|
983
|
+
} else t33 = $[53];
|
|
984
|
+
const closeOnPendingSubmit = useEffectEvent(t33);
|
|
985
|
+
let t34;
|
|
986
|
+
if ($[54] !== closeOnPendingSubmit) {
|
|
987
|
+
t34 = () => () => closeOnPendingSubmit();
|
|
988
|
+
$[54] = closeOnPendingSubmit;
|
|
989
|
+
$[55] = t34;
|
|
990
|
+
} else t34 = $[55];
|
|
991
|
+
let t35;
|
|
992
|
+
if ($[56] === Symbol.for("react.memo_cache_sentinel")) {
|
|
993
|
+
t35 = [];
|
|
994
|
+
$[56] = t35;
|
|
995
|
+
} else t35 = $[56];
|
|
996
|
+
useEffect(t34, t35);
|
|
997
|
+
let t36;
|
|
998
|
+
if ($[57] !== disabled || $[58] !== openOnHover) {
|
|
999
|
+
t36 = () => {
|
|
972
1000
|
clearHoverCloseTimer();
|
|
973
1001
|
if (disabled || !openOnHover || isOpenRef.current) return;
|
|
974
1002
|
setIsOpen(true);
|
|
975
1003
|
endOpeningPress();
|
|
976
1004
|
};
|
|
977
|
-
$[
|
|
978
|
-
$[
|
|
979
|
-
$[
|
|
980
|
-
} else
|
|
981
|
-
const handleDropdownMouseEnter =
|
|
982
|
-
let
|
|
983
|
-
if ($[
|
|
984
|
-
|
|
1005
|
+
$[57] = disabled;
|
|
1006
|
+
$[58] = openOnHover;
|
|
1007
|
+
$[59] = t36;
|
|
1008
|
+
} else t36 = $[59];
|
|
1009
|
+
const handleDropdownMouseEnter = t36;
|
|
1010
|
+
let t37;
|
|
1011
|
+
if ($[60] !== closeDropdown || $[61] !== openOnHover) {
|
|
1012
|
+
t37 = () => {
|
|
985
1013
|
if (!openOnHover || !isOpenRef.current || hoverCloseTimerRef.current != null) return;
|
|
986
1014
|
hoverCloseTimerRef.current = setTimeout(() => {
|
|
987
1015
|
hoverCloseTimerRef.current = null;
|
|
988
1016
|
closeDropdown();
|
|
989
1017
|
}, HOVER_CLOSE_DELAY);
|
|
990
1018
|
};
|
|
991
|
-
$[
|
|
992
|
-
$[
|
|
993
|
-
$[
|
|
994
|
-
} else
|
|
995
|
-
const handleDropdownMouseLeave =
|
|
996
|
-
let
|
|
997
|
-
if ($[
|
|
998
|
-
|
|
1019
|
+
$[60] = closeDropdown;
|
|
1020
|
+
$[61] = openOnHover;
|
|
1021
|
+
$[62] = t37;
|
|
1022
|
+
} else t37 = $[62];
|
|
1023
|
+
const handleDropdownMouseLeave = t37;
|
|
1024
|
+
let t38;
|
|
1025
|
+
if ($[63] !== dropdownElement) {
|
|
1026
|
+
t38 = () => {
|
|
999
1027
|
getTriggerElement(dropdownElement)?.focus();
|
|
1000
1028
|
};
|
|
1001
|
-
$[
|
|
1002
|
-
$[
|
|
1003
|
-
} else
|
|
1004
|
-
const focusTrigger =
|
|
1005
|
-
let
|
|
1006
|
-
if ($[
|
|
1007
|
-
|
|
1029
|
+
$[63] = dropdownElement;
|
|
1030
|
+
$[64] = t38;
|
|
1031
|
+
} else t38 = $[64];
|
|
1032
|
+
const focusTrigger = t38;
|
|
1033
|
+
let t39;
|
|
1034
|
+
if ($[65] !== closeDropdown || $[66] !== disabled || $[67] !== dropdownElement || $[68] !== focusTrigger || $[69] !== isMenubarItem || $[70] !== menubar) {
|
|
1035
|
+
t39 = () => {
|
|
1008
1036
|
if (!menubar || !dropdownElement) return;
|
|
1009
1037
|
return menubar.registerMember({
|
|
1010
1038
|
close: () => closeDropdown({ keepMenubarEngaged: true }),
|
|
@@ -1019,39 +1047,39 @@ function RootDropdown(t0) {
|
|
|
1019
1047
|
}
|
|
1020
1048
|
});
|
|
1021
1049
|
};
|
|
1022
|
-
$[
|
|
1023
|
-
$[
|
|
1024
|
-
$[
|
|
1025
|
-
$[
|
|
1026
|
-
$[
|
|
1027
|
-
$[
|
|
1028
|
-
$[
|
|
1029
|
-
} else
|
|
1030
|
-
useEffect(
|
|
1031
|
-
let
|
|
1032
|
-
let
|
|
1033
|
-
if ($[
|
|
1034
|
-
|
|
1050
|
+
$[65] = closeDropdown;
|
|
1051
|
+
$[66] = disabled;
|
|
1052
|
+
$[67] = dropdownElement;
|
|
1053
|
+
$[68] = focusTrigger;
|
|
1054
|
+
$[69] = isMenubarItem;
|
|
1055
|
+
$[70] = menubar;
|
|
1056
|
+
$[71] = t39;
|
|
1057
|
+
} else t39 = $[71];
|
|
1058
|
+
useEffect(t39);
|
|
1059
|
+
let t40;
|
|
1060
|
+
let t41;
|
|
1061
|
+
if ($[72] !== dropdownElement || $[73] !== isOpen || $[74] !== menubar) {
|
|
1062
|
+
t40 = () => {
|
|
1035
1063
|
if (isOpen && menubar && dropdownElement) menubar.notifyOpened(dropdownElement);
|
|
1036
1064
|
};
|
|
1037
|
-
|
|
1065
|
+
t41 = [
|
|
1038
1066
|
dropdownElement,
|
|
1039
1067
|
isOpen,
|
|
1040
1068
|
menubar
|
|
1041
1069
|
];
|
|
1042
|
-
$[
|
|
1043
|
-
$[
|
|
1044
|
-
$[
|
|
1045
|
-
$[
|
|
1046
|
-
$[
|
|
1070
|
+
$[72] = dropdownElement;
|
|
1071
|
+
$[73] = isOpen;
|
|
1072
|
+
$[74] = menubar;
|
|
1073
|
+
$[75] = t40;
|
|
1074
|
+
$[76] = t41;
|
|
1047
1075
|
} else {
|
|
1048
|
-
|
|
1049
|
-
|
|
1076
|
+
t40 = $[75];
|
|
1077
|
+
t41 = $[76];
|
|
1050
1078
|
}
|
|
1051
|
-
useEffect(
|
|
1052
|
-
let
|
|
1053
|
-
if ($[
|
|
1054
|
-
|
|
1079
|
+
useEffect(t40, t41);
|
|
1080
|
+
let t42;
|
|
1081
|
+
if ($[77] !== allowCreate || $[78] !== allowEmpty || $[79] !== closeDropdown || $[80] !== dropdownElement || $[81] !== focusTrigger || $[82] !== handleActiveItem || $[83] !== hasItems || $[84] !== keepOpenOnSubmit || $[85] !== onSubmitItem || $[86] !== popupRole || $[87] !== valueIdentity) {
|
|
1082
|
+
t42 = (event_1) => {
|
|
1055
1083
|
const element_0 = hasItems ? getActiveItemElement(dropdownElement) : null;
|
|
1056
1084
|
const submenuOfActive = element_0 ? getSubmenuOfItem(element_0) : null;
|
|
1057
1085
|
if (element_0 && submenuOfActive) {
|
|
@@ -1068,11 +1096,14 @@ function RootDropdown(t0) {
|
|
|
1068
1096
|
}
|
|
1069
1097
|
return;
|
|
1070
1098
|
}
|
|
1071
|
-
if (isOpenRef.current && !keepOpenOnSubmit)
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1099
|
+
if (isOpenRef.current && !keepOpenOnSubmit) {
|
|
1100
|
+
clearClosingTimer();
|
|
1101
|
+
closingTimerRef.current = setTimeout(() => {
|
|
1102
|
+
const activeElement_0 = dropdownElement?.ownerDocument.activeElement;
|
|
1103
|
+
if (!hasItems && activeElement_0 && isInOwnBody(dropdownElement, activeElement_0)) focusTrigger();
|
|
1104
|
+
closeDropdown();
|
|
1105
|
+
}, 90);
|
|
1106
|
+
}
|
|
1076
1107
|
if (!hasItems) return;
|
|
1077
1108
|
if (!element_0) {
|
|
1078
1109
|
if (!inputElementRef.current) return;
|
|
@@ -1115,23 +1146,23 @@ function RootDropdown(t0) {
|
|
|
1115
1146
|
onSubmitItem?.(payload_1);
|
|
1116
1147
|
dispatchToSubmenus("onSubmitItem", payload_1);
|
|
1117
1148
|
};
|
|
1118
|
-
$[
|
|
1119
|
-
$[
|
|
1120
|
-
$[
|
|
1121
|
-
$[
|
|
1122
|
-
$[
|
|
1123
|
-
$[
|
|
1124
|
-
$[
|
|
1125
|
-
$[
|
|
1126
|
-
$[
|
|
1127
|
-
$[
|
|
1128
|
-
$[
|
|
1129
|
-
$[
|
|
1130
|
-
} else
|
|
1131
|
-
const handleSubmitItem =
|
|
1132
|
-
let
|
|
1133
|
-
if ($[
|
|
1134
|
-
|
|
1149
|
+
$[77] = allowCreate;
|
|
1150
|
+
$[78] = allowEmpty;
|
|
1151
|
+
$[79] = closeDropdown;
|
|
1152
|
+
$[80] = dropdownElement;
|
|
1153
|
+
$[81] = focusTrigger;
|
|
1154
|
+
$[82] = handleActiveItem;
|
|
1155
|
+
$[83] = hasItems;
|
|
1156
|
+
$[84] = keepOpenOnSubmit;
|
|
1157
|
+
$[85] = onSubmitItem;
|
|
1158
|
+
$[86] = popupRole;
|
|
1159
|
+
$[87] = valueIdentity;
|
|
1160
|
+
$[88] = t42;
|
|
1161
|
+
} else t42 = $[88];
|
|
1162
|
+
const handleSubmitItem = t42;
|
|
1163
|
+
let t43;
|
|
1164
|
+
if ($[89] !== trackSafeArea) {
|
|
1165
|
+
t43 = (event_2) => {
|
|
1135
1166
|
const { clientX, clientY } = event_2;
|
|
1136
1167
|
currentInputMethodRef.current = "mouse";
|
|
1137
1168
|
trackSafeArea(event_2);
|
|
@@ -1140,13 +1171,13 @@ function RootDropdown(t0) {
|
|
|
1140
1171
|
if (Math.abs(initialPosition.clientX - clientX) < 12 && Math.abs(initialPosition.clientY - clientY) < 12) return;
|
|
1141
1172
|
endOpeningPress();
|
|
1142
1173
|
};
|
|
1143
|
-
$[
|
|
1144
|
-
$[
|
|
1145
|
-
} else
|
|
1146
|
-
const handleMouseMove =
|
|
1147
|
-
let
|
|
1148
|
-
if ($[
|
|
1149
|
-
|
|
1174
|
+
$[89] = trackSafeArea;
|
|
1175
|
+
$[90] = t43;
|
|
1176
|
+
} else t43 = $[90];
|
|
1177
|
+
const handleMouseMove = t43;
|
|
1178
|
+
let t44;
|
|
1179
|
+
if ($[91] !== dropdownElement || $[92] !== handleActiveItem || $[93] !== hasItems || $[94] !== syncSubmenuDisclosure) {
|
|
1180
|
+
t44 = (event_3) => {
|
|
1150
1181
|
if (!hasItems) return;
|
|
1151
1182
|
if (currentInputMethodRef.current !== "mouse") return;
|
|
1152
1183
|
if (!dropdownElement) return;
|
|
@@ -1165,16 +1196,16 @@ function RootDropdown(t0) {
|
|
|
1165
1196
|
});
|
|
1166
1197
|
syncSubmenuDisclosure();
|
|
1167
1198
|
};
|
|
1168
|
-
$[
|
|
1169
|
-
$[
|
|
1170
|
-
$[
|
|
1171
|
-
$[
|
|
1172
|
-
$[
|
|
1173
|
-
} else
|
|
1174
|
-
const handleMouseOver =
|
|
1175
|
-
let
|
|
1176
|
-
if ($[
|
|
1177
|
-
|
|
1199
|
+
$[91] = dropdownElement;
|
|
1200
|
+
$[92] = handleActiveItem;
|
|
1201
|
+
$[93] = hasItems;
|
|
1202
|
+
$[94] = syncSubmenuDisclosure;
|
|
1203
|
+
$[95] = t44;
|
|
1204
|
+
} else t44 = $[95];
|
|
1205
|
+
const handleMouseOver = t44;
|
|
1206
|
+
let t45;
|
|
1207
|
+
if ($[96] !== dropdownElement || $[97] !== hasItems || $[98] !== syncSubmenuDisclosure) {
|
|
1208
|
+
t45 = (event_4) => {
|
|
1178
1209
|
if (!hasItems) return;
|
|
1179
1210
|
const relatedTarget = event_4.relatedTarget;
|
|
1180
1211
|
if (!dropdownElement?.contains(relatedTarget)) {
|
|
@@ -1190,15 +1221,15 @@ function RootDropdown(t0) {
|
|
|
1190
1221
|
clearActiveItems(dropdownElement, activeItem);
|
|
1191
1222
|
syncSubmenuDisclosure();
|
|
1192
1223
|
};
|
|
1193
|
-
$[
|
|
1194
|
-
$[
|
|
1195
|
-
$[
|
|
1196
|
-
$[
|
|
1197
|
-
} else
|
|
1198
|
-
const handleMouseOut =
|
|
1199
|
-
let
|
|
1200
|
-
if ($[
|
|
1201
|
-
|
|
1224
|
+
$[96] = dropdownElement;
|
|
1225
|
+
$[97] = hasItems;
|
|
1226
|
+
$[98] = syncSubmenuDisclosure;
|
|
1227
|
+
$[99] = t45;
|
|
1228
|
+
} else t45 = $[99];
|
|
1229
|
+
const handleMouseOut = t45;
|
|
1230
|
+
let t46;
|
|
1231
|
+
if ($[100] !== disabled || $[101] !== onMouseDown) {
|
|
1232
|
+
t46 = (event_5) => {
|
|
1202
1233
|
if (onMouseDown) onMouseDown(event_5);
|
|
1203
1234
|
if (disabled || isOpenRef.current) return;
|
|
1204
1235
|
setIsOpen(true);
|
|
@@ -1212,14 +1243,14 @@ function RootDropdown(t0) {
|
|
|
1212
1243
|
isOpeningTimerRef.current = null;
|
|
1213
1244
|
}, 1e3);
|
|
1214
1245
|
};
|
|
1215
|
-
$[
|
|
1216
|
-
$[
|
|
1217
|
-
$[
|
|
1218
|
-
} else
|
|
1219
|
-
const handleMouseDown =
|
|
1220
|
-
let
|
|
1221
|
-
if ($[
|
|
1222
|
-
|
|
1246
|
+
$[100] = disabled;
|
|
1247
|
+
$[101] = onMouseDown;
|
|
1248
|
+
$[102] = t46;
|
|
1249
|
+
} else t46 = $[102];
|
|
1250
|
+
const handleMouseDown = t46;
|
|
1251
|
+
let t47;
|
|
1252
|
+
if ($[103] !== closeDropdown || $[104] !== dropdownElement || $[105] !== handleActiveItem || $[106] !== handleSubmitItem || $[107] !== hasItems || $[108] !== onMouseUp) {
|
|
1253
|
+
t47 = (event_6) => {
|
|
1223
1254
|
if (onMouseUp) onMouseUp(event_6);
|
|
1224
1255
|
if (isOpeningRef.current || !isOpenRef.current || closingTimerRef.current != null) return;
|
|
1225
1256
|
const eventTarget_1 = event_6.target;
|
|
@@ -1242,18 +1273,18 @@ function RootDropdown(t0) {
|
|
|
1242
1273
|
}
|
|
1243
1274
|
handleSubmitItem(event_6);
|
|
1244
1275
|
};
|
|
1245
|
-
$[
|
|
1246
|
-
$[
|
|
1247
|
-
$[
|
|
1248
|
-
$[
|
|
1249
|
-
$[
|
|
1250
|
-
$[
|
|
1251
|
-
$[
|
|
1252
|
-
} else
|
|
1253
|
-
const handleMouseUp =
|
|
1254
|
-
let
|
|
1255
|
-
if ($[
|
|
1256
|
-
|
|
1276
|
+
$[103] = closeDropdown;
|
|
1277
|
+
$[104] = dropdownElement;
|
|
1278
|
+
$[105] = handleActiveItem;
|
|
1279
|
+
$[106] = handleSubmitItem;
|
|
1280
|
+
$[107] = hasItems;
|
|
1281
|
+
$[108] = onMouseUp;
|
|
1282
|
+
$[109] = t47;
|
|
1283
|
+
} else t47 = $[109];
|
|
1284
|
+
const handleMouseUp = t47;
|
|
1285
|
+
let t48;
|
|
1286
|
+
if ($[110] !== allowCreate || $[111] !== closeDropdown || $[112] !== disabled || $[113] !== dropdownElement || $[114] !== focusTrigger || $[115] !== handleActiveItem || $[116] !== handleSubmitItem || $[117] !== hasItems || $[118] !== menubar || $[119] !== syncSubmenuDisclosure) {
|
|
1287
|
+
t48 = (event_7) => {
|
|
1257
1288
|
const { altKey, ctrlKey, key: key_0, metaKey } = event_7;
|
|
1258
1289
|
const eventTarget_2 = event_7.target;
|
|
1259
1290
|
if (!dropdownElement) return;
|
|
@@ -1413,44 +1444,44 @@ function RootDropdown(t0) {
|
|
|
1413
1444
|
}
|
|
1414
1445
|
}
|
|
1415
1446
|
};
|
|
1416
|
-
$[
|
|
1417
|
-
$[
|
|
1418
|
-
$[
|
|
1419
|
-
$[
|
|
1420
|
-
$[
|
|
1421
|
-
$[
|
|
1422
|
-
$[
|
|
1423
|
-
$[
|
|
1424
|
-
$[
|
|
1425
|
-
$[
|
|
1426
|
-
$[
|
|
1427
|
-
} else
|
|
1428
|
-
const handleKeyDown =
|
|
1429
|
-
let
|
|
1430
|
-
if ($[
|
|
1431
|
-
|
|
1447
|
+
$[110] = allowCreate;
|
|
1448
|
+
$[111] = closeDropdown;
|
|
1449
|
+
$[112] = disabled;
|
|
1450
|
+
$[113] = dropdownElement;
|
|
1451
|
+
$[114] = focusTrigger;
|
|
1452
|
+
$[115] = handleActiveItem;
|
|
1453
|
+
$[116] = handleSubmitItem;
|
|
1454
|
+
$[117] = hasItems;
|
|
1455
|
+
$[118] = menubar;
|
|
1456
|
+
$[119] = syncSubmenuDisclosure;
|
|
1457
|
+
$[120] = t48;
|
|
1458
|
+
} else t48 = $[120];
|
|
1459
|
+
const handleKeyDown = t48;
|
|
1460
|
+
let t49;
|
|
1461
|
+
if ($[121] !== handleKeyDown) {
|
|
1462
|
+
t49 = {
|
|
1432
1463
|
ignoreUsedKeyboardEvents: false,
|
|
1433
1464
|
onKeyDown: handleKeyDown
|
|
1434
1465
|
};
|
|
1435
|
-
$[
|
|
1436
|
-
$[
|
|
1437
|
-
} else
|
|
1438
|
-
useKeyboardEvents(
|
|
1439
|
-
let
|
|
1440
|
-
if ($[
|
|
1441
|
-
|
|
1466
|
+
$[121] = handleKeyDown;
|
|
1467
|
+
$[122] = t49;
|
|
1468
|
+
} else t49 = $[122];
|
|
1469
|
+
useKeyboardEvents(t49);
|
|
1470
|
+
let t50;
|
|
1471
|
+
if ($[123] !== dropdownElement || $[124] !== handleSubmitItem || $[125] !== hasItems) {
|
|
1472
|
+
t50 = (event_8) => {
|
|
1442
1473
|
if (hasItems || !isInOwnBody(dropdownElement, event_8.target)) return;
|
|
1443
1474
|
handleSubmitItem(event_8);
|
|
1444
1475
|
};
|
|
1445
|
-
$[
|
|
1446
|
-
$[
|
|
1447
|
-
$[
|
|
1448
|
-
$[
|
|
1449
|
-
} else
|
|
1450
|
-
const handleBodySubmit =
|
|
1451
|
-
let
|
|
1452
|
-
if ($[
|
|
1453
|
-
|
|
1476
|
+
$[123] = dropdownElement;
|
|
1477
|
+
$[124] = handleSubmitItem;
|
|
1478
|
+
$[125] = hasItems;
|
|
1479
|
+
$[126] = t50;
|
|
1480
|
+
} else t50 = $[126];
|
|
1481
|
+
const handleBodySubmit = t50;
|
|
1482
|
+
let t51;
|
|
1483
|
+
if ($[127] !== allowCreate || $[128] !== closeDropdown || $[129] !== disabled || $[130] !== handleActiveItem) {
|
|
1484
|
+
t51 = (ref) => {
|
|
1454
1485
|
setDropdownElement(ref);
|
|
1455
1486
|
if (!ref) return;
|
|
1456
1487
|
const { ownerDocument } = ref;
|
|
@@ -1460,13 +1491,13 @@ function RootDropdown(t0) {
|
|
|
1460
1491
|
else inputElement = ref.firstElementChild.querySelector(TEXT_INPUT_SELECTOR);
|
|
1461
1492
|
inputElementRef.current = inputElement;
|
|
1462
1493
|
}
|
|
1463
|
-
const handleGlobalMouseDown = (
|
|
1464
|
-
const { target: target_1 } =
|
|
1494
|
+
const handleGlobalMouseDown = (t52) => {
|
|
1495
|
+
const { target: target_1 } = t52;
|
|
1465
1496
|
const eventTarget_3 = target_1;
|
|
1466
1497
|
if (!ref.contains(eventTarget_3)) closeDropdown();
|
|
1467
1498
|
};
|
|
1468
|
-
const handleGlobalMouseUp = (
|
|
1469
|
-
const { target: target_2 } =
|
|
1499
|
+
const handleGlobalMouseUp = (t53) => {
|
|
1500
|
+
const { target: target_2 } = t53;
|
|
1470
1501
|
if (!isOpenRef.current || closingTimerRef.current != null) return;
|
|
1471
1502
|
if (isOpeningRef.current) {
|
|
1472
1503
|
endOpeningPress();
|
|
@@ -1475,8 +1506,8 @@ function RootDropdown(t0) {
|
|
|
1475
1506
|
const eventTarget_4 = target_2;
|
|
1476
1507
|
if (!ref.contains(eventTarget_4)) closeDropdown();
|
|
1477
1508
|
};
|
|
1478
|
-
const handleGlobalFocusIn = (
|
|
1479
|
-
const { target: target_3 } =
|
|
1509
|
+
const handleGlobalFocusIn = (t54) => {
|
|
1510
|
+
const { target: target_3 } = t54;
|
|
1480
1511
|
if (!isOpenRef.current) return;
|
|
1481
1512
|
const eventTarget_5 = target_3;
|
|
1482
1513
|
if (ref.contains(eventTarget_5) || eventTarget_5.contains(ref)) return;
|
|
@@ -1518,16 +1549,16 @@ function RootDropdown(t0) {
|
|
|
1518
1549
|
if (inputElement) inputElement.removeEventListener("input", handleInput);
|
|
1519
1550
|
};
|
|
1520
1551
|
};
|
|
1521
|
-
$[
|
|
1522
|
-
$[
|
|
1523
|
-
$[
|
|
1524
|
-
$[
|
|
1525
|
-
$[
|
|
1526
|
-
} else
|
|
1527
|
-
const handleRef =
|
|
1528
|
-
let
|
|
1529
|
-
if ($[
|
|
1530
|
-
|
|
1552
|
+
$[127] = allowCreate;
|
|
1553
|
+
$[128] = closeDropdown;
|
|
1554
|
+
$[129] = disabled;
|
|
1555
|
+
$[130] = handleActiveItem;
|
|
1556
|
+
$[131] = t51;
|
|
1557
|
+
} else t51 = $[131];
|
|
1558
|
+
const handleRef = t51;
|
|
1559
|
+
let t52;
|
|
1560
|
+
if ($[132] !== dropdownElement || $[133] !== popupRole || $[134] !== valueIdentity) {
|
|
1561
|
+
t52 = (ref_0) => {
|
|
1531
1562
|
if (!ref_0) return;
|
|
1532
1563
|
if (annotatedElementsRef.current.has(ref_0)) return;
|
|
1533
1564
|
annotatedElementsRef.current.add(ref_0);
|
|
@@ -1545,82 +1576,82 @@ function RootDropdown(t0) {
|
|
|
1545
1576
|
}
|
|
1546
1577
|
}
|
|
1547
1578
|
};
|
|
1548
|
-
$[
|
|
1549
|
-
$[
|
|
1550
|
-
$[
|
|
1551
|
-
$[
|
|
1552
|
-
} else
|
|
1553
|
-
const handleBodyRef =
|
|
1579
|
+
$[132] = dropdownElement;
|
|
1580
|
+
$[133] = popupRole;
|
|
1581
|
+
$[134] = valueIdentity;
|
|
1582
|
+
$[135] = t52;
|
|
1583
|
+
} else t52 = $[135];
|
|
1584
|
+
const handleBodyRef = t52;
|
|
1554
1585
|
let bodyLabelledBy;
|
|
1555
1586
|
if (!isValidElement(trigger)) {
|
|
1556
1587
|
if (isSearchable) {
|
|
1557
|
-
const
|
|
1558
|
-
let
|
|
1559
|
-
if ($[
|
|
1560
|
-
|
|
1561
|
-
$[
|
|
1562
|
-
} else
|
|
1563
|
-
let
|
|
1564
|
-
if ($[
|
|
1565
|
-
|
|
1588
|
+
const t53 = valueLabel ?? "";
|
|
1589
|
+
let t54;
|
|
1590
|
+
if ($[136] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1591
|
+
t54 = () => setIsOpen(true);
|
|
1592
|
+
$[136] = t54;
|
|
1593
|
+
} else t54 = $[136];
|
|
1594
|
+
let t55;
|
|
1595
|
+
if ($[137] !== bodyId || $[138] !== disabled || $[139] !== isOpen || $[140] !== name || $[141] !== placeholder || $[142] !== popupRole || $[143] !== t53 || $[144] !== tabIndex || $[145] !== triggerId) {
|
|
1596
|
+
t55 = /* @__PURE__ */ jsx("input", {
|
|
1566
1597
|
"aria-autocomplete": "list",
|
|
1567
1598
|
"aria-controls": bodyId,
|
|
1568
1599
|
"aria-expanded": isOpen,
|
|
1569
1600
|
"aria-haspopup": popupRole,
|
|
1570
1601
|
autoComplete: "off",
|
|
1571
1602
|
className: "uktdropdown-trigger",
|
|
1572
|
-
defaultValue:
|
|
1603
|
+
defaultValue: t53,
|
|
1573
1604
|
disabled,
|
|
1574
1605
|
id: triggerId,
|
|
1575
1606
|
name,
|
|
1576
|
-
onFocus:
|
|
1607
|
+
onFocus: t54,
|
|
1577
1608
|
placeholder,
|
|
1578
1609
|
ref: inputElementRef,
|
|
1579
1610
|
role: "combobox",
|
|
1580
1611
|
tabIndex,
|
|
1581
1612
|
type: "text"
|
|
1582
1613
|
});
|
|
1583
|
-
$[
|
|
1584
|
-
$[
|
|
1585
|
-
$[
|
|
1586
|
-
$[
|
|
1587
|
-
$[
|
|
1588
|
-
$[
|
|
1589
|
-
$[
|
|
1590
|
-
$[
|
|
1591
|
-
$[
|
|
1592
|
-
$[
|
|
1593
|
-
} else
|
|
1594
|
-
trigger =
|
|
1614
|
+
$[137] = bodyId;
|
|
1615
|
+
$[138] = disabled;
|
|
1616
|
+
$[139] = isOpen;
|
|
1617
|
+
$[140] = name;
|
|
1618
|
+
$[141] = placeholder;
|
|
1619
|
+
$[142] = popupRole;
|
|
1620
|
+
$[143] = t53;
|
|
1621
|
+
$[144] = tabIndex;
|
|
1622
|
+
$[145] = triggerId;
|
|
1623
|
+
$[146] = t55;
|
|
1624
|
+
} else t55 = $[146];
|
|
1625
|
+
trigger = t55;
|
|
1595
1626
|
} else {
|
|
1596
1627
|
bodyLabelledBy = triggerId;
|
|
1597
|
-
const
|
|
1598
|
-
const
|
|
1599
|
-
let
|
|
1600
|
-
if ($[
|
|
1601
|
-
|
|
1628
|
+
const t53 = isMenubarItem ? "menuitem" : void 0;
|
|
1629
|
+
const t54 = menubarTabIndex ?? 0;
|
|
1630
|
+
let t55;
|
|
1631
|
+
if ($[147] !== bodyId || $[148] !== disabled || $[149] !== isOpen || $[150] !== popupRole || $[151] !== t53 || $[152] !== t54 || $[153] !== trigger || $[154] !== triggerId) {
|
|
1632
|
+
t55 = /* @__PURE__ */ jsx("button", {
|
|
1602
1633
|
"aria-controls": bodyId,
|
|
1603
1634
|
"aria-expanded": isOpen,
|
|
1604
1635
|
"aria-haspopup": popupRole,
|
|
1605
1636
|
className: "uktdropdown-trigger",
|
|
1606
1637
|
disabled,
|
|
1607
1638
|
id: triggerId,
|
|
1608
|
-
role:
|
|
1609
|
-
tabIndex:
|
|
1639
|
+
role: t53,
|
|
1640
|
+
tabIndex: t54,
|
|
1610
1641
|
type: "button",
|
|
1611
1642
|
children: trigger
|
|
1612
1643
|
});
|
|
1613
|
-
$[
|
|
1614
|
-
$[
|
|
1615
|
-
$[
|
|
1616
|
-
$[
|
|
1617
|
-
$[
|
|
1618
|
-
$[
|
|
1619
|
-
$[
|
|
1620
|
-
$[
|
|
1621
|
-
$[
|
|
1622
|
-
} else
|
|
1623
|
-
trigger =
|
|
1644
|
+
$[147] = bodyId;
|
|
1645
|
+
$[148] = disabled;
|
|
1646
|
+
$[149] = isOpen;
|
|
1647
|
+
$[150] = popupRole;
|
|
1648
|
+
$[151] = t53;
|
|
1649
|
+
$[152] = t54;
|
|
1650
|
+
$[153] = trigger;
|
|
1651
|
+
$[154] = triggerId;
|
|
1652
|
+
$[155] = t55;
|
|
1653
|
+
} else t55 = $[155];
|
|
1654
|
+
trigger = t55;
|
|
1624
1655
|
}
|
|
1625
1656
|
} else {
|
|
1626
1657
|
const triggerProps = trigger.props;
|
|
@@ -1630,95 +1661,95 @@ function RootDropdown(t0) {
|
|
|
1630
1661
|
const isCombobox = isSearchable && isTextInputTrigger && trigger.type !== "textarea";
|
|
1631
1662
|
const triggerRole = triggerProps.role ?? (isCombobox ? "combobox" : isMenubarItem ? "menuitem" : void 0);
|
|
1632
1663
|
const canExpand = !isTextInputTrigger || triggerRole != null;
|
|
1633
|
-
const
|
|
1634
|
-
const
|
|
1635
|
-
const
|
|
1636
|
-
const
|
|
1637
|
-
const
|
|
1638
|
-
const
|
|
1639
|
-
const
|
|
1640
|
-
let
|
|
1641
|
-
if ($[
|
|
1642
|
-
|
|
1643
|
-
"aria-autocomplete":
|
|
1644
|
-
"aria-controls":
|
|
1645
|
-
"aria-disabled":
|
|
1646
|
-
"aria-expanded":
|
|
1647
|
-
"aria-haspopup":
|
|
1664
|
+
const t53 = trigger;
|
|
1665
|
+
const t54 = triggerProps["aria-autocomplete"] ?? (isCombobox ? "list" : void 0);
|
|
1666
|
+
const t55 = triggerProps["aria-controls"] ?? bodyId;
|
|
1667
|
+
const t56 = triggerProps["aria-disabled"] ?? (disabled || void 0);
|
|
1668
|
+
const t57 = triggerProps["aria-expanded"] ?? (canExpand ? isOpen : void 0);
|
|
1669
|
+
const t58 = triggerProps["aria-haspopup"] ?? popupRole;
|
|
1670
|
+
const t59 = triggerProps.tabIndex ?? menubarTabIndex;
|
|
1671
|
+
let t60;
|
|
1672
|
+
if ($[156] !== resolvedTriggerId || $[157] !== t53 || $[158] !== t54 || $[159] !== t55 || $[160] !== t56 || $[161] !== t57 || $[162] !== t58 || $[163] !== t59 || $[164] !== triggerRole) {
|
|
1673
|
+
t60 = cloneElement(t53, {
|
|
1674
|
+
"aria-autocomplete": t54,
|
|
1675
|
+
"aria-controls": t55,
|
|
1676
|
+
"aria-disabled": t56,
|
|
1677
|
+
"aria-expanded": t57,
|
|
1678
|
+
"aria-haspopup": t58,
|
|
1648
1679
|
id: resolvedTriggerId,
|
|
1649
1680
|
role: triggerRole,
|
|
1650
|
-
tabIndex:
|
|
1681
|
+
tabIndex: t59
|
|
1651
1682
|
});
|
|
1652
|
-
$[
|
|
1653
|
-
$[
|
|
1654
|
-
$[
|
|
1655
|
-
$[
|
|
1656
|
-
$[
|
|
1657
|
-
$[
|
|
1658
|
-
$[
|
|
1659
|
-
$[
|
|
1660
|
-
$[
|
|
1661
|
-
$[
|
|
1662
|
-
} else
|
|
1663
|
-
trigger =
|
|
1683
|
+
$[156] = resolvedTriggerId;
|
|
1684
|
+
$[157] = t53;
|
|
1685
|
+
$[158] = t54;
|
|
1686
|
+
$[159] = t55;
|
|
1687
|
+
$[160] = t56;
|
|
1688
|
+
$[161] = t57;
|
|
1689
|
+
$[162] = t58;
|
|
1690
|
+
$[163] = t59;
|
|
1691
|
+
$[164] = triggerRole;
|
|
1692
|
+
$[165] = t60;
|
|
1693
|
+
} else t60 = $[165];
|
|
1694
|
+
trigger = t60;
|
|
1664
1695
|
}
|
|
1665
1696
|
if (label != null) {
|
|
1666
1697
|
bodyLabelledBy = labelId;
|
|
1667
|
-
const
|
|
1668
|
-
const
|
|
1669
|
-
let
|
|
1670
|
-
if ($[
|
|
1671
|
-
|
|
1698
|
+
const t53 = isMenubarMember ? "none" : void 0;
|
|
1699
|
+
const t54 = isMenubarMember ? "none" : void 0;
|
|
1700
|
+
let t55;
|
|
1701
|
+
if ($[166] !== label || $[167] !== labelId || $[168] !== t54) {
|
|
1702
|
+
t55 = /* @__PURE__ */ jsx("div", {
|
|
1672
1703
|
className: "uktdropdown-label-text",
|
|
1673
1704
|
id: labelId,
|
|
1674
|
-
role:
|
|
1705
|
+
role: t54,
|
|
1675
1706
|
children: label
|
|
1676
1707
|
});
|
|
1677
|
-
$[
|
|
1678
|
-
$[
|
|
1679
|
-
$[
|
|
1680
|
-
$[
|
|
1681
|
-
} else
|
|
1682
|
-
let
|
|
1683
|
-
if ($[
|
|
1684
|
-
|
|
1708
|
+
$[166] = label;
|
|
1709
|
+
$[167] = labelId;
|
|
1710
|
+
$[168] = t54;
|
|
1711
|
+
$[169] = t55;
|
|
1712
|
+
} else t55 = $[169];
|
|
1713
|
+
let t56;
|
|
1714
|
+
if ($[170] !== t53 || $[171] !== t55 || $[172] !== trigger) {
|
|
1715
|
+
t56 = /* @__PURE__ */ jsxs("label", {
|
|
1685
1716
|
className: "uktdropdown-label",
|
|
1686
|
-
role:
|
|
1687
|
-
children: [
|
|
1717
|
+
role: t53,
|
|
1718
|
+
children: [t55, trigger]
|
|
1688
1719
|
});
|
|
1689
|
-
$[
|
|
1690
|
-
$[
|
|
1691
|
-
$[
|
|
1692
|
-
$[
|
|
1693
|
-
} else
|
|
1694
|
-
trigger =
|
|
1720
|
+
$[170] = t53;
|
|
1721
|
+
$[171] = t55;
|
|
1722
|
+
$[172] = trigger;
|
|
1723
|
+
$[173] = t56;
|
|
1724
|
+
} else t56 = $[173];
|
|
1725
|
+
trigger = t56;
|
|
1695
1726
|
}
|
|
1696
|
-
let
|
|
1697
|
-
if ($[
|
|
1698
|
-
|
|
1727
|
+
let t53;
|
|
1728
|
+
if ($[174] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1729
|
+
t53 = /* @__PURE__ */ jsx("style", {
|
|
1699
1730
|
href: "@acusti/dropdown/Dropdown",
|
|
1700
1731
|
precedence: "medium",
|
|
1701
1732
|
children: Dropdown_default
|
|
1702
1733
|
});
|
|
1703
|
-
$[
|
|
1704
|
-
} else
|
|
1705
|
-
let
|
|
1706
|
-
if ($[
|
|
1707
|
-
|
|
1734
|
+
$[174] = t53;
|
|
1735
|
+
} else t53 = $[174];
|
|
1736
|
+
let t54;
|
|
1737
|
+
if ($[175] !== className || $[176] !== disabled || $[177] !== isOpen || $[178] !== isSearchable) {
|
|
1738
|
+
t54 = clsx("uktdropdown", className, {
|
|
1708
1739
|
"is-disabled": disabled,
|
|
1709
1740
|
"is-open": isOpen,
|
|
1710
1741
|
"is-searchable": isSearchable
|
|
1711
1742
|
});
|
|
1712
|
-
$[
|
|
1713
|
-
$[
|
|
1714
|
-
$[
|
|
1715
|
-
$[
|
|
1716
|
-
$[
|
|
1717
|
-
} else
|
|
1718
|
-
const
|
|
1719
|
-
let
|
|
1720
|
-
if ($[
|
|
1721
|
-
|
|
1743
|
+
$[175] = className;
|
|
1744
|
+
$[176] = disabled;
|
|
1745
|
+
$[177] = isOpen;
|
|
1746
|
+
$[178] = isSearchable;
|
|
1747
|
+
$[179] = t54;
|
|
1748
|
+
} else t54 = $[179];
|
|
1749
|
+
const t55 = isMenubarMember ? "none" : void 0;
|
|
1750
|
+
let t56;
|
|
1751
|
+
if ($[180] !== body || $[181] !== bodyId || $[182] !== bodyLabelledBy || $[183] !== dropdownContextValue || $[184] !== handleBodyRef || $[185] !== handleBodySubmit || $[186] !== hasItems || $[187] !== isOpen || $[188] !== popupRole) {
|
|
1752
|
+
t56 = isOpen ? /* @__PURE__ */ jsx("div", {
|
|
1722
1753
|
"aria-labelledby": bodyLabelledBy,
|
|
1723
1754
|
className: clsx("uktdropdown-body", { "has-items": hasItems }),
|
|
1724
1755
|
id: bodyId,
|
|
@@ -1734,23 +1765,23 @@ function RootDropdown(t0) {
|
|
|
1734
1765
|
})
|
|
1735
1766
|
})
|
|
1736
1767
|
}) : null;
|
|
1737
|
-
$[
|
|
1738
|
-
$[
|
|
1739
|
-
$[
|
|
1740
|
-
$[
|
|
1741
|
-
$[
|
|
1742
|
-
$[
|
|
1743
|
-
$[
|
|
1744
|
-
$[
|
|
1745
|
-
$[
|
|
1746
|
-
$[
|
|
1747
|
-
} else
|
|
1748
|
-
let
|
|
1749
|
-
if ($[
|
|
1750
|
-
|
|
1751
|
-
className:
|
|
1768
|
+
$[180] = body;
|
|
1769
|
+
$[181] = bodyId;
|
|
1770
|
+
$[182] = bodyLabelledBy;
|
|
1771
|
+
$[183] = dropdownContextValue;
|
|
1772
|
+
$[184] = handleBodyRef;
|
|
1773
|
+
$[185] = handleBodySubmit;
|
|
1774
|
+
$[186] = hasItems;
|
|
1775
|
+
$[187] = isOpen;
|
|
1776
|
+
$[188] = popupRole;
|
|
1777
|
+
$[189] = t56;
|
|
1778
|
+
} else t56 = $[189];
|
|
1779
|
+
let t57;
|
|
1780
|
+
if ($[190] !== handleDropdownMouseEnter || $[191] !== handleDropdownMouseLeave || $[192] !== handleMouseDown || $[193] !== handleMouseMove || $[194] !== handleMouseOut || $[195] !== handleMouseOver || $[196] !== handleMouseUp || $[197] !== handleRef || $[198] !== onClick || $[199] !== styleFromProps || $[200] !== t54 || $[201] !== t55 || $[202] !== t56 || $[203] !== trigger) {
|
|
1781
|
+
t57 = /* @__PURE__ */ jsxs(Fragment, { children: [t53, /* @__PURE__ */ jsxs("div", {
|
|
1782
|
+
className: t54,
|
|
1752
1783
|
onClick,
|
|
1753
|
-
role:
|
|
1784
|
+
role: t55,
|
|
1754
1785
|
onMouseDown: handleMouseDown,
|
|
1755
1786
|
onMouseEnter: handleDropdownMouseEnter,
|
|
1756
1787
|
onMouseLeave: handleDropdownMouseLeave,
|
|
@@ -1760,25 +1791,25 @@ function RootDropdown(t0) {
|
|
|
1760
1791
|
onMouseUp: handleMouseUp,
|
|
1761
1792
|
ref: handleRef,
|
|
1762
1793
|
style: styleFromProps,
|
|
1763
|
-
children: [trigger,
|
|
1794
|
+
children: [trigger, t56]
|
|
1764
1795
|
})] });
|
|
1765
|
-
$[
|
|
1766
|
-
$[
|
|
1767
|
-
$[
|
|
1768
|
-
$[
|
|
1769
|
-
$[
|
|
1770
|
-
$[
|
|
1771
|
-
$[
|
|
1772
|
-
$[
|
|
1773
|
-
$[
|
|
1774
|
-
$[
|
|
1775
|
-
$[
|
|
1776
|
-
$[
|
|
1777
|
-
$[
|
|
1778
|
-
$[
|
|
1779
|
-
$[
|
|
1780
|
-
} else
|
|
1781
|
-
return
|
|
1796
|
+
$[190] = handleDropdownMouseEnter;
|
|
1797
|
+
$[191] = handleDropdownMouseLeave;
|
|
1798
|
+
$[192] = handleMouseDown;
|
|
1799
|
+
$[193] = handleMouseMove;
|
|
1800
|
+
$[194] = handleMouseOut;
|
|
1801
|
+
$[195] = handleMouseOver;
|
|
1802
|
+
$[196] = handleMouseUp;
|
|
1803
|
+
$[197] = handleRef;
|
|
1804
|
+
$[198] = onClick;
|
|
1805
|
+
$[199] = styleFromProps;
|
|
1806
|
+
$[200] = t54;
|
|
1807
|
+
$[201] = t55;
|
|
1808
|
+
$[202] = t56;
|
|
1809
|
+
$[203] = trigger;
|
|
1810
|
+
$[204] = t57;
|
|
1811
|
+
} else t57 = $[204];
|
|
1812
|
+
return t57;
|
|
1782
1813
|
}
|
|
1783
1814
|
var INERT_SUBMENU_PROPS = [
|
|
1784
1815
|
"allowCreate",
|