@gusarov-studio/rubik-ui 26.1.0 → 27.0.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.
- package/dist/Toast/ToastDef.d.ts +8 -0
- package/dist/Toast/ToastRoot.d.ts +1 -1
- package/dist/Toast/ToastViewport.d.ts +1 -0
- package/dist/Toast/ToastsManagerProvider.d.ts +2 -8
- package/dist/Toast/ToastsManagerViewport.d.ts +5 -0
- package/dist/Toast/constants/actionTypes.d.ts +4 -4
- package/dist/Toast/context.d.ts +10 -1
- package/dist/Toast/index.d.ts +5 -2
- package/dist/Toast/toastsManager.d.ts +5 -5
- package/dist/Toast/toastsRegistry.d.ts +16 -0
- package/dist/Toast/types.d.ts +28 -23
- package/dist/Tooltip/hooks/useTooltip.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.declarations.tsbuildinfo +1 -1
- package/dist/utils/generateUniqueId.d.ts +2 -0
- package/dist/utils/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -6,5 +6,5 @@ interface ToastRootProps extends React.ComponentProps<typeof Root> {
|
|
|
6
6
|
variant?: "accent" | "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "black";
|
|
7
7
|
closable?: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare const ToastRoot: React.
|
|
9
|
+
declare const ToastRoot: React.ForwardRefExoticComponent<Omit<ToastRootProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
10
10
|
export { ToastRoot, type ToastRootProps };
|
|
@@ -7,6 +7,7 @@ interface ToastViewportProps extends React.ComponentProps<typeof Viewport> {
|
|
|
7
7
|
align?: "start" | "center" | "end";
|
|
8
8
|
alignOffset?: number;
|
|
9
9
|
zIndex?: number | `${number}`;
|
|
10
|
+
width?: React.CSSProperties["width"];
|
|
10
11
|
}
|
|
11
12
|
declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastViewportProps, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
12
13
|
export { ToastViewport, type ToastViewportProps };
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import React, { type FC } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
interface ToastContextImplType {
|
|
5
|
-
toastElementsMap: Map<string, React.ElementRef<typeof ToastRoot>>;
|
|
6
|
-
sortToasts: () => number[];
|
|
7
|
-
}
|
|
8
|
-
export declare const useToastContext: () => ToastContextImplType;
|
|
9
|
-
type ToastProviderProps = React.ComponentProps<typeof Provider>;
|
|
2
|
+
import { ToastProvider } from "./ToastProvider";
|
|
3
|
+
type ToastProviderProps = React.ComponentProps<typeof ToastProvider>;
|
|
10
4
|
export declare const ToastsManagerProvider: FC<ToastProviderProps>;
|
|
11
5
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ToastViewportProps } from "./ToastViewport";
|
|
3
|
+
type ToastsManagerViewportProps = Omit<ToastViewportProps, "side">;
|
|
4
|
+
declare const ToastsManagerViewport: React.ForwardRefExoticComponent<Omit<ToastViewportProps, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
5
|
+
export { ToastsManagerViewport, type ToastsManagerViewportProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const actionTypes: {
|
|
2
|
-
readonly REGISTER_TOAST: "
|
|
3
|
-
readonly UNREGISTER_TOAST: "
|
|
4
|
-
readonly ADD_TOAST: "
|
|
5
|
-
readonly
|
|
2
|
+
readonly REGISTER_TOAST: "RUBIK_UI_TOASTS/REGISTER_TOAST";
|
|
3
|
+
readonly UNREGISTER_TOAST: "RUBIK_UI_TOASTS/UNREGISTER_TOAST";
|
|
4
|
+
readonly ADD_TOAST: "RUBIK_UI_TOASTS/ADD_TOAST";
|
|
5
|
+
readonly HIDE: "RUBIK_UI_TOASTS/HIDE";
|
|
6
6
|
};
|
package/dist/Toast/context.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ToastsManagerState } from "./types";
|
|
3
|
+
import type { ToastRoot } from "./ToastRoot";
|
|
4
|
+
interface ToastsManagerContextState {
|
|
5
|
+
state: ToastsManagerState;
|
|
6
|
+
toastElementsMap: Map<string, React.ElementRef<typeof ToastRoot>>;
|
|
7
|
+
sortToasts: () => number[];
|
|
8
|
+
}
|
|
9
|
+
declare const ToastsManagerContext: React.Context<ToastsManagerContextState | null>;
|
|
10
|
+
export declare const useToastContext: () => ToastsManagerContextState;
|
|
2
11
|
export { ToastsManagerContext };
|
package/dist/Toast/index.d.ts
CHANGED
|
@@ -4,15 +4,18 @@ import { type ToastViewportProps } from "./ToastViewport";
|
|
|
4
4
|
import { type ToastIconProps } from "./ToastIcon";
|
|
5
5
|
import { type ToastTitleProps } from "./ToastTitle";
|
|
6
6
|
import { type ToastActionProps } from "./ToastAction";
|
|
7
|
+
import { ToastDef } from "./ToastDef";
|
|
7
8
|
import { ToastsManagerProvider } from "./ToastsManagerProvider";
|
|
9
|
+
import { ToastsManagerViewport, type ToastsManagerViewportProps } from "./ToastsManagerViewport";
|
|
8
10
|
import { toastsManager } from "./toastsManager";
|
|
9
11
|
import { type ToastsManager } from "./types";
|
|
12
|
+
import { useToasts } from "./hooks/useToasts";
|
|
10
13
|
declare const Toast: {
|
|
11
14
|
Provider: import("react").FC<import("@radix-ui/react-toast").ToastProviderProps>;
|
|
12
|
-
Root: import("react").
|
|
15
|
+
Root: import("react").ForwardRefExoticComponent<Omit<ToastRootProps, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
|
|
13
16
|
Viewport: import("react").ForwardRefExoticComponent<Omit<ToastViewportProps, "ref"> & import("react").RefAttributes<HTMLOListElement>>;
|
|
14
17
|
Icon: import("react").ForwardRefExoticComponent<ToastIconProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
18
|
Title: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-toast").ToastTitleProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
19
|
Action: import("react").ForwardRefExoticComponent<ToastActionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
17
20
|
};
|
|
18
|
-
export {
|
|
21
|
+
export { useToasts, toastsManager, ToastsManagerProvider, ToastsManagerViewport, ToastDef, Toast, type ToastProviderProps, type ToastRootProps, type ToastViewportProps, type ToastIconProps, type ToastTitleProps, type ToastActionProps, type ToastsManager, type ToastsManagerViewportProps, };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ToastRootProps } from "./ToastRoot";
|
|
1
|
+
import type { CustomToastProps } from "./types";
|
|
3
2
|
declare const toastsManager: {
|
|
4
|
-
register(
|
|
5
|
-
unregister(
|
|
6
|
-
add(
|
|
3
|
+
register: (toastType: string, Component: import("./types").CustomToast, defaultProps?: import("./types").ToastInitialProps) => void;
|
|
4
|
+
unregister: (toastType: string) => boolean;
|
|
5
|
+
add(toastType: string, props?: Partial<CustomToastProps>): string;
|
|
6
|
+
hide(toastId?: string): void;
|
|
7
7
|
};
|
|
8
8
|
export { toastsManager };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CustomToast, ToastInitialProps, ToastsManagerItemProps } from "./types";
|
|
3
|
+
declare function register(toastType: string, Component: CustomToast, defaultProps?: ToastInitialProps): void;
|
|
4
|
+
declare function unregister(toastType: string): boolean;
|
|
5
|
+
declare function get(toastType: string): {
|
|
6
|
+
Component: React.ComponentType<ToastsManagerItemProps>;
|
|
7
|
+
props?: ToastInitialProps;
|
|
8
|
+
} | undefined;
|
|
9
|
+
declare function has(toastType: string): boolean;
|
|
10
|
+
declare const toastsRegistry: {
|
|
11
|
+
register: typeof register;
|
|
12
|
+
unregister: typeof unregister;
|
|
13
|
+
has: typeof has;
|
|
14
|
+
get: typeof get;
|
|
15
|
+
};
|
|
16
|
+
export { toastsRegistry };
|
package/dist/Toast/types.d.ts
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
2
|
import type { actionTypes } from "./constants/actionTypes";
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type { generateUniqueId } from "../utils";
|
|
4
|
+
type ToastsMangerItemId = ReturnType<typeof generateUniqueId>;
|
|
5
|
+
export type CustomToastProps<T = any> = {
|
|
6
|
+
onOpenChange: (open: boolean) => void;
|
|
7
|
+
} & T;
|
|
8
|
+
export type CustomToast = React.ComponentType<CustomToastProps>;
|
|
9
|
+
export interface ToastsManagerItemProps {
|
|
10
|
+
id: ToastsMangerItemId;
|
|
11
|
+
onOpenChange: (open: boolean) => void;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export type ToastManagerComponent = React.ComponentType<ToastsManagerItemProps>;
|
|
15
|
+
export interface ToastInitialProps {
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
onOpenChange: never;
|
|
18
|
+
}
|
|
5
19
|
export interface ToastsManagerState {
|
|
6
|
-
|
|
7
|
-
|
|
20
|
+
activeToasts: Record<ToastsMangerItemId, {
|
|
21
|
+
Component: ToastManagerComponent;
|
|
22
|
+
props?: Partial<CustomToastProps>;
|
|
23
|
+
}>;
|
|
8
24
|
}
|
|
9
25
|
export interface ToastsManager {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
add: (toastId: string, props: ToastRootProps) => void;
|
|
26
|
+
add: (toastType: string, props?: Partial<CustomToastProps>) => ToastsMangerItemId;
|
|
27
|
+
hide: (toastId: string) => void;
|
|
13
28
|
}
|
|
14
|
-
export type ToastsContextState = ToastsManagerState;
|
|
15
29
|
export type ToastsAction = {
|
|
16
|
-
type: typeof actionTypes.REGISTER_TOAST;
|
|
17
|
-
payload: {
|
|
18
|
-
toastId: string;
|
|
19
|
-
toast: ToastComponent;
|
|
20
|
-
};
|
|
21
|
-
} | {
|
|
22
|
-
type: typeof actionTypes.UNREGISTER_TOAST;
|
|
23
|
-
payload: {
|
|
24
|
-
toastId: string;
|
|
25
|
-
};
|
|
26
|
-
} | {
|
|
27
30
|
type: typeof actionTypes.ADD_TOAST;
|
|
28
31
|
payload: {
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
toastType: string;
|
|
33
|
+
toastId: ToastsMangerItemId;
|
|
34
|
+
props?: Partial<CustomToastProps>;
|
|
31
35
|
};
|
|
32
36
|
} | {
|
|
33
|
-
type: typeof actionTypes.
|
|
37
|
+
type: typeof actionTypes.HIDE;
|
|
34
38
|
payload: {
|
|
35
|
-
activeToastId
|
|
39
|
+
activeToastId?: string;
|
|
36
40
|
};
|
|
37
41
|
};
|
|
42
|
+
export {};
|
|
@@ -42,7 +42,7 @@ declare const useTooltip: ({ size, position, withArrow, width, defaultOpen, open
|
|
|
42
42
|
active?: boolean;
|
|
43
43
|
selected?: boolean;
|
|
44
44
|
}) => Record<string, unknown>;
|
|
45
|
-
size: "24" | "32" | "36" | "44" | (24 |
|
|
45
|
+
size: "24" | "32" | "36" | "44" | (24 | 36 | 32 | 44);
|
|
46
46
|
withArrow: boolean;
|
|
47
47
|
arrowRef: import("react").MutableRefObject<SVGSVGElement | null>;
|
|
48
48
|
centered: boolean;
|