@manhphi1309/dialog 0.1.2 → 0.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/dist/index.d.cts CHANGED
@@ -1,23 +1,110 @@
1
- import * as _$react from "react";
1
+ import * as React from "react";
2
2
  import { Dialog as Dialog$1 } from "radix-ui";
3
3
 
4
- //#region index.d.ts
4
+ //#region src/dialog.d.ts
5
+ /**
6
+ * Root dialog component. Controls open/close state and provides context
7
+ * to all child primitives via Radix `Dialog.Root`.
8
+ *
9
+ * Can be used as **uncontrolled** (via `defaultOpen`) or **controlled**
10
+ * (via `open` + `onOpenChange`).
11
+ *
12
+ * @example
13
+ * // Uncontrolled
14
+ * <Dialog>
15
+ * <DialogTrigger>Open</DialogTrigger>
16
+ * <DialogContent>...</DialogContent>
17
+ * </Dialog>
18
+ *
19
+ * @example
20
+ * // Controlled
21
+ * const [open, setOpen] = useState(false)
22
+ * <Dialog open={open} onOpenChange={setOpen}>
23
+ * <DialogContent>...</DialogContent>
24
+ * </Dialog>
25
+ */
5
26
  declare function Dialog({
6
27
  ...props
7
- }: React.ComponentProps<typeof Dialog$1.Root>): _$react.JSX.Element;
28
+ }: React.ComponentProps<typeof Dialog$1.Root>): React.JSX.Element;
29
+ /**
30
+ * The element that opens the dialog when activated (clicked / keyboard).
31
+ * Thin wrapper around Radix `Dialog.Trigger`.
32
+ *
33
+ * Use `asChild` to compose with your own element instead of the default button.
34
+ *
35
+ * @example
36
+ * <DialogTrigger asChild>
37
+ * <Button variant="outline">Open</Button>
38
+ * </DialogTrigger>
39
+ */
8
40
  declare function DialogTrigger({
9
41
  ...props
10
- }: React.ComponentProps<typeof Dialog$1.Trigger>): _$react.JSX.Element;
42
+ }: React.ComponentProps<typeof Dialog$1.Trigger>): React.JSX.Element;
43
+ /**
44
+ * Renders its children into a **portal** appended to `document.body`,
45
+ * outside the current DOM tree. This ensures the dialog always appears
46
+ * above other content and is never clipped by parent `overflow` or `z-index`.
47
+ *
48
+ * You rarely need to use this directly — `DialogContent` already wraps its
49
+ * output in a portal automatically.
50
+ */
11
51
  declare function DialogPortal({
12
52
  ...props
13
- }: React.ComponentProps<typeof Dialog$1.Portal>): _$react.JSX.Element;
53
+ }: React.ComponentProps<typeof Dialog$1.Portal>): React.JSX.Element;
54
+ /**
55
+ * A primitive close trigger. Closes the dialog when activated.
56
+ * Use `asChild` to compose with a custom element.
57
+ *
58
+ * Prefer the built-in `showCloseButton` prop on `DialogContent` or
59
+ * `DialogFooter` for standard close affordances. Use this component
60
+ * when you need a completely custom close action inside the dialog body.
61
+ *
62
+ * @example
63
+ * <DialogClose asChild>
64
+ * <Button variant="ghost">Cancel</Button>
65
+ * </DialogClose>
66
+ */
14
67
  declare function DialogClose({
15
68
  ...props
16
- }: React.ComponentProps<typeof Dialog$1.Close>): _$react.JSX.Element;
69
+ }: React.ComponentProps<typeof Dialog$1.Close>): React.JSX.Element;
70
+ /**
71
+ * The semi-transparent **backdrop** rendered behind the dialog panel.
72
+ * Covers the full viewport (`fixed inset-0`) with a slight blur and dark tint.
73
+ *
74
+ * Animates:
75
+ * - **Open** → `fade-in-0`
76
+ * - **Close** → `fade-out-0`
77
+ *
78
+ * You rarely need to use this directly — `DialogContent` renders it
79
+ * automatically via `DialogPortal`.
80
+ */
17
81
  declare function DialogOverlay({
18
82
  className,
19
83
  ...props
20
- }: React.ComponentProps<typeof Dialog$1.Overlay>): _$react.JSX.Element;
84
+ }: React.ComponentProps<typeof Dialog$1.Overlay>): React.JSX.Element;
85
+ /**
86
+ * The **visible panel** of the dialog. Rendered centred on screen via
87
+ * `position: fixed; top: 50%; left: 50%; translate(-50%, -50%)`.
88
+ * Automatically wraps itself in `DialogPortal` and renders `DialogOverlay`
89
+ * behind it.
90
+ *
91
+ * By default a ghost ✕ button is positioned in the top-right corner.
92
+ * Pass `showCloseButton={false}` to remove it when you want to control
93
+ * close behaviour exclusively from the footer.
94
+ *
95
+ * Animates:
96
+ * - **Open** → `fade-in-0 + zoom-in-95`
97
+ * - **Close** → `fade-out-0 + zoom-out-95`
98
+ *
99
+ * @param showCloseButton - Whether to render the ✕ ghost button in the
100
+ * top-right corner. Defaults to `true`.
101
+ *
102
+ * @example
103
+ * <DialogContent showCloseButton={false}>
104
+ * <DialogHeader>...</DialogHeader>
105
+ * <DialogFooter showCloseButton>...</DialogFooter>
106
+ * </DialogContent>
107
+ */
21
108
  declare function DialogContent({
22
109
  className,
23
110
  children,
@@ -25,11 +112,36 @@ declare function DialogContent({
25
112
  ...props
26
113
  }: React.ComponentProps<typeof Dialog$1.Content> & {
27
114
  showCloseButton?: boolean;
28
- }): _$react.JSX.Element;
115
+ }): React.JSX.Element;
116
+ /**
117
+ * Layout wrapper for the **top section** of a dialog.
118
+ * Stacks children vertically with `gap-2`. Typically contains
119
+ * `DialogTitle` and optionally `DialogDescription`.
120
+ *
121
+ * @example
122
+ * <DialogHeader>
123
+ * <DialogTitle>Confirm deletion</DialogTitle>
124
+ * <DialogDescription>This action is irreversible.</DialogDescription>
125
+ * </DialogHeader>
126
+ */
29
127
  declare function DialogHeader({
30
128
  className,
31
129
  ...props
32
- }: React.ComponentProps<"div">): _$react.JSX.Element;
130
+ }: React.ComponentProps<"div">): React.JSX.Element;
131
+ /**
132
+ * Layout wrapper for the **bottom action area** of a dialog.
133
+ * Bleeds to the content panel edges (`-mx-4 -mb-4`), adds a top border
134
+ * and a subtle muted background tint. Actions stack vertically on mobile
135
+ * and align to the right on `sm+` screens.
136
+ *
137
+ * @param showCloseButton - When `true`, appends an outline `Close` button
138
+ * wired to `DialogClose` after any provided `children`. Defaults to `false`.
139
+ *
140
+ * @example
141
+ * <DialogFooter showCloseButton>
142
+ * <Button type="submit">Save</Button>
143
+ * </DialogFooter>
144
+ */
33
145
  declare function DialogFooter({
34
146
  className,
35
147
  showCloseButton,
@@ -37,14 +149,192 @@ declare function DialogFooter({
37
149
  ...props
38
150
  }: React.ComponentProps<"div"> & {
39
151
  showCloseButton?: boolean;
40
- }): _$react.JSX.Element;
152
+ }): React.JSX.Element;
153
+ /**
154
+ * The **accessible title** of the dialog. Rendered as a Radix `Dialog.Title`,
155
+ * which is automatically linked to the dialog content via `aria-labelledby`.
156
+ * Screen readers announce this text when the dialog opens.
157
+ *
158
+ * Styled with the heading font token at `text-base font-medium`.
159
+ *
160
+ * @remarks Required for accessibility. Every dialog should have a title,
161
+ * even if visually hidden with `className="sr-only"`.
162
+ */
41
163
  declare function DialogTitle({
42
164
  className,
43
165
  ...props
44
- }: React.ComponentProps<typeof Dialog$1.Title>): _$react.JSX.Element;
166
+ }: React.ComponentProps<typeof Dialog$1.Title>): React.JSX.Element;
167
+ /**
168
+ * The **accessible description** of the dialog. Rendered as a Radix
169
+ * `Dialog.Description`, which is linked to the dialog content via
170
+ * `aria-describedby`. Screen readers read this after the title.
171
+ *
172
+ * Styled as small muted text. Anchor tags (`<a>`) inside the description
173
+ * are automatically underlined and change colour on hover.
174
+ *
175
+ * @remarks Optional but recommended. Omit only if the dialog content itself
176
+ * is sufficiently self-descriptive.
177
+ */
45
178
  declare function DialogDescription({
46
179
  className,
47
180
  ...props
48
- }: React.ComponentProps<typeof Dialog$1.Description>): _$react.JSX.Element;
181
+ }: React.ComponentProps<typeof Dialog$1.Description>): React.JSX.Element;
49
182
  //#endregion
50
- export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
183
+ //#region src/responsive-dialog.d.ts
184
+ /**
185
+ * Adaptive root component that switches between `Dialog` and `Drawer`
186
+ * depending on screen width:
187
+ * - **Desktop (≥ 768 px)** → renders `Dialog` (centred modal overlay)
188
+ * - **Mobile (< 768 px)** → renders `Drawer` (bottom-sheet panel)
189
+ *
190
+ * All props are forwarded unchanged to the active primitive, so `open`,
191
+ * `defaultOpen`, `onOpenChange`, and `modal` all behave identically to
192
+ * the standard `Dialog` root.
193
+ *
194
+ * @example
195
+ * <ResponsiveDialog>
196
+ * <ResponsiveDialogTrigger asChild>
197
+ * <Button>Open</Button>
198
+ * </ResponsiveDialogTrigger>
199
+ * <ResponsiveDialogContent>
200
+ * <ResponsiveDialogHeader>
201
+ * <ResponsiveDialogTitle>Title</ResponsiveDialogTitle>
202
+ * </ResponsiveDialogHeader>
203
+ * </ResponsiveDialogContent>
204
+ * </ResponsiveDialog>
205
+ */
206
+ declare function ResponsiveDialog({
207
+ children,
208
+ ...props
209
+ }: React.ComponentProps<typeof Dialog$1.Root>): React.JSX.Element;
210
+ /**
211
+ * The element that opens the responsive dialog/drawer when activated.
212
+ *
213
+ * - **Desktop** → `DialogTrigger` (Radix `Dialog.Trigger`)
214
+ * - **Mobile** → `DrawerTrigger` (Vaul `Drawer.Trigger`)
215
+ *
216
+ * Use `asChild` to render your own element as the trigger instead of
217
+ * the default button wrapper.
218
+ *
219
+ * @example
220
+ * <ResponsiveDialogTrigger asChild>
221
+ * <Button variant="outline">Open</Button>
222
+ * </ResponsiveDialogTrigger>
223
+ */
224
+ declare function ResponsiveDialogTrigger({
225
+ children,
226
+ ...props
227
+ }: React.ComponentProps<typeof Dialog$1.Trigger>): React.JSX.Element;
228
+ /**
229
+ * A close trigger that targets the correct primitive for the current
230
+ * viewport:
231
+ * - **Desktop** → `DialogClose` (Radix `Dialog.Close`)
232
+ * - **Mobile** → `DrawerClose` (Vaul `Drawer.Close`)
233
+ *
234
+ * Use `asChild` to wrap a custom element.
235
+ *
236
+ * @example
237
+ * <ResponsiveDialogClose asChild>
238
+ * <Button variant="ghost">Cancel</Button>
239
+ * </ResponsiveDialogClose>
240
+ */
241
+ declare function ResponsiveDialogClose({
242
+ children,
243
+ ...props
244
+ }: React.ComponentProps<typeof Dialog$1.Close>): React.JSX.Element;
245
+ /**
246
+ * The visible panel of the responsive dialog. Delegates to the
247
+ * appropriate primitive:
248
+ * - **Desktop** → `DialogContent` — centred modal with fade + zoom animations.
249
+ * The ✕ close button is shown by default (`showCloseButton={true}`).
250
+ * - **Mobile** → `DrawerContent` — bottom-sheet panel with a drag handle.
251
+ * `showCloseButton` has **no effect** on mobile; the drawer is closed
252
+ * via swipe gesture or the drag handle.
253
+ *
254
+ * @param showCloseButton - Show/hide the ✕ button in the top-right corner
255
+ * on desktop. Has no effect on mobile. Defaults to `true`.
256
+ *
257
+ * @example
258
+ * // Hide the ✕ button and force close via footer only (desktop)
259
+ * <ResponsiveDialogContent showCloseButton={false}>
260
+ * ...
261
+ * </ResponsiveDialogContent>
262
+ */
263
+ declare function ResponsiveDialogContent({
264
+ className,
265
+ children,
266
+ showCloseButton,
267
+ ...props
268
+ }: React.ComponentProps<typeof Dialog$1.Content> & {
269
+ showCloseButton?: boolean;
270
+ }): React.JSX.Element;
271
+ /**
272
+ * Layout wrapper for the **top section** of the responsive dialog/drawer.
273
+ *
274
+ * - **Desktop** → `DialogHeader` — vertical stack with `gap-2`
275
+ * - **Mobile** → `DrawerHeader` — vertically centred text for bottom/top
276
+ * drawers, left-aligned for side drawers
277
+ *
278
+ * Typically contains `ResponsiveDialogTitle` and optionally
279
+ * `ResponsiveDialogDescription`.
280
+ */
281
+ declare function ResponsiveDialogHeader({
282
+ className,
283
+ ...props
284
+ }: React.ComponentProps<"div">): React.JSX.Element;
285
+ /**
286
+ * Layout wrapper for the **bottom action area** of the responsive
287
+ * dialog/drawer.
288
+ *
289
+ * - **Desktop** → `DialogFooter` — bleeds to panel edges, top border,
290
+ * actions aligned right on `sm+`
291
+ * - **Mobile** → `DrawerFooter` — `mt-auto` stacked column at the bottom
292
+ * of the drawer
293
+ *
294
+ * @param showCloseButton - When `true`, appends a close button after
295
+ * `children`. On **desktop** this is a `DialogClose`-wrapped outline
296
+ * button; on **mobile** this is a `DrawerClose`-wrapped outline button.
297
+ * Defaults to `false`.
298
+ *
299
+ * @example
300
+ * <ResponsiveDialogFooter showCloseButton>
301
+ * <Button type="submit">Save</Button>
302
+ * </ResponsiveDialogFooter>
303
+ */
304
+ declare function ResponsiveDialogFooter({
305
+ className,
306
+ children,
307
+ showCloseButton,
308
+ ...props
309
+ }: React.ComponentProps<"div"> & {
310
+ showCloseButton?: boolean;
311
+ }): React.JSX.Element;
312
+ /**
313
+ * The **accessible title** of the responsive dialog/drawer.
314
+ *
315
+ * - **Desktop** → `DialogTitle` (linked via `aria-labelledby`)
316
+ * - **Mobile** → `DrawerTitle` (linked via `aria-labelledby`)
317
+ *
318
+ * Screen readers announce this text when the panel opens.
319
+ *
320
+ * @remarks Required for accessibility on both desktop and mobile.
321
+ */
322
+ declare function ResponsiveDialogTitle({
323
+ className,
324
+ ...props
325
+ }: React.ComponentProps<typeof Dialog$1.Title>): React.JSX.Element;
326
+ /**
327
+ * The **accessible description** of the responsive dialog/drawer.
328
+ *
329
+ * - **Desktop** → `DialogDescription` (linked via `aria-describedby`)
330
+ * - **Mobile** → `DrawerDescription` (linked via `aria-describedby`)
331
+ *
332
+ * @remarks Optional but recommended. Provides supplementary context for
333
+ * screen reader users after the title is announced.
334
+ */
335
+ declare function ResponsiveDialogDescription({
336
+ className,
337
+ ...props
338
+ }: React.ComponentProps<typeof Dialog$1.Description>): React.JSX.Element;
339
+ //#endregion
340
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, ResponsiveDialog, ResponsiveDialogClose, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHeader, ResponsiveDialogTitle, ResponsiveDialogTrigger };
package/dist/index.d.mts CHANGED
@@ -1,23 +1,110 @@
1
+ import * as React from "react";
1
2
  import { Dialog as Dialog$1 } from "radix-ui";
2
- import * as _$react from "react";
3
3
 
4
- //#region index.d.ts
4
+ //#region src/dialog.d.ts
5
+ /**
6
+ * Root dialog component. Controls open/close state and provides context
7
+ * to all child primitives via Radix `Dialog.Root`.
8
+ *
9
+ * Can be used as **uncontrolled** (via `defaultOpen`) or **controlled**
10
+ * (via `open` + `onOpenChange`).
11
+ *
12
+ * @example
13
+ * // Uncontrolled
14
+ * <Dialog>
15
+ * <DialogTrigger>Open</DialogTrigger>
16
+ * <DialogContent>...</DialogContent>
17
+ * </Dialog>
18
+ *
19
+ * @example
20
+ * // Controlled
21
+ * const [open, setOpen] = useState(false)
22
+ * <Dialog open={open} onOpenChange={setOpen}>
23
+ * <DialogContent>...</DialogContent>
24
+ * </Dialog>
25
+ */
5
26
  declare function Dialog({
6
27
  ...props
7
- }: React.ComponentProps<typeof Dialog$1.Root>): _$react.JSX.Element;
28
+ }: React.ComponentProps<typeof Dialog$1.Root>): React.JSX.Element;
29
+ /**
30
+ * The element that opens the dialog when activated (clicked / keyboard).
31
+ * Thin wrapper around Radix `Dialog.Trigger`.
32
+ *
33
+ * Use `asChild` to compose with your own element instead of the default button.
34
+ *
35
+ * @example
36
+ * <DialogTrigger asChild>
37
+ * <Button variant="outline">Open</Button>
38
+ * </DialogTrigger>
39
+ */
8
40
  declare function DialogTrigger({
9
41
  ...props
10
- }: React.ComponentProps<typeof Dialog$1.Trigger>): _$react.JSX.Element;
42
+ }: React.ComponentProps<typeof Dialog$1.Trigger>): React.JSX.Element;
43
+ /**
44
+ * Renders its children into a **portal** appended to `document.body`,
45
+ * outside the current DOM tree. This ensures the dialog always appears
46
+ * above other content and is never clipped by parent `overflow` or `z-index`.
47
+ *
48
+ * You rarely need to use this directly — `DialogContent` already wraps its
49
+ * output in a portal automatically.
50
+ */
11
51
  declare function DialogPortal({
12
52
  ...props
13
- }: React.ComponentProps<typeof Dialog$1.Portal>): _$react.JSX.Element;
53
+ }: React.ComponentProps<typeof Dialog$1.Portal>): React.JSX.Element;
54
+ /**
55
+ * A primitive close trigger. Closes the dialog when activated.
56
+ * Use `asChild` to compose with a custom element.
57
+ *
58
+ * Prefer the built-in `showCloseButton` prop on `DialogContent` or
59
+ * `DialogFooter` for standard close affordances. Use this component
60
+ * when you need a completely custom close action inside the dialog body.
61
+ *
62
+ * @example
63
+ * <DialogClose asChild>
64
+ * <Button variant="ghost">Cancel</Button>
65
+ * </DialogClose>
66
+ */
14
67
  declare function DialogClose({
15
68
  ...props
16
- }: React.ComponentProps<typeof Dialog$1.Close>): _$react.JSX.Element;
69
+ }: React.ComponentProps<typeof Dialog$1.Close>): React.JSX.Element;
70
+ /**
71
+ * The semi-transparent **backdrop** rendered behind the dialog panel.
72
+ * Covers the full viewport (`fixed inset-0`) with a slight blur and dark tint.
73
+ *
74
+ * Animates:
75
+ * - **Open** → `fade-in-0`
76
+ * - **Close** → `fade-out-0`
77
+ *
78
+ * You rarely need to use this directly — `DialogContent` renders it
79
+ * automatically via `DialogPortal`.
80
+ */
17
81
  declare function DialogOverlay({
18
82
  className,
19
83
  ...props
20
- }: React.ComponentProps<typeof Dialog$1.Overlay>): _$react.JSX.Element;
84
+ }: React.ComponentProps<typeof Dialog$1.Overlay>): React.JSX.Element;
85
+ /**
86
+ * The **visible panel** of the dialog. Rendered centred on screen via
87
+ * `position: fixed; top: 50%; left: 50%; translate(-50%, -50%)`.
88
+ * Automatically wraps itself in `DialogPortal` and renders `DialogOverlay`
89
+ * behind it.
90
+ *
91
+ * By default a ghost ✕ button is positioned in the top-right corner.
92
+ * Pass `showCloseButton={false}` to remove it when you want to control
93
+ * close behaviour exclusively from the footer.
94
+ *
95
+ * Animates:
96
+ * - **Open** → `fade-in-0 + zoom-in-95`
97
+ * - **Close** → `fade-out-0 + zoom-out-95`
98
+ *
99
+ * @param showCloseButton - Whether to render the ✕ ghost button in the
100
+ * top-right corner. Defaults to `true`.
101
+ *
102
+ * @example
103
+ * <DialogContent showCloseButton={false}>
104
+ * <DialogHeader>...</DialogHeader>
105
+ * <DialogFooter showCloseButton>...</DialogFooter>
106
+ * </DialogContent>
107
+ */
21
108
  declare function DialogContent({
22
109
  className,
23
110
  children,
@@ -25,11 +112,36 @@ declare function DialogContent({
25
112
  ...props
26
113
  }: React.ComponentProps<typeof Dialog$1.Content> & {
27
114
  showCloseButton?: boolean;
28
- }): _$react.JSX.Element;
115
+ }): React.JSX.Element;
116
+ /**
117
+ * Layout wrapper for the **top section** of a dialog.
118
+ * Stacks children vertically with `gap-2`. Typically contains
119
+ * `DialogTitle` and optionally `DialogDescription`.
120
+ *
121
+ * @example
122
+ * <DialogHeader>
123
+ * <DialogTitle>Confirm deletion</DialogTitle>
124
+ * <DialogDescription>This action is irreversible.</DialogDescription>
125
+ * </DialogHeader>
126
+ */
29
127
  declare function DialogHeader({
30
128
  className,
31
129
  ...props
32
- }: React.ComponentProps<"div">): _$react.JSX.Element;
130
+ }: React.ComponentProps<"div">): React.JSX.Element;
131
+ /**
132
+ * Layout wrapper for the **bottom action area** of a dialog.
133
+ * Bleeds to the content panel edges (`-mx-4 -mb-4`), adds a top border
134
+ * and a subtle muted background tint. Actions stack vertically on mobile
135
+ * and align to the right on `sm+` screens.
136
+ *
137
+ * @param showCloseButton - When `true`, appends an outline `Close` button
138
+ * wired to `DialogClose` after any provided `children`. Defaults to `false`.
139
+ *
140
+ * @example
141
+ * <DialogFooter showCloseButton>
142
+ * <Button type="submit">Save</Button>
143
+ * </DialogFooter>
144
+ */
33
145
  declare function DialogFooter({
34
146
  className,
35
147
  showCloseButton,
@@ -37,14 +149,192 @@ declare function DialogFooter({
37
149
  ...props
38
150
  }: React.ComponentProps<"div"> & {
39
151
  showCloseButton?: boolean;
40
- }): _$react.JSX.Element;
152
+ }): React.JSX.Element;
153
+ /**
154
+ * The **accessible title** of the dialog. Rendered as a Radix `Dialog.Title`,
155
+ * which is automatically linked to the dialog content via `aria-labelledby`.
156
+ * Screen readers announce this text when the dialog opens.
157
+ *
158
+ * Styled with the heading font token at `text-base font-medium`.
159
+ *
160
+ * @remarks Required for accessibility. Every dialog should have a title,
161
+ * even if visually hidden with `className="sr-only"`.
162
+ */
41
163
  declare function DialogTitle({
42
164
  className,
43
165
  ...props
44
- }: React.ComponentProps<typeof Dialog$1.Title>): _$react.JSX.Element;
166
+ }: React.ComponentProps<typeof Dialog$1.Title>): React.JSX.Element;
167
+ /**
168
+ * The **accessible description** of the dialog. Rendered as a Radix
169
+ * `Dialog.Description`, which is linked to the dialog content via
170
+ * `aria-describedby`. Screen readers read this after the title.
171
+ *
172
+ * Styled as small muted text. Anchor tags (`<a>`) inside the description
173
+ * are automatically underlined and change colour on hover.
174
+ *
175
+ * @remarks Optional but recommended. Omit only if the dialog content itself
176
+ * is sufficiently self-descriptive.
177
+ */
45
178
  declare function DialogDescription({
46
179
  className,
47
180
  ...props
48
- }: React.ComponentProps<typeof Dialog$1.Description>): _$react.JSX.Element;
181
+ }: React.ComponentProps<typeof Dialog$1.Description>): React.JSX.Element;
49
182
  //#endregion
50
- export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
183
+ //#region src/responsive-dialog.d.ts
184
+ /**
185
+ * Adaptive root component that switches between `Dialog` and `Drawer`
186
+ * depending on screen width:
187
+ * - **Desktop (≥ 768 px)** → renders `Dialog` (centred modal overlay)
188
+ * - **Mobile (< 768 px)** → renders `Drawer` (bottom-sheet panel)
189
+ *
190
+ * All props are forwarded unchanged to the active primitive, so `open`,
191
+ * `defaultOpen`, `onOpenChange`, and `modal` all behave identically to
192
+ * the standard `Dialog` root.
193
+ *
194
+ * @example
195
+ * <ResponsiveDialog>
196
+ * <ResponsiveDialogTrigger asChild>
197
+ * <Button>Open</Button>
198
+ * </ResponsiveDialogTrigger>
199
+ * <ResponsiveDialogContent>
200
+ * <ResponsiveDialogHeader>
201
+ * <ResponsiveDialogTitle>Title</ResponsiveDialogTitle>
202
+ * </ResponsiveDialogHeader>
203
+ * </ResponsiveDialogContent>
204
+ * </ResponsiveDialog>
205
+ */
206
+ declare function ResponsiveDialog({
207
+ children,
208
+ ...props
209
+ }: React.ComponentProps<typeof Dialog$1.Root>): React.JSX.Element;
210
+ /**
211
+ * The element that opens the responsive dialog/drawer when activated.
212
+ *
213
+ * - **Desktop** → `DialogTrigger` (Radix `Dialog.Trigger`)
214
+ * - **Mobile** → `DrawerTrigger` (Vaul `Drawer.Trigger`)
215
+ *
216
+ * Use `asChild` to render your own element as the trigger instead of
217
+ * the default button wrapper.
218
+ *
219
+ * @example
220
+ * <ResponsiveDialogTrigger asChild>
221
+ * <Button variant="outline">Open</Button>
222
+ * </ResponsiveDialogTrigger>
223
+ */
224
+ declare function ResponsiveDialogTrigger({
225
+ children,
226
+ ...props
227
+ }: React.ComponentProps<typeof Dialog$1.Trigger>): React.JSX.Element;
228
+ /**
229
+ * A close trigger that targets the correct primitive for the current
230
+ * viewport:
231
+ * - **Desktop** → `DialogClose` (Radix `Dialog.Close`)
232
+ * - **Mobile** → `DrawerClose` (Vaul `Drawer.Close`)
233
+ *
234
+ * Use `asChild` to wrap a custom element.
235
+ *
236
+ * @example
237
+ * <ResponsiveDialogClose asChild>
238
+ * <Button variant="ghost">Cancel</Button>
239
+ * </ResponsiveDialogClose>
240
+ */
241
+ declare function ResponsiveDialogClose({
242
+ children,
243
+ ...props
244
+ }: React.ComponentProps<typeof Dialog$1.Close>): React.JSX.Element;
245
+ /**
246
+ * The visible panel of the responsive dialog. Delegates to the
247
+ * appropriate primitive:
248
+ * - **Desktop** → `DialogContent` — centred modal with fade + zoom animations.
249
+ * The ✕ close button is shown by default (`showCloseButton={true}`).
250
+ * - **Mobile** → `DrawerContent` — bottom-sheet panel with a drag handle.
251
+ * `showCloseButton` has **no effect** on mobile; the drawer is closed
252
+ * via swipe gesture or the drag handle.
253
+ *
254
+ * @param showCloseButton - Show/hide the ✕ button in the top-right corner
255
+ * on desktop. Has no effect on mobile. Defaults to `true`.
256
+ *
257
+ * @example
258
+ * // Hide the ✕ button and force close via footer only (desktop)
259
+ * <ResponsiveDialogContent showCloseButton={false}>
260
+ * ...
261
+ * </ResponsiveDialogContent>
262
+ */
263
+ declare function ResponsiveDialogContent({
264
+ className,
265
+ children,
266
+ showCloseButton,
267
+ ...props
268
+ }: React.ComponentProps<typeof Dialog$1.Content> & {
269
+ showCloseButton?: boolean;
270
+ }): React.JSX.Element;
271
+ /**
272
+ * Layout wrapper for the **top section** of the responsive dialog/drawer.
273
+ *
274
+ * - **Desktop** → `DialogHeader` — vertical stack with `gap-2`
275
+ * - **Mobile** → `DrawerHeader` — vertically centred text for bottom/top
276
+ * drawers, left-aligned for side drawers
277
+ *
278
+ * Typically contains `ResponsiveDialogTitle` and optionally
279
+ * `ResponsiveDialogDescription`.
280
+ */
281
+ declare function ResponsiveDialogHeader({
282
+ className,
283
+ ...props
284
+ }: React.ComponentProps<"div">): React.JSX.Element;
285
+ /**
286
+ * Layout wrapper for the **bottom action area** of the responsive
287
+ * dialog/drawer.
288
+ *
289
+ * - **Desktop** → `DialogFooter` — bleeds to panel edges, top border,
290
+ * actions aligned right on `sm+`
291
+ * - **Mobile** → `DrawerFooter` — `mt-auto` stacked column at the bottom
292
+ * of the drawer
293
+ *
294
+ * @param showCloseButton - When `true`, appends a close button after
295
+ * `children`. On **desktop** this is a `DialogClose`-wrapped outline
296
+ * button; on **mobile** this is a `DrawerClose`-wrapped outline button.
297
+ * Defaults to `false`.
298
+ *
299
+ * @example
300
+ * <ResponsiveDialogFooter showCloseButton>
301
+ * <Button type="submit">Save</Button>
302
+ * </ResponsiveDialogFooter>
303
+ */
304
+ declare function ResponsiveDialogFooter({
305
+ className,
306
+ children,
307
+ showCloseButton,
308
+ ...props
309
+ }: React.ComponentProps<"div"> & {
310
+ showCloseButton?: boolean;
311
+ }): React.JSX.Element;
312
+ /**
313
+ * The **accessible title** of the responsive dialog/drawer.
314
+ *
315
+ * - **Desktop** → `DialogTitle` (linked via `aria-labelledby`)
316
+ * - **Mobile** → `DrawerTitle` (linked via `aria-labelledby`)
317
+ *
318
+ * Screen readers announce this text when the panel opens.
319
+ *
320
+ * @remarks Required for accessibility on both desktop and mobile.
321
+ */
322
+ declare function ResponsiveDialogTitle({
323
+ className,
324
+ ...props
325
+ }: React.ComponentProps<typeof Dialog$1.Title>): React.JSX.Element;
326
+ /**
327
+ * The **accessible description** of the responsive dialog/drawer.
328
+ *
329
+ * - **Desktop** → `DialogDescription` (linked via `aria-describedby`)
330
+ * - **Mobile** → `DrawerDescription` (linked via `aria-describedby`)
331
+ *
332
+ * @remarks Optional but recommended. Provides supplementary context for
333
+ * screen reader users after the title is announced.
334
+ */
335
+ declare function ResponsiveDialogDescription({
336
+ className,
337
+ ...props
338
+ }: React.ComponentProps<typeof Dialog$1.Description>): React.JSX.Element;
339
+ //#endregion
340
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, ResponsiveDialog, ResponsiveDialogClose, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHeader, ResponsiveDialogTitle, ResponsiveDialogTrigger };