@zuzjs/ui 1.0.12 → 1.0.14

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.d.cts CHANGED
@@ -428,12 +428,7 @@ declare const SPINNER: {
428
428
  };
429
429
  type SpinnerProps = BoxProps & {
430
430
  type?: ValueOf<typeof SPINNER>;
431
- variant?: ValueOf<typeof Variant> | number;
432
- width?: number;
433
- color?: string;
434
- background?: string;
435
- foreground?: string;
436
- speed?: number;
431
+ variant?: ValueOf<typeof Variant>;
437
432
  };
438
433
 
439
434
  type ButtonProps = Props<`button`> & {
@@ -445,6 +440,7 @@ type ButtonProps = Props<`button`> & {
445
440
  state?: ButtonState;
446
441
  variant?: ValueOf<typeof Variant>;
447
442
  reset?: boolean;
443
+ kind?: `solid` | `subtle` | `surface` | `outline` | `ghost` | `plain`;
448
444
  };
449
445
  interface ButtonHandler extends HTMLButtonElement {
450
446
  reset: () => void;
@@ -596,34 +592,80 @@ type ColorSchemeProps = Omit<SegmentProps, `items`> & {
596
592
 
597
593
  declare const ColorScheme$1: react.ForwardRefExoticComponent<Omit<ColorSchemeProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
598
594
 
595
+ /**
596
+ * Represents a single menu item in the context menu.
597
+ */
599
598
  interface ContextItem {
599
+ /** The display text for the menu item */
600
600
  label: string;
601
+ /** Optional color for the label text */
601
602
  labelColor?: string;
603
+ /** Optional icon identifier or class name */
602
604
  icon?: string;
605
+ /** Optional color for the icon */
603
606
  iconColor?: string;
607
+ /** Optional CSS class to apply to the menu item */
604
608
  className?: string;
609
+ /** Whether the menu item is enabled and selectable */
605
610
  enabled?: boolean;
606
- onSelect: () => void;
611
+ /** Callback function invoked when the menu item is selected */
612
+ onSelect?: (item: ContextItem) => void;
607
613
  }
614
+ /**
615
+ * Props for the ContextMenu component.
616
+ * Extends the BoxProps interface with context menu specific properties.
617
+ */
608
618
  type ContextMenuProps = BoxProps & {
619
+ /** Unique identifier for the context menu instance */
609
620
  id?: number;
621
+ /** The mouse or touch event that triggered the context menu */
610
622
  event?: MouseEvent$1<Element, MouseEvent> | TouchEvent;
623
+ /** Reference to the parent HTML element */
611
624
  parent?: RefObject<HTMLElement | null>;
625
+ /** The origin point for positioning the context menu */
612
626
  origin?: ValueOf<typeof ORIGIN>;
627
+ /** Array of menu items to display */
613
628
  items?: ContextItem[];
629
+ /** Horizontal offset in pixels from the trigger point */
614
630
  offsetX?: number;
631
+ /** Vertical offset in pixels from the trigger point */
615
632
  offsetY?: number;
633
+ /** Optional header component or ReactNode to display at the top */
616
634
  header?: ReactNode | FC;
635
+ /** Optional footer component or ReactNode to display at the bottom */
617
636
  footer?: ReactNode | FC;
637
+ /** Conditional flag to control whether the context menu is displayed */
618
638
  when?: boolean;
639
+ /** Arrow */
640
+ arrow?: boolean;
641
+ /** Callback invoked when the context menu is closed with its id */
619
642
  onClose?: (id: number) => void;
620
643
  };
644
+ /**
645
+ * Props for individual MenuItem components.
646
+ * Extends ContextItem with additional rendering properties.
647
+ */
621
648
  type MenuItemProps = ContextItem & {
649
+ /** Index position of the menu item in the menu list */
622
650
  index: number;
651
+ /** CSS class name to apply to the menu item element */
623
652
  className: string;
624
653
  };
654
+ /**
655
+ * Handler interface for imperative control of the ContextMenu component.
656
+ * Used with useRef and forwardRef for programmatic visibility control.
657
+ */
625
658
  interface ContextMenuHandler {
659
+ /**
660
+ * Display the context menu at the position of the provided event.
661
+ * @param e - The mouse or touch event that triggered the menu
662
+ * @param items - Optional array of menu items to display
663
+ */
626
664
  show: (e: MouseEvent$1<Element, MouseEvent> | TouchEvent, items?: ContextItem[]) => void;
665
+ /**
666
+ * Hide/close the context menu.
667
+ * @param e - The mouse or touch event that triggered the close action
668
+ */
627
669
  hide: (e: MouseEvent$1 | TouchEvent) => void;
628
670
  }
629
671
 
@@ -854,7 +896,7 @@ declare const Sheet: react.ForwardRefExoticComponent<ZuzProps & {
854
896
  onHide?: () => void;
855
897
  } & react.RefAttributes<SheetHandler>>;
856
898
 
857
- type FormProps = BoxProps & {
899
+ type FormProps = Omit<BoxProps, `ref`> & {
858
900
  /** Name of form, will be appended to --form-{name} in className
859
901
  * whitespace will be replaced with dash (-)
860
902
  */
@@ -906,9 +948,15 @@ interface FormHandler {
906
948
  * @param props - Properties to configure form behavior, validation messages, submission handling, and visual feedback.
907
949
  * @param ref - Reference to the {@link FormHandler} interface, exposing methods to control loading and error states from the parent.
908
950
  */
909
- declare const Form: react.ForwardRefExoticComponent<Omit<FormProps, "ref"> & react.RefAttributes<FormHandler>>;
951
+ declare const Form: {
952
+ ({ ref, ...props }: FormProps & {
953
+ ref?: Ref<FormHandler>;
954
+ }): react_jsx_runtime.JSX.Element;
955
+ displayName: string;
956
+ };
910
957
 
911
958
  type GroupProps = BoxProps & {
959
+ when?: boolean;
912
960
  fxDelay?: number;
913
961
  fxStep?: number;
914
962
  classToIgnore?: string;
@@ -1701,9 +1749,7 @@ interface ThemeConfig {
1701
1749
  /**
1702
1750
  * App Level Spinner Conf
1703
1751
  */
1704
- spinner?: {
1705
- type?: ValueOf<typeof SPINNER>;
1706
- };
1752
+ spinner?: SpinnerProps;
1707
1753
  toast?: {
1708
1754
  curve?: ValueOf<typeof TRANSITION_CURVES>;
1709
1755
  duration?: number;
@@ -1781,7 +1827,18 @@ declare const useMorph: (sourceRef: RefObject<HTMLElement | null>, active: boole
1781
1827
 
1782
1828
  declare const useContextMenu: () => {
1783
1829
  showContextMenu: (e: MouseEvent$1<Element, MouseEvent> | TouchEvent, items: ContextItem[], origin?: ValueOf<typeof ORIGIN>) => void;
1784
- showMenu: (ref: RefObject<HTMLElement | null>, items: ContextItem[], origin?: ValueOf<typeof ORIGIN>) => void;
1830
+ showMenu: (ref: RefObject<HTMLElement | null>, { items, origin, offsetX, offsetY, transition, curve, arrow, duration, header, footer }: {
1831
+ transition?: ValueOf<typeof TRANSITIONS>;
1832
+ curve?: ValueOf<typeof TRANSITION_CURVES>;
1833
+ arrow?: boolean;
1834
+ duration?: number;
1835
+ offsetX?: number;
1836
+ offsetY?: number;
1837
+ items: ContextItem[];
1838
+ origin?: ValueOf<typeof ORIGIN>;
1839
+ header?: ReactNode | FC;
1840
+ footer?: ReactNode | FC;
1841
+ }) => void;
1785
1842
  hide: () => void;
1786
1843
  };
1787
1844
 
package/dist/index.d.ts CHANGED
@@ -428,12 +428,7 @@ declare const SPINNER: {
428
428
  };
429
429
  type SpinnerProps = BoxProps & {
430
430
  type?: ValueOf<typeof SPINNER>;
431
- variant?: ValueOf<typeof Variant> | number;
432
- width?: number;
433
- color?: string;
434
- background?: string;
435
- foreground?: string;
436
- speed?: number;
431
+ variant?: ValueOf<typeof Variant>;
437
432
  };
438
433
 
439
434
  type ButtonProps = Props<`button`> & {
@@ -445,6 +440,7 @@ type ButtonProps = Props<`button`> & {
445
440
  state?: ButtonState;
446
441
  variant?: ValueOf<typeof Variant>;
447
442
  reset?: boolean;
443
+ kind?: `solid` | `subtle` | `surface` | `outline` | `ghost` | `plain`;
448
444
  };
449
445
  interface ButtonHandler extends HTMLButtonElement {
450
446
  reset: () => void;
@@ -596,34 +592,80 @@ type ColorSchemeProps = Omit<SegmentProps, `items`> & {
596
592
 
597
593
  declare const ColorScheme$1: react.ForwardRefExoticComponent<Omit<ColorSchemeProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
598
594
 
595
+ /**
596
+ * Represents a single menu item in the context menu.
597
+ */
599
598
  interface ContextItem {
599
+ /** The display text for the menu item */
600
600
  label: string;
601
+ /** Optional color for the label text */
601
602
  labelColor?: string;
603
+ /** Optional icon identifier or class name */
602
604
  icon?: string;
605
+ /** Optional color for the icon */
603
606
  iconColor?: string;
607
+ /** Optional CSS class to apply to the menu item */
604
608
  className?: string;
609
+ /** Whether the menu item is enabled and selectable */
605
610
  enabled?: boolean;
606
- onSelect: () => void;
611
+ /** Callback function invoked when the menu item is selected */
612
+ onSelect?: (item: ContextItem) => void;
607
613
  }
614
+ /**
615
+ * Props for the ContextMenu component.
616
+ * Extends the BoxProps interface with context menu specific properties.
617
+ */
608
618
  type ContextMenuProps = BoxProps & {
619
+ /** Unique identifier for the context menu instance */
609
620
  id?: number;
621
+ /** The mouse or touch event that triggered the context menu */
610
622
  event?: MouseEvent$1<Element, MouseEvent> | TouchEvent;
623
+ /** Reference to the parent HTML element */
611
624
  parent?: RefObject<HTMLElement | null>;
625
+ /** The origin point for positioning the context menu */
612
626
  origin?: ValueOf<typeof ORIGIN>;
627
+ /** Array of menu items to display */
613
628
  items?: ContextItem[];
629
+ /** Horizontal offset in pixels from the trigger point */
614
630
  offsetX?: number;
631
+ /** Vertical offset in pixels from the trigger point */
615
632
  offsetY?: number;
633
+ /** Optional header component or ReactNode to display at the top */
616
634
  header?: ReactNode | FC;
635
+ /** Optional footer component or ReactNode to display at the bottom */
617
636
  footer?: ReactNode | FC;
637
+ /** Conditional flag to control whether the context menu is displayed */
618
638
  when?: boolean;
639
+ /** Arrow */
640
+ arrow?: boolean;
641
+ /** Callback invoked when the context menu is closed with its id */
619
642
  onClose?: (id: number) => void;
620
643
  };
644
+ /**
645
+ * Props for individual MenuItem components.
646
+ * Extends ContextItem with additional rendering properties.
647
+ */
621
648
  type MenuItemProps = ContextItem & {
649
+ /** Index position of the menu item in the menu list */
622
650
  index: number;
651
+ /** CSS class name to apply to the menu item element */
623
652
  className: string;
624
653
  };
654
+ /**
655
+ * Handler interface for imperative control of the ContextMenu component.
656
+ * Used with useRef and forwardRef for programmatic visibility control.
657
+ */
625
658
  interface ContextMenuHandler {
659
+ /**
660
+ * Display the context menu at the position of the provided event.
661
+ * @param e - The mouse or touch event that triggered the menu
662
+ * @param items - Optional array of menu items to display
663
+ */
626
664
  show: (e: MouseEvent$1<Element, MouseEvent> | TouchEvent, items?: ContextItem[]) => void;
665
+ /**
666
+ * Hide/close the context menu.
667
+ * @param e - The mouse or touch event that triggered the close action
668
+ */
627
669
  hide: (e: MouseEvent$1 | TouchEvent) => void;
628
670
  }
629
671
 
@@ -854,7 +896,7 @@ declare const Sheet: react.ForwardRefExoticComponent<ZuzProps & {
854
896
  onHide?: () => void;
855
897
  } & react.RefAttributes<SheetHandler>>;
856
898
 
857
- type FormProps = BoxProps & {
899
+ type FormProps = Omit<BoxProps, `ref`> & {
858
900
  /** Name of form, will be appended to --form-{name} in className
859
901
  * whitespace will be replaced with dash (-)
860
902
  */
@@ -906,9 +948,15 @@ interface FormHandler {
906
948
  * @param props - Properties to configure form behavior, validation messages, submission handling, and visual feedback.
907
949
  * @param ref - Reference to the {@link FormHandler} interface, exposing methods to control loading and error states from the parent.
908
950
  */
909
- declare const Form: react.ForwardRefExoticComponent<Omit<FormProps, "ref"> & react.RefAttributes<FormHandler>>;
951
+ declare const Form: {
952
+ ({ ref, ...props }: FormProps & {
953
+ ref?: Ref<FormHandler>;
954
+ }): react_jsx_runtime.JSX.Element;
955
+ displayName: string;
956
+ };
910
957
 
911
958
  type GroupProps = BoxProps & {
959
+ when?: boolean;
912
960
  fxDelay?: number;
913
961
  fxStep?: number;
914
962
  classToIgnore?: string;
@@ -1701,9 +1749,7 @@ interface ThemeConfig {
1701
1749
  /**
1702
1750
  * App Level Spinner Conf
1703
1751
  */
1704
- spinner?: {
1705
- type?: ValueOf<typeof SPINNER>;
1706
- };
1752
+ spinner?: SpinnerProps;
1707
1753
  toast?: {
1708
1754
  curve?: ValueOf<typeof TRANSITION_CURVES>;
1709
1755
  duration?: number;
@@ -1781,7 +1827,18 @@ declare const useMorph: (sourceRef: RefObject<HTMLElement | null>, active: boole
1781
1827
 
1782
1828
  declare const useContextMenu: () => {
1783
1829
  showContextMenu: (e: MouseEvent$1<Element, MouseEvent> | TouchEvent, items: ContextItem[], origin?: ValueOf<typeof ORIGIN>) => void;
1784
- showMenu: (ref: RefObject<HTMLElement | null>, items: ContextItem[], origin?: ValueOf<typeof ORIGIN>) => void;
1830
+ showMenu: (ref: RefObject<HTMLElement | null>, { items, origin, offsetX, offsetY, transition, curve, arrow, duration, header, footer }: {
1831
+ transition?: ValueOf<typeof TRANSITIONS>;
1832
+ curve?: ValueOf<typeof TRANSITION_CURVES>;
1833
+ arrow?: boolean;
1834
+ duration?: number;
1835
+ offsetX?: number;
1836
+ offsetY?: number;
1837
+ items: ContextItem[];
1838
+ origin?: ValueOf<typeof ORIGIN>;
1839
+ header?: ReactNode | FC;
1840
+ footer?: ReactNode | FC;
1841
+ }) => void;
1785
1842
  hide: () => void;
1786
1843
  };
1787
1844