@wow-two-beta/ui 0.0.48 → 0.0.50
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/actions/index.js +2 -2
- package/dist/actions/toggleButton/ToggleButton.d.ts +7 -3
- package/dist/actions/toggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/{chunk-NTUKGLIQ.js → chunk-23DELZVV.js} +3 -3
- package/dist/{chunk-NTUKGLIQ.js.map → chunk-23DELZVV.js.map} +1 -1
- package/dist/{chunk-WPC3KBRU.js → chunk-2CDU2ZKL.js} +3 -3
- package/dist/{chunk-WPC3KBRU.js.map → chunk-2CDU2ZKL.js.map} +1 -1
- package/dist/{chunk-5V7FBKKL.js → chunk-2TKPRR4X.js} +3 -3
- package/dist/{chunk-5V7FBKKL.js.map → chunk-2TKPRR4X.js.map} +1 -1
- package/dist/{chunk-C6XVQ5TW.js → chunk-3YNJTBYF.js} +3 -3
- package/dist/{chunk-C6XVQ5TW.js.map → chunk-3YNJTBYF.js.map} +1 -1
- package/dist/{chunk-JYP2HIG3.js → chunk-BEOOTUFV.js} +4 -4
- package/dist/{chunk-JYP2HIG3.js.map → chunk-BEOOTUFV.js.map} +1 -1
- package/dist/{chunk-6URHYLVG.js → chunk-BUWJN6SN.js} +10 -4
- package/dist/chunk-BUWJN6SN.js.map +1 -0
- package/dist/{chunk-EUA2TRKE.js → chunk-CWT5VEMU.js} +4 -4
- package/dist/{chunk-EUA2TRKE.js.map → chunk-CWT5VEMU.js.map} +1 -1
- package/dist/{chunk-UPSN6NFK.js → chunk-L235NITI.js} +4 -4
- package/dist/{chunk-UPSN6NFK.js.map → chunk-L235NITI.js.map} +1 -1
- package/dist/{chunk-CMBKBLJE.js → chunk-VTVWJBOP.js} +150 -99
- package/dist/chunk-VTVWJBOP.js.map +1 -0
- package/dist/{chunk-34TLJSEH.js → chunk-WU5JMO3N.js} +39 -3
- package/dist/chunk-WU5JMO3N.js.map +1 -0
- package/dist/{chunk-ZJJ4KW6G.js → chunk-ZVOPRSED.js} +4 -4
- package/dist/{chunk-ZJJ4KW6G.js.map → chunk-ZVOPRSED.js.map} +1 -1
- package/dist/display/index.js +3 -3
- package/dist/feedback/index.js +3 -3
- package/dist/forms/index.js +5 -5
- package/dist/forms/select/Select.d.ts +52 -28
- package/dist/forms/select/Select.d.ts.map +1 -1
- package/dist/forms/select/index.d.ts +1 -1
- package/dist/forms/select/index.d.ts.map +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.js +11 -11
- package/dist/layout/index.js +3 -3
- package/dist/nav/index.js +3 -3
- package/dist/overlays/index.js +2 -2
- package/dist/utils/Equality.d.ts +29 -0
- package/dist/utils/Equality.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-34TLJSEH.js.map +0 -1
- package/dist/chunk-6URHYLVG.js.map +0 -1
- package/dist/chunk-CMBKBLJE.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { listboxItemVariants, listboxVariants, listboxGroupLabelVariants, listboxSeparatorVariants, listboxEmptyVariants } from './chunk-
|
|
2
|
-
import { PopoverTrigger, Popover, PopoverContent } from './chunk-
|
|
3
|
-
import { startOfMonth, isSameDay, isToday, isDateDisabled, parseISODate, formatISODate, parseISOTime, Tag, addMonths, Kbd, addDays, buildMonthGrid, MONTHS_LONG, WEEKDAYS_SHORT, formatISOTime, startOfDay, isInRange } from './chunk-
|
|
1
|
+
import { listboxItemVariants, listboxVariants, listboxGroupLabelVariants, listboxSeparatorVariants, listboxEmptyVariants } from './chunk-2CDU2ZKL.js';
|
|
2
|
+
import { PopoverTrigger, Popover, PopoverContent } from './chunk-3YNJTBYF.js';
|
|
3
|
+
import { startOfMonth, isSameDay, isToday, isDateDisabled, parseISODate, formatISODate, parseISOTime, Tag, addMonths, Kbd, addDays, buildMonthGrid, MONTHS_LONG, WEEKDAYS_SHORT, formatISOTime, startOfDay, isInRange } from './chunk-2TKPRR4X.js';
|
|
4
4
|
import { useControlled } from './chunk-NUMFGKPY.js';
|
|
5
5
|
import { Icon } from './chunk-F227LKWK.js';
|
|
6
|
-
import { tv, CssExtensions, dataAttr, surfaceVariants } from './chunk-
|
|
6
|
+
import { tv, CssExtensions, dataAttr, surfaceVariants, Equality } from './chunk-WU5JMO3N.js';
|
|
7
7
|
import { useFormControl, FormControlProvider, RovingFocusGroup, useRovingFocusItem, Portal, AnchoredPositioner, DismissableLayer } from './chunk-BMABNEZX.js';
|
|
8
8
|
import { useId } from './chunk-KDXJQNB6.js';
|
|
9
9
|
import { cn, composeRefs } from './chunk-LDRFQG44.js';
|
|
@@ -1567,7 +1567,7 @@ var selectTriggerVariants = tv({
|
|
|
1567
1567
|
base: "flex w-full items-center justify-between gap-2 rounded-md border bg-popover text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60 data-[state=open]:border-border-strong",
|
|
1568
1568
|
variants: {
|
|
1569
1569
|
size: {
|
|
1570
|
-
xs: "h-7 gap-1.5 px-2 text-
|
|
1570
|
+
xs: "h-7 gap-1.5 px-2.5 text-[11px]",
|
|
1571
1571
|
sm: "h-8 px-2.5 text-sm",
|
|
1572
1572
|
md: "h-10 px-3 text-sm",
|
|
1573
1573
|
lg: "h-12 px-4 text-base"
|
|
@@ -1582,7 +1582,6 @@ var selectTriggerVariants = tv({
|
|
|
1582
1582
|
state: "default"
|
|
1583
1583
|
}
|
|
1584
1584
|
});
|
|
1585
|
-
var defaultEquals2 = (a, b) => Object.is(a, b);
|
|
1586
1585
|
var SelectContext = createContext(null);
|
|
1587
1586
|
function useSelectContext() {
|
|
1588
1587
|
const ctx = useContext(SelectContext);
|
|
@@ -1590,15 +1589,15 @@ function useSelectContext() {
|
|
|
1590
1589
|
return ctx;
|
|
1591
1590
|
}
|
|
1592
1591
|
function SelectImpl({
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1592
|
+
selected,
|
|
1593
|
+
defaultSelected,
|
|
1594
|
+
onChange,
|
|
1595
|
+
keyEquals,
|
|
1597
1596
|
disabled = false,
|
|
1598
1597
|
isLoading = false,
|
|
1599
1598
|
clearable = false,
|
|
1600
1599
|
name,
|
|
1601
|
-
|
|
1600
|
+
serializeKey,
|
|
1602
1601
|
invalid,
|
|
1603
1602
|
defaultOpen = false,
|
|
1604
1603
|
open: openProp,
|
|
@@ -1611,70 +1610,88 @@ function SelectImpl({
|
|
|
1611
1610
|
default: defaultOpen,
|
|
1612
1611
|
onChange: onOpenChange
|
|
1613
1612
|
});
|
|
1614
|
-
const [
|
|
1615
|
-
controlled:
|
|
1616
|
-
default:
|
|
1617
|
-
onChange:
|
|
1613
|
+
const [keyState, setKeyState] = useControlled({
|
|
1614
|
+
controlled: selected,
|
|
1615
|
+
default: defaultSelected ?? null,
|
|
1616
|
+
onChange: void 0
|
|
1617
|
+
// we emit via onChange below — needs both key + value
|
|
1618
1618
|
});
|
|
1619
1619
|
const [items, setItems] = useState([]);
|
|
1620
1620
|
const [query, setQuery] = useState("");
|
|
1621
|
-
const
|
|
1622
|
-
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1627
|
-
|
|
1621
|
+
const keyEqualsRef = useRef(keyEquals);
|
|
1622
|
+
keyEqualsRef.current = keyEquals;
|
|
1623
|
+
const serializeKeyRef = useRef(serializeKey);
|
|
1624
|
+
serializeKeyRef.current = serializeKey;
|
|
1625
|
+
const onChangeRef = useRef(onChange);
|
|
1626
|
+
onChangeRef.current = onChange;
|
|
1627
|
+
const keyEqualsFn = useCallback((a, b) => {
|
|
1628
|
+
const fn = keyEqualsRef.current;
|
|
1629
|
+
return (fn ?? Equality.strict)(a, b);
|
|
1628
1630
|
}, []);
|
|
1629
|
-
const
|
|
1630
|
-
const fn =
|
|
1631
|
-
return (fn ?? ((x) => String(x)))(
|
|
1631
|
+
const serializeKeyFn = useCallback((k) => {
|
|
1632
|
+
const fn = serializeKeyRef.current;
|
|
1633
|
+
return (fn ?? ((x) => String(x)))(k);
|
|
1632
1634
|
}, []);
|
|
1633
|
-
const registerItem = useCallback(
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1635
|
+
const registerItem = useCallback(
|
|
1636
|
+
(entry) => {
|
|
1637
|
+
setItems((prev) => {
|
|
1638
|
+
const idx = prev.findIndex((p) => Object.is(p.itemKey, entry.itemKey));
|
|
1639
|
+
if (idx >= 0) {
|
|
1640
|
+
const existing = prev[idx];
|
|
1641
|
+
if (existing && existing.label === entry.label && existing.text === entry.text && Object.is(existing.value, entry.value)) {
|
|
1642
|
+
return prev;
|
|
1643
|
+
}
|
|
1644
|
+
const next = prev.slice();
|
|
1645
|
+
next[idx] = entry;
|
|
1646
|
+
return next;
|
|
1640
1647
|
}
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
}, []);
|
|
1648
|
-
const unregisterItem = useCallback((v) => {
|
|
1648
|
+
return [...prev, entry];
|
|
1649
|
+
});
|
|
1650
|
+
},
|
|
1651
|
+
[]
|
|
1652
|
+
);
|
|
1653
|
+
const unregisterItem = useCallback((k) => {
|
|
1649
1654
|
setItems((prev) => {
|
|
1650
|
-
const idx = prev.findIndex((p) => Object.is(p.
|
|
1655
|
+
const idx = prev.findIndex((p) => Object.is(p.itemKey, k));
|
|
1651
1656
|
if (idx === -1) return prev;
|
|
1652
1657
|
const next = prev.slice();
|
|
1653
1658
|
next.splice(idx, 1);
|
|
1654
1659
|
return next;
|
|
1655
1660
|
});
|
|
1656
1661
|
}, []);
|
|
1657
|
-
const
|
|
1662
|
+
const emitChange = useCallback(
|
|
1658
1663
|
(next) => {
|
|
1659
|
-
|
|
1664
|
+
onChangeRef.current?.(next);
|
|
1665
|
+
},
|
|
1666
|
+
[]
|
|
1667
|
+
);
|
|
1668
|
+
const onSelect = useCallback(
|
|
1669
|
+
(entry) => {
|
|
1670
|
+
setKeyState(entry.itemKey);
|
|
1660
1671
|
setOpenState(false);
|
|
1661
1672
|
setQuery("");
|
|
1673
|
+
emitChange({
|
|
1674
|
+
itemKey: entry.itemKey,
|
|
1675
|
+
value: entry.value,
|
|
1676
|
+
label: entry.label
|
|
1677
|
+
});
|
|
1662
1678
|
},
|
|
1663
|
-
[
|
|
1679
|
+
[setKeyState, setOpenState, emitChange]
|
|
1664
1680
|
);
|
|
1665
1681
|
const onClear = useCallback(() => {
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1682
|
+
setKeyState(null);
|
|
1683
|
+
emitChange(null);
|
|
1684
|
+
}, [setKeyState, emitChange]);
|
|
1685
|
+
const hasSelection = keyState !== null && keyState !== void 0;
|
|
1669
1686
|
const ctx = useMemo(
|
|
1670
1687
|
() => ({
|
|
1671
1688
|
open: openState,
|
|
1672
1689
|
setOpen: setOpenState,
|
|
1673
|
-
|
|
1674
|
-
|
|
1690
|
+
selectedKey: keyState,
|
|
1691
|
+
hasSelection,
|
|
1675
1692
|
onSelect,
|
|
1676
1693
|
onClear,
|
|
1677
|
-
|
|
1694
|
+
keyEquals: keyEqualsFn,
|
|
1678
1695
|
items,
|
|
1679
1696
|
registerItem,
|
|
1680
1697
|
unregisterItem,
|
|
@@ -1683,18 +1700,18 @@ function SelectImpl({
|
|
|
1683
1700
|
disabled,
|
|
1684
1701
|
isLoading,
|
|
1685
1702
|
clearable,
|
|
1686
|
-
|
|
1703
|
+
serializeKey: serializeKeyFn,
|
|
1687
1704
|
name,
|
|
1688
1705
|
invalid
|
|
1689
1706
|
}),
|
|
1690
1707
|
[
|
|
1691
1708
|
openState,
|
|
1692
1709
|
setOpenState,
|
|
1693
|
-
|
|
1694
|
-
|
|
1710
|
+
keyState,
|
|
1711
|
+
hasSelection,
|
|
1695
1712
|
onSelect,
|
|
1696
1713
|
onClear,
|
|
1697
|
-
|
|
1714
|
+
keyEqualsFn,
|
|
1698
1715
|
items,
|
|
1699
1716
|
registerItem,
|
|
1700
1717
|
unregisterItem,
|
|
@@ -1702,7 +1719,7 @@ function SelectImpl({
|
|
|
1702
1719
|
disabled,
|
|
1703
1720
|
isLoading,
|
|
1704
1721
|
clearable,
|
|
1705
|
-
|
|
1722
|
+
serializeKeyFn,
|
|
1706
1723
|
name,
|
|
1707
1724
|
invalid
|
|
1708
1725
|
]
|
|
@@ -1716,17 +1733,39 @@ function SelectImpl({
|
|
|
1716
1733
|
if (!o) setQuery("");
|
|
1717
1734
|
},
|
|
1718
1735
|
placement,
|
|
1719
|
-
offset:
|
|
1736
|
+
offset: 4,
|
|
1720
1737
|
children
|
|
1721
1738
|
}
|
|
1722
1739
|
) });
|
|
1723
1740
|
}
|
|
1724
1741
|
var Select = SelectImpl;
|
|
1742
|
+
var TRIGGER_ICON_CLASSES = {
|
|
1743
|
+
xs: "h-3 w-3",
|
|
1744
|
+
sm: "h-3.5 w-3.5",
|
|
1745
|
+
md: "h-4 w-4",
|
|
1746
|
+
lg: "h-5 w-5"
|
|
1747
|
+
};
|
|
1748
|
+
var TRIGGER_CLEAR_BOX_CLASSES = {
|
|
1749
|
+
xs: "h-4 w-4",
|
|
1750
|
+
sm: "h-5 w-5",
|
|
1751
|
+
md: "h-5 w-5",
|
|
1752
|
+
lg: "h-6 w-6"
|
|
1753
|
+
};
|
|
1754
|
+
var TRIGGER_DIVIDER_CLASSES = {
|
|
1755
|
+
xs: "h-3",
|
|
1756
|
+
sm: "h-3.5",
|
|
1757
|
+
md: "h-4",
|
|
1758
|
+
lg: "h-5"
|
|
1759
|
+
};
|
|
1725
1760
|
var SelectTrigger = forwardRef(
|
|
1726
1761
|
function SelectTrigger2({ size, state, className, children, ...rest }, ref) {
|
|
1727
1762
|
const ctx = useSelectContext();
|
|
1728
1763
|
const triggerState = state ?? (ctx.invalid ? "invalid" : "default");
|
|
1729
|
-
const showClear = ctx.clearable && ctx.
|
|
1764
|
+
const showClear = ctx.clearable && ctx.hasSelection && !ctx.isLoading && !ctx.disabled;
|
|
1765
|
+
const sizeKey = size ?? "md";
|
|
1766
|
+
const iconClass = TRIGGER_ICON_CLASSES[sizeKey];
|
|
1767
|
+
const clearBoxClass = TRIGGER_CLEAR_BOX_CLASSES[sizeKey];
|
|
1768
|
+
const dividerClass = TRIGGER_DIVIDER_CLASSES[sizeKey];
|
|
1730
1769
|
return /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1731
1770
|
"button",
|
|
1732
1771
|
{
|
|
@@ -1738,34 +1777,41 @@ var SelectTrigger = forwardRef(
|
|
|
1738
1777
|
...rest,
|
|
1739
1778
|
children: [
|
|
1740
1779
|
children ?? /* @__PURE__ */ jsx(SelectValue, {}),
|
|
1741
|
-
/* @__PURE__ */ jsxs("span", { className: "ml-auto flex items-center gap-1", children: [
|
|
1742
|
-
showClear && /* @__PURE__ */
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
e
|
|
1750
|
-
ctx.onClear();
|
|
1751
|
-
},
|
|
1752
|
-
onPointerDown: (e) => e.stopPropagation(),
|
|
1753
|
-
onKeyDown: (e) => {
|
|
1754
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
1755
|
-
e.preventDefault();
|
|
1780
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [
|
|
1781
|
+
showClear && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1782
|
+
/* @__PURE__ */ jsx(
|
|
1783
|
+
"span",
|
|
1784
|
+
{
|
|
1785
|
+
role: "button",
|
|
1786
|
+
tabIndex: 0,
|
|
1787
|
+
"aria-label": "Clear selection",
|
|
1788
|
+
onClick: (e) => {
|
|
1756
1789
|
e.stopPropagation();
|
|
1757
1790
|
ctx.onClear();
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1791
|
+
},
|
|
1792
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
1793
|
+
onKeyDown: (e) => {
|
|
1794
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1795
|
+
e.preventDefault();
|
|
1796
|
+
e.stopPropagation();
|
|
1797
|
+
ctx.onClear();
|
|
1798
|
+
}
|
|
1799
|
+
},
|
|
1800
|
+
className: cn(
|
|
1801
|
+
"grid place-items-center rounded-full text-subtle-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
1802
|
+
clearBoxClass
|
|
1803
|
+
),
|
|
1804
|
+
children: /* @__PURE__ */ jsx(X, { className: iconClass })
|
|
1805
|
+
}
|
|
1806
|
+
),
|
|
1807
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn("w-px bg-border", dividerClass) })
|
|
1808
|
+
] }),
|
|
1809
|
+
ctx.isLoading ? /* @__PURE__ */ jsx(Loader2, { className: cn(iconClass, "animate-spin text-subtle-foreground") }) : /* @__PURE__ */ jsx(
|
|
1765
1810
|
ChevronDown,
|
|
1766
1811
|
{
|
|
1767
1812
|
className: cn(
|
|
1768
|
-
|
|
1813
|
+
iconClass,
|
|
1814
|
+
"text-muted-foreground transition-transform",
|
|
1769
1815
|
ctx.open && "rotate-180"
|
|
1770
1816
|
)
|
|
1771
1817
|
}
|
|
@@ -1779,8 +1825,8 @@ var SelectTrigger = forwardRef(
|
|
|
1779
1825
|
function SelectValue({ placeholder, children }) {
|
|
1780
1826
|
const ctx = useSelectContext();
|
|
1781
1827
|
if (children) return /* @__PURE__ */ jsx("span", { className: "truncate", children });
|
|
1782
|
-
const match = ctx.
|
|
1783
|
-
const label = match?.label ?? (ctx.
|
|
1828
|
+
const match = ctx.hasSelection ? ctx.items.find((i) => ctx.keyEquals(i.itemKey, ctx.selectedKey)) : void 0;
|
|
1829
|
+
const label = match?.label ?? (ctx.hasSelection ? ctx.serializeKey(ctx.selectedKey) : null);
|
|
1784
1830
|
return /* @__PURE__ */ jsx("span", { className: cn("truncate text-left", !label && "text-subtle-foreground"), children: label ?? placeholder });
|
|
1785
1831
|
}
|
|
1786
1832
|
function SelectContent({
|
|
@@ -1788,6 +1834,7 @@ function SelectContent({
|
|
|
1788
1834
|
searchable = false,
|
|
1789
1835
|
searchPlaceholder = "Search\u2026",
|
|
1790
1836
|
noResultsLabel = "No results",
|
|
1837
|
+
matchWidth = false,
|
|
1791
1838
|
variant,
|
|
1792
1839
|
tone,
|
|
1793
1840
|
radius,
|
|
@@ -1808,7 +1855,8 @@ function SelectContent({
|
|
|
1808
1855
|
padding: padding ?? "none",
|
|
1809
1856
|
elevation,
|
|
1810
1857
|
className: cn(
|
|
1811
|
-
"
|
|
1858
|
+
"overflow-hidden",
|
|
1859
|
+
matchWidth ? "w-[var(--anchor-width)] [&_[role=option]>span.flex-1>:first-child]:truncate" : "w-auto min-w-[var(--anchor-width)]",
|
|
1812
1860
|
className
|
|
1813
1861
|
),
|
|
1814
1862
|
children: [
|
|
@@ -1828,11 +1876,13 @@ function SelectContent({
|
|
|
1828
1876
|
/* @__PURE__ */ jsxs(
|
|
1829
1877
|
Listbox,
|
|
1830
1878
|
{
|
|
1831
|
-
value: ctx.
|
|
1832
|
-
onValueChange: (
|
|
1833
|
-
if (
|
|
1879
|
+
value: ctx.selectedKey ?? void 0,
|
|
1880
|
+
onValueChange: (k) => {
|
|
1881
|
+
if (k === null || k === void 0) return;
|
|
1882
|
+
const entry = ctx.items.find((i) => ctx.keyEquals(i.itemKey, k));
|
|
1883
|
+
if (entry) ctx.onSelect(entry);
|
|
1834
1884
|
},
|
|
1835
|
-
isEqual: ctx.
|
|
1885
|
+
isEqual: ctx.keyEquals,
|
|
1836
1886
|
variant: "flat",
|
|
1837
1887
|
radius: "none",
|
|
1838
1888
|
children: [
|
|
@@ -1841,7 +1891,7 @@ function SelectContent({
|
|
|
1841
1891
|
]
|
|
1842
1892
|
}
|
|
1843
1893
|
),
|
|
1844
|
-
ctx.name && ctx.
|
|
1894
|
+
ctx.name && ctx.hasSelection && /* @__PURE__ */ jsx("input", { type: "hidden", name: ctx.name, value: ctx.serializeKey(ctx.selectedKey) })
|
|
1845
1895
|
]
|
|
1846
1896
|
}
|
|
1847
1897
|
);
|
|
@@ -1850,26 +1900,27 @@ function extractText(node) {
|
|
|
1850
1900
|
if (node == null || typeof node === "boolean") return "";
|
|
1851
1901
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
1852
1902
|
if (Array.isArray(node)) return node.map(extractText).join(" ");
|
|
1853
|
-
if (
|
|
1903
|
+
if (typeof node === "object" && "props" in node) {
|
|
1854
1904
|
const props = node.props;
|
|
1855
|
-
return extractText(props
|
|
1905
|
+
return extractText(props?.children);
|
|
1856
1906
|
}
|
|
1857
1907
|
return "";
|
|
1858
1908
|
}
|
|
1859
|
-
var SelectItem = forwardRef(function SelectItem2({ value,
|
|
1909
|
+
var SelectItem = forwardRef(function SelectItem2({ itemKey, value, label, children, text, disabled, className }, ref) {
|
|
1860
1910
|
const ctx = useSelectContext();
|
|
1861
1911
|
const { registerItem, unregisterItem, query } = ctx;
|
|
1912
|
+
const resolvedValue = value === void 0 ? itemKey : value;
|
|
1862
1913
|
const itemText = useMemo(
|
|
1863
|
-
() => text ?? extractText(children),
|
|
1864
|
-
[text, children]
|
|
1914
|
+
() => text ?? extractText(label) ?? extractText(children),
|
|
1915
|
+
[text, label, children]
|
|
1865
1916
|
);
|
|
1866
1917
|
useEffect(() => {
|
|
1867
|
-
registerItem({
|
|
1868
|
-
return () => unregisterItem(
|
|
1869
|
-
}, [registerItem, unregisterItem,
|
|
1918
|
+
registerItem({ itemKey, value: resolvedValue, label, text: itemText });
|
|
1919
|
+
return () => unregisterItem(itemKey);
|
|
1920
|
+
}, [registerItem, unregisterItem, itemKey, resolvedValue, label, itemText]);
|
|
1870
1921
|
const matchesQuery = !query || itemText.toLowerCase().includes(query.toLowerCase());
|
|
1871
1922
|
if (!matchesQuery) return null;
|
|
1872
|
-
return /* @__PURE__ */ jsx(ListboxItem, { ref, value, disabled, className, children });
|
|
1923
|
+
return /* @__PURE__ */ jsx(ListboxItem, { ref, value: itemKey, disabled, className, children: children ?? label });
|
|
1873
1924
|
});
|
|
1874
1925
|
Select.Trigger = SelectTrigger;
|
|
1875
1926
|
Select.Value = SelectValue;
|
|
@@ -7401,5 +7452,5 @@ var ChatComposer = forwardRef(
|
|
|
7401
7452
|
ChatComposer.displayName = "ChatComposer";
|
|
7402
7453
|
|
|
7403
7454
|
export { ADDRESS_COUNTRIES, AddressForm, BUILT_IN_EMOJI, BUILT_IN_FONTS, Calendar, CharacterCount, ChatComposer, Checkbox, CheckboxField, CheckboxGroup, ChoiceCard, CodeEditor, ColorArea, ColorField, ColorPicker, ColorSlider, ColorSwatch, ColorSwatchPicker, ColorWheel, Combobox, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxSeparator, CronInput, CurrencyInput, DateField, DatePicker, DateRangePicker, Editable, EditableCancel, EditableInput, EditablePreview, EditableSubmit, EmailInput, EmojiPicker, Fieldset, FilePicker, FileUpload, FontPicker, FormErrorMessage, FormField, FormHelperText, GradientPicker, IconPicker, InputAddon, InputGroup, JSONEditor, KeyboardShortcutPicker, Knob, Label, LabeledInput, Legend, Listbox, ListboxEmpty, ListboxGroup, ListboxItem, ListboxSeparator, MarkdownEditor, MaskedInput, MultiSelect, MultiSelectContent, MultiSelectItem, MultiSelectTags, MultiSelectTrigger, NumberInput, PHONE_COUNTRIES, PasswordInput, PasswordStrength, PercentInput, PhoneInput, PinInput, Radio, RadioField, RadioGroup, RangeCalendar, ReactionPicker, RecurrenceEditor, SearchInput, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Slider, Stepper, StepperList, StepperPanel, StepperStep, Switch, SwitchField, TagsInput, TelInput, TextInput, Textarea, TimeField, TimePicker, UrlInput, Wizard, WizardFooter, WizardStep, WizardSteps, colorSwatchVariants, gradientToCss, useWizard };
|
|
7404
|
-
//# sourceMappingURL=chunk-
|
|
7405
|
-
//# sourceMappingURL=chunk-
|
|
7455
|
+
//# sourceMappingURL=chunk-VTVWJBOP.js.map
|
|
7456
|
+
//# sourceMappingURL=chunk-VTVWJBOP.js.map
|