uiplex 1.1.0 → 1.3.0
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 +164 -396
- package/dist/Accordion/Accordion.d.ts +40 -0
- package/dist/Accordion/Accordion.d.ts.map +1 -0
- package/dist/Accordion/index.d.ts +3 -0
- package/dist/Accordion/index.d.ts.map +1 -0
- package/dist/Checkbox/Checkbox.d.ts +34 -0
- package/dist/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/Checkbox/index.d.ts +3 -0
- package/dist/Checkbox/index.d.ts.map +1 -0
- package/dist/Tabs/Tabs.d.ts.map +1 -1
- package/dist/index.cjs +167 -1
- package/dist/index.css +528 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +162 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,12 +24,10 @@ npm install react react-dom
|
|
|
24
24
|
|
|
25
25
|
## Quick Start
|
|
26
26
|
|
|
27
|
-
**With Modern Bundlers (Vite, Webpack 5, Next.js, etc.):**
|
|
28
|
-
|
|
29
27
|
CSS is automatically included when you import components! Just import and use:
|
|
30
28
|
|
|
31
29
|
```tsx
|
|
32
|
-
import { Button,
|
|
30
|
+
import { Button, ThemeProvider } from 'uiplex';
|
|
33
31
|
|
|
34
32
|
function App() {
|
|
35
33
|
return (
|
|
@@ -45,7 +43,6 @@ function App() {
|
|
|
45
43
|
**If CSS is not automatically loaded**, import it manually:
|
|
46
44
|
|
|
47
45
|
```tsx
|
|
48
|
-
import { Button } from 'uiplex';
|
|
49
46
|
import 'uiplex/styles.css'; // Only needed if bundler doesn't auto-include
|
|
50
47
|
```
|
|
51
48
|
|
|
@@ -53,7 +50,7 @@ import 'uiplex/styles.css'; // Only needed if bundler doesn't auto-include
|
|
|
53
50
|
|
|
54
51
|
### Button
|
|
55
52
|
|
|
56
|
-
|
|
53
|
+
Versatile button component with multiple variants, sizes, and color schemes.
|
|
57
54
|
|
|
58
55
|
```tsx
|
|
59
56
|
import { Button } from 'uiplex';
|
|
@@ -61,43 +58,25 @@ import { Button } from 'uiplex';
|
|
|
61
58
|
<Button variant="primary" size="md" colorScheme="blue">
|
|
62
59
|
Primary Button
|
|
63
60
|
</Button>
|
|
64
|
-
|
|
65
|
-
<Button variant="outline" size="lg" loading>
|
|
66
|
-
Loading...
|
|
67
|
-
</Button>
|
|
68
61
|
```
|
|
69
62
|
|
|
70
|
-
**Props:**
|
|
71
|
-
- `variant`: `"primary" | "secondary" | "outline" | "link"`
|
|
72
|
-
- `size`: `"xs" | "sm" | "md" | "lg"`
|
|
73
|
-
- `colorScheme`: `"blue" | "green" | "red" | "yellow" | "purple" | "gray"`
|
|
74
|
-
- `disabled`: `boolean`
|
|
75
|
-
- `loading`: `boolean`
|
|
76
|
-
- `leftIcon`: `ReactNode`
|
|
77
|
-
- `rightIcon`: `ReactNode`
|
|
63
|
+
**Key Props:** `variant`, `size`, `colorScheme`, `disabled`, `loading`, `leftIcon`, `rightIcon`
|
|
78
64
|
|
|
79
65
|
### Loader
|
|
80
66
|
|
|
81
|
-
|
|
67
|
+
Flexible loading indicator with multiple variants.
|
|
82
68
|
|
|
83
69
|
```tsx
|
|
84
70
|
import { Loader } from 'uiplex';
|
|
85
71
|
|
|
86
72
|
<Loader variant="spinner" size="md" />
|
|
87
|
-
<Loader variant="dots" size="lg" />
|
|
88
|
-
<Loader variant="pulse" isCentered />
|
|
89
73
|
```
|
|
90
74
|
|
|
91
|
-
**Props:**
|
|
92
|
-
- `variant`: `"spinner" | "dots" | "pulse"`
|
|
93
|
-
- `size`: `"xs" | "sm" | "md" | "lg"`
|
|
94
|
-
- `width`: `number` (optional)
|
|
95
|
-
- `height`: `number` (optional)
|
|
96
|
-
- `isCentered`: `boolean`
|
|
75
|
+
**Key Props:** `variant` ("spinner" | "dots" | "pulse"), `size`, `isCentered`
|
|
97
76
|
|
|
98
77
|
### Radio & RadioGroup
|
|
99
78
|
|
|
100
|
-
Radio button components with support for groups
|
|
79
|
+
Radio button components with support for groups.
|
|
101
80
|
|
|
102
81
|
```tsx
|
|
103
82
|
import { Radio, RadioGroup } from 'uiplex';
|
|
@@ -113,144 +92,25 @@ import { Radio, RadioGroup } from 'uiplex';
|
|
|
113
92
|
/>
|
|
114
93
|
```
|
|
115
94
|
|
|
116
|
-
|
|
117
|
-
- `name`: `string` (required)
|
|
118
|
-
- `value`: `string`
|
|
119
|
-
- `checked`: `boolean`
|
|
120
|
-
- `disabled`: `boolean`
|
|
121
|
-
- `label`: `string`
|
|
122
|
-
- `description`: `string`
|
|
123
|
-
- `size`: `"sm" | "md" | "lg"`
|
|
124
|
-
- `colorScheme`: `"blue" | "green" | "red" | "yellow" | "purple" | "gray"`
|
|
95
|
+
### Checkbox & CheckboxGroup
|
|
125
96
|
|
|
126
|
-
|
|
127
|
-
- `name`: `string` (required)
|
|
128
|
-
- `value`: `string`
|
|
129
|
-
- `options`: `Array<{ value: string; label?: string; description?: string; disabled?: boolean }>`
|
|
130
|
-
- `orientation`: `"horizontal" | "vertical"`
|
|
131
|
-
|
|
132
|
-
### Text
|
|
133
|
-
|
|
134
|
-
Typography component with sizes, weights, colors, and alignment options.
|
|
97
|
+
Checkbox components with support for multiple selections.
|
|
135
98
|
|
|
136
99
|
```tsx
|
|
137
|
-
import {
|
|
138
|
-
|
|
139
|
-
<Text size="lg" weight="bold" color="primary">
|
|
140
|
-
Heading Text
|
|
141
|
-
</Text>
|
|
100
|
+
import { Checkbox, CheckboxGroup } from 'uiplex';
|
|
142
101
|
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
- `align`: `"left" | "center" | "right" | "justify"`
|
|
153
|
-
- `as`: `"p" | "span" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6"`
|
|
154
|
-
|
|
155
|
-
### Box
|
|
156
|
-
|
|
157
|
-
A versatile container component that serves as a building block for layouts.
|
|
158
|
-
|
|
159
|
-
```tsx
|
|
160
|
-
import { Box } from 'uiplex';
|
|
161
|
-
|
|
162
|
-
<Box padding="md" margin="lg" borderRadius="md" bg="primary">
|
|
163
|
-
Content here
|
|
164
|
-
</Box>
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
**Props:**
|
|
168
|
-
- `padding`: `string | number`
|
|
169
|
-
- `margin`: `string | number`
|
|
170
|
-
- `width`: `string | number`
|
|
171
|
-
- `height`: `string | number`
|
|
172
|
-
- `bg`: `string`
|
|
173
|
-
- `borderRadius`: `string | number`
|
|
174
|
-
- All standard HTML div props
|
|
175
|
-
|
|
176
|
-
### Flex
|
|
177
|
-
|
|
178
|
-
A flexible layout component built on CSS Flexbox.
|
|
179
|
-
|
|
180
|
-
```tsx
|
|
181
|
-
import { Flex } from 'uiplex';
|
|
182
|
-
|
|
183
|
-
<Flex direction="row" align="center" justify="space-between" gap="md">
|
|
184
|
-
<Box>Item 1</Box>
|
|
185
|
-
<Box>Item 2</Box>
|
|
186
|
-
</Flex>
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
**Props:**
|
|
190
|
-
- `direction`: `"row" | "column" | "row-reverse" | "column-reverse"`
|
|
191
|
-
- `align`: `"flex-start" | "flex-end" | "center" | "stretch" | "baseline"`
|
|
192
|
-
- `justify`: `"flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly"`
|
|
193
|
-
- `wrap`: `"nowrap" | "wrap" | "wrap-reverse"`
|
|
194
|
-
- `gap`: `string | number`
|
|
195
|
-
- All standard HTML div props
|
|
196
|
-
|
|
197
|
-
### Grid
|
|
198
|
-
|
|
199
|
-
CSS Grid layout component for two-dimensional layouts.
|
|
200
|
-
|
|
201
|
-
```tsx
|
|
202
|
-
import { Grid } from 'uiplex';
|
|
203
|
-
|
|
204
|
-
<Grid columns={3} gap="md" rows="auto">
|
|
205
|
-
<Box>Item 1</Box>
|
|
206
|
-
<Box>Item 2</Box>
|
|
207
|
-
<Box>Item 3</Box>
|
|
208
|
-
</Grid>
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
**Props:**
|
|
212
|
-
- `columns`: `number | string`
|
|
213
|
-
- `rows`: `number | string`
|
|
214
|
-
- `gap`: `string | number`
|
|
215
|
-
- All standard HTML div props
|
|
216
|
-
|
|
217
|
-
### Modal
|
|
218
|
-
|
|
219
|
-
Modal dialog component for overlays and popups.
|
|
220
|
-
|
|
221
|
-
```tsx
|
|
222
|
-
import { Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, ModalFooter, ModalCloseButton, useDisclosure } from 'uiplex';
|
|
223
|
-
|
|
224
|
-
function MyComponent() {
|
|
225
|
-
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
226
|
-
|
|
227
|
-
return (
|
|
228
|
-
<>
|
|
229
|
-
<Button onClick={onOpen}>Open Modal</Button>
|
|
230
|
-
<Modal isOpen={isOpen} onClose={onClose}>
|
|
231
|
-
<ModalOverlay />
|
|
232
|
-
<ModalContent>
|
|
233
|
-
<ModalHeader>Modal Title</ModalHeader>
|
|
234
|
-
<ModalCloseButton />
|
|
235
|
-
<ModalBody>
|
|
236
|
-
Modal content goes here
|
|
237
|
-
</ModalBody>
|
|
238
|
-
<ModalFooter>
|
|
239
|
-
<Button onClick={onClose}>Close</Button>
|
|
240
|
-
</ModalFooter>
|
|
241
|
-
</ModalContent>
|
|
242
|
-
</Modal>
|
|
243
|
-
</>
|
|
244
|
-
);
|
|
245
|
-
}
|
|
102
|
+
<CheckboxGroup
|
|
103
|
+
name="options"
|
|
104
|
+
value={selected}
|
|
105
|
+
onChange={(values) => setSelected(values)}
|
|
106
|
+
options={[
|
|
107
|
+
{ value: '1', label: 'Option 1' },
|
|
108
|
+
{ value: '2', label: 'Option 2' },
|
|
109
|
+
]}
|
|
110
|
+
/>
|
|
246
111
|
```
|
|
247
112
|
|
|
248
|
-
**
|
|
249
|
-
- `isOpen`: `boolean`
|
|
250
|
-
- `onClose`: `() => void`
|
|
251
|
-
- `size`: `"xs" | "sm" | "md" | "lg" | "xl" | "full"`
|
|
252
|
-
- `closeOnOverlayClick`: `boolean`
|
|
253
|
-
- `closeOnEsc`: `boolean`
|
|
113
|
+
**Key Props:** `value` (string[]), `onChange`, `options`, `size`, `colorScheme`, `orientation`
|
|
254
114
|
|
|
255
115
|
### Input
|
|
256
116
|
|
|
@@ -261,23 +121,12 @@ import { Input, FormControl, FormLabel, FormErrorMessage } from 'uiplex';
|
|
|
261
121
|
|
|
262
122
|
<FormControl isInvalid={hasError}>
|
|
263
123
|
<FormLabel>Email</FormLabel>
|
|
264
|
-
<Input
|
|
265
|
-
type="email"
|
|
266
|
-
placeholder="Enter your email"
|
|
267
|
-
value={email}
|
|
268
|
-
onChange={(e) => setEmail(e.target.value)}
|
|
269
|
-
/>
|
|
124
|
+
<Input type="email" placeholder="Enter your email" />
|
|
270
125
|
<FormErrorMessage>Email is required</FormErrorMessage>
|
|
271
126
|
</FormControl>
|
|
272
127
|
```
|
|
273
128
|
|
|
274
|
-
**
|
|
275
|
-
- `size`: `"sm" | "md" | "lg"`
|
|
276
|
-
- `variant`: `"outline" | "filled" | "flushed" | "unstyled"`
|
|
277
|
-
- `isInvalid`: `boolean`
|
|
278
|
-
- `isDisabled`: `boolean`
|
|
279
|
-
- `isReadOnly`: `boolean`
|
|
280
|
-
- All standard HTML input props
|
|
129
|
+
**Key Props:** `size`, `variant`, `isInvalid`, `isDisabled`
|
|
281
130
|
|
|
282
131
|
### Textarea
|
|
283
132
|
|
|
@@ -286,36 +135,20 @@ Multi-line text input component.
|
|
|
286
135
|
```tsx
|
|
287
136
|
import { Textarea } from 'uiplex';
|
|
288
137
|
|
|
289
|
-
<Textarea
|
|
290
|
-
placeholder="Enter your message"
|
|
291
|
-
rows={4}
|
|
292
|
-
value={message}
|
|
293
|
-
onChange={(e) => setMessage(e.target.value)}
|
|
294
|
-
/>
|
|
138
|
+
<Textarea placeholder="Enter your message" rows={4} />
|
|
295
139
|
```
|
|
296
140
|
|
|
297
|
-
**Props:**
|
|
298
|
-
- `size`: `"sm" | "md" | "lg"`
|
|
299
|
-
- `variant`: `"outline" | "filled" | "flushed" | "unstyled"`
|
|
300
|
-
- `isInvalid`: `boolean`
|
|
301
|
-
- `isDisabled`: `boolean`
|
|
302
|
-
- All standard HTML textarea props
|
|
303
|
-
|
|
304
141
|
### Select
|
|
305
142
|
|
|
306
|
-
Custom dropdown
|
|
143
|
+
Custom dropdown with single/multi-select, search, and validation.
|
|
307
144
|
|
|
308
145
|
```tsx
|
|
309
|
-
import { Select
|
|
146
|
+
import { Select } from 'uiplex';
|
|
310
147
|
|
|
311
148
|
// Single select
|
|
312
149
|
<Select
|
|
313
150
|
placeholder="Select an option"
|
|
314
|
-
options={
|
|
315
|
-
{ value: 'option1', label: 'Option 1' },
|
|
316
|
-
{ value: 'option2', label: 'Option 2' },
|
|
317
|
-
{ value: 'option3', label: 'Option 3' },
|
|
318
|
-
]}
|
|
151
|
+
options={options}
|
|
319
152
|
value={value}
|
|
320
153
|
onChange={(value) => setValue(value)}
|
|
321
154
|
/>
|
|
@@ -323,119 +156,84 @@ import { Select, FormControl, FormLabel, FormErrorMessage } from 'uiplex';
|
|
|
323
156
|
// Multi-select
|
|
324
157
|
<Select
|
|
325
158
|
mode="multiple"
|
|
326
|
-
placeholder="Select multiple
|
|
327
|
-
options={options}
|
|
328
|
-
value={values}
|
|
329
|
-
onChange={(values) => setValues(values)}
|
|
330
|
-
/>
|
|
331
|
-
|
|
332
|
-
// With search
|
|
333
|
-
<Select
|
|
334
|
-
searchable
|
|
335
|
-
placeholder="Search and select..."
|
|
159
|
+
placeholder="Select multiple"
|
|
336
160
|
options={options}
|
|
337
161
|
/>
|
|
338
162
|
|
|
339
|
-
//
|
|
340
|
-
<
|
|
341
|
-
<FormLabel>Country</FormLabel>
|
|
342
|
-
<Select
|
|
343
|
-
placeholder="Select a country"
|
|
344
|
-
options={countries}
|
|
345
|
-
value={country}
|
|
346
|
-
onChange={(value) => setCountry(value)}
|
|
347
|
-
/>
|
|
348
|
-
<FormErrorMessage>Country is required</FormErrorMessage>
|
|
349
|
-
</FormControl>
|
|
163
|
+
// Searchable
|
|
164
|
+
<Select searchable placeholder="Search..." options={options} />
|
|
350
165
|
```
|
|
351
166
|
|
|
352
|
-
**
|
|
353
|
-
- `size`: `"sm" | "md" | "lg"`
|
|
354
|
-
- `variant`: `"outline" | "filled" | "unstyled"`
|
|
355
|
-
- `mode`: `"single" | "multiple"` (default: `"single"`)
|
|
356
|
-
- `searchable`: `boolean` (default: `false`)
|
|
357
|
-
- `allowClear`: `boolean` (default: `false`)
|
|
358
|
-
- `options`: `SelectOption[]` - Array of option objects
|
|
359
|
-
- `value`: `string | number | (string | number)[]` - Controlled value
|
|
360
|
-
- `defaultValue`: `string | number | (string | number)[]` - Default value (uncontrolled)
|
|
361
|
-
- `onChange`: `(value) => void` - Callback when value changes
|
|
362
|
-
- `placeholder`: `string` (default: `"Select..."`)
|
|
363
|
-
- `width`: `string | number` - Width of the select component
|
|
364
|
-
- `isInvalid`: `boolean`
|
|
365
|
-
- `isDisabled`: `boolean`
|
|
366
|
-
- `isReadOnly`: `boolean`
|
|
367
|
-
|
|
368
|
-
**SelectOption:**
|
|
369
|
-
- `value`: `string | number` - Option value
|
|
370
|
-
- `label`: `string` - Option display text
|
|
371
|
-
- `disabled`: `boolean` - Whether the option is disabled
|
|
167
|
+
**Key Props:** `mode` ("single" | "multiple"), `searchable`, `options`, `value`, `onChange`, `width`
|
|
372
168
|
|
|
373
|
-
###
|
|
169
|
+
### Tabs
|
|
374
170
|
|
|
375
|
-
|
|
171
|
+
Tab component for organizing content into multiple panels.
|
|
376
172
|
|
|
377
173
|
```tsx
|
|
378
|
-
import {
|
|
379
|
-
|
|
380
|
-
<
|
|
381
|
-
|
|
382
|
-
</
|
|
174
|
+
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'uiplex';
|
|
175
|
+
|
|
176
|
+
<Tabs defaultIndex={0}>
|
|
177
|
+
<TabList>
|
|
178
|
+
<Tab index={0}>Tab 1</Tab>
|
|
179
|
+
<Tab index={1}>Tab 2</Tab>
|
|
180
|
+
</TabList>
|
|
181
|
+
<TabPanels>
|
|
182
|
+
<TabPanel index={0}>Content 1</TabPanel>
|
|
183
|
+
<TabPanel index={1}>Content 2</TabPanel>
|
|
184
|
+
</TabPanels>
|
|
185
|
+
</Tabs>
|
|
383
186
|
```
|
|
384
187
|
|
|
385
|
-
**Props:**
|
|
386
|
-
- `variant`: `"primary" | "secondary" | "underline"`
|
|
387
|
-
- `size`: `"sm" | "md" | "lg"`
|
|
388
|
-
- `colorScheme`: `"blue" | "green" | "red" | "yellow" | "purple" | "gray"`
|
|
389
|
-
- All standard HTML anchor props
|
|
188
|
+
**Key Props:** `defaultIndex`, `variant` ("line" | "enclosed" | "soft-rounded"), `size`, `colorScheme`, `orientation`
|
|
390
189
|
|
|
391
|
-
###
|
|
190
|
+
### Accordion
|
|
392
191
|
|
|
393
|
-
|
|
192
|
+
Collapsible accordion component for organizing content.
|
|
394
193
|
|
|
395
194
|
```tsx
|
|
396
|
-
import {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
<
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
195
|
+
import { Accordion, AccordionItem, AccordionButton, AccordionPanel } from 'uiplex';
|
|
196
|
+
|
|
197
|
+
<Accordion defaultIndex={0} allowMultiple>
|
|
198
|
+
<AccordionItem index={0}>
|
|
199
|
+
<AccordionButton index={0}>Item 1</AccordionButton>
|
|
200
|
+
<AccordionPanel index={0}>Content 1</AccordionPanel>
|
|
201
|
+
</AccordionItem>
|
|
202
|
+
<AccordionItem index={1}>
|
|
203
|
+
<AccordionButton index={1}>Item 2</AccordionButton>
|
|
204
|
+
<AccordionPanel index={1}>Content 2</AccordionPanel>
|
|
205
|
+
</AccordionItem>
|
|
206
|
+
</Accordion>
|
|
405
207
|
```
|
|
406
208
|
|
|
407
|
-
**Props:**
|
|
408
|
-
- `icon`: `ReactNode` (required)
|
|
409
|
-
- `variant`: `"primary" | "secondary" | "outline" | "ghost"`
|
|
410
|
-
- `size`: `"sm" | "md" | "lg"`
|
|
411
|
-
- `colorScheme`: `"blue" | "green" | "red" | "yellow" | "purple" | "gray"`
|
|
412
|
-
- `disabled`: `boolean`
|
|
413
|
-
- `aria-label`: `string` (required for accessibility)
|
|
209
|
+
**Key Props:** `defaultIndex`, `allowMultiple`, `allowToggle`, `variant` ("default" | "bordered" | "filled"), `size`, `colorScheme`
|
|
414
210
|
|
|
415
|
-
###
|
|
211
|
+
### Modal
|
|
416
212
|
|
|
417
|
-
|
|
213
|
+
Modal dialog component for overlays and popups.
|
|
418
214
|
|
|
419
215
|
```tsx
|
|
420
|
-
import {
|
|
216
|
+
import { Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, ModalFooter, useDisclosure } from 'uiplex';
|
|
421
217
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
218
|
+
function MyComponent() {
|
|
219
|
+
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<>
|
|
223
|
+
<Button onClick={onOpen}>Open Modal</Button>
|
|
224
|
+
<Modal isOpen={isOpen} onClose={onClose}>
|
|
225
|
+
<ModalOverlay />
|
|
226
|
+
<ModalContent>
|
|
227
|
+
<ModalHeader>Title</ModalHeader>
|
|
228
|
+
<ModalBody>Content</ModalBody>
|
|
229
|
+
<ModalFooter>Footer</ModalFooter>
|
|
230
|
+
</ModalContent>
|
|
231
|
+
</Modal>
|
|
232
|
+
</>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
427
235
|
```
|
|
428
236
|
|
|
429
|
-
**Props:**
|
|
430
|
-
- `value`: `number` (0-100)
|
|
431
|
-
- `min`: `number`
|
|
432
|
-
- `max`: `number`
|
|
433
|
-
- `size`: `number | string`
|
|
434
|
-
- `thickness`: `number`
|
|
435
|
-
- `color`: `string`
|
|
436
|
-
- `trackColor`: `string`
|
|
437
|
-
- `isIndeterminate`: `boolean`
|
|
438
|
-
|
|
439
237
|
### Tooltip
|
|
440
238
|
|
|
441
239
|
Contextual information displayed on hover.
|
|
@@ -443,52 +241,31 @@ Contextual information displayed on hover.
|
|
|
443
241
|
```tsx
|
|
444
242
|
import { Tooltip } from 'uiplex';
|
|
445
243
|
|
|
446
|
-
<Tooltip label="
|
|
244
|
+
<Tooltip label="Helpful tooltip" placement="top" width={200}>
|
|
447
245
|
<Button>Hover me</Button>
|
|
448
246
|
</Tooltip>
|
|
449
247
|
```
|
|
450
248
|
|
|
451
|
-
**Props:**
|
|
452
|
-
- `label`: `string` (required)
|
|
453
|
-
- `placement`: `"top" | "bottom" | "left" | "right"`
|
|
454
|
-
- `width`: `string | number` (for wrapping long text)
|
|
455
|
-
- `isOpen`: `boolean` (controlled)
|
|
456
|
-
- `defaultIsOpen`: `boolean`
|
|
457
|
-
- `closeOnClick`: `boolean`
|
|
458
|
-
|
|
459
249
|
### Popover
|
|
460
250
|
|
|
461
|
-
Floating content container with positioning
|
|
251
|
+
Floating content container with positioning.
|
|
462
252
|
|
|
463
253
|
```tsx
|
|
464
|
-
import { Popover, PopoverContent, PopoverHeader, PopoverBody
|
|
254
|
+
import { Popover, PopoverContent, PopoverHeader, PopoverBody } from 'uiplex';
|
|
465
255
|
|
|
466
256
|
<Popover
|
|
467
257
|
content={
|
|
468
258
|
<PopoverContent>
|
|
469
|
-
<PopoverHeader>
|
|
470
|
-
<PopoverBody>
|
|
471
|
-
<PopoverFooter>
|
|
472
|
-
<PopoverCloseButton onClose={handleClose} />
|
|
473
|
-
</PopoverFooter>
|
|
259
|
+
<PopoverHeader>Title</PopoverHeader>
|
|
260
|
+
<PopoverBody>Content</PopoverBody>
|
|
474
261
|
</PopoverContent>
|
|
475
262
|
}
|
|
476
263
|
placement="bottom"
|
|
477
|
-
trigger="click"
|
|
478
264
|
>
|
|
479
265
|
<Button>Open Popover</Button>
|
|
480
266
|
</Popover>
|
|
481
267
|
```
|
|
482
268
|
|
|
483
|
-
**Props:**
|
|
484
|
-
- `content`: `ReactNode` (required)
|
|
485
|
-
- `placement`: `"top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end"`
|
|
486
|
-
- `trigger`: `"click" | "hover"`
|
|
487
|
-
- `isOpen`: `boolean` (controlled)
|
|
488
|
-
- `defaultIsOpen`: `boolean`
|
|
489
|
-
- `closeOnBlur`: `boolean`
|
|
490
|
-
- `showArrow`: `boolean`
|
|
491
|
-
|
|
492
269
|
### Toast
|
|
493
270
|
|
|
494
271
|
Toast notifications for displaying temporary messages.
|
|
@@ -496,69 +273,95 @@ Toast notifications for displaying temporary messages.
|
|
|
496
273
|
```tsx
|
|
497
274
|
import { Toast, ToastContainerGlobal } from 'uiplex';
|
|
498
275
|
|
|
499
|
-
// Add
|
|
276
|
+
// Add to root layout
|
|
500
277
|
<ToastContainerGlobal />
|
|
501
278
|
|
|
502
|
-
// Use
|
|
279
|
+
// Use static methods
|
|
503
280
|
Toast.success("Operation completed!");
|
|
504
281
|
Toast.error("Something went wrong");
|
|
505
|
-
Toast.warning("Please check
|
|
282
|
+
Toast.warning("Please check");
|
|
506
283
|
Toast.info("New update available");
|
|
284
|
+
```
|
|
507
285
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
}
|
|
286
|
+
### CircularProgress
|
|
287
|
+
|
|
288
|
+
Circular progress indicator.
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
import { CircularProgress, CircularProgressLabel } from 'uiplex';
|
|
292
|
+
|
|
293
|
+
<CircularProgress value={75} size={64}>
|
|
294
|
+
<CircularProgressLabel>75%</CircularProgressLabel>
|
|
295
|
+
</CircularProgress>
|
|
514
296
|
```
|
|
515
297
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
-
|
|
298
|
+
### IconButton
|
|
299
|
+
|
|
300
|
+
Button component for icons.
|
|
301
|
+
|
|
302
|
+
```tsx
|
|
303
|
+
import { IconButton } from 'uiplex';
|
|
304
|
+
import { Mail } from 'feather-icons-react';
|
|
305
|
+
|
|
306
|
+
<IconButton
|
|
307
|
+
icon={<Mail size={18} />}
|
|
308
|
+
variant="primary"
|
|
309
|
+
size="md"
|
|
310
|
+
aria-label="Send email"
|
|
311
|
+
/>
|
|
312
|
+
```
|
|
523
313
|
|
|
524
|
-
###
|
|
314
|
+
### Link
|
|
525
315
|
|
|
526
|
-
|
|
316
|
+
Link component with multiple variants.
|
|
527
317
|
|
|
528
318
|
```tsx
|
|
529
|
-
import {
|
|
319
|
+
import { Link } from 'uiplex';
|
|
530
320
|
|
|
531
|
-
<
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
321
|
+
<Link href="/about" variant="primary" size="md">
|
|
322
|
+
Learn More
|
|
323
|
+
</Link>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Layout Components
|
|
327
|
+
|
|
328
|
+
**Box** - Versatile container component
|
|
329
|
+
```tsx
|
|
330
|
+
<Box padding="md" margin="lg" borderRadius="md">Content</Box>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**Flex** - Flexbox layout component
|
|
334
|
+
```tsx
|
|
335
|
+
<Flex direction="row" align="center" justify="space-between" gap="md">
|
|
336
|
+
<Box>Item 1</Box>
|
|
337
|
+
<Box>Item 2</Box>
|
|
338
|
+
</Flex>
|
|
536
339
|
```
|
|
537
340
|
|
|
538
|
-
**
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
341
|
+
**Grid** - CSS Grid layout component
|
|
342
|
+
```tsx
|
|
343
|
+
<Grid columns={3} gap="md">
|
|
344
|
+
<Box>Item 1</Box>
|
|
345
|
+
<Box>Item 2</Box>
|
|
346
|
+
<Box>Item 3</Box>
|
|
347
|
+
</Grid>
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**Text** - Typography component
|
|
351
|
+
```tsx
|
|
352
|
+
<Text size="lg" weight="bold" color="primary">Heading</Text>
|
|
353
|
+
```
|
|
542
354
|
|
|
543
355
|
## Hooks
|
|
544
356
|
|
|
545
357
|
### useDisclosure
|
|
546
358
|
|
|
547
|
-
Hook for managing open/close state
|
|
359
|
+
Hook for managing open/close state.
|
|
548
360
|
|
|
549
361
|
```tsx
|
|
550
362
|
import { useDisclosure } from 'uiplex';
|
|
551
363
|
|
|
552
|
-
|
|
553
|
-
const { isOpen, onOpen, onClose, onToggle } = useDisclosure();
|
|
554
|
-
|
|
555
|
-
return (
|
|
556
|
-
<>
|
|
557
|
-
<Button onClick={onOpen}>Open</Button>
|
|
558
|
-
{isOpen && <Modal onClose={onClose}>Content</Modal>}
|
|
559
|
-
</>
|
|
560
|
-
);
|
|
561
|
-
}
|
|
364
|
+
const { isOpen, onOpen, onClose, onToggle } = useDisclosure();
|
|
562
365
|
```
|
|
563
366
|
|
|
564
367
|
### useOutsideClick
|
|
@@ -568,31 +371,21 @@ Hook for detecting clicks outside an element.
|
|
|
568
371
|
```tsx
|
|
569
372
|
import { useOutsideClick } from 'uiplex';
|
|
570
373
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
handler: () => {
|
|
577
|
-
// Handle outside click
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
return <div ref={ref}>Content</div>;
|
|
582
|
-
}
|
|
374
|
+
const ref = useRef(null);
|
|
375
|
+
useOutsideClick({
|
|
376
|
+
refs: [ref],
|
|
377
|
+
handler: () => console.log('Clicked outside')
|
|
378
|
+
});
|
|
583
379
|
```
|
|
584
380
|
|
|
585
381
|
## Theme System
|
|
586
382
|
|
|
587
|
-
The library includes a comprehensive theme system with light, dark, and system preference support.
|
|
588
|
-
|
|
589
383
|
### ThemeProvider
|
|
590
384
|
|
|
591
|
-
Wrap your app with `ThemeProvider
|
|
385
|
+
Wrap your app with `ThemeProvider`:
|
|
592
386
|
|
|
593
387
|
```tsx
|
|
594
|
-
import { ThemeProvider, useTheme } from 'uiplex';
|
|
595
|
-
import 'uiplex/theme.css';
|
|
388
|
+
import { ThemeProvider, useTheme, ThemeToggle } from 'uiplex';
|
|
596
389
|
|
|
597
390
|
function App() {
|
|
598
391
|
return (
|
|
@@ -605,51 +398,23 @@ function App() {
|
|
|
605
398
|
|
|
606
399
|
### useTheme Hook
|
|
607
400
|
|
|
608
|
-
Access and control the theme in your components:
|
|
609
|
-
|
|
610
401
|
```tsx
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
function MyComponent() {
|
|
614
|
-
const { theme, setTheme, resolvedTheme } = useTheme();
|
|
615
|
-
|
|
616
|
-
return (
|
|
617
|
-
<div>
|
|
618
|
-
<p>Current theme: {resolvedTheme}</p>
|
|
619
|
-
<button onClick={() => setTheme('dark')}>Dark</button>
|
|
620
|
-
<button onClick={() => setTheme('light')}>Light</button>
|
|
621
|
-
<button onClick={() => setTheme('system')}>System</button>
|
|
622
|
-
</div>
|
|
623
|
-
);
|
|
624
|
-
}
|
|
402
|
+
const { theme, setTheme, resolvedTheme } = useTheme();
|
|
625
403
|
```
|
|
626
404
|
|
|
627
405
|
### ThemeToggle Component
|
|
628
406
|
|
|
629
|
-
A ready-to-use theme toggle component:
|
|
630
|
-
|
|
631
407
|
```tsx
|
|
632
|
-
import { ThemeToggle } from 'uiplex';
|
|
633
|
-
|
|
634
408
|
<ThemeToggle />
|
|
635
409
|
```
|
|
636
410
|
|
|
637
411
|
## Styling
|
|
638
412
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
The bundled CSS includes:
|
|
642
|
-
- Theme CSS variables (light/dark mode support)
|
|
643
|
-
- Button, Loader, Radio styles
|
|
644
|
-
- Text, Box, Flex, Grid layout styles
|
|
645
|
-
- Modal, Input, Textarea, Select, FormControl styles
|
|
646
|
-
- Link, IconButton, CircularProgress styles
|
|
647
|
-
- Tooltip, Toast, Popover styles
|
|
648
|
-
|
|
649
|
-
All components automatically adapt to the current theme (light/dark) based on CSS variables.
|
|
413
|
+
CSS is automatically included when you import components. The library uses CSS variables for theming and supports light/dark modes.
|
|
650
414
|
|
|
651
|
-
|
|
415
|
+
All components automatically adapt to the current theme based on CSS variables.
|
|
652
416
|
|
|
417
|
+
**Manual CSS import** (if needed):
|
|
653
418
|
```tsx
|
|
654
419
|
import 'uiplex/styles.css';
|
|
655
420
|
```
|
|
@@ -658,7 +423,10 @@ import 'uiplex/styles.css';
|
|
|
658
423
|
|
|
659
424
|
This library is built with TypeScript and includes full type definitions. All components and their props are fully typed.
|
|
660
425
|
|
|
426
|
+
## Documentation
|
|
427
|
+
|
|
428
|
+
For complete documentation, examples, and API references, visit: [https://uiplex.ankitkaushal.in/](https://uiplex.ankitkaushal.in/)
|
|
429
|
+
|
|
661
430
|
## License
|
|
662
431
|
|
|
663
432
|
MIT
|
|
664
|
-
|