@neoptocom/neopto-ui 0.2.1
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 +127 -0
- package/README.md +186 -0
- package/dist/index.cjs +836 -0
- package/dist/index.d.cts +290 -0
- package/dist/index.d.ts +290 -0
- package/dist/index.js +805 -0
- package/dist/styles.css +109 -0
- package/package.json +89 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Consumer Setup Guide
|
|
2
|
+
|
|
3
|
+
## ⚠️ Important: Tailwind CSS v4 Required
|
|
4
|
+
|
|
5
|
+
This component library uses **Tailwind CSS v4 utility classes** directly in the components. Your project **MUST** have Tailwind CSS v4 configured to use this library.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📦 Installation
|
|
10
|
+
|
|
11
|
+
### Step 1: Install the library
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @victorfbrito/neo-ui-demo
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Step 2: Install Tailwind CSS v4
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -D tailwindcss@latest @tailwindcss/postcss
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Step 3: Configure PostCSS
|
|
24
|
+
|
|
25
|
+
Create `postcss.config.js` in your project root:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
export default {
|
|
29
|
+
plugins: {
|
|
30
|
+
'@tailwindcss/postcss': {}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Step 4: Setup your CSS file
|
|
36
|
+
|
|
37
|
+
In your main CSS file (e.g., `src/index.css`):
|
|
38
|
+
|
|
39
|
+
```css
|
|
40
|
+
@import "tailwindcss";
|
|
41
|
+
|
|
42
|
+
/* 👇 Scan the component library */
|
|
43
|
+
@source "../node_modules/@victorfbrito/neo-ui-demo/dist";
|
|
44
|
+
|
|
45
|
+
/* 👇 Import library tokens and styles */
|
|
46
|
+
@import "@victorfbrito/neo-ui-demo/styles";
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then import your CSS in `src/main.tsx`:
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import './index.css'
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Step 5: Use the components!
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { Button, Input, Typo } from '@victorfbrito/neo-ui-demo';
|
|
59
|
+
|
|
60
|
+
function App() {
|
|
61
|
+
return (
|
|
62
|
+
<div className="p-8">
|
|
63
|
+
<Typo variant="headline-lg">Welcome!</Typo>
|
|
64
|
+
<Input placeholder="Enter your name" />
|
|
65
|
+
<Button variant="primary">Get Started</Button>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 🌙 Dark Mode
|
|
74
|
+
|
|
75
|
+
Toggle dark mode by adding/removing the `dark` class to your root element:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
// Enable dark mode
|
|
79
|
+
document.documentElement.classList.add('dark');
|
|
80
|
+
|
|
81
|
+
// Disable dark mode
|
|
82
|
+
document.documentElement.classList.remove('dark');
|
|
83
|
+
|
|
84
|
+
// Toggle
|
|
85
|
+
document.documentElement.classList.toggle('dark');
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 🎨 Available Components
|
|
91
|
+
|
|
92
|
+
- `Button` - Interactive buttons with variants
|
|
93
|
+
- `Input` - Text input fields
|
|
94
|
+
- `Typo` - Typography with design tokens
|
|
95
|
+
- `Avatar` & `AvatarGroup` - User avatars
|
|
96
|
+
- `Autocomplete` - Autocomplete input
|
|
97
|
+
- `Search` - Search with debouncing
|
|
98
|
+
- `Icon` - Material Symbols icons
|
|
99
|
+
- `Chip` - Tags and labels
|
|
100
|
+
- `Modal` - Dialog modals
|
|
101
|
+
- `Skeleton` - Loading placeholders
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 🐛 Troubleshooting
|
|
106
|
+
|
|
107
|
+
### Components have no styling
|
|
108
|
+
|
|
109
|
+
**Problem:** Components render but look unstyled.
|
|
110
|
+
|
|
111
|
+
**Solution:** Make sure you:
|
|
112
|
+
1. ✅ Imported the library CSS: `import '@victorfbrito/neo-ui-demo/styles'`
|
|
113
|
+
2. ✅ Added the library path to `tailwind.config.js` content array
|
|
114
|
+
3. ✅ Have Tailwind CSS installed and configured
|
|
115
|
+
|
|
116
|
+
### CSS custom properties not working
|
|
117
|
+
|
|
118
|
+
**Problem:** Colors/spacing look wrong.
|
|
119
|
+
|
|
120
|
+
**Solution:** Make sure the library CSS is imported **before** your app styles so the CSS custom properties are defined.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 📚 Full Documentation
|
|
125
|
+
|
|
126
|
+
Visit the [Storybook documentation](https://victorfbrito.github.io/neo-ui-demo/) for interactive examples and API documentation.
|
|
127
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Neo UI Demo
|
|
2
|
+
|
|
3
|
+
A modern React component library built with Tailwind CSS v4 and TypeScript. Features dark mode, design tokens, and comprehensive Storybook documentation.
|
|
4
|
+
|
|
5
|
+
> ⚠️ **Requirements:** This library requires **Tailwind CSS v4** and **@tailwindcss/postcss** in your project. See installation steps below.
|
|
6
|
+
|
|
7
|
+
## 🚀 Features
|
|
8
|
+
|
|
9
|
+
- **Modern Stack**: Built with React 18+, TypeScript, and Tailwind CSS v4+
|
|
10
|
+
- **Design System**: Comprehensive design token system with dark mode support
|
|
11
|
+
- **Type Safe**: Full TypeScript support with exported types
|
|
12
|
+
- **Accessible**: Built with accessibility in mind
|
|
13
|
+
- **Tree Shakable**: Optimized bundle size with tree shaking
|
|
14
|
+
- **Storybook**: Comprehensive documentation and testing environment
|
|
15
|
+
|
|
16
|
+
## 📦 Installation
|
|
17
|
+
|
|
18
|
+
### Step 1: Install the library
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @victorfbrito/neo-ui-demo
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Step 2: Install Tailwind CSS v4
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -D tailwindcss@latest @tailwindcss/postcss
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Step 3: Configure PostCSS
|
|
31
|
+
|
|
32
|
+
Create `postcss.config.js` in your project root:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
export default {
|
|
36
|
+
plugins: {
|
|
37
|
+
'@tailwindcss/postcss': {}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Step 4: Setup your CSS file
|
|
43
|
+
|
|
44
|
+
In your main CSS file (e.g., `src/index.css`):
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
@import "tailwindcss";
|
|
48
|
+
|
|
49
|
+
/* 👇 Scan the component library */
|
|
50
|
+
@source "../node_modules/@victorfbrito/neo-ui-demo/dist";
|
|
51
|
+
|
|
52
|
+
/* 👇 Import library styles */
|
|
53
|
+
@import "@victorfbrito/neo-ui-demo/styles";
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then import this CSS in your `src/main.tsx`:
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import './index.css'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 🎨 Usage
|
|
63
|
+
|
|
64
|
+
### Basic Example
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { Button, Input, Typo } from '@victorfbrito/neo-ui-demo';
|
|
68
|
+
|
|
69
|
+
function App() {
|
|
70
|
+
return (
|
|
71
|
+
<div className="p-8">
|
|
72
|
+
<Typo variant="headline-lg">Welcome to My UI Library</Typo>
|
|
73
|
+
<Input placeholder="Enter your name" />
|
|
74
|
+
<Button variant="primary">Get Started</Button>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Dark Mode
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
// Enable dark mode
|
|
84
|
+
document.documentElement.classList.add('dark');
|
|
85
|
+
|
|
86
|
+
// Toggle dark mode
|
|
87
|
+
document.documentElement.classList.toggle('dark');
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Why Tailwind CSS v4 is Required
|
|
91
|
+
|
|
92
|
+
This library uses **Tailwind CSS v4** utility classes directly in components (e.g., `gap-2`, `px-4`, `hover:bg-cyan-400`). Your build tool needs Tailwind to process these classes into actual CSS.
|
|
93
|
+
|
|
94
|
+
**Note:** This library requires Tailwind v4+. If you're using Tailwind v3, please upgrade to v4.
|
|
95
|
+
|
|
96
|
+
## 🧩 Components
|
|
97
|
+
|
|
98
|
+
### Button
|
|
99
|
+
```tsx
|
|
100
|
+
import { Button } from '@your-username/my-ui-lib';
|
|
101
|
+
|
|
102
|
+
<Button variant="primary" size="md">
|
|
103
|
+
Click me
|
|
104
|
+
</Button>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Input
|
|
108
|
+
```tsx
|
|
109
|
+
import { Input } from '@your-username/my-ui-lib';
|
|
110
|
+
|
|
111
|
+
<Input placeholder="Enter text" size="md" />
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Typography
|
|
115
|
+
```tsx
|
|
116
|
+
import { Typo } from '@your-username/my-ui-lib';
|
|
117
|
+
|
|
118
|
+
<Typo variant="headline-lg" bold="semibold">
|
|
119
|
+
Heading Text
|
|
120
|
+
</Typo>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Avatar
|
|
124
|
+
```tsx
|
|
125
|
+
import { Avatar, AvatarGroup } from '@your-username/my-ui-lib';
|
|
126
|
+
|
|
127
|
+
<AvatarGroup max={3}>
|
|
128
|
+
<Avatar name="John Doe" src="/avatar.jpg" />
|
|
129
|
+
<Avatar name="Jane Smith" />
|
|
130
|
+
</AvatarGroup>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Autocomplete
|
|
134
|
+
```tsx
|
|
135
|
+
import { Autocomplete } from '@your-username/my-ui-lib';
|
|
136
|
+
|
|
137
|
+
const options = [
|
|
138
|
+
{ label: "Option 1", value: "1" },
|
|
139
|
+
{ label: "Option 2", value: "2" }
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
<Autocomplete
|
|
143
|
+
title="Select Option"
|
|
144
|
+
options={options}
|
|
145
|
+
selectedOption={selected}
|
|
146
|
+
onSelect={setSelected}
|
|
147
|
+
/>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## 🎨 Design Tokens
|
|
151
|
+
|
|
152
|
+
The library uses a comprehensive design token system:
|
|
153
|
+
|
|
154
|
+
- **Colors**: Brand, semantic colors with dark mode support
|
|
155
|
+
- **Typography**: Poppins for headings, Roboto for body text
|
|
156
|
+
- **Spacing**: Consistent spacing scale
|
|
157
|
+
- **Border Radius**: Configurable border radius values
|
|
158
|
+
- **Shadows**: Subtle shadow system
|
|
159
|
+
- **Motion**: Consistent animation timing
|
|
160
|
+
|
|
161
|
+
## 📚 Documentation
|
|
162
|
+
|
|
163
|
+
Visit our [Storybook documentation](https://your-username.github.io/my-ui-lib) for:
|
|
164
|
+
- Interactive component playground
|
|
165
|
+
- Design system guidelines
|
|
166
|
+
- Usage examples
|
|
167
|
+
- Accessibility information
|
|
168
|
+
|
|
169
|
+
## 🤝 Contributing
|
|
170
|
+
|
|
171
|
+
1. Fork the repository
|
|
172
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
173
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
174
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
175
|
+
5. Open a Pull Request
|
|
176
|
+
|
|
177
|
+
## 📄 License
|
|
178
|
+
|
|
179
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
180
|
+
|
|
181
|
+
## 🙏 Acknowledgments
|
|
182
|
+
|
|
183
|
+
- Built with [React](https://reactjs.org/)
|
|
184
|
+
- Styled with [Tailwind CSS](https://tailwindcss.com/)
|
|
185
|
+
- Documented with [Storybook](https://storybook.js.org/)
|
|
186
|
+
- Bundled with [tsup](https://tsup.egoist.sh/)
|