@acusti/dropdown 1.0.0-rc.2 → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Dropdown.js +81 -72
- package/dist/Dropdown.js.map +1 -1
- package/package.json +1 -1
package/dist/Dropdown.js
CHANGED
|
@@ -380,10 +380,18 @@ function Menubar(t0) {
|
|
|
380
380
|
},
|
|
381
381
|
registerMember(member_2) {
|
|
382
382
|
membersRef.current.add(member_2);
|
|
383
|
-
setTabbableElement((current) =>
|
|
383
|
+
setTabbableElement((current) => {
|
|
384
|
+
if (current == null) return canHoldTabStop(member_2) ? member_2.element : current;
|
|
385
|
+
if (current === member_2.element && !canHoldTabStop(member_2)) return null;
|
|
386
|
+
return current;
|
|
387
|
+
});
|
|
384
388
|
return () => {
|
|
385
389
|
membersRef.current.delete(member_2);
|
|
386
|
-
|
|
390
|
+
if (member_2.element !== tabbableElement) return;
|
|
391
|
+
queueMicrotask(() => {
|
|
392
|
+
for (const registered of membersRef.current) if (registered.element === member_2.element) return;
|
|
393
|
+
reconcile();
|
|
394
|
+
});
|
|
387
395
|
};
|
|
388
396
|
},
|
|
389
397
|
tabbableElement
|
|
@@ -539,7 +547,7 @@ function RootDropdown(t0) {
|
|
|
539
547
|
const keepOpenOnSubmit = t3 === void 0 ? !hasItems : t3;
|
|
540
548
|
const childrenCount = Children.count(children);
|
|
541
549
|
if (childrenCount !== 1 && childrenCount !== 2) {
|
|
542
|
-
if (childrenCount === 0) throw new Error(
|
|
550
|
+
if (childrenCount === 0) throw new Error(CHILDREN_ERROR + " Received no children.");
|
|
543
551
|
console.error(`${CHILDREN_ERROR} Received ${childrenCount} children.`);
|
|
544
552
|
}
|
|
545
553
|
let trigger;
|
|
@@ -1469,76 +1477,77 @@ function RootDropdown(t0) {
|
|
|
1469
1477
|
} else t45 = $[120];
|
|
1470
1478
|
const handleBodyRef = t45;
|
|
1471
1479
|
let bodyLabelledBy;
|
|
1472
|
-
if (!isValidElement(trigger))
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1480
|
+
if (!isValidElement(trigger)) {
|
|
1481
|
+
if (isSearchable) {
|
|
1482
|
+
const t46 = valueLabel ?? "";
|
|
1483
|
+
let t47;
|
|
1484
|
+
if ($[121] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1485
|
+
t47 = () => setIsOpen(true);
|
|
1486
|
+
$[121] = t47;
|
|
1487
|
+
} else t47 = $[121];
|
|
1488
|
+
let t48;
|
|
1489
|
+
if ($[122] !== bodyId || $[123] !== disabled || $[124] !== isOpen || $[125] !== name || $[126] !== placeholder || $[127] !== popupRole || $[128] !== t46 || $[129] !== tabIndex || $[130] !== triggerId) {
|
|
1490
|
+
t48 = /* @__PURE__ */ jsx("input", {
|
|
1491
|
+
"aria-autocomplete": "list",
|
|
1492
|
+
"aria-controls": bodyId,
|
|
1493
|
+
"aria-expanded": isOpen,
|
|
1494
|
+
"aria-haspopup": popupRole,
|
|
1495
|
+
autoComplete: "off",
|
|
1496
|
+
className: "uktdropdown-trigger",
|
|
1497
|
+
defaultValue: t46,
|
|
1498
|
+
disabled,
|
|
1499
|
+
id: triggerId,
|
|
1500
|
+
name,
|
|
1501
|
+
onFocus: t47,
|
|
1502
|
+
placeholder,
|
|
1503
|
+
ref: inputElementRef,
|
|
1504
|
+
role: "combobox",
|
|
1505
|
+
tabIndex,
|
|
1506
|
+
type: "text"
|
|
1507
|
+
});
|
|
1508
|
+
$[122] = bodyId;
|
|
1509
|
+
$[123] = disabled;
|
|
1510
|
+
$[124] = isOpen;
|
|
1511
|
+
$[125] = name;
|
|
1512
|
+
$[126] = placeholder;
|
|
1513
|
+
$[127] = popupRole;
|
|
1514
|
+
$[128] = t46;
|
|
1515
|
+
$[129] = tabIndex;
|
|
1516
|
+
$[130] = triggerId;
|
|
1517
|
+
$[131] = t48;
|
|
1518
|
+
} else t48 = $[131];
|
|
1519
|
+
trigger = t48;
|
|
1520
|
+
} else {
|
|
1521
|
+
bodyLabelledBy = triggerId;
|
|
1522
|
+
const t46 = isMenubarItem ? "menuitem" : void 0;
|
|
1523
|
+
const t47 = menubarTabIndex ?? 0;
|
|
1524
|
+
let t48;
|
|
1525
|
+
if ($[132] !== bodyId || $[133] !== disabled || $[134] !== isOpen || $[135] !== popupRole || $[136] !== t46 || $[137] !== t47 || $[138] !== trigger || $[139] !== triggerId) {
|
|
1526
|
+
t48 = /* @__PURE__ */ jsx("button", {
|
|
1527
|
+
"aria-controls": bodyId,
|
|
1528
|
+
"aria-expanded": isOpen,
|
|
1529
|
+
"aria-haspopup": popupRole,
|
|
1530
|
+
className: "uktdropdown-trigger",
|
|
1531
|
+
disabled,
|
|
1532
|
+
id: triggerId,
|
|
1533
|
+
role: t46,
|
|
1534
|
+
tabIndex: t47,
|
|
1535
|
+
type: "button",
|
|
1536
|
+
children: trigger
|
|
1537
|
+
});
|
|
1538
|
+
$[132] = bodyId;
|
|
1539
|
+
$[133] = disabled;
|
|
1540
|
+
$[134] = isOpen;
|
|
1541
|
+
$[135] = popupRole;
|
|
1542
|
+
$[136] = t46;
|
|
1543
|
+
$[137] = t47;
|
|
1544
|
+
$[138] = trigger;
|
|
1545
|
+
$[139] = triggerId;
|
|
1546
|
+
$[140] = t48;
|
|
1547
|
+
} else t48 = $[140];
|
|
1548
|
+
trigger = t48;
|
|
1549
|
+
}
|
|
1511
1550
|
} else {
|
|
1512
|
-
bodyLabelledBy = triggerId;
|
|
1513
|
-
const t46 = isMenubarItem ? "menuitem" : void 0;
|
|
1514
|
-
const t47 = menubarTabIndex ?? 0;
|
|
1515
|
-
let t48;
|
|
1516
|
-
if ($[132] !== bodyId || $[133] !== disabled || $[134] !== isOpen || $[135] !== popupRole || $[136] !== t46 || $[137] !== t47 || $[138] !== trigger || $[139] !== triggerId) {
|
|
1517
|
-
t48 = /* @__PURE__ */ jsx("button", {
|
|
1518
|
-
"aria-controls": bodyId,
|
|
1519
|
-
"aria-expanded": isOpen,
|
|
1520
|
-
"aria-haspopup": popupRole,
|
|
1521
|
-
className: "uktdropdown-trigger",
|
|
1522
|
-
disabled,
|
|
1523
|
-
id: triggerId,
|
|
1524
|
-
role: t46,
|
|
1525
|
-
tabIndex: t47,
|
|
1526
|
-
type: "button",
|
|
1527
|
-
children: trigger
|
|
1528
|
-
});
|
|
1529
|
-
$[132] = bodyId;
|
|
1530
|
-
$[133] = disabled;
|
|
1531
|
-
$[134] = isOpen;
|
|
1532
|
-
$[135] = popupRole;
|
|
1533
|
-
$[136] = t46;
|
|
1534
|
-
$[137] = t47;
|
|
1535
|
-
$[138] = trigger;
|
|
1536
|
-
$[139] = triggerId;
|
|
1537
|
-
$[140] = t48;
|
|
1538
|
-
} else t48 = $[140];
|
|
1539
|
-
trigger = t48;
|
|
1540
|
-
}
|
|
1541
|
-
else {
|
|
1542
1551
|
const triggerProps = trigger.props;
|
|
1543
1552
|
const resolvedTriggerId = triggerProps.id ?? triggerId;
|
|
1544
1553
|
const isTextInputTrigger = isTextInputElement(trigger);
|