@gamecrafters/base-ui 0.0.30 → 0.0.32
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/build/components/badge/Badge.types.d.ts +1 -1
- package/build/components/index.d.ts +1 -1
- package/build/components/switch/Switch.d.ts +5 -0
- package/build/components/switch/Switch.types.d.ts +58 -0
- package/build/components/switch/SwitchContext.d.ts +10 -0
- package/build/components/switch/SwitchControl.d.ts +5 -0
- package/build/components/switch/SwitchHiddenInput.d.ts +5 -0
- package/build/components/switch/SwitchLabel.d.ts +5 -0
- package/build/components/switch/SwitchRootProvider.d.ts +6 -0
- package/build/components/switch/SwitchThumb.d.ts +5 -0
- package/build/components/switch/index.d.ts +32 -0
- package/build/components/switch/useSwitch.d.ts +2 -0
- package/build/main.cjs.js +2 -2
- package/build/main.esm.js +2 -2
- package/build/styles/main.css +1 -1
- package/package.json +2 -2
- package/build/components/toggle-switch/ToggleSwitch.d.ts +0 -21
- package/build/components/toggle-switch/ToggleSwitch.types.d.ts +0 -21
- package/build/components/toggle-switch/index.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import type { PolymorphicProps } from "../../utilities/polymorphic";
|
|
3
3
|
import type { ButtonVisual } from "../button";
|
|
4
|
-
export type BadgeVariant = "default" | "primary" | "accent" | "success" | "attention" | "severe" | "danger" | "done" | "sponsors";
|
|
4
|
+
export type BadgeVariant = "default" | "primary" | "accent" | "success" | "attention" | "severe" | "danger" | "done" | "sponsors" | "outline" | "invisible" | "link";
|
|
5
5
|
export type BadgeAppearance = "filled" | "dot";
|
|
6
6
|
export type BadgeSize = "small" | "medium" | "large";
|
|
7
7
|
export type BadgeProps<As extends React.ElementType = "span"> = PolymorphicProps<As, "span", {
|
|
@@ -109,6 +109,7 @@ export * from "./statistic-card";
|
|
|
109
109
|
export * from "./status";
|
|
110
110
|
export * from "./steps";
|
|
111
111
|
export * from "./swap";
|
|
112
|
+
export * from "./switch";
|
|
112
113
|
export * from "./table-of-contents";
|
|
113
114
|
export * from "./tabs";
|
|
114
115
|
export * from "./text";
|
|
@@ -117,7 +118,6 @@ export * from "./textarea";
|
|
|
117
118
|
export * from "./timeline";
|
|
118
119
|
export * from "./timer";
|
|
119
120
|
export * from "./toast";
|
|
120
|
-
export * from "./toggle-switch";
|
|
121
121
|
export * from "./token";
|
|
122
122
|
export * from "./tooltip";
|
|
123
123
|
export * from "./topic-tag";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const _default: (props: Omit<Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref">, "htmlFor" | keyof import("./Switch.types").UseSwitchProps> & import("./Switch.types").UseSwitchProps & {
|
|
3
|
+
className?: string;
|
|
4
|
+
} & React.RefAttributes<any>) => React.ReactNode;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export type SwitchIds = {
|
|
3
|
+
root?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
control?: string;
|
|
6
|
+
thumb?: string;
|
|
7
|
+
hiddenInput?: string;
|
|
8
|
+
};
|
|
9
|
+
export type UseSwitchProps = {
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
defaultChecked?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
invalid?: boolean;
|
|
16
|
+
name?: string;
|
|
17
|
+
value?: string | number;
|
|
18
|
+
form?: string;
|
|
19
|
+
id?: string;
|
|
20
|
+
ids?: SwitchIds;
|
|
21
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
22
|
+
};
|
|
23
|
+
export type UseSwitchReturn = {
|
|
24
|
+
checked: boolean;
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
readOnly: boolean;
|
|
27
|
+
required: boolean;
|
|
28
|
+
invalid: boolean;
|
|
29
|
+
name?: string;
|
|
30
|
+
value?: string | number;
|
|
31
|
+
form?: string;
|
|
32
|
+
ids: Required<SwitchIds>;
|
|
33
|
+
describedBy?: string;
|
|
34
|
+
setChecked: (checked: boolean) => void;
|
|
35
|
+
toggleChecked: () => void;
|
|
36
|
+
};
|
|
37
|
+
export type SwitchProps = Omit<React.ComponentPropsWithoutRef<"label">, keyof UseSwitchProps | "htmlFor"> & UseSwitchProps & {
|
|
38
|
+
className?: string;
|
|
39
|
+
};
|
|
40
|
+
export type SwitchRootProviderProps = Omit<React.ComponentPropsWithoutRef<"label">, "htmlFor" | "defaultChecked"> & {
|
|
41
|
+
value: UseSwitchReturn;
|
|
42
|
+
className?: string;
|
|
43
|
+
};
|
|
44
|
+
export type SwitchControlProps = React.ComponentPropsWithoutRef<"span"> & {
|
|
45
|
+
className?: string;
|
|
46
|
+
};
|
|
47
|
+
export type SwitchThumbProps = React.ComponentPropsWithoutRef<"span"> & {
|
|
48
|
+
className?: string;
|
|
49
|
+
};
|
|
50
|
+
export type SwitchLabelProps = React.ComponentPropsWithoutRef<"span"> & {
|
|
51
|
+
className?: string;
|
|
52
|
+
};
|
|
53
|
+
export type SwitchHiddenInputProps = Omit<React.ComponentPropsWithoutRef<"input">, "type" | "checked" | "defaultChecked"> & {
|
|
54
|
+
className?: string;
|
|
55
|
+
};
|
|
56
|
+
export type SwitchContextValue = Partial<UseSwitchReturn> & {
|
|
57
|
+
initialChecked?: boolean;
|
|
58
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SwitchContextValue } from "./Switch.types";
|
|
2
|
+
export declare const SwitchContext: import("react").Context<SwitchContextValue>;
|
|
3
|
+
export declare const useSwitchContext: () => SwitchContextValue;
|
|
4
|
+
export declare const getStateAttributes: ({ checked, disabled, readOnly, required, invalid, }: SwitchContextValue) => {
|
|
5
|
+
"data-state": string;
|
|
6
|
+
"data-disabled": true | undefined;
|
|
7
|
+
"data-readonly": true | undefined;
|
|
8
|
+
"data-required": true | undefined;
|
|
9
|
+
"data-invalid": true | undefined;
|
|
10
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const _default: (props: Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "type" | "defaultChecked" | "checked"> & {
|
|
3
|
+
className?: string;
|
|
4
|
+
} & React.RefAttributes<any>) => React.ReactNode;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const _default: (props: Omit<Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref">, "defaultChecked" | "htmlFor"> & {
|
|
3
|
+
value: import("./Switch.types").UseSwitchReturn;
|
|
4
|
+
className?: string;
|
|
5
|
+
} & React.RefAttributes<any>) => React.ReactNode;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import SwitchControl from "./SwitchControl";
|
|
2
|
+
import SwitchHiddenInput from "./SwitchHiddenInput";
|
|
3
|
+
import SwitchLabel from "./SwitchLabel";
|
|
4
|
+
import SwitchRootProvider from "./SwitchRootProvider";
|
|
5
|
+
import SwitchThumb from "./SwitchThumb";
|
|
6
|
+
export declare const Switch: ((props: Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref">, "htmlFor" | keyof import("./Switch.types").UseSwitchProps> & import("./Switch.types").UseSwitchProps & {
|
|
7
|
+
className?: string;
|
|
8
|
+
} & import("react").RefAttributes<any>) => React.ReactNode) & {
|
|
9
|
+
Root: (props: Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref">, "htmlFor" | keyof import("./Switch.types").UseSwitchProps> & import("./Switch.types").UseSwitchProps & {
|
|
10
|
+
className?: string;
|
|
11
|
+
} & import("react").RefAttributes<any>) => React.ReactNode;
|
|
12
|
+
RootProvider: (props: Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref">, "defaultChecked" | "htmlFor"> & {
|
|
13
|
+
value: import("./Switch.types").UseSwitchReturn;
|
|
14
|
+
className?: string;
|
|
15
|
+
} & import("react").RefAttributes<any>) => React.ReactNode;
|
|
16
|
+
Control: (props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
17
|
+
className?: string;
|
|
18
|
+
} & import("react").RefAttributes<any>) => React.ReactNode;
|
|
19
|
+
Thumb: (props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
20
|
+
className?: string;
|
|
21
|
+
} & import("react").RefAttributes<any>) => React.ReactNode;
|
|
22
|
+
Label: (props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
23
|
+
className?: string;
|
|
24
|
+
} & import("react").RefAttributes<any>) => React.ReactNode;
|
|
25
|
+
HiddenInput: (props: Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "type" | "defaultChecked" | "checked"> & {
|
|
26
|
+
className?: string;
|
|
27
|
+
} & import("react").RefAttributes<any>) => React.ReactNode;
|
|
28
|
+
};
|
|
29
|
+
export { SwitchRootProvider, SwitchControl, SwitchThumb, SwitchLabel, SwitchHiddenInput };
|
|
30
|
+
export { SwitchContext, useSwitchContext } from "./SwitchContext";
|
|
31
|
+
export { useSwitch } from "./useSwitch";
|
|
32
|
+
export * from "./Switch.types";
|