@maxio-com/react-ui-components 9.30.2 → 9.32.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.
Files changed (34) hide show
  1. package/dist/index.esm.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/skills/maxio-react/SKILL.md +2 -0
  5. package/dist/skills/maxio-react/references/components-dialog.md +45 -0
  6. package/dist/skills/maxio-react/references/components-modal.md +507 -0
  7. package/dist/skills/maxio-react/references/components-popover.md +1 -1
  8. package/dist/skills/maxio-react/references/patterns-side-nav.md +27 -0
  9. package/dist/temporary-typings/src/components/Dialog/Dialog.d.ts +5 -0
  10. package/dist/temporary-typings/src/components/Dialog/Dialog.d.ts.map +1 -0
  11. package/dist/temporary-typings/src/components/Dialog/index.d.ts +3 -0
  12. package/dist/temporary-typings/src/components/Dialog/index.d.ts.map +1 -0
  13. package/dist/temporary-typings/src/components/Dialog/types.d.ts +15 -0
  14. package/dist/temporary-typings/src/components/Dialog/types.d.ts.map +1 -0
  15. package/dist/temporary-typings/src/components/Modal/Modal.d.ts +5 -0
  16. package/dist/temporary-typings/src/components/Modal/Modal.d.ts.map +1 -0
  17. package/dist/temporary-typings/src/components/Modal/index.d.ts +3 -0
  18. package/dist/temporary-typings/src/components/Modal/index.d.ts.map +1 -0
  19. package/dist/temporary-typings/src/components/Modal/types.d.ts +10 -0
  20. package/dist/temporary-typings/src/components/Modal/types.d.ts.map +1 -0
  21. package/dist/temporary-typings/src/components/SideNav/SideNavItems/SideNavItem/SideNavItem.d.ts.map +1 -1
  22. package/dist/temporary-typings/src/components/SideNav/SideNavItems/SideNavItem/SingleItem/SingleItem.d.ts.map +1 -1
  23. package/dist/temporary-typings/src/components/SideNav/SideNavTopItem/SideNavTopItem.d.ts.map +1 -1
  24. package/dist/temporary-typings/src/components/SideNav/contexts/types.d.ts +2 -0
  25. package/dist/temporary-typings/src/components/SideNav/contexts/types.d.ts.map +1 -1
  26. package/dist/temporary-typings/src/components/index.d.ts +5 -1
  27. package/dist/temporary-typings/src/components/index.d.ts.map +1 -1
  28. package/dist/temporary-typings/src/docs/html/normalizeHtmlForDocs.d.ts.map +1 -1
  29. package/dist/temporary-typings/src/hooks/useIsOverflowing/index.d.ts +2 -0
  30. package/dist/temporary-typings/src/hooks/useIsOverflowing/index.d.ts.map +1 -0
  31. package/dist/temporary-typings/src/hooks/useIsOverflowing/useIsOverflowing.d.ts +3 -0
  32. package/dist/temporary-typings/src/hooks/useIsOverflowing/useIsOverflowing.d.ts.map +1 -0
  33. package/package.json +2 -2
  34. package/typings/index.d.ts +30 -4
@@ -34,6 +34,7 @@ Use this skill to build React components using `@maxio-com/react-ui-components`.
34
34
  - [Components / Chip](references/components-chip.md)
35
35
  - [Components / Copy To Clipboard](references/components-copy-to-clipboard.md)
36
36
  - [Components / Data Table](references/components-data-table.md)
37
+ - [Components / Dialog](references/components-dialog.md)
37
38
  - [Components / Drawer](references/components-drawer.md)
38
39
  - [Components / Empty State](references/components-empty-state.md)
39
40
  - [Components / Flex](references/components-flex.md)
@@ -54,6 +55,7 @@ Use this skill to build React components using `@maxio-com/react-ui-components`.
54
55
  - [Components / ListBox](references/components-listbox.md)
55
56
  - [Components / Loading Spinner](references/components-loading-spinner.md)
56
57
  - [Components / Logo](references/components-logo.md)
58
+ - [Components / Modal](references/components-modal.md)
57
59
  - [Components / Notifications / Alert](references/components-notifications-alert.md)
58
60
  - [Components / Notifications / Banner](references/components-notifications-banner.md)
59
61
  - [Components / Notifications / Toast](references/components-notifications-toast.md)
@@ -0,0 +1,45 @@
1
+ # Dialog
2
+
3
+ ## Imports
4
+
5
+ ```tsx
6
+ import { Body, Button, Dialog, DialogTrigger, Popover } from "@maxio-com/react-ui-components";
7
+ ```
8
+
9
+ ## Prop Types
10
+
11
+ ### Dialog
12
+
13
+ | Prop | Type | Required | Default | Description | Source |
14
+ | --- | --- | --- | --- | --- | --- |
15
+ | `children` | `ReactNode \| ((opts: { close: () => void; }) => ReactNode)` | yes | - | Body content. A function receives `close` to dismiss the dialog. | DialogProps |
16
+ | `className` | `string` | no | - | - | DialogProps |
17
+ | `description` | `ReactNode` | no | - | Optional supporting text below the title. | DialogProps |
18
+ | `footer` | `ReactNode \| ((opts: { close: () => void; }) => ReactNode)` | no | - | Footer content, such as primary and secondary actions. A function receives `close`, so actions can dismiss an uncontrolled dialog. | DialogProps |
19
+ | `showCloseButton` | `boolean` | no | `role !== 'alertdialog'` | Shows the close button in the header. Defaults to `true`, or `false` when `role="alertdialog"`. | DialogProps |
20
+ | `title` | `ReactNode` | yes | - | Visible heading. It is also the dialog's accessible name. | DialogProps |
21
+
22
+ ## Stories
23
+
24
+ ### In a popover
25
+
26
+ Inside a Popover, the Dialog keeps the title connected and adds a close
27
+ button, while the Popover stays anchored to its trigger.
28
+
29
+ ```tsx
30
+ const InPopover = () => <DialogTrigger>
31
+ <Button variant="secondary">Billing contact</Button>
32
+ <Popover placement="bottom start">
33
+ <Dialog
34
+ title="Billing contact"
35
+ description="Who receives invoices for this customer."
36
+ footer={({ close }) => (
37
+ <Button size="sm" onClick={close}>
38
+ Done
39
+ </Button>
40
+ )}>
41
+ <Body size="sm">Jane Doe · billing@acme.com</Body>
42
+ </Dialog>
43
+ </Popover>
44
+ </DialogTrigger>;
45
+ ```
@@ -0,0 +1,507 @@
1
+ # Modal
2
+
3
+ ## Usage Guidelines
4
+
5
+ ### Overview
6
+
7
+ Modal is a centered overlay that blocks the rest of the page until the user
8
+ finishes or dismisses a focused task. Put a `Dialog` inside it for the
9
+ title, body and footer.
10
+
11
+ Modal is built from two components, as in React Aria:
12
+
13
+ - **`Modal`**: the overlay and the centered panel. It holds the open state, blocks the page, locks scroll and handles dismissal. The backdrop is internal.
14
+ - **`Dialog`**: the content. It renders the title (the accessible name), an optional description, the body, the footer and a close button. `Dialog` also works inside a [Popover](components-popover.md).
15
+
16
+ #### When to Use
17
+
18
+ - Use Modal for a focused task or decision that must be finished or dismissed before returning to the page: confirmations, short forms, details.
19
+ - Use `role="alertdialog"` for confirmations that need an explicit answer, such as deleting or voiding a record.
20
+ - Use a blocking modal (no dismissal) only while a required process runs, and close it from code when it ends.
21
+
22
+ #### When Not to Use
23
+
24
+ - Do not use Modal for content that benefits from staying next to the page, such as long forms or detail panels. Use [Drawer](components-drawer.md) instead.
25
+ - Do not use Modal for brief, anchored content or a few actions. Use [Popover](components-popover.md) instead.
26
+ - Do not use Modal for simple status messages. Use a Toast or an Alert instead.
27
+
28
+ ### Behavior
29
+
30
+ - **Mouse and touch**: a backdrop click closes the modal unless `isDismissable={false}`.
31
+ - **Keyboard**: Escape closes the top modal unless `isKeyboardDismissDisabled` is set. Tab and Shift+Tab stay inside the modal.
32
+ - **Focus management**: focus moves into the dialog on open and returns to the trigger on close.
33
+ - **Scroll**: the page behind does not scroll. Long content scrolls inside the body, which then joins the tab order so keyboard users can scroll it.
34
+ - **Sizes**: `sm` (24rem), `md` (40rem) and `lg` (56rem, default) are max-widths that shrink with the viewport. The height follows the content up to the viewport.
35
+ - **Stacking**: a modal can open another modal; Escape closes only the top one.
36
+
37
+ ### Patterns
38
+
39
+ | Pattern | `Modal` props | `Dialog` props |
40
+ | :----------- | :-------------------------------------------------- | :------------------------ |
41
+ | Default | — | — |
42
+ | Confirmation | `isDismissable={false}` | `role="alertdialog"` |
43
+ | Blocking | `isDismissable={false}` `isKeyboardDismissDisabled` | `showCloseButton={false}` |
44
+
45
+ ### Layering
46
+
47
+ Modal stacks at `--maxio-z-overlay` (40), the same layer as Drawer. Overlays from older code can sit higher, such as legacy modals at z-index 1050–1060.
48
+
49
+ - **Stay below** legacy overlays: keep the default values.
50
+ - **Go above** them: re-base `--maxio-z-overlay` once in the app stylesheet, for example `:root { --maxio-z-overlay: 1070; }`. The panel renders inside the fixed backdrop, so only the backdrop's layer sets the stacking order: a z-index through `className`, or re-basing `--maxio-z-modal`, has no effect.
51
+
52
+ ### Accessibility
53
+
54
+ - Always provide a `title`; it is the dialog's visible heading and its accessible name.
55
+ - Use `role="alertdialog"` for confirmations so screen readers announce them as urgent.
56
+ - Keep a visible way to close the dialog unless it is a blocking process.
57
+ - Put actions in `footer` rather than at the end of a scrollable body.
58
+
59
+ ### Content
60
+
61
+ - Keep `title` short and specific, such as "Void invoice?" rather than "Confirm".
62
+ - Name the primary action after its result, such as "Void invoice" rather than "OK".
63
+ - Use `description` for one line of secondary context.
64
+
65
+ ### Related
66
+
67
+ - **[Drawer](components-drawer.md)**: for longer tasks that slide in from an edge.
68
+ - **[Popover](components-popover.md)**: for lighter, anchored content; it can also host a `Dialog`.
69
+
70
+ ## React
71
+
72
+ ```tsx
73
+ import { Modal, Dialog, DialogTrigger } from '@maxio-com/react-ui-components';
74
+ ```
75
+
76
+ Both components follow the React Aria API and pass extra props through to React Aria. `Modal` adds `size`; `Dialog` adds `title`, `description`, `footer` and `showCloseButton`. `children` and `footer` can be functions that receive `close`.
77
+
78
+ ## Imports
79
+
80
+ ```tsx
81
+ import { Body, Button, Dialog, DialogTrigger, Modal, Select, TextField } from "@maxio-com/react-ui-components";
82
+ ```
83
+
84
+ ## Prop Types
85
+
86
+ ### Modal
87
+
88
+ | Prop | Type | Required | Default | Description | Source |
89
+ | --- | --- | --- | --- | --- | --- |
90
+ | `children` | `ReactNode` | yes | - | The modal content, usually a `Dialog`. | ModalProps |
91
+ | `className` | `string` | no | - | Applied to the panel. The backdrop is internal and cannot be styled. | ModalProps |
92
+ | `size` | `"sm" \| "md" \| "lg"` | no | `lg` | Fixed max-width of the panel. It shrinks with the viewport. | ModalProps |
93
+ | `style` | `CSSProperties` | no | - | Applied to the panel. | ModalProps |
94
+
95
+ ## Stories
96
+
97
+ ### Default
98
+
99
+ Use DialogTrigger for the simplest, uncontrolled setup. The close button,
100
+ Escape and a backdrop click close the modal; footer actions receive `close`.
101
+
102
+ ```tsx
103
+ const Default = () => <DialogTrigger>
104
+ <Button variant="secondary">Open modal</Button>
105
+ <Modal size="md" isDismissable isKeyboardDismissDisabled={false}>
106
+ <Dialog
107
+ title="Merge payments"
108
+ description="Combine duplicate payments into one record."
109
+ footer={({ close }) => (
110
+ <>
111
+ <Button variant="secondary" onClick={close}>
112
+ Cancel
113
+ </Button>
114
+ <Button onClick={close}>Merge</Button>
115
+ </>
116
+ )}>
117
+ <Body size="sm">{LOREM}</Body>
118
+ </Dialog>
119
+ </Modal>
120
+ </DialogTrigger>;
121
+ ```
122
+
123
+ ### Controlled (external state)
124
+
125
+ Use `isOpen` and `onOpenChange` when the open state lives elsewhere, for
126
+ example in a store or in a different part of the page than the trigger.
127
+
128
+ ```tsx
129
+ const Controlled = () => {
130
+ const [isOpen, setIsOpen] = React.useState(false);
131
+
132
+ return (
133
+ <>
134
+ <Button variant="secondary" onClick={() => setIsOpen(true)}>Open modal
135
+ </Button>
136
+ <Modal
137
+ size="md"
138
+ isDismissable
139
+ isKeyboardDismissDisabled={false}
140
+ isOpen={isOpen}
141
+ onOpenChange={setIsOpen}>
142
+ <Dialog title="Payment details">
143
+ <Body size="sm">{LOREM}</Body>
144
+ </Dialog>
145
+ </Modal>
146
+ </>
147
+ );
148
+ };
149
+ ```
150
+
151
+ ### Sizes
152
+
153
+ Sizes are fixed max-widths that shrink with the viewport: `sm` for
154
+ confirmations, `md` for short forms and `lg` (default) for richer content.
155
+
156
+ ```tsx
157
+ const Sizes = () => {
158
+ const sizes: ModalSize[] = ['sm', 'md', 'lg'];
159
+ const [openSize, setOpenSize] = React.useState<ModalSize | null>(null);
160
+
161
+ return (
162
+ <div style={{ display: 'flex', gap: '0.75rem' }}>
163
+ {sizes.map((size) => (
164
+ <Button
165
+ key={size}
166
+ variant="secondary"
167
+ onClick={() => setOpenSize(size)}
168
+ >
169
+ {size}
170
+ </Button>
171
+ ))}
172
+ {sizes.map((size) => (
173
+ <Modal
174
+ key={size}
175
+ size={size}
176
+ isOpen={openSize === size}
177
+ onOpenChange={(isOpen) => !isOpen && setOpenSize(null)}
178
+ >
179
+ <Dialog title={`size="${size}"`}>
180
+ <Body size="sm">{LOREM}</Body>
181
+ </Dialog>
182
+ </Modal>
183
+ ))}
184
+ </div>
185
+ );
186
+ };
187
+ ```
188
+
189
+ ### Confirmation
190
+
191
+ Use `role="alertdialog"` for confirmations that need an explicit answer.
192
+ Turn off backdrop dismissal so a stray click doesn't discard the decision.
193
+
194
+ ```tsx
195
+ const Confirmation = () => (
196
+ <DialogTrigger>
197
+ <Button variant="danger">Void invoice</Button>
198
+ <Modal size="sm" isDismissable={false}>
199
+ <Dialog
200
+ role="alertdialog"
201
+ title="Void invoice?"
202
+ footer={({ close }) => (
203
+ <>
204
+ <Button variant="secondary" onClick={close}>
205
+ Cancel
206
+ </Button>
207
+ <Button variant="danger" onClick={close}>
208
+ Void invoice
209
+ </Button>
210
+ </>
211
+ )}
212
+ >
213
+ <Body size="sm">
214
+ The invoice will be marked as void and can no longer be paid.
215
+ </Body>
216
+ </Dialog>
217
+ </Modal>
218
+ </DialogTrigger>
219
+ );
220
+ ```
221
+
222
+ ### Blocking
223
+
224
+ Block every user dismissal while a required process runs, and close the
225
+ modal from code when it finishes. This example closes after 3 seconds.
226
+
227
+ ```tsx
228
+ const Blocking = () => {
229
+ const [isOpen, setIsOpen] = React.useState(false);
230
+
231
+ React.useEffect(() => {
232
+ if (!isOpen) return undefined;
233
+
234
+ const timer = setTimeout(() => setIsOpen(false), 3000);
235
+ return () => clearTimeout(timer);
236
+ }, [isOpen]);
237
+
238
+ return (
239
+ <>
240
+ <Button variant="secondary" onClick={() => setIsOpen(true)}>
241
+ Sync with Xero
242
+ </Button>
243
+ <Modal
244
+ size="sm"
245
+ isOpen={isOpen}
246
+ onOpenChange={setIsOpen}
247
+ isDismissable={false}
248
+ isKeyboardDismissDisabled
249
+ >
250
+ <Dialog title="Syncing with Xero…" showCloseButton={false}>
251
+ <Body size="sm">This can take a few minutes.</Body>
252
+ </Dialog>
253
+ </Modal>
254
+ </>
255
+ );
256
+ };
257
+ ```
258
+
259
+ ### With form
260
+
261
+ Forms keep their actions in the footer. Point the submit button at the form
262
+ with the `form` attribute, and keep the modal open until the save resolves:
263
+ while it saves, Escape, backdrop click, Close and Cancel are disabled.
264
+
265
+ ```tsx
266
+ const WithForm = () => {
267
+ const [isOpen, setIsOpen] = React.useState(false);
268
+ const [isSaving, setIsSaving] = React.useState(false);
269
+
270
+ React.useEffect(() => {
271
+ if (!isSaving) return undefined;
272
+
273
+ const timer = setTimeout(() => {
274
+ setIsSaving(false);
275
+ setIsOpen(false);
276
+ }, 1000);
277
+ return () => clearTimeout(timer);
278
+ }, [isSaving]);
279
+
280
+ const onSubmit = (event: React.FormEvent) => {
281
+ event.preventDefault();
282
+ setIsSaving(true);
283
+ };
284
+
285
+ return (
286
+ <>
287
+ <Button variant="secondary" onClick={() => setIsOpen(true)}>Add customer
288
+ </Button>
289
+ <Modal
290
+ size="md"
291
+ isOpen={isOpen}
292
+ onOpenChange={setIsOpen}
293
+ isDismissable={args.isDismissable && !isSaving}
294
+ isKeyboardDismissDisabled={args.isKeyboardDismissDisabled || isSaving}>
295
+ <Dialog
296
+ title="Add customer"
297
+ showCloseButton={!isSaving}
298
+ footer={
299
+ <>
300
+ <Button
301
+ variant="secondary"
302
+ onClick={() => setIsOpen(false)}
303
+ disabled={isSaving}
304
+ >
305
+ Cancel
306
+ </Button>
307
+ <Button type="submit" form="add-customer" disabled={isSaving}>
308
+ {isSaving ? 'Saving…' : 'Save'}
309
+ </Button>
310
+ </>
311
+ }>
312
+ <form
313
+ id="add-customer"
314
+ onSubmit={onSubmit}
315
+ style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
316
+ <TextField label="Name" placeholder="Acme Inc." />
317
+ <TextField label="Email" placeholder="billing@acme.com" />
318
+ <Select label="Plan" options={PLAN_OPTIONS} />
319
+ </form>
320
+ </Dialog>
321
+ </Modal>
322
+ </>
323
+ );
324
+ };
325
+ ```
326
+
327
+ ### Long content
328
+
329
+ Long content scrolls inside the body while the title and actions stay
330
+ visible. The body joins the tab order so it can be scrolled by keyboard.
331
+
332
+ ```tsx
333
+ const LongContent = () => <DialogTrigger>
334
+ <Button variant="secondary">Open modal</Button>
335
+ <Modal size="md" isDismissable isKeyboardDismissDisabled={false}>
336
+ <Dialog
337
+ title="Terms of service"
338
+ footer={({ close }) => <Button onClick={close}>Accept</Button>}>
339
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
340
+ {Array.from({ length: 20 }, (_, i) => (
341
+ <Body key={i} size="sm">
342
+ {i + 1}. {LOREM}
343
+ </Body>
344
+ ))}
345
+ </div>
346
+ </Dialog>
347
+ </Modal>
348
+ </DialogTrigger>;
349
+ ```
350
+
351
+ ### Stacked
352
+
353
+ A modal can open another one, such as a discard confirmation on top of a
354
+ form. Escape closes only the top modal.
355
+
356
+ ```tsx
357
+ const Stacked = () => {
358
+ const [isFormOpen, setIsFormOpen] = React.useState(false);
359
+ const [isConfirmOpen, setIsConfirmOpen] = React.useState(false);
360
+
361
+ return (
362
+ <>
363
+ <Button variant="secondary" onClick={() => setIsFormOpen(true)}>
364
+ Edit plan
365
+ </Button>
366
+ <Modal size="md" isOpen={isFormOpen} onOpenChange={setIsFormOpen}>
367
+ <Dialog
368
+ title="Edit plan"
369
+ footer={
370
+ <Button
371
+ variant="secondary"
372
+ onClick={() => setIsConfirmOpen(true)}
373
+ >
374
+ Discard changes
375
+ </Button>
376
+ }
377
+ >
378
+ <TextField label="Plan name" placeholder="Growth" />
379
+ </Dialog>
380
+ </Modal>
381
+ <Modal
382
+ size="sm"
383
+ isDismissable={false}
384
+ isOpen={isConfirmOpen}
385
+ onOpenChange={setIsConfirmOpen}
386
+ >
387
+ <Dialog
388
+ role="alertdialog"
389
+ title="Discard changes?"
390
+ footer={
391
+ <>
392
+ <Button
393
+ variant="secondary"
394
+ onClick={() => setIsConfirmOpen(false)}
395
+ >
396
+ Keep editing
397
+ </Button>
398
+ <Button
399
+ variant="danger"
400
+ onClick={() => {
401
+ setIsConfirmOpen(false);
402
+ setIsFormOpen(false);
403
+ }}
404
+ >
405
+ Discard
406
+ </Button>
407
+ </>
408
+ }
409
+ >
410
+ <Body size="sm">Your changes to this plan will be lost.</Body>
411
+ </Dialog>
412
+ </Modal>
413
+ </>
414
+ );
415
+ };
416
+ ```
417
+
418
+ ### Native dialog (HTML)
419
+
420
+ HTML apps use a native `<dialog class="maxio-modal">` with a `maxio-dialog`
421
+ block inside. `aria-labelledby` (and `role="alertdialog"` for
422
+ confirmations) go on `<dialog>`; open it with `showModal()`.
423
+
424
+ ```tsx
425
+ const NativeDialog = () => {
426
+ const ref = React.useRef<HTMLDialogElement>(null);
427
+ const pointerDownOnBackdrop = React.useRef(false);
428
+ const close = () => ref.current?.close();
429
+
430
+ return (
431
+ <>
432
+ <button
433
+ id="merge-dialog-open"
434
+ type="button"
435
+ className="maxio-button maxio-button--secondary"
436
+ onClick={() => ref.current?.showModal()}
437
+ >
438
+ Open dialog
439
+ </button>
440
+ <dialog
441
+ ref={ref}
442
+ id="merge-dialog"
443
+ className="maxio-modal"
444
+ data-size="md"
445
+ aria-labelledby="merge-title"
446
+ aria-describedby="merge-description"
447
+ onPointerDown={(event) => {
448
+ pointerDownOnBackdrop.current = event.target === ref.current;
449
+ }}
450
+ onClick={(event) => {
451
+ if (pointerDownOnBackdrop.current && event.target === ref.current) {
452
+ close();
453
+ }
454
+ }}
455
+ >
456
+ <div className="maxio-dialog">
457
+ <header className="maxio-dialog__header">
458
+ <div className="maxio-dialog__title-group">
459
+ <h2
460
+ id="merge-title"
461
+ className="maxio-dialog__title maxio-heading-md"
462
+ >
463
+ Merge payments
464
+ </h2>
465
+ <p id="merge-description" className="maxio-dialog__description">
466
+ Combine duplicate payments into one record.
467
+ </p>
468
+ </div>
469
+ <button
470
+ type="button"
471
+ aria-label="Close"
472
+ className="maxio-button maxio-button--icon maxio-button--ghost maxio-button--sm maxio-dialog__close"
473
+ onClick={close}
474
+ >
475
+ <i
476
+ className="fa-kit fa-cross maxio-button__trailing-element"
477
+ aria-hidden="true"
478
+ />
479
+ </button>
480
+ </header>
481
+ <div className="maxio-dialog__body">
482
+ <div>
483
+ <p className="maxio-body-sm">{LOREM}</p>
484
+ </div>
485
+ </div>
486
+ <footer className="maxio-dialog__footer">
487
+ <button
488
+ type="button"
489
+ className="maxio-button maxio-button--secondary"
490
+ onClick={close}
491
+ >
492
+ Cancel
493
+ </button>
494
+ <button
495
+ type="button"
496
+ className="maxio-button maxio-button--primary"
497
+ onClick={close}
498
+ >
499
+ Merge
500
+ </button>
501
+ </footer>
502
+ </div>
503
+ </dialog>
504
+ </>
505
+ );
506
+ };
507
+ ```
@@ -17,7 +17,7 @@ Popover positions dismissible overlay content next to a trigger.
17
17
 
18
18
  - Do not use for brief explanatory text. Use Tooltip instead.
19
19
  - Do not use for a simple list of contextual actions. Use ActionMenu instead.
20
- - Do not use for page-level or blocking decisions. Use a modal dialog pattern instead.
20
+ - Do not use for page-level or blocking decisions. Use [Modal](components-modal.md) instead.
21
21
  - Do not use Popover by itself when you need trigger state, focus return, or dismissal behavior. Pair it with a React Aria trigger.
22
22
 
23
23
  ### Behavior
@@ -82,6 +82,10 @@ const [isOpen, setIsOpen] = React.useState(true);
82
82
  />
83
83
  ```
84
84
 
85
+ #### Collapsed logo
86
+
87
+ With `shouldToggleSidebar`, the collapsed nav shows the toggle over the logo when it's hovered, and clicking it expands the nav. On touch devices, tapping the logo follows the brand link, and keyboard users reach the brand link and the toggle separately. Opening the site switcher or a section while collapsed expands the nav first.
88
+
85
89
  ### Navigation Data
86
90
 
87
91
  Use `topDropdownItems` for the site switcher and `sections` for grouped navigation lists. Each item with `isCurrent: true` renders the active page state.
@@ -137,9 +141,32 @@ interface SingleSection {
137
141
  key: string;
138
142
  isCurrent?: boolean;
139
143
  type?: 'regular';
144
+ render?: LinkProps['render']; // from react-aria-components
140
145
  }
141
146
  ```
142
147
 
148
+ ### Client-side routing
149
+
150
+ Section links render a React Aria [`Link`](https://react-spectrum.adobe.com/react-aria/Link.html). Pass `render` on a section or sub-item to render your router's link instead of a plain `<a>`. Spread the received props (they include `ref`, `className`, `href` and `aria-current`) onto the rendered anchor.
151
+
152
+ ```tsx
153
+ import { Link as RouterLink } from 'react-router';
154
+
155
+ const sections = [
156
+ [
157
+ {
158
+ key: 'dashboard',
159
+ name: 'Dashboard',
160
+ icon: 'home',
161
+ href: '/dashboard',
162
+ render: ({ href, ...props }) => <RouterLink {...props} to={href} />,
163
+ },
164
+ ],
165
+ ];
166
+ ```
167
+
168
+ Alternatively, wrap your app in React Aria's [`RouterProvider`](https://react-spectrum.adobe.com/react-aria/routing.html) to route every section link through your router's `navigate` function.
169
+
143
170
  ## Imports
144
171
 
145
172
  ```tsx
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { DialogProps } from './types';
3
+ declare const Dialog: ({ title, description, children, footer, role, showCloseButton, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...props }: DialogProps) => React.JSX.Element;
4
+ export default Dialog;
5
+ //# sourceMappingURL=Dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAU7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAS3C,QAAA,MAAM,MAAM,GAAI,uLAYb,WAAW,sBAwEb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as Dialog } from './Dialog';
2
+ export type { DialogProps } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { DialogProps as AriaDialogProps } from 'react-aria-components';
3
+ export interface DialogProps extends Omit<AriaDialogProps, 'children' | 'className'> {
4
+ title: ReactNode;
5
+ description?: ReactNode;
6
+ children: ReactNode | ((opts: {
7
+ close: () => void;
8
+ }) => ReactNode);
9
+ footer?: ReactNode | ((opts: {
10
+ close: () => void;
11
+ }) => ReactNode);
12
+ showCloseButton?: boolean;
13
+ className?: string;
14
+ }
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dialog/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE5E,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,eAAe,EACf,UAAU,GAAG,WAAW,CACzB;IAIC,KAAK,EAAE,SAAS,CAAC;IAIjB,WAAW,CAAC,EAAE,SAAS,CAAC;IAIxB,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,SAAS,CAAC,CAAC;IAKnE,MAAM,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,SAAS,CAAC,CAAC;IAKlE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { ModalProps } from './types';
3
+ declare const Modal: ({ size, isDismissable, className, style, children, ...props }: ModalProps) => React.JSX.Element;
4
+ export default Modal;
5
+ //# sourceMappingURL=Modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM1C,QAAA,MAAM,KAAK,GAAI,+DAOZ,UAAU,sBAcZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as Modal } from './Modal';
2
+ export type { ModalProps, ModalSize } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Modal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}