@zuzjs/ui 1.0.11 → 1.0.13
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/bin.cjs +4 -4
- package/dist/bin.js +1 -1
- package/dist/css/styles.css +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +61 -11
- package/dist/index.d.ts +61 -11
- package/dist/index.js +6 -6
- package/package.json +3 -3
- /package/dist/{chunk-M5VICTQY.cjs → chunk-A43XDOVH.cjs} +0 -0
- /package/dist/{chunk-ZJ7KMXAM.js → chunk-XVGACJKW.js} +0 -0
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
|
|
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`> & {
|
|
@@ -596,34 +591,80 @@ type ColorSchemeProps = Omit<SegmentProps, `items`> & {
|
|
|
596
591
|
|
|
597
592
|
declare const ColorScheme$1: react.ForwardRefExoticComponent<Omit<ColorSchemeProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
598
593
|
|
|
594
|
+
/**
|
|
595
|
+
* Represents a single menu item in the context menu.
|
|
596
|
+
*/
|
|
599
597
|
interface ContextItem {
|
|
598
|
+
/** The display text for the menu item */
|
|
600
599
|
label: string;
|
|
600
|
+
/** Optional color for the label text */
|
|
601
601
|
labelColor?: string;
|
|
602
|
+
/** Optional icon identifier or class name */
|
|
602
603
|
icon?: string;
|
|
604
|
+
/** Optional color for the icon */
|
|
603
605
|
iconColor?: string;
|
|
606
|
+
/** Optional CSS class to apply to the menu item */
|
|
604
607
|
className?: string;
|
|
608
|
+
/** Whether the menu item is enabled and selectable */
|
|
605
609
|
enabled?: boolean;
|
|
606
|
-
|
|
610
|
+
/** Callback function invoked when the menu item is selected */
|
|
611
|
+
onSelect?: (item: ContextItem) => void;
|
|
607
612
|
}
|
|
613
|
+
/**
|
|
614
|
+
* Props for the ContextMenu component.
|
|
615
|
+
* Extends the BoxProps interface with context menu specific properties.
|
|
616
|
+
*/
|
|
608
617
|
type ContextMenuProps = BoxProps & {
|
|
618
|
+
/** Unique identifier for the context menu instance */
|
|
609
619
|
id?: number;
|
|
620
|
+
/** The mouse or touch event that triggered the context menu */
|
|
610
621
|
event?: MouseEvent$1<Element, MouseEvent> | TouchEvent;
|
|
622
|
+
/** Reference to the parent HTML element */
|
|
611
623
|
parent?: RefObject<HTMLElement | null>;
|
|
624
|
+
/** The origin point for positioning the context menu */
|
|
612
625
|
origin?: ValueOf<typeof ORIGIN>;
|
|
626
|
+
/** Array of menu items to display */
|
|
613
627
|
items?: ContextItem[];
|
|
628
|
+
/** Horizontal offset in pixels from the trigger point */
|
|
614
629
|
offsetX?: number;
|
|
630
|
+
/** Vertical offset in pixels from the trigger point */
|
|
615
631
|
offsetY?: number;
|
|
632
|
+
/** Optional header component or ReactNode to display at the top */
|
|
616
633
|
header?: ReactNode | FC;
|
|
634
|
+
/** Optional footer component or ReactNode to display at the bottom */
|
|
617
635
|
footer?: ReactNode | FC;
|
|
636
|
+
/** Conditional flag to control whether the context menu is displayed */
|
|
618
637
|
when?: boolean;
|
|
638
|
+
/** Arrow */
|
|
639
|
+
arrow?: boolean;
|
|
640
|
+
/** Callback invoked when the context menu is closed with its id */
|
|
619
641
|
onClose?: (id: number) => void;
|
|
620
642
|
};
|
|
643
|
+
/**
|
|
644
|
+
* Props for individual MenuItem components.
|
|
645
|
+
* Extends ContextItem with additional rendering properties.
|
|
646
|
+
*/
|
|
621
647
|
type MenuItemProps = ContextItem & {
|
|
648
|
+
/** Index position of the menu item in the menu list */
|
|
622
649
|
index: number;
|
|
650
|
+
/** CSS class name to apply to the menu item element */
|
|
623
651
|
className: string;
|
|
624
652
|
};
|
|
653
|
+
/**
|
|
654
|
+
* Handler interface for imperative control of the ContextMenu component.
|
|
655
|
+
* Used with useRef and forwardRef for programmatic visibility control.
|
|
656
|
+
*/
|
|
625
657
|
interface ContextMenuHandler {
|
|
658
|
+
/**
|
|
659
|
+
* Display the context menu at the position of the provided event.
|
|
660
|
+
* @param e - The mouse or touch event that triggered the menu
|
|
661
|
+
* @param items - Optional array of menu items to display
|
|
662
|
+
*/
|
|
626
663
|
show: (e: MouseEvent$1<Element, MouseEvent> | TouchEvent, items?: ContextItem[]) => void;
|
|
664
|
+
/**
|
|
665
|
+
* Hide/close the context menu.
|
|
666
|
+
* @param e - The mouse or touch event that triggered the close action
|
|
667
|
+
*/
|
|
627
668
|
hide: (e: MouseEvent$1 | TouchEvent) => void;
|
|
628
669
|
}
|
|
629
670
|
|
|
@@ -1701,9 +1742,7 @@ interface ThemeConfig {
|
|
|
1701
1742
|
/**
|
|
1702
1743
|
* App Level Spinner Conf
|
|
1703
1744
|
*/
|
|
1704
|
-
spinner?:
|
|
1705
|
-
type?: ValueOf<typeof SPINNER>;
|
|
1706
|
-
};
|
|
1745
|
+
spinner?: SpinnerProps;
|
|
1707
1746
|
toast?: {
|
|
1708
1747
|
curve?: ValueOf<typeof TRANSITION_CURVES>;
|
|
1709
1748
|
duration?: number;
|
|
@@ -1781,7 +1820,18 @@ declare const useMorph: (sourceRef: RefObject<HTMLElement | null>, active: boole
|
|
|
1781
1820
|
|
|
1782
1821
|
declare const useContextMenu: () => {
|
|
1783
1822
|
showContextMenu: (e: MouseEvent$1<Element, MouseEvent> | TouchEvent, items: ContextItem[], origin?: ValueOf<typeof ORIGIN>) => void;
|
|
1784
|
-
showMenu: (ref: RefObject<HTMLElement | null>, items
|
|
1823
|
+
showMenu: (ref: RefObject<HTMLElement | null>, { items, origin, offsetX, offsetY, transition, curve, arrow, duration, header, footer }: {
|
|
1824
|
+
transition?: ValueOf<typeof TRANSITIONS>;
|
|
1825
|
+
curve?: ValueOf<typeof TRANSITION_CURVES>;
|
|
1826
|
+
arrow?: boolean;
|
|
1827
|
+
duration?: number;
|
|
1828
|
+
offsetX?: number;
|
|
1829
|
+
offsetY?: number;
|
|
1830
|
+
items: ContextItem[];
|
|
1831
|
+
origin?: ValueOf<typeof ORIGIN>;
|
|
1832
|
+
header?: ReactNode | FC;
|
|
1833
|
+
footer?: ReactNode | FC;
|
|
1834
|
+
}) => void;
|
|
1785
1835
|
hide: () => void;
|
|
1786
1836
|
};
|
|
1787
1837
|
|
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
|
|
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`> & {
|
|
@@ -596,34 +591,80 @@ type ColorSchemeProps = Omit<SegmentProps, `items`> & {
|
|
|
596
591
|
|
|
597
592
|
declare const ColorScheme$1: react.ForwardRefExoticComponent<Omit<ColorSchemeProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
598
593
|
|
|
594
|
+
/**
|
|
595
|
+
* Represents a single menu item in the context menu.
|
|
596
|
+
*/
|
|
599
597
|
interface ContextItem {
|
|
598
|
+
/** The display text for the menu item */
|
|
600
599
|
label: string;
|
|
600
|
+
/** Optional color for the label text */
|
|
601
601
|
labelColor?: string;
|
|
602
|
+
/** Optional icon identifier or class name */
|
|
602
603
|
icon?: string;
|
|
604
|
+
/** Optional color for the icon */
|
|
603
605
|
iconColor?: string;
|
|
606
|
+
/** Optional CSS class to apply to the menu item */
|
|
604
607
|
className?: string;
|
|
608
|
+
/** Whether the menu item is enabled and selectable */
|
|
605
609
|
enabled?: boolean;
|
|
606
|
-
|
|
610
|
+
/** Callback function invoked when the menu item is selected */
|
|
611
|
+
onSelect?: (item: ContextItem) => void;
|
|
607
612
|
}
|
|
613
|
+
/**
|
|
614
|
+
* Props for the ContextMenu component.
|
|
615
|
+
* Extends the BoxProps interface with context menu specific properties.
|
|
616
|
+
*/
|
|
608
617
|
type ContextMenuProps = BoxProps & {
|
|
618
|
+
/** Unique identifier for the context menu instance */
|
|
609
619
|
id?: number;
|
|
620
|
+
/** The mouse or touch event that triggered the context menu */
|
|
610
621
|
event?: MouseEvent$1<Element, MouseEvent> | TouchEvent;
|
|
622
|
+
/** Reference to the parent HTML element */
|
|
611
623
|
parent?: RefObject<HTMLElement | null>;
|
|
624
|
+
/** The origin point for positioning the context menu */
|
|
612
625
|
origin?: ValueOf<typeof ORIGIN>;
|
|
626
|
+
/** Array of menu items to display */
|
|
613
627
|
items?: ContextItem[];
|
|
628
|
+
/** Horizontal offset in pixels from the trigger point */
|
|
614
629
|
offsetX?: number;
|
|
630
|
+
/** Vertical offset in pixels from the trigger point */
|
|
615
631
|
offsetY?: number;
|
|
632
|
+
/** Optional header component or ReactNode to display at the top */
|
|
616
633
|
header?: ReactNode | FC;
|
|
634
|
+
/** Optional footer component or ReactNode to display at the bottom */
|
|
617
635
|
footer?: ReactNode | FC;
|
|
636
|
+
/** Conditional flag to control whether the context menu is displayed */
|
|
618
637
|
when?: boolean;
|
|
638
|
+
/** Arrow */
|
|
639
|
+
arrow?: boolean;
|
|
640
|
+
/** Callback invoked when the context menu is closed with its id */
|
|
619
641
|
onClose?: (id: number) => void;
|
|
620
642
|
};
|
|
643
|
+
/**
|
|
644
|
+
* Props for individual MenuItem components.
|
|
645
|
+
* Extends ContextItem with additional rendering properties.
|
|
646
|
+
*/
|
|
621
647
|
type MenuItemProps = ContextItem & {
|
|
648
|
+
/** Index position of the menu item in the menu list */
|
|
622
649
|
index: number;
|
|
650
|
+
/** CSS class name to apply to the menu item element */
|
|
623
651
|
className: string;
|
|
624
652
|
};
|
|
653
|
+
/**
|
|
654
|
+
* Handler interface for imperative control of the ContextMenu component.
|
|
655
|
+
* Used with useRef and forwardRef for programmatic visibility control.
|
|
656
|
+
*/
|
|
625
657
|
interface ContextMenuHandler {
|
|
658
|
+
/**
|
|
659
|
+
* Display the context menu at the position of the provided event.
|
|
660
|
+
* @param e - The mouse or touch event that triggered the menu
|
|
661
|
+
* @param items - Optional array of menu items to display
|
|
662
|
+
*/
|
|
626
663
|
show: (e: MouseEvent$1<Element, MouseEvent> | TouchEvent, items?: ContextItem[]) => void;
|
|
664
|
+
/**
|
|
665
|
+
* Hide/close the context menu.
|
|
666
|
+
* @param e - The mouse or touch event that triggered the close action
|
|
667
|
+
*/
|
|
627
668
|
hide: (e: MouseEvent$1 | TouchEvent) => void;
|
|
628
669
|
}
|
|
629
670
|
|
|
@@ -1701,9 +1742,7 @@ interface ThemeConfig {
|
|
|
1701
1742
|
/**
|
|
1702
1743
|
* App Level Spinner Conf
|
|
1703
1744
|
*/
|
|
1704
|
-
spinner?:
|
|
1705
|
-
type?: ValueOf<typeof SPINNER>;
|
|
1706
|
-
};
|
|
1745
|
+
spinner?: SpinnerProps;
|
|
1707
1746
|
toast?: {
|
|
1708
1747
|
curve?: ValueOf<typeof TRANSITION_CURVES>;
|
|
1709
1748
|
duration?: number;
|
|
@@ -1781,7 +1820,18 @@ declare const useMorph: (sourceRef: RefObject<HTMLElement | null>, active: boole
|
|
|
1781
1820
|
|
|
1782
1821
|
declare const useContextMenu: () => {
|
|
1783
1822
|
showContextMenu: (e: MouseEvent$1<Element, MouseEvent> | TouchEvent, items: ContextItem[], origin?: ValueOf<typeof ORIGIN>) => void;
|
|
1784
|
-
showMenu: (ref: RefObject<HTMLElement | null>, items
|
|
1823
|
+
showMenu: (ref: RefObject<HTMLElement | null>, { items, origin, offsetX, offsetY, transition, curve, arrow, duration, header, footer }: {
|
|
1824
|
+
transition?: ValueOf<typeof TRANSITIONS>;
|
|
1825
|
+
curve?: ValueOf<typeof TRANSITION_CURVES>;
|
|
1826
|
+
arrow?: boolean;
|
|
1827
|
+
duration?: number;
|
|
1828
|
+
offsetX?: number;
|
|
1829
|
+
offsetY?: number;
|
|
1830
|
+
items: ContextItem[];
|
|
1831
|
+
origin?: ValueOf<typeof ORIGIN>;
|
|
1832
|
+
header?: ReactNode | FC;
|
|
1833
|
+
footer?: ReactNode | FC;
|
|
1834
|
+
}) => void;
|
|
1785
1835
|
hide: () => void;
|
|
1786
1836
|
};
|
|
1787
1837
|
|