@gusarov-studio/rubik-ui 3.9.1 → 3.11.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/ModalsManager/ModalDef.d.ts +9 -0
- package/dist/ModalsManager/ModalsManagerProvider.d.ts +7 -0
- package/dist/ModalsManager/ModalsView.d.ts +3 -0
- package/dist/ModalsManager/constants/actionTypes.d.ts +4 -0
- package/dist/ModalsManager/context.d.ts +2 -0
- package/dist/ModalsManager/dispatcher.d.ts +6 -0
- package/dist/ModalsManager/hooks/useModals.d.ts +3 -0
- package/dist/ModalsManager/hooks/useModalsContext.d.ts +2 -0
- package/dist/ModalsManager/hooks/useModalsState.d.ts +5 -0
- package/dist/ModalsManager/index.d.ts +6 -0
- package/dist/ModalsManager/modalsManager.d.ts +8 -0
- package/dist/ModalsManager/modalsRegistry.d.ts +13 -0
- package/dist/ModalsManager/types.d.ts +25 -0
- package/dist/Tooltip/Tooltip.d.ts +17 -0
- package/dist/Tooltip/TooltipContent.d.ts +4 -0
- package/dist/Tooltip/TooltipContext.d.ts +54 -0
- package/dist/Tooltip/TooltipTrigger.d.ts +7 -0
- package/dist/Tooltip/hooks/useTooltip.d.ts +52 -0
- package/dist/Tooltip/index.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.declarations.tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ModalProps } from "./types";
|
|
3
|
+
interface ModalDefProps {
|
|
4
|
+
modalId: string;
|
|
5
|
+
component: React.ComponentType<any>;
|
|
6
|
+
defaultProps?: ModalProps;
|
|
7
|
+
}
|
|
8
|
+
declare function ModalDef(props: ModalDefProps): null;
|
|
9
|
+
export { ModalDef };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ModalsAction } from "./types";
|
|
3
|
+
type Dispatcher = React.Dispatch<ModalsAction>;
|
|
4
|
+
declare function registerDispatcher(dispatch: Dispatcher): void;
|
|
5
|
+
declare function dispatch(action: ModalsAction): void;
|
|
6
|
+
export { registerDispatcher, dispatch };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ModalsAction, ModalsManagerState } from "../types";
|
|
3
|
+
declare const reducer: (state: ModalsManagerState | undefined, action: ModalsAction) => ModalsManagerState;
|
|
4
|
+
declare function useModalsState(): [ModalsManagerState, React.Dispatch<ModalsAction>];
|
|
5
|
+
export { useModalsState, reducer };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ModalsManagerProvider } from "./ModalsManagerProvider";
|
|
2
|
+
export { ModalsView } from "./ModalsView";
|
|
3
|
+
export { ModalDef } from "./ModalDef";
|
|
4
|
+
export { useModals } from "./hooks/useModals";
|
|
5
|
+
export { modalsManager } from "./modalsManager";
|
|
6
|
+
export { type ModalsManager } from "./types";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ModalProps } from "./types";
|
|
2
|
+
declare const modalsManager: {
|
|
3
|
+
open(modalId: string, props?: ModalProps): void;
|
|
4
|
+
close(): void;
|
|
5
|
+
register: (modalId: string, Component: React.ComponentType<unknown>, defaultProps?: ModalProps) => void;
|
|
6
|
+
unregister: (modalId: string) => boolean;
|
|
7
|
+
};
|
|
8
|
+
export { modalsManager };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ModalProps, RegistryItem } from "./types";
|
|
3
|
+
declare function register(modalId: string, Component: React.ComponentType<unknown>, defaultProps?: ModalProps): void;
|
|
4
|
+
declare function unregister(modalId: string): boolean;
|
|
5
|
+
declare function get(modalId: string): RegistryItem | undefined;
|
|
6
|
+
declare function has(modalId: string): boolean;
|
|
7
|
+
declare const modalsRegistry: {
|
|
8
|
+
register: typeof register;
|
|
9
|
+
unregister: typeof unregister;
|
|
10
|
+
has: typeof has;
|
|
11
|
+
get: typeof get;
|
|
12
|
+
};
|
|
13
|
+
export { modalsRegistry };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { actionTypes } from "./constants/actionTypes";
|
|
3
|
+
export type ModalProps = Record<string, unknown>;
|
|
4
|
+
export interface ModalsManagerState {
|
|
5
|
+
activeDialogId: string | null;
|
|
6
|
+
props: ModalProps;
|
|
7
|
+
}
|
|
8
|
+
export interface ModalsManager {
|
|
9
|
+
open: (dialogId: string, props?: ModalProps) => void;
|
|
10
|
+
close: () => void;
|
|
11
|
+
}
|
|
12
|
+
export type ModalsContextState = ModalsManagerState;
|
|
13
|
+
export interface RegistryItem {
|
|
14
|
+
Component: React.ComponentType<unknown>;
|
|
15
|
+
props?: ModalProps;
|
|
16
|
+
}
|
|
17
|
+
export type ModalsAction = {
|
|
18
|
+
type: typeof actionTypes.OPEN_MODAL;
|
|
19
|
+
payload: {
|
|
20
|
+
modalId: string;
|
|
21
|
+
props?: ModalProps;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
type: typeof actionTypes.CLOSE_MODAL;
|
|
25
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Placement } from "@floating-ui/react";
|
|
3
|
+
import type { CSSUnit } from "../types/CSSUnit";
|
|
4
|
+
type WidthValue = CSSUnit | "0" | `calc(${string})` | number | "auto";
|
|
5
|
+
interface TooltipPropsBase {
|
|
6
|
+
position?: Placement;
|
|
7
|
+
width?: WidthValue;
|
|
8
|
+
withArrow?: boolean;
|
|
9
|
+
initialOpen?: boolean;
|
|
10
|
+
open?: boolean;
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
interface TooltipProps extends TooltipPropsBase {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
17
|
+
export { Tooltip, type TooltipPropsBase, type TooltipProps };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { useTooltip } from "./hooks/useTooltip";
|
|
2
|
+
type ContextType = ReturnType<typeof useTooltip> | null;
|
|
3
|
+
declare const TooltipContext: import("react").Context<ContextType>;
|
|
4
|
+
declare const useTooltipContext: () => {
|
|
5
|
+
placement: import("@floating-ui/utils").Placement;
|
|
6
|
+
strategy: import("@floating-ui/utils").Strategy;
|
|
7
|
+
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
isPositioned: boolean;
|
|
11
|
+
update: () => void;
|
|
12
|
+
floatingStyles: React.CSSProperties;
|
|
13
|
+
refs: {
|
|
14
|
+
reference: import("react").MutableRefObject<import("@floating-ui/react-dom").ReferenceType | null>;
|
|
15
|
+
floating: React.MutableRefObject<HTMLElement | null>;
|
|
16
|
+
setReference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
|
|
17
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
18
|
+
} & import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
19
|
+
elements: {
|
|
20
|
+
reference: import("@floating-ui/react-dom").ReferenceType | null;
|
|
21
|
+
floating: HTMLElement | null;
|
|
22
|
+
} & import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
23
|
+
context: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
placement: import("@floating-ui/utils").Placement;
|
|
27
|
+
strategy: import("@floating-ui/utils").Strategy;
|
|
28
|
+
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
29
|
+
isPositioned: boolean;
|
|
30
|
+
update: () => void;
|
|
31
|
+
floatingStyles: React.CSSProperties;
|
|
32
|
+
open: boolean;
|
|
33
|
+
onOpenChange: (open: boolean, event?: Event, reason?: import("@floating-ui/react").OpenChangeReason) => void;
|
|
34
|
+
events: import("@floating-ui/react").FloatingEvents;
|
|
35
|
+
dataRef: React.MutableRefObject<import("@floating-ui/react").ContextData>;
|
|
36
|
+
nodeId: string | undefined;
|
|
37
|
+
floatingId: string | undefined;
|
|
38
|
+
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
39
|
+
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
40
|
+
};
|
|
41
|
+
getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
|
|
42
|
+
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
43
|
+
getItemProps: (userProps?: Omit<React.HTMLProps<HTMLElement>, "selected" | "active"> & {
|
|
44
|
+
active?: boolean;
|
|
45
|
+
selected?: boolean;
|
|
46
|
+
}) => Record<string, unknown>;
|
|
47
|
+
withArrow: boolean;
|
|
48
|
+
arrowRef: import("react").MutableRefObject<SVGSVGElement | null>;
|
|
49
|
+
centered: boolean;
|
|
50
|
+
width: (number | "0" | "auto" | import("../types/CSSUnit").CSSUnit | `calc(${string})`) | undefined;
|
|
51
|
+
open: boolean;
|
|
52
|
+
setOpen: (newOpen: boolean) => void;
|
|
53
|
+
};
|
|
54
|
+
export { TooltipContext, type ContextType, useTooltipContext };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface TooltipTriggerProps extends React.HTMLProps<HTMLElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<Omit<TooltipTriggerProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
7
|
+
export { TooltipTrigger };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { TooltipPropsBase } from "../Tooltip";
|
|
2
|
+
declare function useTooltip(props?: TooltipPropsBase): {
|
|
3
|
+
placement: import("@floating-ui/utils").Placement;
|
|
4
|
+
strategy: import("@floating-ui/utils").Strategy;
|
|
5
|
+
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
isPositioned: boolean;
|
|
9
|
+
update: () => void;
|
|
10
|
+
floatingStyles: React.CSSProperties;
|
|
11
|
+
refs: {
|
|
12
|
+
reference: import("react").MutableRefObject<import("@floating-ui/react-dom").ReferenceType | null>;
|
|
13
|
+
floating: React.MutableRefObject<HTMLElement | null>;
|
|
14
|
+
setReference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
|
|
15
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
16
|
+
} & import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
17
|
+
elements: {
|
|
18
|
+
reference: import("@floating-ui/react-dom").ReferenceType | null;
|
|
19
|
+
floating: HTMLElement | null;
|
|
20
|
+
} & import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
21
|
+
context: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
placement: import("@floating-ui/utils").Placement;
|
|
25
|
+
strategy: import("@floating-ui/utils").Strategy;
|
|
26
|
+
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
27
|
+
isPositioned: boolean;
|
|
28
|
+
update: () => void;
|
|
29
|
+
floatingStyles: React.CSSProperties;
|
|
30
|
+
open: boolean;
|
|
31
|
+
onOpenChange: (open: boolean, event?: Event, reason?: import("@floating-ui/react").OpenChangeReason) => void;
|
|
32
|
+
events: import("@floating-ui/react").FloatingEvents;
|
|
33
|
+
dataRef: React.MutableRefObject<import("@floating-ui/react").ContextData>;
|
|
34
|
+
nodeId: string | undefined;
|
|
35
|
+
floatingId: string | undefined;
|
|
36
|
+
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
37
|
+
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
38
|
+
};
|
|
39
|
+
getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
|
|
40
|
+
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
41
|
+
getItemProps: (userProps?: Omit<React.HTMLProps<HTMLElement>, "selected" | "active"> & {
|
|
42
|
+
active?: boolean;
|
|
43
|
+
selected?: boolean;
|
|
44
|
+
}) => Record<string, unknown>;
|
|
45
|
+
withArrow: boolean;
|
|
46
|
+
arrowRef: import("react").MutableRefObject<SVGSVGElement | null>;
|
|
47
|
+
centered: boolean;
|
|
48
|
+
width: (number | "0" | "auto" | import("../../types/CSSUnit").CSSUnit | `calc(${string})`) | undefined;
|
|
49
|
+
open: boolean;
|
|
50
|
+
setOpen: (newOpen: boolean) => void;
|
|
51
|
+
};
|
|
52
|
+
export { useTooltip };
|