@nori-ui/core 1.1.0 → 1.3.0

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.
Files changed (58) hide show
  1. package/dist/chunk-2PESUXE3.js +3 -0
  2. package/dist/chunk-2PESUXE3.js.map +1 -0
  3. package/dist/{chunk-WDNDTSNX.js → chunk-4I37QSEM.js} +3 -3
  4. package/dist/{chunk-WDNDTSNX.js.map → chunk-4I37QSEM.js.map} +1 -1
  5. package/dist/chunk-H7MFAFV4.js +303 -0
  6. package/dist/chunk-H7MFAFV4.js.map +1 -0
  7. package/dist/chunk-KCLWPSV5.js +134 -0
  8. package/dist/chunk-KCLWPSV5.js.map +1 -0
  9. package/dist/{chunk-7D2BHQ6M.js → chunk-L5X4SYJ4.js} +3 -3
  10. package/dist/chunk-L5X4SYJ4.js.map +1 -0
  11. package/dist/{chunk-Y4ZRSW35.js → chunk-OCHEPOOO.js} +3 -3
  12. package/dist/{chunk-Y4ZRSW35.js.map → chunk-OCHEPOOO.js.map} +1 -1
  13. package/dist/{chunk-VMAGFYHG.js → chunk-SJZTETUT.js} +3 -3
  14. package/dist/{chunk-VMAGFYHG.js.map → chunk-SJZTETUT.js.map} +1 -1
  15. package/dist/chunk-XXBN6CIK.js +343 -0
  16. package/dist/chunk-XXBN6CIK.js.map +1 -0
  17. package/dist/chunk-ZPUYNM37.js +3 -0
  18. package/dist/chunk-ZPUYNM37.js.map +1 -0
  19. package/dist/client.cjs +747 -0
  20. package/dist/client.cjs.map +1 -1
  21. package/dist/client.d.cts +4 -1
  22. package/dist/client.d.ts +4 -1
  23. package/dist/client.js +24 -19
  24. package/dist/client.js.map +1 -1
  25. package/dist/components/Accordion/index.js +2 -2
  26. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  27. package/dist/components/Breadcrumb/index.js +3 -2
  28. package/dist/components/ContextMenu/index.cjs +1150 -0
  29. package/dist/components/ContextMenu/index.cjs.map +1 -0
  30. package/dist/components/ContextMenu/index.d.cts +38 -0
  31. package/dist/components/ContextMenu/index.d.ts +38 -0
  32. package/dist/components/ContextMenu/index.js +10 -0
  33. package/dist/components/ContextMenu/index.js.map +1 -0
  34. package/dist/components/DatePicker/index.cjs +3875 -0
  35. package/dist/components/DatePicker/index.cjs.map +1 -0
  36. package/dist/components/DatePicker/index.d.cts +58 -0
  37. package/dist/components/DatePicker/index.d.ts +58 -0
  38. package/dist/components/DatePicker/index.js +15 -0
  39. package/dist/components/DatePicker/index.js.map +1 -0
  40. package/dist/components/DropdownMenu/index.cjs +1032 -0
  41. package/dist/components/DropdownMenu/index.cjs.map +1 -0
  42. package/dist/components/DropdownMenu/index.d.cts +97 -0
  43. package/dist/components/DropdownMenu/index.d.ts +97 -0
  44. package/dist/components/DropdownMenu/index.js +10 -0
  45. package/dist/components/DropdownMenu/index.js.map +1 -0
  46. package/dist/components/Popover/index.cjs +1 -0
  47. package/dist/components/Popover/index.cjs.map +1 -1
  48. package/dist/components/Popover/index.d.cts +22 -1
  49. package/dist/components/Popover/index.d.ts +22 -1
  50. package/dist/components/Popover/index.js +2 -1
  51. package/dist/components/Switch/index.js +2 -2
  52. package/dist/index.cjs +747 -0
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.d.cts +4 -1
  55. package/dist/index.d.ts +4 -1
  56. package/dist/index.js +23 -18
  57. package/package.json +1 -1
  58. package/dist/chunk-7D2BHQ6M.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -6590,6 +6590,745 @@ var Checkbox = /* @__PURE__ */ __name(({
6590
6590
  }
6591
6591
  );
6592
6592
  }, "Checkbox");
6593
+ var MenuContext = React.createContext(null);
6594
+ var MenuContextProvider = /* @__PURE__ */ __name(({
6595
+ open,
6596
+ toggle,
6597
+ close,
6598
+ children
6599
+ }) => /* @__PURE__ */ jsxRuntime.jsx(MenuContext.Provider, { value: { open, toggle: toggle ?? close, close }, children }), "MenuContextProvider");
6600
+ function useMenuContext(caller) {
6601
+ const ctx = React.useContext(MenuContext);
6602
+ if (!ctx) {
6603
+ throw new Error(`<${caller}> must be rendered inside a <DropdownMenu> or <ContextMenu>.`);
6604
+ }
6605
+ return ctx;
6606
+ }
6607
+ __name(useMenuContext, "useMenuContext");
6608
+ var MenuContent = /* @__PURE__ */ __name(({
6609
+ children,
6610
+ className,
6611
+ testID,
6612
+ side = "bottom",
6613
+ align = "start",
6614
+ "aria-label": ariaLabel
6615
+ }) => {
6616
+ const colors = useThemeColors();
6617
+ const containerRef = React.useRef(null);
6618
+ React.useEffect(() => {
6619
+ if (reactNative.Platform.OS !== "web") {
6620
+ return;
6621
+ }
6622
+ if (typeof document === "undefined") {
6623
+ return;
6624
+ }
6625
+ const container = containerRef.current;
6626
+ if (!container) {
6627
+ return;
6628
+ }
6629
+ const getItems = /* @__PURE__ */ __name(() => Array.from(container.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')), "getItems");
6630
+ const onKeyDown = /* @__PURE__ */ __name((e) => {
6631
+ const items = getItems();
6632
+ if (items.length === 0) {
6633
+ return;
6634
+ }
6635
+ const focused = document.activeElement;
6636
+ const idx = focused ? items.indexOf(focused) : -1;
6637
+ switch (e.key) {
6638
+ case "ArrowDown":
6639
+ e.preventDefault();
6640
+ items[idx < items.length - 1 ? idx + 1 : 0]?.focus();
6641
+ break;
6642
+ case "ArrowUp":
6643
+ e.preventDefault();
6644
+ items[idx > 0 ? idx - 1 : items.length - 1]?.focus();
6645
+ break;
6646
+ case "Home":
6647
+ e.preventDefault();
6648
+ items[0]?.focus();
6649
+ break;
6650
+ case "End":
6651
+ e.preventDefault();
6652
+ items[items.length - 1]?.focus();
6653
+ break;
6654
+ }
6655
+ }, "onKeyDown");
6656
+ container.addEventListener("keydown", onKeyDown);
6657
+ return () => container.removeEventListener("keydown", onKeyDown);
6658
+ });
6659
+ return /* @__PURE__ */ jsxRuntime.jsx(
6660
+ Popover.Content,
6661
+ {
6662
+ side,
6663
+ align,
6664
+ ...testID !== void 0 ? { testID } : {},
6665
+ ...ariaLabel !== void 0 ? { "aria-label": ariaLabel } : {},
6666
+ ...className !== void 0 ? { className } : {},
6667
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6668
+ reactNative.View,
6669
+ {
6670
+ ref: containerRef,
6671
+ ...{
6672
+ role: "menu",
6673
+ ...ariaLabel !== void 0 ? { "aria-label": ariaLabel } : {}
6674
+ },
6675
+ style: {
6676
+ minWidth: 160,
6677
+ paddingVertical: px(colors.spacing["1"]),
6678
+ margin: -px(colors.spacing["4"]),
6679
+ borderRadius: px(colors.radius.lg),
6680
+ overflow: "hidden"
6681
+ },
6682
+ children
6683
+ }
6684
+ )
6685
+ }
6686
+ );
6687
+ }, "MenuContent");
6688
+ MenuContent.displayName = "MenuContent";
6689
+ var MenuItem = /* @__PURE__ */ __name(({
6690
+ onSelect,
6691
+ disabled = false,
6692
+ destructive = false,
6693
+ icon,
6694
+ shortcut,
6695
+ children,
6696
+ className,
6697
+ testID
6698
+ }) => {
6699
+ const colors = useThemeColors();
6700
+ const menu = useMenuContext("MenuItem");
6701
+ const handlePress = React.useCallback(() => {
6702
+ if (disabled) {
6703
+ return;
6704
+ }
6705
+ onSelect?.();
6706
+ menu.close();
6707
+ }, [disabled, onSelect, menu]);
6708
+ const textColor = destructive ? colors.color.danger : disabled ? colors.semantic.text.muted : colors.semantic.text.default;
6709
+ return /* @__PURE__ */ jsxRuntime.jsxs(
6710
+ reactNative.Pressable,
6711
+ {
6712
+ onPress: handlePress,
6713
+ disabled,
6714
+ ...{
6715
+ role: "menuitem",
6716
+ "aria-disabled": disabled ? "true" : void 0,
6717
+ tabIndex: disabled ? -1 : 0,
6718
+ onKeyDown: /* @__PURE__ */ __name((e) => {
6719
+ if (e.key === "Enter" || e.key === " ") {
6720
+ e.preventDefault();
6721
+ handlePress();
6722
+ }
6723
+ }, "onKeyDown")
6724
+ },
6725
+ ...testID !== void 0 ? { testID } : {},
6726
+ className: cn("flex-row items-center gap-2 px-3 py-2", className),
6727
+ style: { opacity: disabled ? 0.4 : 1 },
6728
+ accessibilityRole: "menuitem",
6729
+ accessibilityState: { disabled },
6730
+ children: [
6731
+ icon !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { width: 16, height: 16, alignItems: "center", justifyContent: "center" }, children: icon }),
6732
+ /* @__PURE__ */ jsxRuntime.jsx(
6733
+ reactNative.Text,
6734
+ {
6735
+ style: {
6736
+ flex: 1,
6737
+ fontFamily: colors.fontFamily.body,
6738
+ fontSize: px(colors.fontSize.sm),
6739
+ color: textColor
6740
+ },
6741
+ children
6742
+ }
6743
+ ),
6744
+ shortcut !== void 0 && reactNative.Platform.OS === "web" && /* @__PURE__ */ jsxRuntime.jsx(
6745
+ reactNative.Text,
6746
+ {
6747
+ ...{ "aria-hidden": "true" },
6748
+ style: {
6749
+ fontFamily: colors.fontFamily.body,
6750
+ fontSize: px(colors.fontSize.xs),
6751
+ color: colors.semantic.text.muted
6752
+ },
6753
+ children: shortcut
6754
+ }
6755
+ )
6756
+ ]
6757
+ }
6758
+ );
6759
+ }, "MenuItem");
6760
+ MenuItem.displayName = "MenuItem";
6761
+ var MenuSeparator = /* @__PURE__ */ __name(({ className, testID }) => {
6762
+ const colors = useThemeColors();
6763
+ return /* @__PURE__ */ jsxRuntime.jsx(
6764
+ reactNative.View,
6765
+ {
6766
+ ...{ role: "separator" },
6767
+ accessibilityRole: "none",
6768
+ ...testID !== void 0 ? { testID } : {},
6769
+ className: cn("mx-1 my-1", className),
6770
+ style: {
6771
+ height: 1,
6772
+ marginVertical: 4,
6773
+ marginHorizontal: 4,
6774
+ backgroundColor: colors.semantic.border.default
6775
+ }
6776
+ }
6777
+ );
6778
+ }, "MenuSeparator");
6779
+ MenuSeparator.displayName = "MenuSeparator";
6780
+ var MenuLabel = /* @__PURE__ */ __name(({ children, className, testID }) => {
6781
+ const colors = useThemeColors();
6782
+ return /* @__PURE__ */ jsxRuntime.jsx(
6783
+ reactNative.View,
6784
+ {
6785
+ ...{ role: "presentation" },
6786
+ ...testID !== void 0 ? { testID } : {},
6787
+ className: cn("px-3 pt-2 pb-1", className),
6788
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6789
+ reactNative.Text,
6790
+ {
6791
+ style: {
6792
+ fontFamily: colors.fontFamily.body,
6793
+ fontSize: px(colors.fontSize.xs),
6794
+ color: colors.semantic.text.muted,
6795
+ textTransform: "uppercase",
6796
+ letterSpacing: 0.6,
6797
+ fontWeight: "600"
6798
+ },
6799
+ children
6800
+ }
6801
+ )
6802
+ }
6803
+ );
6804
+ }, "MenuLabel");
6805
+ MenuLabel.displayName = "MenuLabel";
6806
+ var DropdownMenuRoot = /* @__PURE__ */ __name(({ open, defaultOpen = false, onOpenChange, children }) => {
6807
+ const [inner, setInner] = React.useState(defaultOpen);
6808
+ const isControlled = open !== void 0;
6809
+ const current = isControlled ? open : inner;
6810
+ const setOpen = React.useCallback(
6811
+ (next) => {
6812
+ if (!isControlled) {
6813
+ setInner(next);
6814
+ }
6815
+ onOpenChange?.(next);
6816
+ },
6817
+ [isControlled, onOpenChange]
6818
+ );
6819
+ const toggle = React.useCallback(() => setOpen(!current), [setOpen, current]);
6820
+ const close = React.useCallback(() => setOpen(false), [setOpen]);
6821
+ return /* @__PURE__ */ jsxRuntime.jsx(MenuContextProvider, { open: current, toggle, close, children: /* @__PURE__ */ jsxRuntime.jsx(Popover, { open: current, onOpenChange: setOpen, children }) });
6822
+ }, "DropdownMenuRoot");
6823
+ var DropdownMenuTrigger = /* @__PURE__ */ __name(({ children, className, testID }) => {
6824
+ const menu = useMenuContext("DropdownMenu.Trigger");
6825
+ const popover = usePopoverContext("DropdownMenu.Trigger");
6826
+ const onPress = React.useCallback(() => {
6827
+ popover.measureTrigger();
6828
+ popover.setOpen(!popover.open);
6829
+ }, [popover]);
6830
+ if (React.isValidElement(children)) {
6831
+ const child = children;
6832
+ const fire = /* @__PURE__ */ __name((existing) => (event) => {
6833
+ existing?.(event);
6834
+ popover.measureTrigger();
6835
+ popover.setOpen(!popover.open);
6836
+ }, "fire");
6837
+ return /* @__PURE__ */ jsxRuntime.jsx(
6838
+ Slot,
6839
+ {
6840
+ ref: (node) => {
6841
+ popover.triggerRef.current = node;
6842
+ },
6843
+ onClick: fire(child.props.onClick),
6844
+ onPress: fire(child.props.onPress),
6845
+ ...{
6846
+ "aria-haspopup": "menu",
6847
+ "aria-expanded": menu.open,
6848
+ "aria-controls": popover.contentId
6849
+ },
6850
+ ...testID !== void 0 ? { "data-testid": testID } : {},
6851
+ ...className !== void 0 ? { className } : {},
6852
+ children: child
6853
+ }
6854
+ );
6855
+ }
6856
+ return /* @__PURE__ */ jsxRuntime.jsx(
6857
+ reactNative.Pressable,
6858
+ {
6859
+ ref: (node) => {
6860
+ popover.triggerRef.current = node;
6861
+ },
6862
+ onPress,
6863
+ ...{
6864
+ "aria-haspopup": "menu",
6865
+ "aria-expanded": menu.open,
6866
+ "aria-controls": popover.contentId
6867
+ },
6868
+ ...testID !== void 0 ? { testID } : {},
6869
+ ...className !== void 0 ? { className } : {},
6870
+ children: typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { children }) : children
6871
+ }
6872
+ );
6873
+ }, "DropdownMenuTrigger");
6874
+ var DropdownMenuContent = /* @__PURE__ */ __name((props) => /* @__PURE__ */ jsxRuntime.jsx(MenuContent, { ...props }), "DropdownMenuContent");
6875
+ var DropdownMenu = Object.assign(DropdownMenuRoot, {
6876
+ Trigger: DropdownMenuTrigger,
6877
+ Content: DropdownMenuContent,
6878
+ Item: MenuItem,
6879
+ Separator: MenuSeparator,
6880
+ Label: MenuLabel
6881
+ });
6882
+ var ContextMenuCtx = React.createContext(null);
6883
+ var useContextMenuCtx = /* @__PURE__ */ __name(() => {
6884
+ const ctx = React.useContext(ContextMenuCtx);
6885
+ if (!ctx) {
6886
+ throw new Error("ContextMenu compound parts must be rendered inside a <ContextMenu>.");
6887
+ }
6888
+ return ctx;
6889
+ }, "useContextMenuCtx");
6890
+ var ContextMenuRoot = /* @__PURE__ */ __name(({ open, defaultOpen = false, onOpenChange, children }) => {
6891
+ const [inner, setInner] = React.useState(defaultOpen);
6892
+ const isControlled = open !== void 0;
6893
+ const current = isControlled ? open : inner;
6894
+ const setOpen = React.useCallback(
6895
+ (next) => {
6896
+ if (!isControlled) {
6897
+ setInner(next);
6898
+ }
6899
+ onOpenChange?.(next);
6900
+ },
6901
+ [isControlled, onOpenChange]
6902
+ );
6903
+ return /* @__PURE__ */ jsxRuntime.jsx(ContextMenuCtx.Provider, { value: { open: current, setOpen }, children: /* @__PURE__ */ jsxRuntime.jsx(Popover, { open: current, onOpenChange: setOpen, children }) });
6904
+ }, "ContextMenuRoot");
6905
+ var ContextMenuTrigger = /* @__PURE__ */ __name(({ children, className, testID }) => {
6906
+ const ctx = useContextMenuCtx();
6907
+ const popover = usePopoverContext("ContextMenu.Trigger");
6908
+ const openMenu = React.useCallback(() => {
6909
+ popover.measureTrigger();
6910
+ ctx.setOpen(true);
6911
+ }, [ctx, popover]);
6912
+ if (reactNative.Platform.OS === "web") {
6913
+ if (React.isValidElement(children)) {
6914
+ const child = children;
6915
+ const existing = child.props.onContextMenu;
6916
+ return /* @__PURE__ */ jsxRuntime.jsx(
6917
+ Slot,
6918
+ {
6919
+ ref: (node) => {
6920
+ popover.triggerRef.current = node;
6921
+ },
6922
+ onContextMenu: (e) => {
6923
+ e.preventDefault();
6924
+ existing?.(e);
6925
+ openMenu();
6926
+ },
6927
+ ...{
6928
+ "aria-haspopup": "menu",
6929
+ "aria-expanded": ctx.open,
6930
+ "aria-controls": popover.contentId
6931
+ },
6932
+ ...testID !== void 0 ? { "data-testid": testID } : {},
6933
+ ...className !== void 0 ? { className } : {},
6934
+ children: child
6935
+ }
6936
+ );
6937
+ }
6938
+ return /* @__PURE__ */ jsxRuntime.jsx(
6939
+ reactNative.Pressable,
6940
+ {
6941
+ ref: (node) => {
6942
+ popover.triggerRef.current = node;
6943
+ },
6944
+ ...{
6945
+ onContextMenu: /* @__PURE__ */ __name((e) => {
6946
+ e.preventDefault();
6947
+ openMenu();
6948
+ }, "onContextMenu"),
6949
+ "aria-haspopup": "menu",
6950
+ "aria-expanded": ctx.open,
6951
+ "aria-controls": popover.contentId
6952
+ },
6953
+ ...testID !== void 0 ? { testID } : {},
6954
+ ...className !== void 0 ? { className } : {},
6955
+ children: typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { children }) : children
6956
+ }
6957
+ );
6958
+ }
6959
+ if (React.isValidElement(children)) {
6960
+ const child = children;
6961
+ const existing = child.props.onLongPress;
6962
+ return /* @__PURE__ */ jsxRuntime.jsx(
6963
+ Slot,
6964
+ {
6965
+ ref: (node) => {
6966
+ popover.triggerRef.current = node;
6967
+ },
6968
+ onLongPress: (e) => {
6969
+ existing?.(e);
6970
+ openMenu();
6971
+ },
6972
+ accessibilityRole: "button",
6973
+ ...testID !== void 0 ? { testID } : {},
6974
+ ...className !== void 0 ? { className } : {},
6975
+ children: child
6976
+ }
6977
+ );
6978
+ }
6979
+ return /* @__PURE__ */ jsxRuntime.jsx(
6980
+ reactNative.Pressable,
6981
+ {
6982
+ ref: (node) => {
6983
+ popover.triggerRef.current = node;
6984
+ },
6985
+ onLongPress: openMenu,
6986
+ ...testID !== void 0 ? { testID } : {},
6987
+ ...className !== void 0 ? { className } : {},
6988
+ children: typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { children }) : children
6989
+ }
6990
+ );
6991
+ }, "ContextMenuTrigger");
6992
+ var ContextMenuContent = /* @__PURE__ */ __name((props) => {
6993
+ const ctx = useContextMenuCtx();
6994
+ const close = React.useCallback(() => ctx.setOpen(false), [ctx]);
6995
+ return /* @__PURE__ */ jsxRuntime.jsx(MenuContextProvider, { open: ctx.open, close, children: /* @__PURE__ */ jsxRuntime.jsx(MenuContent, { ...props }) });
6996
+ }, "ContextMenuContent");
6997
+ var ContextMenu = Object.assign(ContextMenuRoot, {
6998
+ Trigger: ContextMenuTrigger,
6999
+ Content: ContextMenuContent,
7000
+ Item: MenuItem,
7001
+ Separator: MenuSeparator,
7002
+ Label: MenuLabel
7003
+ });
7004
+ function formatDate(date$1, locale) {
7005
+ try {
7006
+ return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date$1.toDate(date.getLocalTimeZone()));
7007
+ } catch {
7008
+ return `${date$1.year}-${String(date$1.month).padStart(2, "0")}-${String(date$1.day).padStart(2, "0")}`;
7009
+ }
7010
+ }
7011
+ __name(formatDate, "formatDate");
7012
+ function CalendarIcon({ size = 16, color = "currentColor" }) {
7013
+ const colors = useThemeColors();
7014
+ if (reactNative.Platform.OS === "web") {
7015
+ return /* @__PURE__ */ jsxRuntime.jsx(
7016
+ "svg",
7017
+ {
7018
+ width: size,
7019
+ height: size,
7020
+ viewBox: "0 0 24 24",
7021
+ fill: "none",
7022
+ stroke: color,
7023
+ strokeWidth: "2",
7024
+ strokeLinecap: "round",
7025
+ strokeLinejoin: "round",
7026
+ "aria-hidden": "true",
7027
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z" })
7028
+ }
7029
+ );
7030
+ }
7031
+ const resolvedColor = color === "currentColor" ? colors.semantic.text.muted : color;
7032
+ return /* @__PURE__ */ jsxRuntime.jsx(
7033
+ reactNative.Text,
7034
+ {
7035
+ accessibilityElementsHidden: true,
7036
+ importantForAccessibility: "no-hide-descendants",
7037
+ style: { fontSize: size, lineHeight: size, color: resolvedColor },
7038
+ children: "\u{1F4C5}"
7039
+ }
7040
+ );
7041
+ }
7042
+ __name(CalendarIcon, "CalendarIcon");
7043
+ function buildCalendarOptional(minValue, maxValue, isDateUnavailable, firstDayOfWeek) {
7044
+ const out = {};
7045
+ if (minValue !== void 0) {
7046
+ out.minValue = minValue;
7047
+ }
7048
+ if (maxValue !== void 0) {
7049
+ out.maxValue = maxValue;
7050
+ }
7051
+ if (isDateUnavailable !== void 0) {
7052
+ out.isDateUnavailable = isDateUnavailable;
7053
+ }
7054
+ if (firstDayOfWeek !== void 0) {
7055
+ out.firstDayOfWeek = firstDayOfWeek;
7056
+ }
7057
+ return out;
7058
+ }
7059
+ __name(buildCalendarOptional, "buildCalendarOptional");
7060
+ function buildTriggerAriaProps(ariaProps) {
7061
+ const out = {};
7062
+ if (ariaProps["aria-labelledby"] !== void 0) {
7063
+ out["aria-labelledby"] = ariaProps["aria-labelledby"];
7064
+ }
7065
+ if (ariaProps["aria-describedby"] !== void 0) {
7066
+ out["aria-describedby"] = ariaProps["aria-describedby"];
7067
+ }
7068
+ if (ariaProps["aria-invalid"] !== void 0) {
7069
+ out["aria-invalid"] = ariaProps["aria-invalid"];
7070
+ }
7071
+ if (ariaProps["aria-required"] !== void 0) {
7072
+ out["aria-required"] = ariaProps["aria-required"];
7073
+ }
7074
+ return out;
7075
+ }
7076
+ __name(buildTriggerAriaProps, "buildTriggerAriaProps");
7077
+ var DatePickerRoot = /* @__PURE__ */ __name(({
7078
+ value,
7079
+ defaultValue: defaultValue2,
7080
+ onChange,
7081
+ locale: localeProp,
7082
+ minValue,
7083
+ maxValue,
7084
+ isDateUnavailable,
7085
+ firstDayOfWeek,
7086
+ placeholder,
7087
+ disabled = false,
7088
+ id,
7089
+ name: _name,
7090
+ className,
7091
+ testID,
7092
+ ...ariaProps
7093
+ }) => {
7094
+ const providerLocale = useLocale();
7095
+ const locale = localeProp ?? providerLocale;
7096
+ const [open, setOpen] = React.useState(false);
7097
+ const isControlled = value !== void 0;
7098
+ const [inner, setInner] = React.useState(defaultValue2 ?? null);
7099
+ const current = isControlled ? value ?? null : inner;
7100
+ const handleChange = React.useCallback(
7101
+ (date) => {
7102
+ if (!isControlled) {
7103
+ setInner(date);
7104
+ }
7105
+ onChange?.(date);
7106
+ setOpen(false);
7107
+ },
7108
+ [isControlled, onChange]
7109
+ );
7110
+ const handleOpenChange = React.useCallback(
7111
+ (next) => {
7112
+ if (!disabled) {
7113
+ setOpen(next);
7114
+ }
7115
+ },
7116
+ [disabled]
7117
+ );
7118
+ const displayValue = current ? formatDate(current, locale) : null;
7119
+ const calendarOptional = buildCalendarOptional(minValue, maxValue, isDateUnavailable, firstDayOfWeek);
7120
+ const triggerAriaProps = buildTriggerAriaProps(ariaProps);
7121
+ const colors = useThemeColors();
7122
+ const hasError = ariaProps["aria-invalid"] === true || ariaProps["aria-invalid"] === "true";
7123
+ const pressableStyle = {
7124
+ flexDirection: "row",
7125
+ alignItems: "center",
7126
+ borderWidth: 1,
7127
+ borderRadius: px(colors.radius.md),
7128
+ paddingHorizontal: px(colors.spacing["3"]),
7129
+ paddingVertical: px(colors.spacing["2"]),
7130
+ backgroundColor: colors.semantic.background.elevated,
7131
+ borderColor: hasError ? colors.color.danger : colors.semantic.border.default,
7132
+ opacity: disabled ? 0.6 : 1
7133
+ };
7134
+ const textStyle = {
7135
+ flex: 1,
7136
+ fontFamily: colors.fontFamily.body,
7137
+ fontSize: px(colors.fontSize.md),
7138
+ color: displayValue ? colors.semantic.text.default : colors.semantic.text.muted
7139
+ };
7140
+ const triggerExtraProps = {
7141
+ role: "combobox",
7142
+ accessibilityRole: "button",
7143
+ "aria-haspopup": "dialog",
7144
+ "aria-expanded": open,
7145
+ ...triggerAriaProps
7146
+ };
7147
+ if (id !== void 0) {
7148
+ triggerExtraProps.id = id;
7149
+ triggerExtraProps.nativeID = id;
7150
+ }
7151
+ if (testID !== void 0) {
7152
+ triggerExtraProps.testID = testID;
7153
+ }
7154
+ if (hasError) {
7155
+ triggerExtraProps["aria-invalid"] = true;
7156
+ }
7157
+ if (ariaProps["aria-required"]) {
7158
+ triggerExtraProps["aria-required"] = true;
7159
+ }
7160
+ if (disabled) {
7161
+ triggerExtraProps["aria-disabled"] = true;
7162
+ }
7163
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
7164
+ /* @__PURE__ */ jsxRuntime.jsx(Popover.Trigger, { asChild: false, className: cn(className), children: /* @__PURE__ */ jsxRuntime.jsxs(
7165
+ reactNative.Pressable,
7166
+ {
7167
+ onPress: disabled ? void 0 : () => setOpen(!open),
7168
+ disabled,
7169
+ className: cn(
7170
+ "flex-row items-center rounded-md border px-3 py-2",
7171
+ hasError ? "border-semantic-interactive-destructive" : "border-semantic-border-default",
7172
+ disabled ? "opacity-60" : void 0,
7173
+ className
7174
+ ),
7175
+ style: pressableStyle,
7176
+ ...triggerExtraProps,
7177
+ children: [
7178
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, numberOfLines: 1, children: displayValue ?? placeholder ?? "" }),
7179
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { marginLeft: px(colors.spacing["2"]) }, children: /* @__PURE__ */ jsxRuntime.jsx(CalendarIcon, { size: 16, color: colors.semantic.text.muted }) })
7180
+ ]
7181
+ }
7182
+ ) }),
7183
+ /* @__PURE__ */ jsxRuntime.jsx(Popover.Content, { "aria-label": "Date picker", side: "bottom", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
7184
+ Calendar,
7185
+ {
7186
+ mode: "single",
7187
+ value: current,
7188
+ onChange: (date) => {
7189
+ handleChange(date);
7190
+ },
7191
+ locale,
7192
+ ...calendarOptional
7193
+ }
7194
+ ) })
7195
+ ] });
7196
+ }, "DatePickerRoot");
7197
+ var DatePickerRange = /* @__PURE__ */ __name(({
7198
+ value,
7199
+ defaultValue: defaultValue2,
7200
+ onChange,
7201
+ locale: localeProp,
7202
+ minValue,
7203
+ maxValue,
7204
+ isDateUnavailable,
7205
+ firstDayOfWeek,
7206
+ placeholder,
7207
+ disabled = false,
7208
+ id,
7209
+ name: _name,
7210
+ className,
7211
+ testID,
7212
+ ...ariaProps
7213
+ }) => {
7214
+ const providerLocale = useLocale();
7215
+ const locale = localeProp ?? providerLocale;
7216
+ const [open, setOpen] = React.useState(false);
7217
+ const isControlled = value !== void 0;
7218
+ const [inner, setInner] = React.useState(defaultValue2 ?? { start: null, end: null });
7219
+ const current = isControlled ? value ?? { start: null, end: null } : inner;
7220
+ const calendarValue = current.start !== null ? { start: current.start, end: current.end } : null;
7221
+ const handleChange = React.useCallback(
7222
+ (calRange) => {
7223
+ const next = {
7224
+ start: calRange?.start ?? null,
7225
+ end: calRange?.end ?? null
7226
+ };
7227
+ if (!isControlled) {
7228
+ setInner(next);
7229
+ }
7230
+ onChange?.(next);
7231
+ if (next.start !== null && next.end !== null) {
7232
+ setOpen(false);
7233
+ }
7234
+ },
7235
+ [isControlled, onChange]
7236
+ );
7237
+ const handleOpenChange = React.useCallback(
7238
+ (next) => {
7239
+ if (!disabled) {
7240
+ setOpen(next);
7241
+ }
7242
+ },
7243
+ [disabled]
7244
+ );
7245
+ let displayValue = null;
7246
+ if (current.start !== null) {
7247
+ const startStr = formatDate(current.start, locale);
7248
+ const endStr = current.end !== null ? formatDate(current.end, locale) : "";
7249
+ displayValue = `${startStr} \u2013 ${endStr}`;
7250
+ }
7251
+ const calendarOptional = buildCalendarOptional(minValue, maxValue, isDateUnavailable, firstDayOfWeek);
7252
+ const triggerAriaProps = buildTriggerAriaProps(ariaProps);
7253
+ const colors = useThemeColors();
7254
+ const hasError = ariaProps["aria-invalid"] === true || ariaProps["aria-invalid"] === "true";
7255
+ const pressableStyle = {
7256
+ flexDirection: "row",
7257
+ alignItems: "center",
7258
+ borderWidth: 1,
7259
+ borderRadius: px(colors.radius.md),
7260
+ paddingHorizontal: px(colors.spacing["3"]),
7261
+ paddingVertical: px(colors.spacing["2"]),
7262
+ backgroundColor: colors.semantic.background.elevated,
7263
+ borderColor: hasError ? colors.color.danger : colors.semantic.border.default,
7264
+ opacity: disabled ? 0.6 : 1
7265
+ };
7266
+ const textStyle = {
7267
+ flex: 1,
7268
+ fontFamily: colors.fontFamily.body,
7269
+ fontSize: px(colors.fontSize.md),
7270
+ color: displayValue ? colors.semantic.text.default : colors.semantic.text.muted
7271
+ };
7272
+ const triggerExtraProps = {
7273
+ role: "combobox",
7274
+ accessibilityRole: "button",
7275
+ "aria-haspopup": "dialog",
7276
+ "aria-expanded": open,
7277
+ ...triggerAriaProps
7278
+ };
7279
+ if (id !== void 0) {
7280
+ triggerExtraProps.id = id;
7281
+ triggerExtraProps.nativeID = id;
7282
+ }
7283
+ if (testID !== void 0) {
7284
+ triggerExtraProps.testID = testID;
7285
+ }
7286
+ if (hasError) {
7287
+ triggerExtraProps["aria-invalid"] = true;
7288
+ }
7289
+ if (ariaProps["aria-required"]) {
7290
+ triggerExtraProps["aria-required"] = true;
7291
+ }
7292
+ if (disabled) {
7293
+ triggerExtraProps["aria-disabled"] = true;
7294
+ }
7295
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
7296
+ /* @__PURE__ */ jsxRuntime.jsx(Popover.Trigger, { asChild: false, className: cn(className), children: /* @__PURE__ */ jsxRuntime.jsxs(
7297
+ reactNative.Pressable,
7298
+ {
7299
+ onPress: disabled ? void 0 : () => setOpen(!open),
7300
+ disabled,
7301
+ className: cn(
7302
+ "flex-row items-center rounded-md border px-3 py-2",
7303
+ hasError ? "border-semantic-interactive-destructive" : "border-semantic-border-default",
7304
+ disabled ? "opacity-60" : void 0,
7305
+ className
7306
+ ),
7307
+ style: pressableStyle,
7308
+ ...triggerExtraProps,
7309
+ children: [
7310
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, numberOfLines: 1, children: displayValue ?? placeholder ?? "" }),
7311
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { marginLeft: px(colors.spacing["2"]) }, children: /* @__PURE__ */ jsxRuntime.jsx(CalendarIcon, { size: 16, color: colors.semantic.text.muted }) })
7312
+ ]
7313
+ }
7314
+ ) }),
7315
+ /* @__PURE__ */ jsxRuntime.jsx(Popover.Content, { "aria-label": "Date range picker", side: "bottom", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
7316
+ Calendar,
7317
+ {
7318
+ mode: "range",
7319
+ value: calendarValue,
7320
+ onChange: (range2) => {
7321
+ handleChange(range2);
7322
+ },
7323
+ locale,
7324
+ ...calendarOptional
7325
+ }
7326
+ ) })
7327
+ ] });
7328
+ }, "DatePickerRange");
7329
+ var DatePicker = Object.assign(DatePickerRoot, {
7330
+ Range: DatePickerRange
7331
+ });
6593
7332
  var DialogContext = React.createContext(null);
6594
7333
  var useDialogContext = /* @__PURE__ */ __name((label) => {
6595
7334
  const ctx = React.useContext(DialogContext);
@@ -12133,13 +12872,20 @@ exports.Button = Button;
12133
12872
  exports.Calendar = Calendar;
12134
12873
  exports.Card = Card;
12135
12874
  exports.Checkbox = Checkbox;
12875
+ exports.ContextMenu = ContextMenu;
12876
+ exports.DatePicker = DatePicker;
12136
12877
  exports.Dialog = Dialog;
12878
+ exports.DropdownMenu = DropdownMenu;
12137
12879
  exports.Field = Field;
12138
12880
  exports.FloatButton = FloatButton;
12139
12881
  exports.HStack = HStack;
12140
12882
  exports.Icon = Icon;
12141
12883
  exports.InputGroup = InputGroup;
12142
12884
  exports.Label = Label;
12885
+ exports.MenuContent = MenuContent;
12886
+ exports.MenuItem = MenuItem;
12887
+ exports.MenuLabel = MenuLabel;
12888
+ exports.MenuSeparator = MenuSeparator;
12143
12889
  exports.PAGINATION_COMPACT_BREAKPOINT = PAGINATION_COMPACT_BREAKPOINT;
12144
12890
  exports.Pagination = Pagination;
12145
12891
  exports.Popover = Popover;
@@ -12173,6 +12919,7 @@ exports.themeDark = themeDark;
12173
12919
  exports.toast = toast2;
12174
12920
  exports.useCalendarCaption = useCalendarCaption;
12175
12921
  exports.usePagination = usePagination;
12922
+ exports.usePopoverContext = usePopoverContext;
12176
12923
  exports.useSliderInteractionActive = useSliderInteractionActive;
12177
12924
  //# sourceMappingURL=index.cjs.map
12178
12925
  //# sourceMappingURL=index.cjs.map