@neoptocom/neopto-ui 0.5.0 → 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,18 +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
- ```bash
21
- npx neopto-ui
20
+ Create `postcss.config.js` in your project root:
21
+
22
+ ```js
23
+ export default {
24
+ plugins: {
25
+ "@tailwindcss/postcss": {},
26
+ },
27
+ };
28
+ ```
29
+
30
+ ### Step 3: Setup your CSS file
31
+
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";
22
42
  ```
23
43
 
24
- This will automatically:
25
- - āœ… Create `postcss.config.js` if needed
26
- - āœ… Update your CSS file with required imports
27
- - āœ… Configure Tailwind to scan the library components
44
+ Then import your CSS in `src/main.tsx`:
45
+
46
+ ```tsx
47
+ import "./index.css";
48
+ ```
28
49
 
29
- ### Step 3: Use the components!
50
+ ### Step 4: Use the components!
30
51
 
31
52
  ```tsx
32
53
  import { Button, Input, Typo } from "@neoptocom/neopto-ui";
@@ -73,51 +94,9 @@ document.documentElement.classList.toggle("dark");
73
94
  - `Chip` - Tags and labels
74
95
  - `Modal` - Dialog modals
75
96
  - `Skeleton` - Loading placeholders
76
-
77
- ---
78
-
79
- ## šŸ› ļø Manual Setup (Alternative)
80
-
81
- If you prefer to set up manually or the init script didn't work:
82
-
83
- ### Step 1: Install dependencies
84
-
85
- ```bash
86
- npm install @neoptocom/neopto-ui
87
- npm install -D tailwindcss@latest @tailwindcss/postcss
88
- ```
89
-
90
- ### Step 2: Configure PostCSS
91
-
92
- Create `postcss.config.js` in your project root:
93
-
94
- ```js
95
- export default {
96
- plugins: {
97
- "@tailwindcss/postcss": {},
98
- },
99
- };
100
- ```
101
-
102
- ### Step 3: Setup your CSS file
103
-
104
- In your main CSS file (e.g., `src/index.css`):
105
-
106
- ```css
107
- @import "tailwindcss";
108
-
109
- /* Scan the component library source files */
110
- @source "../node_modules/@neoptocom/neopto-ui/src";
111
-
112
- /* Import library tokens and styles */
113
- @import "@neoptocom/neopto-ui/styles";
114
- ```
115
-
116
- Then import your CSS in `src/main.tsx`:
117
-
118
- ```tsx
119
- import "./index.css";
120
- ```
97
+ - `Counter` - Number stepper
98
+ - `IconButton` - Icon-only buttons
99
+ - `ChatButton` - Animated chat button
121
100
 
122
101
  ---
123
102
 
@@ -129,9 +108,9 @@ import "./index.css";
129
108
 
130
109
  **Solution:** Make sure you:
131
110
 
132
- 1. āœ… Imported the library CSS: `import '@neoptocom/neopto-ui/styles'`
133
- 2. āœ… Added the library path to `tailwind.config.js` content array
134
- 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`
135
114
 
136
115
  ### CSS custom properties not working
137
116
 
@@ -139,6 +118,12 @@ import "./index.css";
139
118
 
140
119
  **Solution:** Make sure the library CSS is imported **before** your app styles so the CSS custom properties are defined.
141
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
+
142
127
  ---
143
128
 
144
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.0",
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,12 +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
- },
49
45
  "scripts": {
50
46
  "dev": "vite",
51
47
  "build": "tsup && npm run build:css",
package/scripts/init.mjs DELETED
@@ -1,200 +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\n', 'blue');
194
- }
195
-
196
- main().catch((error) => {
197
- log(`\nāŒ Error: ${error.message}`, 'red');
198
- process.exit(1);
199
- });
200
-