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