shadcn-packaged 0.0.1 → 2025.1.18
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/README.md +95 -36
- package/index.css +3 -1
- package/package.json +9 -9
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025-present anuoua
|
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/README.md
CHANGED
@@ -1,50 +1,109 @@
|
|
1
|
-
#
|
1
|
+
# Shadcn Packaged
|
2
2
|
|
3
|
-
This
|
3
|
+
This is a npm package of all [shadcn/ui](https://ui.shadcn.com/) components without CLI for easy use.
|
4
4
|
|
5
|
-
|
5
|
+
It simply exports all the useful files with type declaration.
|
6
6
|
|
7
|
-
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
7
|
+
## Pre work
|
9
8
|
|
10
|
-
|
9
|
+
1. Create a new react project.
|
10
|
+
2. [Get started with Tailwind CSS](https://tailwindcss.com/docs/installation).
|
11
11
|
|
12
|
-
|
12
|
+
## Install
|
13
13
|
|
14
|
-
|
14
|
+
```shell
|
15
|
+
npm i tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react
|
16
|
+
npm i shadcn-packaged
|
17
|
+
```
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
## Configuation
|
20
|
+
|
21
|
+
tailwind.config.js
|
22
|
+
|
23
|
+
```javascript
|
24
|
+
const config = {
|
25
|
+
content: [
|
26
|
+
"...",
|
27
|
+
"./node_modules/shadcn-packaged/**/*.{jsx,js,ts,tsx}",
|
28
|
+
],
|
29
|
+
presets: [require("shadcn-packaged/tailwind.config")],
|
30
|
+
};
|
31
|
+
export default config;
|
26
32
|
```
|
27
33
|
|
28
|
-
|
29
|
-
- Optionally add `...tseslint.configs.stylisticTypeChecked`
|
30
|
-
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
|
34
|
+
next.config.js
|
31
35
|
|
32
|
-
```
|
33
|
-
|
34
|
-
|
36
|
+
```javascript
|
37
|
+
const nextConfig = {
|
38
|
+
// ...
|
39
|
+
transpilePackages: ["shadcn-packaged"],
|
40
|
+
};
|
35
41
|
|
36
|
-
export default
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
// Enable its recommended rules
|
46
|
-
...react.configs.recommended.rules,
|
47
|
-
...react.configs['jsx-runtime'].rules,
|
42
|
+
export default nextConfig;
|
43
|
+
```
|
44
|
+
|
45
|
+
vite.config.js [#optimizedeps-include](https://cn.vitejs.dev/config/dep-optimization-options.html#optimizedeps-include)
|
46
|
+
|
47
|
+
```javascript
|
48
|
+
export default defineConfig({
|
49
|
+
optimizeDeps: {
|
50
|
+
include: ['shadcn-packaged/**/*.{js,jsx,ts,tsx}'],
|
48
51
|
},
|
49
52
|
})
|
50
53
|
```
|
54
|
+
|
55
|
+
## Usage
|
56
|
+
|
57
|
+
Package Struct
|
58
|
+
|
59
|
+
- shadcn-packaged/ui/*: components
|
60
|
+
- shadcn-packaged/hooks/*: hooks
|
61
|
+
- shadcn-packaged/lib/utils: utils
|
62
|
+
|
63
|
+
Import style
|
64
|
+
|
65
|
+
> If you have a fully customized style in tailwindcss entry, you don't need to import it
|
66
|
+
|
67
|
+
```javascript
|
68
|
+
import "shadcn-packaged/index.css";
|
69
|
+
```
|
70
|
+
|
71
|
+
Import code
|
72
|
+
|
73
|
+
```javascript
|
74
|
+
import { Button } from 'shadcn-packaged/ui/button';
|
75
|
+
import { cn } from 'shadcn-packaged/lib/utils';
|
76
|
+
import { useToast } from 'shadcn/hooks/use-toast';
|
77
|
+
```
|
78
|
+
|
79
|
+
## Type declaration and IDE auto import
|
80
|
+
|
81
|
+
This package support vscode auto import, add below code to project main.tsx or root layout.tsx in NextJS
|
82
|
+
|
83
|
+
```typescript
|
84
|
+
/// <reference types="shadcn-packaged" />
|
85
|
+
```
|
86
|
+
|
87
|
+
## Custom Theme
|
88
|
+
|
89
|
+
index.css | global.css (the tailwindcss entry)
|
90
|
+
|
91
|
+
```css
|
92
|
+
@tailwind base;
|
93
|
+
@tailwind components;
|
94
|
+
@tailwind utilities;
|
95
|
+
|
96
|
+
@layer base {
|
97
|
+
:root {
|
98
|
+
/* theme here */
|
99
|
+
}
|
100
|
+
|
101
|
+
.dark {
|
102
|
+
/* theme here */
|
103
|
+
}
|
104
|
+
}
|
105
|
+
```
|
106
|
+
|
107
|
+
## License
|
108
|
+
|
109
|
+
MIT anuoua
|
package/index.css
CHANGED
package/package.json
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "shadcn-packaged",
|
3
3
|
"private": false,
|
4
|
-
"version": "
|
4
|
+
"version": "2025.1.18",
|
5
5
|
"type": "module",
|
6
6
|
"scripts": {
|
7
7
|
"dev": "vite",
|
8
8
|
"build": "npm run shadcn:clean && npm run shadcn:generate && npm run shadcn:tsc && npm run shadcn:move",
|
9
9
|
"shadcn:clean": "rm -rf lib ui hooks dist ~shadcn-packaged/hooks ~shadcn-packaged/ui",
|
10
10
|
"shadcn:generate": "npx shadcn@latest add -a -y -o && node ./modify.mjs",
|
11
|
-
"shadcn:tsc": "tsc -p tsconfig.json && node ./types.mjs",
|
12
|
-
"shadcn:
|
13
|
-
"
|
11
|
+
"shadcn:tsc": "npm run shadcn:tsc:preinstall && tsc -p tsconfig.json && node ./types.mjs",
|
12
|
+
"shadcn:tsc:preinstall": "npm install -D tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react",
|
13
|
+
"shadcn:move": "mv dist/* ./"
|
14
14
|
},
|
15
15
|
"types": "index.d.ts",
|
16
16
|
"files": [
|
@@ -50,21 +50,16 @@
|
|
50
50
|
"@radix-ui/react-toggle": "^1.1.1",
|
51
51
|
"@radix-ui/react-toggle-group": "^1.1.1",
|
52
52
|
"@radix-ui/react-tooltip": "^1.1.6",
|
53
|
-
"class-variance-authority": "^0.7.1",
|
54
|
-
"clsx": "^2.1.1",
|
55
53
|
"cmdk": "^1.0.0",
|
56
54
|
"date-fns": "^4.1.0",
|
57
55
|
"embla-carousel-react": "^8.5.2",
|
58
56
|
"input-otp": "^1.4.2",
|
59
|
-
"lucide-react": "^0.473.0",
|
60
57
|
"next-themes": "^0.4.4",
|
61
58
|
"react-day-picker": "^8.10.1",
|
62
59
|
"react-hook-form": "^7.54.2",
|
63
60
|
"react-resizable-panels": "^2.1.7",
|
64
61
|
"recharts": "^2.15.0",
|
65
62
|
"sonner": "^1.7.2",
|
66
|
-
"tailwind-merge": "^2.6.0",
|
67
|
-
"tailwindcss-animate": "^1.0.7",
|
68
63
|
"vaul": "^1.1.2",
|
69
64
|
"zod": "^3.24.1"
|
70
65
|
},
|
@@ -72,8 +67,13 @@
|
|
72
67
|
"@types/node": "^22.10.7",
|
73
68
|
"@types/react": "^18.3.18",
|
74
69
|
"@types/react-dom": "^18.3.5",
|
70
|
+
"class-variance-authority": "^0.7.1",
|
71
|
+
"clsx": "^2.1.1",
|
75
72
|
"globals": "^15.14.0",
|
73
|
+
"lucide-react": "^0.473.0",
|
74
|
+
"tailwind-merge": "^2.6.0",
|
76
75
|
"tailwindcss": "^3.4.17",
|
76
|
+
"tailwindcss-animate": "^1.0.7",
|
77
77
|
"typescript": "~5.6.2"
|
78
78
|
}
|
79
79
|
}
|