@argojun/react-components 1.0.0 → 1.0.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/README.md CHANGED
@@ -1,41 +1,120 @@
1
1
  # @argojun/react-components
2
2
 
3
- A collection of beautifully crafted React components built with Tailwind CSS.
3
+ A collection of beautifully crafted React components designed to work seamlessly with your Tailwind CSS project.
4
+
5
+ 📚 **[Documentation](https://www.argojun.in/)**
4
6
 
5
7
  ## Installation
6
8
 
7
9
  ```bash
10
+ # npm
8
11
  npm install @argojun/react-components
12
+
13
+ # yarn
14
+ yarn add @argojun/react-components
15
+
16
+ # pnpm
17
+ pnpm add @argojun/react-components
9
18
  ```
10
19
 
11
- ## Usage
20
+ ## ⚠️ Required Setup: Tailwind CSS Configuration
12
21
 
13
- Import components directly from the package:
22
+ **This library requires Tailwind CSS in your project.** The components use Tailwind utility classes that need to be compiled by your project's Tailwind setup.
14
23
 
15
- ```jsx
16
- import { Button, Input, Select, Checkbox, Radio, DateTimePicker, FileUpload, MultiSelect, Textarea, Icon } from '@argojun/react-components';
17
- ```
24
+ ---
18
25
 
19
- ### Include Styles
26
+ ### 🔷 For Tailwind CSS v3 Users
20
27
 
21
- Make sure to include the styles in your app:
28
+ #### Option A: Using the Tailwind Preset (Recommended)
22
29
 
23
- ```jsx
24
- import '@argojun/react-components/styles.css';
30
+ The easiest way! Import our preset in your `tailwind.config.js`:
31
+
32
+ ```js
33
+ const { tailwindPreset } = require('@argojun/react-components/tailwind');
34
+
35
+ /** @type {import('tailwindcss').Config} */
36
+ module.exports = {
37
+ presets: [tailwindPreset],
38
+ content: [
39
+ './src/**/*.{js,jsx,ts,tsx}',
40
+ ],
41
+ darkMode: 'class',
42
+ theme: {
43
+ extend: {},
44
+ },
45
+ plugins: [],
46
+ };
25
47
  ```
26
48
 
27
- Or if you're using Tailwind CSS, you can include the component paths in your `tailwind.config.js`:
49
+ #### Option B: Manual Configuration
50
+
51
+ Add the library path to your `tailwind.config.js` content array:
28
52
 
29
53
  ```js
54
+ /** @type {import('tailwindcss').Config} */
30
55
  module.exports = {
31
56
  content: [
32
- // ... your paths
57
+ './src/**/*.{js,jsx,ts,tsx}',
58
+ // 👇 Add this line to include the component library
33
59
  './node_modules/@argojun/react-components/dist/**/*.js',
34
60
  ],
35
- // ...
61
+ darkMode: 'class',
62
+ theme: {
63
+ extend: {},
64
+ },
65
+ plugins: [],
36
66
  };
37
67
  ```
38
68
 
69
+ ---
70
+
71
+ ### 🔶 For Tailwind CSS v4 Users
72
+
73
+ If using Tailwind v4 with CSS-based configuration, add the `@source` directive to your CSS:
74
+
75
+ ```css
76
+ @import "tailwindcss";
77
+
78
+ /* Scan the component library for utility classes */
79
+ @source "./node_modules/@argojun/react-components/dist/*.js";
80
+ ```
81
+
82
+ ---
83
+
84
+ ### Start Using Components
85
+
86
+ Base styles (animations, scroll behavior, etc.) are **automatically injected** when you import any component — no separate CSS import needed!
87
+
88
+ ```jsx
89
+ import { Button, Input, Select } from '@argojun/react-components';
90
+
91
+ function App() {
92
+ return (
93
+ <div className="p-8">
94
+ <Button variant="primary" color="violet">
95
+ Click me
96
+ </Button>
97
+ </div>
98
+ );
99
+ }
100
+ ```
101
+
102
+ ## Dark Mode Support
103
+
104
+ All components support dark mode. Add the `dark` class to your `<html>` or parent element:
105
+
106
+ ```html
107
+ <html class="dark">
108
+ <!-- Your app -->
109
+ </html>
110
+ ```
111
+
112
+ Or toggle it programmatically:
113
+
114
+ ```jsx
115
+ document.documentElement.classList.toggle('dark');
116
+ ```
117
+
39
118
  ## Components
40
119
 
41
120
  ### Button
@@ -93,6 +172,13 @@ module.exports = {
93
172
  />
94
173
  ```
95
174
 
175
+ **Props:**
176
+ - `options`: Array of `{ value, label, icon?, description? }` or strings
177
+ - `searchable`: boolean - Enable search/filter
178
+ - `clearable`: boolean - Show clear button
179
+ - `theme`: `'default'` | `'glass'` | `'minimal'` | `'outlined'` | `'filled'`
180
+ - `color`: `'violet'` | `'blue'` | `'emerald'` | `'rose'` | `'amber'` | `'black'`
181
+
96
182
  ### MultiSelect
97
183
 
98
184
  ```jsx
@@ -104,37 +190,62 @@ module.exports = {
104
190
  />
105
191
  ```
106
192
 
193
+ **Props:**
194
+ - All Select props, plus:
195
+ - `maxSelections`: number - Limit selections
196
+ - `chipDisplay`: `'inline'` | `'count'` | `'compact'`
197
+
107
198
  ### Checkbox
108
199
 
109
200
  ```jsx
201
+ // Standalone
110
202
  <Checkbox
111
203
  label="Accept terms"
112
204
  description="I agree to the terms and conditions"
113
205
  color="emerald"
114
206
  />
207
+
208
+ // As a group
209
+ <Checkbox.Group
210
+ label="Select options"
211
+ onChange={(values) => console.log(values)}
212
+ >
213
+ <Checkbox value="opt1" label="Option 1" />
214
+ <Checkbox value="opt2" label="Option 2" />
215
+ </Checkbox.Group>
115
216
  ```
116
217
 
117
218
  ### Radio
118
219
 
119
220
  ```jsx
120
- <Radio
221
+ <Radio.Group
121
222
  name="plan"
122
- label="Pro Plan"
123
- description="$29/month"
124
- variant="card"
125
- />
223
+ label="Select a plan"
224
+ onChange={(value) => console.log(value)}
225
+ >
226
+ <Radio value="basic" label="Basic" description="$9/month" />
227
+ <Radio value="pro" label="Pro" description="$29/month" variant="card" />
228
+ </Radio.Group>
126
229
  ```
127
230
 
128
231
  ### DateTimePicker
129
232
 
130
233
  ```jsx
131
234
  <DateTimePicker
132
- mode="datetime"
235
+ type="datetime"
133
236
  label="Appointment"
237
+ value={date}
238
+ onChange={(newDate) => setDate(newDate)}
134
239
  minDate={new Date()}
135
240
  />
136
241
  ```
137
242
 
243
+ **Props:**
244
+ - `type`: `'date'` | `'time'` | `'datetime'`
245
+ - `value`: Date object
246
+ - `onChange`: `(date: Date) => void`
247
+ - `minDate` / `maxDate`: Date constraints
248
+
138
249
  ### FileUpload
139
250
 
140
251
  ```jsx
@@ -143,44 +254,68 @@ module.exports = {
143
254
  multiple
144
255
  maxFiles={5}
145
256
  maxSize={5 * 1024 * 1024}
146
- showPreview
257
+ onFilesChange={(files) => console.log(files)}
147
258
  />
148
259
  ```
149
260
 
261
+ **Props:**
262
+ - `variant`: `'dropzone'` | `'compact'`
263
+ - `multiple`: boolean
264
+ - `accept`: string (MIME types)
265
+ - `maxFiles`: number
266
+ - `maxSize`: number (bytes)
267
+
150
268
  ### Textarea
151
269
 
152
270
  ```jsx
153
271
  <Textarea
154
272
  label="Description"
155
273
  placeholder="Enter description..."
156
- autoResize
157
- showCharCount
158
274
  maxLength={500}
275
+ helperText="Write a brief description"
159
276
  />
160
277
  ```
161
278
 
162
279
  ### Icon
163
280
 
281
+ Built-in icon library with 150+ icons - no external dependencies needed!
282
+
164
283
  ```jsx
165
284
  <Icon icon="check" size="md" variant="solid" />
166
285
  <Icon icon="user" size="lg" />
286
+ <Icon icon="heart" variant="outline" className="text-red-500" />
167
287
  ```
168
288
 
169
- ## Peer Dependencies
289
+ **Props:**
290
+ - `icon`: string - Icon name (see full list in docs)
291
+ - `size`: `'xs'` | `'sm'` | `'md'` | `'lg'` | `'xl'` | `'2xl'`
292
+ - `variant`: `'outline'` | `'solid'`
293
+
294
+ **Available Icons:**
295
+ Navigation, actions, status, forms, media, files, commerce, shapes, weather, development, social brands, and more.
170
296
 
171
- This package requires the following peer dependencies:
297
+ ## Peer Dependencies
172
298
 
173
299
  ```json
174
300
  {
175
301
  "react": ">=17.0.0",
176
- "react-dom": ">=17.0.0"
302
+ "react-dom": ">=17.0.0",
303
+ "tailwindcss": ">=3.0.0"
177
304
  }
178
305
  ```
179
306
 
180
- ## Tailwind CSS
307
+ ## Troubleshooting
308
+
309
+ ### Styles not appearing?
310
+
311
+ 1. **Check Tailwind config**: Make sure you added the library path to `content` array, or use the preset
312
+ 2. **Rebuild your app**: Restart your dev server after config changes
313
+ 3. **Check browser console**: Look for any JavaScript errors
314
+
315
+ ### Dark mode not working?
181
316
 
182
- These components are built with Tailwind CSS. Make sure you have Tailwind configured in your project for the best experience.
317
+ Make sure your `tailwind.config.js` has `darkMode: 'class'` and add the `dark` class to your root element.
183
318
 
184
319
  ## License
185
320
 
186
- MIT
321
+ MIT © Arnav Gour