@tan-ahmed/tan-ui-kit 0.1.7 → 0.1.9
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 +18 -44
- package/dist/components/ui/button.d.ts.map +1 -1
- package/package.json +6 -2
- package/src/components/ui/button.tsx +53 -0
- package/src/index.ts +6 -0
- package/src/lib/utils.ts +6 -0
package/README.md
CHANGED
|
@@ -31,32 +31,11 @@ npm install @tan-ahmed/tan-ui-kit
|
|
|
31
31
|
|
|
32
32
|
See [INSTALLATION_TROUBLESHOOTING.md](./INSTALLATION_TROUBLESHOOTING.md) for more details.
|
|
33
33
|
|
|
34
|
-
##
|
|
35
|
-
|
|
36
|
-
This package requires the following peer dependencies:
|
|
37
|
-
|
|
38
|
-
- `react`: ^18.0.0 || ^19.0.0
|
|
39
|
-
- `react-dom`: ^18.0.0 || ^19.0.0
|
|
40
|
-
|
|
41
|
-
All other dependencies (base-ui, class-variance-authority, clsx, tailwind-merge) are bundled with the library, so you don't need to install them separately.
|
|
42
|
-
|
|
43
|
-
## Setup
|
|
44
|
-
|
|
45
|
-
### 1. Configure Tailwind CSS v4
|
|
46
|
-
|
|
47
|
-
This package uses **Tailwind CSS v4**. In your main CSS file (e.g., `src/index.css` or `src/main.css`), add:
|
|
48
|
-
|
|
49
|
-
```css
|
|
50
|
-
@import "tailwindcss";
|
|
51
|
-
|
|
52
|
-
/* Your other styles... */
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**That's it!** The package includes pre-generated CSS with all utility classes, so no additional configuration is needed.
|
|
34
|
+
## Usage
|
|
56
35
|
|
|
57
|
-
###
|
|
36
|
+
### 1. Import styles in your entry file
|
|
58
37
|
|
|
59
|
-
|
|
38
|
+
Import the styles once in your main entry point file:
|
|
60
39
|
|
|
61
40
|
- **React (Vite/CRA)**: `src/main.tsx` or `src/index.tsx`
|
|
62
41
|
- **Next.js (App Router)**: `app/layout.tsx` or `app/page.tsx`
|
|
@@ -66,20 +45,14 @@ This package uses **Tailwind CSS v4**. In your main CSS file (e.g., `src/index.c
|
|
|
66
45
|
|
|
67
46
|
```tsx
|
|
68
47
|
// In your main entry point file (e.g., src/main.tsx, app.tsx, etc.)
|
|
69
|
-
import "@tan-ahmed/tan-ui-kit/styles";
|
|
70
|
-
import { Button } from "@tan-ahmed/tan-ui-kit";
|
|
71
|
-
|
|
72
|
-
function App() {
|
|
73
|
-
return <Button variant="destructive">Click me</Button>;
|
|
74
|
-
}
|
|
48
|
+
import "@tan-ahmed/tan-ui-kit/styles";
|
|
75
49
|
```
|
|
76
50
|
|
|
77
|
-
|
|
51
|
+
### 2. Use components anywhere
|
|
78
52
|
|
|
79
|
-
|
|
53
|
+
After importing the styles, you can use components anywhere in your app:
|
|
80
54
|
|
|
81
55
|
```tsx
|
|
82
|
-
// In your component files, you only need to import the component
|
|
83
56
|
import { Button } from "@tan-ahmed/tan-ui-kit";
|
|
84
57
|
|
|
85
58
|
function MyComponent() {
|
|
@@ -87,20 +60,21 @@ function MyComponent() {
|
|
|
87
60
|
}
|
|
88
61
|
```
|
|
89
62
|
|
|
90
|
-
|
|
63
|
+
### Next.js App Router
|
|
91
64
|
|
|
92
|
-
|
|
93
|
-
# Install dependencies
|
|
94
|
-
pnpm install
|
|
95
|
-
|
|
96
|
-
# Start dev server
|
|
97
|
-
pnpm dev
|
|
65
|
+
This library is fully compatible with Next.js App Router. Components are automatically marked as Client Components, so you don't need to add `"use client"` directives when importing them:
|
|
98
66
|
|
|
99
|
-
|
|
100
|
-
|
|
67
|
+
```tsx
|
|
68
|
+
// app/page.tsx - No "use client" needed!
|
|
69
|
+
import { Button } from "@tan-ahmed/tan-ui-kit";
|
|
101
70
|
|
|
102
|
-
|
|
103
|
-
|
|
71
|
+
export default function Home() {
|
|
72
|
+
return (
|
|
73
|
+
<div>
|
|
74
|
+
<Button variant="destructive">Click me</Button>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
104
78
|
```
|
|
105
79
|
|
|
106
80
|
## License
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,cAAc;;;8EA4BnB,CAAA;AAED,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAmB,EACnB,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,2CAQ7D;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tan-ahmed/tan-ui-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "A React component library built with Tailwind CSS v4 and base-ui components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/tan-ui-kit.es.js",
|
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
|
-
"dist"
|
|
20
|
+
"dist",
|
|
21
|
+
"src/components",
|
|
22
|
+
"src/lib",
|
|
23
|
+
"src/index.ts",
|
|
24
|
+
"README.md"
|
|
21
25
|
],
|
|
22
26
|
"repository": {
|
|
23
27
|
"type": "git",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button"
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
const buttonVariants = cva(
|
|
9
|
+
"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",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
14
|
+
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",
|
|
15
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
16
|
+
ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
17
|
+
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",
|
|
18
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
22
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
23
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
24
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
25
|
+
icon: "size-9",
|
|
26
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
27
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
28
|
+
"icon-lg": "size-10",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
variant: "default",
|
|
33
|
+
size: "default",
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
function Button({
|
|
39
|
+
className,
|
|
40
|
+
variant = "default",
|
|
41
|
+
size = "default",
|
|
42
|
+
...props
|
|
43
|
+
}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
|
|
44
|
+
return (
|
|
45
|
+
<ButtonPrimitive
|
|
46
|
+
data-slot="button"
|
|
47
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { Button, buttonVariants }
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Note: index.css is NOT imported here - it's pre-generated during build
|
|
2
|
+
// The CSS is included in dist/tan-ui-kit.css via the build:css script
|
|
3
|
+
|
|
4
|
+
// Export shadcn button
|
|
5
|
+
export { Button, buttonVariants } from "./components/ui/button";
|
|
6
|
+
// export type { ButtonProps } from "./components/ui/button";
|