@apteva/apteva-kit 0.1.114 → 0.1.115
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/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1449,9 +1449,12 @@ function PortalDropdown({
|
|
|
1449
1449
|
children
|
|
1450
1450
|
}) {
|
|
1451
1451
|
const dropdownRef = _react.useRef.call(void 0, null);
|
|
1452
|
-
const [pos, setPos] = _react.useState.call(void 0,
|
|
1452
|
+
const [pos, setPos] = _react.useState.call(void 0, null);
|
|
1453
1453
|
_react.useEffect.call(void 0, () => {
|
|
1454
|
-
if (!open || !anchorRef.current)
|
|
1454
|
+
if (!open || !anchorRef.current) {
|
|
1455
|
+
setPos(null);
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1455
1458
|
const update = () => {
|
|
1456
1459
|
const rect = anchorRef.current.getBoundingClientRect();
|
|
1457
1460
|
setPos({
|
|
@@ -1487,7 +1490,7 @@ function PortalDropdown({
|
|
|
1487
1490
|
document.addEventListener("keydown", handler);
|
|
1488
1491
|
return () => document.removeEventListener("keydown", handler);
|
|
1489
1492
|
}, [open, onClose]);
|
|
1490
|
-
if (!open) return null;
|
|
1493
|
+
if (!open || !pos) return null;
|
|
1491
1494
|
return _reactdom.createPortal.call(void 0,
|
|
1492
1495
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1493
1496
|
"div",
|
|
@@ -1517,7 +1520,7 @@ function CustomSelect({
|
|
|
1517
1520
|
}) {
|
|
1518
1521
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
1519
1522
|
const triggerRef = _react.useRef.call(void 0, null);
|
|
1520
|
-
const selected = _optionalChain([options, 'optionalAccess', _18 => _18.find, 'call', _19 => _19((o) => o.value === value)]);
|
|
1523
|
+
const selected = _optionalChain([options, 'optionalAccess', _18 => _18.find, 'call', _19 => _19((o) => o.label === value || o.value === value)]);
|
|
1521
1524
|
const close = _react.useCallback.call(void 0, () => setOpen(false), []);
|
|
1522
1525
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-select relative", children: [
|
|
1523
1526
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -1533,7 +1536,7 @@ function CustomSelect({
|
|
|
1533
1536
|
"aria-hidden": true,
|
|
1534
1537
|
children: [
|
|
1535
1538
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "" }),
|
|
1536
|
-
_optionalChain([options, 'optionalAccess', _20 => _20.map, 'call', _21 => _21((o) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: o.
|
|
1539
|
+
_optionalChain([options, 'optionalAccess', _20 => _20.map, 'call', _21 => _21((o) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: o.label, children: o.label }, o.value))])
|
|
1537
1540
|
]
|
|
1538
1541
|
}
|
|
1539
1542
|
),
|
|
@@ -1565,10 +1568,10 @@ function CustomSelect({
|
|
|
1565
1568
|
{
|
|
1566
1569
|
type: "button",
|
|
1567
1570
|
onClick: () => {
|
|
1568
|
-
onChange(opt.
|
|
1571
|
+
onChange(opt.label);
|
|
1569
1572
|
close();
|
|
1570
1573
|
},
|
|
1571
|
-
className: `apteva-select-option w-full text-left px-3 py-2 text-sm transition-colors ${
|
|
1574
|
+
className: `apteva-select-option w-full text-left px-3 py-2 text-sm transition-colors ${value === opt.label ? "apteva-select-option-active" : ""}`,
|
|
1572
1575
|
children: opt.label
|
|
1573
1576
|
},
|
|
1574
1577
|
opt.value
|