@ataraui/ataraui-react 0.3.0 → 0.4.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 +115 -3
- package/dist/index.d.mts +73 -1
- package/dist/index.d.ts +73 -1
- package/dist/index.js +558 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +543 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,11 +47,17 @@ Add the source and theme tokens to your `globals.css`:
|
|
|
47
47
|
## Usage
|
|
48
48
|
|
|
49
49
|
```tsx
|
|
50
|
+
import React from 'react'
|
|
50
51
|
import {
|
|
51
52
|
Button,
|
|
52
53
|
Input,
|
|
53
54
|
Badge,
|
|
54
|
-
Card,
|
|
55
|
+
Card,
|
|
56
|
+
CardHeader,
|
|
57
|
+
CardTitle,
|
|
58
|
+
CardDescription,
|
|
59
|
+
CardContent,
|
|
60
|
+
CardFooter,
|
|
55
61
|
Avatar,
|
|
56
62
|
Separator,
|
|
57
63
|
Spinner,
|
|
@@ -59,9 +65,26 @@ import {
|
|
|
59
65
|
Checkbox,
|
|
60
66
|
RadioGroup,
|
|
61
67
|
Switch,
|
|
68
|
+
Modal,
|
|
69
|
+
ModalHeader,
|
|
70
|
+
ModalTitle,
|
|
71
|
+
ModalDescription,
|
|
72
|
+
ModalBody,
|
|
73
|
+
ModalFooter,
|
|
74
|
+
Drawer,
|
|
75
|
+
DrawerHeader,
|
|
76
|
+
DrawerTitle,
|
|
77
|
+
DrawerDescription,
|
|
78
|
+
DrawerBody,
|
|
79
|
+
DrawerFooter,
|
|
80
|
+
Tooltip,
|
|
81
|
+
Popover,
|
|
62
82
|
} from '@ataraui/ataraui-react'
|
|
63
83
|
|
|
64
84
|
export default function Page() {
|
|
85
|
+
const [modalOpen, setModalOpen] = React.useState(false)
|
|
86
|
+
const [drawerOpen, setDrawerOpen] = React.useState(false)
|
|
87
|
+
|
|
65
88
|
return (
|
|
66
89
|
<div>
|
|
67
90
|
<Badge variant="default">New</Badge>
|
|
@@ -114,6 +137,48 @@ export default function Page() {
|
|
|
114
137
|
/>
|
|
115
138
|
|
|
116
139
|
<Switch label="Notifications" description="Receive email notifications." />
|
|
140
|
+
|
|
141
|
+
<Button onClick={() => setModalOpen(true)}>Open modal</Button>
|
|
142
|
+
<Modal open={modalOpen} onClose={() => setModalOpen(false)}>
|
|
143
|
+
<ModalHeader onClose={() => setModalOpen(false)}>
|
|
144
|
+
<ModalTitle>Confirm action</ModalTitle>
|
|
145
|
+
<ModalDescription>This action can be reviewed before continuing.</ModalDescription>
|
|
146
|
+
</ModalHeader>
|
|
147
|
+
<ModalBody>Use modals for focused workflows.</ModalBody>
|
|
148
|
+
<ModalFooter>
|
|
149
|
+
<Button variant="ghost" onClick={() => setModalOpen(false)}>Cancel</Button>
|
|
150
|
+
<Button onClick={() => setModalOpen(false)}>Continue</Button>
|
|
151
|
+
</ModalFooter>
|
|
152
|
+
</Modal>
|
|
153
|
+
|
|
154
|
+
<Button variant="outline" onClick={() => setDrawerOpen(true)}>Open drawer</Button>
|
|
155
|
+
<Drawer open={drawerOpen} onClose={() => setDrawerOpen(false)} side="right">
|
|
156
|
+
<DrawerHeader onClose={() => setDrawerOpen(false)}>
|
|
157
|
+
<DrawerTitle>Settings</DrawerTitle>
|
|
158
|
+
<DrawerDescription>Manage preferences without leaving the page.</DrawerDescription>
|
|
159
|
+
</DrawerHeader>
|
|
160
|
+
<DrawerBody>Drawer content goes here.</DrawerBody>
|
|
161
|
+
<DrawerFooter>
|
|
162
|
+
<Button onClick={() => setDrawerOpen(false)}>Save</Button>
|
|
163
|
+
</DrawerFooter>
|
|
164
|
+
</Drawer>
|
|
165
|
+
|
|
166
|
+
<Tooltip content="Helpful context" side="top">
|
|
167
|
+
<Button variant="outline">Hover me</Button>
|
|
168
|
+
</Tooltip>
|
|
169
|
+
|
|
170
|
+
<Popover
|
|
171
|
+
side="bottom"
|
|
172
|
+
align="start"
|
|
173
|
+
content={({ close }) => (
|
|
174
|
+
<div className="flex w-56 flex-col gap-3">
|
|
175
|
+
<p className="font-medium">Account settings</p>
|
|
176
|
+
<Button size="sm" onClick={close}>Done</Button>
|
|
177
|
+
</div>
|
|
178
|
+
)}
|
|
179
|
+
>
|
|
180
|
+
<Button variant="outline">Open popover</Button>
|
|
181
|
+
</Popover>
|
|
117
182
|
</div>
|
|
118
183
|
)
|
|
119
184
|
}
|
|
@@ -134,6 +199,10 @@ export default function Page() {
|
|
|
134
199
|
| `Checkbox` | — | ✅ Ready |
|
|
135
200
|
| `RadioGroup` | `vertical` `horizontal` | ✅ Ready |
|
|
136
201
|
| `Switch` | — | ✅ Ready |
|
|
202
|
+
| `Modal` | `sm` `md` `lg` `xl` `full` | ✅ Ready |
|
|
203
|
+
| `Drawer` | `left` `right` `top` `bottom` | ✅ Ready |
|
|
204
|
+
| `Tooltip` | `top` `bottom` `left` `right` | ✅ Ready |
|
|
205
|
+
| `Popover` | `top` `bottom` `left` `right` · `start` `center` `end` | ✅ Ready |
|
|
137
206
|
|
|
138
207
|
## Button Props
|
|
139
208
|
|
|
@@ -225,6 +294,49 @@ export default function Page() {
|
|
|
225
294
|
| `defaultChecked` | `boolean` | Default checked state (uncontrolled) |
|
|
226
295
|
| `onChange` | `ChangeEventHandler` | Change handler |
|
|
227
296
|
|
|
297
|
+
## Modal Props
|
|
298
|
+
|
|
299
|
+
| Prop | Type | Default | Description |
|
|
300
|
+
|------|------|---------|-------------|
|
|
301
|
+
| `open` | `boolean` | — | Controls whether the modal is visible |
|
|
302
|
+
| `onClose` | `() => void` | — | Called when the modal should close |
|
|
303
|
+
| `children` | `ReactNode` | — | Modal content |
|
|
304
|
+
| `size` | `sm` \| `md` \| `lg` \| `xl` \| `full` | `md` | Modal width |
|
|
305
|
+
| `closeOnOverlayClick` | `boolean` | `true` | Close when the overlay is clicked |
|
|
306
|
+
|
|
307
|
+
## Drawer Props
|
|
308
|
+
|
|
309
|
+
| Prop | Type | Default | Description |
|
|
310
|
+
|------|------|---------|-------------|
|
|
311
|
+
| `open` | `boolean` | — | Controls whether the drawer is visible |
|
|
312
|
+
| `onClose` | `() => void` | — | Called when the drawer should close |
|
|
313
|
+
| `children` | `ReactNode` | — | Drawer content |
|
|
314
|
+
| `side` | `left` \| `right` \| `top` \| `bottom` | `right` | Drawer placement |
|
|
315
|
+
| `size` | `sm` \| `md` \| `lg` \| `full` | `md` | Drawer width for left/right placements |
|
|
316
|
+
| `closeOnOverlayClick` | `boolean` | `true` | Close when the overlay is clicked |
|
|
317
|
+
|
|
318
|
+
## Tooltip Props
|
|
319
|
+
|
|
320
|
+
| Prop | Type | Default | Description |
|
|
321
|
+
|------|------|---------|-------------|
|
|
322
|
+
| `content` | `ReactNode` | — | Tooltip content |
|
|
323
|
+
| `children` | `ReactNode` | — | Tooltip trigger |
|
|
324
|
+
| `side` | `top` \| `bottom` \| `left` \| `right` | `top` | Tooltip placement |
|
|
325
|
+
| `delay` | `number` | `300` | Delay before showing the tooltip, in milliseconds |
|
|
326
|
+
|
|
327
|
+
## Popover Props
|
|
328
|
+
|
|
329
|
+
| Prop | Type | Default | Description |
|
|
330
|
+
|------|------|---------|-------------|
|
|
331
|
+
| `content` | `ReactNode` \| `(controls) => ReactNode` | — | Popover content, optionally with `close`, `open`, and `setOpen` controls |
|
|
332
|
+
| `children` | `ReactNode` | — | Popover trigger |
|
|
333
|
+
| `side` | `top` \| `bottom` \| `left` \| `right` | `bottom` | Popover placement |
|
|
334
|
+
| `align` | `start` \| `center` \| `end` | `center` | Popover alignment relative to the trigger |
|
|
335
|
+
| `open` | `boolean` | — | Controlled open state |
|
|
336
|
+
| `defaultOpen` | `boolean` | `false` | Initial open state for uncontrolled usage |
|
|
337
|
+
| `onOpenChange` | `(open: boolean) => void` | — | Called when open state changes |
|
|
338
|
+
| `closeOnOutsideClick` | `boolean` | `true` | Close when clicking outside the popover |
|
|
339
|
+
|
|
228
340
|
## Development
|
|
229
341
|
|
|
230
342
|
```bash
|
|
@@ -257,7 +369,7 @@ npm publish
|
|
|
257
369
|
| **v0.1.0** ✅ | `Button` `Input` `Badge` | Core + Tailwind v4 |
|
|
258
370
|
| **v0.2.0** ✅ | `Card` `Avatar` `Separator` `Spinner` | Layout primitives |
|
|
259
371
|
| **v0.3.0** ✅ | `Select` `Checkbox` `Radio` `Switch` | Form components |
|
|
260
|
-
| **v0.4.0** | `Modal/Dialog` `Drawer` `Tooltip` `Popover` | Overlay components |
|
|
372
|
+
| **v0.4.0** ✅ | `Modal/Dialog` `Drawer` `Tooltip` `Popover` | Overlay components |
|
|
261
373
|
| **v0.5.0** | `Toast/Alert` `Progress` `Skeleton` | Feedback components |
|
|
262
374
|
| **v0.6.0** | `Table` `Tabs` `Accordion` | Data display |
|
|
263
375
|
| **v0.7.0** | Dark mode · Storybook docs | DX improvements |
|
|
@@ -271,4 +383,4 @@ Contributions are welcome! Feel free to open an issue or submit a pull request.
|
|
|
271
383
|
|
|
272
384
|
## License
|
|
273
385
|
|
|
274
|
-
MIT © [
|
|
386
|
+
MIT © [AtaraUI](https://github.com/AtaraUI)
|
package/dist/index.d.mts
CHANGED
|
@@ -190,4 +190,76 @@ interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
190
190
|
}
|
|
191
191
|
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
declare const modalVariants: (props?: ({
|
|
194
|
+
size?: "sm" | "md" | "lg" | "xl" | "full" | null | undefined;
|
|
195
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
196
|
+
interface ModalProps extends VariantProps<typeof modalVariants> {
|
|
197
|
+
open: boolean;
|
|
198
|
+
onClose: () => void;
|
|
199
|
+
children: React.ReactNode;
|
|
200
|
+
className?: string;
|
|
201
|
+
closeOnOverlayClick?: boolean;
|
|
202
|
+
}
|
|
203
|
+
declare const Modal: React.FC<ModalProps>;
|
|
204
|
+
interface ModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
205
|
+
onClose?: () => void;
|
|
206
|
+
}
|
|
207
|
+
declare const ModalHeader: React.FC<ModalHeaderProps>;
|
|
208
|
+
declare const ModalTitle: React.FC<React.HTMLAttributes<HTMLHeadingElement>>;
|
|
209
|
+
declare const ModalDescription: React.FC<React.HTMLAttributes<HTMLParagraphElement>>;
|
|
210
|
+
declare const ModalBody: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
211
|
+
declare const ModalFooter: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
212
|
+
|
|
213
|
+
declare const drawerVariants: (props?: ({
|
|
214
|
+
side?: "bottom" | "left" | "right" | "top" | null | undefined;
|
|
215
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
216
|
+
interface DrawerProps extends VariantProps<typeof drawerVariants> {
|
|
217
|
+
open: boolean;
|
|
218
|
+
onClose: () => void;
|
|
219
|
+
children: React.ReactNode;
|
|
220
|
+
className?: string;
|
|
221
|
+
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
222
|
+
closeOnOverlayClick?: boolean;
|
|
223
|
+
}
|
|
224
|
+
declare const Drawer: React.FC<DrawerProps>;
|
|
225
|
+
interface DrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
226
|
+
onClose?: () => void;
|
|
227
|
+
}
|
|
228
|
+
declare const DrawerHeader: React.FC<DrawerHeaderProps>;
|
|
229
|
+
declare const DrawerTitle: React.FC<React.HTMLAttributes<HTMLHeadingElement>>;
|
|
230
|
+
declare const DrawerDescription: React.FC<React.HTMLAttributes<HTMLParagraphElement>>;
|
|
231
|
+
declare const DrawerBody: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
232
|
+
declare const DrawerFooter: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
233
|
+
|
|
234
|
+
type TooltipSide = 'top' | 'bottom' | 'left' | 'right';
|
|
235
|
+
interface TooltipProps {
|
|
236
|
+
content: React.ReactNode;
|
|
237
|
+
children: React.ReactNode;
|
|
238
|
+
side?: TooltipSide;
|
|
239
|
+
delay?: number;
|
|
240
|
+
className?: string;
|
|
241
|
+
}
|
|
242
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
243
|
+
|
|
244
|
+
type PopoverSide = 'top' | 'bottom' | 'left' | 'right';
|
|
245
|
+
type PopoverAlign = 'start' | 'center' | 'end';
|
|
246
|
+
type PopoverControls = {
|
|
247
|
+
close: () => void;
|
|
248
|
+
open: () => void;
|
|
249
|
+
setOpen: (open: boolean) => void;
|
|
250
|
+
};
|
|
251
|
+
type PopoverContent = React.ReactNode | ((controls: PopoverControls) => React.ReactNode);
|
|
252
|
+
interface PopoverProps {
|
|
253
|
+
content: PopoverContent;
|
|
254
|
+
children: React.ReactNode;
|
|
255
|
+
side?: PopoverSide;
|
|
256
|
+
align?: PopoverAlign;
|
|
257
|
+
open?: boolean;
|
|
258
|
+
defaultOpen?: boolean;
|
|
259
|
+
onOpenChange?: (open: boolean) => void;
|
|
260
|
+
className?: string;
|
|
261
|
+
closeOnOutsideClick?: boolean;
|
|
262
|
+
}
|
|
263
|
+
declare const Popover: React.FC<PopoverProps>;
|
|
264
|
+
|
|
265
|
+
export { Avatar, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, Drawer, DrawerBody, DrawerDescription, DrawerFooter, DrawerHeader, type DrawerHeaderProps, type DrawerProps, DrawerTitle, Input, type InputProps, Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, type ModalHeaderProps, type ModalProps, ModalTitle, Popover, type PopoverProps, RadioGroup, type RadioGroupProps, type RadioOption, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Spinner, type SpinnerProps, Switch, type SwitchProps, Tooltip, type TooltipProps, avatarVariants, badgeVariants, buttonVariants, cardVariants, cn, colors, drawerVariants, fontSize, inputVariants, modalVariants, radius, selectVariants, separatorVariants, spinnerVariants };
|
package/dist/index.d.ts
CHANGED
|
@@ -190,4 +190,76 @@ interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
190
190
|
}
|
|
191
191
|
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
declare const modalVariants: (props?: ({
|
|
194
|
+
size?: "sm" | "md" | "lg" | "xl" | "full" | null | undefined;
|
|
195
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
196
|
+
interface ModalProps extends VariantProps<typeof modalVariants> {
|
|
197
|
+
open: boolean;
|
|
198
|
+
onClose: () => void;
|
|
199
|
+
children: React.ReactNode;
|
|
200
|
+
className?: string;
|
|
201
|
+
closeOnOverlayClick?: boolean;
|
|
202
|
+
}
|
|
203
|
+
declare const Modal: React.FC<ModalProps>;
|
|
204
|
+
interface ModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
205
|
+
onClose?: () => void;
|
|
206
|
+
}
|
|
207
|
+
declare const ModalHeader: React.FC<ModalHeaderProps>;
|
|
208
|
+
declare const ModalTitle: React.FC<React.HTMLAttributes<HTMLHeadingElement>>;
|
|
209
|
+
declare const ModalDescription: React.FC<React.HTMLAttributes<HTMLParagraphElement>>;
|
|
210
|
+
declare const ModalBody: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
211
|
+
declare const ModalFooter: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
212
|
+
|
|
213
|
+
declare const drawerVariants: (props?: ({
|
|
214
|
+
side?: "bottom" | "left" | "right" | "top" | null | undefined;
|
|
215
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
216
|
+
interface DrawerProps extends VariantProps<typeof drawerVariants> {
|
|
217
|
+
open: boolean;
|
|
218
|
+
onClose: () => void;
|
|
219
|
+
children: React.ReactNode;
|
|
220
|
+
className?: string;
|
|
221
|
+
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
222
|
+
closeOnOverlayClick?: boolean;
|
|
223
|
+
}
|
|
224
|
+
declare const Drawer: React.FC<DrawerProps>;
|
|
225
|
+
interface DrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
226
|
+
onClose?: () => void;
|
|
227
|
+
}
|
|
228
|
+
declare const DrawerHeader: React.FC<DrawerHeaderProps>;
|
|
229
|
+
declare const DrawerTitle: React.FC<React.HTMLAttributes<HTMLHeadingElement>>;
|
|
230
|
+
declare const DrawerDescription: React.FC<React.HTMLAttributes<HTMLParagraphElement>>;
|
|
231
|
+
declare const DrawerBody: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
232
|
+
declare const DrawerFooter: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
233
|
+
|
|
234
|
+
type TooltipSide = 'top' | 'bottom' | 'left' | 'right';
|
|
235
|
+
interface TooltipProps {
|
|
236
|
+
content: React.ReactNode;
|
|
237
|
+
children: React.ReactNode;
|
|
238
|
+
side?: TooltipSide;
|
|
239
|
+
delay?: number;
|
|
240
|
+
className?: string;
|
|
241
|
+
}
|
|
242
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
243
|
+
|
|
244
|
+
type PopoverSide = 'top' | 'bottom' | 'left' | 'right';
|
|
245
|
+
type PopoverAlign = 'start' | 'center' | 'end';
|
|
246
|
+
type PopoverControls = {
|
|
247
|
+
close: () => void;
|
|
248
|
+
open: () => void;
|
|
249
|
+
setOpen: (open: boolean) => void;
|
|
250
|
+
};
|
|
251
|
+
type PopoverContent = React.ReactNode | ((controls: PopoverControls) => React.ReactNode);
|
|
252
|
+
interface PopoverProps {
|
|
253
|
+
content: PopoverContent;
|
|
254
|
+
children: React.ReactNode;
|
|
255
|
+
side?: PopoverSide;
|
|
256
|
+
align?: PopoverAlign;
|
|
257
|
+
open?: boolean;
|
|
258
|
+
defaultOpen?: boolean;
|
|
259
|
+
onOpenChange?: (open: boolean) => void;
|
|
260
|
+
className?: string;
|
|
261
|
+
closeOnOutsideClick?: boolean;
|
|
262
|
+
}
|
|
263
|
+
declare const Popover: React.FC<PopoverProps>;
|
|
264
|
+
|
|
265
|
+
export { Avatar, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, Drawer, DrawerBody, DrawerDescription, DrawerFooter, DrawerHeader, type DrawerHeaderProps, type DrawerProps, DrawerTitle, Input, type InputProps, Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, type ModalHeaderProps, type ModalProps, ModalTitle, Popover, type PopoverProps, RadioGroup, type RadioGroupProps, type RadioOption, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Spinner, type SpinnerProps, Switch, type SwitchProps, Tooltip, type TooltipProps, avatarVariants, badgeVariants, buttonVariants, cardVariants, cn, colors, drawerVariants, fontSize, inputVariants, modalVariants, radius, selectVariants, separatorVariants, spinnerVariants };
|