@gusarov-studio/rubik-ui 25.0.0 → 25.2.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.
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import "./RadioButton.scss";
3
+ type RadioButtonSize = 12 | 14 | 16 | 18 | 20;
4
+ interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> {
5
+ size?: RadioButtonSize | `${RadioButtonSize}`;
6
+ }
7
+ declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<HTMLInputElement>>;
8
+ export { RadioButton, type RadioButtonProps };
@@ -0,0 +1 @@
1
+ export * from "./RadioButton";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { Action } from "@radix-ui/react-toast";
3
+ interface ToastActionProps extends React.ComponentPropsWithoutRef<typeof Action> {
4
+ appearance?: "link";
5
+ }
6
+ declare const ToastAction: React.ForwardRefExoticComponent<ToastActionProps & React.RefAttributes<HTMLButtonElement>>;
7
+ export { ToastAction, type ToastActionProps };
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { Close } from "@radix-ui/react-toast";
3
+ interface ToastCloseProps extends React.ComponentPropsWithoutRef<typeof Close> {
4
+ appearance?: "solid" | "subtle" | "soft";
5
+ variant?: "accent" | "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "black";
6
+ }
7
+ declare const ToastClose: React.ForwardRefExoticComponent<ToastCloseProps & React.RefAttributes<HTMLButtonElement>>;
8
+ export { ToastClose, type ToastCloseProps };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ type ToastIconProps = React.HTMLAttributes<HTMLDivElement>;
3
+ declare const ToastIcon: React.ForwardRefExoticComponent<ToastIconProps & React.RefAttributes<HTMLDivElement>>;
4
+ export { ToastIcon, type ToastIconProps };
@@ -0,0 +1,6 @@
1
+ import React, { type FC } from "react";
2
+ import { Provider } from "@radix-ui/react-toast";
3
+ import "./Toast.scss";
4
+ type ToastProviderProps = React.ComponentProps<typeof Provider>;
5
+ declare const ToastProvider: FC<ToastProviderProps>;
6
+ export { ToastProvider, type ToastProviderProps };
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { Root } from "@radix-ui/react-toast";
3
+ import "./Toast.scss";
4
+ interface ToastRootProps extends React.ComponentProps<typeof Root> {
5
+ appearance?: "solid" | "subtle" | "soft";
6
+ variant?: "accent" | "primary" | "secondary" | "success" | "danger" | "warning" | "white" | "black";
7
+ closable?: boolean;
8
+ }
9
+ declare const ToastRoot: React.FC<ToastRootProps>;
10
+ export { ToastRoot, type ToastRootProps };
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { Title } from "@radix-ui/react-toast";
3
+ type ToastTitleProps = React.ComponentPropsWithoutRef<typeof Title>;
4
+ declare const ToastTitle: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-toast").ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ export { ToastTitle, type ToastTitleProps };
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { Viewport } from "@radix-ui/react-toast";
3
+ import "./Toast.scss";
4
+ interface ToastViewportProps extends React.ComponentProps<typeof Viewport> {
5
+ side?: "top" | "right" | "bottom" | "left";
6
+ sideOffset?: number;
7
+ align?: "start" | "center" | "end";
8
+ alignOffset?: number;
9
+ zIndex?: number | `${number}`;
10
+ }
11
+ declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastViewportProps, "ref"> & React.RefAttributes<HTMLOListElement>>;
12
+ export { ToastViewport, type ToastViewportProps };
@@ -0,0 +1,11 @@
1
+ import React, { type FC } from "react";
2
+ import { Provider } from "@radix-ui/react-toast";
3
+ import type { ToastRoot } from "./ToastRoot";
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>;
10
+ export declare const ToastsManagerProvider: FC<ToastProviderProps>;
11
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const actionTypes: {
2
+ readonly REGISTER_TOAST: "RUBIK_UI/REGISTER_TOAST";
3
+ readonly UNREGISTER_TOAST: "RUBIK_UI/UNREGISTER_TOAST";
4
+ readonly ADD_TOAST: "RUBIK_UI/ADD_TOAST";
5
+ readonly HIDE_TOAST: "RUBIK_UI/HIDE_TOAST";
6
+ };
@@ -0,0 +1,2 @@
1
+ declare const ToastsManagerContext: import("react").Context<import("./types").ToastsManagerState | null>;
2
+ export { ToastsManagerContext };
@@ -0,0 +1,6 @@
1
+ import type React from "react";
2
+ import type { ToastsAction } from "./types";
3
+ type Dispatcher = React.Dispatch<ToastsAction>;
4
+ declare function registerDispatcher(dispatch: Dispatcher): void;
5
+ declare function dispatch(action: ToastsAction): void;
6
+ export { registerDispatcher, dispatch };
@@ -0,0 +1,3 @@
1
+ import type { ToastsManager } from "../types";
2
+ declare const useToasts: () => ToastsManager;
3
+ export { useToasts };
@@ -0,0 +1,5 @@
1
+ import type React from "react";
2
+ import type { ToastsAction, ToastsManagerState } from "../types";
3
+ declare const reducer: (state: ToastsManagerState, action: ToastsAction) => ToastsManagerState;
4
+ declare function useToastsState(): [ToastsManagerState, React.Dispatch<ToastsAction>];
5
+ export { useToastsState, reducer };
@@ -0,0 +1,16 @@
1
+ import { type ToastProviderProps } from "./ToastProvider";
2
+ import { type ToastRootProps } from "./ToastRoot";
3
+ import { type ToastViewportProps } from "./ToastViewport";
4
+ import { type ToastIconProps } from "./ToastIcon";
5
+ import { type ToastTitleProps } from "./ToastTitle";
6
+ import { type ToastActionProps } from "./ToastAction";
7
+ import { ToastsManagerProvider } from "./ToastsManagerProvider";
8
+ declare const Toast: {
9
+ Provider: import("react").FC<import("@radix-ui/react-toast").ToastProviderProps>;
10
+ Root: import("react").FC<ToastRootProps>;
11
+ Viewport: import("react").ForwardRefExoticComponent<Omit<ToastViewportProps, "ref"> & import("react").RefAttributes<HTMLOListElement>>;
12
+ Icon: import("react").ForwardRefExoticComponent<ToastIconProps & import("react").RefAttributes<HTMLDivElement>>;
13
+ Title: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-toast").ToastTitleProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
14
+ Action: import("react").ForwardRefExoticComponent<ToastActionProps & import("react").RefAttributes<HTMLButtonElement>>;
15
+ };
16
+ export { Toast, ToastsManagerProvider, type ToastProviderProps, type ToastRootProps, type ToastViewportProps, type ToastIconProps, type ToastTitleProps, type ToastActionProps, };
@@ -0,0 +1,8 @@
1
+ import type { ToastComponent } from "./types";
2
+ import type { ToastRootProps } from "./ToastRoot";
3
+ declare const toastsManager: {
4
+ register(toastId: string, toast: ToastComponent): void;
5
+ unregister(toastId: string): void;
6
+ add(toastId: string, props: ToastRootProps): void;
7
+ };
8
+ export { toastsManager };
@@ -0,0 +1,37 @@
1
+ import type React from "react";
2
+ import type { actionTypes } from "./constants/actionTypes";
3
+ import type { ToastRootProps } from "./ToastRoot";
4
+ export type ToastComponent = React.ReactElement<ToastRootProps>;
5
+ export interface ToastsManagerState {
6
+ registeredToasts: Record<string, ToastComponent>;
7
+ activeToasts: Record<string, ToastComponent>;
8
+ }
9
+ export interface ToastsManager {
10
+ register: (toastId: string, toast: ToastComponent) => void;
11
+ unregister: (toastId: string) => void;
12
+ add: (toastId: string, props: ToastRootProps) => void;
13
+ }
14
+ export type ToastsContextState = ToastsManagerState;
15
+ 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
+ type: typeof actionTypes.ADD_TOAST;
28
+ payload: {
29
+ toastId: string;
30
+ props?: ToastRootProps;
31
+ };
32
+ } | {
33
+ type: typeof actionTypes.HIDE_TOAST;
34
+ payload: {
35
+ activeToastId: string;
36
+ };
37
+ };
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from "./InputText";
18
18
  export * from "./LoadingIndicator";
19
19
  export * from "./ModalsManager";
20
20
  export * from "./Popover";
21
+ export * from "./RadioButton";
21
22
  export * from "./Resizable";
22
23
  export * from "./Skeleton";
23
24
  export * from "./Stack";