shadcn-packaged 0.0.0 → 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 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
- # React + TypeScript + Vite
1
+ # Shadcn Packaged
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ This is a npm package of all [shadcn/ui](https://ui.shadcn.com/) components without CLI for easy use.
4
4
 
5
- Currently, two official plugins are available:
5
+ It simply exports all the useful files with type declaration.
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
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
- ## Expanding the ESLint configuration
9
+ 1. Create a new react project.
10
+ 2. [Get started with Tailwind CSS](https://tailwindcss.com/docs/installation).
11
11
 
12
- If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
12
+ ## Install
13
13
 
14
- - Configure the top-level `parserOptions` property like this:
14
+ ```shell
15
+ npm i tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react
16
+ npm i shadcn-packaged
17
+ ```
15
18
 
16
- ```js
17
- export default tseslint.config({
18
- languageOptions: {
19
- // other options...
20
- parserOptions: {
21
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
22
- tsconfigRootDir: import.meta.dirname,
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
- - Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
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
- ```js
33
- // eslint.config.js
34
- import react from 'eslint-plugin-react'
36
+ ```javascript
37
+ const nextConfig = {
38
+ // ...
39
+ transpilePackages: ["shadcn-packaged"],
40
+ };
35
41
 
36
- export default tseslint.config({
37
- // Set the react version
38
- settings: { react: { version: '18.3' } },
39
- plugins: {
40
- // Add the react plugin
41
- react,
42
- },
43
- rules: {
44
- // other rules...
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 ADDED
@@ -0,0 +1,149 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @layer base {
6
+ :root {
7
+
8
+ --background: 0 0% 100%;
9
+
10
+ --foreground: 0 0% 3.9%;
11
+
12
+ --card: 0 0% 100%;
13
+
14
+ --card-foreground: 0 0% 3.9%;
15
+
16
+ --popover: 0 0% 100%;
17
+
18
+ --popover-foreground: 0 0% 3.9%;
19
+
20
+ --primary: 0 0% 9%;
21
+
22
+ --primary-foreground: 0 0% 98%;
23
+
24
+ --secondary: 0 0% 96.1%;
25
+
26
+ --secondary-foreground: 0 0% 9%;
27
+
28
+ --muted: 0 0% 96.1%;
29
+
30
+ --muted-foreground: 0 0% 45.1%;
31
+
32
+ --accent: 0 0% 96.1%;
33
+
34
+ --accent-foreground: 0 0% 9%;
35
+
36
+ --destructive: 0 84.2% 60.2%;
37
+
38
+ --destructive-foreground: 0 0% 98%;
39
+
40
+ --border: 0 0% 89.8%;
41
+
42
+ --input: 0 0% 89.8%;
43
+
44
+ --ring: 0 0% 3.9%;
45
+
46
+ --chart-1: 12 76% 61%;
47
+
48
+ --chart-2: 173 58% 39%;
49
+
50
+ --chart-3: 197 37% 24%;
51
+
52
+ --chart-4: 43 74% 66%;
53
+
54
+ --chart-5: 27 87% 67%;
55
+
56
+ --radius: 0.5rem;
57
+
58
+ --sidebar-background: 0 0% 98%;
59
+
60
+ --sidebar-foreground: 240 5.3% 26.1%;
61
+
62
+ --sidebar-primary: 240 5.9% 10%;
63
+
64
+ --sidebar-primary-foreground: 0 0% 98%;
65
+
66
+ --sidebar-accent: 240 4.8% 95.9%;
67
+
68
+ --sidebar-accent-foreground: 240 5.9% 10%;
69
+
70
+ --sidebar-border: 220 13% 91%;
71
+
72
+ --sidebar-ring: 217.2 91.2% 59.8%}
73
+
74
+ .dark {
75
+
76
+ --background: 0 0% 3.9%;
77
+
78
+ --foreground: 0 0% 98%;
79
+
80
+ --card: 0 0% 3.9%;
81
+
82
+ --card-foreground: 0 0% 98%;
83
+
84
+ --popover: 0 0% 3.9%;
85
+
86
+ --popover-foreground: 0 0% 98%;
87
+
88
+ --primary: 0 0% 98%;
89
+
90
+ --primary-foreground: 0 0% 9%;
91
+
92
+ --secondary: 0 0% 14.9%;
93
+
94
+ --secondary-foreground: 0 0% 98%;
95
+
96
+ --muted: 0 0% 14.9%;
97
+
98
+ --muted-foreground: 0 0% 63.9%;
99
+
100
+ --accent: 0 0% 14.9%;
101
+
102
+ --accent-foreground: 0 0% 98%;
103
+
104
+ --destructive: 0 62.8% 30.6%;
105
+
106
+ --destructive-foreground: 0 0% 98%;
107
+
108
+ --border: 0 0% 14.9%;
109
+
110
+ --input: 0 0% 14.9%;
111
+
112
+ --ring: 0 0% 83.1%;
113
+
114
+ --chart-1: 220 70% 50%;
115
+
116
+ --chart-2: 160 60% 45%;
117
+
118
+ --chart-3: 30 80% 55%;
119
+
120
+ --chart-4: 280 65% 60%;
121
+
122
+ --chart-5: 340 75% 55%;
123
+
124
+ --sidebar-background: 240 5.9% 10%;
125
+
126
+ --sidebar-foreground: 240 4.8% 95.9%;
127
+
128
+ --sidebar-primary: 224.3 76.3% 48%;
129
+
130
+ --sidebar-primary-foreground: 0 0% 100%;
131
+
132
+ --sidebar-accent: 240 3.7% 15.9%;
133
+
134
+ --sidebar-accent-foreground: 240 4.8% 95.9%;
135
+
136
+ --sidebar-border: 240 3.7% 15.9%;
137
+
138
+ --sidebar-ring: 217.2 91.2% 59.8%}
139
+ }
140
+
141
+ @layer base {
142
+ * {
143
+ @apply border-border;
144
+ }
145
+
146
+ body {
147
+ @apply bg-background text-foreground;
148
+ }
149
+ }
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "shadcn-packaged",
3
3
  "private": false,
4
- "version": "0.0.0",
4
+ "version": "2025.1.18",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
- "build": "npm run shadcn:generate && npm run shadcn:tsc && npm run shadcn:move",
8
+ "build": "npm run shadcn:clean && npm run shadcn:generate && npm run shadcn:tsc && npm run shadcn:move",
9
+ "shadcn:clean": "rm -rf lib ui hooks dist ~shadcn-packaged/hooks ~shadcn-packaged/ui",
9
10
  "shadcn:generate": "npx shadcn@latest add -a -y -o && node ./modify.mjs",
10
- "shadcn:tsc": "tsc -p tsconfig.json && node ./types.mjs",
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",
11
13
  "shadcn:move": "mv dist/* ./"
12
14
  },
13
15
  "types": "index.d.ts",
@@ -16,7 +18,8 @@
16
18
  "hooks",
17
19
  "lib",
18
20
  "index.d.ts",
19
- "tailwind.config.js"
21
+ "tailwind.config.js",
22
+ "index.css"
20
23
  ],
21
24
  "dependencies": {
22
25
  "@hookform/resolvers": "^3.10.0",
@@ -47,21 +50,16 @@
47
50
  "@radix-ui/react-toggle": "^1.1.1",
48
51
  "@radix-ui/react-toggle-group": "^1.1.1",
49
52
  "@radix-ui/react-tooltip": "^1.1.6",
50
- "class-variance-authority": "^0.7.1",
51
- "clsx": "^2.1.1",
52
53
  "cmdk": "^1.0.0",
53
54
  "date-fns": "^4.1.0",
54
55
  "embla-carousel-react": "^8.5.2",
55
56
  "input-otp": "^1.4.2",
56
- "lucide-react": "^0.473.0",
57
57
  "next-themes": "^0.4.4",
58
58
  "react-day-picker": "^8.10.1",
59
59
  "react-hook-form": "^7.54.2",
60
60
  "react-resizable-panels": "^2.1.7",
61
61
  "recharts": "^2.15.0",
62
62
  "sonner": "^1.7.2",
63
- "tailwind-merge": "^2.6.0",
64
- "tailwindcss-animate": "^1.0.7",
65
63
  "vaul": "^1.1.2",
66
64
  "zod": "^3.24.1"
67
65
  },
@@ -69,8 +67,13 @@
69
67
  "@types/node": "^22.10.7",
70
68
  "@types/react": "^18.3.18",
71
69
  "@types/react-dom": "^18.3.5",
70
+ "class-variance-authority": "^0.7.1",
71
+ "clsx": "^2.1.1",
72
72
  "globals": "^15.14.0",
73
+ "lucide-react": "^0.473.0",
74
+ "tailwind-merge": "^2.6.0",
73
75
  "tailwindcss": "^3.4.17",
76
+ "tailwindcss-animate": "^1.0.7",
74
77
  "typescript": "~5.6.2"
75
78
  }
76
79
  }
@@ -1,7 +1,7 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
2
  module.exports = {
3
3
  darkMode: ["class"],
4
- content: ["./index.html", "./src/**/*.{ts,tsx,js,jsx}", "./~shadcn-packaged/**/*.{ts,tsx,js,jsx}"],
4
+ content: ["./**/*.{ts,tsx,js,jsx}"],
5
5
  theme: {
6
6
  extend: {
7
7
  borderRadius: {