@overmap-ai/blocks 1.0.34-command-menu.3 → 1.0.34-command-menu.4
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/CheckedIndicator/CheckedIndicator.d.ts +2 -2
- package/dist/CommandMenu/CheckboxIndicator.d.ts +1 -2
- package/dist/CommandMenu/MultiSelectGroup.d.ts +2 -4
- package/dist/CommandMenu/RadioGroup.d.ts +2 -5
- package/dist/CommandMenu/SelectedIndicator.d.ts +1 -2
- package/dist/CommandMenu/context.d.ts +1 -13
- package/dist/CommandMenu/index.d.ts +2 -2
- package/dist/CommandMenu/utils.d.ts +1 -1
- package/dist/Menu/CheckboxItemIndicator/CheckboxItemIndicator.d.ts +1 -1
- package/dist/Menu/SelectAll/index.d.ts +0 -1
- package/dist/Menu/SelectedIndicator/SelectedIndicator.d.ts +1 -1
- package/dist/Menu/SelectedIndicator/context.d.ts +2 -6
- package/dist/Menu/cva.d.ts +0 -3
- package/dist/Menu/index.d.ts +2 -3
- package/dist/Menu/typings.d.ts +3 -9
- package/dist/Menu/utils.d.ts +7 -1
- package/dist/SelectContext/MultiSelectProvider.d.ts +3 -0
- package/dist/SelectContext/SingleSelectProvider.d.ts +4 -0
- package/dist/SelectContext/context.d.ts +13 -3
- package/dist/SelectContext/index.d.ts +2 -2
- package/dist/SelectContext/typings.d.ts +16 -8
- package/dist/blocks.js +277 -235
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +276 -234
- package/dist/blocks.umd.cjs.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/Menu/SelectAll/SelectAllIndicator.d.ts +0 -3
- package/dist/Menu/SelectAll/context.d.ts +0 -6
- package/dist/SelectContext/Provider.d.ts +0 -14
package/dist/blocks.umd.cjs
CHANGED
|
@@ -1026,30 +1026,37 @@
|
|
|
1026
1026
|
);
|
|
1027
1027
|
});
|
|
1028
1028
|
const CommandMenuContext = React.createContext({});
|
|
1029
|
-
const SelectContext$1 = React.createContext({});
|
|
1030
|
-
const MultiSelectGroupContext = React.createContext({});
|
|
1031
1029
|
const SelectedIndicatorContext$1 = React.createContext(false);
|
|
1032
1030
|
const CheckboxIndicatorContext = React.createContext(false);
|
|
1033
1031
|
const CommandMenuPageContext = React.createContext({});
|
|
1034
1032
|
const CommandMenuDialogContext = React.createContext({});
|
|
1035
|
-
function getSelectedState(selected) {
|
|
1033
|
+
function getSelectedState$1(selected) {
|
|
1036
1034
|
return selected ? "selected" : "unselected";
|
|
1037
1035
|
}
|
|
1038
|
-
function getCheckedState(checked) {
|
|
1036
|
+
function getCheckedState$1(checked) {
|
|
1039
1037
|
return checked === true ? "checked" : checked === false ? "unchecked" : "indeterminate";
|
|
1040
1038
|
}
|
|
1041
1039
|
function getActiveState(active) {
|
|
1042
1040
|
return active ? "active" : "inactive";
|
|
1043
1041
|
}
|
|
1044
1042
|
const CommandMenuCheckboxIndicator = (props) => {
|
|
1045
|
-
const { ref,
|
|
1043
|
+
const { ref, className, children, ...rest } = props;
|
|
1046
1044
|
const checkedState = React.use(CheckboxIndicatorContext);
|
|
1047
1045
|
const computedChildren = React.useMemo(() => {
|
|
1048
1046
|
return typeof children === "function" ? children(checkedState) : children;
|
|
1049
1047
|
}, [checkedState, children]);
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1048
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1049
|
+
"span",
|
|
1050
|
+
{
|
|
1051
|
+
ref,
|
|
1052
|
+
"data-state": getCheckedState$1(checkedState),
|
|
1053
|
+
className: classVarianceAuthority.cx(className, "inline-block size-max", {
|
|
1054
|
+
invisible: checkedState === false
|
|
1055
|
+
}),
|
|
1056
|
+
...rest,
|
|
1057
|
+
children: computedChildren
|
|
1058
|
+
}
|
|
1059
|
+
);
|
|
1053
1060
|
};
|
|
1054
1061
|
const commandMenuContentCva = classVarianceAuthority.cva(
|
|
1055
1062
|
[
|
|
@@ -1292,7 +1299,7 @@
|
|
|
1292
1299
|
},
|
|
1293
1300
|
[checked, onCheckedChange, onSelect]
|
|
1294
1301
|
);
|
|
1295
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxIndicatorContext, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getCheckedState(checked), ...rest, children }) });
|
|
1302
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxIndicatorContext, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getCheckedState$1(checked), ...rest, children }) });
|
|
1296
1303
|
};
|
|
1297
1304
|
const CommandMenuContent = React.memo((props) => {
|
|
1298
1305
|
const providerContext = useProvider();
|
|
@@ -1383,10 +1390,26 @@
|
|
|
1383
1390
|
);
|
|
1384
1391
|
});
|
|
1385
1392
|
CommandMenuList.displayName = "CommandMenuList";
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
const
|
|
1393
|
+
const SelectContext = React.createContext({});
|
|
1394
|
+
const MultiSelectContext = React.createContext({});
|
|
1395
|
+
const MultiSelectProvider = React.memo((props) => {
|
|
1396
|
+
const { children, defaultValues, values: controlledValues, onValuesChange } = props;
|
|
1397
|
+
const [itemValueMapping, setItemValueMapping] = React.useState(/* @__PURE__ */ new Set());
|
|
1398
|
+
const [values, setValues] = useControlledState(defaultValues ?? [], controlledValues, onValuesChange);
|
|
1399
|
+
const registerValue = React.useCallback((value) => {
|
|
1400
|
+
setItemValueMapping((prev) => {
|
|
1401
|
+
const newSet = new Set(prev);
|
|
1402
|
+
newSet.add(value);
|
|
1403
|
+
return newSet;
|
|
1404
|
+
});
|
|
1405
|
+
return () => {
|
|
1406
|
+
setItemValueMapping((prev) => {
|
|
1407
|
+
const newSet = new Set(prev);
|
|
1408
|
+
newSet.delete(value);
|
|
1409
|
+
return newSet;
|
|
1410
|
+
});
|
|
1411
|
+
};
|
|
1412
|
+
}, []);
|
|
1390
1413
|
const selected = React.useCallback((value) => values.includes(value), [values]);
|
|
1391
1414
|
const selectValue = React.useCallback(
|
|
1392
1415
|
(value) => {
|
|
@@ -1398,37 +1421,65 @@
|
|
|
1398
1421
|
},
|
|
1399
1422
|
[selected, setValues, values]
|
|
1400
1423
|
);
|
|
1401
|
-
const
|
|
1402
|
-
return
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
}, [
|
|
1407
|
-
const
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
values
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1424
|
+
const allSelected = React.useMemo(() => {
|
|
1425
|
+
return Array.from(itemValueMapping.values()).every((value) => values.includes(value));
|
|
1426
|
+
}, [itemValueMapping, values]);
|
|
1427
|
+
const someSelected = React.useMemo(() => {
|
|
1428
|
+
return Array.from(itemValueMapping.values()).some((value) => values.includes(value));
|
|
1429
|
+
}, [itemValueMapping, values]);
|
|
1430
|
+
const toggleSelectAll = React.useCallback(() => {
|
|
1431
|
+
if (allSelected) {
|
|
1432
|
+
setValues([]);
|
|
1433
|
+
} else {
|
|
1434
|
+
setValues(Array.from(itemValueMapping.values()));
|
|
1435
|
+
}
|
|
1436
|
+
}, [allSelected, itemValueMapping, setValues]);
|
|
1437
|
+
const contextValue = React.useMemo(
|
|
1438
|
+
() => ({ selected, selectValue, allSelected, someSelected, toggleSelectAll, registerValue }),
|
|
1439
|
+
[allSelected, registerValue, selectValue, selected, someSelected, toggleSelectAll]
|
|
1440
|
+
);
|
|
1441
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MultiSelectContext, { value: contextValue, children });
|
|
1442
|
+
});
|
|
1443
|
+
MultiSelectProvider.displayName = "MultiSelectProvider";
|
|
1444
|
+
const SingleSelectRequiredProvider = React.memo((props) => {
|
|
1445
|
+
const { children, defaultValue, value, onValueChange } = props;
|
|
1446
|
+
const [controlledValue, setControlledValue] = useControlledState(defaultValue ?? "", value, onValueChange);
|
|
1447
|
+
const selected = React.useCallback((v) => v === controlledValue, [controlledValue]);
|
|
1448
|
+
const selectValue = React.useCallback(
|
|
1449
|
+
(v) => {
|
|
1450
|
+
if (selected(v)) return;
|
|
1451
|
+
setControlledValue(v);
|
|
1452
|
+
},
|
|
1453
|
+
[selected, setControlledValue]
|
|
1454
|
+
);
|
|
1455
|
+
const contextValue = React.useMemo(() => ({ selected, selectValue }), [selectValue, selected]);
|
|
1456
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectContext, { value: contextValue, children });
|
|
1457
|
+
});
|
|
1458
|
+
SingleSelectRequiredProvider.displayName = "SingleSelectRequiredProvider";
|
|
1459
|
+
const SingleSelectNotRequiredProvider = React.memo((props) => {
|
|
1460
|
+
const { children, defaultValue = null, value: controlledValue, onValueChange } = props;
|
|
1461
|
+
const [value, setValue] = useControlledState(defaultValue, controlledValue, onValueChange);
|
|
1462
|
+
const selected = React.useCallback((v) => v === value, [value]);
|
|
1463
|
+
const selectValue = React.useCallback(
|
|
1464
|
+
(v) => {
|
|
1465
|
+
setValue(selected(v) ? null : v);
|
|
1466
|
+
},
|
|
1467
|
+
[selected, setValue]
|
|
1468
|
+
);
|
|
1469
|
+
const contextValue = React.useMemo(() => ({ selected, selectValue }), [selected, selectValue]);
|
|
1470
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectContext, { value: contextValue, children });
|
|
1471
|
+
});
|
|
1472
|
+
SingleSelectNotRequiredProvider.displayName = "SingleSelectNotRequiredProvider";
|
|
1473
|
+
const CommandMenuMultiSelectGroup = (props) => {
|
|
1474
|
+
const { children, ref, defaultValues, values, onValuesChange, ...rest } = props;
|
|
1475
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MultiSelectProvider, { values, onValuesChange, defaultValues, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuGroup, { ref, "aria-multiselectable": true, ...rest, children }) });
|
|
1416
1476
|
};
|
|
1417
1477
|
const CommandMenuMultiSelectItem = (props) => {
|
|
1418
1478
|
const { children, ref, value, onSelect, closeOnSelect = false, ...rest } = props;
|
|
1419
|
-
const { selected, selectValue: handleSelectValue } = React.use(
|
|
1420
|
-
const itemValueId = React.useId();
|
|
1421
|
-
const { setItemValueMapping } = React.use(MultiSelectGroupContext);
|
|
1479
|
+
const { selected, selectValue: handleSelectValue, registerValue } = React.use(MultiSelectContext);
|
|
1422
1480
|
React.useLayoutEffect(() => {
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
setItemValueMapping((prev) => {
|
|
1426
|
-
const next = new Map(prev);
|
|
1427
|
-
next.delete(itemValueId);
|
|
1428
|
-
return next;
|
|
1429
|
-
});
|
|
1430
|
-
};
|
|
1431
|
-
}, [itemValueId, setItemValueMapping, value]);
|
|
1481
|
+
return registerValue(value);
|
|
1482
|
+
}, [registerValue, value]);
|
|
1432
1483
|
const handleSelect = React.useCallback(
|
|
1433
1484
|
(value2) => {
|
|
1434
1485
|
onSelect == null ? void 0 : onSelect(value2);
|
|
@@ -1442,7 +1493,7 @@
|
|
|
1442
1493
|
{
|
|
1443
1494
|
ref,
|
|
1444
1495
|
onSelect: handleSelect,
|
|
1445
|
-
"data-state": getSelectedState(isSelected),
|
|
1496
|
+
"data-state": getSelectedState$1(isSelected),
|
|
1446
1497
|
"aria-selected": isSelected,
|
|
1447
1498
|
value,
|
|
1448
1499
|
closeOnSelect,
|
|
@@ -1490,21 +1541,20 @@
|
|
|
1490
1541
|
) });
|
|
1491
1542
|
};
|
|
1492
1543
|
const CommandMenuRadioGroup = (props) => {
|
|
1493
|
-
const { children, ref, defaultValue
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CommandMenuGroup, { ref, role: "radiogroup", ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(SelectContext$1, { value: contextValue, children }) });
|
|
1544
|
+
const { children, ref, required, defaultValue, value, onValueChange, ...rest } = props;
|
|
1545
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CommandMenuGroup, { ref, role: "radiogroup", ...rest, children: required ? /* @__PURE__ */ jsxRuntime.jsx(SingleSelectRequiredProvider, { defaultValue, value, onValueChange, children }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1546
|
+
SingleSelectNotRequiredProvider,
|
|
1547
|
+
{
|
|
1548
|
+
defaultValue,
|
|
1549
|
+
value,
|
|
1550
|
+
onValueChange,
|
|
1551
|
+
children
|
|
1552
|
+
}
|
|
1553
|
+
) });
|
|
1504
1554
|
};
|
|
1505
1555
|
const CommandMenuRadioItem = (props) => {
|
|
1506
1556
|
const { children, ref, value, onSelect, ...rest } = props;
|
|
1507
|
-
const { selected, selectValue } = React.use(SelectContext
|
|
1557
|
+
const { selected, selectValue } = React.use(SelectContext);
|
|
1508
1558
|
const handleSelect = React.useCallback(
|
|
1509
1559
|
(value2) => {
|
|
1510
1560
|
onSelect == null ? void 0 : onSelect(value2);
|
|
@@ -1518,7 +1568,7 @@
|
|
|
1518
1568
|
{
|
|
1519
1569
|
ref,
|
|
1520
1570
|
onSelect: handleSelect,
|
|
1521
|
-
"data-state": getSelectedState(isSelected),
|
|
1571
|
+
"data-state": getSelectedState$1(isSelected),
|
|
1522
1572
|
value,
|
|
1523
1573
|
...rest,
|
|
1524
1574
|
children
|
|
@@ -1539,41 +1589,45 @@
|
|
|
1539
1589
|
CommandMenuRoot.displayName = "CommandMenuRoot";
|
|
1540
1590
|
const CommandMenuSelectAllItem = (props) => {
|
|
1541
1591
|
const { ref, onSelect, closeOnSelect = false, ...rest } = props;
|
|
1542
|
-
const {
|
|
1543
|
-
const selectedState = React.useMemo(() => {
|
|
1544
|
-
const allValues = Array.from(itemValueMapping.values());
|
|
1545
|
-
if (allValues.every((value) => values.includes(value))) return true;
|
|
1546
|
-
if (allValues.some((value) => values.includes(value))) return "indeterminate";
|
|
1547
|
-
return false;
|
|
1548
|
-
}, [itemValueMapping, values]);
|
|
1592
|
+
const { allSelected, someSelected, toggleSelectAll } = React.use(MultiSelectContext);
|
|
1549
1593
|
const handleSelect = React.useCallback(
|
|
1550
1594
|
(value) => {
|
|
1551
1595
|
onSelect == null ? void 0 : onSelect(value);
|
|
1552
|
-
|
|
1596
|
+
toggleSelectAll();
|
|
1553
1597
|
},
|
|
1554
|
-
[
|
|
1598
|
+
[onSelect, toggleSelectAll]
|
|
1555
1599
|
);
|
|
1600
|
+
const selectedState = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
1556
1601
|
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxIndicatorContext, { value: selectedState, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1557
1602
|
CommandMenuItem,
|
|
1558
1603
|
{
|
|
1559
1604
|
ref,
|
|
1560
1605
|
role: "menuitemcheckbox",
|
|
1561
1606
|
onSelect: handleSelect,
|
|
1562
|
-
"data-state": getCheckedState(selectedState),
|
|
1607
|
+
"data-state": getCheckedState$1(selectedState),
|
|
1563
1608
|
closeOnSelect,
|
|
1564
1609
|
...rest
|
|
1565
1610
|
}
|
|
1566
1611
|
) });
|
|
1567
1612
|
};
|
|
1568
1613
|
const CommandMenuSelectedIndicator = (props) => {
|
|
1569
|
-
const { ref,
|
|
1614
|
+
const { ref, className, children, ...rest } = props;
|
|
1570
1615
|
const isSelected = React.use(SelectedIndicatorContext$1);
|
|
1571
1616
|
const computedChildren = React.useMemo(() => {
|
|
1572
1617
|
return typeof children === "function" ? children(isSelected) : children;
|
|
1573
1618
|
}, [isSelected, children]);
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1619
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1620
|
+
"span",
|
|
1621
|
+
{
|
|
1622
|
+
ref,
|
|
1623
|
+
"data-state": getSelectedState$1(isSelected),
|
|
1624
|
+
className: classVarianceAuthority.cx(className, "inline-block size-max", {
|
|
1625
|
+
invisible: !isSelected
|
|
1626
|
+
}),
|
|
1627
|
+
...rest,
|
|
1628
|
+
children: computedChildren
|
|
1629
|
+
}
|
|
1630
|
+
);
|
|
1577
1631
|
};
|
|
1578
1632
|
const CommandMenuSeparator = React.memo((props) => {
|
|
1579
1633
|
const { className, ref, spacing = false, ...rest } = props;
|
|
@@ -2626,29 +2680,53 @@
|
|
|
2626
2680
|
Link.displayName = "Link";
|
|
2627
2681
|
const CheckedIndicatorContext = React.createContext({});
|
|
2628
2682
|
const CheckedIndicator = (props) => {
|
|
2629
|
-
const { children } = props;
|
|
2683
|
+
const { children, ref, className, ...rest } = props;
|
|
2630
2684
|
const checked = React.useContext(CheckedIndicatorContext);
|
|
2631
2685
|
const computedChildren = typeof children === "function" ? children(checked === "indeterminate") : children;
|
|
2632
|
-
return
|
|
2686
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2687
|
+
"span",
|
|
2688
|
+
{
|
|
2689
|
+
ref,
|
|
2690
|
+
className: classVarianceAuthority.cx(className, {
|
|
2691
|
+
invisible: checked === false
|
|
2692
|
+
}),
|
|
2693
|
+
"data-state": getCheckedState$1(checked),
|
|
2694
|
+
...rest,
|
|
2695
|
+
children: computedChildren
|
|
2696
|
+
}
|
|
2697
|
+
);
|
|
2633
2698
|
};
|
|
2634
2699
|
const menuItem = classVarianceAuthority.cva(
|
|
2635
|
-
[
|
|
2700
|
+
[
|
|
2701
|
+
"select-none",
|
|
2702
|
+
"relative",
|
|
2703
|
+
"flex",
|
|
2704
|
+
"items-center",
|
|
2705
|
+
"rounded",
|
|
2706
|
+
"outline-none",
|
|
2707
|
+
"data-[disabled=true]:text-(--base-a8)"
|
|
2708
|
+
],
|
|
2636
2709
|
{
|
|
2637
2710
|
variants: {
|
|
2638
2711
|
size: {
|
|
2639
|
-
xs: ["h-5", "
|
|
2640
|
-
sm: ["h-6", "
|
|
2641
|
-
md: ["h-7", "
|
|
2642
|
-
lg: ["h-8", "
|
|
2643
|
-
xl: ["h-9", "
|
|
2712
|
+
xs: ["h-5", "gap-1.5", "px-1.5"],
|
|
2713
|
+
sm: ["h-6", "gap-2.25", "px-2.25"],
|
|
2714
|
+
md: ["h-7", "gap-3", "px-3"],
|
|
2715
|
+
lg: ["h-8", "gap-3.75", "px-3.75"],
|
|
2716
|
+
xl: ["h-9", "gap-4.5", "px-4.5"]
|
|
2644
2717
|
},
|
|
2645
2718
|
variant: {
|
|
2646
2719
|
solid: [
|
|
2647
2720
|
"text-(--base-12)",
|
|
2648
|
-
"data-highlighted:not-data-disabled:text-(--accent-contrast)",
|
|
2649
|
-
"data-highlighted:not-data-disabled:bg-(--accent-a9)"
|
|
2721
|
+
"data-highlighted:not-data-[disabled=true]:text-(--accent-contrast)",
|
|
2722
|
+
"data-highlighted:not-data-[disabled=true]:bg-(--accent-a9)",
|
|
2723
|
+
"data-highlighted:not-data-[disabled=true]:active:brightness-110"
|
|
2650
2724
|
],
|
|
2651
|
-
soft: [
|
|
2725
|
+
soft: [
|
|
2726
|
+
"text-(--base-12)",
|
|
2727
|
+
"data-highlighted:not-data-[disabled=true]:bg-(--accent-a3)",
|
|
2728
|
+
"data-highlighted:not-data-[disabled=true]:active:bg-(--accent-a4)"
|
|
2729
|
+
]
|
|
2652
2730
|
}
|
|
2653
2731
|
},
|
|
2654
2732
|
defaultVariants: {
|
|
@@ -2671,20 +2749,6 @@
|
|
|
2671
2749
|
size: "md"
|
|
2672
2750
|
}
|
|
2673
2751
|
});
|
|
2674
|
-
const menuSelectedIndicator = classVarianceAuthority.cva(["flex", "items-center", "justify-center"], {
|
|
2675
|
-
variants: {
|
|
2676
|
-
size: {
|
|
2677
|
-
xs: ["w-4", "h-4"],
|
|
2678
|
-
sm: ["w-5", "h-5"],
|
|
2679
|
-
md: ["w-6", "h-6"],
|
|
2680
|
-
lg: ["w-7", "h-7"],
|
|
2681
|
-
xl: ["w-8", "h-8"]
|
|
2682
|
-
}
|
|
2683
|
-
},
|
|
2684
|
-
defaultVariants: {
|
|
2685
|
-
size: "md"
|
|
2686
|
-
}
|
|
2687
|
-
});
|
|
2688
2752
|
const menuContent = classVarianceAuthority.cva(
|
|
2689
2753
|
[
|
|
2690
2754
|
"flex",
|
|
@@ -2697,8 +2761,6 @@
|
|
|
2697
2761
|
"ring-1",
|
|
2698
2762
|
"ring-(--base-6)",
|
|
2699
2763
|
"overflow-hidden"
|
|
2700
|
-
// "[scrollbar-width:thin]",
|
|
2701
|
-
// "[scrollbar-color:var(--base-6)_transparent]",
|
|
2702
2764
|
],
|
|
2703
2765
|
{
|
|
2704
2766
|
variants: {
|
|
@@ -2740,8 +2802,8 @@
|
|
|
2740
2802
|
"flex",
|
|
2741
2803
|
"items-stretch",
|
|
2742
2804
|
"transition-colors",
|
|
2743
|
-
"
|
|
2744
|
-
"
|
|
2805
|
+
"data-[disabled=true]:opacity-50",
|
|
2806
|
+
"data-[disabled=true]:pointer-events-none",
|
|
2745
2807
|
"box-border",
|
|
2746
2808
|
"bg-transparent",
|
|
2747
2809
|
"text-(--base-12)"
|
|
@@ -2856,6 +2918,37 @@
|
|
|
2856
2918
|
) });
|
|
2857
2919
|
};
|
|
2858
2920
|
MenuRoot.displayName = "Root";
|
|
2921
|
+
const computeOffsets = (side, alignment) => {
|
|
2922
|
+
switch (side) {
|
|
2923
|
+
case "right":
|
|
2924
|
+
if (alignment === "start") {
|
|
2925
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -8 };
|
|
2926
|
+
} else if (alignment === "end") {
|
|
2927
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
2928
|
+
}
|
|
2929
|
+
break;
|
|
2930
|
+
case "left":
|
|
2931
|
+
if (alignment === "start") {
|
|
2932
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -8 };
|
|
2933
|
+
} else if (alignment === "end") {
|
|
2934
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
2935
|
+
}
|
|
2936
|
+
break;
|
|
2937
|
+
}
|
|
2938
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: 0 };
|
|
2939
|
+
};
|
|
2940
|
+
function getSelectedState(selected) {
|
|
2941
|
+
return selected ? "selected" : "unselected";
|
|
2942
|
+
}
|
|
2943
|
+
function getCheckedState(checked) {
|
|
2944
|
+
return checked === true ? "checked" : checked === false ? "unchecked" : "indeterminate";
|
|
2945
|
+
}
|
|
2946
|
+
function getBooleanState(value) {
|
|
2947
|
+
return value ? "true" : "false";
|
|
2948
|
+
}
|
|
2949
|
+
function getOpenState(open) {
|
|
2950
|
+
return open ? "open" : "closed";
|
|
2951
|
+
}
|
|
2859
2952
|
const MenuContentContext = React.createContext({});
|
|
2860
2953
|
const useMenuContentContext = () => React.useContext(MenuContentContext);
|
|
2861
2954
|
const MenuContent = React.memo(
|
|
@@ -2943,7 +3036,7 @@
|
|
|
2943
3036
|
"max-h-(--overmap-menu-available-height)"
|
|
2944
3037
|
),
|
|
2945
3038
|
ref: forwardedRef,
|
|
2946
|
-
"data-state": open
|
|
3039
|
+
"data-state": getOpenState(open),
|
|
2947
3040
|
"data-side": side,
|
|
2948
3041
|
"data-accent-color": accentColor,
|
|
2949
3042
|
...rest,
|
|
@@ -2960,25 +3053,6 @@
|
|
|
2960
3053
|
);
|
|
2961
3054
|
const SubContext = React.createContext({});
|
|
2962
3055
|
const useSubContext = () => React.useContext(SubContext);
|
|
2963
|
-
const computeOffsets = (side, alignment) => {
|
|
2964
|
-
switch (side) {
|
|
2965
|
-
case "right":
|
|
2966
|
-
if (alignment === "start") {
|
|
2967
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -8 };
|
|
2968
|
-
} else if (alignment === "end") {
|
|
2969
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
2970
|
-
}
|
|
2971
|
-
break;
|
|
2972
|
-
case "left":
|
|
2973
|
-
if (alignment === "start") {
|
|
2974
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -8 };
|
|
2975
|
-
} else if (alignment === "end") {
|
|
2976
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
2977
|
-
}
|
|
2978
|
-
break;
|
|
2979
|
-
}
|
|
2980
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: 0 };
|
|
2981
|
-
};
|
|
2982
3056
|
const MenuSub = (props) => {
|
|
2983
3057
|
const {
|
|
2984
3058
|
children,
|
|
@@ -3090,7 +3164,7 @@
|
|
|
3090
3164
|
onClick,
|
|
3091
3165
|
onKeyDown,
|
|
3092
3166
|
closeOnSelect = true,
|
|
3093
|
-
disabled,
|
|
3167
|
+
disabled = false,
|
|
3094
3168
|
...rest
|
|
3095
3169
|
} = props;
|
|
3096
3170
|
const { ref, index } = react.useListItem();
|
|
@@ -3127,7 +3201,7 @@
|
|
|
3127
3201
|
className: classVarianceAuthority.cx(className, menuItem({ size, variant }), radiusCva({ radius, maxLarge: true })),
|
|
3128
3202
|
ref: mergeRefs2,
|
|
3129
3203
|
role: "menuitem",
|
|
3130
|
-
"data-disabled": disabled
|
|
3204
|
+
"data-disabled": getBooleanState(disabled),
|
|
3131
3205
|
"aria-disabled": disabled,
|
|
3132
3206
|
"data-highlighted": isActive ? "" : void 0,
|
|
3133
3207
|
...getItemProps({
|
|
@@ -3159,9 +3233,8 @@
|
|
|
3159
3233
|
});
|
|
3160
3234
|
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
3161
3235
|
const MenuCheckboxItemIndicator = React.forwardRef((props, ref) => {
|
|
3162
|
-
const {
|
|
3163
|
-
|
|
3164
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { ref, className: classVarianceAuthority.cx(className, menuSelectedIndicator({ size })), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { children }) });
|
|
3236
|
+
const { children, ...rest } = props;
|
|
3237
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
3165
3238
|
});
|
|
3166
3239
|
MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
3167
3240
|
const MenuClickTrigger = React.memo(
|
|
@@ -3177,8 +3250,8 @@
|
|
|
3177
3250
|
{
|
|
3178
3251
|
ref: mergedRefs,
|
|
3179
3252
|
"aria-disabled": disabled,
|
|
3180
|
-
"data-disabled": disabled
|
|
3181
|
-
"data-state": open
|
|
3253
|
+
"data-disabled": getBooleanState(disabled),
|
|
3254
|
+
"data-state": getOpenState(open),
|
|
3182
3255
|
...getReferenceProps({ disabled }),
|
|
3183
3256
|
children
|
|
3184
3257
|
}
|
|
@@ -3187,9 +3260,9 @@
|
|
|
3187
3260
|
);
|
|
3188
3261
|
const MenuContextTrigger = React.memo(
|
|
3189
3262
|
React.forwardRef((props, forwardedRef) => {
|
|
3190
|
-
const { children, disabled } = props;
|
|
3263
|
+
const { children, disabled = false } = props;
|
|
3191
3264
|
const ref = React.useRef(null);
|
|
3192
|
-
const { setOpen, refs, setTriggerType } = useMenuContext();
|
|
3265
|
+
const { setOpen, refs, setTriggerType, open } = useMenuContext();
|
|
3193
3266
|
const mergedRefs = react.useMergeRefs([forwardedRef, ref]);
|
|
3194
3267
|
React.useEffect(() => {
|
|
3195
3268
|
setTriggerType("context");
|
|
@@ -3225,7 +3298,8 @@
|
|
|
3225
3298
|
ref: mergedRefs,
|
|
3226
3299
|
style: { WebkitTouchCallout: disabled ? "none" : "unset" },
|
|
3227
3300
|
"aria-disabled": disabled,
|
|
3228
|
-
"data-disabled": disabled
|
|
3301
|
+
"data-disabled": getBooleanState(disabled),
|
|
3302
|
+
"data-state": getOpenState(open),
|
|
3229
3303
|
onContextMenu: handleContextMenu,
|
|
3230
3304
|
children
|
|
3231
3305
|
}
|
|
@@ -3240,7 +3314,7 @@
|
|
|
3240
3314
|
);
|
|
3241
3315
|
const MenuInputField = React.memo(
|
|
3242
3316
|
React.forwardRef((props, forwardedRef) => {
|
|
3243
|
-
const { className, onValueChange, onChange, ...rest } = props;
|
|
3317
|
+
const { className, onValueChange, onChange, disabled = false, ...rest } = props;
|
|
3244
3318
|
const { activeIndex, getItemProps } = useMenuContentContext();
|
|
3245
3319
|
const { index, ref } = react.useListItem();
|
|
3246
3320
|
const mergedRefs = react.useMergeRefs([ref, forwardedRef]);
|
|
@@ -3261,6 +3335,8 @@
|
|
|
3261
3335
|
{
|
|
3262
3336
|
className: classVarianceAuthority.cx(className, "placeholder-(--base-a9)", "selection:bg-(--accent-a5)", "outline-none"),
|
|
3263
3337
|
ref: mergedRefs,
|
|
3338
|
+
disabled,
|
|
3339
|
+
"data-disabled": getBooleanState(disabled),
|
|
3264
3340
|
...getItemProps({
|
|
3265
3341
|
...rest,
|
|
3266
3342
|
tabIndex: index === activeIndex ? 0 : -1,
|
|
@@ -3283,86 +3359,53 @@
|
|
|
3283
3359
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx(className, "flex", "items-center", "text-(--base-a11)"), ref, ...rest });
|
|
3284
3360
|
})
|
|
3285
3361
|
);
|
|
3286
|
-
const SelectContext = React.createContext({});
|
|
3287
|
-
function useSelectContext() {
|
|
3288
|
-
return React.useContext(SelectContext);
|
|
3289
|
-
}
|
|
3290
|
-
const SelectContextProvider = React.memo((props) => {
|
|
3291
|
-
const { type, children } = props;
|
|
3292
|
-
const [controlledValue, setControlledValue] = React.useState(
|
|
3293
|
-
type === "single" ? (props == null ? void 0 : props.defaultValue) ?? null : null
|
|
3294
|
-
);
|
|
3295
|
-
const [controlledValues, setControlledValues] = React.useState(
|
|
3296
|
-
type === "multi" ? (props == null ? void 0 : props.defaultValues) ?? [] : []
|
|
3297
|
-
);
|
|
3298
|
-
const onValuesChange = React.useCallback(
|
|
3299
|
-
(values) => {
|
|
3300
|
-
setControlledValues(values);
|
|
3301
|
-
if (type === "multi" && (props == null ? void 0 : props.onValuesChange)) props.onValuesChange(values);
|
|
3302
|
-
},
|
|
3303
|
-
[props, type]
|
|
3304
|
-
);
|
|
3305
|
-
const onValueChange = React.useCallback(
|
|
3306
|
-
(value2) => {
|
|
3307
|
-
setControlledValue(value2);
|
|
3308
|
-
if (type === "single" && (props == null ? void 0 : props.onValueChange)) props.onValueChange(value2);
|
|
3309
|
-
},
|
|
3310
|
-
[props, type]
|
|
3311
|
-
);
|
|
3312
|
-
const value = React.useMemo(
|
|
3313
|
-
() => type === "multi" ? {
|
|
3314
|
-
type,
|
|
3315
|
-
values: (props == null ? void 0 : props.values) ?? controlledValues,
|
|
3316
|
-
handleValuesChange: onValuesChange
|
|
3317
|
-
} : {
|
|
3318
|
-
type,
|
|
3319
|
-
value: props.value ?? controlledValue,
|
|
3320
|
-
handleValueChange: onValueChange
|
|
3321
|
-
},
|
|
3322
|
-
[controlledValue, controlledValues, onValueChange, onValuesChange, props, type]
|
|
3323
|
-
);
|
|
3324
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectContext.Provider, { value, children });
|
|
3325
|
-
});
|
|
3326
|
-
SelectContextProvider.displayName = "SelectContextProvider";
|
|
3327
3362
|
const MenuMultiSelectGroup = React.memo(
|
|
3328
3363
|
React.forwardRef((props, ref) => {
|
|
3329
|
-
const { children, values, onValuesChange, ...rest } = props;
|
|
3330
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3364
|
+
const { children, defaultValues, values, onValuesChange, ...rest } = props;
|
|
3365
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(MultiSelectProvider, { defaultValues, values, onValuesChange, children }) });
|
|
3331
3366
|
})
|
|
3332
3367
|
);
|
|
3333
|
-
const SelectedIndicatorContext = React.createContext(
|
|
3368
|
+
const SelectedIndicatorContext = React.createContext(false);
|
|
3334
3369
|
const useSelectedIndicatorContext = () => React.useContext(SelectedIndicatorContext);
|
|
3335
3370
|
const MenuSelectedIndicator = React.forwardRef((props, ref) => {
|
|
3336
3371
|
const { children } = props;
|
|
3337
|
-
const
|
|
3338
|
-
|
|
3339
|
-
|
|
3372
|
+
const isSelected = useSelectedIndicatorContext();
|
|
3373
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3374
|
+
"span",
|
|
3375
|
+
{
|
|
3376
|
+
ref,
|
|
3377
|
+
className: classVarianceAuthority.cx({
|
|
3378
|
+
invisible: !isSelected
|
|
3379
|
+
}),
|
|
3380
|
+
"data-state": getSelectedState(isSelected),
|
|
3381
|
+
children
|
|
3382
|
+
}
|
|
3383
|
+
);
|
|
3340
3384
|
});
|
|
3341
3385
|
MenuSelectedIndicator.displayName = "SelectedIndicator";
|
|
3342
3386
|
const MenuMultiSelectItem = React.memo(
|
|
3343
3387
|
React.forwardRef((props, ref) => {
|
|
3344
3388
|
const { onSelect, children, closeOnSelect = false, value, ...rest } = props;
|
|
3345
|
-
const {
|
|
3346
|
-
|
|
3389
|
+
const { selected, selectValue, registerValue } = React.use(MultiSelectContext);
|
|
3390
|
+
React.useLayoutEffect(() => {
|
|
3391
|
+
return registerValue(value);
|
|
3392
|
+
}, [registerValue, value]);
|
|
3393
|
+
const isSelected = selected(value);
|
|
3347
3394
|
const handleSelect = React.useCallback(() => {
|
|
3348
|
-
if (!selected) {
|
|
3349
|
-
handleValuesChange([...values, value]);
|
|
3350
|
-
} else {
|
|
3351
|
-
handleValuesChange(values.filter((currentValue) => currentValue !== value));
|
|
3352
|
-
}
|
|
3353
3395
|
if (onSelect) onSelect();
|
|
3354
|
-
|
|
3396
|
+
selectValue(value);
|
|
3397
|
+
}, [onSelect, selectValue, value]);
|
|
3355
3398
|
const computedChildren = React.useMemo(() => {
|
|
3356
|
-
return typeof children === "function" ? ({ active }) => children({ selected, active }) : children;
|
|
3357
|
-
}, [children,
|
|
3358
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext.Provider, { value:
|
|
3399
|
+
return typeof children === "function" ? ({ active }) => children({ selected: isSelected, active }) : children;
|
|
3400
|
+
}, [children, isSelected]);
|
|
3401
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3359
3402
|
MenuItem,
|
|
3360
3403
|
{
|
|
3361
3404
|
ref,
|
|
3362
3405
|
role: "menuitemcheckbox",
|
|
3363
3406
|
onSelect: handleSelect,
|
|
3364
3407
|
closeOnSelect,
|
|
3365
|
-
"data-
|
|
3408
|
+
"data-state": getSelectedState(isSelected),
|
|
3366
3409
|
...rest,
|
|
3367
3410
|
children: computedChildren
|
|
3368
3411
|
}
|
|
@@ -3412,71 +3455,72 @@
|
|
|
3412
3455
|
);
|
|
3413
3456
|
});
|
|
3414
3457
|
MenuScroll.displayName = "MenuScroll";
|
|
3415
|
-
const SelectAllContext = React.createContext({});
|
|
3416
|
-
const MenuSelectAllIndicator = React.forwardRef((props, ref) => {
|
|
3417
|
-
const { className, children, ...rest } = props;
|
|
3418
|
-
const { size } = useMenuContentContext();
|
|
3419
|
-
const { selected } = React.useContext(SelectAllContext);
|
|
3420
|
-
const computedChildren = React.useMemo(() => {
|
|
3421
|
-
return typeof children === "function" ? children(selected === "indeterminate") : children;
|
|
3422
|
-
}, [children, selected]);
|
|
3423
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { ref, className: classVarianceAuthority.cx(className, menuSelectedIndicator({ size })), ...rest, children: selected ? computedChildren : null });
|
|
3424
|
-
});
|
|
3425
|
-
MenuSelectAllIndicator.displayName = "SelectAllIndicator";
|
|
3426
3458
|
const MenuSelectAllItem = React.forwardRef((props, ref) => {
|
|
3427
|
-
const { children,
|
|
3428
|
-
const {
|
|
3429
|
-
const
|
|
3430
|
-
const selectValuesSet = new Set(values);
|
|
3431
|
-
if (allValues.every((value) => selectValuesSet.has(value))) return true;
|
|
3432
|
-
if (values.length > 0) return "indeterminate";
|
|
3433
|
-
return false;
|
|
3434
|
-
}, [allValues, values]);
|
|
3459
|
+
const { children, onSelect, closeOnSelect = false, ...rest } = props;
|
|
3460
|
+
const { allSelected, someSelected, toggleSelectAll } = React.use(MultiSelectContext);
|
|
3461
|
+
const selectedState = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
3435
3462
|
const handleSelect = React.useCallback(() => {
|
|
3436
3463
|
onSelect == null ? void 0 : onSelect();
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
handleValuesChange([]);
|
|
3440
|
-
break;
|
|
3441
|
-
case "indeterminate":
|
|
3442
|
-
case false: {
|
|
3443
|
-
handleValuesChange(allValues);
|
|
3444
|
-
break;
|
|
3445
|
-
}
|
|
3446
|
-
}
|
|
3447
|
-
}, [allValues, handleValuesChange, onSelect, selected]);
|
|
3464
|
+
toggleSelectAll();
|
|
3465
|
+
}, [onSelect, toggleSelectAll]);
|
|
3448
3466
|
const computedChildren = React.useMemo(() => {
|
|
3449
|
-
return typeof children === "function" ? ({ active }) => children({ selected, active }) : children;
|
|
3450
|
-
}, [children,
|
|
3451
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3467
|
+
return typeof children === "function" ? ({ active }) => children({ selected: selectedState, active }) : children;
|
|
3468
|
+
}, [children, selectedState]);
|
|
3469
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext, { value: selectedState, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3470
|
+
MenuItem,
|
|
3471
|
+
{
|
|
3472
|
+
onSelect: handleSelect,
|
|
3473
|
+
ref,
|
|
3474
|
+
"data-state": getCheckedState(selectedState),
|
|
3475
|
+
closeOnSelect,
|
|
3476
|
+
...rest,
|
|
3477
|
+
children: computedChildren
|
|
3478
|
+
}
|
|
3479
|
+
) });
|
|
3452
3480
|
});
|
|
3453
3481
|
MenuSelectAllItem.displayName = "SelectAllItem";
|
|
3454
3482
|
const MenuSelectGroup = React.memo(
|
|
3455
3483
|
React.forwardRef((props, ref) => {
|
|
3456
|
-
const { children, value, onValueChange } = props;
|
|
3457
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3484
|
+
const { children, required, defaultValue, value, onValueChange, ...rest } = props;
|
|
3485
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: required ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3486
|
+
SingleSelectRequiredProvider,
|
|
3487
|
+
{
|
|
3488
|
+
defaultValue,
|
|
3489
|
+
value,
|
|
3490
|
+
onValueChange,
|
|
3491
|
+
children
|
|
3492
|
+
}
|
|
3493
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3494
|
+
SingleSelectNotRequiredProvider,
|
|
3495
|
+
{
|
|
3496
|
+
defaultValue,
|
|
3497
|
+
value,
|
|
3498
|
+
onValueChange,
|
|
3499
|
+
children
|
|
3500
|
+
}
|
|
3501
|
+
) });
|
|
3458
3502
|
})
|
|
3459
3503
|
);
|
|
3460
3504
|
const MenuSelectItem = React.memo(
|
|
3461
3505
|
React.forwardRef((props, ref) => {
|
|
3462
3506
|
const { value, onSelect, children, closeOnSelect = true, ...rest } = props;
|
|
3463
|
-
const {
|
|
3464
|
-
const
|
|
3507
|
+
const { selected, selectValue } = React.use(SelectContext);
|
|
3508
|
+
const isSelected = React.useMemo(() => selected(value), [selected, value]);
|
|
3465
3509
|
const handleSelect = React.useCallback(() => {
|
|
3466
|
-
handleValueChange(!selected ? value : null);
|
|
3467
3510
|
if (onSelect) onSelect();
|
|
3468
|
-
|
|
3511
|
+
selectValue(value);
|
|
3512
|
+
}, [onSelect, selectValue, value]);
|
|
3469
3513
|
const computedChildren = React.useMemo(() => {
|
|
3470
|
-
return typeof children === "function" ? ({ active }) => children({ selected, active }) : children;
|
|
3471
|
-
}, [children,
|
|
3472
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext.Provider, { value:
|
|
3514
|
+
return typeof children === "function" ? ({ active }) => children({ selected: isSelected, active }) : children;
|
|
3515
|
+
}, [children, isSelected]);
|
|
3516
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3473
3517
|
MenuItem,
|
|
3474
3518
|
{
|
|
3475
3519
|
ref,
|
|
3476
3520
|
role: "menuitemcheckbox",
|
|
3477
3521
|
onSelect: handleSelect,
|
|
3478
3522
|
closeOnSelect,
|
|
3479
|
-
"data-
|
|
3523
|
+
"data-state": getSelectedState(isSelected),
|
|
3480
3524
|
...rest,
|
|
3481
3525
|
children: computedChildren
|
|
3482
3526
|
}
|
|
@@ -3553,7 +3597,7 @@
|
|
|
3553
3597
|
"max-h-(--overmap-menu-available-height)"
|
|
3554
3598
|
),
|
|
3555
3599
|
ref: forwardedRef,
|
|
3556
|
-
"data-state": open
|
|
3600
|
+
"data-state": getOpenState(open),
|
|
3557
3601
|
"data-side": side,
|
|
3558
3602
|
"data-accent-color": accentColor,
|
|
3559
3603
|
...rest,
|
|
@@ -3577,7 +3621,7 @@
|
|
|
3577
3621
|
ref: mergedRefs,
|
|
3578
3622
|
closeOnSelect: false,
|
|
3579
3623
|
"aria-haspopup": "menu",
|
|
3580
|
-
"data-
|
|
3624
|
+
"data-state": getOpenState(open),
|
|
3581
3625
|
disabled,
|
|
3582
3626
|
...getReferenceProps(rest),
|
|
3583
3627
|
children
|
|
@@ -3629,7 +3673,6 @@
|
|
|
3629
3673
|
SelectAllItem: MenuSelectAllItem,
|
|
3630
3674
|
CheckboxItem: MenuCheckboxItem,
|
|
3631
3675
|
// indicators
|
|
3632
|
-
SelectAllIndicator: MenuSelectAllIndicator,
|
|
3633
3676
|
SelectedIndicator: MenuSelectedIndicator,
|
|
3634
3677
|
CheckboxItemIndicator: MenuCheckboxItemIndicator,
|
|
3635
3678
|
// input
|
|
@@ -5010,7 +5053,6 @@
|
|
|
5010
5053
|
exports2.MenuPages = MenuPages;
|
|
5011
5054
|
exports2.MenuRoot = MenuRoot;
|
|
5012
5055
|
exports2.MenuScroll = MenuScroll;
|
|
5013
|
-
exports2.MenuSelectAllIndicator = MenuSelectAllIndicator;
|
|
5014
5056
|
exports2.MenuSelectAllItem = MenuSelectAllItem;
|
|
5015
5057
|
exports2.MenuSelectGroup = MenuSelectGroup;
|
|
5016
5058
|
exports2.MenuSelectItem = MenuSelectItem;
|