uiplex 1.0.2 → 1.2.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 +151 -403
- 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/Tabs/Tabs.d.ts +44 -0
- package/dist/Tabs/Tabs.d.ts.map +1 -0
- package/dist/Tabs/index.d.ts +3 -0
- package/dist/Tabs/index.d.ts.map +1 -0
- package/dist/index.cjs +250 -0
- package/dist/index.css +708 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +242 -1
- 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,145 +92,6 @@ import { Radio, RadioGroup } from 'uiplex';
|
|
|
113
92
|
/>
|
|
114
93
|
```
|
|
115
94
|
|
|
116
|
-
**Radio Props:**
|
|
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"`
|
|
125
|
-
|
|
126
|
-
**RadioGroup Props:**
|
|
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.
|
|
135
|
-
|
|
136
|
-
```tsx
|
|
137
|
-
import { Text } from 'uiplex';
|
|
138
|
-
|
|
139
|
-
<Text size="lg" weight="bold" color="primary">
|
|
140
|
-
Heading Text
|
|
141
|
-
</Text>
|
|
142
|
-
|
|
143
|
-
<Text size="md" align="center">
|
|
144
|
-
Centered text
|
|
145
|
-
</Text>
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
**Props:**
|
|
149
|
-
- `size`: `"xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl"`
|
|
150
|
-
- `weight`: `"normal" | "medium" | "semibold" | "bold"`
|
|
151
|
-
- `color`: `"primary" | "secondary" | "success" | "error" | "warning" | "info"`
|
|
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
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
**Modal Props:**
|
|
249
|
-
- `isOpen`: `boolean`
|
|
250
|
-
- `onClose`: `() => void`
|
|
251
|
-
- `size`: `"xs" | "sm" | "md" | "lg" | "xl" | "full"`
|
|
252
|
-
- `closeOnOverlayClick`: `boolean`
|
|
253
|
-
- `closeOnEsc`: `boolean`
|
|
254
|
-
|
|
255
95
|
### Input
|
|
256
96
|
|
|
257
97
|
Form input component with validation support.
|
|
@@ -261,23 +101,12 @@ import { Input, FormControl, FormLabel, FormErrorMessage } from 'uiplex';
|
|
|
261
101
|
|
|
262
102
|
<FormControl isInvalid={hasError}>
|
|
263
103
|
<FormLabel>Email</FormLabel>
|
|
264
|
-
<Input
|
|
265
|
-
type="email"
|
|
266
|
-
placeholder="Enter your email"
|
|
267
|
-
value={email}
|
|
268
|
-
onChange={(e) => setEmail(e.target.value)}
|
|
269
|
-
/>
|
|
104
|
+
<Input type="email" placeholder="Enter your email" />
|
|
270
105
|
<FormErrorMessage>Email is required</FormErrorMessage>
|
|
271
106
|
</FormControl>
|
|
272
107
|
```
|
|
273
108
|
|
|
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
|
|
109
|
+
**Key Props:** `size`, `variant`, `isInvalid`, `isDisabled`
|
|
281
110
|
|
|
282
111
|
### Textarea
|
|
283
112
|
|
|
@@ -286,36 +115,20 @@ Multi-line text input component.
|
|
|
286
115
|
```tsx
|
|
287
116
|
import { Textarea } from 'uiplex';
|
|
288
117
|
|
|
289
|
-
<Textarea
|
|
290
|
-
placeholder="Enter your message"
|
|
291
|
-
rows={4}
|
|
292
|
-
value={message}
|
|
293
|
-
onChange={(e) => setMessage(e.target.value)}
|
|
294
|
-
/>
|
|
118
|
+
<Textarea placeholder="Enter your message" rows={4} />
|
|
295
119
|
```
|
|
296
120
|
|
|
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
121
|
### Select
|
|
305
122
|
|
|
306
|
-
Custom dropdown
|
|
123
|
+
Custom dropdown with single/multi-select, search, and validation.
|
|
307
124
|
|
|
308
125
|
```tsx
|
|
309
|
-
import { Select
|
|
126
|
+
import { Select } from 'uiplex';
|
|
310
127
|
|
|
311
128
|
// Single select
|
|
312
129
|
<Select
|
|
313
130
|
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
|
-
]}
|
|
131
|
+
options={options}
|
|
319
132
|
value={value}
|
|
320
133
|
onChange={(value) => setValue(value)}
|
|
321
134
|
/>
|
|
@@ -323,119 +136,84 @@ import { Select, FormControl, FormLabel, FormErrorMessage } from 'uiplex';
|
|
|
323
136
|
// Multi-select
|
|
324
137
|
<Select
|
|
325
138
|
mode="multiple"
|
|
326
|
-
placeholder="Select multiple
|
|
139
|
+
placeholder="Select multiple"
|
|
327
140
|
options={options}
|
|
328
|
-
value={values}
|
|
329
|
-
onChange={(values) => setValues(values)}
|
|
330
141
|
/>
|
|
331
142
|
|
|
332
|
-
//
|
|
333
|
-
<Select
|
|
334
|
-
searchable
|
|
335
|
-
placeholder="Search and select..."
|
|
336
|
-
options={options}
|
|
337
|
-
/>
|
|
338
|
-
|
|
339
|
-
// With FormControl
|
|
340
|
-
<FormControl isInvalid={hasError}>
|
|
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>
|
|
143
|
+
// Searchable
|
|
144
|
+
<Select searchable placeholder="Search..." options={options} />
|
|
350
145
|
```
|
|
351
146
|
|
|
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
|
|
147
|
+
**Key Props:** `mode` ("single" | "multiple"), `searchable`, `options`, `value`, `onChange`, `width`
|
|
372
148
|
|
|
373
|
-
###
|
|
149
|
+
### Tabs
|
|
374
150
|
|
|
375
|
-
|
|
151
|
+
Tab component for organizing content into multiple panels.
|
|
376
152
|
|
|
377
153
|
```tsx
|
|
378
|
-
import {
|
|
379
|
-
|
|
380
|
-
<
|
|
381
|
-
|
|
382
|
-
</
|
|
154
|
+
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'uiplex';
|
|
155
|
+
|
|
156
|
+
<Tabs defaultIndex={0}>
|
|
157
|
+
<TabList>
|
|
158
|
+
<Tab index={0}>Tab 1</Tab>
|
|
159
|
+
<Tab index={1}>Tab 2</Tab>
|
|
160
|
+
</TabList>
|
|
161
|
+
<TabPanels>
|
|
162
|
+
<TabPanel index={0}>Content 1</TabPanel>
|
|
163
|
+
<TabPanel index={1}>Content 2</TabPanel>
|
|
164
|
+
</TabPanels>
|
|
165
|
+
</Tabs>
|
|
383
166
|
```
|
|
384
167
|
|
|
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
|
|
168
|
+
**Key Props:** `defaultIndex`, `variant` ("line" | "enclosed" | "soft-rounded"), `size`, `colorScheme`, `orientation`
|
|
390
169
|
|
|
391
|
-
###
|
|
170
|
+
### Accordion
|
|
392
171
|
|
|
393
|
-
|
|
172
|
+
Collapsible accordion component for organizing content.
|
|
394
173
|
|
|
395
174
|
```tsx
|
|
396
|
-
import {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
<
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
175
|
+
import { Accordion, AccordionItem, AccordionButton, AccordionPanel } from 'uiplex';
|
|
176
|
+
|
|
177
|
+
<Accordion defaultIndex={0} allowMultiple>
|
|
178
|
+
<AccordionItem index={0}>
|
|
179
|
+
<AccordionButton index={0}>Item 1</AccordionButton>
|
|
180
|
+
<AccordionPanel index={0}>Content 1</AccordionPanel>
|
|
181
|
+
</AccordionItem>
|
|
182
|
+
<AccordionItem index={1}>
|
|
183
|
+
<AccordionButton index={1}>Item 2</AccordionButton>
|
|
184
|
+
<AccordionPanel index={1}>Content 2</AccordionPanel>
|
|
185
|
+
</AccordionItem>
|
|
186
|
+
</Accordion>
|
|
405
187
|
```
|
|
406
188
|
|
|
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)
|
|
189
|
+
**Key Props:** `defaultIndex`, `allowMultiple`, `allowToggle`, `variant` ("default" | "bordered" | "filled"), `size`, `colorScheme`
|
|
414
190
|
|
|
415
|
-
###
|
|
191
|
+
### Modal
|
|
416
192
|
|
|
417
|
-
|
|
193
|
+
Modal dialog component for overlays and popups.
|
|
418
194
|
|
|
419
195
|
```tsx
|
|
420
|
-
import {
|
|
421
|
-
|
|
422
|
-
<CircularProgress value={75} size={64}>
|
|
423
|
-
<CircularProgressLabel>75%</CircularProgressLabel>
|
|
424
|
-
</CircularProgress>
|
|
196
|
+
import { Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, ModalFooter, useDisclosure } from 'uiplex';
|
|
425
197
|
|
|
426
|
-
|
|
198
|
+
function MyComponent() {
|
|
199
|
+
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<>
|
|
203
|
+
<Button onClick={onOpen}>Open Modal</Button>
|
|
204
|
+
<Modal isOpen={isOpen} onClose={onClose}>
|
|
205
|
+
<ModalOverlay />
|
|
206
|
+
<ModalContent>
|
|
207
|
+
<ModalHeader>Title</ModalHeader>
|
|
208
|
+
<ModalBody>Content</ModalBody>
|
|
209
|
+
<ModalFooter>Footer</ModalFooter>
|
|
210
|
+
</ModalContent>
|
|
211
|
+
</Modal>
|
|
212
|
+
</>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
427
215
|
```
|
|
428
216
|
|
|
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
217
|
### Tooltip
|
|
440
218
|
|
|
441
219
|
Contextual information displayed on hover.
|
|
@@ -443,52 +221,31 @@ Contextual information displayed on hover.
|
|
|
443
221
|
```tsx
|
|
444
222
|
import { Tooltip } from 'uiplex';
|
|
445
223
|
|
|
446
|
-
<Tooltip label="
|
|
224
|
+
<Tooltip label="Helpful tooltip" placement="top" width={200}>
|
|
447
225
|
<Button>Hover me</Button>
|
|
448
226
|
</Tooltip>
|
|
449
227
|
```
|
|
450
228
|
|
|
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
229
|
### Popover
|
|
460
230
|
|
|
461
|
-
Floating content container with positioning
|
|
231
|
+
Floating content container with positioning.
|
|
462
232
|
|
|
463
233
|
```tsx
|
|
464
|
-
import { Popover, PopoverContent, PopoverHeader, PopoverBody
|
|
234
|
+
import { Popover, PopoverContent, PopoverHeader, PopoverBody } from 'uiplex';
|
|
465
235
|
|
|
466
236
|
<Popover
|
|
467
237
|
content={
|
|
468
238
|
<PopoverContent>
|
|
469
|
-
<PopoverHeader>
|
|
470
|
-
<PopoverBody>
|
|
471
|
-
<PopoverFooter>
|
|
472
|
-
<PopoverCloseButton onClose={handleClose} />
|
|
473
|
-
</PopoverFooter>
|
|
239
|
+
<PopoverHeader>Title</PopoverHeader>
|
|
240
|
+
<PopoverBody>Content</PopoverBody>
|
|
474
241
|
</PopoverContent>
|
|
475
242
|
}
|
|
476
243
|
placement="bottom"
|
|
477
|
-
trigger="click"
|
|
478
244
|
>
|
|
479
245
|
<Button>Open Popover</Button>
|
|
480
246
|
</Popover>
|
|
481
247
|
```
|
|
482
248
|
|
|
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
249
|
### Toast
|
|
493
250
|
|
|
494
251
|
Toast notifications for displaying temporary messages.
|
|
@@ -496,69 +253,95 @@ Toast notifications for displaying temporary messages.
|
|
|
496
253
|
```tsx
|
|
497
254
|
import { Toast, ToastContainerGlobal } from 'uiplex';
|
|
498
255
|
|
|
499
|
-
// Add
|
|
256
|
+
// Add to root layout
|
|
500
257
|
<ToastContainerGlobal />
|
|
501
258
|
|
|
502
|
-
// Use
|
|
259
|
+
// Use static methods
|
|
503
260
|
Toast.success("Operation completed!");
|
|
504
261
|
Toast.error("Something went wrong");
|
|
505
|
-
Toast.warning("Please check
|
|
262
|
+
Toast.warning("Please check");
|
|
506
263
|
Toast.info("New update available");
|
|
264
|
+
```
|
|
507
265
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
}
|
|
266
|
+
### CircularProgress
|
|
267
|
+
|
|
268
|
+
Circular progress indicator.
|
|
269
|
+
|
|
270
|
+
```tsx
|
|
271
|
+
import { CircularProgress, CircularProgressLabel } from 'uiplex';
|
|
272
|
+
|
|
273
|
+
<CircularProgress value={75} size={64}>
|
|
274
|
+
<CircularProgressLabel>75%</CircularProgressLabel>
|
|
275
|
+
</CircularProgress>
|
|
514
276
|
```
|
|
515
277
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
-
|
|
278
|
+
### IconButton
|
|
279
|
+
|
|
280
|
+
Button component for icons.
|
|
281
|
+
|
|
282
|
+
```tsx
|
|
283
|
+
import { IconButton } from 'uiplex';
|
|
284
|
+
import { Mail } from 'feather-icons-react';
|
|
285
|
+
|
|
286
|
+
<IconButton
|
|
287
|
+
icon={<Mail size={18} />}
|
|
288
|
+
variant="primary"
|
|
289
|
+
size="md"
|
|
290
|
+
aria-label="Send email"
|
|
291
|
+
/>
|
|
292
|
+
```
|
|
523
293
|
|
|
524
|
-
###
|
|
294
|
+
### Link
|
|
525
295
|
|
|
526
|
-
|
|
296
|
+
Link component with multiple variants.
|
|
527
297
|
|
|
528
298
|
```tsx
|
|
529
|
-
import {
|
|
299
|
+
import { Link } from 'uiplex';
|
|
530
300
|
|
|
531
|
-
<
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
<FormErrorMessage>Username is required</FormErrorMessage>
|
|
535
|
-
</FormControl>
|
|
301
|
+
<Link href="/about" variant="primary" size="md">
|
|
302
|
+
Learn More
|
|
303
|
+
</Link>
|
|
536
304
|
```
|
|
537
305
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
-
|
|
541
|
-
|
|
306
|
+
### Layout Components
|
|
307
|
+
|
|
308
|
+
**Box** - Versatile container component
|
|
309
|
+
```tsx
|
|
310
|
+
<Box padding="md" margin="lg" borderRadius="md">Content</Box>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**Flex** - Flexbox layout component
|
|
314
|
+
```tsx
|
|
315
|
+
<Flex direction="row" align="center" justify="space-between" gap="md">
|
|
316
|
+
<Box>Item 1</Box>
|
|
317
|
+
<Box>Item 2</Box>
|
|
318
|
+
</Flex>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Grid** - CSS Grid layout component
|
|
322
|
+
```tsx
|
|
323
|
+
<Grid columns={3} gap="md">
|
|
324
|
+
<Box>Item 1</Box>
|
|
325
|
+
<Box>Item 2</Box>
|
|
326
|
+
<Box>Item 3</Box>
|
|
327
|
+
</Grid>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Text** - Typography component
|
|
331
|
+
```tsx
|
|
332
|
+
<Text size="lg" weight="bold" color="primary">Heading</Text>
|
|
333
|
+
```
|
|
542
334
|
|
|
543
335
|
## Hooks
|
|
544
336
|
|
|
545
337
|
### useDisclosure
|
|
546
338
|
|
|
547
|
-
Hook for managing open/close state
|
|
339
|
+
Hook for managing open/close state.
|
|
548
340
|
|
|
549
341
|
```tsx
|
|
550
342
|
import { useDisclosure } from 'uiplex';
|
|
551
343
|
|
|
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
|
-
}
|
|
344
|
+
const { isOpen, onOpen, onClose, onToggle } = useDisclosure();
|
|
562
345
|
```
|
|
563
346
|
|
|
564
347
|
### useOutsideClick
|
|
@@ -568,31 +351,21 @@ Hook for detecting clicks outside an element.
|
|
|
568
351
|
```tsx
|
|
569
352
|
import { useOutsideClick } from 'uiplex';
|
|
570
353
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
handler: () => {
|
|
577
|
-
// Handle outside click
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
return <div ref={ref}>Content</div>;
|
|
582
|
-
}
|
|
354
|
+
const ref = useRef(null);
|
|
355
|
+
useOutsideClick({
|
|
356
|
+
refs: [ref],
|
|
357
|
+
handler: () => console.log('Clicked outside')
|
|
358
|
+
});
|
|
583
359
|
```
|
|
584
360
|
|
|
585
361
|
## Theme System
|
|
586
362
|
|
|
587
|
-
The library includes a comprehensive theme system with light, dark, and system preference support.
|
|
588
|
-
|
|
589
363
|
### ThemeProvider
|
|
590
364
|
|
|
591
|
-
Wrap your app with `ThemeProvider
|
|
365
|
+
Wrap your app with `ThemeProvider`:
|
|
592
366
|
|
|
593
367
|
```tsx
|
|
594
|
-
import { ThemeProvider, useTheme } from 'uiplex';
|
|
595
|
-
import 'uiplex/theme.css';
|
|
368
|
+
import { ThemeProvider, useTheme, ThemeToggle } from 'uiplex';
|
|
596
369
|
|
|
597
370
|
function App() {
|
|
598
371
|
return (
|
|
@@ -605,51 +378,23 @@ function App() {
|
|
|
605
378
|
|
|
606
379
|
### useTheme Hook
|
|
607
380
|
|
|
608
|
-
Access and control the theme in your components:
|
|
609
|
-
|
|
610
381
|
```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
|
-
}
|
|
382
|
+
const { theme, setTheme, resolvedTheme } = useTheme();
|
|
625
383
|
```
|
|
626
384
|
|
|
627
385
|
### ThemeToggle Component
|
|
628
386
|
|
|
629
|
-
A ready-to-use theme toggle component:
|
|
630
|
-
|
|
631
387
|
```tsx
|
|
632
|
-
import { ThemeToggle } from 'uiplex';
|
|
633
|
-
|
|
634
388
|
<ThemeToggle />
|
|
635
389
|
```
|
|
636
390
|
|
|
637
391
|
## Styling
|
|
638
392
|
|
|
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.
|
|
393
|
+
CSS is automatically included when you import components. The library uses CSS variables for theming and supports light/dark modes.
|
|
650
394
|
|
|
651
|
-
|
|
395
|
+
All components automatically adapt to the current theme based on CSS variables.
|
|
652
396
|
|
|
397
|
+
**Manual CSS import** (if needed):
|
|
653
398
|
```tsx
|
|
654
399
|
import 'uiplex/styles.css';
|
|
655
400
|
```
|
|
@@ -658,7 +403,10 @@ import 'uiplex/styles.css';
|
|
|
658
403
|
|
|
659
404
|
This library is built with TypeScript and includes full type definitions. All components and their props are fully typed.
|
|
660
405
|
|
|
406
|
+
## Documentation
|
|
407
|
+
|
|
408
|
+
For complete documentation, examples, and API references, visit: [https://uiplex.ankitkaushal.in/](https://uiplex.ankitkaushal.in/)
|
|
409
|
+
|
|
661
410
|
## License
|
|
662
411
|
|
|
663
412
|
MIT
|
|
664
|
-
|