@vygruppen/spor-react 12.24.14 → 12.24.16

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.cjs CHANGED
@@ -66,9 +66,9 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
66
66
  var warnAboutMismatchingIcon = ({
67
67
  icon
68
68
  }) => {
69
- var _a5, _b4;
69
+ var _a6, _b5;
70
70
  if (process.env.NODE_ENV !== "production") {
71
- const displayName = (_b4 = (_a5 = icon == null ? void 0 : icon.type) == null ? void 0 : _a5.render) == null ? void 0 : _b4.displayName;
71
+ const displayName = (_b5 = (_a6 = icon == null ? void 0 : icon.type) == null ? void 0 : _a6.render) == null ? void 0 : _b5.displayName;
72
72
  if (!displayName) {
73
73
  return;
74
74
  }
@@ -1524,21 +1524,26 @@ function CalendarProvider(props) {
1524
1524
  ref
1525
1525
  );
1526
1526
  const getRangeStartValue = () => {
1527
- var _a5, _b4;
1528
- if ((_a5 = rangeState.highlightedRange) == null ? void 0 : _a5.start) {
1527
+ var _a6, _b5;
1528
+ if ((_a6 = rangeState.highlightedRange) == null ? void 0 : _a6.start) {
1529
1529
  return date.toCalendarDate(rangeState.highlightedRange.start);
1530
1530
  }
1531
- if ((_b4 = rangeState == null ? void 0 : rangeState.value) == null ? void 0 : _b4.start) {
1531
+ if ((_b5 = rangeState == null ? void 0 : rangeState.value) == null ? void 0 : _b5.start) {
1532
1532
  return date.toCalendarDate(rangeState.value.start);
1533
1533
  }
1534
1534
  return null;
1535
1535
  };
1536
1536
  const getRangeEndValue = () => {
1537
- var _a5, _b4;
1538
- if ((_a5 = rangeState.highlightedRange) == null ? void 0 : _a5.end) {
1537
+ var _a6, _b5;
1538
+ if ((_a6 = rangeState.highlightedRange) == null ? void 0 : _a6.end) {
1539
+ if (rangeState.anchorDate && rangeState.highlightedRange.start && rangeState.highlightedRange.end.compare(
1540
+ rangeState.highlightedRange.start
1541
+ ) === 0) {
1542
+ return null;
1543
+ }
1539
1544
  return date.toCalendarDate(rangeState.highlightedRange.end);
1540
1545
  }
1541
- if ((_b4 = rangeState == null ? void 0 : rangeState.value) == null ? void 0 : _b4.end) {
1546
+ if ((_b5 = rangeState == null ? void 0 : rangeState.value) == null ? void 0 : _b5.end) {
1542
1547
  return date.toCalendarDate(rangeState.value.end);
1543
1548
  }
1544
1549
  return null;
@@ -1639,16 +1644,36 @@ var StaticCard = React20.forwardRef(
1639
1644
  }
1640
1645
  );
1641
1646
  StaticCard.displayName = "StaticCard";
1647
+ var _a2, _b;
1648
+ var IS_TOUCH_PRIMARY = globalThis.window !== void 0 && ((_b = (_a2 = globalThis.window).matchMedia) == null ? void 0 : _b.call(_a2, "(pointer: coarse)").matches);
1649
+ function isPhantomPointer(event) {
1650
+ return IS_TOUCH_PRIMARY && event.pointerType === "mouse";
1651
+ }
1642
1652
  function CalendarCell({ date: date$1, currentMonth }) {
1643
- var _a5, _b4;
1653
+ var _a6, _b5;
1644
1654
  const { mode, state } = useCalendar();
1645
1655
  const ref = React20.useRef(null);
1646
1656
  const { cellProps, buttonProps, isSelected, isDisabled, formattedDate } = reactAria.useCalendarCell({ date: date$1 }, state, ref);
1647
1657
  const isOutsideMonth = !date.isSameMonth(currentMonth, date$1);
1648
- const isSelectionStart = mode === "range" && ((_a5 = state.highlightedRange) == null ? void 0 : _a5.start) ? date.isSameDay(date$1, state.highlightedRange.start) : false;
1649
- const isSelectionEnd = mode === "range" && ((_b4 = state.highlightedRange) == null ? void 0 : _b4.end) ? date.isSameDay(date$1, state.highlightedRange.end) : false;
1650
- const isSingleModeSelected = mode === "single" && isSelected;
1658
+ const isSelectionStart = mode === "range" && ((_a6 = state.highlightedRange) == null ? void 0 : _a6.start) ? date.isSameDay(date$1, state.highlightedRange.start) : false;
1659
+ const isSelectionEnd = mode === "range" && ((_b5 = state.highlightedRange) == null ? void 0 : _b5.end) ? date.isSameDay(date$1, state.highlightedRange.end) : false;
1660
+ const isEdge = mode === "single" && isSelected || isSelectionStart || isSelectionEnd;
1661
+ const isMiddle = isSelected && !isEdge && mode === "range";
1651
1662
  const { focusProps, isFocusVisible } = reactAria.useFocusRing();
1663
+ const merged = reactAria.mergeProps(buttonProps, focusProps);
1664
+ const interactionProps = mode === "range" && IS_TOUCH_PRIMARY ? {
1665
+ ...merged,
1666
+ onPointerEnter: (event) => {
1667
+ var _a7;
1668
+ if (!isPhantomPointer(event))
1669
+ (_a7 = merged.onPointerEnter) == null ? void 0 : _a7.call(merged, event);
1670
+ },
1671
+ onPointerMove: (event) => {
1672
+ var _a7;
1673
+ if (!isPhantomPointer(event))
1674
+ (_a7 = merged.onPointerMove) == null ? void 0 : _a7.call(merged, event);
1675
+ }
1676
+ } : merged;
1652
1677
  return /* @__PURE__ */ jsxRuntime.jsx(
1653
1678
  "td",
1654
1679
  {
@@ -1660,7 +1685,7 @@ function CalendarCell({ date: date$1, currentMonth }) {
1660
1685
  children: /* @__PURE__ */ jsxRuntime.jsx(
1661
1686
  react.Box,
1662
1687
  {
1663
- ...reactAria.mergeProps(buttonProps, focusProps),
1688
+ ...interactionProps,
1664
1689
  ref,
1665
1690
  hidden: isOutsideMonth,
1666
1691
  width: ["54px", null, "70px"],
@@ -1676,32 +1701,10 @@ function CalendarCell({ date: date$1, currentMonth }) {
1676
1701
  alignItems: "center",
1677
1702
  justifyContent: "center",
1678
1703
  borderRadius: "sm",
1679
- css: {
1680
- cursor: "pointer",
1681
- color: isDisabled ? "text.disabled" : void 0,
1682
- // Single mode: Selected styling
1683
- ...isSingleModeSelected && {
1684
- backgroundColor: "brand.surface",
1685
- color: "text.inverted"
1686
- },
1687
- // Range mode: Selection start/end styling
1688
- ...(isSelectionStart || isSelectionEnd) && {
1689
- backgroundColor: "brand.surface",
1690
- color: "text.inverted"
1691
- },
1692
- // Range mode: Middle range styling
1693
- ...isSelected && !(isSelectionStart || isSelectionEnd) && mode === "range" && {
1694
- backgroundColor: "surface.secondary",
1695
- color: "text"
1696
- },
1697
- // Non-selected hover state
1698
- ...!isSelected && !isDisabled && {
1699
- "&:hover": {
1700
- backgroundColor: "surface.secondary",
1701
- color: "text"
1702
- }
1703
- }
1704
- },
1704
+ css: cellStyles,
1705
+ "data-disabled": isDisabled || void 0,
1706
+ "data-edge": isEdge || void 0,
1707
+ "data-middle": isMiddle || void 0,
1705
1708
  children: /* @__PURE__ */ jsxRuntime.jsx(Text3, { variant: "sm", children: formattedDate })
1706
1709
  }
1707
1710
  )
@@ -1710,6 +1713,30 @@ function CalendarCell({ date: date$1, currentMonth }) {
1710
1713
  }
1711
1714
  );
1712
1715
  }
1716
+ var cellStyles = {
1717
+ cursor: "pointer",
1718
+ // Disabled
1719
+ "&[data-disabled]": {
1720
+ color: "text.disabled"
1721
+ },
1722
+ // Selection edge (single-mode selected OR range start/end)
1723
+ "&[data-edge]": {
1724
+ backgroundColor: "brand.surface",
1725
+ color: "text.inverted"
1726
+ },
1727
+ // Range middle
1728
+ "&[data-middle]": {
1729
+ backgroundColor: "surface.secondary",
1730
+ color: "text"
1731
+ },
1732
+ // Hover for non-selected, non-disabled cells on devices that support hover
1733
+ "@media (hover: hover)": {
1734
+ "&:not([data-edge]):not([data-middle]):not([data-disabled]):hover": {
1735
+ backgroundColor: "surface.secondary",
1736
+ color: "text"
1737
+ }
1738
+ }
1739
+ };
1713
1740
  var weekDays = {
1714
1741
  nb: ["Ma", "Ti", "On", "To", "Fr", "L\xF8", "S\xF8"],
1715
1742
  nn: ["Ma", "Ti", "On", "To", "Fr", "L\xF8", "S\xF8"],
@@ -1912,10 +1939,20 @@ function ScrollCalendar(boxProps) {
1912
1939
  if (monthIndex > 0 && monthIndex < monthCount) {
1913
1940
  const element = monthReferences.current[monthIndex];
1914
1941
  if (element) {
1915
- element.scrollIntoView({
1916
- behavior: "instant",
1917
- block: "start"
1918
- });
1942
+ const selectedCell = element.querySelector(
1943
+ '[aria-selected="true"]'
1944
+ );
1945
+ if (selectedCell) {
1946
+ selectedCell.scrollIntoView({
1947
+ behavior: "instant",
1948
+ block: "center"
1949
+ });
1950
+ } else {
1951
+ element.scrollIntoView({
1952
+ behavior: "instant",
1953
+ block: "start"
1954
+ });
1955
+ }
1919
1956
  }
1920
1957
  }
1921
1958
  hasScrolledRef.current = true;
@@ -2149,8 +2186,8 @@ function CalendarCell2({
2149
2186
  stateProps["data-unavailable"] = true;
2150
2187
  }
2151
2188
  React20.useEffect(() => {
2152
- var _a5;
2153
- (_a5 = ref.current) == null ? void 0 : _a5.addEventListener(
2189
+ var _a6;
2190
+ (_a6 = ref.current) == null ? void 0 : _a6.addEventListener(
2154
2191
  "touchend",
2155
2192
  (event) => {
2156
2193
  event.preventDefault();
@@ -2486,7 +2523,7 @@ function createCalendar3(identifier) {
2486
2523
  }
2487
2524
  var DateField = React20.forwardRef(
2488
2525
  (props, externalRef) => {
2489
- var _a5;
2526
+ var _a6;
2490
2527
  const locale = useCurrentLocale();
2491
2528
  const recipe = react.useSlotRecipe({
2492
2529
  key: "datePicker"
@@ -2524,7 +2561,7 @@ var DateField = React20.forwardRef(
2524
2561
  "input",
2525
2562
  {
2526
2563
  type: "hidden",
2527
- value: ((_a5 = state.value) == null ? void 0 : _a5.toString()) ?? "",
2564
+ value: ((_a6 = state.value) == null ? void 0 : _a6.toString()) ?? "",
2528
2565
  name: props.name,
2529
2566
  id: props.id
2530
2567
  }
@@ -2641,11 +2678,11 @@ var DatePicker = React20.forwardRef(
2641
2678
  const locale = useCurrentLocale();
2642
2679
  const shouldShowCalendar = state.isOpen && !props.isDisabled && !props.noCalendar;
2643
2680
  const onFieldClick = () => {
2644
- var _a5;
2681
+ var _a6;
2645
2682
  if (!props.noCalendar) {
2646
2683
  state.setOpen(true);
2647
2684
  }
2648
- (_a5 = props.onClick) == null ? void 0 : _a5.call(props);
2685
+ (_a6 = props.onClick) == null ? void 0 : _a6.call(props);
2649
2686
  };
2650
2687
  const popoverContent = /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Content, { css: styles.calendarPopover, children: /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Body, { minWidth: "20rem", children: /* @__PURE__ */ jsxRuntime.jsx(
2651
2688
  Calendar2,
@@ -3419,91 +3456,95 @@ var Input = React20.forwardRef(
3419
3456
  }
3420
3457
  );
3421
3458
  Input.displayName = "Input";
3422
- var Autocomplete = ({
3423
- variant = "core",
3424
- children,
3425
- label,
3426
- leftIcon,
3427
- onInputValueChange,
3428
- invalid,
3429
- helperText,
3430
- errorText,
3431
- required,
3432
- filteredExternally,
3433
- loading,
3434
- disabled,
3435
- emptyLabel,
3436
- onFocus,
3437
- openOnClick = true,
3438
- openOnFocus = true,
3439
- ...rest
3440
- }) => {
3441
- const { contains } = react.useFilter({ sensitivity: "base" });
3442
- const { t } = useTranslation();
3443
- const extractedItems = React20__namespace.default.useMemo(
3444
- () => extractItemsFromChildren(children),
3445
- [children]
3446
- );
3447
- const { collection, filter, reset } = react.useListCollection({
3448
- initialItems: extractedItems,
3449
- filter: filteredExternally ? void 0 : contains
3450
- });
3451
- React20__namespace.default.useEffect(() => {
3452
- if (filteredExternally)
3453
- reset();
3454
- }, [extractedItems, reset, filteredExternally]);
3455
- const filteredChildren = React20__namespace.default.useMemo(
3456
- () => filterChildren(children, collection.items),
3457
- [children, collection.items]
3458
- );
3459
- const combobox = react.useCombobox({
3460
- collection,
3461
- openOnClick: filteredChildren.length > 0 ? openOnClick : false,
3462
- onInputValueChange: (event) => {
3463
- if (!filteredExternally) {
3464
- filter(event.inputValue);
3465
- }
3466
- onInputValueChange == null ? void 0 : onInputValueChange(event);
3467
- },
3468
- positioning: {
3469
- placement: "bottom",
3470
- offset: {
3471
- mainAxis: 3,
3472
- crossAxis: -1
3473
- },
3474
- flip: false
3475
- },
3459
+ var Autocomplete = React20.forwardRef(
3460
+ function Autocomplete2({
3461
+ variant = "core",
3462
+ children,
3463
+ css,
3464
+ label,
3465
+ leftIcon,
3466
+ onInputValueChange,
3467
+ invalid,
3468
+ helperText,
3469
+ errorText,
3470
+ required,
3471
+ filteredExternally,
3472
+ loading,
3476
3473
  disabled,
3474
+ emptyLabel,
3475
+ onFocus,
3476
+ openOnClick = true,
3477
+ openOnFocus = true,
3477
3478
  ...rest
3478
- });
3479
- return /* @__PURE__ */ jsxRuntime.jsxs(react.Combobox.RootProvider, { value: combobox, children: [
3480
- /* @__PURE__ */ jsxRuntime.jsxs(react.Combobox.Control, { children: [
3481
- /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Input, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
3482
- Input,
3483
- {
3484
- label: /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Label, { children: label }),
3485
- variant,
3486
- labelAsChild: true,
3487
- startElement: leftIcon,
3488
- invalid,
3489
- helperText,
3490
- errorText,
3491
- required,
3492
- onFocus: (event) => {
3493
- onFocus == null ? void 0 : onFocus(event);
3494
- if (openOnFocus && filteredChildren.length > 0)
3495
- combobox.setOpen(true);
3479
+ }, ref) {
3480
+ const { contains } = react.useFilter({ sensitivity: "base" });
3481
+ const { t } = useTranslation();
3482
+ const extractedItems = React20__namespace.default.useMemo(
3483
+ () => extractItemsFromChildren(children),
3484
+ [children]
3485
+ );
3486
+ const { collection, filter, reset } = react.useListCollection({
3487
+ initialItems: extractedItems,
3488
+ filter: filteredExternally ? void 0 : contains
3489
+ });
3490
+ React20__namespace.default.useEffect(() => {
3491
+ if (filteredExternally)
3492
+ reset();
3493
+ }, [extractedItems, reset, filteredExternally]);
3494
+ const filteredChildren = React20__namespace.default.useMemo(
3495
+ () => filterChildren(children, collection.items),
3496
+ [children, collection.items]
3497
+ );
3498
+ const combobox = react.useCombobox({
3499
+ collection,
3500
+ openOnClick: filteredChildren.length > 0 ? openOnClick : false,
3501
+ onInputValueChange: (event) => {
3502
+ if (!filteredExternally) {
3503
+ filter(event.inputValue);
3504
+ }
3505
+ onInputValueChange == null ? void 0 : onInputValueChange(event);
3506
+ },
3507
+ positioning: {
3508
+ placement: "bottom",
3509
+ offset: {
3510
+ mainAxis: 3,
3511
+ crossAxis: -1
3512
+ },
3513
+ flip: false
3514
+ },
3515
+ disabled,
3516
+ ...rest
3517
+ });
3518
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Combobox.RootProvider, { value: combobox, children: [
3519
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Combobox.Control, { css, children: [
3520
+ /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Input, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
3521
+ Input,
3522
+ {
3523
+ ref,
3524
+ label: /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Label, { children: label }),
3525
+ variant,
3526
+ labelAsChild: true,
3527
+ startElement: leftIcon,
3528
+ invalid,
3529
+ helperText,
3530
+ errorText,
3531
+ required,
3532
+ onFocus: (event) => {
3533
+ onFocus == null ? void 0 : onFocus(event);
3534
+ if (openOnFocus && filteredChildren.length > 0)
3535
+ combobox.setOpen(true);
3536
+ }
3496
3537
  }
3497
- }
3498
- ) }),
3499
- /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.IndicatorGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.ClearTrigger, { asChild: true, "aria-label": t(texts14.clearValue), children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { size: "xs", tabIndex: 0 }) }) })
3500
- ] }),
3501
- /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.Combobox.Content, { children: [
3502
- !loading && /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Empty, { children: emptyLabel ?? t(texts14.noItemsFound) }),
3503
- loading ? /* @__PURE__ */ jsxRuntime.jsx(ColorSpinner, { width: "1.5rem", p: "2" }) : filteredChildren
3504
- ] }) })
3505
- ] });
3506
- };
3538
+ ) }),
3539
+ /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.IndicatorGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.ClearTrigger, { asChild: true, "aria-label": t(texts14.clearValue), children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { size: "xs", tabIndex: 0 }) }) })
3540
+ ] }),
3541
+ /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.Combobox.Content, { children: [
3542
+ !loading && /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Empty, { children: emptyLabel ?? t(texts14.noItemsFound) }),
3543
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(ColorSpinner, { width: "1.5rem", p: "2" }) : filteredChildren
3544
+ ] }) })
3545
+ ] });
3546
+ }
3547
+ );
3507
3548
  var AutocompleteItemGroup = react.Combobox.ItemGroup;
3508
3549
  var AutocompleteItemGroupLabel = react.Combobox.ItemGroupLabel;
3509
3550
  var AutocompleteItem = React20.forwardRef(
@@ -3521,7 +3562,7 @@ var AutocompleteItem = React20.forwardRef(
3521
3562
  var filterChildren = (children, collectionItems) => {
3522
3563
  const collectionValues = new Set(collectionItems.map((item) => item.value));
3523
3564
  return React20__namespace.default.Children.toArray(children).map((child) => {
3524
- var _a5;
3565
+ var _a6;
3525
3566
  if (!React20__namespace.default.isValidElement(child))
3526
3567
  return null;
3527
3568
  if (child.type === AutocompleteItemGroup) {
@@ -3540,7 +3581,7 @@ var filterChildren = (children, collectionItems) => {
3540
3581
  children: filteredGroupChildren
3541
3582
  });
3542
3583
  }
3543
- const itemProps = (_a5 = child.props) == null ? void 0 : _a5.item;
3584
+ const itemProps = (_a6 = child.props) == null ? void 0 : _a6.item;
3544
3585
  if (itemProps) {
3545
3586
  return collectionValues.has(itemProps.value) ? child : null;
3546
3587
  }
@@ -3681,7 +3722,7 @@ var Popover = React20.forwardRef(
3681
3722
  hasBackdrop = true,
3682
3723
  containerPadding = 12
3683
3724
  }, ref) => {
3684
- var _a5;
3725
+ var _a6;
3685
3726
  const internalRef = React20.useRef(null);
3686
3727
  const popoverRef = ref ?? internalRef;
3687
3728
  const { popoverProps, underlayProps } = reactAria.usePopover(
@@ -3702,7 +3743,7 @@ var Popover = React20.forwardRef(
3702
3743
  {
3703
3744
  ...popoverProps,
3704
3745
  ref: popoverRef,
3705
- minWidth: ((_a5 = triggerRef.current) == null ? void 0 : _a5.clientWidth) ?? "auto",
3746
+ minWidth: ((_a6 = triggerRef.current) == null ? void 0 : _a6.clientWidth) ?? "auto",
3706
3747
  children: [
3707
3748
  /* @__PURE__ */ jsxRuntime.jsx(reactAria.DismissButton, { onDismiss: state.close }),
3708
3749
  children,
@@ -3997,8 +4038,8 @@ function Option({ item, state }) {
3997
4038
  dataFields["data-focus-visible"] = true;
3998
4039
  }
3999
4040
  React20.useEffect(() => {
4000
- var _a5;
4001
- (_a5 = ref == null ? void 0 : ref.current) == null ? void 0 : _a5.addEventListener(
4041
+ var _a6;
4042
+ (_a6 = ref == null ? void 0 : ref.current) == null ? void 0 : _a6.addEventListener(
4002
4043
  "touchend",
4003
4044
  (event) => {
4004
4045
  event.preventDefault();
@@ -4027,7 +4068,7 @@ var useOptionContext = () => {
4027
4068
  return React20.useContext(OptionContext);
4028
4069
  };
4029
4070
  function ListBoxSection({ section, state }) {
4030
- var _a5, _b4;
4071
+ var _a6, _b5;
4031
4072
  const { itemProps, headingProps, groupProps } = reactAria.useListBoxSection({
4032
4073
  heading: section.rendered,
4033
4074
  "aria-label": section["aria-label"]
@@ -4049,11 +4090,132 @@ function ListBoxSection({ section, state }) {
4049
4090
  children: section.rendered
4050
4091
  }
4051
4092
  ),
4052
- /* @__PURE__ */ jsxRuntime.jsx(List, { ...groupProps, padding: 0, listStyleType: "none", children: Array.from(((_b4 = (_a5 = state.collection).getChildren) == null ? void 0 : _b4.call(_a5, section.key)) ?? []).map(
4093
+ /* @__PURE__ */ jsxRuntime.jsx(List, { ...groupProps, padding: 0, listStyleType: "none", children: Array.from(((_b5 = (_a6 = state.collection).getChildren) == null ? void 0 : _b5.call(_a6, section.key)) ?? []).map(
4053
4094
  (item) => /* @__PURE__ */ jsxRuntime.jsx(Option, { item, state }, item.key)
4054
4095
  ) })
4055
4096
  ] }) });
4056
4097
  }
4098
+ var CustomMenuContext = React20.createContext({
4099
+ variant: "core"
4100
+ });
4101
+ var useMenuContext = () => React20.useContext(CustomMenuContext);
4102
+ var Menu = ({ children, ...props }) => {
4103
+ return /* @__PURE__ */ jsxRuntime.jsx(
4104
+ CustomMenuContext.Provider,
4105
+ {
4106
+ value: {
4107
+ variant: props.variant
4108
+ },
4109
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.Menu.Root, { ...props, children })
4110
+ }
4111
+ );
4112
+ };
4113
+ var MenuContent = React20.forwardRef(
4114
+ ({ children, ...props }, ref) => {
4115
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Menu.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Menu.Content, { ref, ...props, children }) }) });
4116
+ }
4117
+ );
4118
+ MenuContent.displayName = "MenuContent";
4119
+ var MenuTrigger = React20.forwardRef(
4120
+ ({ icon, size, children, ...props }, ref) => {
4121
+ const { variant } = useMenuContext();
4122
+ const { open } = react.useMenuContext();
4123
+ const ChevronIcon = size === "sm" ? spor_icon_react_star.DropdownDownFill18Icon : spor_icon_react_star.DropdownDownFill24Icon;
4124
+ const getButtonVariant = () => {
4125
+ if (variant === "floating")
4126
+ return "floating";
4127
+ if (variant === "accent")
4128
+ return "secondary";
4129
+ return "tertiary";
4130
+ };
4131
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Menu.Trigger, { asChild: true, ref, children: /* @__PURE__ */ jsxRuntime.jsx(
4132
+ Button,
4133
+ {
4134
+ leftIcon: icon,
4135
+ variant: getButtonVariant(),
4136
+ size,
4137
+ ...props,
4138
+ rightIcon: /* @__PURE__ */ jsxRuntime.jsx(
4139
+ ChevronIcon,
4140
+ {
4141
+ transform: open ? "rotate(180deg)" : void 0,
4142
+ transition: "transform 0.3s"
4143
+ }
4144
+ ),
4145
+ children
4146
+ }
4147
+ ) });
4148
+ }
4149
+ );
4150
+ MenuTrigger.displayName = "MenuTrigger";
4151
+ var MenuItem = React20.forwardRef(
4152
+ ({ itemCommand, children, value, leftIcon, rightIcon, ...props }, ref) => {
4153
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Menu.Item, { value, ...props, ref, children: [
4154
+ leftIcon,
4155
+ children,
4156
+ itemCommand && /* @__PURE__ */ jsxRuntime.jsx(react.Menu.ItemCommand, { children: itemCommand }),
4157
+ rightIcon
4158
+ ] });
4159
+ }
4160
+ );
4161
+ MenuItem.displayName = "MenuItem";
4162
+ var MenuTriggerItem = React20.forwardRef(
4163
+ ({ children, leftIcon, rightIcon, ...props }, ref) => {
4164
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Menu.TriggerItem, { ...props, ref, children: [
4165
+ leftIcon,
4166
+ children,
4167
+ rightIcon
4168
+ ] });
4169
+ }
4170
+ );
4171
+ MenuTriggerItem.displayName = "MenuTriggerItem";
4172
+ var MenuRadioItemGroup = React20.forwardRef(({ children, ...props }) => {
4173
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Menu.RadioItemGroup, { ...props, children });
4174
+ });
4175
+ MenuRadioItemGroup.displayName = "MenuRadioItemGroup";
4176
+ var MenuRadioItem = React20.forwardRef(
4177
+ ({ children, ...props }, ref) => {
4178
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Menu.RadioItem, { ...props, ref, children: [
4179
+ children,
4180
+ /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { w: "1.25rem", justify: "center", align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(react.Menu.ItemIndicator, {}) })
4181
+ ] });
4182
+ }
4183
+ );
4184
+ MenuRadioItem.displayName = "MenuRadioItem";
4185
+ var MenuItemGroup = React20.forwardRef(
4186
+ ({ children, label, ...props }, ref) => {
4187
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Menu.ItemGroup, { ...props, ref, children: [
4188
+ label && /* @__PURE__ */ jsxRuntime.jsx(react.Menu.ItemGroupLabel, { children: label }),
4189
+ children
4190
+ ] });
4191
+ }
4192
+ );
4193
+ MenuItemGroup.displayName = "MenuItemGroup";
4194
+ var MenuCheckboxItem = React20.forwardRef(({ children, closeOnSelect = false, ...props }, ref) => {
4195
+ return /* @__PURE__ */ jsxRuntime.jsx(
4196
+ react.Menu.CheckboxItem,
4197
+ {
4198
+ ...props,
4199
+ ref,
4200
+ closeOnSelect,
4201
+ checked: props.checked,
4202
+ onCheckedChange: props.onCheckedChange,
4203
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4204
+ Checkbox,
4205
+ {
4206
+ checked: props.checked,
4207
+ onCheckedChange: () => props.onCheckedChange,
4208
+ children
4209
+ }
4210
+ )
4211
+ }
4212
+ );
4213
+ });
4214
+ MenuCheckboxItem.displayName = "MenuCheckboxItem";
4215
+ var MenuSeparator = React20.forwardRef(({ ...props }) => {
4216
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Menu.Separator, { ...props });
4217
+ });
4218
+ MenuSeparator.displayName = "MenuSeparator";
4057
4219
  var NativeSelect = React20__namespace.forwardRef(function NativeSelect2(props, ref) {
4058
4220
  const {
4059
4221
  children,
@@ -4135,8 +4297,8 @@ var NumericStepper = React20__namespace.default.forwardRef((props, ref) => {
4135
4297
  });
4136
4298
  const clampedStepSize = Math.max(Math.min(stepSize, 10), 1);
4137
4299
  const focusOnAddButton = () => {
4138
- var _a5;
4139
- (_a5 = addButtonRef.current) == null ? void 0 : _a5.focus();
4300
+ var _a6;
4301
+ (_a6 = addButtonRef.current) == null ? void 0 : _a6.focus();
4140
4302
  };
4141
4303
  return /* @__PURE__ */ jsxRuntime.jsxs(
4142
4304
  Field3,
@@ -4408,8 +4570,8 @@ var CountryCodeSelect = React20.forwardRef((props, ref) => {
4408
4570
  return allCallingCodes;
4409
4571
  const filteredItems = allCallingCodes.items.filter(
4410
4572
  (callingCode) => {
4411
- var _a5;
4412
- return (_a5 = props.allowedCountryCodes) == null ? void 0 : _a5.includes(callingCode.label);
4573
+ var _a6;
4574
+ return (_a6 = props.allowedCountryCodes) == null ? void 0 : _a6.includes(callingCode.label);
4413
4575
  }
4414
4576
  );
4415
4577
  return react.createListCollection({ items: filteredItems });
@@ -4910,8 +5072,8 @@ var LinjeTagIcon = ({
4910
5072
  size,
4911
5073
  css
4912
5074
  }) => {
4913
- var _a5;
4914
- const IconComponent2 = ((_a5 = icons[variant]) == null ? void 0 : _a5[size]) ?? react.Box;
5075
+ var _a6;
5076
+ const IconComponent2 = ((_a6 = icons[variant]) == null ? void 0 : _a6[size]) ?? react.Box;
4915
5077
  return /* @__PURE__ */ jsxRuntime.jsx(react.Box, { css, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent2, {}) });
4916
5078
  };
4917
5079
  var LineIcon = React20.forwardRef(
@@ -6432,15 +6594,15 @@ var getNextSortState = (current, columnIndex) => {
6432
6594
  return { direction: "asc", columnIndex: null };
6433
6595
  };
6434
6596
  var getColumnIndex = (element) => {
6435
- var _a5;
6436
- return Array.prototype.indexOf.call((_a5 = element.parentElement) == null ? void 0 : _a5.children, element);
6597
+ var _a6;
6598
+ return Array.prototype.indexOf.call((_a6 = element.parentElement) == null ? void 0 : _a6.children, element);
6437
6599
  };
6438
6600
  var getCellSortText = (row, columnIndex) => {
6439
- var _a5;
6601
+ var _a6;
6440
6602
  const cell = row.cells[columnIndex];
6441
6603
  if (!cell)
6442
6604
  return "";
6443
- return cell.dataset.sort || ((_a5 = cell.textContent) == null ? void 0 : _a5.trim()) || "";
6605
+ return cell.dataset.sort || ((_a6 = cell.textContent) == null ? void 0 : _a6.trim()) || "";
6444
6606
  };
6445
6607
  var applyDomSort = (tbody, sortState, originalRows) => {
6446
6608
  if (sortState.columnIndex == null) {
@@ -7204,7 +7366,7 @@ var staticCardRecipe = react.defineRecipe({
7204
7366
  colorPalette: "white"
7205
7367
  }
7206
7368
  });
7207
- var _a2, _b;
7369
+ var _a3, _b2;
7208
7370
  var textareaRecipe = react.defineRecipe({
7209
7371
  className: "spor-textarea",
7210
7372
  base: {
@@ -7221,10 +7383,10 @@ var textareaRecipe = react.defineRecipe({
7221
7383
  variants: {
7222
7384
  variant: {
7223
7385
  core: {
7224
- ...(_a2 = inputRecipe.variants) == null ? void 0 : _a2.variant.core
7386
+ ...(_a3 = inputRecipe.variants) == null ? void 0 : _a3.variant.core
7225
7387
  },
7226
7388
  floating: {
7227
- ...(_b = inputRecipe.variants) == null ? void 0 : _b.variant.floating
7389
+ ...(_b2 = inputRecipe.variants) == null ? void 0 : _b2.variant.floating
7228
7390
  }
7229
7391
  }
7230
7392
  }
@@ -7561,6 +7723,19 @@ var comboboxAnatomy = react$1.comboboxAnatomy.extendWith(
7561
7723
  "indicatorGroup",
7562
7724
  "empty"
7563
7725
  );
7726
+ var menuAnatomy = anatomy.createAnatomy("menu").parts(
7727
+ "trigger",
7728
+ "content",
7729
+ "item",
7730
+ "itemGroup",
7731
+ "triggerItem",
7732
+ "itemCommand",
7733
+ "itemGroupLabel",
7734
+ "separator",
7735
+ "radioItem",
7736
+ "triggerItem",
7737
+ "checkboxItem"
7738
+ );
7564
7739
 
7565
7740
  // src/theme/slot-recipes/accordion.ts
7566
7741
  var accordionSlotRecipe = react.defineSlotRecipe({
@@ -9436,7 +9611,7 @@ var travelTagSlotRecipe = react.defineSlotRecipe({
9436
9611
  });
9437
9612
 
9438
9613
  // src/theme/slot-recipes/info-tag.ts
9439
- var _a3, _b2, _c, _d;
9614
+ var _a4, _b3, _c, _d;
9440
9615
  var infoTagSlotRecipe = react.defineSlotRecipe({
9441
9616
  slots: infoTagAnatomy.keys(),
9442
9617
  className: "spor-info-tag",
@@ -9473,9 +9648,9 @@ var infoTagSlotRecipe = react.defineSlotRecipe({
9473
9648
  "local-bus": {}
9474
9649
  },
9475
9650
  size: {
9476
- ...(_a3 = travelTagSlotRecipe.variants) == null ? void 0 : _a3.size,
9651
+ ...(_a4 = travelTagSlotRecipe.variants) == null ? void 0 : _a4.size,
9477
9652
  sm: {
9478
- ...(_b2 = travelTagSlotRecipe.variants) == null ? void 0 : _b2.size.sm,
9653
+ ...(_b3 = travelTagSlotRecipe.variants) == null ? void 0 : _b3.size.sm,
9479
9654
  iconContainer: {
9480
9655
  borderRadius: "0.375rem"
9481
9656
  }
@@ -9849,7 +10024,108 @@ var mediaControllerSlotRecipe = react.defineSlotRecipe({
9849
10024
  }
9850
10025
  ]
9851
10026
  });
9852
- var _a4, _b3;
10027
+ var menuSlotRecipe = react.defineSlotRecipe({
10028
+ className: "menu",
10029
+ slots: menuAnatomy.keys(),
10030
+ base: {
10031
+ content: {
10032
+ bg: "bg",
10033
+ borderRadius: "sm",
10034
+ boxShadow: "sm",
10035
+ width: "fit-content",
10036
+ padding: "1",
10037
+ display: "flex",
10038
+ flexDirection: "column",
10039
+ gap: "0.5",
10040
+ zIndex: "dropdown",
10041
+ _open: {
10042
+ animationStyle: "slide-fade-in",
10043
+ animationDuration: "fast",
10044
+ zIndex: "popover",
10045
+ outline: "none"
10046
+ }
10047
+ },
10048
+ itemGroup: {
10049
+ display: "flex",
10050
+ flexDirection: "column",
10051
+ gap: "0.5"
10052
+ },
10053
+ item: {
10054
+ borderRadius: "9px",
10055
+ padding: "2",
10056
+ display: "flex",
10057
+ justifyContent: "space-between",
10058
+ gap: 1.5,
10059
+ _hover: {
10060
+ backgroundColor: "accent.surface.hover"
10061
+ },
10062
+ "&:active": {
10063
+ backgroundColor: "accent.surface.active"
10064
+ },
10065
+ _checked: {
10066
+ backgroundColor: "accent.surface"
10067
+ },
10068
+ _highlighted: {
10069
+ backgroundColor: "ghost.surface.hover"
10070
+ }
10071
+ },
10072
+ itemGroupLabel: {
10073
+ paddingY: "1",
10074
+ fontWeight: "bold",
10075
+ fontSize: "xs"
10076
+ },
10077
+ itemCommand: {
10078
+ fontSize: "2xs"
10079
+ },
10080
+ separator: {
10081
+ color: "outline"
10082
+ },
10083
+ radioItem: {
10084
+ display: "flex",
10085
+ justifyContent: "space-between",
10086
+ gap: 2
10087
+ },
10088
+ triggerItem: {
10089
+ display: "flex",
10090
+ justifyContent: "space-between",
10091
+ gap: 1.5,
10092
+ alignItems: "center"
10093
+ },
10094
+ checkboxItem: {
10095
+ display: "flex",
10096
+ gap: 2,
10097
+ alignItems: "center",
10098
+ width: "full"
10099
+ }
10100
+ },
10101
+ variants: {
10102
+ variant: {
10103
+ core: {
10104
+ content: {
10105
+ border: "1px solid",
10106
+ borderColor: "core.outline"
10107
+ }
10108
+ },
10109
+ accent: {
10110
+ content: {
10111
+ border: "1px solid",
10112
+ borderColor: "core.outline"
10113
+ }
10114
+ },
10115
+ floating: {
10116
+ content: {
10117
+ border: "sm",
10118
+ borderColor: "floating.outline",
10119
+ boxShadow: "lg"
10120
+ }
10121
+ }
10122
+ }
10123
+ },
10124
+ defaultVariants: {
10125
+ variant: "core"
10126
+ }
10127
+ });
10128
+ var _a5, _b4;
9853
10129
  var nativeSelectSlotRecipe = react.defineSlotRecipe({
9854
10130
  slots: NativeSelectAnatomy.keys(),
9855
10131
  className: "spor-nativeSelect",
@@ -9893,12 +10169,12 @@ var nativeSelectSlotRecipe = react.defineSlotRecipe({
9893
10169
  variant: {
9894
10170
  core: {
9895
10171
  field: {
9896
- ...(_a4 = inputRecipe.variants) == null ? void 0 : _a4.variant.core
10172
+ ...(_a5 = inputRecipe.variants) == null ? void 0 : _a5.variant.core
9897
10173
  }
9898
10174
  },
9899
10175
  floating: {
9900
10176
  field: {
9901
- ...(_b3 = inputRecipe.variants) == null ? void 0 : _b3.variant.floating
10177
+ ...(_b4 = inputRecipe.variants) == null ? void 0 : _b4.variant.floating
9902
10178
  }
9903
10179
  }
9904
10180
  }
@@ -11212,7 +11488,8 @@ var slotRecipes = {
11212
11488
  toast: toastSlotRecipe,
11213
11489
  checkboxCard: choiceChipSlotRecipe,
11214
11490
  collapsible: collapsibleSlotRecipe,
11215
- tooltip: popoverSlotRecipe
11491
+ tooltip: popoverSlotRecipe,
11492
+ menu: menuSlotRecipe
11216
11493
  };
11217
11494
  var animations = react.defineTokens.animations({
11218
11495
  spin: {
@@ -12400,6 +12677,16 @@ exports.List = List;
12400
12677
  exports.ListBox = ListBox;
12401
12678
  exports.ListIndicator = ListIndicator;
12402
12679
  exports.ListItem = ListItem2;
12680
+ exports.Menu = Menu;
12681
+ exports.MenuCheckboxItem = MenuCheckboxItem;
12682
+ exports.MenuContent = MenuContent;
12683
+ exports.MenuItem = MenuItem;
12684
+ exports.MenuItemGroup = MenuItemGroup;
12685
+ exports.MenuRadioItem = MenuRadioItem;
12686
+ exports.MenuRadioItemGroup = MenuRadioItemGroup;
12687
+ exports.MenuSeparator = MenuSeparator;
12688
+ exports.MenuTrigger = MenuTrigger;
12689
+ exports.MenuTriggerItem = MenuTriggerItem;
12403
12690
  exports.NativeSelect = NativeSelect;
12404
12691
  exports.Nudge = Nudge;
12405
12692
  exports.NudgeActions = NudgeActions;
@@ -12480,6 +12767,7 @@ exports.themes = themes;
12480
12767
  exports.useCalendar = useCalendar;
12481
12768
  exports.useColorMode = useColorMode;
12482
12769
  exports.useColorModeValue = useColorModeValue;
12770
+ exports.useMenuContext = useMenuContext;
12483
12771
  exports.useTableSort = useTableSort;
12484
12772
  exports.useTranslation = useTranslation;
12485
12773
  //# sourceMappingURL=out.js.map