@astryxdesign/lab 0.7.2-canary.db3a2e7 → 0.7.2-canary.e2909cf
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.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/lab.css +0 -46
- package/package.json +4 -4
- package/src/index.ts +0 -8
- package/blocks/DrawerFullWidthMobile.doc.mjs +0 -21
- package/blocks/DrawerFullWidthMobile.tsx +0 -42
- package/blocks/DrawerHeaderShowcase.doc.mjs +0 -15
- package/blocks/DrawerHeaderShowcase.tsx +0 -73
- package/blocks/DrawerHeaderSubtitleEndContent.doc.mjs +0 -22
- package/blocks/DrawerHeaderSubtitleEndContent.tsx +0 -49
- package/blocks/DrawerHeaderWithCloseButton.doc.mjs +0 -21
- package/blocks/DrawerHeaderWithCloseButton.tsx +0 -42
- package/blocks/DrawerMobileReveal.doc.mjs +0 -21
- package/blocks/DrawerMobileReveal.tsx +0 -43
- package/blocks/DrawerScrim.doc.mjs +0 -22
- package/blocks/DrawerScrim.tsx +0 -68
- package/blocks/DrawerShowcase.doc.mjs +0 -22
- package/blocks/DrawerShowcase.tsx +0 -41
- package/blocks/DrawerStart.doc.mjs +0 -21
- package/blocks/DrawerStart.tsx +0 -41
- package/blocks/DrawerWidths.doc.mjs +0 -22
- package/blocks/DrawerWidths.tsx +0 -54
- package/dist/Drawer/Drawer.d.ts +0 -181
- package/dist/Drawer/Drawer.d.ts.map +0 -1
- package/dist/Drawer/Drawer.js +0 -388
- package/dist/Drawer/DrawerHeader.d.ts +0 -82
- package/dist/Drawer/DrawerHeader.d.ts.map +0 -1
- package/dist/Drawer/DrawerHeader.js +0 -131
- package/dist/Drawer/index.d.ts +0 -11
- package/dist/Drawer/index.d.ts.map +0 -1
- package/dist/Drawer/index.js +0 -11
- package/dist/Drawer/useDrawerDialogPresence.d.ts +0 -42
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +0 -1
- package/dist/Drawer/useDrawerDialogPresence.js +0 -235
- package/src/Drawer/Drawer.doc.mjs +0 -470
- package/src/Drawer/Drawer.spec.md +0 -343
- package/src/Drawer/Drawer.test.tsx +0 -1039
- package/src/Drawer/Drawer.tsx +0 -618
- package/src/Drawer/DrawerHeader.doc.mjs +0 -291
- package/src/Drawer/DrawerHeader.test.tsx +0 -89
- package/src/Drawer/DrawerHeader.tsx +0 -237
- package/src/Drawer/index.ts +0 -13
- package/src/Drawer/useDrawerDialogPresence.ts +0 -283
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export default {
|
|
5
|
-
type: 'block',
|
|
6
|
-
name: 'Modal or non-modal (hasScrim)',
|
|
7
|
-
displayName: 'Modal or non-modal (hasScrim)',
|
|
8
|
-
description:
|
|
9
|
-
'The default modal drawer dims the page, traps focus, and closes on a scrim click. With hasScrim={false}, the drawer has no scrim or focus trap and leaves the page interactive.',
|
|
10
|
-
exampleFor: 'Drawer',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: [
|
|
14
|
-
'Drawer',
|
|
15
|
-
'Button',
|
|
16
|
-
'Layout',
|
|
17
|
-
'LayoutContent',
|
|
18
|
-
'HStack',
|
|
19
|
-
'DrawerHeader',
|
|
20
|
-
'Text',
|
|
21
|
-
],
|
|
22
|
-
};
|
package/blocks/DrawerScrim.tsx
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @input Separate controlled states for modal and non-modal drawers
|
|
7
|
-
* @output A comparison of hasScrim's two presentations
|
|
8
|
-
* @position Copyable Lab Drawer example
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {useState} from 'react';
|
|
12
|
-
import {Drawer, DrawerHeader} from '@astryxdesign/lab';
|
|
13
|
-
import {Button} from '@astryxdesign/core/Button';
|
|
14
|
-
import {Layout, LayoutContent} from '@astryxdesign/core/Layout';
|
|
15
|
-
import {HStack} from '@astryxdesign/core/Stack';
|
|
16
|
-
import {Text} from '@astryxdesign/core/Text';
|
|
17
|
-
|
|
18
|
-
export default function DrawerScrim() {
|
|
19
|
-
const [openModal, setOpenModal] = useState(false);
|
|
20
|
-
const [openPanel, setOpenPanel] = useState(false);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<>
|
|
24
|
-
<HStack gap={2}>
|
|
25
|
-
<Button label="Open modal drawer" onClick={() => setOpenModal(true)} />
|
|
26
|
-
<Button
|
|
27
|
-
label="Open non-modal drawer"
|
|
28
|
-
onClick={() => setOpenPanel(true)}
|
|
29
|
-
/>
|
|
30
|
-
</HStack>
|
|
31
|
-
<Drawer
|
|
32
|
-
isOpen={openModal}
|
|
33
|
-
onOpenChange={setOpenModal}
|
|
34
|
-
label="Edit details">
|
|
35
|
-
<Layout
|
|
36
|
-
header={
|
|
37
|
-
<DrawerHeader title="Edit details" onOpenChange={setOpenModal} />
|
|
38
|
-
}
|
|
39
|
-
content={
|
|
40
|
-
<LayoutContent>
|
|
41
|
-
<Text type="body">
|
|
42
|
-
The scrim blocks the page behind this modal drawer.
|
|
43
|
-
</Text>
|
|
44
|
-
</LayoutContent>
|
|
45
|
-
}
|
|
46
|
-
/>
|
|
47
|
-
</Drawer>
|
|
48
|
-
<Drawer
|
|
49
|
-
isOpen={openPanel}
|
|
50
|
-
onOpenChange={setOpenPanel}
|
|
51
|
-
label="Inspector"
|
|
52
|
-
hasScrim={false}>
|
|
53
|
-
<Layout
|
|
54
|
-
header={
|
|
55
|
-
<DrawerHeader title="Inspector" onOpenChange={setOpenPanel} />
|
|
56
|
-
}
|
|
57
|
-
content={
|
|
58
|
-
<LayoutContent>
|
|
59
|
-
<Text type="body">
|
|
60
|
-
The page behind this non-modal drawer stays interactive.
|
|
61
|
-
</Text>
|
|
62
|
-
</LayoutContent>
|
|
63
|
-
}
|
|
64
|
-
/>
|
|
65
|
-
</Drawer>
|
|
66
|
-
</>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export default {
|
|
5
|
-
type: 'block',
|
|
6
|
-
name: 'Basic',
|
|
7
|
-
displayName: 'Basic',
|
|
8
|
-
description:
|
|
9
|
-
'Open a modal drawer from a single trigger. The scrim dims the page; Escape, a scrim click, or the header close button closes it, and focus returns to the trigger.',
|
|
10
|
-
exampleFor: 'Drawer',
|
|
11
|
-
isReady: true,
|
|
12
|
-
isShowcase: true,
|
|
13
|
-
aspectRatio: 16 / 9,
|
|
14
|
-
componentsUsed: [
|
|
15
|
-
'Drawer',
|
|
16
|
-
'Button',
|
|
17
|
-
'Layout',
|
|
18
|
-
'LayoutContent',
|
|
19
|
-
'DrawerHeader',
|
|
20
|
-
'Text',
|
|
21
|
-
],
|
|
22
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @input Controlled open state for a modal Drawer
|
|
7
|
-
* @output A single-trigger drawer with a scrim and the built-in close button
|
|
8
|
-
* @position Lab Drawer's docsite showcase and copyable CLI block
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {useState} from 'react';
|
|
12
|
-
import {Drawer, DrawerHeader} from '@astryxdesign/lab';
|
|
13
|
-
import {Button} from '@astryxdesign/core/Button';
|
|
14
|
-
import {Layout, LayoutContent} from '@astryxdesign/core/Layout';
|
|
15
|
-
import {Text} from '@astryxdesign/core/Text';
|
|
16
|
-
|
|
17
|
-
export default function DrawerShowcase() {
|
|
18
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<>
|
|
22
|
-
<Button label="Open drawer" onClick={() => setIsOpen(true)} />
|
|
23
|
-
<Drawer
|
|
24
|
-
isOpen={isOpen}
|
|
25
|
-
onOpenChange={setIsOpen}
|
|
26
|
-
label="Details"
|
|
27
|
-
width={360}>
|
|
28
|
-
<Layout
|
|
29
|
-
header={<DrawerHeader title="Details" onOpenChange={setIsOpen} />}
|
|
30
|
-
content={
|
|
31
|
-
<LayoutContent>
|
|
32
|
-
<Text type="body">
|
|
33
|
-
Close with Escape, the scrim, or the close button.
|
|
34
|
-
</Text>
|
|
35
|
-
</LayoutContent>
|
|
36
|
-
}
|
|
37
|
-
/>
|
|
38
|
-
</Drawer>
|
|
39
|
-
</>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export default {
|
|
5
|
-
type: 'block',
|
|
6
|
-
name: 'Slide in from the start edge',
|
|
7
|
-
displayName: 'Slide in from the start edge',
|
|
8
|
-
description:
|
|
9
|
-
'Set side="start" to open from the inline start edge: left in LTR and right in RTL. The default end edge follows the inspector convention.',
|
|
10
|
-
exampleFor: 'Drawer',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: [
|
|
14
|
-
'Drawer',
|
|
15
|
-
'Button',
|
|
16
|
-
'Layout',
|
|
17
|
-
'LayoutContent',
|
|
18
|
-
'DrawerHeader',
|
|
19
|
-
'Text',
|
|
20
|
-
],
|
|
21
|
-
};
|
package/blocks/DrawerStart.tsx
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @input Controlled open state and the logical start edge
|
|
7
|
-
* @output A Drawer that opens from the start side of the viewport
|
|
8
|
-
* @position Copyable Lab Drawer example
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {useState} from 'react';
|
|
12
|
-
import {Drawer, DrawerHeader} from '@astryxdesign/lab';
|
|
13
|
-
import {Button} from '@astryxdesign/core/Button';
|
|
14
|
-
import {Layout, LayoutContent} from '@astryxdesign/core/Layout';
|
|
15
|
-
import {Text} from '@astryxdesign/core/Text';
|
|
16
|
-
|
|
17
|
-
export default function DrawerStart() {
|
|
18
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<>
|
|
22
|
-
<Button label="Open start drawer" onClick={() => setIsOpen(true)} />
|
|
23
|
-
<Drawer
|
|
24
|
-
isOpen={isOpen}
|
|
25
|
-
onOpenChange={setIsOpen}
|
|
26
|
-
label="Navigation"
|
|
27
|
-
side="start">
|
|
28
|
-
<Layout
|
|
29
|
-
header={<DrawerHeader title="Navigation" onOpenChange={setIsOpen} />}
|
|
30
|
-
content={
|
|
31
|
-
<LayoutContent>
|
|
32
|
-
<Text type="body">
|
|
33
|
-
The start edge follows the page's writing direction.
|
|
34
|
-
</Text>
|
|
35
|
-
</LayoutContent>
|
|
36
|
-
}
|
|
37
|
-
/>
|
|
38
|
-
</Drawer>
|
|
39
|
-
</>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
-
export default {
|
|
5
|
-
type: 'block',
|
|
6
|
-
name: 'Width budget: pixels or any CSS length',
|
|
7
|
-
displayName: 'Width budget: pixels or any CSS length',
|
|
8
|
-
description:
|
|
9
|
-
'Compare a numeric pixel width with rem and percentage lengths. The width budget also caps the drawer on mobile.',
|
|
10
|
-
exampleFor: 'Drawer',
|
|
11
|
-
isReady: true,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
componentsUsed: [
|
|
14
|
-
'Drawer',
|
|
15
|
-
'Button',
|
|
16
|
-
'Layout',
|
|
17
|
-
'LayoutContent',
|
|
18
|
-
'HStack',
|
|
19
|
-
'DrawerHeader',
|
|
20
|
-
'Text',
|
|
21
|
-
],
|
|
22
|
-
};
|
package/blocks/DrawerWidths.tsx
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @input A pixel, rem, or percentage width and controlled open state
|
|
7
|
-
* @output A Drawer demonstrating the selected width budget
|
|
8
|
-
* @position Copyable Lab Drawer example
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {useState} from 'react';
|
|
12
|
-
import {Drawer, DrawerHeader} from '@astryxdesign/lab';
|
|
13
|
-
import {Button} from '@astryxdesign/core/Button';
|
|
14
|
-
import {Layout, LayoutContent} from '@astryxdesign/core/Layout';
|
|
15
|
-
import {HStack} from '@astryxdesign/core/Stack';
|
|
16
|
-
import {Text} from '@astryxdesign/core/Text';
|
|
17
|
-
|
|
18
|
-
export default function DrawerWidths() {
|
|
19
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
20
|
-
const [width, setWidth] = useState<number | string>(320);
|
|
21
|
-
|
|
22
|
-
function openAtWidth(value: number | string) {
|
|
23
|
-
setWidth(value);
|
|
24
|
-
setIsOpen(true);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<>
|
|
29
|
-
<HStack gap={2}>
|
|
30
|
-
<Button label="320px" onClick={() => openAtWidth(320)} />
|
|
31
|
-
<Button label="32rem" onClick={() => openAtWidth('32rem')} />
|
|
32
|
-
<Button label="50%" onClick={() => openAtWidth('50%')} />
|
|
33
|
-
</HStack>
|
|
34
|
-
<Drawer
|
|
35
|
-
isOpen={isOpen}
|
|
36
|
-
onOpenChange={setIsOpen}
|
|
37
|
-
label="Width budget"
|
|
38
|
-
width={width}>
|
|
39
|
-
<Layout
|
|
40
|
-
header={
|
|
41
|
-
<DrawerHeader title="Width budget" onOpenChange={setIsOpen} />
|
|
42
|
-
}
|
|
43
|
-
content={
|
|
44
|
-
<LayoutContent>
|
|
45
|
-
<Text type="body">
|
|
46
|
-
Width: {typeof width === 'number' ? `${width}px` : width}
|
|
47
|
-
</Text>
|
|
48
|
-
</LayoutContent>
|
|
49
|
-
}
|
|
50
|
-
/>
|
|
51
|
-
</Drawer>
|
|
52
|
-
</>
|
|
53
|
-
);
|
|
54
|
-
}
|
package/dist/Drawer/Drawer.d.ts
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Drawer.tsx
|
|
3
|
-
* @input Uses React, StyleX, theme tokens and text defaults, the Dialog purpose type, shared focus/dismissal/depth primitives, container padding lowering, scroll locking/dialog presence, BaseProps, merged refs/props, themeProps
|
|
4
|
-
* @output Exports Drawer component and DrawerProps
|
|
5
|
-
* @position Lab implementation; consumed by index.ts, tested by Drawer.test.tsx, demonstrated in Storybook
|
|
6
|
-
*
|
|
7
|
-
* Overlay panel for inspectors and detail views — the "click a table row,
|
|
8
|
-
* see its details" pattern. Slides in from the inline start or end edge and
|
|
9
|
-
* floats above the page content: unlike a docked panel it never reflows the
|
|
10
|
-
* layout underneath, it overlays it (with or without a scrim).
|
|
11
|
-
*
|
|
12
|
-
* Inline axis only (start/end). Block-axis sheets are BottomSheet's job;
|
|
13
|
-
* a drawer is always a full-height side panel.
|
|
14
|
-
*
|
|
15
|
-
* Sizing is viewport-aware: `width` is the desktop budget, and below
|
|
16
|
-
* the mobile breakpoint it preserves a 56px reveal of the page behind, capped
|
|
17
|
-
* by the requested width (or fills the viewport with `isFullWidthOnMobile`).
|
|
18
|
-
*
|
|
19
|
-
* Uses the native `<dialog>` element (same precedent as Dialog/MobileNav):
|
|
20
|
-
* - `showModal()` when `hasScrim` (default) — top-layer rendering, focus
|
|
21
|
-
* trapping, `::backdrop`, no z-index management.
|
|
22
|
-
* - `showPopover()` when `hasScrim={false}` — non-modal top-layer overlay;
|
|
23
|
-
* the page behind stays interactive (e.g. master-detail inspectors).
|
|
24
|
-
*
|
|
25
|
-
* Entry animation uses `@starting-style`; exit slides out before the active
|
|
26
|
-
* modal-dialog or manual-popover host releases the top layer and focus returns
|
|
27
|
-
* to the element that opened the drawer. React owns `display` for both legs
|
|
28
|
-
* rather than a discrete `display` transition, so the panel stops painting in
|
|
29
|
-
* the same commit as the host closes — see the `rendered` style for why.
|
|
30
|
-
*
|
|
31
|
-
* Sibling drawers use the shared layer dismissal stack for topmost-only Escape
|
|
32
|
-
* handling and the browser top layer's chronological paint order.
|
|
33
|
-
*
|
|
34
|
-
* Dismissal follows Dialog: `purpose` decides whether Escape and a scrim click
|
|
35
|
-
* request close, and Drawer renders no close button of its own. Compose
|
|
36
|
-
* `DrawerHeader` with `onOpenChange` for a visible close action, as with
|
|
37
|
-
* `DialogHeader`.
|
|
38
|
-
*
|
|
39
|
-
* The scrolling content area is the drawer's container, like Dialog's inner
|
|
40
|
-
* box: the `padding` prop, else the theme's `padding` on `drawer`, insets it
|
|
41
|
-
* through container tokens, defaulting to `--spacing-4` like Dialog, and the
|
|
42
|
-
* applied inset is published so a lone Section child escapes it and a Layout
|
|
43
|
-
* redistributes it to its regions. Compose `DrawerHeader` inside a `Layout`, as
|
|
44
|
-
* `DialogHeader` is composed in Dialog, so the header is not padded twice. The
|
|
45
|
-
* root dialog stays the overlay boundary (`overlayPaddingReset`).
|
|
46
|
-
*
|
|
47
|
-
* SYNC: When modified, update these files to stay in sync:
|
|
48
|
-
* - /packages/lab/src/Drawer/Drawer.doc.mjs (props table, features, usage)
|
|
49
|
-
* - /packages/lab/src/Drawer/Drawer.test.tsx (tests for new/changed behavior)
|
|
50
|
-
* - /packages/lab/src/Drawer/Drawer.spec.md (component contract)
|
|
51
|
-
* - /packages/lab/src/Drawer/index.ts (exports if types change)
|
|
52
|
-
* - /apps/storybook/stories/Drawer.stories.tsx (examples and visual coverage)
|
|
53
|
-
*/
|
|
54
|
-
import { type ReactNode } from 'react';
|
|
55
|
-
import type { BaseProps } from '@astryxdesign/core';
|
|
56
|
-
import type { DialogPurpose } from '@astryxdesign/core/Dialog';
|
|
57
|
-
import type { SpacingStep } from '@astryxdesign/core/Layout';
|
|
58
|
-
export interface DrawerProps extends BaseProps<HTMLDialogElement> {
|
|
59
|
-
/** Ref forwarded to the root <dialog> element */
|
|
60
|
-
ref?: React.Ref<HTMLDialogElement>;
|
|
61
|
-
/**
|
|
62
|
-
* Whether the drawer is open. Fully controlled — pair with `onOpenChange`.
|
|
63
|
-
*/
|
|
64
|
-
isOpen: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Called when the drawer requests an open-state change. Escape and a scrim
|
|
67
|
-
* click call it with `false` as `purpose` allows; a `DrawerHeader` close
|
|
68
|
-
* button calls it when you pass the same callback to the header. The caller
|
|
69
|
-
* owns the open state. When sibling drawers are open, Escape only closes the
|
|
70
|
-
* top (last-opened) drawer.
|
|
71
|
-
*/
|
|
72
|
-
onOpenChange: (isOpen: boolean) => void;
|
|
73
|
-
/**
|
|
74
|
-
* Which edge the drawer slides from.
|
|
75
|
-
* - `'end'` — inline-end edge (right in LTR) — the inspector convention
|
|
76
|
-
* - `'start'` — inline-start edge (left in LTR)
|
|
77
|
-
* @default 'end'
|
|
78
|
-
*/
|
|
79
|
-
side?: 'start' | 'end';
|
|
80
|
-
/**
|
|
81
|
-
* Desktop width budget. A number is pixels; a string is any CSS length
|
|
82
|
-
* (`'50%'`, `'32rem'`). Below the mobile breakpoint (640px), this
|
|
83
|
-
* remains the maximum while the drawer preserves a 56px reveal of the page
|
|
84
|
-
* behind — see `isFullWidthOnMobile`.
|
|
85
|
-
* @default 400
|
|
86
|
-
*/
|
|
87
|
-
width?: number | string;
|
|
88
|
-
/**
|
|
89
|
-
* Whether the drawer covers the full viewport width on mobile
|
|
90
|
-
* (below 640px) instead of preserving the default 56px reveal of the page
|
|
91
|
-
* behind. The reveal makes the drawer read as an overlay rather than a
|
|
92
|
-
* navigation.
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
isFullWidthOnMobile?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Accessible label for the drawer (required — the drawer has no
|
|
98
|
-
* built-in heading to derive a name from).
|
|
99
|
-
*/
|
|
100
|
-
label: string;
|
|
101
|
-
/**
|
|
102
|
-
* Whether to render a modal scrim behind the drawer.
|
|
103
|
-
* - `true` (default) — `showModal()`: top layer, focus trap, body scroll
|
|
104
|
-
* lock, click-outside-to-close.
|
|
105
|
-
* - `false` — `showPopover()`: non-modal top-layer overlay; the page behind
|
|
106
|
-
* stays interactive. Escape still closes through the shared layer stack.
|
|
107
|
-
* @default true
|
|
108
|
-
*/
|
|
109
|
-
hasScrim?: boolean;
|
|
110
|
-
/**
|
|
111
|
-
* Configures how the drawer enables dismissals, matching Dialog.
|
|
112
|
-
* - required: Disables Escape and scrim click (for mandatory flows); a
|
|
113
|
-
* modal required drawer is exposed as an `alertdialog`
|
|
114
|
-
* - form: Prevents scrim click, allows the Escape key
|
|
115
|
-
* - info: Allows Escape and scrim click
|
|
116
|
-
*
|
|
117
|
-
* A non-modal drawer has no scrim, so `form` and `info` behave the same.
|
|
118
|
-
* @default 'info'
|
|
119
|
-
*/
|
|
120
|
-
purpose?: DialogPurpose;
|
|
121
|
-
/**
|
|
122
|
-
* Internal padding of the drawer content using the spacing scale, matching
|
|
123
|
-
* Dialog. Accepts numeric spacing steps: 0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8,
|
|
124
|
-
* 10. When omitted, uses the theme default for drawers (`--spacing-4`, 16px,
|
|
125
|
-
* unless the theme sets `padding` on `drawer`), as Dialog does. Pass `0` for
|
|
126
|
-
* a full-bleed content area. The content area is a container: a Section that
|
|
127
|
-
* is its only child escapes the padding, bleed children such as Table and
|
|
128
|
-
* Divider compensate against it, and a Layout picks it up for its regions.
|
|
129
|
-
*/
|
|
130
|
-
padding?: SpacingStep;
|
|
131
|
-
/**
|
|
132
|
-
* Drawer content. Rendered inside a full-height scrollable area.
|
|
133
|
-
* Focus the element with `data-autofocus` on open, if present.
|
|
134
|
-
*/
|
|
135
|
-
children: ReactNode;
|
|
136
|
-
/**
|
|
137
|
-
* Test ID for the root element.
|
|
138
|
-
*/
|
|
139
|
-
'data-testid'?: string;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* An overlay panel for inspectors and detail views.
|
|
143
|
-
*
|
|
144
|
-
* Slides in from the logical start or end edge and floats above the page
|
|
145
|
-
* using the native `<dialog>` element: modal with a scrim by default, or a
|
|
146
|
-
* non-modal overlay with `hasScrim={false}` that leaves the page behind
|
|
147
|
-
* interactive. `width` is the desktop budget; below 640px the panel preserves
|
|
148
|
-
* a 56px page reveal without exceeding that budget (or fills the viewport
|
|
149
|
-
* with `isFullWidthOnMobile`). Escape
|
|
150
|
-
* closes the top-most open drawer; focus returns to the element that
|
|
151
|
-
* opened it.
|
|
152
|
-
*
|
|
153
|
-
* Dismissal matches Dialog: `purpose` decides whether Escape and a scrim click
|
|
154
|
-
* close the drawer, and `DrawerHeader` renders a close button when given
|
|
155
|
-
* `onOpenChange`.
|
|
156
|
-
*
|
|
157
|
-
* Like Dialog, the drawer is a container: `padding` (or a theme's `padding`
|
|
158
|
-
* on `drawer`) insets the content area, a lone Section child escapes that
|
|
159
|
-
* inset, and a Layout inside picks it up for its header, content, and footer
|
|
160
|
-
* regions. The default inset is `--spacing-4`, matching Dialog.
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* ```
|
|
164
|
-
* const [selected, setSelected] = useState(null);
|
|
165
|
-
* const handleOpenChange = isOpen => !isOpen && setSelected(null);
|
|
166
|
-
* <Drawer
|
|
167
|
-
* isOpen={selected != null}
|
|
168
|
-
* onOpenChange={handleOpenChange}
|
|
169
|
-
* label={`Details: ${selected?.name}`}>
|
|
170
|
-
* <Layout
|
|
171
|
-
* header={<DrawerHeader title={selected?.name} onOpenChange={handleOpenChange} />}
|
|
172
|
-
* content={<LayoutContent><HostDetails host={selected} /></LayoutContent>}
|
|
173
|
-
* />
|
|
174
|
-
* </Drawer>
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
export declare function Drawer({ isOpen, onOpenChange, side, width, isFullWidthOnMobile, label, hasScrim, purpose, padding, children, xstyle, className, style, onClick: onClickProp, onKeyDown: onKeyDownProp, ref, ...props }: DrawerProps): import("react").JSX.Element;
|
|
178
|
-
export declare namespace Drawer {
|
|
179
|
-
var displayName: string;
|
|
180
|
-
}
|
|
181
|
-
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../src/Drawer/Drawer.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAgC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAUlD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAoB7D,OAAO,KAAK,EAAC,WAAW,EAAe,MAAM,2BAA2B,CAAC;AA6MzE,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC/D,iDAAiD;IACjD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAEnC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;;OAMG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAExC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAEvB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,YAAY,EACZ,IAAY,EACZ,KAAW,EACX,mBAA2B,EAC3B,KAAK,EACL,QAAe,EACf,OAAgB,EAChB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,EACxB,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,+BAuKb;yBAzLe,MAAM"}
|