@canceyd/react-npm-starter 0.0.1
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/README.md +83 -0
- package/dist/button.d.ts +61 -0
- package/dist/button.js +3 -0
- package/dist/button.js.map +1 -0
- package/dist/components/button/index.js +48 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/button/variants/index.js +38 -0
- package/dist/components/button/variants/index.js.map +1 -0
- package/dist/components/container/index.js +22 -0
- package/dist/components/container/index.js.map +1 -0
- package/dist/components/container/variants/index.js +24 -0
- package/dist/components/container/variants/index.js.map +1 -0
- package/dist/container.d.ts +29 -0
- package/dist/container.js +3 -0
- package/dist/container.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.js +9 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/react-npm-starter.css +3108 -0
- package/dist/vite.svg +1 -0
- package/package.json +108 -0
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @canceyd/react-npm-starter
|
|
2
|
+
|
|
3
|
+
A React component library built with TypeScript, Vite, and shadcn/ui. Optimized for tree-shaking and minimal bundle size.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @canceyd/react-npm-starter
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @canceyd/react-npm-starter
|
|
11
|
+
# or
|
|
12
|
+
yarn add @canceyd/react-npm-starter
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Import individual components (recommended for minimal bundle size)
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Button } from "@canceyd/react-npm-starter/button";
|
|
21
|
+
import { Container } from "@canceyd/react-npm-starter/container";
|
|
22
|
+
|
|
23
|
+
function App() {
|
|
24
|
+
return (
|
|
25
|
+
<Container>
|
|
26
|
+
<Button variant="default">Click me</Button>
|
|
27
|
+
</Container>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Import from main entry point
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { Button, Container } from "@canceyd/react-npm-starter";
|
|
36
|
+
|
|
37
|
+
function App() {
|
|
38
|
+
return (
|
|
39
|
+
<Container>
|
|
40
|
+
<Button variant="default">Click me</Button>
|
|
41
|
+
</Container>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Import styles
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import "@canceyd/react-npm-starter/styles/react-npm-starter.css";
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Components
|
|
53
|
+
|
|
54
|
+
### Button
|
|
55
|
+
|
|
56
|
+
A flexible button component that can render as either a `<button>` or `<a>` element.
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { Button } from "@canceyd/react-npm-starter/button";
|
|
60
|
+
|
|
61
|
+
<Button variant="default" size="default">Default</Button>
|
|
62
|
+
<Button variant="outline" size="sm">Outline</Button>
|
|
63
|
+
<Button href="/about" newTab>Link Button</Button>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Container
|
|
67
|
+
|
|
68
|
+
A responsive container component with size variants.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { Container } from "@canceyd/react-npm-starter/container";
|
|
72
|
+
|
|
73
|
+
<Container size="base">Content</Container>
|
|
74
|
+
<Container size="wide">Wide Content</Container>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Tree-Shaking
|
|
78
|
+
|
|
79
|
+
This package is optimized for tree-shaking. When you import individual components, only the code for those components will be included in your bundle.
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import { JSX } from 'react/jsx-runtime';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
export declare function Button({ className, variant, size, ...props }: ButtonProps): JSX.Element;
|
|
7
|
+
|
|
8
|
+
export declare type ButtonAsButtonProps = ButtonBaseProps & Omit<React.ComponentProps<"button">, keyof ButtonBaseProps> & {
|
|
9
|
+
href?: never;
|
|
10
|
+
newTab?: never;
|
|
11
|
+
isIcon?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export declare type ButtonAsLinkProps = ButtonBaseProps & Omit<React.ComponentProps<"a">, keyof ButtonBaseProps> & {
|
|
15
|
+
href: string;
|
|
16
|
+
newTab?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export declare type ButtonBaseProps = VariantProps<typeof buttonVariants> & {
|
|
20
|
+
icon?: React.ReactNode;
|
|
21
|
+
label?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export declare const buttonCva: {
|
|
25
|
+
readonly variants: {
|
|
26
|
+
readonly variant: {
|
|
27
|
+
readonly default: "bg-primary text-primary-foreground hover:bg-primary/80";
|
|
28
|
+
readonly outline: "border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs";
|
|
29
|
+
readonly secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground";
|
|
30
|
+
readonly ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground";
|
|
31
|
+
readonly destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30";
|
|
32
|
+
};
|
|
33
|
+
readonly size: {
|
|
34
|
+
readonly default: "h-9 gap-1.5 px-2.5 data-[icon=true]:size-8";
|
|
35
|
+
readonly xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs [&_svg:not([class*='size-'])]:size-3 data-[icon=true]:size-6";
|
|
36
|
+
readonly sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 data-[icon=true]:size-6 data-[icon=true]:size-7";
|
|
37
|
+
readonly lg: "h-10 gap-1.5 px-2.5 data-[icon=true]:size-9";
|
|
38
|
+
};
|
|
39
|
+
readonly isIcon: {
|
|
40
|
+
readonly true: "p-0";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly defaultVariants: {
|
|
44
|
+
readonly variant: "default";
|
|
45
|
+
readonly size: "default";
|
|
46
|
+
readonly loading: false;
|
|
47
|
+
readonly isIcon: false;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export declare function ButtonGroup({ className, ...props }: ComponentProps<"div">): JSX.Element;
|
|
52
|
+
|
|
53
|
+
export declare type ButtonProps = ButtonAsButtonProps | ButtonAsLinkProps;
|
|
54
|
+
|
|
55
|
+
export declare const buttonVariants: (props?: ({
|
|
56
|
+
readonly variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
57
|
+
readonly size?: "default" | "xs" | "sm" | "lg" | null | undefined;
|
|
58
|
+
readonly isIcon?: boolean | null | undefined;
|
|
59
|
+
} & ClassProp) | undefined) => string;
|
|
60
|
+
|
|
61
|
+
export { }
|
package/dist/button.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../lib/utils.js';
|
|
3
|
+
import { buttonVariants } from './variants/index.js';
|
|
4
|
+
|
|
5
|
+
function ButtonGroup({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
"data-slot": "button-group",
|
|
10
|
+
className: cn(
|
|
11
|
+
"relative flex flex-col items-center gap-2 sm:flex-row",
|
|
12
|
+
className
|
|
13
|
+
),
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function Button({ className, variant, size, ...props }) {
|
|
19
|
+
const isLink = "href" in props && props.href !== void 0;
|
|
20
|
+
if (isLink) {
|
|
21
|
+
const { href, newTab, ...linkProps } = props;
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
"a",
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "button-link",
|
|
26
|
+
"data-variant": variant,
|
|
27
|
+
href,
|
|
28
|
+
target: newTab ? "_blank" : void 0,
|
|
29
|
+
rel: newTab ? "noopener noreferrer" : void 0,
|
|
30
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
31
|
+
...linkProps
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
"button",
|
|
37
|
+
{
|
|
38
|
+
"data-slot": "button",
|
|
39
|
+
"data-variant": variant,
|
|
40
|
+
type: "button",
|
|
41
|
+
className: cn(buttonVariants({ variant, size }), className),
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { Button, ButtonGroup };
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/button/index.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { buttonVariants } from \"@/components/button/variants\";\nimport type {\n ButtonAsButtonProps,\n ButtonAsLinkProps,\n ButtonProps,\n} from \"@/components/button/types\";\n\nfunction ButtonGroup({ className, ...props }: ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"button-group\"\n className={cn(\n \"relative flex flex-col items-center gap-2 sm:flex-row\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Button({ className, variant, size, ...props }: ButtonProps) {\n // Determine if this should be a link based on href prop\n const isLink = \"href\" in props && props.href !== undefined;\n\n if (isLink) {\n const { href, newTab, ...linkProps } = props as ButtonAsLinkProps;\n return (\n <a\n data-slot=\"button-link\"\n data-variant={variant}\n href={href}\n target={newTab ? \"_blank\" : undefined}\n rel={newTab ? \"noopener noreferrer\" : undefined}\n className={cn(buttonVariants({ variant, size, className }))}\n {...linkProps}\n />\n );\n }\n\n return (\n <button\n data-slot=\"button\"\n data-variant={variant}\n type=\"button\"\n className={cn(buttonVariants({ variant, size }), className)}\n {...(props as ButtonAsButtonProps)}\n />\n );\n}\n\nexport { Button, ButtonGroup };\n"],"names":[],"mappings":";;;;AASA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAA0B;AACnE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,uDAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,OAAO,EAAE,SAAA,EAAW,SAAS,IAAA,EAAM,GAAG,OAAM,EAAgB;AAEnE,EAAA,MAAM,MAAA,GAAS,MAAA,IAAU,KAAA,IAAS,KAAA,CAAM,IAAA,KAAS,MAAA;AAEjD,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,MAAM,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,WAAU,GAAI,KAAA;AACvC,IAAA,uBACE,GAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACC,WAAA,EAAU,aAAA;AAAA,QACV,cAAA,EAAc,OAAA;AAAA,QACd,IAAA;AAAA,QACA,MAAA,EAAQ,SAAS,QAAA,GAAW,MAAA;AAAA,QAC5B,GAAA,EAAK,SAAS,qBAAA,GAAwB,MAAA;AAAA,QACtC,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAC,CAAA;AAAA,QACzD,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,QAAA;AAAA,MACV,cAAA,EAAc,OAAA;AAAA,MACd,IAAA,EAAK,QAAA;AAAA,MACL,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,SAAS,IAAA,EAAM,GAAG,SAAS,CAAA;AAAA,MACzD,GAAI;AAAA;AAAA,GACP;AAEJ;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cn } from '../../../lib/utils.js';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
|
|
4
|
+
const buttonCva = {
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
8
|
+
outline: "border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs",
|
|
9
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
10
|
+
ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
11
|
+
destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30"
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
default: "h-9 gap-1.5 px-2.5 data-[icon=true]:size-8",
|
|
15
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs [&_svg:not([class*='size-'])]:size-3 data-[icon=true]:size-6",
|
|
16
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 data-[icon=true]:size-6 data-[icon=true]:size-7",
|
|
17
|
+
lg: "h-10 gap-1.5 px-2.5 data-[icon=true]:size-9"
|
|
18
|
+
},
|
|
19
|
+
isIcon: {
|
|
20
|
+
true: "p-0"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: "default",
|
|
25
|
+
size: "default",
|
|
26
|
+
loading: false,
|
|
27
|
+
isIcon: false
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const buttonVariants = cva(
|
|
31
|
+
cn(
|
|
32
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none"
|
|
33
|
+
),
|
|
34
|
+
buttonCva
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export { buttonCva, buttonVariants };
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/button/variants/index.ts"],"sourcesContent":["import { cn } from \"@/lib/utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const buttonCva = {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n outline:\n \"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n ghost:\n \"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground\",\n destructive:\n \"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30\",\n },\n size: {\n default: \"h-9 gap-1.5 px-2.5 data-[icon=true]:size-8\",\n xs: \"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs [&_svg:not([class*='size-'])]:size-3 data-[icon=true]:size-6\",\n sm: \"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 data-[icon=true]:size-6 data-[icon=true]:size-7\",\n lg: \"h-10 gap-1.5 px-2.5 data-[icon=true]:size-9\",\n },\n isIcon: {\n true: \"p-0\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n loading: false,\n isIcon: false,\n },\n} as const;\n\nexport const buttonVariants = cva(\n cn(\n \"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none\",\n ),\n buttonCva,\n);\n"],"names":[],"mappings":";;;AAGO,MAAM,SAAA,GAAY;AAAA,EACvB,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,MACP,OAAA,EAAS,wDAAA;AAAA,MACT,OAAA,EACE,2LAAA;AAAA,MACF,SAAA,EACE,iIAAA;AAAA,MACF,KAAA,EACE,kHAAA;AAAA,MACF,WAAA,EACE;AAAA,KACJ;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,OAAA,EAAS,4CAAA;AAAA,MACT,EAAA,EAAI,yHAAA;AAAA,MACJ,EAAA,EAAI,uGAAA;AAAA,MACJ,EAAA,EAAI;AAAA,KACN;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,OAAA,EAAS,SAAA;AAAA,IACT,IAAA,EAAM,SAAA;AAAA,IACN,OAAA,EAAS,KAAA;AAAA,IACT,MAAA,EAAQ;AAAA;AAEZ;AAEO,MAAM,cAAA,GAAiB,GAAA;AAAA,EAC5B,EAAA;AAAA,IACE;AAAA,GACF;AAAA,EACA;AACF;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../lib/utils.js';
|
|
3
|
+
import { containerVariants } from './variants/index.js';
|
|
4
|
+
|
|
5
|
+
function Container({
|
|
6
|
+
size,
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
"data-slot": "container",
|
|
14
|
+
"data-size": size,
|
|
15
|
+
className: cn(containerVariants({ size }), className),
|
|
16
|
+
...props
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Container as default };
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/container/index.tsx"],"sourcesContent":["import { cn } from \"@/lib/utils\";\nimport { containerVariants } from \"@/components/container/variants\";\nimport type { VariantProps } from \"class-variance-authority\";\n\nexport default function Container({\n size,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof containerVariants>) {\n return (\n <div\n data-slot=\"container\"\n data-size={size}\n className={cn(containerVariants({ size }), className)}\n {...props}\n />\n );\n}\n"],"names":[],"mappings":";;;;AAIA,SAAwB,SAAA,CAAU;AAAA,EAChC,IAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAyE;AACvE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,WAAA;AAAA,MACV,WAAA,EAAW,IAAA;AAAA,MACX,WAAW,EAAA,CAAG,iBAAA,CAAkB,EAAE,IAAA,EAAM,GAAG,SAAS,CAAA;AAAA,MACnD,GAAG;AAAA;AAAA,GACN;AAEJ;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cn } from '../../../lib/utils.js';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
|
|
4
|
+
const containerCva = {
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
base: "max-w-[1280px]",
|
|
8
|
+
contained: "max-w-[1024px]",
|
|
9
|
+
wide: "max-w-[1645px]",
|
|
10
|
+
thin: "max-w-[980px]",
|
|
11
|
+
full: "max-w-full"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: "base"
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const containerVariants = cva(
|
|
19
|
+
cn("mx-auto w-full md:px-6 px-4"),
|
|
20
|
+
containerCva
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export { containerCva, containerVariants };
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/container/variants/index.ts"],"sourcesContent":["import { cn } from \"@/lib/utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const containerCva = {\n variants: {\n size: {\n base: \"max-w-[1280px]\",\n contained: \"max-w-[1024px]\",\n wide: \"max-w-[1645px]\",\n thin: \"max-w-[980px]\",\n full: \"max-w-full\",\n },\n },\n defaultVariants: {\n size: \"base\",\n },\n} as const;\n\nexport const containerVariants = cva(\n cn(\"mx-auto w-full md:px-6 px-4\"),\n containerCva,\n);\n"],"names":[],"mappings":";;;AAGO,MAAM,YAAA,GAAe;AAAA,EAC1B,QAAA,EAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,gBAAA;AAAA,MACN,SAAA,EAAW,gBAAA;AAAA,MACX,IAAA,EAAM,gBAAA;AAAA,MACN,IAAA,EAAM,eAAA;AAAA,MACN,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,IAAA,EAAM;AAAA;AAEV;AAEO,MAAM,iBAAA,GAAoB,GAAA;AAAA,EAC/B,GAAG,6BAA6B,CAAA;AAAA,EAChC;AACF;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import { JSX } from 'react/jsx-runtime';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
export declare function Container({ size, className, ...props }: React.ComponentProps<"div"> & VariantProps<typeof containerVariants>): JSX.Element;
|
|
7
|
+
|
|
8
|
+
export declare const containerCva: {
|
|
9
|
+
readonly variants: {
|
|
10
|
+
readonly size: {
|
|
11
|
+
readonly base: "max-w-[1280px]";
|
|
12
|
+
readonly contained: "max-w-[1024px]";
|
|
13
|
+
readonly wide: "max-w-[1645px]";
|
|
14
|
+
readonly thin: "max-w-[980px]";
|
|
15
|
+
readonly full: "max-w-full";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly defaultVariants: {
|
|
19
|
+
readonly size: "base";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export declare type ContainerProps = ComponentProps<"div"> & VariantProps<typeof containerVariants>;
|
|
24
|
+
|
|
25
|
+
export declare const containerVariants: (props?: ({
|
|
26
|
+
readonly size?: "base" | "contained" | "wide" | "thin" | "full" | null | undefined;
|
|
27
|
+
} & ClassProp) | undefined) => string;
|
|
28
|
+
|
|
29
|
+
export { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
2
|
+
import { ClassValue } from 'clsx';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
import { JSX } from 'react/jsx-runtime';
|
|
5
|
+
import { VariantProps } from 'class-variance-authority';
|
|
6
|
+
|
|
7
|
+
export declare function Button({ className, variant, size, ...props }: ButtonProps): JSX.Element;
|
|
8
|
+
|
|
9
|
+
declare type ButtonAsButtonProps = ButtonBaseProps & Omit<React.ComponentProps<"button">, keyof ButtonBaseProps> & {
|
|
10
|
+
href?: never;
|
|
11
|
+
newTab?: never;
|
|
12
|
+
isIcon?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
declare type ButtonAsLinkProps = ButtonBaseProps & Omit<React.ComponentProps<"a">, keyof ButtonBaseProps> & {
|
|
16
|
+
href: string;
|
|
17
|
+
newTab?: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
declare type ButtonBaseProps = VariantProps<typeof buttonVariants> & {
|
|
21
|
+
icon?: React.ReactNode;
|
|
22
|
+
label?: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export declare function ButtonGroup({ className, ...props }: ComponentProps<"div">): JSX.Element;
|
|
26
|
+
|
|
27
|
+
declare type ButtonProps = ButtonAsButtonProps | ButtonAsLinkProps;
|
|
28
|
+
|
|
29
|
+
declare const buttonVariants: (props?: ({
|
|
30
|
+
readonly variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
31
|
+
readonly size?: "default" | "xs" | "sm" | "lg" | null | undefined;
|
|
32
|
+
readonly isIcon?: boolean | null | undefined;
|
|
33
|
+
} & ClassProp) | undefined) => string;
|
|
34
|
+
|
|
35
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
36
|
+
|
|
37
|
+
export declare type ImageItem = ComponentProps<"img"> & {
|
|
38
|
+
src: string;
|
|
39
|
+
alt: string;
|
|
40
|
+
width?: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export declare type LinkItem = ComponentProps<"a"> & {
|
|
45
|
+
label?: string;
|
|
46
|
+
newTab?: boolean;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/lib/utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;;;;"}
|