@acusti/dropdown 1.0.0 → 1.1.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/README.md +67 -4
- package/dist/Dropdown.d.ts +7 -3
- package/dist/Dropdown.js +282 -237
- package/dist/Dropdown.js.map +1 -1
- package/dist/helpers.d.ts +5 -0
- package/package.json +2 -2
package/dist/Dropdown.js
CHANGED
|
@@ -19,6 +19,18 @@ var LIST_CONTAINER_SELECTOR = "menu, ol, ul";
|
|
|
19
19
|
var DISABLED_ITEM_SELECTOR = "[aria-disabled=\"true\"]";
|
|
20
20
|
var FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, [tabindex]";
|
|
21
21
|
var getBodyElement = (dropdownElement) => dropdownElement?.querySelector(".uktdropdown-body") ?? null;
|
|
22
|
+
var isInOwnBody = (dropdownElement, element) => {
|
|
23
|
+
const bodyElement = element.closest(BODY_SELECTOR);
|
|
24
|
+
return bodyElement != null && bodyElement.closest(".uktdropdown") === dropdownElement;
|
|
25
|
+
};
|
|
26
|
+
var isFormlessTextInput = (element) => {
|
|
27
|
+
if (element.tagName !== "INPUT") return false;
|
|
28
|
+
const { form, type } = element;
|
|
29
|
+
return form == null && !NON_TEXT_INPUT_TYPES.includes(type);
|
|
30
|
+
};
|
|
31
|
+
var isMultilineTextField = (element) => element.tagName === "TEXTAREA" || element.isContentEditable;
|
|
32
|
+
var isIMEKeyEvent = (event) => event.isComposing || event.keyCode === 229;
|
|
33
|
+
var isSubmitKey = (event) => event.key === "Enter" && !event.defaultPrevented;
|
|
22
34
|
var getLevelRoot = (element) => element.closest(SUBMENU_SELECTOR);
|
|
23
35
|
var getSubmenuOfItem = (item) => {
|
|
24
36
|
const submenu = item.querySelector(SUBMENU_SELECTOR);
|
|
@@ -569,7 +581,7 @@ function Dropdown(props) {
|
|
|
569
581
|
return t0;
|
|
570
582
|
}
|
|
571
583
|
function RootDropdown(t0) {
|
|
572
|
-
const $ = c(
|
|
584
|
+
const $ = c(199);
|
|
573
585
|
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
586
|
const allowEmpty = t1 === void 0 ? true : t1;
|
|
575
587
|
const hasItems = t2 === void 0 ? true : t2;
|
|
@@ -1042,7 +1054,7 @@ function RootDropdown(t0) {
|
|
|
1042
1054
|
}
|
|
1043
1055
|
useEffect(t36, t37);
|
|
1044
1056
|
let t38;
|
|
1045
|
-
if ($[71] !== allowCreate || $[72] !== allowEmpty || $[73] !== closeDropdown || $[74] !== dropdownElement || $[75] !==
|
|
1057
|
+
if ($[71] !== allowCreate || $[72] !== allowEmpty || $[73] !== closeDropdown || $[74] !== dropdownElement || $[75] !== focusTrigger || $[76] !== handleActiveItem || $[77] !== hasItems || $[78] !== keepOpenOnSubmit || $[79] !== onSubmitItem || $[80] !== popupRole || $[81] !== valueIdentity) {
|
|
1046
1058
|
t38 = (event_1) => {
|
|
1047
1059
|
const element_0 = hasItems ? getActiveItemElement(dropdownElement) : null;
|
|
1048
1060
|
const submenuOfActive = element_0 ? getSubmenuOfItem(element_0) : null;
|
|
@@ -1060,7 +1072,11 @@ function RootDropdown(t0) {
|
|
|
1060
1072
|
}
|
|
1061
1073
|
return;
|
|
1062
1074
|
}
|
|
1063
|
-
if (isOpenRef.current && !keepOpenOnSubmit) closingTimerRef.current = setTimeout(
|
|
1075
|
+
if (isOpenRef.current && !keepOpenOnSubmit) closingTimerRef.current = setTimeout(() => {
|
|
1076
|
+
const activeElement_0 = dropdownElement?.ownerDocument.activeElement;
|
|
1077
|
+
if (!hasItems && activeElement_0 && isInOwnBody(dropdownElement, activeElement_0)) focusTrigger();
|
|
1078
|
+
closeDropdown();
|
|
1079
|
+
}, 90);
|
|
1064
1080
|
if (!hasItems) return;
|
|
1065
1081
|
if (!element_0) {
|
|
1066
1082
|
if (!inputElementRef.current) return;
|
|
@@ -1107,17 +1123,18 @@ function RootDropdown(t0) {
|
|
|
1107
1123
|
$[72] = allowEmpty;
|
|
1108
1124
|
$[73] = closeDropdown;
|
|
1109
1125
|
$[74] = dropdownElement;
|
|
1110
|
-
$[75] =
|
|
1111
|
-
$[76] =
|
|
1112
|
-
$[77] =
|
|
1113
|
-
$[78] =
|
|
1114
|
-
$[79] =
|
|
1115
|
-
$[80] =
|
|
1116
|
-
$[81] =
|
|
1117
|
-
|
|
1126
|
+
$[75] = focusTrigger;
|
|
1127
|
+
$[76] = handleActiveItem;
|
|
1128
|
+
$[77] = hasItems;
|
|
1129
|
+
$[78] = keepOpenOnSubmit;
|
|
1130
|
+
$[79] = onSubmitItem;
|
|
1131
|
+
$[80] = popupRole;
|
|
1132
|
+
$[81] = valueIdentity;
|
|
1133
|
+
$[82] = t38;
|
|
1134
|
+
} else t38 = $[82];
|
|
1118
1135
|
const handleSubmitItem = t38;
|
|
1119
1136
|
let t39;
|
|
1120
|
-
if ($[
|
|
1137
|
+
if ($[83] !== trackSafeArea) {
|
|
1121
1138
|
t39 = (event_2) => {
|
|
1122
1139
|
const { clientX, clientY } = event_2;
|
|
1123
1140
|
currentInputMethodRef.current = "mouse";
|
|
@@ -1127,12 +1144,12 @@ function RootDropdown(t0) {
|
|
|
1127
1144
|
if (Math.abs(initialPosition.clientX - clientX) < 12 && Math.abs(initialPosition.clientY - clientY) < 12) return;
|
|
1128
1145
|
endOpeningPress();
|
|
1129
1146
|
};
|
|
1130
|
-
$[
|
|
1131
|
-
$[
|
|
1132
|
-
} else t39 = $[
|
|
1147
|
+
$[83] = trackSafeArea;
|
|
1148
|
+
$[84] = t39;
|
|
1149
|
+
} else t39 = $[84];
|
|
1133
1150
|
const handleMouseMove = t39;
|
|
1134
1151
|
let t40;
|
|
1135
|
-
if ($[
|
|
1152
|
+
if ($[85] !== dropdownElement || $[86] !== handleActiveItem || $[87] !== hasItems || $[88] !== syncSubmenuDisclosure) {
|
|
1136
1153
|
t40 = (event_3) => {
|
|
1137
1154
|
if (!hasItems) return;
|
|
1138
1155
|
if (currentInputMethodRef.current !== "mouse") return;
|
|
@@ -1152,15 +1169,15 @@ function RootDropdown(t0) {
|
|
|
1152
1169
|
});
|
|
1153
1170
|
syncSubmenuDisclosure();
|
|
1154
1171
|
};
|
|
1155
|
-
$[
|
|
1156
|
-
$[
|
|
1157
|
-
$[
|
|
1158
|
-
$[
|
|
1159
|
-
$[
|
|
1160
|
-
} else t40 = $[
|
|
1172
|
+
$[85] = dropdownElement;
|
|
1173
|
+
$[86] = handleActiveItem;
|
|
1174
|
+
$[87] = hasItems;
|
|
1175
|
+
$[88] = syncSubmenuDisclosure;
|
|
1176
|
+
$[89] = t40;
|
|
1177
|
+
} else t40 = $[89];
|
|
1161
1178
|
const handleMouseOver = t40;
|
|
1162
1179
|
let t41;
|
|
1163
|
-
if ($[
|
|
1180
|
+
if ($[90] !== dropdownElement || $[91] !== hasItems || $[92] !== syncSubmenuDisclosure) {
|
|
1164
1181
|
t41 = (event_4) => {
|
|
1165
1182
|
if (!hasItems) return;
|
|
1166
1183
|
const relatedTarget = event_4.relatedTarget;
|
|
@@ -1177,14 +1194,14 @@ function RootDropdown(t0) {
|
|
|
1177
1194
|
clearActiveItems(dropdownElement, activeItem);
|
|
1178
1195
|
syncSubmenuDisclosure();
|
|
1179
1196
|
};
|
|
1180
|
-
$[
|
|
1181
|
-
$[
|
|
1182
|
-
$[
|
|
1183
|
-
$[
|
|
1184
|
-
} else t41 = $[
|
|
1197
|
+
$[90] = dropdownElement;
|
|
1198
|
+
$[91] = hasItems;
|
|
1199
|
+
$[92] = syncSubmenuDisclosure;
|
|
1200
|
+
$[93] = t41;
|
|
1201
|
+
} else t41 = $[93];
|
|
1185
1202
|
const handleMouseOut = t41;
|
|
1186
1203
|
let t42;
|
|
1187
|
-
if ($[
|
|
1204
|
+
if ($[94] !== disabled || $[95] !== onMouseDown) {
|
|
1188
1205
|
t42 = (event_5) => {
|
|
1189
1206
|
if (onMouseDown) onMouseDown(event_5);
|
|
1190
1207
|
if (disabled || isOpenRef.current) return;
|
|
@@ -1199,21 +1216,20 @@ function RootDropdown(t0) {
|
|
|
1199
1216
|
isOpeningTimerRef.current = null;
|
|
1200
1217
|
}, 1e3);
|
|
1201
1218
|
};
|
|
1202
|
-
$[
|
|
1203
|
-
$[
|
|
1204
|
-
$[
|
|
1205
|
-
} else t42 = $[
|
|
1219
|
+
$[94] = disabled;
|
|
1220
|
+
$[95] = onMouseDown;
|
|
1221
|
+
$[96] = t42;
|
|
1222
|
+
} else t42 = $[96];
|
|
1206
1223
|
const handleMouseDown = t42;
|
|
1207
1224
|
let t43;
|
|
1208
|
-
if ($[
|
|
1225
|
+
if ($[97] !== closeDropdown || $[98] !== dropdownElement || $[99] !== handleActiveItem || $[100] !== handleSubmitItem || $[101] !== hasItems || $[102] !== onMouseUp) {
|
|
1209
1226
|
t43 = (event_6) => {
|
|
1210
1227
|
if (onMouseUp) onMouseUp(event_6);
|
|
1211
1228
|
if (isOpeningRef.current || !isOpenRef.current || closingTimerRef.current != null) return;
|
|
1212
1229
|
const eventTarget_1 = event_6.target;
|
|
1213
1230
|
const clickedRoot = eventTarget_1.closest(".uktdropdown");
|
|
1214
1231
|
if (clickedRoot !== dropdownElement && clickedRoot?.classList.contains("is-open") && dropdownElement?.contains(clickedRoot)) return;
|
|
1215
|
-
|
|
1216
|
-
if (!Boolean(targetBody && targetBody.closest(".uktdropdown") === dropdownElement)) {
|
|
1232
|
+
if (!isInOwnBody(dropdownElement, eventTarget_1)) {
|
|
1217
1233
|
if (inputElementRef.current !== eventTarget_1.ownerDocument.activeElement) closeDropdown();
|
|
1218
1234
|
return;
|
|
1219
1235
|
}
|
|
@@ -1230,21 +1246,22 @@ function RootDropdown(t0) {
|
|
|
1230
1246
|
}
|
|
1231
1247
|
handleSubmitItem(event_6);
|
|
1232
1248
|
};
|
|
1233
|
-
$[
|
|
1234
|
-
$[
|
|
1235
|
-
$[
|
|
1236
|
-
$[
|
|
1237
|
-
$[
|
|
1238
|
-
$[
|
|
1239
|
-
$[
|
|
1240
|
-
} else t43 = $[
|
|
1249
|
+
$[97] = closeDropdown;
|
|
1250
|
+
$[98] = dropdownElement;
|
|
1251
|
+
$[99] = handleActiveItem;
|
|
1252
|
+
$[100] = handleSubmitItem;
|
|
1253
|
+
$[101] = hasItems;
|
|
1254
|
+
$[102] = onMouseUp;
|
|
1255
|
+
$[103] = t43;
|
|
1256
|
+
} else t43 = $[103];
|
|
1241
1257
|
const handleMouseUp = t43;
|
|
1242
1258
|
let t44;
|
|
1243
|
-
if ($[
|
|
1259
|
+
if ($[104] !== allowCreate || $[105] !== closeDropdown || $[106] !== disabled || $[107] !== dropdownElement || $[108] !== focusTrigger || $[109] !== handleActiveItem || $[110] !== handleSubmitItem || $[111] !== hasItems || $[112] !== menubar || $[113] !== syncSubmenuDisclosure) {
|
|
1244
1260
|
t44 = (event_7) => {
|
|
1245
1261
|
const { altKey, ctrlKey, key: key_0, metaKey } = event_7;
|
|
1246
1262
|
const eventTarget_2 = event_7.target;
|
|
1247
1263
|
if (!dropdownElement) return;
|
|
1264
|
+
if (isIMEKeyEvent(event_7)) return;
|
|
1248
1265
|
const onEventHandled = () => {
|
|
1249
1266
|
event_7.stopPropagation();
|
|
1250
1267
|
event_7.preventDefault();
|
|
@@ -1258,7 +1275,7 @@ function RootDropdown(t0) {
|
|
|
1258
1275
|
if (disabled) return;
|
|
1259
1276
|
if (key_0 === " " || key_0 === "Enter" || hasItems && (key_0 === "ArrowUp" || key_0 === "ArrowDown")) {
|
|
1260
1277
|
onEventHandled();
|
|
1261
|
-
setIsOpen(true);
|
|
1278
|
+
if (!event_7.repeat) setIsOpen(true);
|
|
1262
1279
|
}
|
|
1263
1280
|
return;
|
|
1264
1281
|
}
|
|
@@ -1286,12 +1303,26 @@ function RootDropdown(t0) {
|
|
|
1286
1303
|
return;
|
|
1287
1304
|
}
|
|
1288
1305
|
}
|
|
1306
|
+
if (!hasItems && (key_0 === "Enter" || key_0 === " ")) {
|
|
1307
|
+
if (isEventTargetingDropdown) {
|
|
1308
|
+
if (isInOwnBody(dropdownElement, eventTarget_2)) {
|
|
1309
|
+
if (isSubmitKey(event_7) && eventTarget_2.closest(".uktdropdown") === dropdownElement && isFormlessTextInput(eventTarget_2)) handleSubmitItem(event_7);
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
if (!isTargetUsingKeyEvents || eventTarget_2.matches(CLICKABLE_SELECTOR)) {
|
|
1313
|
+
onEventHandled();
|
|
1314
|
+
if (!event_7.repeat) closeDropdown();
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
if (isMultilineTextField(eventTarget_2) || !isSubmitKey(event_7)) return;
|
|
1318
|
+
} else if (isTargetUsingKeyEvents || !eventTarget_2.contains(dropdownElement)) return;
|
|
1319
|
+
}
|
|
1289
1320
|
if (key_0 === "Enter" || key_0 === " " && !inputElementRef.current) {
|
|
1290
1321
|
onEventHandled();
|
|
1291
|
-
handleSubmitItem(event_7);
|
|
1322
|
+
if (!event_7.repeat) handleSubmitItem(event_7);
|
|
1292
1323
|
return;
|
|
1293
1324
|
}
|
|
1294
|
-
if (key_0 === "Escape"
|
|
1325
|
+
if (key_0 === "Escape") {
|
|
1295
1326
|
if (hasItems || !isTargetUsingKeyEvents) {
|
|
1296
1327
|
focusTrigger();
|
|
1297
1328
|
closeDropdown();
|
|
@@ -1346,12 +1377,12 @@ function RootDropdown(t0) {
|
|
|
1346
1377
|
}
|
|
1347
1378
|
if (!isTargetUsingKeyEvents) {
|
|
1348
1379
|
if (key_0 === "ArrowRight") {
|
|
1349
|
-
const
|
|
1350
|
-
const submenu_3 =
|
|
1351
|
-
if (
|
|
1380
|
+
const activeElement_1 = getActiveItemElement(dropdownElement);
|
|
1381
|
+
const submenu_3 = activeElement_1 ? getSubmenuOfItem(activeElement_1) : null;
|
|
1382
|
+
if (activeElement_1 && submenu_3) {
|
|
1352
1383
|
onEventHandled();
|
|
1353
1384
|
clearDisclosureTimer();
|
|
1354
|
-
expandItem(
|
|
1385
|
+
expandItem(activeElement_1, handleToggleSubmenu);
|
|
1355
1386
|
const firstItem_0 = getItemElements(dropdownElement, submenu_3)?.[0];
|
|
1356
1387
|
if (firstItem_0) setActiveItem({
|
|
1357
1388
|
dropdownElement,
|
|
@@ -1368,8 +1399,8 @@ function RootDropdown(t0) {
|
|
|
1368
1399
|
return;
|
|
1369
1400
|
}
|
|
1370
1401
|
if (key_0 === "ArrowLeft") {
|
|
1371
|
-
const
|
|
1372
|
-
const levelRoot =
|
|
1402
|
+
const activeElement_2 = getActiveItemElement(dropdownElement);
|
|
1403
|
+
const levelRoot = activeElement_2 ? getLevelRoot(activeElement_2) : null;
|
|
1373
1404
|
if (levelRoot) {
|
|
1374
1405
|
onEventHandled();
|
|
1375
1406
|
clearDisclosureTimer();
|
|
@@ -1386,32 +1417,44 @@ function RootDropdown(t0) {
|
|
|
1386
1417
|
}
|
|
1387
1418
|
}
|
|
1388
1419
|
};
|
|
1389
|
-
$[
|
|
1390
|
-
$[
|
|
1391
|
-
$[
|
|
1392
|
-
$[
|
|
1393
|
-
$[
|
|
1394
|
-
$[
|
|
1395
|
-
$[
|
|
1396
|
-
$[
|
|
1397
|
-
$[
|
|
1398
|
-
$[
|
|
1399
|
-
$[
|
|
1400
|
-
} else t44 = $[
|
|
1420
|
+
$[104] = allowCreate;
|
|
1421
|
+
$[105] = closeDropdown;
|
|
1422
|
+
$[106] = disabled;
|
|
1423
|
+
$[107] = dropdownElement;
|
|
1424
|
+
$[108] = focusTrigger;
|
|
1425
|
+
$[109] = handleActiveItem;
|
|
1426
|
+
$[110] = handleSubmitItem;
|
|
1427
|
+
$[111] = hasItems;
|
|
1428
|
+
$[112] = menubar;
|
|
1429
|
+
$[113] = syncSubmenuDisclosure;
|
|
1430
|
+
$[114] = t44;
|
|
1431
|
+
} else t44 = $[114];
|
|
1401
1432
|
const handleKeyDown = t44;
|
|
1402
1433
|
let t45;
|
|
1403
|
-
if ($[
|
|
1434
|
+
if ($[115] !== handleKeyDown) {
|
|
1404
1435
|
t45 = {
|
|
1405
1436
|
ignoreUsedKeyboardEvents: false,
|
|
1406
1437
|
onKeyDown: handleKeyDown
|
|
1407
1438
|
};
|
|
1408
|
-
$[
|
|
1409
|
-
$[
|
|
1410
|
-
} else t45 = $[
|
|
1439
|
+
$[115] = handleKeyDown;
|
|
1440
|
+
$[116] = t45;
|
|
1441
|
+
} else t45 = $[116];
|
|
1411
1442
|
useKeyboardEvents(t45);
|
|
1412
1443
|
let t46;
|
|
1413
|
-
if ($[
|
|
1414
|
-
t46 = (
|
|
1444
|
+
if ($[117] !== dropdownElement || $[118] !== handleSubmitItem || $[119] !== hasItems) {
|
|
1445
|
+
t46 = (event_8) => {
|
|
1446
|
+
if (hasItems || !isInOwnBody(dropdownElement, event_8.target)) return;
|
|
1447
|
+
handleSubmitItem(event_8);
|
|
1448
|
+
};
|
|
1449
|
+
$[117] = dropdownElement;
|
|
1450
|
+
$[118] = handleSubmitItem;
|
|
1451
|
+
$[119] = hasItems;
|
|
1452
|
+
$[120] = t46;
|
|
1453
|
+
} else t46 = $[120];
|
|
1454
|
+
const handleBodySubmit = t46;
|
|
1455
|
+
let t47;
|
|
1456
|
+
if ($[121] !== allowCreate || $[122] !== closeDropdown || $[123] !== disabled || $[124] !== handleActiveItem) {
|
|
1457
|
+
t47 = (ref) => {
|
|
1415
1458
|
setDropdownElement(ref);
|
|
1416
1459
|
if (!ref) return;
|
|
1417
1460
|
const { ownerDocument } = ref;
|
|
@@ -1421,13 +1464,13 @@ function RootDropdown(t0) {
|
|
|
1421
1464
|
else inputElement = ref.firstElementChild.querySelector(TEXT_INPUT_SELECTOR);
|
|
1422
1465
|
inputElementRef.current = inputElement;
|
|
1423
1466
|
}
|
|
1424
|
-
const handleGlobalMouseDown = (
|
|
1425
|
-
const { target: target_1 } =
|
|
1467
|
+
const handleGlobalMouseDown = (t48) => {
|
|
1468
|
+
const { target: target_1 } = t48;
|
|
1426
1469
|
const eventTarget_3 = target_1;
|
|
1427
1470
|
if (!ref.contains(eventTarget_3)) closeDropdown();
|
|
1428
1471
|
};
|
|
1429
|
-
const handleGlobalMouseUp = (
|
|
1430
|
-
const { target: target_2 } =
|
|
1472
|
+
const handleGlobalMouseUp = (t49) => {
|
|
1473
|
+
const { target: target_2 } = t49;
|
|
1431
1474
|
if (!isOpenRef.current || closingTimerRef.current != null) return;
|
|
1432
1475
|
if (isOpeningRef.current) {
|
|
1433
1476
|
endOpeningPress();
|
|
@@ -1436,8 +1479,8 @@ function RootDropdown(t0) {
|
|
|
1436
1479
|
const eventTarget_4 = target_2;
|
|
1437
1480
|
if (!ref.contains(eventTarget_4)) closeDropdown();
|
|
1438
1481
|
};
|
|
1439
|
-
const handleGlobalFocusIn = (
|
|
1440
|
-
const { target: target_3 } =
|
|
1482
|
+
const handleGlobalFocusIn = (t50) => {
|
|
1483
|
+
const { target: target_3 } = t50;
|
|
1441
1484
|
if (!isOpenRef.current) return;
|
|
1442
1485
|
const eventTarget_5 = target_3;
|
|
1443
1486
|
if (ref.contains(eventTarget_5) || eventTarget_5.contains(ref)) return;
|
|
@@ -1451,16 +1494,16 @@ function RootDropdown(t0) {
|
|
|
1451
1494
|
ownerDocument.addEventListener("mousedown", handleGlobalMouseDown);
|
|
1452
1495
|
ownerDocument.addEventListener("mouseup", handleGlobalMouseUp);
|
|
1453
1496
|
}
|
|
1454
|
-
const handleInput = (
|
|
1497
|
+
const handleInput = (event_9) => {
|
|
1455
1498
|
if (disabled) return;
|
|
1456
1499
|
if (!isOpenRef.current) setIsOpen(true);
|
|
1457
|
-
const input =
|
|
1500
|
+
const input = event_9.target;
|
|
1458
1501
|
const isDeleting = enteredCharactersRef.current.length > input.value.length;
|
|
1459
1502
|
enteredCharactersRef.current = input.value;
|
|
1460
1503
|
if (isDeleting && input.value.length && getActiveItemElement(ref)) return;
|
|
1461
1504
|
setActiveItem({
|
|
1462
1505
|
dropdownElement: ref,
|
|
1463
|
-
event:
|
|
1506
|
+
event: event_9,
|
|
1464
1507
|
isExactMatch: allowCreate,
|
|
1465
1508
|
onActiveItem: handleActiveItem,
|
|
1466
1509
|
text: enteredCharactersRef.current
|
|
@@ -1479,16 +1522,16 @@ function RootDropdown(t0) {
|
|
|
1479
1522
|
if (inputElement) inputElement.removeEventListener("input", handleInput);
|
|
1480
1523
|
};
|
|
1481
1524
|
};
|
|
1482
|
-
$[
|
|
1483
|
-
$[
|
|
1484
|
-
$[
|
|
1485
|
-
$[
|
|
1486
|
-
$[
|
|
1487
|
-
} else
|
|
1488
|
-
const handleRef =
|
|
1489
|
-
let
|
|
1490
|
-
if ($[
|
|
1491
|
-
|
|
1525
|
+
$[121] = allowCreate;
|
|
1526
|
+
$[122] = closeDropdown;
|
|
1527
|
+
$[123] = disabled;
|
|
1528
|
+
$[124] = handleActiveItem;
|
|
1529
|
+
$[125] = t47;
|
|
1530
|
+
} else t47 = $[125];
|
|
1531
|
+
const handleRef = t47;
|
|
1532
|
+
let t48;
|
|
1533
|
+
if ($[126] !== dropdownElement || $[127] !== popupRole || $[128] !== valueIdentity) {
|
|
1534
|
+
t48 = (ref_0) => {
|
|
1492
1535
|
if (!ref_0) return;
|
|
1493
1536
|
if (annotatedElementsRef.current.has(ref_0)) return;
|
|
1494
1537
|
annotatedElementsRef.current.add(ref_0);
|
|
@@ -1506,82 +1549,82 @@ function RootDropdown(t0) {
|
|
|
1506
1549
|
}
|
|
1507
1550
|
}
|
|
1508
1551
|
};
|
|
1509
|
-
$[
|
|
1510
|
-
$[
|
|
1511
|
-
$[
|
|
1512
|
-
$[
|
|
1513
|
-
} else
|
|
1514
|
-
const handleBodyRef =
|
|
1552
|
+
$[126] = dropdownElement;
|
|
1553
|
+
$[127] = popupRole;
|
|
1554
|
+
$[128] = valueIdentity;
|
|
1555
|
+
$[129] = t48;
|
|
1556
|
+
} else t48 = $[129];
|
|
1557
|
+
const handleBodyRef = t48;
|
|
1515
1558
|
let bodyLabelledBy;
|
|
1516
1559
|
if (!isValidElement(trigger)) {
|
|
1517
1560
|
if (isSearchable) {
|
|
1518
|
-
const
|
|
1519
|
-
let t49;
|
|
1520
|
-
if ($[125] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1521
|
-
t49 = () => setIsOpen(true);
|
|
1522
|
-
$[125] = t49;
|
|
1523
|
-
} else t49 = $[125];
|
|
1561
|
+
const t49 = valueLabel ?? "";
|
|
1524
1562
|
let t50;
|
|
1525
|
-
if ($[
|
|
1526
|
-
t50 =
|
|
1563
|
+
if ($[130] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1564
|
+
t50 = () => setIsOpen(true);
|
|
1565
|
+
$[130] = t50;
|
|
1566
|
+
} else t50 = $[130];
|
|
1567
|
+
let t51;
|
|
1568
|
+
if ($[131] !== bodyId || $[132] !== disabled || $[133] !== isOpen || $[134] !== name || $[135] !== placeholder || $[136] !== popupRole || $[137] !== t49 || $[138] !== tabIndex || $[139] !== triggerId) {
|
|
1569
|
+
t51 = /* @__PURE__ */ jsx("input", {
|
|
1527
1570
|
"aria-autocomplete": "list",
|
|
1528
1571
|
"aria-controls": bodyId,
|
|
1529
1572
|
"aria-expanded": isOpen,
|
|
1530
1573
|
"aria-haspopup": popupRole,
|
|
1531
1574
|
autoComplete: "off",
|
|
1532
1575
|
className: "uktdropdown-trigger",
|
|
1533
|
-
defaultValue:
|
|
1576
|
+
defaultValue: t49,
|
|
1534
1577
|
disabled,
|
|
1535
1578
|
id: triggerId,
|
|
1536
1579
|
name,
|
|
1537
|
-
onFocus:
|
|
1580
|
+
onFocus: t50,
|
|
1538
1581
|
placeholder,
|
|
1539
1582
|
ref: inputElementRef,
|
|
1540
1583
|
role: "combobox",
|
|
1541
1584
|
tabIndex,
|
|
1542
1585
|
type: "text"
|
|
1543
1586
|
});
|
|
1544
|
-
$[
|
|
1545
|
-
$[
|
|
1546
|
-
$[
|
|
1547
|
-
$[
|
|
1548
|
-
$[
|
|
1549
|
-
$[
|
|
1550
|
-
$[
|
|
1551
|
-
$[
|
|
1552
|
-
$[
|
|
1553
|
-
$[
|
|
1554
|
-
} else
|
|
1555
|
-
trigger =
|
|
1587
|
+
$[131] = bodyId;
|
|
1588
|
+
$[132] = disabled;
|
|
1589
|
+
$[133] = isOpen;
|
|
1590
|
+
$[134] = name;
|
|
1591
|
+
$[135] = placeholder;
|
|
1592
|
+
$[136] = popupRole;
|
|
1593
|
+
$[137] = t49;
|
|
1594
|
+
$[138] = tabIndex;
|
|
1595
|
+
$[139] = triggerId;
|
|
1596
|
+
$[140] = t51;
|
|
1597
|
+
} else t51 = $[140];
|
|
1598
|
+
trigger = t51;
|
|
1556
1599
|
} else {
|
|
1557
1600
|
bodyLabelledBy = triggerId;
|
|
1558
|
-
const
|
|
1559
|
-
const
|
|
1560
|
-
let
|
|
1561
|
-
if ($[
|
|
1562
|
-
|
|
1601
|
+
const t49 = isMenubarItem ? "menuitem" : void 0;
|
|
1602
|
+
const t50 = menubarTabIndex ?? 0;
|
|
1603
|
+
let t51;
|
|
1604
|
+
if ($[141] !== bodyId || $[142] !== disabled || $[143] !== isOpen || $[144] !== popupRole || $[145] !== t49 || $[146] !== t50 || $[147] !== trigger || $[148] !== triggerId) {
|
|
1605
|
+
t51 = /* @__PURE__ */ jsx("button", {
|
|
1563
1606
|
"aria-controls": bodyId,
|
|
1564
1607
|
"aria-expanded": isOpen,
|
|
1565
1608
|
"aria-haspopup": popupRole,
|
|
1566
1609
|
className: "uktdropdown-trigger",
|
|
1567
1610
|
disabled,
|
|
1568
1611
|
id: triggerId,
|
|
1569
|
-
role:
|
|
1570
|
-
tabIndex:
|
|
1612
|
+
role: t49,
|
|
1613
|
+
tabIndex: t50,
|
|
1571
1614
|
type: "button",
|
|
1572
1615
|
children: trigger
|
|
1573
1616
|
});
|
|
1574
|
-
$[
|
|
1575
|
-
$[
|
|
1576
|
-
$[
|
|
1577
|
-
$[
|
|
1578
|
-
$[
|
|
1579
|
-
$[
|
|
1580
|
-
$[
|
|
1581
|
-
$[
|
|
1582
|
-
$[
|
|
1583
|
-
} else
|
|
1584
|
-
trigger =
|
|
1617
|
+
$[141] = bodyId;
|
|
1618
|
+
$[142] = disabled;
|
|
1619
|
+
$[143] = isOpen;
|
|
1620
|
+
$[144] = popupRole;
|
|
1621
|
+
$[145] = t49;
|
|
1622
|
+
$[146] = t50;
|
|
1623
|
+
$[147] = trigger;
|
|
1624
|
+
$[148] = triggerId;
|
|
1625
|
+
$[149] = t51;
|
|
1626
|
+
} else t51 = $[149];
|
|
1627
|
+
trigger = t51;
|
|
1585
1628
|
}
|
|
1586
1629
|
} else {
|
|
1587
1630
|
const triggerProps = trigger.props;
|
|
@@ -1591,98 +1634,99 @@ function RootDropdown(t0) {
|
|
|
1591
1634
|
const isCombobox = isSearchable && isTextInputTrigger && trigger.type !== "textarea";
|
|
1592
1635
|
const triggerRole = triggerProps.role ?? (isCombobox ? "combobox" : isMenubarItem ? "menuitem" : void 0);
|
|
1593
1636
|
const canExpand = !isTextInputTrigger || triggerRole != null;
|
|
1594
|
-
const
|
|
1595
|
-
const
|
|
1596
|
-
const
|
|
1597
|
-
const
|
|
1598
|
-
const
|
|
1599
|
-
const
|
|
1600
|
-
const
|
|
1601
|
-
let
|
|
1602
|
-
if ($[
|
|
1603
|
-
|
|
1604
|
-
"aria-autocomplete":
|
|
1605
|
-
"aria-controls":
|
|
1606
|
-
"aria-disabled":
|
|
1607
|
-
"aria-expanded":
|
|
1608
|
-
"aria-haspopup":
|
|
1637
|
+
const t49 = trigger;
|
|
1638
|
+
const t50 = triggerProps["aria-autocomplete"] ?? (isCombobox ? "list" : void 0);
|
|
1639
|
+
const t51 = triggerProps["aria-controls"] ?? bodyId;
|
|
1640
|
+
const t52 = triggerProps["aria-disabled"] ?? (disabled || void 0);
|
|
1641
|
+
const t53 = triggerProps["aria-expanded"] ?? (canExpand ? isOpen : void 0);
|
|
1642
|
+
const t54 = triggerProps["aria-haspopup"] ?? popupRole;
|
|
1643
|
+
const t55 = triggerProps.tabIndex ?? menubarTabIndex;
|
|
1644
|
+
let t56;
|
|
1645
|
+
if ($[150] !== resolvedTriggerId || $[151] !== t49 || $[152] !== t50 || $[153] !== t51 || $[154] !== t52 || $[155] !== t53 || $[156] !== t54 || $[157] !== t55 || $[158] !== triggerRole) {
|
|
1646
|
+
t56 = cloneElement(t49, {
|
|
1647
|
+
"aria-autocomplete": t50,
|
|
1648
|
+
"aria-controls": t51,
|
|
1649
|
+
"aria-disabled": t52,
|
|
1650
|
+
"aria-expanded": t53,
|
|
1651
|
+
"aria-haspopup": t54,
|
|
1609
1652
|
id: resolvedTriggerId,
|
|
1610
1653
|
role: triggerRole,
|
|
1611
|
-
tabIndex:
|
|
1654
|
+
tabIndex: t55
|
|
1612
1655
|
});
|
|
1613
|
-
$[
|
|
1614
|
-
$[
|
|
1615
|
-
$[
|
|
1616
|
-
$[
|
|
1617
|
-
$[
|
|
1618
|
-
$[
|
|
1619
|
-
$[
|
|
1620
|
-
$[
|
|
1621
|
-
$[
|
|
1622
|
-
$[
|
|
1623
|
-
} else
|
|
1624
|
-
trigger =
|
|
1656
|
+
$[150] = resolvedTriggerId;
|
|
1657
|
+
$[151] = t49;
|
|
1658
|
+
$[152] = t50;
|
|
1659
|
+
$[153] = t51;
|
|
1660
|
+
$[154] = t52;
|
|
1661
|
+
$[155] = t53;
|
|
1662
|
+
$[156] = t54;
|
|
1663
|
+
$[157] = t55;
|
|
1664
|
+
$[158] = triggerRole;
|
|
1665
|
+
$[159] = t56;
|
|
1666
|
+
} else t56 = $[159];
|
|
1667
|
+
trigger = t56;
|
|
1625
1668
|
}
|
|
1626
1669
|
if (label != null) {
|
|
1627
1670
|
bodyLabelledBy = labelId;
|
|
1628
|
-
const t48 = isMenubarMember ? "none" : void 0;
|
|
1629
1671
|
const t49 = isMenubarMember ? "none" : void 0;
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1672
|
+
const t50 = isMenubarMember ? "none" : void 0;
|
|
1673
|
+
let t51;
|
|
1674
|
+
if ($[160] !== label || $[161] !== labelId || $[162] !== t50) {
|
|
1675
|
+
t51 = /* @__PURE__ */ jsx("div", {
|
|
1633
1676
|
className: "uktdropdown-label-text",
|
|
1634
1677
|
id: labelId,
|
|
1635
|
-
role:
|
|
1678
|
+
role: t50,
|
|
1636
1679
|
children: label
|
|
1637
1680
|
});
|
|
1638
|
-
$[
|
|
1639
|
-
$[
|
|
1640
|
-
$[
|
|
1641
|
-
$[
|
|
1642
|
-
} else
|
|
1643
|
-
let
|
|
1644
|
-
if ($[
|
|
1645
|
-
|
|
1681
|
+
$[160] = label;
|
|
1682
|
+
$[161] = labelId;
|
|
1683
|
+
$[162] = t50;
|
|
1684
|
+
$[163] = t51;
|
|
1685
|
+
} else t51 = $[163];
|
|
1686
|
+
let t52;
|
|
1687
|
+
if ($[164] !== t49 || $[165] !== t51 || $[166] !== trigger) {
|
|
1688
|
+
t52 = /* @__PURE__ */ jsxs("label", {
|
|
1646
1689
|
className: "uktdropdown-label",
|
|
1647
|
-
role:
|
|
1648
|
-
children: [
|
|
1690
|
+
role: t49,
|
|
1691
|
+
children: [t51, trigger]
|
|
1649
1692
|
});
|
|
1650
|
-
$[
|
|
1651
|
-
$[
|
|
1652
|
-
$[
|
|
1653
|
-
$[
|
|
1654
|
-
} else
|
|
1655
|
-
trigger =
|
|
1693
|
+
$[164] = t49;
|
|
1694
|
+
$[165] = t51;
|
|
1695
|
+
$[166] = trigger;
|
|
1696
|
+
$[167] = t52;
|
|
1697
|
+
} else t52 = $[167];
|
|
1698
|
+
trigger = t52;
|
|
1656
1699
|
}
|
|
1657
|
-
let
|
|
1658
|
-
if ($[
|
|
1659
|
-
|
|
1700
|
+
let t49;
|
|
1701
|
+
if ($[168] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1702
|
+
t49 = /* @__PURE__ */ jsx("style", {
|
|
1660
1703
|
href: "@acusti/dropdown/Dropdown",
|
|
1661
1704
|
precedence: "medium",
|
|
1662
1705
|
children: Dropdown_default
|
|
1663
1706
|
});
|
|
1664
|
-
$[
|
|
1665
|
-
} else
|
|
1666
|
-
let
|
|
1667
|
-
if ($[
|
|
1668
|
-
|
|
1707
|
+
$[168] = t49;
|
|
1708
|
+
} else t49 = $[168];
|
|
1709
|
+
let t50;
|
|
1710
|
+
if ($[169] !== className || $[170] !== disabled || $[171] !== isOpen || $[172] !== isSearchable) {
|
|
1711
|
+
t50 = clsx("uktdropdown", className, {
|
|
1669
1712
|
"is-disabled": disabled,
|
|
1670
1713
|
"is-open": isOpen,
|
|
1671
1714
|
"is-searchable": isSearchable
|
|
1672
1715
|
});
|
|
1673
|
-
$[
|
|
1674
|
-
$[
|
|
1675
|
-
$[
|
|
1676
|
-
$[
|
|
1677
|
-
$[
|
|
1678
|
-
} else
|
|
1679
|
-
const
|
|
1680
|
-
let
|
|
1681
|
-
if ($[
|
|
1682
|
-
|
|
1716
|
+
$[169] = className;
|
|
1717
|
+
$[170] = disabled;
|
|
1718
|
+
$[171] = isOpen;
|
|
1719
|
+
$[172] = isSearchable;
|
|
1720
|
+
$[173] = t50;
|
|
1721
|
+
} else t50 = $[173];
|
|
1722
|
+
const t51 = isMenubarMember ? "none" : void 0;
|
|
1723
|
+
let t52;
|
|
1724
|
+
if ($[174] !== body || $[175] !== bodyId || $[176] !== bodyLabelledBy || $[177] !== dropdownContextValue || $[178] !== handleBodyRef || $[179] !== handleBodySubmit || $[180] !== hasItems || $[181] !== isOpen || $[182] !== popupRole) {
|
|
1725
|
+
t52 = isOpen ? /* @__PURE__ */ jsx("div", {
|
|
1683
1726
|
"aria-labelledby": bodyLabelledBy,
|
|
1684
1727
|
className: clsx("uktdropdown-body", { "has-items": hasItems }),
|
|
1685
1728
|
id: bodyId,
|
|
1729
|
+
onSubmit: handleBodySubmit,
|
|
1686
1730
|
popover: "manual",
|
|
1687
1731
|
ref: handleBodyRef,
|
|
1688
1732
|
role: popupRole,
|
|
@@ -1694,22 +1738,23 @@ function RootDropdown(t0) {
|
|
|
1694
1738
|
})
|
|
1695
1739
|
})
|
|
1696
1740
|
}) : null;
|
|
1697
|
-
$[
|
|
1698
|
-
$[
|
|
1699
|
-
$[
|
|
1700
|
-
$[
|
|
1701
|
-
$[
|
|
1702
|
-
$[
|
|
1703
|
-
$[
|
|
1704
|
-
$[
|
|
1705
|
-
$[
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1741
|
+
$[174] = body;
|
|
1742
|
+
$[175] = bodyId;
|
|
1743
|
+
$[176] = bodyLabelledBy;
|
|
1744
|
+
$[177] = dropdownContextValue;
|
|
1745
|
+
$[178] = handleBodyRef;
|
|
1746
|
+
$[179] = handleBodySubmit;
|
|
1747
|
+
$[180] = hasItems;
|
|
1748
|
+
$[181] = isOpen;
|
|
1749
|
+
$[182] = popupRole;
|
|
1750
|
+
$[183] = t52;
|
|
1751
|
+
} else t52 = $[183];
|
|
1752
|
+
let t53;
|
|
1753
|
+
if ($[184] !== handleDropdownMouseEnter || $[185] !== handleDropdownMouseLeave || $[186] !== handleMouseDown || $[187] !== handleMouseMove || $[188] !== handleMouseOut || $[189] !== handleMouseOver || $[190] !== handleMouseUp || $[191] !== handleRef || $[192] !== onClick || $[193] !== styleFromProps || $[194] !== t50 || $[195] !== t51 || $[196] !== t52 || $[197] !== trigger) {
|
|
1754
|
+
t53 = /* @__PURE__ */ jsxs(Fragment, { children: [t49, /* @__PURE__ */ jsxs("div", {
|
|
1755
|
+
className: t50,
|
|
1711
1756
|
onClick,
|
|
1712
|
-
role:
|
|
1757
|
+
role: t51,
|
|
1713
1758
|
onMouseDown: handleMouseDown,
|
|
1714
1759
|
onMouseEnter: handleDropdownMouseEnter,
|
|
1715
1760
|
onMouseLeave: handleDropdownMouseLeave,
|
|
@@ -1719,25 +1764,25 @@ function RootDropdown(t0) {
|
|
|
1719
1764
|
onMouseUp: handleMouseUp,
|
|
1720
1765
|
ref: handleRef,
|
|
1721
1766
|
style: styleFromProps,
|
|
1722
|
-
children: [trigger,
|
|
1767
|
+
children: [trigger, t52]
|
|
1723
1768
|
})] });
|
|
1724
|
-
$[
|
|
1725
|
-
$[
|
|
1726
|
-
$[
|
|
1727
|
-
$[
|
|
1728
|
-
$[
|
|
1729
|
-
$[
|
|
1730
|
-
$[
|
|
1731
|
-
$[
|
|
1732
|
-
$[
|
|
1733
|
-
$[
|
|
1734
|
-
$[
|
|
1735
|
-
$[
|
|
1736
|
-
$[
|
|
1737
|
-
$[
|
|
1738
|
-
$[
|
|
1739
|
-
} else
|
|
1740
|
-
return
|
|
1769
|
+
$[184] = handleDropdownMouseEnter;
|
|
1770
|
+
$[185] = handleDropdownMouseLeave;
|
|
1771
|
+
$[186] = handleMouseDown;
|
|
1772
|
+
$[187] = handleMouseMove;
|
|
1773
|
+
$[188] = handleMouseOut;
|
|
1774
|
+
$[189] = handleMouseOver;
|
|
1775
|
+
$[190] = handleMouseUp;
|
|
1776
|
+
$[191] = handleRef;
|
|
1777
|
+
$[192] = onClick;
|
|
1778
|
+
$[193] = styleFromProps;
|
|
1779
|
+
$[194] = t50;
|
|
1780
|
+
$[195] = t51;
|
|
1781
|
+
$[196] = t52;
|
|
1782
|
+
$[197] = trigger;
|
|
1783
|
+
$[198] = t53;
|
|
1784
|
+
} else t53 = $[198];
|
|
1785
|
+
return t53;
|
|
1741
1786
|
}
|
|
1742
1787
|
var INERT_SUBMENU_PROPS = [
|
|
1743
1788
|
"allowCreate",
|