@nori-ui/core 1.2.0 → 1.4.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 (56) 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-BNDUQNG7.js +443 -0
  6. package/dist/chunk-BNDUQNG7.js.map +1 -0
  7. package/dist/chunk-H7MFAFV4.js +303 -0
  8. package/dist/chunk-H7MFAFV4.js.map +1 -0
  9. package/dist/chunk-KCLWPSV5.js +134 -0
  10. package/dist/chunk-KCLWPSV5.js.map +1 -0
  11. package/dist/{chunk-7D2BHQ6M.js → chunk-L5X4SYJ4.js} +3 -3
  12. package/dist/chunk-L5X4SYJ4.js.map +1 -0
  13. package/dist/{chunk-XBNVKPJN.js → chunk-XXBN6CIK.js} +3 -3
  14. package/dist/{chunk-XBNVKPJN.js.map → chunk-XXBN6CIK.js.map} +1 -1
  15. package/dist/chunk-ZPUYNM37.js +3 -0
  16. package/dist/chunk-ZPUYNM37.js.map +1 -0
  17. package/dist/client.cjs +879 -21
  18. package/dist/client.cjs.map +1 -1
  19. package/dist/client.d.cts +4 -1
  20. package/dist/client.d.ts +4 -1
  21. package/dist/client.js +18 -13
  22. package/dist/client.js.map +1 -1
  23. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  24. package/dist/components/Breadcrumb/index.js +3 -2
  25. package/dist/components/ContextMenu/index.cjs +1150 -0
  26. package/dist/components/ContextMenu/index.cjs.map +1 -0
  27. package/dist/components/ContextMenu/index.d.cts +38 -0
  28. package/dist/components/ContextMenu/index.d.ts +38 -0
  29. package/dist/components/ContextMenu/index.js +10 -0
  30. package/dist/components/ContextMenu/index.js.map +1 -0
  31. package/dist/components/DatePicker/index.cjs.map +1 -1
  32. package/dist/components/DatePicker/index.js +3 -2
  33. package/dist/components/DropdownMenu/index.cjs +1032 -0
  34. package/dist/components/DropdownMenu/index.cjs.map +1 -0
  35. package/dist/components/DropdownMenu/index.d.cts +97 -0
  36. package/dist/components/DropdownMenu/index.d.ts +97 -0
  37. package/dist/components/DropdownMenu/index.js +10 -0
  38. package/dist/components/DropdownMenu/index.js.map +1 -0
  39. package/dist/components/Popover/index.cjs +1 -0
  40. package/dist/components/Popover/index.cjs.map +1 -1
  41. package/dist/components/Popover/index.d.cts +22 -1
  42. package/dist/components/Popover/index.d.ts +22 -1
  43. package/dist/components/Popover/index.js +2 -1
  44. package/dist/components/Sheet/index.cjs +855 -0
  45. package/dist/components/Sheet/index.cjs.map +1 -0
  46. package/dist/components/Sheet/index.d.cts +104 -0
  47. package/dist/components/Sheet/index.d.ts +104 -0
  48. package/dist/components/Sheet/index.js +8 -0
  49. package/dist/components/Sheet/index.js.map +1 -0
  50. package/dist/index.cjs +879 -21
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.cts +4 -1
  53. package/dist/index.d.ts +4 -1
  54. package/dist/index.js +18 -13
  55. package/package.json +1 -1
  56. package/dist/chunk-7D2BHQ6M.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -6590,6 +6590,417 @@ 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
+ });
6593
7004
  function formatDate(date$1, locale) {
6594
7005
  try {
6595
7006
  return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date$1.toDate(date.getLocalTimeZone()));
@@ -10233,25 +10644,455 @@ var Separator = /* @__PURE__ */ __name(({
10233
10644
  }
10234
10645
  );
10235
10646
  }, "Separator");
10236
- var PULSE_DURATION_MS = 900;
10237
- var PULSE_MIN = 0.55;
10238
- var PULSE_MAX = 1;
10239
- var Skeleton = /* @__PURE__ */ __name(({
10240
- width = "100%",
10241
- height = 16,
10242
- radius = 6,
10243
- static: isStatic = false,
10244
- className,
10245
- style,
10246
- testID
10647
+ var SIZE_PERCENT = {
10648
+ sm: "25%",
10649
+ md: "50%",
10650
+ lg: "75%",
10651
+ full: "100%"
10652
+ };
10653
+ var SheetContext = React.createContext(null);
10654
+ var useSheetContext = /* @__PURE__ */ __name((label) => {
10655
+ const ctx = React.useContext(SheetContext);
10656
+ if (!ctx) {
10657
+ throw new Error(`<${label}> must be rendered inside a <Sheet>.`);
10658
+ }
10659
+ return ctx;
10660
+ }, "useSheetContext");
10661
+ var SheetRoot = /* @__PURE__ */ __name(({
10662
+ open,
10663
+ defaultOpen = false,
10664
+ onOpenChange,
10665
+ side = "bottom",
10666
+ size = "md",
10667
+ dismissible = true,
10668
+ children
10247
10669
  }) => {
10248
- const colors = useThemeColors();
10249
- const isDark = useColorScheme() === "dark";
10250
- const opacity = React.useRef(new reactNative.Animated.Value(PULSE_MAX)).current;
10251
- React.useEffect(() => {
10252
- if (isStatic) {
10253
- return;
10254
- }
10670
+ const [inner, setInner] = React.useState(defaultOpen);
10671
+ const isControlled = open !== void 0;
10672
+ const current = isControlled ? open : inner;
10673
+ const setOpen = React.useCallback(
10674
+ (next) => {
10675
+ if (!isControlled) {
10676
+ setInner(next);
10677
+ }
10678
+ onOpenChange?.(next);
10679
+ },
10680
+ [isControlled, onOpenChange]
10681
+ );
10682
+ const baseId = React.useId();
10683
+ const triggerRef = React.useRef(null);
10684
+ const ctxValue = {
10685
+ open: current,
10686
+ setOpen,
10687
+ titleId: `${baseId}-title`,
10688
+ descriptionId: `${baseId}-description`,
10689
+ triggerRef,
10690
+ side,
10691
+ size,
10692
+ dismissible
10693
+ };
10694
+ return /* @__PURE__ */ jsxRuntime.jsx(SheetContext.Provider, { value: ctxValue, children });
10695
+ }, "SheetRoot");
10696
+ var SheetTrigger = /* @__PURE__ */ __name(({ asChild = true, children, className, testID }) => {
10697
+ const ctx = useSheetContext("SheetTrigger");
10698
+ const onPress = React.useCallback(() => ctx.setOpen(true), [ctx]);
10699
+ if (asChild && React.isValidElement(children)) {
10700
+ const child = children;
10701
+ const fire = /* @__PURE__ */ __name((existing) => (event) => {
10702
+ existing?.(event);
10703
+ ctx.setOpen(true);
10704
+ }, "fire");
10705
+ return /* @__PURE__ */ jsxRuntime.jsx(
10706
+ Slot,
10707
+ {
10708
+ ref: (node) => {
10709
+ ctx.triggerRef.current = node;
10710
+ },
10711
+ onClick: fire(child.props.onClick),
10712
+ onPress: fire(child.props.onPress),
10713
+ ...testID !== void 0 ? { "data-testid": testID } : {},
10714
+ ...className !== void 0 ? { className } : {},
10715
+ children: child
10716
+ }
10717
+ );
10718
+ }
10719
+ return /* @__PURE__ */ jsxRuntime.jsx(
10720
+ reactNative.Pressable,
10721
+ {
10722
+ ref: (node) => {
10723
+ ctx.triggerRef.current = node;
10724
+ },
10725
+ onPress,
10726
+ ...testID !== void 0 ? { testID } : {},
10727
+ ...className !== void 0 ? { className } : {},
10728
+ children: wrapStringChildren5(children)
10729
+ }
10730
+ );
10731
+ }, "SheetTrigger");
10732
+ var SheetHeader = /* @__PURE__ */ __name(({ children, className }) => {
10733
+ const colors = useThemeColors();
10734
+ return /* @__PURE__ */ jsxRuntime.jsx(
10735
+ reactNative.View,
10736
+ {
10737
+ className: cn("flex-col gap-1", className),
10738
+ style: {
10739
+ flexDirection: "column",
10740
+ gap: px(colors.spacing["1"]),
10741
+ paddingHorizontal: px(colors.spacing["6"]),
10742
+ paddingTop: px(colors.spacing["6"]),
10743
+ paddingBottom: px(colors.spacing["2"])
10744
+ },
10745
+ children
10746
+ }
10747
+ );
10748
+ }, "SheetHeader");
10749
+ var SheetTitle = /* @__PURE__ */ __name(({ children, className }) => {
10750
+ const ctx = useSheetContext("SheetTitle");
10751
+ const colors = useThemeColors();
10752
+ return /* @__PURE__ */ jsxRuntime.jsx(
10753
+ reactNative.Text,
10754
+ {
10755
+ nativeID: ctx.titleId,
10756
+ id: ctx.titleId,
10757
+ role: "heading",
10758
+ "aria-level": 2,
10759
+ className: cn("text-lg font-semibold text-semantic-text-default", className),
10760
+ style: {
10761
+ color: colors.semantic.text.default,
10762
+ fontFamily: colors.fontFamily.display,
10763
+ fontSize: px(colors.fontSize.lg),
10764
+ fontWeight: colors.fontWeight.semibold
10765
+ },
10766
+ children
10767
+ }
10768
+ );
10769
+ }, "SheetTitle");
10770
+ var SheetDescription = /* @__PURE__ */ __name(({ children, className }) => {
10771
+ const ctx = useSheetContext("SheetDescription");
10772
+ const colors = useThemeColors();
10773
+ return /* @__PURE__ */ jsxRuntime.jsx(
10774
+ reactNative.Text,
10775
+ {
10776
+ nativeID: ctx.descriptionId,
10777
+ id: ctx.descriptionId,
10778
+ className: cn("text-sm text-semantic-text-muted", className),
10779
+ style: {
10780
+ color: colors.semantic.text.muted,
10781
+ fontFamily: colors.fontFamily.body,
10782
+ fontSize: px(colors.fontSize.sm),
10783
+ lineHeight: px(colors.fontSize.sm) * Number(colors.lineHeight.normal)
10784
+ },
10785
+ children
10786
+ }
10787
+ );
10788
+ }, "SheetDescription");
10789
+ var SheetBody = /* @__PURE__ */ __name(({ children, className }) => {
10790
+ const colors = useThemeColors();
10791
+ return /* @__PURE__ */ jsxRuntime.jsx(
10792
+ reactNative.View,
10793
+ {
10794
+ className: cn("flex-1", className),
10795
+ style: {
10796
+ flex: 1,
10797
+ paddingHorizontal: px(colors.spacing["6"]),
10798
+ paddingVertical: px(colors.spacing["4"])
10799
+ },
10800
+ children
10801
+ }
10802
+ );
10803
+ }, "SheetBody");
10804
+ var SheetFooter = /* @__PURE__ */ __name(({ children, className }) => {
10805
+ const colors = useThemeColors();
10806
+ return /* @__PURE__ */ jsxRuntime.jsx(
10807
+ reactNative.View,
10808
+ {
10809
+ className: cn("flex-row items-center justify-end gap-2", className),
10810
+ style: {
10811
+ flexDirection: "row",
10812
+ alignItems: "center",
10813
+ justifyContent: "flex-end",
10814
+ gap: px(colors.spacing["2"]),
10815
+ paddingHorizontal: px(colors.spacing["6"]),
10816
+ paddingBottom: px(colors.spacing["6"]),
10817
+ paddingTop: px(colors.spacing["2"])
10818
+ },
10819
+ children
10820
+ }
10821
+ );
10822
+ }, "SheetFooter");
10823
+ var SheetClose = /* @__PURE__ */ __name(({
10824
+ asChild = true,
10825
+ children,
10826
+ className,
10827
+ testID,
10828
+ accessibilityLabel = "Close"
10829
+ }) => {
10830
+ const ctx = useSheetContext("SheetClose");
10831
+ const onPress = React.useCallback(() => ctx.setOpen(false), [ctx]);
10832
+ if (asChild && React.isValidElement(children)) {
10833
+ const child = children;
10834
+ const fire = /* @__PURE__ */ __name((existing) => (event) => {
10835
+ existing?.(event);
10836
+ ctx.setOpen(false);
10837
+ }, "fire");
10838
+ return /* @__PURE__ */ jsxRuntime.jsx(
10839
+ Slot,
10840
+ {
10841
+ onClick: fire(child.props.onClick),
10842
+ onPress: fire(child.props.onPress),
10843
+ ...testID !== void 0 ? { "data-testid": testID } : {},
10844
+ ...className !== void 0 ? { className } : {},
10845
+ children: child
10846
+ }
10847
+ );
10848
+ }
10849
+ return /* @__PURE__ */ jsxRuntime.jsx(
10850
+ reactNative.Pressable,
10851
+ {
10852
+ onPress,
10853
+ role: "button",
10854
+ accessibilityRole: "button",
10855
+ accessibilityLabel,
10856
+ "aria-label": accessibilityLabel,
10857
+ ...testID !== void 0 ? { testID } : {},
10858
+ ...className !== void 0 ? { className } : {},
10859
+ children: wrapStringChildren5(children)
10860
+ }
10861
+ );
10862
+ }, "SheetClose");
10863
+ function wrapStringChildren5(children) {
10864
+ if (typeof children === "string" || typeof children === "number") {
10865
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { children });
10866
+ }
10867
+ return children;
10868
+ }
10869
+ __name(wrapStringChildren5, "wrapStringChildren");
10870
+ var SCRIM_COLOR3 = "rgba(0, 0, 0, 0.40)";
10871
+ var FOCUSABLE_SELECTOR3 = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
10872
+ var SheetPanel = /* @__PURE__ */ __name(({ children, className, testID }) => {
10873
+ const ctx = useSheetContext("SheetPanel");
10874
+ const colors = useThemeColors();
10875
+ const panelRef = React.useRef(null);
10876
+ const overlayDomRef = React.useRef(null);
10877
+ const [entered, setEntered] = React.useState(false);
10878
+ React.useEffect(() => {
10879
+ if (reactNative.Platform.OS !== "web") {
10880
+ setEntered(true);
10881
+ return;
10882
+ }
10883
+ if (!ctx.open) {
10884
+ setEntered(false);
10885
+ return;
10886
+ }
10887
+ const id = requestAnimationFrame(() => setEntered(true));
10888
+ return () => cancelAnimationFrame(id);
10889
+ }, [ctx.open]);
10890
+ React.useEffect(() => {
10891
+ if (reactNative.Platform.OS !== "web") {
10892
+ return;
10893
+ }
10894
+ const node = overlayDomRef.current;
10895
+ if (!node) {
10896
+ return;
10897
+ }
10898
+ node.style.transitionProperty = "background-color";
10899
+ node.style.transitionDuration = "200ms";
10900
+ node.style.transitionTimingFunction = "ease-out";
10901
+ node.style.backgroundColor = entered ? SCRIM_COLOR3 : "rgba(0,0,0,0)";
10902
+ }, [entered]);
10903
+ React.useEffect(() => {
10904
+ if (!ctx.open || reactNative.Platform.OS !== "web" || typeof document === "undefined") {
10905
+ return;
10906
+ }
10907
+ const previouslyFocused = document.activeElement;
10908
+ const prevBodyOverflow = document.body.style.overflow;
10909
+ document.body.style.overflow = "hidden";
10910
+ const focusFirst = /* @__PURE__ */ __name(() => {
10911
+ const node = panelRef.current;
10912
+ if (!node) {
10913
+ return;
10914
+ }
10915
+ const focusable = node.querySelectorAll(FOCUSABLE_SELECTOR3);
10916
+ const first = focusable[0];
10917
+ if (first) {
10918
+ first.focus();
10919
+ } else {
10920
+ node.setAttribute("tabindex", "-1");
10921
+ node.focus();
10922
+ }
10923
+ }, "focusFirst");
10924
+ focusFirst();
10925
+ const onKeyDown = /* @__PURE__ */ __name((event) => {
10926
+ if (event.key === "Escape") {
10927
+ event.preventDefault();
10928
+ ctx.setOpen(false);
10929
+ return;
10930
+ }
10931
+ if (event.key !== "Tab") {
10932
+ return;
10933
+ }
10934
+ const node = panelRef.current;
10935
+ if (!node) {
10936
+ return;
10937
+ }
10938
+ const focusable = Array.from(node.querySelectorAll(FOCUSABLE_SELECTOR3)).filter(
10939
+ (el) => el.offsetParent !== null || el === document.activeElement
10940
+ );
10941
+ if (focusable.length === 0) {
10942
+ event.preventDefault();
10943
+ return;
10944
+ }
10945
+ const first = focusable[0];
10946
+ const last = focusable[focusable.length - 1];
10947
+ if (!first || !last) {
10948
+ return;
10949
+ }
10950
+ if (event.shiftKey) {
10951
+ if (document.activeElement === first || !node.contains(document.activeElement)) {
10952
+ event.preventDefault();
10953
+ last.focus();
10954
+ }
10955
+ } else if (document.activeElement === last) {
10956
+ event.preventDefault();
10957
+ first.focus();
10958
+ }
10959
+ }, "onKeyDown");
10960
+ document.addEventListener("keydown", onKeyDown);
10961
+ return () => {
10962
+ document.removeEventListener("keydown", onKeyDown);
10963
+ document.body.style.overflow = prevBodyOverflow;
10964
+ const restoreTo = ctx.triggerRef.current ?? previouslyFocused;
10965
+ restoreTo?.focus?.();
10966
+ };
10967
+ }, [ctx.open, ctx.setOpen, ctx.triggerRef]);
10968
+ const onBackdropPress = React.useCallback(() => {
10969
+ if (ctx.dismissible) {
10970
+ ctx.setOpen(false);
10971
+ }
10972
+ }, [ctx]);
10973
+ const isHorizontal = ctx.side === "left" || ctx.side === "right";
10974
+ const dim = typeof ctx.size === "number" ? ctx.size : SIZE_PERCENT[ctx.size];
10975
+ const panelStyle = {
10976
+ position: "absolute",
10977
+ backgroundColor: colors.semantic.background.elevated,
10978
+ ...isHorizontal ? { top: 0, bottom: 0 } : { left: 0, right: 0 },
10979
+ ...ctx.side === "bottom" && { bottom: 0 },
10980
+ ...ctx.side === "top" && { top: 0 },
10981
+ ...ctx.side === "left" && { left: 0 },
10982
+ ...ctx.side === "right" && { right: 0 }
10983
+ };
10984
+ const translateStyle = reactNative.Platform.OS === "web" ? {
10985
+ transform: entered ? "translateX(0) translateY(0)" : translateOffscreen(ctx.side),
10986
+ transitionProperty: "transform",
10987
+ transitionDuration: "280ms",
10988
+ transitionTimingFunction: "cubic-bezier(0.16, 1, 0.3, 1)"
10989
+ } : {};
10990
+ const overlayStyle = {
10991
+ position: reactNative.Platform.OS === "web" ? "fixed" : "absolute",
10992
+ top: 0,
10993
+ left: 0,
10994
+ right: 0,
10995
+ bottom: 0,
10996
+ ...reactNative.Platform.OS === "web" ? { zIndex: 50 } : { backgroundColor: SCRIM_COLOR3 }
10997
+ };
10998
+ const sizeStyle = isHorizontal ? { width: dim, height: "100%" } : { height: dim, width: "100%" };
10999
+ return /* @__PURE__ */ jsxRuntime.jsx(
11000
+ reactNative.Modal,
11001
+ {
11002
+ visible: ctx.open,
11003
+ transparent: true,
11004
+ animationType: reactNative.Platform.OS === "web" ? "none" : ctx.side === "bottom" || ctx.side === "top" ? "slide" : "fade",
11005
+ onRequestClose: () => ctx.setOpen(false),
11006
+ children: /* @__PURE__ */ jsxRuntime.jsx(
11007
+ reactNative.Pressable,
11008
+ {
11009
+ accessibilityRole: "none",
11010
+ "aria-hidden": true,
11011
+ ref: (node) => {
11012
+ overlayDomRef.current = node;
11013
+ },
11014
+ style: overlayStyle,
11015
+ onPress: onBackdropPress,
11016
+ children: /* @__PURE__ */ jsxRuntime.jsx(
11017
+ reactNative.Pressable,
11018
+ {
11019
+ onPress: (event) => event.stopPropagation?.(),
11020
+ ref: (node) => {
11021
+ panelRef.current = node;
11022
+ },
11023
+ role: "dialog",
11024
+ accessibilityRole: "none",
11025
+ "aria-modal": true,
11026
+ "aria-labelledby": ctx.titleId,
11027
+ "aria-describedby": ctx.descriptionId,
11028
+ "data-side": ctx.side,
11029
+ ...testID !== void 0 ? { testID } : {},
11030
+ className: cn("bg-semantic-background-elevated", className),
11031
+ style: [
11032
+ panelStyle,
11033
+ sizeStyle,
11034
+ translateStyle,
11035
+ {
11036
+ shadowColor: "#000",
11037
+ shadowOffset: { width: 0, height: -2 },
11038
+ shadowOpacity: 0.15,
11039
+ shadowRadius: 20,
11040
+ elevation: 24,
11041
+ ...ctx.side === "bottom" ? { borderTopLeftRadius: 16, borderTopRightRadius: 16 } : {},
11042
+ ...ctx.side === "top" ? { borderBottomLeftRadius: 16, borderBottomRightRadius: 16 } : {}
11043
+ }
11044
+ ],
11045
+ children
11046
+ }
11047
+ )
11048
+ }
11049
+ )
11050
+ }
11051
+ );
11052
+ }, "SheetPanel");
11053
+ var Sheet = Object.assign(SheetRoot, {
11054
+ Trigger: SheetTrigger,
11055
+ Panel: SheetPanel,
11056
+ Header: SheetHeader,
11057
+ Title: SheetTitle,
11058
+ Description: SheetDescription,
11059
+ Body: SheetBody,
11060
+ Footer: SheetFooter,
11061
+ Close: SheetClose
11062
+ });
11063
+ var Drawer = Sheet;
11064
+ function translateOffscreen(side) {
11065
+ switch (side) {
11066
+ case "bottom":
11067
+ return "translateY(100%)";
11068
+ case "top":
11069
+ return "translateY(-100%)";
11070
+ case "left":
11071
+ return "translateX(-100%)";
11072
+ case "right":
11073
+ return "translateX(100%)";
11074
+ }
11075
+ }
11076
+ __name(translateOffscreen, "translateOffscreen");
11077
+ var PULSE_DURATION_MS = 900;
11078
+ var PULSE_MIN = 0.55;
11079
+ var PULSE_MAX = 1;
11080
+ var Skeleton = /* @__PURE__ */ __name(({
11081
+ width = "100%",
11082
+ height = 16,
11083
+ radius = 6,
11084
+ static: isStatic = false,
11085
+ className,
11086
+ style,
11087
+ testID
11088
+ }) => {
11089
+ const colors = useThemeColors();
11090
+ const isDark = useColorScheme() === "dark";
11091
+ const opacity = React.useRef(new reactNative.Animated.Value(PULSE_MAX)).current;
11092
+ React.useEffect(() => {
11093
+ if (isStatic) {
11094
+ return;
11095
+ }
10255
11096
  const loop = reactNative.Animated.loop(
10256
11097
  reactNative.Animated.sequence([
10257
11098
  reactNative.Animated.timing(opacity, {
@@ -12146,17 +12987,17 @@ var TooltipTrigger = /* @__PURE__ */ __name(({ asChild = true, children, classNa
12146
12987
  },
12147
12988
  ...testID !== void 0 ? { testID } : {},
12148
12989
  ...className !== void 0 ? { className } : {},
12149
- children: wrapStringChildren5(children)
12990
+ children: wrapStringChildren6(children)
12150
12991
  }
12151
12992
  );
12152
12993
  }, "TooltipTrigger");
12153
- function wrapStringChildren5(children) {
12994
+ function wrapStringChildren6(children) {
12154
12995
  if (typeof children === "string" || typeof children === "number") {
12155
12996
  return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { children });
12156
12997
  }
12157
12998
  return children;
12158
12999
  }
12159
- __name(wrapStringChildren5, "wrapStringChildren");
13000
+ __name(wrapStringChildren6, "wrapStringChildren");
12160
13001
  var GAP2 = 4;
12161
13002
  var MIN_WIDTH2 = 0;
12162
13003
  function computePosition2(rect, side, align, contentSize) {
@@ -12461,14 +13302,21 @@ exports.Button = Button;
12461
13302
  exports.Calendar = Calendar;
12462
13303
  exports.Card = Card;
12463
13304
  exports.Checkbox = Checkbox;
13305
+ exports.ContextMenu = ContextMenu;
12464
13306
  exports.DatePicker = DatePicker;
12465
13307
  exports.Dialog = Dialog;
13308
+ exports.Drawer = Drawer;
13309
+ exports.DropdownMenu = DropdownMenu;
12466
13310
  exports.Field = Field;
12467
13311
  exports.FloatButton = FloatButton;
12468
13312
  exports.HStack = HStack;
12469
13313
  exports.Icon = Icon;
12470
13314
  exports.InputGroup = InputGroup;
12471
13315
  exports.Label = Label;
13316
+ exports.MenuContent = MenuContent;
13317
+ exports.MenuItem = MenuItem;
13318
+ exports.MenuLabel = MenuLabel;
13319
+ exports.MenuSeparator = MenuSeparator;
12472
13320
  exports.PAGINATION_COMPACT_BREAKPOINT = PAGINATION_COMPACT_BREAKPOINT;
12473
13321
  exports.Pagination = Pagination;
12474
13322
  exports.Popover = Popover;
@@ -12477,6 +13325,15 @@ exports.Radio = Radio;
12477
13325
  exports.SegmentedControl = SegmentedControl;
12478
13326
  exports.Select = Select;
12479
13327
  exports.Separator = Separator;
13328
+ exports.Sheet = Sheet;
13329
+ exports.SheetBody = SheetBody;
13330
+ exports.SheetClose = SheetClose;
13331
+ exports.SheetDescription = SheetDescription;
13332
+ exports.SheetFooter = SheetFooter;
13333
+ exports.SheetHeader = SheetHeader;
13334
+ exports.SheetPanel = SheetPanel;
13335
+ exports.SheetTitle = SheetTitle;
13336
+ exports.SheetTrigger = SheetTrigger;
12480
13337
  exports.Skeleton = Skeleton;
12481
13338
  exports.Slider = Slider;
12482
13339
  exports.SliderGestureProvider = SliderGestureProvider;
@@ -12502,6 +13359,7 @@ exports.themeDark = themeDark;
12502
13359
  exports.toast = toast2;
12503
13360
  exports.useCalendarCaption = useCalendarCaption;
12504
13361
  exports.usePagination = usePagination;
13362
+ exports.usePopoverContext = usePopoverContext;
12505
13363
  exports.useSliderInteractionActive = useSliderInteractionActive;
12506
13364
  //# sourceMappingURL=index.cjs.map
12507
13365
  //# sourceMappingURL=index.cjs.map