@cratis/components 4.46.0 → 4.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compat-manifest.json +13 -13
- package/dist/esm/Dialogs/DialogDocument.d.ts +3 -1
- package/dist/esm/Dialogs/DialogDocument.d.ts.map +1 -1
- package/dist/esm/Dialogs/DialogDocument.js +6 -2
- package/dist/esm/Dialogs/DialogDocument.js.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.js +2 -1
- package/dist/esm/Dialogs/DialogImplementation.js.map +1 -1
- package/dist/esm/renderer/DialogStackContext.d.ts +15 -0
- package/dist/esm/renderer/DialogStackContext.d.ts.map +1 -1
- package/dist/esm/renderer/DialogStackContext.js +2 -1
- package/dist/esm/renderer/DialogStackContext.js.map +1 -1
- package/dist/esm/renderer/index.d.ts +1 -0
- package/dist/esm/renderer/index.d.ts.map +1 -1
- package/dist/esm/renderer/index.js +1 -0
- package/dist/esm/renderer/index.js.map +1 -1
- package/dist/esm/renderer/useOverlayHost.d.ts +15 -0
- package/dist/esm/renderer/useOverlayHost.d.ts.map +1 -0
- package/dist/esm/renderer/useOverlayHost.js +23 -0
- package/dist/esm/renderer/useOverlayHost.js.map +1 -0
- package/package.json +1 -1
package/compat-manifest.json
CHANGED
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
{
|
|
71
71
|
"name": "@cratis/components",
|
|
72
72
|
"role": "core",
|
|
73
|
-
"version": "4.
|
|
73
|
+
"version": "4.47.0",
|
|
74
74
|
"releaseMajorRange": ">=4 <5",
|
|
75
75
|
"independentRelease": false,
|
|
76
76
|
"private": false,
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
{
|
|
95
95
|
"name": "@cratis/eslint-plugin-components",
|
|
96
96
|
"role": "eslint",
|
|
97
|
-
"version": "4.
|
|
97
|
+
"version": "4.47.0",
|
|
98
98
|
"releaseMajorRange": ">=4 <5",
|
|
99
99
|
"independentRelease": false,
|
|
100
100
|
"private": false,
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
{
|
|
108
108
|
"name": "@cratis/components.migrator",
|
|
109
109
|
"role": "migrator",
|
|
110
|
-
"version": "4.
|
|
110
|
+
"version": "4.47.0",
|
|
111
111
|
"releaseMajorRange": ">=4 <5",
|
|
112
112
|
"independentRelease": false,
|
|
113
113
|
"private": false,
|
|
@@ -118,13 +118,13 @@
|
|
|
118
118
|
{
|
|
119
119
|
"name": "@cratis/components.conformance",
|
|
120
120
|
"role": "conformance",
|
|
121
|
-
"version": "4.
|
|
121
|
+
"version": "4.47.0",
|
|
122
122
|
"releaseMajorRange": ">=4 <5",
|
|
123
123
|
"independentRelease": false,
|
|
124
124
|
"private": false,
|
|
125
125
|
"packageAccess": "public",
|
|
126
126
|
"peerDependencies": {
|
|
127
|
-
"@cratis/components": "4.
|
|
127
|
+
"@cratis/components": "4.47.0",
|
|
128
128
|
"react": "^19.0.0",
|
|
129
129
|
"react-dom": "^19.0.0"
|
|
130
130
|
},
|
|
@@ -134,13 +134,13 @@
|
|
|
134
134
|
{
|
|
135
135
|
"name": "@cratis/components.mui",
|
|
136
136
|
"role": "renderer-adapter",
|
|
137
|
-
"version": "4.
|
|
137
|
+
"version": "4.47.0",
|
|
138
138
|
"releaseMajorRange": ">=4 <5",
|
|
139
139
|
"independentRelease": false,
|
|
140
140
|
"private": false,
|
|
141
141
|
"packageAccess": "public",
|
|
142
142
|
"peerDependencies": {
|
|
143
|
-
"@cratis/components": "4.
|
|
143
|
+
"@cratis/components": "4.47.0",
|
|
144
144
|
"@emotion/react": ">=11.5 <12",
|
|
145
145
|
"@emotion/styled": ">=11.11 <12",
|
|
146
146
|
"@mui/material": ">=9 <10",
|
|
@@ -190,13 +190,13 @@
|
|
|
190
190
|
{
|
|
191
191
|
"name": "@cratis/components.primereact",
|
|
192
192
|
"role": "renderer-adapter",
|
|
193
|
-
"version": "4.
|
|
193
|
+
"version": "4.47.0",
|
|
194
194
|
"releaseMajorRange": ">=4 <5",
|
|
195
195
|
"independentRelease": false,
|
|
196
196
|
"private": false,
|
|
197
197
|
"packageAccess": "public",
|
|
198
198
|
"peerDependencies": {
|
|
199
|
-
"@cratis/components": "4.
|
|
199
|
+
"@cratis/components": "4.47.0",
|
|
200
200
|
"@primereact/core": ">=11 <12",
|
|
201
201
|
"@primereact/ui": ">=11 <12",
|
|
202
202
|
"@primeuix/themes": ">=3 <4",
|
|
@@ -258,13 +258,13 @@
|
|
|
258
258
|
{
|
|
259
259
|
"name": "@cratis/components.primereact10",
|
|
260
260
|
"role": "renderer-adapter",
|
|
261
|
-
"version": "4.
|
|
261
|
+
"version": "4.47.0",
|
|
262
262
|
"releaseMajorRange": ">=4 <5",
|
|
263
263
|
"independentRelease": false,
|
|
264
264
|
"private": false,
|
|
265
265
|
"packageAccess": "public",
|
|
266
266
|
"peerDependencies": {
|
|
267
|
-
"@cratis/components": "4.
|
|
267
|
+
"@cratis/components": "4.47.0",
|
|
268
268
|
"primereact": ">=10.9.9 <11",
|
|
269
269
|
"react": "^19.0.0",
|
|
270
270
|
"react-dom": "^19.0.0"
|
|
@@ -306,13 +306,13 @@
|
|
|
306
306
|
{
|
|
307
307
|
"name": "@cratis/components.designsystemet",
|
|
308
308
|
"role": "renderer-adapter",
|
|
309
|
-
"version": "4.
|
|
309
|
+
"version": "4.47.0",
|
|
310
310
|
"releaseMajorRange": ">=4 <5",
|
|
311
311
|
"independentRelease": false,
|
|
312
312
|
"private": false,
|
|
313
313
|
"packageAccess": "public",
|
|
314
314
|
"peerDependencies": {
|
|
315
|
-
"@cratis/components": "4.
|
|
315
|
+
"@cratis/components": "4.47.0",
|
|
316
316
|
"@digdir/designsystemet-css": ">=1.24 <2",
|
|
317
317
|
"@digdir/designsystemet-react": ">=1.24 <2",
|
|
318
318
|
"react": "^19.0.0",
|
|
@@ -11,12 +11,14 @@ export interface DialogDocumentProps {
|
|
|
11
11
|
/** The footer, or null when the dialog has no footer. */
|
|
12
12
|
footer: DialogFooterProps | null;
|
|
13
13
|
stackZIndex: string;
|
|
14
|
+
/** Identity of this dialog instance, published to descendants as their overlay host. */
|
|
15
|
+
hostId: string;
|
|
14
16
|
visible: boolean;
|
|
15
17
|
contentStyle: React.CSSProperties | undefined;
|
|
16
18
|
announcement: Announcement | null;
|
|
17
19
|
children: React.ReactNode;
|
|
18
20
|
}
|
|
19
21
|
/** The accessible dialog document: header, content, footer and the status live region. */
|
|
20
|
-
export declare const DialogDocument: ({ header, footer, stackZIndex, visible, contentStyle, announcement, children, }: DialogDocumentProps) => React.JSX.Element;
|
|
22
|
+
export declare const DialogDocument: ({ header, footer, stackZIndex, hostId, visible, contentStyle, announcement, children, }: DialogDocumentProps) => React.JSX.Element;
|
|
21
23
|
export {};
|
|
22
24
|
//# sourceMappingURL=DialogDocument.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogDocument.d.ts","sourceRoot":"","sources":["../../../Dialogs/DialogDocument.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DialogDocument.d.ts","sourceRoot":"","sources":["../../../Dialogs/DialogDocument.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,mBAAgB,CAAC;AACtE,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,mBAAgB,CAAC;AAgBtE,UAAU,YAAY;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CAChB;AA4CD,oCAAoC;AACpC,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,yDAAyD;IACzD,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;IAC9C,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,0FAA0F;AAC1F,eAAO,MAAM,cAAc,4FASxB,mBAAmB,sBAqBrB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { Dialog } from 'react-aria-components/Dialog';
|
|
3
|
+
import { useMemo } from 'react';
|
|
3
4
|
import { classNames } from '../ClassNames/classNames.js';
|
|
4
|
-
import { DialogStackContext } from '../renderer/DialogStackContext.js';
|
|
5
|
+
import { DialogStackContext, OverlayHostContext } from '../renderer/DialogStackContext.js';
|
|
5
6
|
import { DialogFooter } from './DialogFooter.js';
|
|
6
7
|
import { DialogHeader } from './DialogHeader.js';
|
|
7
8
|
|
|
@@ -18,7 +19,10 @@ const visuallyHidden = {
|
|
|
18
19
|
};
|
|
19
20
|
const DialogContent = ({ visible, isBusy, contentStyle, pt, children }) => (jsx("div", { ...pt?.content, className: classNames('cratis-dialog__content', pt?.content?.className), style: { ...pt?.content?.style, ...contentStyle }, "data-cratis-part": 'content', "data-open": visible || undefined, "data-busy": isBusy || undefined, children: jsx("fieldset", { className: 'cratis-dialog__busy-scope', "data-cratis-part": 'busy-scope', "data-busy": isBusy || undefined, disabled: isBusy, inert: isBusy, "aria-busy": isBusy || undefined, children: children }) }));
|
|
20
21
|
const LiveRegion = ({ announcement }) => (jsx("div", { className: 'cratis-dialog__live-region', style: visuallyHidden, role: 'status', "aria-live": 'polite', "aria-atomic": 'true', children: announcement && jsx("span", { children: announcement.text }, announcement.key) }));
|
|
21
|
-
const DialogDocument = ({ header, footer, stackZIndex, visible, contentStyle, announcement, children, }) =>
|
|
22
|
+
const DialogDocument = ({ header, footer, stackZIndex, hostId, visible, contentStyle, announcement, children, }) => {
|
|
23
|
+
const host = useMemo(() => ({ id: hostId, open: visible, stackZIndex }), [hostId, visible, stackZIndex]);
|
|
24
|
+
return (jsx(DialogStackContext.Provider, { value: stackZIndex, children: jsx(OverlayHostContext.Provider, { value: host, children: jsx(Dialog, { className: 'cratis-dialog__document', "aria-describedby": header.hasSubtitle ? header.subtitleId : undefined, children: jsxs(Fragment, { children: [jsx(DialogHeader, { ...header }), jsx(DialogContent, { visible: visible, isBusy: header.isBusy, contentStyle: contentStyle, pt: header.pt, children: children }), footer && jsx(DialogFooter, { ...footer }), jsx(LiveRegion, { announcement: announcement })] }) }) }) }));
|
|
25
|
+
};
|
|
22
26
|
|
|
23
27
|
export { DialogDocument };
|
|
24
28
|
//# sourceMappingURL=DialogDocument.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogDocument.js","sources":["../../../Dialogs/DialogDocument.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Dialog as AriaDialog } from 'react-aria-components/Dialog';\nimport type React from 'react';\nimport { classNames } from '../ClassNames/classNames';\nimport { DialogStackContext } from '../renderer/DialogStackContext';\nimport { DialogFooter, type DialogFooterProps } from './DialogFooter';\nimport { DialogHeader, type DialogHeaderProps } from './DialogHeader';\nimport type { DialogParts } from './Dialog';\n\n// Inline rather than in Dialog.css: the packed aggregate stylesheet has a reviewed size budget.\nconst visuallyHidden: React.CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n margin: -1,\n padding: 0,\n overflow: 'hidden',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n border: 0,\n};\n\ninterface Announcement {\n key: number;\n text: string;\n}\n\ninterface DialogContentProps {\n visible: boolean;\n isBusy: boolean;\n contentStyle: React.CSSProperties | undefined;\n pt: DialogParts | undefined;\n children: React.ReactNode;\n}\n\nconst DialogContent = ({ visible, isBusy, contentStyle, pt, children }: DialogContentProps) => (\n <div\n {...pt?.content}\n className={classNames('cratis-dialog__content', pt?.content?.className)}\n style={{ ...pt?.content?.style, ...contentStyle }}\n data-cratis-part='content'\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <fieldset\n className='cratis-dialog__busy-scope'\n data-cratis-part='busy-scope'\n data-busy={isBusy || undefined}\n disabled={isBusy}\n inert={isBusy}\n aria-busy={isBusy || undefined}\n >\n {children}\n </fieldset>\n </div>\n);\n\nconst LiveRegion = ({ announcement }: { announcement: Announcement | null }) => (\n <div\n className='cratis-dialog__live-region'\n style={visuallyHidden}\n role='status'\n aria-live='polite'\n aria-atomic='true'\n >\n {announcement && <span key={announcement.key}>{announcement.text}</span>}\n </div>\n);\n\n/** Props of the dialog document. */\nexport interface DialogDocumentProps {\n header: DialogHeaderProps;\n /** The footer, or null when the dialog has no footer. */\n footer: DialogFooterProps | null;\n stackZIndex: string;\n visible: boolean;\n contentStyle: React.CSSProperties | undefined;\n announcement: Announcement | null;\n children: React.ReactNode;\n}\n\n/** The accessible dialog document: header, content, footer and the status live region. */\nexport const DialogDocument = ({\n header,\n footer,\n stackZIndex,\n visible,\n contentStyle,\n announcement,\n children,\n}: DialogDocumentProps) => (\n
|
|
1
|
+
{"version":3,"file":"DialogDocument.js","sources":["../../../Dialogs/DialogDocument.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Dialog as AriaDialog } from 'react-aria-components/Dialog';\nimport { useMemo } from 'react';\nimport type React from 'react';\nimport { classNames } from '../ClassNames/classNames';\nimport { DialogStackContext, OverlayHostContext } from '../renderer/DialogStackContext';\nimport { DialogFooter, type DialogFooterProps } from './DialogFooter';\nimport { DialogHeader, type DialogHeaderProps } from './DialogHeader';\nimport type { DialogParts } from './Dialog';\n\n// Inline rather than in Dialog.css: the packed aggregate stylesheet has a reviewed size budget.\nconst visuallyHidden: React.CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n margin: -1,\n padding: 0,\n overflow: 'hidden',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n border: 0,\n};\n\ninterface Announcement {\n key: number;\n text: string;\n}\n\ninterface DialogContentProps {\n visible: boolean;\n isBusy: boolean;\n contentStyle: React.CSSProperties | undefined;\n pt: DialogParts | undefined;\n children: React.ReactNode;\n}\n\nconst DialogContent = ({ visible, isBusy, contentStyle, pt, children }: DialogContentProps) => (\n <div\n {...pt?.content}\n className={classNames('cratis-dialog__content', pt?.content?.className)}\n style={{ ...pt?.content?.style, ...contentStyle }}\n data-cratis-part='content'\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <fieldset\n className='cratis-dialog__busy-scope'\n data-cratis-part='busy-scope'\n data-busy={isBusy || undefined}\n disabled={isBusy}\n inert={isBusy}\n aria-busy={isBusy || undefined}\n >\n {children}\n </fieldset>\n </div>\n);\n\nconst LiveRegion = ({ announcement }: { announcement: Announcement | null }) => (\n <div\n className='cratis-dialog__live-region'\n style={visuallyHidden}\n role='status'\n aria-live='polite'\n aria-atomic='true'\n >\n {announcement && <span key={announcement.key}>{announcement.text}</span>}\n </div>\n);\n\n/** Props of the dialog document. */\nexport interface DialogDocumentProps {\n header: DialogHeaderProps;\n /** The footer, or null when the dialog has no footer. */\n footer: DialogFooterProps | null;\n stackZIndex: string;\n /** Identity of this dialog instance, published to descendants as their overlay host. */\n hostId: string;\n visible: boolean;\n contentStyle: React.CSSProperties | undefined;\n announcement: Announcement | null;\n children: React.ReactNode;\n}\n\n/** The accessible dialog document: header, content, footer and the status live region. */\nexport const DialogDocument = ({\n header,\n footer,\n stackZIndex,\n hostId,\n visible,\n contentStyle,\n announcement,\n children,\n}: DialogDocumentProps) => {\n const host = useMemo(() => ({ id: hostId, open: visible, stackZIndex }), [hostId, visible, stackZIndex]);\n return (\n <DialogStackContext.Provider value={stackZIndex}>\n <OverlayHostContext.Provider value={host}>\n <AriaDialog\n className='cratis-dialog__document'\n aria-describedby={header.hasSubtitle ? header.subtitleId : undefined}\n >\n <>\n <DialogHeader {...header} />\n <DialogContent visible={visible} isBusy={header.isBusy} contentStyle={contentStyle} pt={header.pt}>\n {children}\n </DialogContent>\n {footer && <DialogFooter {...footer} />}\n <LiveRegion announcement={announcement} />\n </>\n </AriaDialog>\n </OverlayHostContext.Provider>\n </DialogStackContext.Provider>\n );\n};\n"],"names":["_jsx","AriaDialog","_jsxs"],"mappings":";;;;;;;;AAaA,MAAM,cAAc,GAAwB;AACxC,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,EAAE;AACV,IAAA,OAAO,EAAE,CAAC;AACV,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,QAAQ,EAAE,YAAY;AACtB,IAAA,UAAU,EAAE,QAAQ;AACpB,IAAA,MAAM,EAAE,CAAC;CACZ;AAeD,MAAM,aAAa,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAsB,MACtFA,GAAA,CAAA,KAAA,EAAA,EAAA,GACQ,EAAE,EAAE,OAAO,EACf,SAAS,EAAE,UAAU,CAAC,wBAAwB,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,EACvE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,EAAA,kBAAA,EAChC,SAAS,eACf,OAAO,IAAI,SAAS,EAAA,WAAA,EACpB,MAAM,IAAI,SAAS,EAAA,QAAA,EAE9BA,kBACI,SAAS,EAAC,2BAA2B,EAAA,kBAAA,EACpB,YAAY,EAAA,WAAA,EAClB,MAAM,IAAI,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EAAA,WAAA,EACF,MAAM,IAAI,SAAS,EAAA,QAAA,EAE7B,QAAQ,EAAA,CACF,EAAA,CACT,CACT;AAED,MAAM,UAAU,GAAG,CAAC,EAAE,YAA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AAE,YAAY,EAAA,CAAI,IAC3C,EAAA,CACM,EAAA,CACa,EAAA,CACJ;AAEtC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogImplementation.d.ts","sourceRoot":"","sources":["../../../Dialogs/DialogImplementation.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAU,CAAC;AAuC5C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,kBAAmB,WAAW,
|
|
1
|
+
{"version":3,"file":"DialogImplementation.d.ts","sourceRoot":"","sources":["../../../Dialogs/DialogImplementation.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAU,CAAC;AAuC5C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,kBAAmB,WAAW,gCA4H9D,CAAC"}
|
|
@@ -41,6 +41,7 @@ const DialogImplementation = (incomingProps) => {
|
|
|
41
41
|
const { messages, dialogHeaderActions } = useCratisComponentsConfig();
|
|
42
42
|
const dialogId = useId();
|
|
43
43
|
const subtitleId = useId();
|
|
44
|
+
const hostId = useId();
|
|
44
45
|
const labels = resolveDialogLabels(props, messages?.dialog);
|
|
45
46
|
const icon = useCratisIcon();
|
|
46
47
|
const isBrowser = useIsBrowser();
|
|
@@ -61,7 +62,7 @@ const DialogImplementation = (incomingProps) => {
|
|
|
61
62
|
refusedMessage: labels.refused,
|
|
62
63
|
});
|
|
63
64
|
const handleClose = useDialogClose(props, onRefused);
|
|
64
|
-
const dialogDocument = (jsx(DialogDocument, { stackZIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN, visible: visible, contentStyle: props.contentStyle, announcement: announcement, header: {
|
|
65
|
+
const dialogDocument = (jsx(DialogDocument, { stackZIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN, hostId: hostId, visible: visible, contentStyle: props.contentStyle, announcement: announcement, header: {
|
|
65
66
|
dialogId,
|
|
66
67
|
title,
|
|
67
68
|
subtitle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogImplementation.js","sources":["../../../Dialogs/DialogImplementation.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogResult, DialogButtons } from '@cratis/arc.react/dialogs';\nimport { useId, useSyncExternalStore } from 'react';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { DialogInitialFocus } from './DialogInitialFocus';\nimport type { DialogProps } from './Dialog';\nimport { resolveDialogDismissal } from './resolveDialogDismissal';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport { DIALOG_ZINDEX_TOKEN } from '../renderer/dialogStack';\nimport { useComponentPresentation } from '../configuration/identity/useComponentPresentation';\nimport { dialogDescriptor } from './dialogDescriptor';\nimport { DialogDocument } from './DialogDocument';\nimport { DialogModalShell, DialogServerShell } from './DialogShells';\nimport { resolveDialogLabels } from './resolveDialogLabels';\nimport { useDialogClose } from './useDialogClose';\nimport { useDialogFocus } from './useDialogFocus';\nimport { useDialogZIndex } from './useDialogZIndex';\n\nconst subscribeToBrowserEnvironment = () => () => undefined;\nconst useIsBrowser = () =>\n useSyncExternalStore(\n subscribeToBrowserEnvironment,\n () => true,\n () => false,\n );\n\n// A cancel-focused dialog without a dismissing button falls back to focusing the content.\nconst resolveInitialFocus = (initialFocus: DialogInitialFocus, buttons: DialogProps['buttons']) => {\n const hasDismissingButton = typeof buttons === 'number' && buttons !== DialogButtons.Ok;\n return initialFocus === DialogInitialFocus.Cancel && !hasDismissingButton ? DialogInitialFocus.Content : initialFocus;\n};\n\nconst dismissalFor = (props: DialogProps, isBusy: boolean) =>\n resolveDialogDismissal({\n // An explicit null (no footer) must stay null; only an omitted set defaults.\n buttons: props.buttons === undefined ? DialogButtons.OkCancel : props.buttons,\n dismissable: props.dismissable,\n dismissOnOutsideClick: props.dismissOnOutsideClick,\n closeOnEscape: props.closeOnEscape,\n showCloseButton: props.showCloseButton,\n isBusy,\n });\n\n/**\n * A modal dialog with Arc host integration, typed footer actions, busy/validity\n * state, controlled dismissal, and stable Cratis-owned styling parts.\n */\nexport const DialogImplementation = (incomingProps: DialogProps) => {\n const [props, marker] = useComponentPresentation(dialogDescriptor, incomingProps);\n const {\n title,\n subtitle,\n placement = 'center',\n closeIcon,\n headerActions,\n hideGlobalHeaderActions = false,\n sliceLocation,\n isCommandDialog = false,\n visible = true,\n buttons = DialogButtons.OkCancel,\n initialFocus = DialogInitialFocus.Confirm,\n children,\n width = '450px',\n isValid,\n isBusy = false,\n pt,\n } = props;\n const { messages, dialogHeaderActions } = useCratisComponentsConfig();\n const dialogId = useId();\n const subtitleId = useId();\n const labels = resolveDialogLabels(props, messages?.dialog);\n const icon = useCratisIcon();\n const isBrowser = useIsBrowser();\n const overlayEnvironment = unstable_useOverlayEnvironment();\n\n const hasHeaderActions =\n headerActions != null || (dialogHeaderActions !== undefined && !hideGlobalHeaderActions);\n const hasSubtitle = subtitle !== undefined && subtitle !== null && subtitle !== false;\n const resolvedInitialFocus = resolveInitialFocus(initialFocus, buttons);\n const focus = {\n confirm: resolvedInitialFocus === DialogInitialFocus.Confirm,\n dismissing: resolvedInitialFocus === DialogInitialFocus.Cancel,\n };\n const { allowsOutsideDismissal, allowsEscapeDismissal, showsCloseButton } = dismissalFor(props, isBusy);\n\n const resolvedZIndex = useDialogZIndex(visible);\n const { titleRef, confirmRef, cancelRef, announcement, onRefused } = useDialogFocus({\n visible,\n isBusy,\n initialFocus: resolvedInitialFocus,\n refusedMessage: labels.refused,\n });\n const handleClose = useDialogClose(props, onRefused);\n\n const dialogDocument = (\n <DialogDocument\n stackZIndex={resolvedZIndex ?? DIALOG_ZINDEX_TOKEN}\n visible={visible}\n contentStyle={props.contentStyle}\n announcement={announcement}\n header={{\n dialogId,\n title,\n subtitle,\n subtitleId,\n hasSubtitle,\n hasHeaderActions,\n headerActions,\n globalHeaderActions: dialogHeaderActions,\n hideGlobalHeaderActions,\n isCommandDialog,\n sliceLocation,\n showsCloseButton,\n focusesTitle: resolvedInitialFocus === DialogInitialFocus.Content,\n titleRef,\n isBusy,\n closeAriaLabel: labels.closeAria,\n closeIcon: icon('close', '×', closeIcon),\n onClose: () => void handleClose(DialogResult.Cancelled),\n pt,\n }}\n footer={\n buttons === null\n ? null\n : {\n buttons,\n labels,\n focus,\n isBusy,\n isValid: isValid !== false,\n pt,\n confirmRef,\n cancelRef,\n onResult: (result) => void handleClose(result),\n }\n }\n >\n {children}\n </DialogDocument>\n );\n\n const shell = {\n placement,\n visible,\n isBusy,\n zIndex: resolvedZIndex,\n width,\n style: props.style,\n className: props.className,\n dialogId,\n marker,\n pt,\n children: dialogDocument,\n };\n\n // useSyncExternalStore supplies the server snapshot during hydration, so this\n // fallback is identical on the server and on the client's first render. React\n // switches to the portaled React Aria modal only after hydration completes.\n if (!isBrowser) return <DialogServerShell {...shell} />;\n\n return (\n <DialogModalShell\n {...shell}\n portalContainer={overlayEnvironment.getContainer}\n allowsOutsideDismissal={allowsOutsideDismissal}\n allowsEscapeDismissal={allowsEscapeDismissal}\n onDismiss={() => void handleClose(DialogResult.Cancelled)}\n />\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,6BAA6B,GAAG,MAAM,MAAM,SAAS;AAC3D,MAAM,YAAY,GAAG,MACjB,oBAAoB,CAChB,6BAA6B,EAC7B,MAAM,IAAI,EACV,MAAM,KAAK,CACd;AAGL,MAAM,mBAAmB,GAAG,CAAC,YAAgC,EAAE,OAA+B,KAAI;AAC9F,IAAA,MAAM,mBAAmB,GAAG,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,aAAa,CAAC,EAAE;AACvF,IAAA,OAAO,YAAY,KAAK,kBAAkB,CAAC,MAAM,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,OAAO,GAAG,YAAY;AACzH,CAAC;AAED,M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AO;YACjE,QAAQ;YACR,MAAM;YACN,cAAc,EAAE,MAAM,CAAC,SAAS;YAChC,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC;YACxC,OAAO,EAAE,MAAM,KAAK,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC;YACvD,EAAE;AACL,SAAA,EACD,MAAM,EACF,OAAO,KAAK;AACR,cAAE;AACF,cAAE;gBACI,OAAO;gBACP,MAAM;gBACN,KAAK;gBACL,MAAM;gBACN,OAAO,EAAE,OAAO,KAAK,KAAK;gBAC1B,EAAE;gBACF,UAAU;gBACV,SAAS;gBACT,QAAQ,EAAE,CAAC,MAAM,KAAK,KAAK,WAAW,CAAC,MAAM,CAAC;aACjD,EAAA,QAAA,EAGV,QAAQ,EAAA,CACI,CACpB;AAED,IAAA,MAAM,KAAK,GAAG;QACV,SAAS;QACT,OAAO;QACP,MAAM;AACN,QAAA,MAAM,EAAE,cAAc;QACtB,KAAK;QACL,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,QAAQ;QACR,MAAM;QACN,EAAE;AACF,QAAA,QAAQ,EAAE,cAAc;KAC3B;AAKD,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,OAAOA,GAAA,CAAC,iBAAiB,EAAA,EAAA,GAAK,KAAK,GAAI;AAEvD,IAAA,QACIA,GAAA,CAAC,gBAAgB,EAAA,EAAA,GACT,KAAK,EACT,eAAe,EAAE,kBAAkB,CAAC,YAAY,EAChD,sBAAsB,EAAE,sBAAsB,EAC9C,qBAAqB,EAAE,qBAAqB,EAC5C,SAAS,EAAE,MAAM,KAAK,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,EAAA,CAC3D;AAEV;;"}
|
|
1
|
+
{"version":3,"file":"DialogImplementation.js","sources":["../../../Dialogs/DialogImplementation.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogResult, DialogButtons } from '@cratis/arc.react/dialogs';\nimport { useId, useSyncExternalStore } from 'react';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { DialogInitialFocus } from './DialogInitialFocus';\nimport type { DialogProps } from './Dialog';\nimport { resolveDialogDismissal } from './resolveDialogDismissal';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport { DIALOG_ZINDEX_TOKEN } from '../renderer/dialogStack';\nimport { useComponentPresentation } from '../configuration/identity/useComponentPresentation';\nimport { dialogDescriptor } from './dialogDescriptor';\nimport { DialogDocument } from './DialogDocument';\nimport { DialogModalShell, DialogServerShell } from './DialogShells';\nimport { resolveDialogLabels } from './resolveDialogLabels';\nimport { useDialogClose } from './useDialogClose';\nimport { useDialogFocus } from './useDialogFocus';\nimport { useDialogZIndex } from './useDialogZIndex';\n\nconst subscribeToBrowserEnvironment = () => () => undefined;\nconst useIsBrowser = () =>\n useSyncExternalStore(\n subscribeToBrowserEnvironment,\n () => true,\n () => false,\n );\n\n// A cancel-focused dialog without a dismissing button falls back to focusing the content.\nconst resolveInitialFocus = (initialFocus: DialogInitialFocus, buttons: DialogProps['buttons']) => {\n const hasDismissingButton = typeof buttons === 'number' && buttons !== DialogButtons.Ok;\n return initialFocus === DialogInitialFocus.Cancel && !hasDismissingButton ? DialogInitialFocus.Content : initialFocus;\n};\n\nconst dismissalFor = (props: DialogProps, isBusy: boolean) =>\n resolveDialogDismissal({\n // An explicit null (no footer) must stay null; only an omitted set defaults.\n buttons: props.buttons === undefined ? DialogButtons.OkCancel : props.buttons,\n dismissable: props.dismissable,\n dismissOnOutsideClick: props.dismissOnOutsideClick,\n closeOnEscape: props.closeOnEscape,\n showCloseButton: props.showCloseButton,\n isBusy,\n });\n\n/**\n * A modal dialog with Arc host integration, typed footer actions, busy/validity\n * state, controlled dismissal, and stable Cratis-owned styling parts.\n */\nexport const DialogImplementation = (incomingProps: DialogProps) => {\n const [props, marker] = useComponentPresentation(dialogDescriptor, incomingProps);\n const {\n title,\n subtitle,\n placement = 'center',\n closeIcon,\n headerActions,\n hideGlobalHeaderActions = false,\n sliceLocation,\n isCommandDialog = false,\n visible = true,\n buttons = DialogButtons.OkCancel,\n initialFocus = DialogInitialFocus.Confirm,\n children,\n width = '450px',\n isValid,\n isBusy = false,\n pt,\n } = props;\n const { messages, dialogHeaderActions } = useCratisComponentsConfig();\n const dialogId = useId();\n const subtitleId = useId();\n const hostId = useId();\n const labels = resolveDialogLabels(props, messages?.dialog);\n const icon = useCratisIcon();\n const isBrowser = useIsBrowser();\n const overlayEnvironment = unstable_useOverlayEnvironment();\n\n const hasHeaderActions =\n headerActions != null || (dialogHeaderActions !== undefined && !hideGlobalHeaderActions);\n const hasSubtitle = subtitle !== undefined && subtitle !== null && subtitle !== false;\n const resolvedInitialFocus = resolveInitialFocus(initialFocus, buttons);\n const focus = {\n confirm: resolvedInitialFocus === DialogInitialFocus.Confirm,\n dismissing: resolvedInitialFocus === DialogInitialFocus.Cancel,\n };\n const { allowsOutsideDismissal, allowsEscapeDismissal, showsCloseButton } = dismissalFor(props, isBusy);\n\n const resolvedZIndex = useDialogZIndex(visible);\n const { titleRef, confirmRef, cancelRef, announcement, onRefused } = useDialogFocus({\n visible,\n isBusy,\n initialFocus: resolvedInitialFocus,\n refusedMessage: labels.refused,\n });\n const handleClose = useDialogClose(props, onRefused);\n\n const dialogDocument = (\n <DialogDocument\n stackZIndex={resolvedZIndex ?? DIALOG_ZINDEX_TOKEN}\n hostId={hostId}\n visible={visible}\n contentStyle={props.contentStyle}\n announcement={announcement}\n header={{\n dialogId,\n title,\n subtitle,\n subtitleId,\n hasSubtitle,\n hasHeaderActions,\n headerActions,\n globalHeaderActions: dialogHeaderActions,\n hideGlobalHeaderActions,\n isCommandDialog,\n sliceLocation,\n showsCloseButton,\n focusesTitle: resolvedInitialFocus === DialogInitialFocus.Content,\n titleRef,\n isBusy,\n closeAriaLabel: labels.closeAria,\n closeIcon: icon('close', '×', closeIcon),\n onClose: () => void handleClose(DialogResult.Cancelled),\n pt,\n }}\n footer={\n buttons === null\n ? null\n : {\n buttons,\n labels,\n focus,\n isBusy,\n isValid: isValid !== false,\n pt,\n confirmRef,\n cancelRef,\n onResult: (result) => void handleClose(result),\n }\n }\n >\n {children}\n </DialogDocument>\n );\n\n const shell = {\n placement,\n visible,\n isBusy,\n zIndex: resolvedZIndex,\n width,\n style: props.style,\n className: props.className,\n dialogId,\n marker,\n pt,\n children: dialogDocument,\n };\n\n // useSyncExternalStore supplies the server snapshot during hydration, so this\n // fallback is identical on the server and on the client's first render. React\n // switches to the portaled React Aria modal only after hydration completes.\n if (!isBrowser) return <DialogServerShell {...shell} />;\n\n return (\n <DialogModalShell\n {...shell}\n portalContainer={overlayEnvironment.getContainer}\n allowsOutsideDismissal={allowsOutsideDismissal}\n allowsEscapeDismissal={allowsEscapeDismissal}\n onDismiss={() => void handleClose(DialogResult.Cancelled)}\n />\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,6BAA6B,GAAG,MAAM,MAAM,SAAS;AAC3D,MAAM,YAAY,GAAG,MACjB,oBAAoB,CAChB,6BAA6B,EAC7B,MAAM,IAAI,EACV,MAAM,KAAK,CACd;AAGL,MAAM,mBAAmB,GAAG,CAAC,YAAgC,EAAE,OAA+B,KAAI;AAC9F,IAAA,MAAM,mBAAmB,GAAG,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,aAAa,CAAC,EAAE;AACvF,IAAA,OAAO,YAAY,KAAK,kBAAkB,CAAC,MAAM,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,OAAO,GAAG,YAAY;AACzH,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,KAAkB,EAAE,MAAe,KACrD,sBAAsB,CAAC;AAEnB,IAAA,OAAO,EAAE,KAAK,CAAC,OAAO,KAAK,SAAS,GAAG,aAA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SAAS;YAChC,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC;YACxC,OAAO,EAAE,MAAM,KAAK,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC;YACvD,EAAE;AACL,SAAA,EACD,MAAM,EACF,OAAO,KAAK;AACR,cAAE;AACF,cAAE;gBACI,OAAO;gBACP,MAAM;gBACN,KAAK;gBACL,MAAM;gBACN,OAAO,EAAE,OAAO,KAAK,KAAK;gBAC1B,EAAE;gBACF,UAAU;gBACV,SAAS;gBACT,QAAQ,EAAE,CAAC,MAAM,KAAK,KAAK,WAAW,CAAC,MAAM,CAAC;aACjD,EAAA,QAAA,EAGV,QAAQ,EAAA,CACI,CACpB;AAED,IAAA,MAAM,KAAK,GAAG;QACV,SAAS;QACT,OAAO;QACP,MAAM;AACN,QAAA,MAAM,EAAE,cAAc;QACtB,KAAK;QACL,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,QAAQ;QACR,MAAM;QACN,EAAE;AACF,QAAA,QAAQ,EAAE,cAAc;KAC3B;AAKD,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,OAAOA,GAAA,CAAC,iBAAiB,EAAA,EAAA,GAAK,KAAK,GAAI;AAEvD,IAAA,QACIA,GAAA,CAAC,gBAAgB,EAAA,EAAA,GACT,KAAK,EACT,eAAe,EAAE,kBAAkB,CAAC,YAAY,EAChD,sBAAsB,EAAE,sBAAsB,EAC9C,qBAAqB,EAAE,qBAAqB,EAC5C,SAAS,EAAE,MAAM,KAAK,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,EAAA,CAC3D;AAEV;;"}
|
|
@@ -9,6 +9,21 @@
|
|
|
9
9
|
* its own stacking order. Compose onto it with `zIndexAboveDialog` rather than doing arithmetic.
|
|
10
10
|
*/
|
|
11
11
|
export declare const DialogStackContext: import("react").Context<string | null>;
|
|
12
|
+
/**
|
|
13
|
+
* The overlay host an overlay-producing descendant opened in. Unlike {@link DialogStackContext}, it
|
|
14
|
+
* carries the host's identity and whether it is still open, so a descendant can tell a closed host
|
|
15
|
+
* from an open one even though both resolve to the same z-index token.
|
|
16
|
+
*/
|
|
17
|
+
export interface OverlayHostState {
|
|
18
|
+
/** Unique per host instance, so a reused stacking tier can never alias two hosts. */
|
|
19
|
+
readonly id: string;
|
|
20
|
+
/** False from the moment the host starts closing, while its children are still mounted. */
|
|
21
|
+
readonly open: boolean;
|
|
22
|
+
/** The host's resolved z-index, as a CSS expression. */
|
|
23
|
+
readonly stackZIndex: string;
|
|
24
|
+
}
|
|
25
|
+
/** The nearest ancestor overlay host, or `null` when rendered outside any host. */
|
|
26
|
+
export declare const OverlayHostContext: import("react").Context<OverlayHostState | null>;
|
|
12
27
|
/** Reads the nearest ancestor dialog's resolved z-index. `null` when not nested in a dialog. */
|
|
13
28
|
export declare const useNearestDialogZIndex: () => string | null;
|
|
14
29
|
//# sourceMappingURL=DialogStackContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogStackContext.d.ts","sourceRoot":"","sources":["../../../renderer/DialogStackContext.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,wCAAqC,CAAC;AAErE,gGAAgG;AAChG,eAAO,MAAM,sBAAsB,QAAO,MAAM,GAAG,IAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"DialogStackContext.d.ts","sourceRoot":"","sources":["../../../renderer/DialogStackContext.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,wCAAqC,CAAC;AAErE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,qFAAqF;IACrF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAChC;AAED,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,kDAA+C,CAAC;AAE/E,gGAAgG;AAChG,eAAO,MAAM,sBAAsB,QAAO,MAAM,GAAG,IAAsC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createContext, useContext } from 'react';
|
|
2
2
|
|
|
3
3
|
const DialogStackContext = createContext(null);
|
|
4
|
+
const OverlayHostContext = createContext(null);
|
|
4
5
|
const useNearestDialogZIndex = () => useContext(DialogStackContext);
|
|
5
6
|
|
|
6
|
-
export { DialogStackContext, useNearestDialogZIndex };
|
|
7
|
+
export { DialogStackContext, OverlayHostContext, useNearestDialogZIndex };
|
|
7
8
|
//# sourceMappingURL=DialogStackContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogStackContext.js","sources":["../../../renderer/DialogStackContext.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { createContext, useContext } from 'react';\n\n/**\n * The resolved z-index of the nearest ancestor {@link DialogImplementation}, or `null` when\n * rendered outside any dialog. Overlay-producing descendants (dropdown popovers, date-picker\n * popovers, tooltips, filter menus) read this to stack themselves above their owning dialog instead\n * of relying on the static overlay token, which does not account for dialog nesting depth.\n *\n * This is a CSS expression rather than a number - it stays relative to the `--cratis-z-index-dialog`\n * token so an application that retunes that token keeps its dialogs, and everything they host, in\n * its own stacking order. Compose onto it with `zIndexAboveDialog` rather than doing arithmetic.\n */\nexport const DialogStackContext = createContext<string | null>(null);\n\n/** Reads the nearest ancestor dialog's resolved z-index. `null` when not nested in a dialog. */\nexport const useNearestDialogZIndex = (): string | null => useContext(DialogStackContext);\n"],"names":[],"mappings":";;MAea,kBAAkB,GAAG,aAAa,CAAgB,IAAI;
|
|
1
|
+
{"version":3,"file":"DialogStackContext.js","sources":["../../../renderer/DialogStackContext.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { createContext, useContext } from 'react';\n\n/**\n * The resolved z-index of the nearest ancestor {@link DialogImplementation}, or `null` when\n * rendered outside any dialog. Overlay-producing descendants (dropdown popovers, date-picker\n * popovers, tooltips, filter menus) read this to stack themselves above their owning dialog instead\n * of relying on the static overlay token, which does not account for dialog nesting depth.\n *\n * This is a CSS expression rather than a number - it stays relative to the `--cratis-z-index-dialog`\n * token so an application that retunes that token keeps its dialogs, and everything they host, in\n * its own stacking order. Compose onto it with `zIndexAboveDialog` rather than doing arithmetic.\n */\nexport const DialogStackContext = createContext<string | null>(null);\n\n/**\n * The overlay host an overlay-producing descendant opened in. Unlike {@link DialogStackContext}, it\n * carries the host's identity and whether it is still open, so a descendant can tell a closed host\n * from an open one even though both resolve to the same z-index token.\n */\nexport interface OverlayHostState {\n /** Unique per host instance, so a reused stacking tier can never alias two hosts. */\n readonly id: string;\n /** False from the moment the host starts closing, while its children are still mounted. */\n readonly open: boolean;\n /** The host's resolved z-index, as a CSS expression. */\n readonly stackZIndex: string;\n}\n\n/** The nearest ancestor overlay host, or `null` when rendered outside any host. */\nexport const OverlayHostContext = createContext<OverlayHostState | null>(null);\n\n/** Reads the nearest ancestor dialog's resolved z-index. `null` when not nested in a dialog. */\nexport const useNearestDialogZIndex = (): string | null => useContext(DialogStackContext);\n"],"names":[],"mappings":";;MAea,kBAAkB,GAAG,aAAa,CAAgB,IAAI;MAiBtD,kBAAkB,GAAG,aAAa,CAA0B,IAAI;AAGtE,MAAM,sBAAsB,GAAG,MAAqB,UAAU,CAAC,kBAAkB;;"}
|
|
@@ -56,6 +56,7 @@ export { unstable_CRATIS_UI_ABI_VERSION, unstable_composeUiLibraries, unstable_d
|
|
|
56
56
|
export { unstable_defaultOverlayEnvironment, type CratisOverlayEnvironment, type unstable_CratisOverlayEnvironment, } from './overlayEnvironment.js';
|
|
57
57
|
export { CRATIS_PRESENTATION_ABI_VERSION, CRATIS_PRESENTATION_PROFILE, cratisPresentationSlotIds, definePresentationUiLibrary, type CratisPresentationCapabilities, type CratisPresentationCapabilityId, type CratisPresentationSlotDeclaration, type CratisPresentationSlotId, type CratisPresentationSlotMap, type CratisPresentationSlots, type CratisPresentationUiLibrary, cratisAtomicSlotIds, type CratisAtomicSlotDeclaration, type CratisAtomicSlotId, type CratisAtomicSlotMap, type CratisAtomicSlots, } from './presentation.js';
|
|
58
58
|
export { unstable_useCapability, unstable_useOverlayEnvironment, unstable_useRendererId, } from './RendererContext.js';
|
|
59
|
+
export { unstable_useOverlayHost, type unstable_OverlayHost } from './useOverlayHost.js';
|
|
59
60
|
export { unstable_RendererScope, type unstable_RendererScopeProps, } from './RendererScope.js';
|
|
60
61
|
export type { unstable_BehaviorMode, unstable_CratisSlots, unstable_Fidelity, unstable_SlotDeclaration, unstable_SlotId, unstable_SlotMap, } from './slots.js';
|
|
61
62
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../renderer/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAmB,CAAC;A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ACf,gBAAgB,GACnB,MAAM,YAAS,CAAC"}
|
|
@@ -3,5 +3,6 @@ export { unstable_CRATIS_UI_ABI_VERSION, unstable_composeUiLibraries, unstable_d
|
|
|
3
3
|
export { unstable_defaultOverlayEnvironment } from './overlayEnvironment.js';
|
|
4
4
|
export { CRATIS_PRESENTATION_ABI_VERSION, CRATIS_PRESENTATION_PROFILE, cratisAtomicSlotIds, cratisPresentationSlotIds, definePresentationUiLibrary } from './presentation.js';
|
|
5
5
|
export { unstable_useCapability, unstable_useOverlayEnvironment, unstable_useRendererId } from './RendererContext.js';
|
|
6
|
+
export { unstable_useOverlayHost } from './useOverlayHost.js';
|
|
6
7
|
export { unstable_RendererScope } from './RendererScope.js';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The overlay host an adapter-owned popup opened in. A popup bound to a host must close
|
|
3
|
+
* immediately, without an exit transition, once the host closes, unmounts or changes identity.
|
|
4
|
+
*/
|
|
5
|
+
export interface unstable_OverlayHost {
|
|
6
|
+
/** Unique per host instance. A different id means the popup now belongs to a different host. */
|
|
7
|
+
readonly id: string;
|
|
8
|
+
/** False once the host starts closing, while its children may still be mounted. */
|
|
9
|
+
readonly open: boolean;
|
|
10
|
+
/** The z-index, as a CSS expression, a tooltip popup uses to stay above the host. */
|
|
11
|
+
readonly tooltipZIndex: string;
|
|
12
|
+
}
|
|
13
|
+
/** @unstable Adapter-author contract. Expect changes until renderer conformance gates promote it. */
|
|
14
|
+
export declare const unstable_useOverlayHost: () => unstable_OverlayHost;
|
|
15
|
+
//# sourceMappingURL=useOverlayHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOverlayHost.d.ts","sourceRoot":"","sources":["../../../renderer/useOverlayHost.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACjC,gGAAgG;IAChG,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,qFAAqF;IACrF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAClC;AA8BD,qGAAqG;AACrG,eAAO,MAAM,uBAAuB,EAAE,MAAM,oBAAqC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import { zIndexAboveDialog, TOOLTIP_OFFSET } from './dialogStack.js';
|
|
3
|
+
import { OverlayHostContext } from './DialogStackContext.js';
|
|
4
|
+
|
|
5
|
+
const documentHost = Object.freeze({
|
|
6
|
+
id: 'document',
|
|
7
|
+
open: true,
|
|
8
|
+
tooltipZIndex: 'var(--cratis-z-index-tooltip)',
|
|
9
|
+
});
|
|
10
|
+
const useOverlayHost = () => {
|
|
11
|
+
const host = useContext(OverlayHostContext);
|
|
12
|
+
return useMemo(() => host === null
|
|
13
|
+
? documentHost
|
|
14
|
+
: {
|
|
15
|
+
id: host.id,
|
|
16
|
+
open: host.open,
|
|
17
|
+
tooltipZIndex: zIndexAboveDialog(host.stackZIndex, TOOLTIP_OFFSET),
|
|
18
|
+
}, [host]);
|
|
19
|
+
};
|
|
20
|
+
const unstable_useOverlayHost = useOverlayHost;
|
|
21
|
+
|
|
22
|
+
export { unstable_useOverlayHost };
|
|
23
|
+
//# sourceMappingURL=useOverlayHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOverlayHost.js","sources":["../../../renderer/useOverlayHost.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useContext, useMemo } from 'react';\nimport { TOOLTIP_OFFSET, zIndexAboveDialog } from './dialogStack';\nimport { OverlayHostContext } from './DialogStackContext';\n\n/**\n * The overlay host an adapter-owned popup opened in. A popup bound to a host must close\n * immediately, without an exit transition, once the host closes, unmounts or changes identity.\n */\nexport interface unstable_OverlayHost {\n /** Unique per host instance. A different id means the popup now belongs to a different host. */\n readonly id: string;\n /** False once the host starts closing, while its children may still be mounted. */\n readonly open: boolean;\n /** The z-index, as a CSS expression, a tooltip popup uses to stay above the host. */\n readonly tooltipZIndex: string;\n}\n\n/** The host used outside any dialog: the document itself, which never closes. */\nconst documentHost: unstable_OverlayHost = Object.freeze({\n id: 'document',\n open: true,\n tooltipZIndex: 'var(--cratis-z-index-tooltip)',\n});\n\n/**\n * Reads the nearest overlay host: its identity, whether it is open and the stacking order a tooltip\n * must use to stay above it. Outside any host it reports the always-open document with the static\n * `--cratis-z-index-tooltip` token. Both z-index forms stay relative to the application's token\n * overrides.\n */\nconst useOverlayHost = (): unstable_OverlayHost => {\n const host = useContext(OverlayHostContext);\n return useMemo(\n () =>\n host === null\n ? documentHost\n : {\n id: host.id,\n open: host.open,\n tooltipZIndex: zIndexAboveDialog(host.stackZIndex, TOOLTIP_OFFSET),\n },\n [host],\n );\n};\n\n/** @unstable Adapter-author contract. Expect changes until renderer conformance gates promote it. */\nexport const unstable_useOverlayHost: () => unstable_OverlayHost = useOverlayHost;\n"],"names":[],"mappings":";;;;AAqBA,MAAM,YAAY,GAAyB,MAAM,CAAC,MAAM,CAAC;AACrD,IAAA,EAAE,EAAE,UAAU;AACd,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,aAAa,EAAE,+BAA+B;AACjD,CAAA,CAAC;AAQF,MAAM,cAAc,GAAG,MAA2B;AAC9C,IAAA,MAAM,IAAI,GAAG,UAAU,CAAC,kBAAkB,CAAC;AAC3C,IAAA,OAAO,OAAO,CACV,MACI,IAAI,KAAK;AACL,UAAE;AACF,UAAE;YACI,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,aAAa,EAAE,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC;AACrE,SAAA,EACX,CAAC,IAAI,CAAC,CACT;AACL,CAAC;AAGM,MAAM,uBAAuB,GAA+B;;"}
|
package/package.json
CHANGED