@apteva/apteva-kit 0.1.113 → 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.mjs CHANGED
@@ -1449,9 +1449,12 @@ function PortalDropdown({
1449
1449
  children
1450
1450
  }) {
1451
1451
  const dropdownRef = useRef3(null);
1452
- const [pos, setPos] = useState3({ top: 0, left: 0, width: 0 });
1452
+ const [pos, setPos] = useState3(null);
1453
1453
  useEffect3(() => {
1454
- if (!open || !anchorRef.current) return;
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 createPortal(
1492
1495
  /* @__PURE__ */ jsx6(
1493
1496
  "div",
@@ -1517,7 +1520,7 @@ function CustomSelect({
1517
1520
  }) {
1518
1521
  const [open, setOpen] = useState3(false);
1519
1522
  const triggerRef = useRef3(null);
1520
- const selected = options?.find((o) => o.value === value);
1523
+ const selected = options?.find((o) => o.label === value || o.value === value);
1521
1524
  const close = useCallback(() => setOpen(false), []);
1522
1525
  return /* @__PURE__ */ jsxs4("div", { className: "apteva-select relative", children: [
1523
1526
  /* @__PURE__ */ jsxs4(
@@ -1533,7 +1536,7 @@ function CustomSelect({
1533
1536
  "aria-hidden": true,
1534
1537
  children: [
1535
1538
  /* @__PURE__ */ jsx6("option", { value: "" }),
1536
- options?.map((o) => /* @__PURE__ */ jsx6("option", { value: o.value, children: o.label }, o.value))
1539
+ options?.map((o) => /* @__PURE__ */ jsx6("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.value);
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 ${opt.value === value ? "apteva-select-option-active" : ""}`,
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