tokka-ui 0.1.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/LICENSE +21 -0
- package/dist/button.d.ts +15 -0
- package/dist/button.js +56 -0
- package/dist/card.d.ts +10 -0
- package/dist/card.js +67 -0
- package/dist/chunk-RQHJBTEU.js +10 -0
- package/dist/input.d.ts +9 -0
- package/dist/input.js +47 -0
- package/package.json +66 -0
- package/src/button.tsx +56 -0
- package/src/card.tsx +74 -0
- package/src/input.tsx +48 -0
- package/src/lib/utils.ts +6 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tokka contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const buttonVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
7
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
|
|
15
|
+
export { Button, type ButtonProps, buttonVariants };
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-RQHJBTEU.js";
|
|
4
|
+
|
|
5
|
+
// src/button.tsx
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
8
|
+
import { cva } from "class-variance-authority";
|
|
9
|
+
import { jsxs } from "react/jsx-runtime";
|
|
10
|
+
var buttonVariants = cva(
|
|
11
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
variant: {
|
|
15
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
16
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
17
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
18
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
19
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
20
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: "h-10 px-4 py-2",
|
|
24
|
+
sm: "h-9 rounded-md px-3",
|
|
25
|
+
lg: "h-11 rounded-md px-8",
|
|
26
|
+
icon: "size-10"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: "default",
|
|
31
|
+
size: "default"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
var Button = React.forwardRef(
|
|
36
|
+
({ className, variant, size, asChild = false, icon, children, ...props }, ref) => {
|
|
37
|
+
const Comp = asChild ? Slot : "button";
|
|
38
|
+
return /* @__PURE__ */ jsxs(
|
|
39
|
+
Comp,
|
|
40
|
+
{
|
|
41
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
42
|
+
ref,
|
|
43
|
+
...props,
|
|
44
|
+
children: [
|
|
45
|
+
icon,
|
|
46
|
+
children
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
Button.displayName = "Button";
|
|
53
|
+
export {
|
|
54
|
+
Button,
|
|
55
|
+
buttonVariants
|
|
56
|
+
};
|
package/dist/card.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
6
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
7
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
|
|
10
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
package/dist/card.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-RQHJBTEU.js";
|
|
4
|
+
|
|
5
|
+
// src/card.tsx
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var Card = React.forwardRef(
|
|
9
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
ref,
|
|
13
|
+
className: cn(
|
|
14
|
+
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
15
|
+
className
|
|
16
|
+
),
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
Card.displayName = "Card";
|
|
22
|
+
var CardHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
ref,
|
|
26
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
27
|
+
...props
|
|
28
|
+
}
|
|
29
|
+
));
|
|
30
|
+
CardHeader.displayName = "CardHeader";
|
|
31
|
+
var CardTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
32
|
+
"h3",
|
|
33
|
+
{
|
|
34
|
+
ref,
|
|
35
|
+
className: cn("text-2xl font-semibold leading-none tracking-tight", className),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
));
|
|
39
|
+
CardTitle.displayName = "CardTitle";
|
|
40
|
+
var CardDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
41
|
+
"p",
|
|
42
|
+
{
|
|
43
|
+
ref,
|
|
44
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
));
|
|
48
|
+
CardDescription.displayName = "CardDescription";
|
|
49
|
+
var CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
50
|
+
CardContent.displayName = "CardContent";
|
|
51
|
+
var CardFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
ref,
|
|
55
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
56
|
+
...props
|
|
57
|
+
}
|
|
58
|
+
));
|
|
59
|
+
CardFooter.displayName = "CardFooter";
|
|
60
|
+
export {
|
|
61
|
+
Card,
|
|
62
|
+
CardContent,
|
|
63
|
+
CardDescription,
|
|
64
|
+
CardFooter,
|
|
65
|
+
CardHeader,
|
|
66
|
+
CardTitle
|
|
67
|
+
};
|
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
trailing?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
8
|
+
|
|
9
|
+
export { Input, type InputProps };
|
package/dist/input.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-RQHJBTEU.js";
|
|
4
|
+
|
|
5
|
+
// src/input.tsx
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
var Input = React.forwardRef(
|
|
9
|
+
({ className, type, icon, trailing, ...props }, ref) => {
|
|
10
|
+
if (icon || trailing) {
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative flex items-center", children: [
|
|
12
|
+
icon && /* @__PURE__ */ jsx("span", { className: "absolute left-3 text-muted-foreground", children: icon }),
|
|
13
|
+
/* @__PURE__ */ jsx(
|
|
14
|
+
"input",
|
|
15
|
+
{
|
|
16
|
+
type,
|
|
17
|
+
className: cn(
|
|
18
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
19
|
+
icon && "pl-10",
|
|
20
|
+
trailing && "pr-10",
|
|
21
|
+
className
|
|
22
|
+
),
|
|
23
|
+
ref,
|
|
24
|
+
...props
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
trailing && /* @__PURE__ */ jsx("span", { className: "absolute right-3 text-muted-foreground", children: trailing })
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
"input",
|
|
32
|
+
{
|
|
33
|
+
type,
|
|
34
|
+
className: cn(
|
|
35
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
ref,
|
|
39
|
+
...props
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
Input.displayName = "Input";
|
|
45
|
+
export {
|
|
46
|
+
Input
|
|
47
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tokka-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "React UI components for tokka with design token support",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"react",
|
|
8
|
+
"ui-components",
|
|
9
|
+
"design-system",
|
|
10
|
+
"tailwind",
|
|
11
|
+
"radix-ui"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/ccwilson10/tokka#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/ccwilson10/tokka/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/ccwilson10/tokka.git",
|
|
20
|
+
"directory": "packages/ui"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"author": "tokka contributors",
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"exports": {
|
|
26
|
+
"./button": {
|
|
27
|
+
"types": "./dist/button.d.ts",
|
|
28
|
+
"default": "./dist/button.js"
|
|
29
|
+
},
|
|
30
|
+
"./card": {
|
|
31
|
+
"types": "./dist/card.d.ts",
|
|
32
|
+
"default": "./dist/card.js"
|
|
33
|
+
},
|
|
34
|
+
"./input": {
|
|
35
|
+
"types": "./dist/input.d.ts",
|
|
36
|
+
"default": "./dist/input.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"src"
|
|
42
|
+
],
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"react": "^18.2.0 || ^19.0.0",
|
|
45
|
+
"react-dom": "^18.2.0 || ^19.0.0"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@radix-ui/react-slot": "^1.0.2",
|
|
49
|
+
"class-variance-authority": "^0.7.0",
|
|
50
|
+
"clsx": "^2.1.0",
|
|
51
|
+
"tailwind-merge": "^2.2.1"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/react": "^18.2.65",
|
|
55
|
+
"@types/react-dom": "^18.2.22",
|
|
56
|
+
"react": "^18.2.0",
|
|
57
|
+
"react-dom": "^18.2.0",
|
|
58
|
+
"tsup": "^8.0.2",
|
|
59
|
+
"typescript": "^5.3.3"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsup src/*.tsx --format esm --dts --clean --external react",
|
|
63
|
+
"dev": "tsup src/*.tsx --format esm --dts --watch --external react",
|
|
64
|
+
"typecheck": "tsc --noEmit"
|
|
65
|
+
}
|
|
66
|
+
}
|
package/src/button.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
import { cn } from "./lib/utils"
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva(
|
|
7
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
12
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
13
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
14
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
15
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
16
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
default: "h-10 px-4 py-2",
|
|
20
|
+
sm: "h-9 rounded-md px-3",
|
|
21
|
+
lg: "h-11 rounded-md px-8",
|
|
22
|
+
icon: "size-10",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: "default",
|
|
27
|
+
size: "default",
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
export interface ButtonProps
|
|
33
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
34
|
+
VariantProps<typeof buttonVariants> {
|
|
35
|
+
asChild?: boolean
|
|
36
|
+
icon?: React.ReactNode
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
40
|
+
({ className, variant, size, asChild = false, icon, children, ...props }, ref) => {
|
|
41
|
+
const Comp = asChild ? Slot : "button"
|
|
42
|
+
return (
|
|
43
|
+
<Comp
|
|
44
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
45
|
+
ref={ref}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
{icon}
|
|
49
|
+
{children}
|
|
50
|
+
</Comp>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
Button.displayName = "Button"
|
|
55
|
+
|
|
56
|
+
export { Button, buttonVariants }
|
package/src/card.tsx
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "./lib/utils"
|
|
3
|
+
|
|
4
|
+
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
5
|
+
({ className, ...props }, ref) => (
|
|
6
|
+
<div
|
|
7
|
+
ref={ref}
|
|
8
|
+
className={cn(
|
|
9
|
+
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
10
|
+
className
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
)
|
|
16
|
+
Card.displayName = "Card"
|
|
17
|
+
|
|
18
|
+
const CardHeader = React.forwardRef<
|
|
19
|
+
HTMLDivElement,
|
|
20
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
21
|
+
>(({ className, ...props }, ref) => (
|
|
22
|
+
<div
|
|
23
|
+
ref={ref}
|
|
24
|
+
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
))
|
|
28
|
+
CardHeader.displayName = "CardHeader"
|
|
29
|
+
|
|
30
|
+
const CardTitle = React.forwardRef<
|
|
31
|
+
HTMLParagraphElement,
|
|
32
|
+
React.HTMLAttributes<HTMLHeadingElement>
|
|
33
|
+
>(({ className, ...props }, ref) => (
|
|
34
|
+
<h3
|
|
35
|
+
ref={ref}
|
|
36
|
+
className={cn("text-2xl font-semibold leading-none tracking-tight", className)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
))
|
|
40
|
+
CardTitle.displayName = "CardTitle"
|
|
41
|
+
|
|
42
|
+
const CardDescription = React.forwardRef<
|
|
43
|
+
HTMLParagraphElement,
|
|
44
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
45
|
+
>(({ className, ...props }, ref) => (
|
|
46
|
+
<p
|
|
47
|
+
ref={ref}
|
|
48
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
))
|
|
52
|
+
CardDescription.displayName = "CardDescription"
|
|
53
|
+
|
|
54
|
+
const CardContent = React.forwardRef<
|
|
55
|
+
HTMLDivElement,
|
|
56
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
57
|
+
>(({ className, ...props }, ref) => (
|
|
58
|
+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
|
59
|
+
))
|
|
60
|
+
CardContent.displayName = "CardContent"
|
|
61
|
+
|
|
62
|
+
const CardFooter = React.forwardRef<
|
|
63
|
+
HTMLDivElement,
|
|
64
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
65
|
+
>(({ className, ...props }, ref) => (
|
|
66
|
+
<div
|
|
67
|
+
ref={ref}
|
|
68
|
+
className={cn("flex items-center p-6 pt-0", className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
))
|
|
72
|
+
CardFooter.displayName = "CardFooter"
|
|
73
|
+
|
|
74
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|
package/src/input.tsx
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "./lib/utils"
|
|
3
|
+
|
|
4
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
5
|
+
icon?: React.ReactNode
|
|
6
|
+
trailing?: React.ReactNode
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
10
|
+
({ className, type, icon, trailing, ...props }, ref) => {
|
|
11
|
+
if (icon || trailing) {
|
|
12
|
+
return (
|
|
13
|
+
<div className="relative flex items-center">
|
|
14
|
+
{icon && <span className="absolute left-3 text-muted-foreground">{icon}</span>}
|
|
15
|
+
<input
|
|
16
|
+
type={type}
|
|
17
|
+
className={cn(
|
|
18
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
19
|
+
icon && "pl-10",
|
|
20
|
+
trailing && "pr-10",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
ref={ref}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
{trailing && (
|
|
27
|
+
<span className="absolute right-3 text-muted-foreground">{trailing}</span>
|
|
28
|
+
)}
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<input
|
|
35
|
+
type={type}
|
|
36
|
+
className={cn(
|
|
37
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
38
|
+
className
|
|
39
|
+
)}
|
|
40
|
+
ref={ref}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
Input.displayName = "Input"
|
|
47
|
+
|
|
48
|
+
export { Input }
|