@mattermost/compass-ui 0.1.0-alpha.13 → 0.1.0-alpha.14
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/components/channel-sidebar-item/ChannelSidebarItem.cjs +1 -1
- package/dist/components/channel-sidebar-item/ChannelSidebarItem.cjs.map +1 -1
- package/dist/components/channel-sidebar-item/ChannelSidebarItem.d.ts.map +1 -1
- package/dist/components/channel-sidebar-item/ChannelSidebarItem.js +32 -31
- package/dist/components/channel-sidebar-item/ChannelSidebarItem.js.map +1 -1
- package/dist/components/checkbox/Checkbox.css +1 -1
- package/dist/components/checkbox/Checkbox.module.scss.cjs +1 -1
- package/dist/components/checkbox/Checkbox.module.scss.js +10 -10
- package/dist/components/icon-button/IconButton.css +1 -1
- package/dist/components/icon-button/IconButton.module.scss.cjs +1 -1
- package/dist/components/icon-button/IconButton.module.scss.js +15 -15
- package/dist/components/modal/Modal.cjs +1 -1
- package/dist/components/modal/Modal.cjs.map +1 -1
- package/dist/components/modal/Modal.css +1 -1
- package/dist/components/modal/Modal.d.ts +25 -3
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +105 -68
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/modal/Modal.module.scss.cjs +1 -1
- package/dist/components/modal/Modal.module.scss.js +14 -12
- package/dist/components/modal/Modal.module.scss.js.map +1 -1
- package/dist/components/modal-header/ModalHeader.css +1 -1
- package/dist/components/modal-header/ModalHeader.module.scss.cjs +1 -1
- package/dist/components/modal-header/ModalHeader.module.scss.js +15 -15
- package/dist/components/popover-menu/PopoverMenu.cjs +1 -1
- package/dist/components/popover-menu/PopoverMenu.cjs.map +1 -1
- package/dist/components/popover-menu/PopoverMenu.css +1 -1
- package/dist/components/popover-menu/PopoverMenu.d.ts +9 -1
- package/dist/components/popover-menu/PopoverMenu.d.ts.map +1 -1
- package/dist/components/popover-menu/PopoverMenu.js +39 -28
- package/dist/components/popover-menu/PopoverMenu.js.map +1 -1
- package/dist/components/popover-menu/PopoverMenu.module.scss.cjs +1 -1
- package/dist/components/popover-menu/PopoverMenu.module.scss.js +12 -10
- package/dist/components/popover-menu/PopoverMenu.module.scss.js.map +1 -1
- package/dist/components/radio/Radio.css +1 -1
- package/dist/components/radio/Radio.module.scss.cjs +1 -1
- package/dist/components/radio/Radio.module.scss.js +14 -14
- package/dist/components/switch/Switch.css +1 -1
- package/dist/components/switch/Switch.module.scss.cjs +1 -1
- package/dist/components/switch/Switch.module.scss.js +11 -11
- package/dist/components/tabs/Tabs.cjs +1 -1
- package/dist/components/tabs/Tabs.cjs.map +1 -1
- package/dist/components/tabs/Tabs.css +1 -1
- package/dist/components/tabs/Tabs.d.ts +4 -1
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +41 -35
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/tabs/Tabs.module.scss.cjs +1 -1
- package/dist/components/tabs/Tabs.module.scss.js +13 -12
- package/dist/components/tabs/Tabs.module.scss.js.map +1 -1
- package/dist/components/tabs/index.d.ts +1 -1
- package/dist/components/tabs/index.d.ts.map +1 -1
- package/dist/hooks/use-modal-focus.cjs +2 -0
- package/dist/hooks/use-modal-focus.cjs.map +1 -0
- package/dist/hooks/use-modal-focus.d.ts +26 -0
- package/dist/hooks/use-modal-focus.d.ts.map +1 -0
- package/dist/hooks/use-modal-focus.js +91 -0
- package/dist/hooks/use-modal-focus.js.map +1 -0
- package/dist/hooks/use-popover-transition.cjs +1 -1
- package/dist/hooks/use-popover-transition.cjs.map +1 -1
- package/dist/hooks/use-popover-transition.d.ts +6 -4
- package/dist/hooks/use-popover-transition.d.ts.map +1 -1
- package/dist/hooks/use-popover-transition.js +19 -15
- package/dist/hooks/use-popover-transition.js.map +1 -1
- package/dist/utils/duration.cjs +2 -0
- package/dist/utils/duration.cjs.map +1 -0
- package/dist/utils/duration.d.ts +8 -0
- package/dist/utils/duration.d.ts.map +1 -0
- package/dist/utils/duration.js +11 -0
- package/dist/utils/duration.js.map +1 -0
- package/package.json +4 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, HTMLAttributes, ReactNode } from 'react';
|
|
1
|
+
import { CSSProperties, HTMLAttributes, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { ModalFooterType } from '../modal-footer/ModalFooter';
|
|
3
3
|
import { ModalSubtitlePlacement } from '../modal-header/ModalHeader';
|
|
4
4
|
import { BuiltInButtonProps } from '../../utils/props';
|
|
@@ -71,10 +71,32 @@ export interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
71
71
|
footerType?: ModalFooterType;
|
|
72
72
|
/** Show divider between body and footer. Default: true. */
|
|
73
73
|
footerDivider?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Close on Escape via a document listener while mounted. Escapes already
|
|
76
|
+
* handled by an inner widget (`defaultPrevented`) are ignored. Default: true.
|
|
77
|
+
*/
|
|
78
|
+
closeOnEscape?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Element to focus when the modal mounts (e.g. the first form field).
|
|
81
|
+
* Default: the dialog root.
|
|
82
|
+
*/
|
|
83
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
84
|
+
/**
|
|
85
|
+
* Controlled visibility with the Compass enter/exit transition (fade + drop from the top + subtle scale 98%→100%,
|
|
86
|
+
* reverse on close, `--duration-quick`); the modal unmounts after the exit,
|
|
87
|
+
* and focus is restored then. Omit to keep the mount-controlled behavior
|
|
88
|
+
* (always rendered, no transition). The host still owns the state.
|
|
89
|
+
*/
|
|
90
|
+
open?: boolean;
|
|
91
|
+
/** Called after the exit transition finishes and the modal unmounts (only when `open` is controlled). */
|
|
92
|
+
onExited?: () => void;
|
|
74
93
|
}
|
|
75
94
|
/**
|
|
76
95
|
* Modal dialog shell — composes ModalHeader, scrollable body, and ModalFooter.
|
|
77
|
-
*
|
|
96
|
+
* Owns dialog-level focus and keyboard behavior: initial focus, Tab trap,
|
|
97
|
+
* Escape, and focus restore on unmount. Host owns portal, overlay/backdrop,
|
|
98
|
+
* scroll lock, stacking, and open state. Mount-controlled by default; pass
|
|
99
|
+
* `open` for the enter/exit transition.
|
|
78
100
|
*/
|
|
79
|
-
export default function Modal({
|
|
101
|
+
export default function Modal({ open, onExited, ...props }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
80
102
|
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,SAAS,EACT,SAAS,EACV,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAIxD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3D,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC;AAExD,MAAM,WAAW,UAAW,SAAQ,IAAI,CACtC,cAAc,CAAC,cAAc,CAAC,EAC9B,OAAO,GAAG,UAAU,GAAG,OAAO,CAC/B;IACC,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,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IAAI,CAAC,EAAE,OAAO,CAAC;IACf,yGAAyG;IACzG,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAsHD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,kDAwBrE"}
|
|
@@ -1,87 +1,124 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useId as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
import { jsx as n, jsxs as A } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as c, useEffect as D, useId as G } from "react";
|
|
3
|
+
import { useModalFocus as J } from "../../hooks/use-modal-focus.js";
|
|
4
|
+
import { usePopoverTransition as O } from "../../hooks/use-popover-transition.js";
|
|
5
|
+
import Q from "../scrollbar/Scrollbar.js";
|
|
6
|
+
import U from "../modal-footer/ModalFooter.js";
|
|
7
|
+
import V from "../modal-header/ModalHeader.js";
|
|
8
|
+
import { toKebab as W } from "../../utils/string.js";
|
|
9
|
+
import o from "./Modal.module.scss.js";
|
|
10
|
+
function X({
|
|
11
|
+
className: t = "",
|
|
12
|
+
style: a,
|
|
13
|
+
size: d = "small",
|
|
14
|
+
title: e,
|
|
15
|
+
subtitle: r,
|
|
16
|
+
subtitlePlacement: m = "below",
|
|
17
|
+
hideTitle: s = !1,
|
|
18
|
+
showBackButton: l = !1,
|
|
19
|
+
onBack: i,
|
|
20
|
+
backLabel: I,
|
|
21
|
+
backButtonProps: j,
|
|
22
|
+
onClose: f,
|
|
23
|
+
closeLabel: w,
|
|
24
|
+
closeButtonProps: F,
|
|
25
|
+
headerDivider: N = !0,
|
|
26
|
+
headerAction: x,
|
|
27
|
+
headerSlot: z,
|
|
28
|
+
bodyPadding: b = "default",
|
|
29
|
+
scrollable: B = !0,
|
|
30
|
+
children: g,
|
|
31
|
+
footer: p,
|
|
32
|
+
footerLeading: v,
|
|
33
|
+
footerType: u = "2-actions",
|
|
34
|
+
footerDivider: C = !0,
|
|
35
|
+
closeOnEscape: H = !0,
|
|
36
|
+
initialFocusRef: K,
|
|
37
|
+
active: P,
|
|
38
|
+
transition: _,
|
|
39
|
+
visible: R,
|
|
40
|
+
...S
|
|
34
41
|
}) {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
const y = c(null);
|
|
43
|
+
J(y, {
|
|
44
|
+
initialFocusRef: K,
|
|
45
|
+
closeOnEscape: H,
|
|
46
|
+
onClose: f,
|
|
47
|
+
active: P
|
|
48
|
+
});
|
|
49
|
+
const M = G(), $ = o[`modal--size-${W(d)}`], k = [
|
|
50
|
+
o["modal__body-inner"],
|
|
51
|
+
b === "menu" && o["modal__body-inner--menu"],
|
|
52
|
+
b === "none" && o["modal__body-inner--none"]
|
|
53
|
+
].filter(Boolean).join(" "), h = /* @__PURE__ */ n("div", { className: k, children: g }), q = p != null || v != null || u === "spacer-small" || u === "spacer-large";
|
|
54
|
+
return /* @__PURE__ */ A(
|
|
41
55
|
"div",
|
|
42
56
|
{
|
|
43
|
-
...
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
...S,
|
|
58
|
+
ref: y,
|
|
59
|
+
tabIndex: -1,
|
|
60
|
+
className: [
|
|
61
|
+
o.modal,
|
|
62
|
+
$,
|
|
63
|
+
_ && o["modal--transition"],
|
|
64
|
+
_ && R && o["modal--visible"],
|
|
65
|
+
t
|
|
66
|
+
].filter(Boolean).join(" "),
|
|
67
|
+
style: a,
|
|
46
68
|
role: "dialog",
|
|
47
69
|
"aria-modal": "true",
|
|
48
|
-
"aria-labelledby":
|
|
70
|
+
"aria-labelledby": M,
|
|
49
71
|
children: [
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
|
|
72
|
+
/* @__PURE__ */ n(
|
|
73
|
+
V,
|
|
52
74
|
{
|
|
53
|
-
title:
|
|
54
|
-
titleId:
|
|
55
|
-
subtitle:
|
|
56
|
-
subtitlePlacement:
|
|
57
|
-
hideTitle:
|
|
58
|
-
showBackButton:
|
|
59
|
-
onBack:
|
|
60
|
-
backLabel:
|
|
61
|
-
backButtonProps:
|
|
62
|
-
onClose:
|
|
63
|
-
closeLabel:
|
|
64
|
-
closeButtonProps:
|
|
65
|
-
divider:
|
|
66
|
-
headerAction:
|
|
67
|
-
headerSlot:
|
|
75
|
+
title: e,
|
|
76
|
+
titleId: M,
|
|
77
|
+
subtitle: r,
|
|
78
|
+
subtitlePlacement: m,
|
|
79
|
+
hideTitle: s,
|
|
80
|
+
showBackButton: l,
|
|
81
|
+
onBack: i,
|
|
82
|
+
backLabel: I,
|
|
83
|
+
backButtonProps: j,
|
|
84
|
+
onClose: f,
|
|
85
|
+
closeLabel: w,
|
|
86
|
+
closeButtonProps: F,
|
|
87
|
+
divider: N,
|
|
88
|
+
headerAction: x,
|
|
89
|
+
headerSlot: z
|
|
68
90
|
}
|
|
69
91
|
),
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
|
|
72
|
-
|
|
92
|
+
/* @__PURE__ */ n("div", { className: o.modal__body, children: B ? /* @__PURE__ */ n(Q, { children: h }) : h }),
|
|
93
|
+
q && /* @__PURE__ */ n(
|
|
94
|
+
U,
|
|
73
95
|
{
|
|
74
|
-
type:
|
|
75
|
-
divider:
|
|
76
|
-
leading:
|
|
77
|
-
children:
|
|
96
|
+
type: u,
|
|
97
|
+
divider: C,
|
|
98
|
+
leading: v,
|
|
99
|
+
children: p
|
|
78
100
|
}
|
|
79
101
|
)
|
|
80
102
|
]
|
|
81
103
|
}
|
|
82
104
|
);
|
|
83
105
|
}
|
|
106
|
+
function no({ open: t, onExited: a, ...d }) {
|
|
107
|
+
const e = t !== void 0, { mounted: r, visible: m } = O(t ?? !0), s = c(r), l = c(a);
|
|
108
|
+
return l.current = a, D(() => {
|
|
109
|
+
var i;
|
|
110
|
+
s.current && !r && e && ((i = l.current) == null || i.call(l)), s.current = r;
|
|
111
|
+
}, [r, e]), e && !r ? null : /* @__PURE__ */ n(
|
|
112
|
+
X,
|
|
113
|
+
{
|
|
114
|
+
...d,
|
|
115
|
+
active: t ?? !0,
|
|
116
|
+
transition: e,
|
|
117
|
+
visible: m
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
84
121
|
export {
|
|
85
|
-
|
|
122
|
+
no as default
|
|
86
123
|
};
|
|
87
124
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sources":["../../../src/components/modal/Modal.tsx"],"sourcesContent":["import type { CSSProperties, HTMLAttributes, ReactNode } from 'react';\nimport { useId } from 'react';\nimport Scrollbar from '@/components/scrollbar/Scrollbar';\nimport ModalFooter from '@/components/modal-footer/ModalFooter';\nimport type { ModalFooterType } from '@/components/modal-footer/ModalFooter';\nimport ModalHeader from '@/components/modal-header/ModalHeader';\nimport type { ModalSubtitlePlacement } from '@/components/modal-header/ModalHeader';\nimport type { BuiltInButtonProps } from '@/utils/props';\nimport { toKebab } from '@/utils/string';\nimport styles from './Modal.module.scss';\n\nexport type ModalSize = 'small' | 'medium' | 'large';\n\n/**\n * Body inset. `menu` is for MenuItem lists — 8px vertical / 16px horizontal so\n * row labels align with the 32px header/footer margins. `none` removes inset\n * for host-owned full-bleed layouts (e.g. settings sidebars).\n */\nexport type ModalBodyPadding = 'default' | 'menu' | 'none';\n\nexport type { ModalFooterType, ModalSubtitlePlacement };\n\nexport interface ModalProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'title' | 'children' | 'style'\n> {\n /** Extra class on the dialog root (size + chrome classes still apply). */\n className?: string;\n /** Inline style on the dialog root — prefer `className` for layout overrides. */\n style?: CSSProperties;\n /** Width variant. Figma: Size — Small 600px, Medium 704px, Large 832px. */\n size?: ModalSize;\n /** Modal heading text. Required for a11y; use `hideTitle` for close-only chrome. */\n title: ReactNode;\n /** Optional secondary line — placement via `subtitlePlacement`. */\n subtitle?: ReactNode;\n /**\n * Where the subtitle sits. Figma Modal Header: Below | Beside.\n * Default: `below`.\n */\n subtitlePlacement?: ModalSubtitlePlacement;\n /** Visually hide the title (close-only header); title remains for `aria-labelledby`. */\n hideTitle?: boolean;\n /** When true, shows a back-arrow button before the title. */\n showBackButton?: boolean;\n /** Called when the back button is clicked. */\n onBack?: () => void;\n /** Accessible name for the back button. Default: \"Go back\". */\n backLabel?: string;\n /** Extra attributes for the back button (e.g. `data-testid`). */\n backButtonProps?: BuiltInButtonProps;\n /** Called when the × close button is clicked. */\n onClose?: () => void;\n /** Accessible name for the close button. Default: \"Close\". */\n closeLabel?: string;\n /** Extra attributes for the close button (e.g. `data-testid`). */\n closeButtonProps?: BuiltInButtonProps;\n /** Show divider between header and body. Default: true. */\n headerDivider?: boolean;\n /** Optional control before close (Button, search field, …). */\n headerAction?: ReactNode;\n /**\n * Full-width slot rendered below the title row and above the header divider.\n * Accepts any ReactNode — SearchInput, Tabs, a custom toolbar, etc.\n */\n headerSlot?: ReactNode;\n /**\n * Body inset. Default is 32px horizontal / 28px vertical. Use `menu` for\n * MenuItem lists. Use `none` when the host owns padding.\n */\n bodyPadding?: ModalBodyPadding;\n /**\n * When true (default), wraps body content in Scrollbar. Set false when the\n * host manages scroll inside panes.\n */\n scrollable?: boolean;\n /** Body content. */\n children: ReactNode;\n /** Footer slot — typically Buttons. Wrapped in `ModalFooter`. */\n footer?: ReactNode;\n /** Left footer slot (pagination status, PaginationDots, …). */\n footerLeading?: ReactNode;\n /** Footer layout. Figma Modal Footer Type. Default: `2-actions`. */\n footerType?: ModalFooterType;\n /** Show divider between body and footer. Default: true. */\n footerDivider?: boolean;\n}\n\n/**\n * Modal dialog shell — composes ModalHeader, scrollable body, and ModalFooter.\n * Host owns portal, overlay, focus trap, and open/close.\n */\nexport default function Modal({\n className = '',\n style,\n size = 'small',\n title,\n subtitle,\n subtitlePlacement = 'below',\n hideTitle = false,\n showBackButton = false,\n onBack,\n backLabel,\n backButtonProps,\n onClose,\n closeLabel,\n closeButtonProps,\n headerDivider = true,\n headerAction,\n headerSlot,\n bodyPadding = 'default',\n scrollable = true,\n children,\n footer,\n footerLeading,\n footerType = '2-actions',\n footerDivider = true,\n ...rest\n}: ModalProps) {\n const titleId = useId();\n const sizeClass = styles[`modal--size-${toKebab(size)}`];\n const bodyInnerClass = [\n styles['modal__body-inner'],\n bodyPadding === 'menu' && styles['modal__body-inner--menu'],\n bodyPadding === 'none' && styles['modal__body-inner--none'],\n ]\n .filter(Boolean)\n .join(' ');\n\n const bodyInner = <div className={bodyInnerClass}>{children}</div>;\n const showFooter =\n footer != null ||\n footerLeading != null ||\n footerType === 'spacer-small' ||\n footerType === 'spacer-large';\n\n return (\n <div\n {...rest}\n className={[styles.modal, sizeClass, className].filter(Boolean).join(' ')}\n style={style}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n >\n <ModalHeader\n title={title}\n titleId={titleId}\n subtitle={subtitle}\n subtitlePlacement={subtitlePlacement}\n hideTitle={hideTitle}\n showBackButton={showBackButton}\n onBack={onBack}\n backLabel={backLabel}\n backButtonProps={backButtonProps}\n onClose={onClose}\n closeLabel={closeLabel}\n closeButtonProps={closeButtonProps}\n divider={headerDivider}\n headerAction={headerAction}\n headerSlot={headerSlot}\n />\n\n <div className={styles['modal__body']}>\n {scrollable ? <Scrollbar>{bodyInner}</Scrollbar> : bodyInner}\n </div>\n\n {showFooter && (\n <ModalFooter\n type={footerType}\n divider={footerDivider}\n leading={footerLeading}\n >\n {footer}\n </ModalFooter>\n )}\n </div>\n );\n}\n"],"names":["Modal","className","style","size","title","subtitle","subtitlePlacement","hideTitle","showBackButton","onBack","backLabel","backButtonProps","onClose","closeLabel","closeButtonProps","headerDivider","headerAction","headerSlot","bodyPadding","scrollable","children","footer","footerLeading","footerType","footerDivider","rest","titleId","useId","sizeClass","styles","toKebab","bodyInnerClass","bodyInner","jsx","showFooter","jsxs","ModalHeader","Scrollbar","ModalFooter"],"mappings":";;;;;;;AA4FA,SAAwBA,EAAM;AAAA,EAC5B,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,mBAAAC,IAAoB;AAAA,EACpB,WAAAC,IAAY;AAAA,EACZ,gBAAAC,IAAiB;AAAA,EACjB,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,eAAAC,IAAgB;AAAA,EAChB,GAAGC;AACL,GAAe;AACb,QAAMC,IAAUC,EAAA,GACVC,IAAYC,EAAO,eAAeC,EAAQ3B,CAAI,CAAC,EAAE,GACjD4B,IAAiB;AAAA,IACrBF,EAAO,mBAAmB;AAAA,IAC1BX,MAAgB,UAAUW,EAAO,yBAAyB;AAAA,IAC1DX,MAAgB,UAAUW,EAAO,yBAAyB;AAAA,EAAA,EAEzD,OAAO,OAAO,EACd,KAAK,GAAG,GAELG,IAAY,gBAAAC,EAAC,OAAA,EAAI,WAAWF,GAAiB,UAAAX,GAAS,GACtDc,IACJb,KAAU,QACVC,KAAiB,QACjBC,MAAe,kBACfA,MAAe;AAEjB,SACE,gBAAAY;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGV;AAAA,MACJ,WAAW,CAACI,EAAO,OAAOD,GAAW3B,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,MACxE,OAAAC;AAAA,MACA,MAAK;AAAA,MACL,cAAW;AAAA,MACX,mBAAiBwB;AAAA,MAEjB,UAAA;AAAA,QAAA,gBAAAO;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,OAAAhC;AAAA,YACA,SAAAsB;AAAA,YACA,UAAArB;AAAA,YACA,mBAAAC;AAAA,YACA,WAAAC;AAAA,YACA,gBAAAC;AAAA,YACA,QAAAC;AAAA,YACA,WAAAC;AAAA,YACA,iBAAAC;AAAA,YACA,SAAAC;AAAA,YACA,YAAAC;AAAA,YACA,kBAAAC;AAAA,YACA,SAASC;AAAA,YACT,cAAAC;AAAA,YACA,YAAAC;AAAA,UAAA;AAAA,QAAA;AAAA,QAGF,gBAAAgB,EAAC,OAAA,EAAI,WAAWJ,EAAO,aACpB,UAAAV,IAAa,gBAAAc,EAACI,GAAA,EAAW,UAAAL,EAAA,CAAU,IAAeA,GACrD;AAAA,QAECE,KACC,gBAAAD;AAAA,UAACK;AAAA,UAAA;AAAA,YACC,MAAMf;AAAA,YACN,SAASC;AAAA,YACT,SAASF;AAAA,YAER,UAAAD;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../../src/components/modal/Modal.tsx"],"sourcesContent":["import type {\n CSSProperties,\n HTMLAttributes,\n ReactNode,\n RefObject,\n} from 'react';\nimport { useEffect, useId, useRef } from 'react';\nimport { useModalFocus } from '@/hooks/use-modal-focus';\nimport { usePopoverTransition } from '@/hooks/use-popover-transition';\nimport Scrollbar from '@/components/scrollbar/Scrollbar';\nimport ModalFooter from '@/components/modal-footer/ModalFooter';\nimport type { ModalFooterType } from '@/components/modal-footer/ModalFooter';\nimport ModalHeader from '@/components/modal-header/ModalHeader';\nimport type { ModalSubtitlePlacement } from '@/components/modal-header/ModalHeader';\nimport type { BuiltInButtonProps } from '@/utils/props';\nimport { toKebab } from '@/utils/string';\nimport styles from './Modal.module.scss';\n\nexport type ModalSize = 'small' | 'medium' | 'large';\n\n/**\n * Body inset. `menu` is for MenuItem lists — 8px vertical / 16px horizontal so\n * row labels align with the 32px header/footer margins. `none` removes inset\n * for host-owned full-bleed layouts (e.g. settings sidebars).\n */\nexport type ModalBodyPadding = 'default' | 'menu' | 'none';\n\nexport type { ModalFooterType, ModalSubtitlePlacement };\n\nexport interface ModalProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'title' | 'children' | 'style'\n> {\n /** Extra class on the dialog root (size + chrome classes still apply). */\n className?: string;\n /** Inline style on the dialog root — prefer `className` for layout overrides. */\n style?: CSSProperties;\n /** Width variant. Figma: Size — Small 600px, Medium 704px, Large 832px. */\n size?: ModalSize;\n /** Modal heading text. Required for a11y; use `hideTitle` for close-only chrome. */\n title: ReactNode;\n /** Optional secondary line — placement via `subtitlePlacement`. */\n subtitle?: ReactNode;\n /**\n * Where the subtitle sits. Figma Modal Header: Below | Beside.\n * Default: `below`.\n */\n subtitlePlacement?: ModalSubtitlePlacement;\n /** Visually hide the title (close-only header); title remains for `aria-labelledby`. */\n hideTitle?: boolean;\n /** When true, shows a back-arrow button before the title. */\n showBackButton?: boolean;\n /** Called when the back button is clicked. */\n onBack?: () => void;\n /** Accessible name for the back button. Default: \"Go back\". */\n backLabel?: string;\n /** Extra attributes for the back button (e.g. `data-testid`). */\n backButtonProps?: BuiltInButtonProps;\n /** Called when the × close button is clicked. */\n onClose?: () => void;\n /** Accessible name for the close button. Default: \"Close\". */\n closeLabel?: string;\n /** Extra attributes for the close button (e.g. `data-testid`). */\n closeButtonProps?: BuiltInButtonProps;\n /** Show divider between header and body. Default: true. */\n headerDivider?: boolean;\n /** Optional control before close (Button, search field, …). */\n headerAction?: ReactNode;\n /**\n * Full-width slot rendered below the title row and above the header divider.\n * Accepts any ReactNode — SearchInput, Tabs, a custom toolbar, etc.\n */\n headerSlot?: ReactNode;\n /**\n * Body inset. Default is 32px horizontal / 28px vertical. Use `menu` for\n * MenuItem lists. Use `none` when the host owns padding.\n */\n bodyPadding?: ModalBodyPadding;\n /**\n * When true (default), wraps body content in Scrollbar. Set false when the\n * host manages scroll inside panes.\n */\n scrollable?: boolean;\n /** Body content. */\n children: ReactNode;\n /** Footer slot — typically Buttons. Wrapped in `ModalFooter`. */\n footer?: ReactNode;\n /** Left footer slot (pagination status, PaginationDots, …). */\n footerLeading?: ReactNode;\n /** Footer layout. Figma Modal Footer Type. Default: `2-actions`. */\n footerType?: ModalFooterType;\n /** Show divider between body and footer. Default: true. */\n footerDivider?: boolean;\n /**\n * Close on Escape via a document listener while mounted. Escapes already\n * handled by an inner widget (`defaultPrevented`) are ignored. Default: true.\n */\n closeOnEscape?: boolean;\n /**\n * Element to focus when the modal mounts (e.g. the first form field).\n * Default: the dialog root.\n */\n initialFocusRef?: RefObject<HTMLElement | null>;\n /**\n * Controlled visibility with the Compass enter/exit transition (fade + drop from the top + subtle scale 98%→100%,\n * reverse on close, `--duration-quick`); the modal unmounts after the exit,\n * and focus is restored then. Omit to keep the mount-controlled behavior\n * (always rendered, no transition). The host still owns the state.\n */\n open?: boolean;\n /** Called after the exit transition finishes and the modal unmounts (only when `open` is controlled). */\n onExited?: () => void;\n}\n\ninterface ModalPanelState {\n active: boolean;\n transition: boolean;\n visible: boolean;\n}\n\nfunction ModalPanel({\n className = '',\n style,\n size = 'small',\n title,\n subtitle,\n subtitlePlacement = 'below',\n hideTitle = false,\n showBackButton = false,\n onBack,\n backLabel,\n backButtonProps,\n onClose,\n closeLabel,\n closeButtonProps,\n headerDivider = true,\n headerAction,\n headerSlot,\n bodyPadding = 'default',\n scrollable = true,\n children,\n footer,\n footerLeading,\n footerType = '2-actions',\n footerDivider = true,\n closeOnEscape = true,\n initialFocusRef,\n active,\n transition,\n visible,\n ...rest\n}: ModalProps & ModalPanelState) {\n const rootRef = useRef<HTMLDivElement>(null);\n useModalFocus(rootRef, {\n initialFocusRef,\n closeOnEscape,\n onClose,\n active,\n });\n const titleId = useId();\n const sizeClass = styles[`modal--size-${toKebab(size)}`];\n const bodyInnerClass = [\n styles['modal__body-inner'],\n bodyPadding === 'menu' && styles['modal__body-inner--menu'],\n bodyPadding === 'none' && styles['modal__body-inner--none'],\n ]\n .filter(Boolean)\n .join(' ');\n\n const bodyInner = <div className={bodyInnerClass}>{children}</div>;\n const showFooter =\n footer != null ||\n footerLeading != null ||\n footerType === 'spacer-small' ||\n footerType === 'spacer-large';\n\n return (\n <div\n {...rest}\n ref={rootRef}\n tabIndex={-1}\n className={[\n styles.modal,\n sizeClass,\n transition && styles['modal--transition'],\n transition && visible && styles['modal--visible'],\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={style}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n >\n <ModalHeader\n title={title}\n titleId={titleId}\n subtitle={subtitle}\n subtitlePlacement={subtitlePlacement}\n hideTitle={hideTitle}\n showBackButton={showBackButton}\n onBack={onBack}\n backLabel={backLabel}\n backButtonProps={backButtonProps}\n onClose={onClose}\n closeLabel={closeLabel}\n closeButtonProps={closeButtonProps}\n divider={headerDivider}\n headerAction={headerAction}\n headerSlot={headerSlot}\n />\n\n <div className={styles['modal__body']}>\n {scrollable ? <Scrollbar>{bodyInner}</Scrollbar> : bodyInner}\n </div>\n\n {showFooter && (\n <ModalFooter\n type={footerType}\n divider={footerDivider}\n leading={footerLeading}\n >\n {footer}\n </ModalFooter>\n )}\n </div>\n );\n}\n\n/**\n * Modal dialog shell — composes ModalHeader, scrollable body, and ModalFooter.\n * Owns dialog-level focus and keyboard behavior: initial focus, Tab trap,\n * Escape, and focus restore on unmount. Host owns portal, overlay/backdrop,\n * scroll lock, stacking, and open state. Mount-controlled by default; pass\n * `open` for the enter/exit transition.\n */\nexport default function Modal({ open, onExited, ...props }: ModalProps) {\n const controlled = open !== undefined;\n const { mounted, visible } = usePopoverTransition(open ?? true);\n const wasMounted = useRef(mounted);\n const onExitedRef = useRef(onExited);\n onExitedRef.current = onExited;\n\n useEffect(() => {\n if (wasMounted.current && !mounted && controlled) {\n onExitedRef.current?.();\n }\n wasMounted.current = mounted;\n }, [mounted, controlled]);\n\n if (controlled && !mounted) return null;\n\n return (\n <ModalPanel\n {...props}\n active={open ?? true}\n transition={controlled}\n visible={visible}\n />\n );\n}\n"],"names":["ModalPanel","className","style","size","title","subtitle","subtitlePlacement","hideTitle","showBackButton","onBack","backLabel","backButtonProps","onClose","closeLabel","closeButtonProps","headerDivider","headerAction","headerSlot","bodyPadding","scrollable","children","footer","footerLeading","footerType","footerDivider","closeOnEscape","initialFocusRef","active","transition","visible","rest","rootRef","useRef","useModalFocus","titleId","useId","sizeClass","styles","toKebab","bodyInnerClass","bodyInner","jsx","showFooter","jsxs","ModalHeader","Scrollbar","ModalFooter","Modal","open","onExited","props","controlled","mounted","usePopoverTransition","wasMounted","onExitedRef","useEffect","_a"],"mappings":";;;;;;;;;AAwHA,SAASA,EAAW;AAAA,EAClB,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,mBAAAC,IAAoB;AAAA,EACpB,WAAAC,IAAY;AAAA,EACZ,gBAAAC,IAAiB;AAAA,EACjB,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,e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toStringTag]:{value:"Module"}});require('./Modal.css');const _="
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./Modal.css');const _="_modal_14reu_2",e="_modal__body_14reu_47",o={modal:_,"modal--transition":"_modal--transition_14reu_11","modal--visible":"_modal--visible_14reu_24","modal--size-small":"_modal--size-small_14reu_38","modal--size-medium":"_modal--size-medium_14reu_41","modal--size-large":"_modal--size-large_14reu_44",modal__body:e,"modal__body-inner":"_modal__body-inner_14reu_51","modal__body-inner--menu":"_modal__body-inner--menu_14reu_54","modal__body-inner--none":"_modal__body-inner--none_14reu_57"};exports.default=o;exports.modal=_;exports.modal__body=e;
|
|
2
2
|
//# sourceMappingURL=Modal.module.scss.cjs.map
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import './Modal.css';const
|
|
2
|
-
modal:
|
|
3
|
-
"modal--
|
|
4
|
-
"modal--
|
|
5
|
-
"modal--size-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"modal__body-inner
|
|
1
|
+
import './Modal.css';const _ = "_modal_14reu_2", o = "_modal__body_14reu_47", e = {
|
|
2
|
+
modal: _,
|
|
3
|
+
"modal--transition": "_modal--transition_14reu_11",
|
|
4
|
+
"modal--visible": "_modal--visible_14reu_24",
|
|
5
|
+
"modal--size-small": "_modal--size-small_14reu_38",
|
|
6
|
+
"modal--size-medium": "_modal--size-medium_14reu_41",
|
|
7
|
+
"modal--size-large": "_modal--size-large_14reu_44",
|
|
8
|
+
modal__body: o,
|
|
9
|
+
"modal__body-inner": "_modal__body-inner_14reu_51",
|
|
10
|
+
"modal__body-inner--menu": "_modal__body-inner--menu_14reu_54",
|
|
11
|
+
"modal__body-inner--none": "_modal__body-inner--none_14reu_57"
|
|
10
12
|
};
|
|
11
13
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
e as default,
|
|
15
|
+
_ as modal,
|
|
16
|
+
o as modal__body
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=Modal.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Modal.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._modal-
|
|
1
|
+
._modal-header_1wwv5_2{display:flex;flex-direction:column;flex-shrink:0;border-bottom:1px solid rgba(var(--center-channel-color-rgb),.12)}._modal-header--no-divider_1wwv5_8{border-bottom:none}._modal-header--no-divider_1wwv5_8 ._modal-header__content_1wwv5_11,._modal-header--has-slot_1wwv5_14 ._modal-header__content_1wwv5_11{padding-bottom:0}._modal-header--close-only_1wwv5_17 ._modal-header__content_1wwv5_11{justify-content:flex-end}._modal-header__content_1wwv5_11{display:flex;align-items:flex-start;gap:10px;width:100%;padding:var(--spacing-xxl) var(--spacing-xxxl)}._modal-header__titles_1wwv5_27{display:flex;flex:1 1 auto;flex-direction:column;align-items:flex-start;gap:var(--spacing-m);min-width:0;padding:var(--spacing-xxxxs) 0}._modal-header__primary_1wwv5_36{display:flex;align-items:center;gap:var(--spacing-m);width:100%;min-height:var(--line-height-500)}._modal-header__title_1wwv5_27{flex:0 1 auto;min-width:0;margin:0;font-family:var(--font-family-heading);font-size:var(--font-size-500);font-weight:var(--font-weight-semibold);line-height:var(--line-height-500);color:var(--center-channel-color)}._modal-header__title-sr_1wwv5_53{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}._modal-header__subtitle_1wwv5_64{margin:0;font-family:var(--font-family-body);font-size:var(--font-size-75);font-weight:var(--font-weight-regular);line-height:var(--line-height-75);color:rgba(var(--center-channel-color-rgb),.72)}._modal-header__subtitle-beside_1wwv5_72{display:flex;flex-shrink:0;align-items:center;gap:var(--spacing-xs)}._modal-header__subtitle-beside_1wwv5_72 ._modal-header__subtitle_1wwv5_64{line-height:var(--line-height-200);white-space:nowrap}._modal-header__subtitle-divider_1wwv5_82{display:block;width:1px;height:var(--line-height-500);background-color:rgba(var(--center-channel-color-rgb),.16)}._modal-header__actions_1wwv5_88{display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;gap:7px;height:28px}._modal-header__close_1wwv5_96{margin-right:-12px;margin-top:-6px;margin-bottom:-6px}._modal-header__slot_1wwv5_101{padding:var(--spacing-l) var(--spacing-xxxl) var(--spacing-xxl)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./ModalHeader.css');const e={"modal-header":"_modal-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./ModalHeader.css');const e={"modal-header":"_modal-header_1wwv5_2","modal-header--no-divider":"_modal-header--no-divider_1wwv5_8","modal-header__content":"_modal-header__content_1wwv5_11","modal-header--has-slot":"_modal-header--has-slot_1wwv5_14","modal-header--close-only":"_modal-header--close-only_1wwv5_17","modal-header__titles":"_modal-header__titles_1wwv5_27","modal-header__primary":"_modal-header__primary_1wwv5_36","modal-header__title":"_modal-header__title_1wwv5_27","modal-header__title-sr":"_modal-header__title-sr_1wwv5_53","modal-header__subtitle":"_modal-header__subtitle_1wwv5_64","modal-header__subtitle-beside":"_modal-header__subtitle-beside_1wwv5_72","modal-header__subtitle-divider":"_modal-header__subtitle-divider_1wwv5_82","modal-header__actions":"_modal-header__actions_1wwv5_88","modal-header__close":"_modal-header__close_1wwv5_96","modal-header__slot":"_modal-header__slot_1wwv5_101"};exports.default=e;
|
|
2
2
|
//# sourceMappingURL=ModalHeader.module.scss.cjs.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import './ModalHeader.css';const e = {
|
|
2
|
-
"modal-header": "_modal-
|
|
3
|
-
"modal-header--no-divider": "_modal-header--no-
|
|
4
|
-
"modal-header__content": "_modal-
|
|
5
|
-
"modal-header--has-slot": "_modal-header--has-
|
|
6
|
-
"modal-header--close-only": "_modal-header--close-
|
|
7
|
-
"modal-header__titles": "_modal-
|
|
8
|
-
"modal-header__primary": "_modal-
|
|
9
|
-
"modal-header__title": "_modal-
|
|
10
|
-
"modal-header__title-sr": "_modal-header__title-
|
|
11
|
-
"modal-header__subtitle": "_modal-
|
|
12
|
-
"modal-header__subtitle-beside": "_modal-header__subtitle-
|
|
13
|
-
"modal-header__subtitle-divider": "_modal-header__subtitle-
|
|
14
|
-
"modal-header__actions": "_modal-
|
|
15
|
-
"modal-header__close": "_modal-
|
|
16
|
-
"modal-header__slot": "_modal-
|
|
2
|
+
"modal-header": "_modal-header_1wwv5_2",
|
|
3
|
+
"modal-header--no-divider": "_modal-header--no-divider_1wwv5_8",
|
|
4
|
+
"modal-header__content": "_modal-header__content_1wwv5_11",
|
|
5
|
+
"modal-header--has-slot": "_modal-header--has-slot_1wwv5_14",
|
|
6
|
+
"modal-header--close-only": "_modal-header--close-only_1wwv5_17",
|
|
7
|
+
"modal-header__titles": "_modal-header__titles_1wwv5_27",
|
|
8
|
+
"modal-header__primary": "_modal-header__primary_1wwv5_36",
|
|
9
|
+
"modal-header__title": "_modal-header__title_1wwv5_27",
|
|
10
|
+
"modal-header__title-sr": "_modal-header__title-sr_1wwv5_53",
|
|
11
|
+
"modal-header__subtitle": "_modal-header__subtitle_1wwv5_64",
|
|
12
|
+
"modal-header__subtitle-beside": "_modal-header__subtitle-beside_1wwv5_72",
|
|
13
|
+
"modal-header__subtitle-divider": "_modal-header__subtitle-divider_1wwv5_82",
|
|
14
|
+
"modal-header__actions": "_modal-header__actions_1wwv5_88",
|
|
15
|
+
"modal-header__close": "_modal-header__close_1wwv5_96",
|
|
16
|
+
"modal-header__slot": "_modal-header__slot_1wwv5_101"
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
19
|
e as default
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),p=require("../scrollbar/Scrollbar.cjs"),n=require("./PopoverMenu.module.scss.cjs");function
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),p=require("react"),M=require("../../hooks/use-popover-transition.cjs"),P=require("../scrollbar/Scrollbar.cjs"),n=require("./PopoverMenu.module.scss.cjs");function j({variant:e="parent",open:o,onExited:r,children:s,className:v="",...f}){const{mounted:t,visible:d}=M.usePopoverTransition(o??!0),l=o!==void 0,a=p.useRef(t),i=p.useRef(r);if(i.current=r,p.useEffect(()=>{var c;a.current&&!t&&l&&((c=i.current)==null||c.call(i)),a.current=t},[t,l]),l&&!t)return null;const m=[n.default["popover-menu"],e==="child"?n.default["popover-menu--child"]:n.default["popover-menu--parent"],l&&n.default["popover-menu--transition"],l&&d&&n.default["popover-menu--visible"],v].filter(Boolean).join(" ");return u.jsx("div",{className:m,...f,children:s})}function _({maxHeight:e,children:o,className:r=""}){const s=typeof e=="number"?`${e}px`:e;return u.jsx(P.default,{className:[n.default["popover-menu__scroll"],r].filter(Boolean).join(" "),style:{maxHeight:s},children:o})}function T({children:e,className:o="",...r}){return u.jsx("p",{className:[n.default["popover-menu__title"],o].filter(Boolean).join(" "),...r,children:e})}function b({children:e,className:o="",...r}){return u.jsx("div",{role:"group",className:[n.default["popover-menu__group"],o].filter(Boolean).join(" "),...r,children:e})}function x({children:e,className:o="",...r}){return u.jsx("p",{className:[n.default["popover-menu__group-title"],o].filter(Boolean).join(" "),...r,children:e})}function B({className:e="",...o}){return u.jsx("div",{className:[n.default["popover-menu__divider"],e].filter(Boolean).join(" "),role:"separator",...o})}exports.PopoverMenuDivider=B;exports.PopoverMenuGroup=b;exports.PopoverMenuGroupTitle=x;exports.PopoverMenuScroll=_;exports.PopoverMenuTitle=T;exports.default=j;
|
|
2
2
|
//# sourceMappingURL=PopoverMenu.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverMenu.cjs","sources":["../../../src/components/popover-menu/PopoverMenu.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\nimport Scrollbar from '@/components/scrollbar/Scrollbar';\nimport styles from './PopoverMenu.module.scss';\n\nexport interface PopoverMenuProps extends HTMLAttributes<HTMLDivElement> {\n /** Parent menus use Elevation 4; nested child menus use Elevation 5. */\n variant?: 'parent' | 'child';\n children: ReactNode;\n}\n\n/**\n * Surface container for popover-style menus — border, fill, elevation, and width\n * constraints per Compass. Compose with {@link MenuItem} rows and optional\n * titles, group labels, and dividers. Use {@link PopoverMenuScroll} when the item\n * list should scroll while a {@link PopoverMenuTitle} stays pinned.\n */\nexport default function PopoverMenu({\n variant = 'parent',\n children,\n className = '',\n ...rest\n}: PopoverMenuProps) {\n const rootClass = [\n styles['popover-menu'],\n variant === 'child'\n ? styles['popover-menu--child']\n : styles['popover-menu--parent'],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div className={rootClass} {...rest}>\n {children}\n </div>\n );\n}\n\nexport interface PopoverMenuScrollProps {\n children: ReactNode;\n /** Maximum height of the scrollable region (coerces numbers to px). */\n maxHeight: string | number;\n className?: string;\n}\n\n/** Scrollable region for long item lists; keeps a sibling title visible when used with `maxHeight`. */\nexport function PopoverMenuScroll({\n maxHeight,\n children,\n className = '',\n}: PopoverMenuScrollProps) {\n const maxH = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;\n return (\n <Scrollbar\n className={[styles['popover-menu__scroll'], className]\n .filter(Boolean)\n .join(' ')}\n style={{ maxHeight: maxH }}\n >\n {children}\n </Scrollbar>\n );\n}\n\nexport interface PopoverMenuTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n}\n\n/** Optional heading above menu items; keep pinned outside a scrolling body when using `maxHeight` on `PopoverMenu`. */\nexport function PopoverMenuTitle({\n children,\n className = '',\n ...rest\n}: PopoverMenuTitleProps) {\n return (\n <p\n className={[styles['popover-menu__title'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </p>\n );\n}\n\nexport interface PopoverMenuGroupProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Accessible label when the group has no visible `PopoverMenuGroupTitle`. */\n 'aria-label'?: string;\n}\n\n/** Groups related menu items. */\nexport function PopoverMenuGroup({\n children,\n className = '',\n ...rest\n}: PopoverMenuGroupProps) {\n return (\n <div\n role=\"group\"\n className={[styles['popover-menu__group'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\nexport interface PopoverMenuGroupTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n}\n\n/** Optional label for a `PopoverMenuGroup`. */\nexport function PopoverMenuGroupTitle({\n children,\n className = '',\n ...rest\n}: PopoverMenuGroupTitleProps) {\n return (\n <p\n className={[styles['popover-menu__group-title'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </p>\n );\n}\n\nexport type PopoverMenuDividerProps = HTMLAttributes<HTMLDivElement>;\n\n/** Horizontal rule between groups or below a menu title. */\nexport function PopoverMenuDivider({\n className = '',\n ...rest\n}: PopoverMenuDividerProps) {\n return (\n <div\n className={[styles['popover-menu__divider'], className]\n .filter(Boolean)\n .join(' ')}\n role=\"separator\"\n {...rest}\n />\n );\n}\n"],"names":["PopoverMenu","variant","children","className","rest","rootClass","styles","PopoverMenuScroll","maxHeight","maxH","jsx","Scrollbar","PopoverMenuTitle","PopoverMenuGroup","PopoverMenuGroupTitle","PopoverMenuDivider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PopoverMenu.cjs","sources":["../../../src/components/popover-menu/PopoverMenu.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { usePopoverTransition } from '@/hooks/use-popover-transition';\nimport Scrollbar from '@/components/scrollbar/Scrollbar';\nimport styles from './PopoverMenu.module.scss';\n\nexport interface PopoverMenuProps extends HTMLAttributes<HTMLDivElement> {\n /** Parent menus use Elevation 4; nested child menus use Elevation 5. */\n variant?: 'parent' | 'child';\n /**\n * Controlled visibility with the Compass popover transition (scale + fade in,\n * reverse on close); the menu unmounts after the exit. Omit to always render\n * without transition. The host owns the state and positioning.\n */\n open?: boolean;\n /** Called after the exit transition finishes and the menu unmounts (only when `open` is controlled). */\n onExited?: () => void;\n children: ReactNode;\n}\n\n/**\n * Surface container for popover-style menus — border, fill, elevation, and width\n * constraints per Compass. Compose with {@link MenuItem} rows and optional\n * titles, group labels, and dividers. Use {@link PopoverMenuScroll} when the item\n * list should scroll while a {@link PopoverMenuTitle} stays pinned.\n */\nexport default function PopoverMenu({\n variant = 'parent',\n open,\n onExited,\n children,\n className = '',\n ...rest\n}: PopoverMenuProps) {\n const { mounted, visible } = usePopoverTransition(open ?? true);\n const transitioned = open !== undefined;\n const wasMounted = useRef(mounted);\n const onExitedRef = useRef(onExited);\n onExitedRef.current = onExited;\n\n useEffect(() => {\n if (wasMounted.current && !mounted && transitioned) {\n onExitedRef.current?.();\n }\n wasMounted.current = mounted;\n }, [mounted, transitioned]);\n\n if (transitioned && !mounted) return null;\n\n const rootClass = [\n styles['popover-menu'],\n variant === 'child'\n ? styles['popover-menu--child']\n : styles['popover-menu--parent'],\n transitioned && styles['popover-menu--transition'],\n transitioned && visible && styles['popover-menu--visible'],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div className={rootClass} {...rest}>\n {children}\n </div>\n );\n}\n\nexport interface PopoverMenuScrollProps {\n children: ReactNode;\n /** Maximum height of the scrollable region (coerces numbers to px). */\n maxHeight: string | number;\n className?: string;\n}\n\n/** Scrollable region for long item lists; keeps a sibling title visible when used with `maxHeight`. */\nexport function PopoverMenuScroll({\n maxHeight,\n children,\n className = '',\n}: PopoverMenuScrollProps) {\n const maxH = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;\n return (\n <Scrollbar\n className={[styles['popover-menu__scroll'], className]\n .filter(Boolean)\n .join(' ')}\n style={{ maxHeight: maxH }}\n >\n {children}\n </Scrollbar>\n );\n}\n\nexport interface PopoverMenuTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n}\n\n/** Optional heading above menu items; keep pinned outside a scrolling body when using `maxHeight` on `PopoverMenu`. */\nexport function PopoverMenuTitle({\n children,\n className = '',\n ...rest\n}: PopoverMenuTitleProps) {\n return (\n <p\n className={[styles['popover-menu__title'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </p>\n );\n}\n\nexport interface PopoverMenuGroupProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Accessible label when the group has no visible `PopoverMenuGroupTitle`. */\n 'aria-label'?: string;\n}\n\n/** Groups related menu items. */\nexport function PopoverMenuGroup({\n children,\n className = '',\n ...rest\n}: PopoverMenuGroupProps) {\n return (\n <div\n role=\"group\"\n className={[styles['popover-menu__group'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\nexport interface PopoverMenuGroupTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n}\n\n/** Optional label for a `PopoverMenuGroup`. */\nexport function PopoverMenuGroupTitle({\n children,\n className = '',\n ...rest\n}: PopoverMenuGroupTitleProps) {\n return (\n <p\n className={[styles['popover-menu__group-title'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </p>\n );\n}\n\nexport type PopoverMenuDividerProps = HTMLAttributes<HTMLDivElement>;\n\n/** Horizontal rule between groups or below a menu title. */\nexport function PopoverMenuDivider({\n className = '',\n ...rest\n}: PopoverMenuDividerProps) {\n return (\n <div\n className={[styles['popover-menu__divider'], className]\n .filter(Boolean)\n .join(' ')}\n role=\"separator\"\n {...rest}\n />\n );\n}\n"],"names":["PopoverMenu","variant","open","onExited","children","className","rest","mounted","visible","usePopoverTransition","transitioned","wasMounted","useRef","onExitedRef","useEffect","_a","rootClass","styles","PopoverMenuScroll","maxHeight","maxH","jsx","Scrollbar","PopoverMenuTitle","PopoverMenuGroup","PopoverMenuGroupTitle","PopoverMenuDivider"],"mappings":"ySA0BA,SAAwBA,EAAY,CAClC,QAAAC,EAAU,SACV,KAAAC,EACA,SAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,GACZ,GAAGC,CACL,EAAqB,CACnB,KAAM,CAAE,QAAAC,EAAS,QAAAC,CAAA,EAAYC,EAAAA,qBAAqBP,GAAQ,EAAI,EACxDQ,EAAeR,IAAS,OACxBS,EAAaC,EAAAA,OAAOL,CAAO,EAC3BM,EAAcD,EAAAA,OAAOT,CAAQ,EAUnC,GATAU,EAAY,QAAUV,EAEtBW,EAAAA,UAAU,IAAM,OACVH,EAAW,SAAW,CAACJ,GAAWG,KACpCK,EAAAF,EAAY,UAAZ,MAAAE,EAAA,KAAAF,IAEFF,EAAW,QAAUJ,CACvB,EAAG,CAACA,EAASG,CAAY,CAAC,EAEtBA,GAAgB,CAACH,EAAS,OAAO,KAErC,MAAMS,EAAY,CAChBC,EAAAA,QAAO,cAAc,EACrBhB,IAAY,QACRgB,EAAAA,QAAO,qBAAqB,EAC5BA,EAAAA,QAAO,sBAAsB,EACjCP,GAAgBO,EAAAA,QAAO,0BAA0B,EACjDP,GAAgBF,GAAWS,EAAAA,QAAO,uBAAuB,EACzDZ,CAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG,EAEX,aACG,MAAA,CAAI,UAAWW,EAAY,GAAGV,EAC5B,SAAAF,EACH,CAEJ,CAUO,SAASc,EAAkB,CAChC,UAAAC,EACA,SAAAf,EACA,UAAAC,EAAY,EACd,EAA2B,CACzB,MAAMe,EAAO,OAAOD,GAAc,SAAW,GAAGA,CAAS,KAAOA,EAChE,OACEE,EAAAA,IAACC,EAAAA,QAAA,CACC,UAAW,CAACL,UAAO,sBAAsB,EAAGZ,CAAS,EAClD,OAAO,OAAO,EACd,KAAK,GAAG,EACX,MAAO,CAAE,UAAWe,CAAA,EAEnB,SAAAhB,CAAA,CAAA,CAGP,CAOO,SAASmB,EAAiB,CAC/B,SAAAnB,EACA,UAAAC,EAAY,GACZ,GAAGC,CACL,EAA0B,CACxB,OACEe,EAAAA,IAAC,IAAA,CACC,UAAW,CAACJ,UAAO,qBAAqB,EAAGZ,CAAS,EACjD,OAAO,OAAO,EACd,KAAK,GAAG,EACV,GAAGC,EAEH,SAAAF,CAAA,CAAA,CAGP,CASO,SAASoB,EAAiB,CAC/B,SAAApB,EACA,UAAAC,EAAY,GACZ,GAAGC,CACL,EAA0B,CACxB,OACEe,EAAAA,IAAC,MAAA,CACC,KAAK,QACL,UAAW,CAACJ,UAAO,qBAAqB,EAAGZ,CAAS,EACjD,OAAO,OAAO,EACd,KAAK,GAAG,EACV,GAAGC,EAEH,SAAAF,CAAA,CAAA,CAGP,CAOO,SAASqB,EAAsB,CACpC,SAAArB,EACA,UAAAC,EAAY,GACZ,GAAGC,CACL,EAA+B,CAC7B,OACEe,EAAAA,IAAC,IAAA,CACC,UAAW,CAACJ,UAAO,2BAA2B,EAAGZ,CAAS,EACvD,OAAO,OAAO,EACd,KAAK,GAAG,EACV,GAAGC,EAEH,SAAAF,CAAA,CAAA,CAGP,CAKO,SAASsB,EAAmB,CACjC,UAAArB,EAAY,GACZ,GAAGC,CACL,EAA4B,CAC1B,OACEe,EAAAA,IAAC,MAAA,CACC,UAAW,CAACJ,UAAO,uBAAuB,EAAGZ,CAAS,EACnD,OAAO,OAAO,EACd,KAAK,GAAG,EACX,KAAK,YACJ,GAAGC,CAAA,CAAA,CAGV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._popover-
|
|
1
|
+
._popover-menu_1tx2s_2{display:flex;flex-direction:column;align-items:stretch;box-sizing:border-box;min-width:212px;max-width:496px;width:max-content;padding:var(--spacing-xs) 0;background-color:var(--center-channel-bg);border:1px solid rgba(var(--center-channel-color-rgb),.16);border-radius:var(--radius-s);color:var(--center-channel-color)}._popover-menu--parent_1tx2s_16{box-shadow:var(--elevation-4)}._popover-menu--child_1tx2s_19{box-shadow:var(--elevation-5)}._popover-menu--transition_1tx2s_22{opacity:0;transform:scale(.9);transform-origin:top left;pointer-events:none;transition:opacity var(--duration-quick) var(--ease-exit),transform var(--duration-quick) var(--ease-exit)}@media(prefers-reduced-motion:reduce){._popover-menu--transition_1tx2s_22{transform:none;transition:none}}._popover-menu--visible_1tx2s_35{opacity:1;transform:scale(1);pointer-events:auto;transition:opacity var(--duration-quick) var(--ease-entrance),transform var(--duration-quick) var(--ease-entrance)}@media(prefers-reduced-motion:reduce){._popover-menu--visible_1tx2s_35{transform:none;transition:none}}._popover-menu__scroll_1tx2s_47{min-height:0}._popover-menu__title_1tx2s_50{flex-shrink:0;margin:0;padding:var(--spacing-xxs) var(--spacing-l) var(--spacing-xs);font-family:var(--font-family-body);font-size:var(--font-size-75);font-weight:var(--font-weight-semibold);line-height:var(--line-height-75);letter-spacing:var(--letter-spacing-normal);color:rgba(var(--center-channel-color-rgb),.75)}._popover-menu__group_1tx2s_61{display:flex;flex-direction:column;align-items:stretch}._popover-menu__group-title_1tx2s_66{flex-shrink:0;margin:0;padding:var(--spacing-xxs) var(--spacing-l) var(--spacing-xxs);font-family:var(--font-family-body);font-size:var(--font-size-50);font-weight:var(--font-weight-semibold);line-height:var(--line-height-50);letter-spacing:.11px;text-transform:uppercase;color:rgba(var(--center-channel-color-rgb),.64)}._popover-menu__divider_1tx2s_78{flex-shrink:0;width:100%;padding:var(--spacing-xs) 0}._popover-menu__divider_1tx2s_78:before{content:"";display:block;width:100%;border-top:1px solid rgba(var(--center-channel-color-rgb),.12)}
|
|
@@ -2,6 +2,14 @@ import { HTMLAttributes, ReactNode } from 'react';
|
|
|
2
2
|
export interface PopoverMenuProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
/** Parent menus use Elevation 4; nested child menus use Elevation 5. */
|
|
4
4
|
variant?: 'parent' | 'child';
|
|
5
|
+
/**
|
|
6
|
+
* Controlled visibility with the Compass popover transition (scale + fade in,
|
|
7
|
+
* reverse on close); the menu unmounts after the exit. Omit to always render
|
|
8
|
+
* without transition. The host owns the state and positioning.
|
|
9
|
+
*/
|
|
10
|
+
open?: boolean;
|
|
11
|
+
/** Called after the exit transition finishes and the menu unmounts (only when `open` is controlled). */
|
|
12
|
+
onExited?: () => void;
|
|
5
13
|
children: ReactNode;
|
|
6
14
|
}
|
|
7
15
|
/**
|
|
@@ -10,7 +18,7 @@ export interface PopoverMenuProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
10
18
|
* titles, group labels, and dividers. Use {@link PopoverMenuScroll} when the item
|
|
11
19
|
* list should scroll while a {@link PopoverMenuTitle} stays pinned.
|
|
12
20
|
*/
|
|
13
|
-
export default function PopoverMenu({ variant, children, className, ...rest }: PopoverMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default function PopoverMenu({ variant, open, onExited, children, className, ...rest }: PopoverMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
14
22
|
export interface PopoverMenuScrollProps {
|
|
15
23
|
children: ReactNode;
|
|
16
24
|
/** Maximum height of the scrollable region (coerces numbers to px). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverMenu.d.ts","sourceRoot":"","sources":["../../../src/components/popover-menu/PopoverMenu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PopoverMenu.d.ts","sourceRoot":"","sources":["../../../src/components/popover-menu/PopoverMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvD,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACtE,wEAAwE;IACxE,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC7B;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,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