@szum-tech/design-system 1.5.0 → 1.5.2

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,33 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
3
+ import * as React from 'react';
4
+
5
+ declare const avatarCva: (props?: ({
6
+ size?: "sm" | "md" | "lg" | null | undefined;
7
+ } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
8
+
9
+ type AvatarCvaProps = VariantProps<typeof avatarCva>;
10
+ type AvatarSizeType = NonNullable<AvatarCvaProps["size"]>;
11
+
12
+ type AvatarProps = React.ComponentPropsWithoutRef<"div"> & {
13
+ /**
14
+ * Defines avatar image alt
15
+ */
16
+ alt?: string;
17
+ /**
18
+ * Defines background color
19
+ */
20
+ bg?: `bg-${string}` | `bg-${string}-${number}`;
21
+ /**
22
+ * Defines avatar size
23
+ * @default 'md'
24
+ */
25
+ size?: AvatarSizeType;
26
+ /**
27
+ * Defines avatar image src
28
+ */
29
+ src?: string;
30
+ };
31
+ declare function Avatar({ alt, bg, children, size, src, ...props }: AvatarProps): JSX.Element;
32
+
33
+ export { AvatarProps, AvatarSizeType, Avatar as default };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var classVarianceAuthority = require('class-variance-authority');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+
6
+ var e=classVarianceAuthority.cva("select-none rounded font-semibold leading-none justify-center flex items-center bg-gray-500 text-white dark:text-black",{variants:{size:{sm:"h-6 w-6 text-lg",md:"h-10 w-10 text-xl",lg:"h-14 w-14 text-2xl"}},defaultVariants:{size:"md"}});function a({alt:o,bg:s,children:i,size:n="md",src:t,...l}){let m=e({size:n,className:s});return jsxRuntime.jsx("div",{className:m,...l,children:t?jsxRuntime.jsx("img",{className:"h-full w-full rounded object-cover object-center",alt:o,src:t}):i})}
7
+
8
+ module.exports = a;
@@ -0,0 +1,6 @@
1
+ import { cva } from 'class-variance-authority';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ var e=cva("select-none rounded font-semibold leading-none justify-center flex items-center bg-gray-500 text-white dark:text-black",{variants:{size:{sm:"h-6 w-6 text-lg",md:"h-10 w-10 text-xl",lg:"h-14 w-14 text-2xl"}},defaultVariants:{size:"md"}});function a({alt:o,bg:s,children:i,size:n="md",src:t,...l}){let m=e({size:n,className:s});return jsx("div",{className:m,...l,children:t?jsx("img",{className:"h-full w-full rounded object-cover object-center",alt:o,src:t}):i})}
5
+
6
+ export { a as default };
@@ -0,0 +1,44 @@
1
+ import * as React from 'react';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
4
+
5
+ declare const buttonCva: (props?: ({
6
+ color?: "neutral" | "primary" | "success" | "warning" | "error" | null | undefined;
7
+ size?: "sm" | "md" | "lg" | null | undefined;
8
+ variant?: "text" | "outlined" | "contained" | null | undefined;
9
+ } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
10
+
11
+ type ButtonCvaProps = VariantProps<typeof buttonCva>;
12
+ type ButtonSizeType = NonNullable<ButtonCvaProps["size"]>;
13
+ type ButtonVariantType = NonNullable<ButtonCvaProps["variant"]>;
14
+ type ButtonColorType = NonNullable<ButtonCvaProps["color"]>;
15
+
16
+ type AsProp<C extends React.ElementType> = {
17
+ /**
18
+ * Defines HTML tag to be used for component
19
+ */
20
+ as?: C;
21
+ };
22
+ type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
23
+ type PolymorphicComponentProp<C extends React.ElementType, Props = {}> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
24
+
25
+ type ButtonProp = {
26
+ /**
27
+ * Defines button color
28
+ * @default 'primary'
29
+ */
30
+ color?: ButtonColorType;
31
+ /**
32
+ * Defines button variant
33
+ * @default 'text'
34
+ */
35
+ variant?: ButtonVariantType;
36
+ /**
37
+ * Defines button size
38
+ * @default 'md'
39
+ */
40
+ size?: ButtonSizeType;
41
+ };
42
+ declare const _default: React.ForwardRefExoticComponent<Pick<PolymorphicComponentProp<React.ElementType<any>, ButtonProp>, string | number | symbol> & React.RefAttributes<unknown>>;
43
+
44
+ export { _default as default };
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ var e = require('react');
4
+ var classVarianceAuthority = require('class-variance-authority');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var e__namespace = /*#__PURE__*/_interopNamespace(e);
26
+
27
+ var r=classVarianceAuthority.cva("border rounded font-sans font-medium leading-[1.75] tracking-[.02857em]",{variants:{color:{neutral:"",primary:"",success:"",warning:"",error:""},size:{sm:"py-1 px-2.5 text-[.8125rem]",md:"px-4 py-1.5 text-sm",lg:"px-5 py-2 text-[.9375rem]"},variant:{text:"border-transparent bg-transparent hover:text-white",outlined:"",contained:""}},compoundVariants:[{variant:"text",color:"neutral",class:["text-gray-400","hover:border-gray-400 hover:bg-gray-400","active:text-white active:border-gray-300 active:bg-gray-300","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-gray-400"]},{variant:"text",color:"primary",class:["text-primary-500","hover:border-primary-400 hover:bg-primary-400","active:text-white active:border-primary-600 active:bg-primary-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-primary-500"]},{variant:"text",color:"success",class:["text-success-500","hover:border-success-400 hover:bg-success-400","active:text-white active:border-success-600 active:bg-success-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-success-500"]},{variant:"text",color:"warning",class:["text-warning-500","hover:border-warning-400 hover:bg-warning-400","active:text-white active:border-warning-600 active:bg-warning-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-warning-500"]},{variant:"text",color:"error",class:["text-error-500","hover:border-error-400 hover:bg-error-400","active:text-white active:border-error-600 active:bg-error-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-error-500"]},{variant:"outlined",color:"neutral",class:["text-gray-400 border-gray-400 bg-transparent","hover:bg-gray-500 hover:text-white","active:text-white active:bg-gray-300","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-gray-400"]},{variant:"outlined",color:"primary",class:["text-primary-500 border-primary-500 bg-transparent","hover:bg-primary-400 hover:text-white","active:text-white active:bg-primary-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-primary-500"]},{variant:"outlined",color:"success",class:["text-success-500 border-success-500 bg-transparent","hover:bg-success-400 hover:text-white","active:text-white active:bg-success-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-success-500"]},{variant:"outlined",color:"warning",class:["text-warning-500 border-warning-500 bg-transparent","hover:bg-warning-400 hover:text-white","active:text-white active:bg-warning-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-warning-500"]},{variant:"outlined",color:"error",class:["text-error-500 border-error-500 bg-transparent","hover:bg-error-400 hover:text-white","active:text-white active:bg-error-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-error-500"]}]});var v=e__namespace.forwardRef(function({as:t,color:a="primary",children:o,size:i="md",variant:s="text",...n},d){let c=t||"button",l=r({size:i,variant:s,color:a});return jsxRuntime.jsx(c,{className:l,ref:d,...n,children:o})});
28
+
29
+ module.exports = v;
@@ -0,0 +1,7 @@
1
+ import * as e from 'react';
2
+ import { cva } from 'class-variance-authority';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var r=cva("border rounded font-sans font-medium leading-[1.75] tracking-[.02857em]",{variants:{color:{neutral:"",primary:"",success:"",warning:"",error:""},size:{sm:"py-1 px-2.5 text-[.8125rem]",md:"px-4 py-1.5 text-sm",lg:"px-5 py-2 text-[.9375rem]"},variant:{text:"border-transparent bg-transparent hover:text-white",outlined:"",contained:""}},compoundVariants:[{variant:"text",color:"neutral",class:["text-gray-400","hover:border-gray-400 hover:bg-gray-400","active:text-white active:border-gray-300 active:bg-gray-300","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-gray-400"]},{variant:"text",color:"primary",class:["text-primary-500","hover:border-primary-400 hover:bg-primary-400","active:text-white active:border-primary-600 active:bg-primary-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-primary-500"]},{variant:"text",color:"success",class:["text-success-500","hover:border-success-400 hover:bg-success-400","active:text-white active:border-success-600 active:bg-success-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-success-500"]},{variant:"text",color:"warning",class:["text-warning-500","hover:border-warning-400 hover:bg-warning-400","active:text-white active:border-warning-600 active:bg-warning-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-warning-500"]},{variant:"text",color:"error",class:["text-error-500","hover:border-error-400 hover:bg-error-400","active:text-white active:border-error-600 active:bg-error-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-error-500"]},{variant:"outlined",color:"neutral",class:["text-gray-400 border-gray-400 bg-transparent","hover:bg-gray-500 hover:text-white","active:text-white active:bg-gray-300","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-gray-400"]},{variant:"outlined",color:"primary",class:["text-primary-500 border-primary-500 bg-transparent","hover:bg-primary-400 hover:text-white","active:text-white active:bg-primary-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-primary-500"]},{variant:"outlined",color:"success",class:["text-success-500 border-success-500 bg-transparent","hover:bg-success-400 hover:text-white","active:text-white active:bg-success-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-success-500"]},{variant:"outlined",color:"warning",class:["text-warning-500 border-warning-500 bg-transparent","hover:bg-warning-400 hover:text-white","active:text-white active:bg-warning-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-warning-500"]},{variant:"outlined",color:"error",class:["text-error-500 border-error-500 bg-transparent","hover:bg-error-400 hover:text-white","active:text-white active:bg-error-600","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-error-500"]}]});var v=e.forwardRef(function({as:t,color:a="primary",children:o,size:i="md",variant:s="text",...n},d){let c=t||"button",l=r({size:i,variant:s,color:a});return jsx(c,{className:l,ref:d,...n,children:o})});
6
+
7
+ export { v as default };
@@ -0,0 +1,72 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
3
+ import * as React from 'react';
4
+
5
+ declare const avatarCva: (props?: ({
6
+ size?: "sm" | "md" | "lg" | null | undefined;
7
+ } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
8
+
9
+ type AvatarCvaProps = VariantProps<typeof avatarCva>;
10
+ type AvatarSizeType = NonNullable<AvatarCvaProps["size"]>;
11
+
12
+ type AvatarProps = React.ComponentPropsWithoutRef<"div"> & {
13
+ /**
14
+ * Defines avatar image alt
15
+ */
16
+ alt?: string;
17
+ /**
18
+ * Defines background color
19
+ */
20
+ bg?: `bg-${string}` | `bg-${string}-${number}`;
21
+ /**
22
+ * Defines avatar size
23
+ * @default 'md'
24
+ */
25
+ size?: AvatarSizeType;
26
+ /**
27
+ * Defines avatar image src
28
+ */
29
+ src?: string;
30
+ };
31
+ declare function Avatar({ alt, bg, children, size, src, ...props }: AvatarProps): JSX.Element;
32
+
33
+ declare const buttonCva: (props?: ({
34
+ color?: "neutral" | "primary" | "success" | "warning" | "error" | null | undefined;
35
+ size?: "sm" | "md" | "lg" | null | undefined;
36
+ variant?: "text" | "outlined" | "contained" | null | undefined;
37
+ } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
38
+
39
+ type ButtonCvaProps = VariantProps<typeof buttonCva>;
40
+ type ButtonSizeType = NonNullable<ButtonCvaProps["size"]>;
41
+ type ButtonVariantType = NonNullable<ButtonCvaProps["variant"]>;
42
+ type ButtonColorType = NonNullable<ButtonCvaProps["color"]>;
43
+
44
+ type AsProp<C extends React.ElementType> = {
45
+ /**
46
+ * Defines HTML tag to be used for component
47
+ */
48
+ as?: C;
49
+ };
50
+ type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
51
+ type PolymorphicComponentProp<C extends React.ElementType, Props = {}> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
52
+
53
+ type ButtonProp = {
54
+ /**
55
+ * Defines button color
56
+ * @default 'primary'
57
+ */
58
+ color?: ButtonColorType;
59
+ /**
60
+ * Defines button variant
61
+ * @default 'text'
62
+ */
63
+ variant?: ButtonVariantType;
64
+ /**
65
+ * Defines button size
66
+ * @default 'md'
67
+ */
68
+ size?: ButtonSizeType;
69
+ };
70
+ declare const _default: React.ForwardRefExoticComponent<Pick<PolymorphicComponentProp<React.ElementType<any>, ButtonProp>, string | number | symbol> & React.RefAttributes<unknown>>;
71
+
72
+ export { Avatar, AvatarProps, AvatarSizeType, _default as Button };
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var Avatar = require('./Avatar');
4
+ var Button = require('./Button');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var Button__default = /*#__PURE__*/_interopDefault(Button);
9
+
10
+
11
+
12
+ Object.defineProperty(exports, 'Avatar', {
13
+ enumerable: true,
14
+ get: function () { return Avatar__namespace.default; }
15
+ });
16
+ Object.defineProperty(exports, 'Button', {
17
+ enumerable: true,
18
+ get: function () { return Button__default.default; }
19
+ });
20
+ Object.keys(Avatar).forEach(function (k) {
21
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
22
+ enumerable: true,
23
+ get: function () { return Avatar[k]; }
24
+ });
25
+ });
@@ -0,0 +1,3 @@
1
+ export * from './Avatar';
2
+ export { default as Avatar } from './Avatar';
3
+ export { default as Button } from './Button';
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+
3
+ type ThemeType = "light" | "dark";
4
+ interface ThemeContextType {
5
+ theme: ThemeType;
6
+ setTheme: React.Dispatch<React.SetStateAction<ThemeType>>;
7
+ }
8
+
9
+ declare const ThemeContext: React.Context<ThemeContextType>;
10
+
11
+ interface ThemeProviderProps {
12
+ /**
13
+ * Children Components using theming.
14
+ */
15
+ children?: React.ReactNode;
16
+ /**
17
+ * Define the default theme which is set at the beginning if neither local storage nor media is defined.
18
+ */
19
+ defaultTheme?: ThemeType;
20
+ /**
21
+ * Define theme that is always set initially.
22
+ */
23
+ theme?: ThemeType;
24
+ }
25
+ declare function ThemeProvider({ children, defaultTheme, theme }: ThemeProviderProps): JSX.Element;
26
+
27
+ export { ThemeContext, ThemeContextType, ThemeProvider, ThemeProviderProps, ThemeType };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var theme = require('./theme');
4
+
5
+
6
+
7
+ Object.keys(theme).forEach(function (k) {
8
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
9
+ enumerable: true,
10
+ get: function () { return theme[k]; }
11
+ });
12
+ });
@@ -0,0 +1 @@
1
+ export * from './theme';
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+
3
+ type ThemeType = "light" | "dark";
4
+ interface ThemeContextType {
5
+ theme: ThemeType;
6
+ setTheme: React.Dispatch<React.SetStateAction<ThemeType>>;
7
+ }
8
+
9
+ declare const ThemeContext: React.Context<ThemeContextType>;
10
+
11
+ interface ThemeProviderProps {
12
+ /**
13
+ * Children Components using theming.
14
+ */
15
+ children?: React.ReactNode;
16
+ /**
17
+ * Define the default theme which is set at the beginning if neither local storage nor media is defined.
18
+ */
19
+ defaultTheme?: ThemeType;
20
+ /**
21
+ * Define theme that is always set initially.
22
+ */
23
+ theme?: ThemeType;
24
+ }
25
+ declare function ThemeProvider({ children, defaultTheme, theme }: ThemeProviderProps): JSX.Element;
26
+
27
+ export { ThemeContext, ThemeContextType, ThemeProvider, ThemeProviderProps, ThemeType };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var a = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var a__default = /*#__PURE__*/_interopDefault(a);
9
+
10
+ var n=a__default.default.createContext({});function T(t){if(typeof window<"u"&&window.localStorage){let e=window.localStorage.getItem("theme");if(e==="dark"||!e&&window.matchMedia("(prefers-color-scheme: dark)").matches)return "dark"}return t??"light"}function u({children:t,defaultTheme:e,theme:r}){let[o,i]=a__default.default.useState(r||T(e));function d(m){typeof window<"u"&&window.localStorage&&(m==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),localStorage.setItem("theme",m));}return a__default.default.useEffect(()=>{d(o);},[o]),jsxRuntime.jsx(n.Provider,{value:{theme:o,setTheme:i},children:t})}
11
+
12
+ exports.ThemeContext = n;
13
+ exports.ThemeProvider = u;
@@ -0,0 +1,6 @@
1
+ import a from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ var n=a.createContext({});function T(t){if(typeof window<"u"&&window.localStorage){let e=window.localStorage.getItem("theme");if(e==="dark"||!e&&window.matchMedia("(prefers-color-scheme: dark)").matches)return "dark"}return t??"light"}function u({children:t,defaultTheme:e,theme:r}){let[o,i]=a.useState(r||T(e));function d(m){typeof window<"u"&&window.localStorage&&(m==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),localStorage.setItem("theme",m));}return a.useEffect(()=>{d(o);},[o]),jsx(n.Provider,{value:{theme:o,setTheme:i},children:t})}
5
+
6
+ export { n as ThemeContext, u as ThemeProvider };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+
3
+ type ThemeType = "light" | "dark";
4
+ interface ThemeContextType {
5
+ theme: ThemeType;
6
+ setTheme: React.Dispatch<React.SetStateAction<ThemeType>>;
7
+ }
8
+
9
+ declare const useTheme: () => ThemeContextType;
10
+
11
+ export { useTheme };
package/hooks/index.js ADDED
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var useTheme = require('./useTheme');
4
+
5
+
6
+
7
+ Object.keys(useTheme).forEach(function (k) {
8
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
9
+ enumerable: true,
10
+ get: function () { return useTheme[k]; }
11
+ });
12
+ });
@@ -0,0 +1 @@
1
+ export * from './useTheme';
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+
3
+ type ThemeType = "light" | "dark";
4
+ interface ThemeContextType {
5
+ theme: ThemeType;
6
+ setTheme: React.Dispatch<React.SetStateAction<ThemeType>>;
7
+ }
8
+
9
+ declare const useTheme: () => ThemeContextType;
10
+
11
+ export { useTheme };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ var t = require('react');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var t__default = /*#__PURE__*/_interopDefault(t);
8
+
9
+ var e=t__default.default.createContext({});var T=()=>t__default.default.useContext(e);
10
+
11
+ exports.useTheme = T;
@@ -0,0 +1,5 @@
1
+ import t from 'react';
2
+
3
+ var e=t.createContext({});var T=()=>t.useContext(e);
4
+
5
+ export { T as useTheme };
@@ -7,10 +7,10 @@ declare const avatarCva: (props?: ({
7
7
  size?: "sm" | "md" | "lg" | null | undefined;
8
8
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
9
9
 
10
- declare type AvatarCvaProps = VariantProps<typeof avatarCva>;
11
- declare type AvatarSizeType = NonNullable<AvatarCvaProps["size"]>;
10
+ type AvatarCvaProps = VariantProps<typeof avatarCva>;
11
+ type AvatarSizeType = NonNullable<AvatarCvaProps["size"]>;
12
12
 
13
- declare type AvatarProps = React.ComponentPropsWithoutRef<"div"> & {
13
+ type AvatarProps = React.ComponentPropsWithoutRef<"div"> & {
14
14
  /**
15
15
  * Defines avatar image alt
16
16
  */
@@ -37,21 +37,21 @@ declare const buttonCva: (props?: ({
37
37
  variant?: "text" | "outlined" | "contained" | null | undefined;
38
38
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
39
39
 
40
- declare type ButtonCvaProps = VariantProps<typeof buttonCva>;
41
- declare type ButtonSizeType = NonNullable<ButtonCvaProps["size"]>;
42
- declare type ButtonVariantType = NonNullable<ButtonCvaProps["variant"]>;
43
- declare type ButtonColorType = NonNullable<ButtonCvaProps["color"]>;
40
+ type ButtonCvaProps = VariantProps<typeof buttonCva>;
41
+ type ButtonSizeType = NonNullable<ButtonCvaProps["size"]>;
42
+ type ButtonVariantType = NonNullable<ButtonCvaProps["variant"]>;
43
+ type ButtonColorType = NonNullable<ButtonCvaProps["color"]>;
44
44
 
45
- declare type AsProp<C extends React.ElementType> = {
45
+ type AsProp<C extends React.ElementType> = {
46
46
  /**
47
47
  * Defines HTML tag to be used for component
48
48
  */
49
49
  as?: C;
50
50
  };
51
- declare type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
52
- declare type PolymorphicComponentProp<C extends React.ElementType, Props = {}> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
51
+ type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
52
+ type PolymorphicComponentProp<C extends React.ElementType, Props = {}> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
53
53
 
54
- declare type ButtonProp = {
54
+ type ButtonProp = {
55
55
  /**
56
56
  * Defines button color
57
57
  * @default 'primary'
@@ -70,7 +70,7 @@ declare type ButtonProp = {
70
70
  };
71
71
  declare const _default: React.ForwardRefExoticComponent<Pick<PolymorphicComponentProp<React.ElementType<any>, ButtonProp>, string | number | symbol> & React.RefAttributes<unknown>>;
72
72
 
73
- declare type ThemeType = "light" | "dark";
73
+ type ThemeType = "light" | "dark";
74
74
  interface ThemeContextType {
75
75
  theme: ThemeType;
76
76
  setTheme: React__default.Dispatch<React__default.SetStateAction<ThemeType>>;
package/index.js ADDED
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var index = require('./components/index');
4
+ var hooks = require('./hooks');
5
+ var contexts = require('./contexts');
6
+
7
+
8
+
9
+ Object.keys(index).forEach(function (k) {
10
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
11
+ enumerable: true,
12
+ get: function () { return index[k]; }
13
+ });
14
+ });
15
+ Object.keys(hooks).forEach(function (k) {
16
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
17
+ enumerable: true,
18
+ get: function () { return hooks[k]; }
19
+ });
20
+ });
21
+ Object.keys(contexts).forEach(function (k) {
22
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
23
+ enumerable: true,
24
+ get: function () { return contexts[k]; }
25
+ });
26
+ });
package/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ export * from './components/index';
2
+ export * from './hooks';
3
+ export * from './contexts';
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "dependencies": {
8
8
  "@heroicons/react": "^2.0.15",
9
9
  "class-variance-authority": "^0.4.0",
10
- "tailwindcss": "^3.2.4"
10
+ "tailwindcss": "^3.2.7"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@babel/core": "^7.19.6",
@@ -17,19 +17,17 @@
17
17
  "@semantic-release/github": "^8.0.6",
18
18
  "@semantic-release/npm": "^9.0.1",
19
19
  "@semantic-release/release-notes-generator": "^10.0.3",
20
- "@storybook/addon-actions": "^6.5.13",
21
- "@storybook/addon-docs": "^6.5.13",
22
- "@storybook/addon-essentials": "^6.5.13",
23
- "@storybook/addon-interactions": "^6.5.13",
24
- "@storybook/addon-links": "^6.5.13",
25
- "@storybook/addon-postcss": "^2.0.0",
26
- "@storybook/addons": "^6.5.13",
27
- "@storybook/builder-webpack5": "^6.5.13",
28
- "@storybook/core-events": "^6.5.13",
29
- "@storybook/manager-webpack5": "^6.5.13",
30
- "@storybook/react": "^6.5.13",
31
- "@storybook/testing-library": "^0.0.13",
32
- "@storybook/theming": "^6.5.13",
20
+ "@storybook/addon-a11y": "^7.0.0-beta.47",
21
+ "@storybook/addon-actions": "^7.0.0-beta.47",
22
+ "@storybook/addon-docs": "^7.0.0-beta.47",
23
+ "@storybook/addon-essentials": "^7.0.0-beta.47",
24
+ "@storybook/addon-links": "^7.0.0-beta.47",
25
+ "@storybook/addons": "^7.0.0-beta.47",
26
+ "@storybook/core-common": "^6.5.16",
27
+ "@storybook/core-events": "^6.5.16",
28
+ "@storybook/react": "^7.0.0-beta.47",
29
+ "@storybook/react-vite": "^7.0.0-beta.47",
30
+ "@storybook/theming": "^7.0.0-beta.47",
33
31
  "@tailwindcss/container-queries": "^0.1.0",
34
32
  "@testing-library/react": "^13.4.0",
35
33
  "@testing-library/user-event": "^14.4.3",
@@ -37,9 +35,10 @@
37
35
  "@types/react": "^18.0.24",
38
36
  "@types/react-dom": "^18.0.8",
39
37
  "@types/semantic-release": "^17.2.4",
38
+ "@vitejs/plugin-react": "^3.1.0",
40
39
  "autoprefixer": "^10.4.13",
41
40
  "babel-loader": "^8.2.5",
42
- "concurrently": "^7.5.0",
41
+ "concurrently": "^7.6.0",
43
42
  "cpy-cli": "^4.2.0",
44
43
  "postcss": "^8.4.18",
45
44
  "prettier": "^2.7.1",
@@ -49,13 +48,20 @@
49
48
  "react-docgen-typescript": "^2.2.2",
50
49
  "react-dom": "^18.2.0",
51
50
  "semantic-release": "^19.0.5",
52
- "storybook-dark-mode": "^1.1.2",
53
- "tailwind-scrollbar": "^2.0.1",
54
- "tsup": "^6.3.0",
55
- "typescript": "^4.8.4"
51
+ "serve": "^14.2.0",
52
+ "storybook": "^7.0.0-beta.47",
53
+ "storybook-addon-pseudo-states": "^2.0.0-next.0",
54
+ "storybook-addon-themes": "^6.1.0",
55
+ "tailwind-scrollbar": "^2.1.0",
56
+ "tsup": "^6.6.3",
57
+ "typescript": "^4.9.5",
58
+ "vite": "^4.1.2"
56
59
  },
57
60
  "files": [
58
- "dist/**",
61
+ "index.*",
62
+ "components/**",
63
+ "hooks/**",
64
+ "contexts/**",
59
65
  "tailwindcss/**"
60
66
  ],
61
67
  "homepage": "https://github.com/JanSzewczyk/design-system#readme",
@@ -73,9 +79,9 @@
73
79
  "semantic-release"
74
80
  ],
75
81
  "license": "MIT",
76
- "main": "./dist/index.js",
82
+ "main": "./index.js",
77
83
  "name": "@szum-tech/design-system",
78
- "module": "./dist/index.mjs",
84
+ "module": "./index.mjs",
79
85
  "publishConfig": {
80
86
  "access": "public"
81
87
  },
@@ -84,20 +90,21 @@
84
90
  "url": "git+https://github.com/JanSzewczyk/design-system.git"
85
91
  },
86
92
  "scripts": {
87
- "build": "tsup src/index.tsx --format esm,cjs --dts --treeshake --external react,react-dom",
93
+ "build": "tsup",
94
+ "typecheck": "tsc --noEmit",
88
95
  "clean": "rm -rf node_modules && rm -rf dist",
89
96
  "dev": "concurrently \"npm run dev:css\" \"npm run dev:build\"",
90
97
  "dev:build": "tsup src/index.tsx --format esm,cjs --watch --dts --external react,react-dom",
91
98
  "dev:css": "tailwindcss -w -i tailwindcss/global.css -o src/styles/default.css",
92
- "storybook": "start-storybook -p 6006",
93
99
  "semantic-release": "semantic-release",
94
- "build:storybook": "build-storybook",
95
- "build:storybook:docs": "build-storybook --docs",
96
- "prebuild:storybook": "tailwindcss -i tailwindcss/global.css -o src/styles/default.css"
100
+ "storybook": "storybook dev -p 6006 -s public",
101
+ "storybook:prebuild": "tailwindcss -i tailwindcss/global.css -o src/styles/default.css",
102
+ "storybook:build": "storybook build --docs",
103
+ "storybook:serve": "serve storybook-static"
97
104
  },
98
105
  "sideEffects": false,
99
- "types": "./dist/index.d.ts",
100
- "version": "1.5.0",
106
+ "types": "./index.d.ts",
107
+ "version": "1.5.2",
101
108
  "peerDependencies": {
102
109
  "@tailwindcss/container-queries": "^0.1.0",
103
110
  "react": "^18.2.0",
package/dist/index.js DELETED
@@ -1,243 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var classVarianceAuthority = require('class-variance-authority');
6
- var jsxRuntime = require('react/jsx-runtime');
7
- var React3 = require('react');
8
-
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
-
11
- function _interopNamespace(e) {
12
- if (e && e.__esModule) return e;
13
- var n = Object.create(null);
14
- if (e) {
15
- Object.keys(e).forEach(function (k) {
16
- if (k !== 'default') {
17
- var d = Object.getOwnPropertyDescriptor(e, k);
18
- Object.defineProperty(n, k, d.get ? d : {
19
- enumerable: true,
20
- get: function () { return e[k]; }
21
- });
22
- }
23
- });
24
- }
25
- n["default"] = e;
26
- return Object.freeze(n);
27
- }
28
-
29
- var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
30
- var React3__default = /*#__PURE__*/_interopDefaultLegacy(React3);
31
-
32
- // src/components/Avatar/Avatar.styles.ts
33
- var avatarCva = classVarianceAuthority.cva(
34
- "select-none rounded font-semibold leading-none justify-center flex items-center bg-gray-500 text-white dark:text-black",
35
- {
36
- variants: {
37
- size: {
38
- sm: "h-6 w-6 text-lg",
39
- md: "h-10 w-10 text-xl",
40
- lg: "h-14 w-14 text-2xl"
41
- }
42
- },
43
- defaultVariants: {
44
- size: "md"
45
- }
46
- }
47
- );
48
- function Avatar({ alt, bg, children, size = "md", src, ...props }) {
49
- const avatarStyles = avatarCva({ size, className: bg });
50
- return /* @__PURE__ */ jsxRuntime.jsx("div", {
51
- className: avatarStyles,
52
- ...props,
53
- children: src ? /* @__PURE__ */ jsxRuntime.jsx("img", {
54
- className: "h-full w-full rounded object-cover object-center",
55
- alt,
56
- src
57
- }) : children
58
- });
59
- }
60
- var buttonCva = classVarianceAuthority.cva(
61
- "border rounded font-sans font-medium leading-[1.75] tracking-[.02857em]",
62
- {
63
- variants: {
64
- color: {
65
- neutral: "",
66
- primary: "",
67
- success: "",
68
- warning: "",
69
- error: ""
70
- },
71
- size: {
72
- sm: "py-1 px-2.5 text-[.8125rem]",
73
- md: "px-4 py-1.5 text-sm",
74
- lg: "px-5 py-2 text-[.9375rem]"
75
- },
76
- variant: {
77
- text: "border-transparent bg-transparent hover:text-white",
78
- outlined: "",
79
- contained: ""
80
- }
81
- },
82
- compoundVariants: [
83
- {
84
- variant: "text",
85
- color: "neutral",
86
- class: [
87
- "text-gray-400",
88
- "hover:border-gray-400 hover:bg-gray-400",
89
- "active:text-white active:border-gray-300 active:bg-gray-300",
90
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-gray-400"
91
- ]
92
- },
93
- {
94
- variant: "text",
95
- color: "primary",
96
- class: [
97
- "text-primary-500",
98
- "hover:border-primary-400 hover:bg-primary-400",
99
- "active:text-white active:border-primary-600 active:bg-primary-600",
100
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-primary-500"
101
- ]
102
- },
103
- {
104
- variant: "text",
105
- color: "success",
106
- class: [
107
- "text-success-500",
108
- "hover:border-success-400 hover:bg-success-400",
109
- "active:text-white active:border-success-600 active:bg-success-600",
110
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-success-500"
111
- ]
112
- },
113
- {
114
- variant: "text",
115
- color: "warning",
116
- class: [
117
- "text-warning-500",
118
- "hover:border-warning-400 hover:bg-warning-400",
119
- "active:text-white active:border-warning-600 active:bg-warning-600",
120
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-warning-500"
121
- ]
122
- },
123
- {
124
- variant: "text",
125
- color: "error",
126
- class: [
127
- "text-error-500",
128
- "hover:border-error-400 hover:bg-error-400",
129
- "active:text-white active:border-error-600 active:bg-error-600",
130
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-error-500"
131
- ]
132
- },
133
- {
134
- variant: "outlined",
135
- color: "neutral",
136
- class: [
137
- "text-gray-400 border-gray-400 bg-transparent",
138
- "hover:bg-gray-500 hover:text-white",
139
- "active:text-white active:bg-gray-300",
140
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-gray-400"
141
- ]
142
- },
143
- {
144
- variant: "outlined",
145
- color: "primary",
146
- class: [
147
- "text-primary-500 border-primary-500 bg-transparent",
148
- "hover:bg-primary-400 hover:text-white",
149
- "active:text-white active:bg-primary-600",
150
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-primary-500"
151
- ]
152
- },
153
- {
154
- variant: "outlined",
155
- color: "success",
156
- class: [
157
- "text-success-500 border-success-500 bg-transparent",
158
- "hover:bg-success-400 hover:text-white",
159
- "active:text-white active:bg-success-600",
160
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-success-500"
161
- ]
162
- },
163
- {
164
- variant: "outlined",
165
- color: "warning",
166
- class: [
167
- "text-warning-500 border-warning-500 bg-transparent",
168
- "hover:bg-warning-400 hover:text-white",
169
- "active:text-white active:bg-warning-600",
170
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-warning-500"
171
- ]
172
- },
173
- {
174
- variant: "outlined",
175
- color: "error",
176
- class: [
177
- "text-error-500 border-error-500 bg-transparent",
178
- "hover:bg-error-400 hover:text-white",
179
- "active:text-white active:bg-error-600",
180
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-error-500"
181
- ]
182
- }
183
- ]
184
- }
185
- );
186
- var Button_default = React3__namespace.forwardRef(function({
187
- as,
188
- color = "primary",
189
- children,
190
- size = "md",
191
- variant = "text",
192
- ...restProps
193
- }, ref) {
194
- const Component = as || "button";
195
- const buttonRootStyles = buttonCva({ size, variant, color });
196
- return /* @__PURE__ */ jsxRuntime.jsx(Component, {
197
- className: buttonRootStyles,
198
- ref,
199
- ...restProps,
200
- children
201
- });
202
- });
203
- var ThemeContext = React3__default["default"].createContext({});
204
- function getInitialTheme(defaultTheme) {
205
- if (typeof window !== "undefined" && window.localStorage) {
206
- const storageTheme = window.localStorage.getItem("theme");
207
- if (storageTheme === "dark" || !storageTheme && window.matchMedia("(prefers-color-scheme: dark)").matches) {
208
- return "dark";
209
- }
210
- }
211
- return defaultTheme ?? "light";
212
- }
213
- function ThemeProvider({ children, defaultTheme, theme }) {
214
- const [themeState, setThemeState] = React3__default["default"].useState(
215
- theme ? theme : getInitialTheme(defaultTheme)
216
- );
217
- function rawSetTheme(rawTheme) {
218
- if (typeof window !== "undefined" && window.localStorage) {
219
- if (rawTheme === "dark") {
220
- document.documentElement.classList.add("dark");
221
- } else {
222
- document.documentElement.classList.remove("dark");
223
- }
224
- localStorage.setItem("theme", rawTheme);
225
- }
226
- }
227
- React3__default["default"].useEffect(() => {
228
- rawSetTheme(themeState);
229
- }, [themeState]);
230
- return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, {
231
- value: { theme: themeState, setTheme: setThemeState },
232
- children
233
- });
234
- }
235
-
236
- // src/hooks/useTheme/useTheme.tsx
237
- var useTheme = () => React3__default["default"].useContext(ThemeContext);
238
-
239
- exports.Avatar = Avatar;
240
- exports.Button = Button_default;
241
- exports.ThemeContext = ThemeContext;
242
- exports.ThemeProvider = ThemeProvider;
243
- exports.useTheme = useTheme;
package/dist/index.mjs DELETED
@@ -1,213 +0,0 @@
1
- import { cva } from 'class-variance-authority';
2
- import { jsx } from 'react/jsx-runtime';
3
- import * as React3 from 'react';
4
- import React3__default from 'react';
5
-
6
- // src/components/Avatar/Avatar.styles.ts
7
- var avatarCva = cva(
8
- "select-none rounded font-semibold leading-none justify-center flex items-center bg-gray-500 text-white dark:text-black",
9
- {
10
- variants: {
11
- size: {
12
- sm: "h-6 w-6 text-lg",
13
- md: "h-10 w-10 text-xl",
14
- lg: "h-14 w-14 text-2xl"
15
- }
16
- },
17
- defaultVariants: {
18
- size: "md"
19
- }
20
- }
21
- );
22
- function Avatar({ alt, bg, children, size = "md", src, ...props }) {
23
- const avatarStyles = avatarCva({ size, className: bg });
24
- return /* @__PURE__ */ jsx("div", {
25
- className: avatarStyles,
26
- ...props,
27
- children: src ? /* @__PURE__ */ jsx("img", {
28
- className: "h-full w-full rounded object-cover object-center",
29
- alt,
30
- src
31
- }) : children
32
- });
33
- }
34
- var buttonCva = cva(
35
- "border rounded font-sans font-medium leading-[1.75] tracking-[.02857em]",
36
- {
37
- variants: {
38
- color: {
39
- neutral: "",
40
- primary: "",
41
- success: "",
42
- warning: "",
43
- error: ""
44
- },
45
- size: {
46
- sm: "py-1 px-2.5 text-[.8125rem]",
47
- md: "px-4 py-1.5 text-sm",
48
- lg: "px-5 py-2 text-[.9375rem]"
49
- },
50
- variant: {
51
- text: "border-transparent bg-transparent hover:text-white",
52
- outlined: "",
53
- contained: ""
54
- }
55
- },
56
- compoundVariants: [
57
- {
58
- variant: "text",
59
- color: "neutral",
60
- class: [
61
- "text-gray-400",
62
- "hover:border-gray-400 hover:bg-gray-400",
63
- "active:text-white active:border-gray-300 active:bg-gray-300",
64
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-gray-400"
65
- ]
66
- },
67
- {
68
- variant: "text",
69
- color: "primary",
70
- class: [
71
- "text-primary-500",
72
- "hover:border-primary-400 hover:bg-primary-400",
73
- "active:text-white active:border-primary-600 active:bg-primary-600",
74
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-primary-500"
75
- ]
76
- },
77
- {
78
- variant: "text",
79
- color: "success",
80
- class: [
81
- "text-success-500",
82
- "hover:border-success-400 hover:bg-success-400",
83
- "active:text-white active:border-success-600 active:bg-success-600",
84
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-success-500"
85
- ]
86
- },
87
- {
88
- variant: "text",
89
- color: "warning",
90
- class: [
91
- "text-warning-500",
92
- "hover:border-warning-400 hover:bg-warning-400",
93
- "active:text-white active:border-warning-600 active:bg-warning-600",
94
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-warning-500"
95
- ]
96
- },
97
- {
98
- variant: "text",
99
- color: "error",
100
- class: [
101
- "text-error-500",
102
- "hover:border-error-400 hover:bg-error-400",
103
- "active:text-white active:border-error-600 active:bg-error-600",
104
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-transparent disabled:hover:bg-transparent disabled:hover:text-error-500"
105
- ]
106
- },
107
- {
108
- variant: "outlined",
109
- color: "neutral",
110
- class: [
111
- "text-gray-400 border-gray-400 bg-transparent",
112
- "hover:bg-gray-500 hover:text-white",
113
- "active:text-white active:bg-gray-300",
114
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-gray-400"
115
- ]
116
- },
117
- {
118
- variant: "outlined",
119
- color: "primary",
120
- class: [
121
- "text-primary-500 border-primary-500 bg-transparent",
122
- "hover:bg-primary-400 hover:text-white",
123
- "active:text-white active:bg-primary-600",
124
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-primary-500"
125
- ]
126
- },
127
- {
128
- variant: "outlined",
129
- color: "success",
130
- class: [
131
- "text-success-500 border-success-500 bg-transparent",
132
- "hover:bg-success-400 hover:text-white",
133
- "active:text-white active:bg-success-600",
134
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-success-500"
135
- ]
136
- },
137
- {
138
- variant: "outlined",
139
- color: "warning",
140
- class: [
141
- "text-warning-500 border-warning-500 bg-transparent",
142
- "hover:bg-warning-400 hover:text-white",
143
- "active:text-white active:bg-warning-600",
144
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-warning-500"
145
- ]
146
- },
147
- {
148
- variant: "outlined",
149
- color: "error",
150
- class: [
151
- "text-error-500 border-error-500 bg-transparent",
152
- "hover:bg-error-400 hover:text-white",
153
- "active:text-white active:bg-error-600",
154
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-error-500"
155
- ]
156
- }
157
- ]
158
- }
159
- );
160
- var Button_default = React3.forwardRef(function({
161
- as,
162
- color = "primary",
163
- children,
164
- size = "md",
165
- variant = "text",
166
- ...restProps
167
- }, ref) {
168
- const Component = as || "button";
169
- const buttonRootStyles = buttonCva({ size, variant, color });
170
- return /* @__PURE__ */ jsx(Component, {
171
- className: buttonRootStyles,
172
- ref,
173
- ...restProps,
174
- children
175
- });
176
- });
177
- var ThemeContext = React3__default.createContext({});
178
- function getInitialTheme(defaultTheme) {
179
- if (typeof window !== "undefined" && window.localStorage) {
180
- const storageTheme = window.localStorage.getItem("theme");
181
- if (storageTheme === "dark" || !storageTheme && window.matchMedia("(prefers-color-scheme: dark)").matches) {
182
- return "dark";
183
- }
184
- }
185
- return defaultTheme ?? "light";
186
- }
187
- function ThemeProvider({ children, defaultTheme, theme }) {
188
- const [themeState, setThemeState] = React3__default.useState(
189
- theme ? theme : getInitialTheme(defaultTheme)
190
- );
191
- function rawSetTheme(rawTheme) {
192
- if (typeof window !== "undefined" && window.localStorage) {
193
- if (rawTheme === "dark") {
194
- document.documentElement.classList.add("dark");
195
- } else {
196
- document.documentElement.classList.remove("dark");
197
- }
198
- localStorage.setItem("theme", rawTheme);
199
- }
200
- }
201
- React3__default.useEffect(() => {
202
- rawSetTheme(themeState);
203
- }, [themeState]);
204
- return /* @__PURE__ */ jsx(ThemeContext.Provider, {
205
- value: { theme: themeState, setTheme: setThemeState },
206
- children
207
- });
208
- }
209
-
210
- // src/hooks/useTheme/useTheme.tsx
211
- var useTheme = () => React3__default.useContext(ThemeContext);
212
-
213
- export { Avatar, Button_default as Button, ThemeContext, ThemeProvider, useTheme };