@neoptocom/neopto-ui 0.5.1 → 0.5.2

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/CONSUMER_SETUP.md CHANGED
@@ -6,7 +6,7 @@ This component library uses **Tailwind CSS v4 utility classes** directly in the
6
6
 
7
7
  ---
8
8
 
9
- ## šŸ“¦ Quick Setup (Recommended)
9
+ ## šŸ“¦ Installation
10
10
 
11
11
  ### Step 1: Install dependencies
12
12
 
@@ -15,20 +15,39 @@ npm install @neoptocom/neopto-ui
15
15
  npm install -D tailwindcss@latest @tailwindcss/postcss
16
16
  ```
17
17
 
18
- ### Step 2: Run the init command
18
+ ### Step 2: Configure PostCSS
19
19
 
20
- After installing the package, run:
20
+ Create `postcss.config.js` in your project root:
21
21
 
22
- ```bash
23
- npx neopto-ui
22
+ ```js
23
+ export default {
24
+ plugins: {
25
+ "@tailwindcss/postcss": {},
26
+ },
27
+ };
24
28
  ```
25
29
 
26
- This will automatically:
27
- - āœ… Create `postcss.config.js` if needed
28
- - āœ… Update your CSS file with required imports
29
- - āœ… Configure Tailwind to scan the library components
30
+ ### Step 3: Setup your CSS file
30
31
 
31
- ### Step 3: Use the components!
32
+ In your main CSS file (e.g., `src/index.css`):
33
+
34
+ ```css
35
+ @import "tailwindcss";
36
+
37
+ /* Scan the component library source files */
38
+ @source "../node_modules/@neoptocom/neopto-ui/src";
39
+
40
+ /* Import library tokens and styles */
41
+ @import "@neoptocom/neopto-ui/styles";
42
+ ```
43
+
44
+ Then import your CSS in `src/main.tsx`:
45
+
46
+ ```tsx
47
+ import "./index.css";
48
+ ```
49
+
50
+ ### Step 4: Use the components!
32
51
 
33
52
  ```tsx
34
53
  import { Button, Input, Typo } from "@neoptocom/neopto-ui";
@@ -75,51 +94,9 @@ document.documentElement.classList.toggle("dark");
75
94
  - `Chip` - Tags and labels
76
95
  - `Modal` - Dialog modals
77
96
  - `Skeleton` - Loading placeholders
78
-
79
- ---
80
-
81
- ## šŸ› ļø Manual Setup (Alternative)
82
-
83
- If you prefer to set up manually or the init script didn't work:
84
-
85
- ### Step 1: Install dependencies
86
-
87
- ```bash
88
- npm install @neoptocom/neopto-ui
89
- npm install -D tailwindcss@latest @tailwindcss/postcss
90
- ```
91
-
92
- ### Step 2: Configure PostCSS
93
-
94
- Create `postcss.config.js` in your project root:
95
-
96
- ```js
97
- export default {
98
- plugins: {
99
- "@tailwindcss/postcss": {},
100
- },
101
- };
102
- ```
103
-
104
- ### Step 3: Setup your CSS file
105
-
106
- In your main CSS file (e.g., `src/index.css`):
107
-
108
- ```css
109
- @import "tailwindcss";
110
-
111
- /* Scan the component library source files */
112
- @source "../node_modules/@neoptocom/neopto-ui/src";
113
-
114
- /* Import library tokens and styles */
115
- @import "@neoptocom/neopto-ui/styles";
116
- ```
117
-
118
- Then import your CSS in `src/main.tsx`:
119
-
120
- ```tsx
121
- import "./index.css";
122
- ```
97
+ - `Counter` - Number stepper
98
+ - `IconButton` - Icon-only buttons
99
+ - `ChatButton` - Animated chat button
123
100
 
124
101
  ---
125
102
 
@@ -131,9 +108,9 @@ import "./index.css";
131
108
 
132
109
  **Solution:** Make sure you:
133
110
 
134
- 1. āœ… Imported the library CSS: `import '@neoptocom/neopto-ui/styles'`
135
- 2. āœ… Added the library path to `tailwind.config.js` content array
136
- 3. āœ… Have Tailwind CSS installed and configured
111
+ 1. āœ… Imported the library CSS: `@import "@neoptocom/neopto-ui/styles"`
112
+ 2. āœ… Added the `@source` directive to scan the library source files
113
+ 3. āœ… Have Tailwind CSS v4 installed and configured with `@tailwindcss/postcss`
137
114
 
138
115
  ### CSS custom properties not working
139
116
 
@@ -141,6 +118,12 @@ import "./index.css";
141
118
 
142
119
  **Solution:** Make sure the library CSS is imported **before** your app styles so the CSS custom properties are defined.
143
120
 
121
+ ### Tailwind classes not being generated
122
+
123
+ **Problem:** Some component styles are missing.
124
+
125
+ **Solution:** Ensure the `@source` directive points to the library's **source files** (`/src`), not the compiled dist folder. The source files contain all the Tailwind utility classes that need to be scanned.
126
+
144
127
  ---
145
128
 
146
129
  ## šŸ“š Full Documentation
package/README.md CHANGED
@@ -13,28 +13,9 @@ A modern React component library built with Tailwind CSS v4 and TypeScript. Feat
13
13
  - **Tree Shakable**: Optimized bundle size with tree shaking
14
14
  - **Storybook**: Comprehensive documentation and testing environment
15
15
 
16
- ## šŸ“¦ Quick Start
16
+ ## šŸ“¦ Installation
17
17
 
18
- ```bash
19
- # Install the library and Tailwind CSS v4
20
- npm install @neoptocom/neopto-ui
21
- npm install -D tailwindcss@latest @tailwindcss/postcss
22
-
23
- # Run the init command - it handles everything automatically!
24
- npx neopto-ui
25
- ```
26
-
27
- The init command will:
28
- - āœ… Create `postcss.config.js` if needed
29
- - āœ… Update your CSS file with required imports
30
- - āœ… Configure Tailwind to scan the library components
31
-
32
- ### Manual Setup (if needed)
33
-
34
- <details>
35
- <summary>Click to expand manual installation steps</summary>
36
-
37
- ### Step 1: Install dependencies
18
+ ### Step 1: Install the library and Tailwind CSS v4
38
19
 
39
20
  ```bash
40
21
  npm install @neoptocom/neopto-ui
@@ -73,8 +54,6 @@ Then import this CSS in your `src/main.tsx`:
73
54
  import "./index.css";
74
55
  ```
75
56
 
76
- </details>
77
-
78
57
  ## šŸŽØ Usage
79
58
 
80
59
  ### Basic Example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neoptocom/neopto-ui",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "private": false,
5
5
  "description": "A modern React component library built with Tailwind CSS v4 and TypeScript. Features dark mode, design tokens, and comprehensive Storybook documentation. Requires Tailwind v4+.",
6
6
  "keywords": [
@@ -40,13 +40,8 @@
40
40
  "files": [
41
41
  "dist",
42
42
  "src",
43
- "scripts/init.mjs",
44
43
  "CONSUMER_SETUP.md"
45
44
  ],
46
- "bin": {
47
- "neopto-ui": "./scripts/init.mjs",
48
- "neopto-ui-init": "./scripts/init.mjs"
49
- },
50
45
  "scripts": {
51
46
  "dev": "vite",
52
47
  "build": "tsup && npm run build:css",
package/scripts/init.mjs DELETED
@@ -1,201 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { readFileSync, writeFileSync, existsSync } from 'fs';
4
- import { resolve, join } from 'path';
5
- import { fileURLToPath } from 'url';
6
- import { dirname } from 'path';
7
-
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = dirname(__filename);
10
-
11
- // ANSI color codes
12
- const colors = {
13
- reset: '\x1b[0m',
14
- green: '\x1b[32m',
15
- yellow: '\x1b[33m',
16
- blue: '\x1b[36m',
17
- red: '\x1b[31m',
18
- bold: '\x1b[1m',
19
- };
20
-
21
- function log(message, color = 'reset') {
22
- console.log(`${colors[color]}${message}${colors.reset}`);
23
- }
24
-
25
- function findCssFile() {
26
- const possiblePaths = [
27
- 'src/index.css',
28
- 'src/app.css',
29
- 'src/main.css',
30
- 'src/styles.css',
31
- 'src/global.css',
32
- 'src/globals.css',
33
- 'app/globals.css', // Next.js
34
- 'styles/globals.css', // Next.js alternative
35
- ];
36
-
37
- for (const path of possiblePaths) {
38
- if (existsSync(path)) {
39
- return path;
40
- }
41
- }
42
-
43
- return null;
44
- }
45
-
46
- function checkTailwindInstalled() {
47
- try {
48
- const packageJson = JSON.parse(readFileSync('package.json', 'utf-8'));
49
- const hasTailwind =
50
- packageJson.dependencies?.tailwindcss ||
51
- packageJson.devDependencies?.tailwindcss;
52
-
53
- if (!hasTailwind) {
54
- log('āš ļø Warning: Tailwind CSS not found in package.json', 'yellow');
55
- log(' Make sure to install: npm install -D tailwindcss@latest @tailwindcss/postcss', 'yellow');
56
- return false;
57
- }
58
- return true;
59
- } catch (error) {
60
- log('āš ļø Warning: Could not read package.json', 'yellow');
61
- return false;
62
- }
63
- }
64
-
65
- function updateCssFile(cssPath) {
66
- let content = readFileSync(cssPath, 'utf-8');
67
-
68
- const neededLines = [
69
- '@import "tailwindcss";',
70
- '@source "../node_modules/@neoptocom/neopto-ui/src";',
71
- '@import "@neoptocom/neopto-ui/styles";',
72
- ];
73
-
74
- let modified = false;
75
- const addedLines = [];
76
-
77
- // Check and add @import "tailwindcss"
78
- if (!content.includes('@import "tailwindcss"')) {
79
- content = `@import "tailwindcss";\n\n${content}`;
80
- modified = true;
81
- addedLines.push('@import "tailwindcss"');
82
- }
83
-
84
- // Check and add @source directive
85
- if (!content.includes('@source') || !content.includes('@neoptocom/neopto-ui')) {
86
- const importIndex = content.indexOf('@import "tailwindcss"');
87
- if (importIndex !== -1) {
88
- const lineEnd = content.indexOf('\n', importIndex);
89
- content =
90
- content.slice(0, lineEnd + 1) +
91
- '\n/* Scan neopto-ui components */\n' +
92
- '@source "../node_modules/@neoptocom/neopto-ui/src";\n' +
93
- content.slice(lineEnd + 1);
94
- modified = true;
95
- addedLines.push('@source directive');
96
- }
97
- }
98
-
99
- // Check and add library styles import
100
- if (!content.includes('@import "@neoptocom/neopto-ui/styles"')) {
101
- const sourceIndex = content.indexOf('@source "../node_modules/@neoptocom/neopto-ui/src"');
102
- if (sourceIndex !== -1) {
103
- const lineEnd = content.indexOf('\n', sourceIndex);
104
- content =
105
- content.slice(0, lineEnd + 1) +
106
- '\n/* Import neopto-ui design tokens and styles */\n' +
107
- '@import "@neoptocom/neopto-ui/styles";\n' +
108
- content.slice(lineEnd + 1);
109
- modified = true;
110
- addedLines.push('library styles import');
111
- }
112
- }
113
-
114
- if (modified) {
115
- writeFileSync(cssPath, content, 'utf-8');
116
- log(`\nāœ… Updated ${cssPath}`, 'green');
117
- if (addedLines.length > 0) {
118
- log(` Added: ${addedLines.join(', ')}`, 'blue');
119
- }
120
- return true;
121
- } else {
122
- log(`\nāœ… ${cssPath} already configured!`, 'green');
123
- return false;
124
- }
125
- }
126
-
127
- function createPostCssConfig() {
128
- const configPath = 'postcss.config.js';
129
-
130
- if (existsSync(configPath)) {
131
- const content = readFileSync(configPath, 'utf-8');
132
- if (content.includes('@tailwindcss/postcss')) {
133
- log('āœ… postcss.config.js already configured', 'green');
134
- return false;
135
- }
136
- }
137
-
138
- const config = `export default {
139
- plugins: {
140
- "@tailwindcss/postcss": {},
141
- },
142
- };
143
- `;
144
-
145
- writeFileSync(configPath, config, 'utf-8');
146
- log('āœ… Created postcss.config.js', 'green');
147
- return true;
148
- }
149
-
150
- async function main() {
151
- log('\n╔══════════════════════════════════════════╗', 'blue');
152
- log('ā•‘ NeoPTO UI Component Library Setup ā•‘', 'blue');
153
- log('ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•\n', 'blue');
154
-
155
- // Check if we're in a project root
156
- if (!existsSync('package.json')) {
157
- log('āŒ Error: package.json not found. Please run this command from your project root.', 'red');
158
- process.exit(1);
159
- }
160
-
161
- // Check Tailwind installation
162
- log('šŸ“¦ Checking dependencies...', 'blue');
163
- checkTailwindInstalled();
164
-
165
- // Create PostCSS config
166
- log('\nāš™ļø Setting up PostCSS...', 'blue');
167
- createPostCssConfig();
168
-
169
- // Find and update CSS file
170
- log('\nšŸŽØ Setting up CSS configuration...', 'blue');
171
- const cssFile = findCssFile();
172
-
173
- if (cssFile) {
174
- updateCssFile(cssFile);
175
- } else {
176
- log('\nāš ļø Could not find main CSS file', 'yellow');
177
- log(' Please manually add the following to your CSS file:\n', 'yellow');
178
- log(' @import "tailwindcss";', 'bold');
179
- log(' @source "../node_modules/@neoptocom/neopto-ui/src";', 'bold');
180
- log(' @import "@neoptocom/neopto-ui/styles";\n', 'bold');
181
- }
182
-
183
- log('\n╔══════════════════════════════════════════╗', 'green');
184
- log('ā•‘ Setup Complete! šŸŽ‰ ā•‘', 'green');
185
- log('ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•\n', 'green');
186
-
187
- log('Next steps:', 'blue');
188
- log(' 1. Import your CSS file in your main entry file', 'reset');
189
- log(' 2. Start using components:', 'reset');
190
- log(' import { Button, Input } from "@neoptocom/neopto-ui";\n', 'bold');
191
-
192
- log('šŸ“š Documentation: https://github.com/neoptocom/neopto-ui', 'blue');
193
- log('šŸ’” Need help? Check CONSUMER_SETUP.md in node_modules/@neoptocom/neopto-ui', 'blue');
194
- log('šŸ”§ Run this setup again anytime with: npx neopto-ui\n', 'blue');
195
- }
196
-
197
- main().catch((error) => {
198
- log(`\nāŒ Error: ${error.message}`, 'red');
199
- process.exit(1);
200
- });
201
-