@cratis/components 4.32.0 → 4.33.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 +11 -11
- package/dist/esm/CommandDialog/CommandDialog.d.ts +3 -2
- package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.d.ts +6 -0
- package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts +2 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.js +60 -2
- package/dist/esm/Dialogs/DialogImplementation.js.map +1 -1
- package/package.json +1 -1
package/compat-manifest.json
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
{
|
|
69
69
|
"name": "@cratis/components",
|
|
70
70
|
"role": "core",
|
|
71
|
-
"version": "4.
|
|
71
|
+
"version": "4.33.0",
|
|
72
72
|
"releaseMajorRange": ">=4 <5",
|
|
73
73
|
"independentRelease": false,
|
|
74
74
|
"private": false,
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
{
|
|
93
93
|
"name": "@cratis/eslint-plugin-components",
|
|
94
94
|
"role": "eslint",
|
|
95
|
-
"version": "4.
|
|
95
|
+
"version": "4.33.0",
|
|
96
96
|
"releaseMajorRange": ">=4 <5",
|
|
97
97
|
"independentRelease": false,
|
|
98
98
|
"private": false,
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
{
|
|
106
106
|
"name": "@cratis/components.migrator",
|
|
107
107
|
"role": "migrator",
|
|
108
|
-
"version": "4.
|
|
108
|
+
"version": "4.33.0",
|
|
109
109
|
"releaseMajorRange": ">=4 <5",
|
|
110
110
|
"independentRelease": false,
|
|
111
111
|
"private": false,
|
|
@@ -116,13 +116,13 @@
|
|
|
116
116
|
{
|
|
117
117
|
"name": "@cratis/components.conformance",
|
|
118
118
|
"role": "conformance",
|
|
119
|
-
"version": "4.
|
|
119
|
+
"version": "4.33.0",
|
|
120
120
|
"releaseMajorRange": ">=4 <5",
|
|
121
121
|
"independentRelease": false,
|
|
122
122
|
"private": false,
|
|
123
123
|
"packageAccess": "public",
|
|
124
124
|
"peerDependencies": {
|
|
125
|
-
"@cratis/components": "4.
|
|
125
|
+
"@cratis/components": "4.33.0",
|
|
126
126
|
"react": "^19.0.0",
|
|
127
127
|
"react-dom": "^19.0.0"
|
|
128
128
|
},
|
|
@@ -132,13 +132,13 @@
|
|
|
132
132
|
{
|
|
133
133
|
"name": "@cratis/components.mui",
|
|
134
134
|
"role": "renderer-adapter",
|
|
135
|
-
"version": "4.
|
|
135
|
+
"version": "4.33.0",
|
|
136
136
|
"releaseMajorRange": ">=4 <5",
|
|
137
137
|
"independentRelease": false,
|
|
138
138
|
"private": false,
|
|
139
139
|
"packageAccess": "public",
|
|
140
140
|
"peerDependencies": {
|
|
141
|
-
"@cratis/components": "4.
|
|
141
|
+
"@cratis/components": "4.33.0",
|
|
142
142
|
"@emotion/react": ">=11.5 <12",
|
|
143
143
|
"@emotion/styled": ">=11.11 <12",
|
|
144
144
|
"@mui/material": ">=9 <10",
|
|
@@ -188,13 +188,13 @@
|
|
|
188
188
|
{
|
|
189
189
|
"name": "@cratis/components.primereact",
|
|
190
190
|
"role": "renderer-adapter",
|
|
191
|
-
"version": "4.
|
|
191
|
+
"version": "4.33.0",
|
|
192
192
|
"releaseMajorRange": ">=4 <5",
|
|
193
193
|
"independentRelease": false,
|
|
194
194
|
"private": false,
|
|
195
195
|
"packageAccess": "public",
|
|
196
196
|
"peerDependencies": {
|
|
197
|
-
"@cratis/components": "4.
|
|
197
|
+
"@cratis/components": "4.33.0",
|
|
198
198
|
"@primereact/core": ">=11 <12",
|
|
199
199
|
"@primereact/ui": ">=11 <12",
|
|
200
200
|
"@primeuix/themes": ">=3 <4",
|
|
@@ -256,13 +256,13 @@
|
|
|
256
256
|
{
|
|
257
257
|
"name": "@cratis/components.primereact10",
|
|
258
258
|
"role": "renderer-adapter",
|
|
259
|
-
"version": "4.
|
|
259
|
+
"version": "4.33.0",
|
|
260
260
|
"releaseMajorRange": ">=4 <5",
|
|
261
261
|
"independentRelease": false,
|
|
262
262
|
"private": false,
|
|
263
263
|
"packageAccess": "public",
|
|
264
264
|
"peerDependencies": {
|
|
265
|
-
"@cratis/components": "4.
|
|
265
|
+
"@cratis/components": "4.33.0",
|
|
266
266
|
"primereact": ">=10.9.9 <11",
|
|
267
267
|
"react": "^19.0.0",
|
|
268
268
|
"react-dom": "^19.0.0"
|
|
@@ -75,8 +75,9 @@ export interface CommandDialogProps<TCommand extends object, TResponse = object>
|
|
|
75
75
|
* stays open and the `CommandResult` is set on the form context so the
|
|
76
76
|
* UI can surface the error to the user.
|
|
77
77
|
*
|
|
78
|
-
* Throughout, the dialog is in the `isBusy` state —
|
|
79
|
-
* disabled and
|
|
78
|
+
* Throughout, the dialog is in the `isBusy` state — the confirm button keeps
|
|
79
|
+
* focus but is `aria-disabled` and ignores activation, the other action
|
|
80
|
+
* buttons are disabled, and the confirm button shows a spinner.
|
|
80
81
|
*
|
|
81
82
|
* ## Destructive commands and initial focus
|
|
82
83
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,sBAAmB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAKH,KAAK,gBAAgB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAAwB,CAAC;AAOnE;;;;;;;;;GASG;AACH,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,CAAC;IAEtD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAoHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AACH,QAAA,MAAM,sBAAsB;KAAI,QAAQ,SAAS,MAAM,WAAW,SAAS,kBAChE,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC;;CA8EjD,CAAC;AAEF,QAAA,MAAM,0BAA0B,iBAAkB;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,sBAE9E,CAAC;AAKF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,+BAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.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 { DialogButtons, DialogResult } from '@cratis/arc.react/dialogs';\nimport { Dialog, type DialogProps } from '../Dialogs/Dialog';\nimport React from 'react';\nimport {\n CommandForm,\n CommandFormFieldWrapper,\n useCommandFormContext,\n useCommandInstance,\n type CommandFormProps,\n} from '@cratis/arc.react/commands';\nimport type { BeforeExecuteCallback } from './applyBeforeExecute';\nimport type { ConfirmBeforeExecute } from './confirmBeforeExecute';\nimport { useCommandExecution } from './useCommandExecution';\nimport {\n isCommandFormField,\n markAsCommandFormColumn,\n} from '../CommandForm/commandFormMarkers';\n\n/**\n * Props for {@link CommandDialog}. Combines the props of a `CommandForm`\n * (`command`, `initialValues`, `onSuccess`, `onValidationFailure`, `onFailed`,\n * `onBeforeExecute`, etc.) with the props of a {@link Dialog} (`title`,\n * `buttons`, `width`, `pt`, `unstyled`, …). Dialog presentation props\n * such as `subtitle`, `placement`, and `closeIcon` are forwarded to the dialog.\n *\n * @typeParam TCommand - The command record type (must extend `object`).\n * @typeParam TResponse - The response payload type returned by a successful command. Defaults to `object`.\n */\nexport interface CommandDialogProps<TCommand extends object, TResponse = object>\n extends\n Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>,\n Omit<DialogProps, 'children' | 'isBusy'> {\n /**\n * A transformer invoked with the current command values immediately before\n * the command executes on confirm. It **must return** the values to run with\n * (mutated or not) — a callback that returns nothing does not execute the\n * command with `undefined`; the current values are kept and a warning is\n * logged. May be async.\n *\n * ⚠️ It runs **only on submit**, after the form has already been validated,\n * so a value produced here can never satisfy required-field validation — the\n * submit button stays disabled if a required value is only seeded here. Seed\n * required values through `initialValues`; reserve `onBeforeExecute` for\n * transforms that do not affect validity (for example a generated id).\n */\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n\n /**\n * Ask whether to run the command after validation and `onBeforeExecute`.\n * Receives the transformed values. Only `true` executes; all other outcomes\n * keep the dialog open. May return a promise (for example from a confirmation dialog).\n * If command values change while confirmation is pending, execution is skipped\n * and the dialog stays open; confirm the new values again.\n * Unlike `onConfirm`, this runs before execution, not after success.\n */\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n\n /**\n * Form fields and arbitrary content for the dialog body. Children that are\n * `CommandFormField` instances are automatically wrapped so they bind to\n * the command instance.\n */\n children?: React.ReactNode;\n}\n\n// Requiring each key here makes a newly added Dialog prop fail compilation until it is routed.\ntype ForwardedDialogProps = Omit<DialogProps, 'children' | 'isBusy'> &\n Record<keyof Omit<DialogProps, 'children' | 'isBusy'>, unknown>;\n\nconst CommandDialogWrapper = <TCommand extends object, TResponse = object>({\n isValid,\n onClose,\n onConfirm,\n onSuccess,\n onValidationFailure,\n onFailed,\n onException,\n onUnauthorized,\n onBeforeExecute,\n confirmBeforeExecute,\n children,\n ...dialogProps\n}: Omit<DialogProps, 'isBusy'> & {\n onSuccess?: CommandFormProps<TCommand, TResponse>['onSuccess'];\n onValidationFailure?: CommandFormProps<TCommand, TResponse>['onValidationFailure'];\n onFailed?: CommandFormProps<TCommand, TResponse>['onFailed'];\n onException?: CommandFormProps<TCommand, TResponse>['onException'];\n onUnauthorized?: CommandFormProps<TCommand, TResponse>['onUnauthorized'];\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n}) => {\n const {\n setCommandValues,\n setCommandResult,\n isValid: isCommandFormValid,\n } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n const submission = useCommandExecution<TCommand, TResponse>(\n commandInstance, setCommandValues, onBeforeExecute, confirmBeforeExecute, onException,\n );\n\n const handleConfirm = async () => {\n const result = await submission.run();\n if (!result) return false;\n\n if (!result.isSuccess) {\n await onFailed?.(result);\n if (result.hasExceptions) {\n await onException?.(result.exceptionMessages, result.exceptionStackTrace);\n }\n if (!result.isAuthorized) await onUnauthorized?.();\n if (!result.isValid) {\n await onValidationFailure?.(result.validationResults);\n }\n if (submission.isMounted()) setCommandResult(result);\n return false;\n }\n\n await onSuccess?.(result.response as TResponse);\n if (onConfirm) {\n const closeResult = await onConfirm();\n return closeResult === true;\n }\n if (onClose) {\n const closeResult = await onClose(DialogResult.Ok);\n return closeResult !== false;\n }\n return true;\n };\n\n const processChildren = (nodes: React.ReactNode): React.ReactNode => {\n return React.Children.map(nodes, (child) => {\n if (!React.isValidElement(child)) return child;\n\n const component = child.type as React.ComponentType<unknown>;\n if (isCommandFormField(component)) {\n type FieldElement = Parameters<\n typeof CommandFormFieldWrapper\n >[0]['field'];\n // SAFETY: isCommandFormField guards that child.type is a command form field component.\n return (\n <CommandFormFieldWrapper field={child as unknown as FieldElement} />\n );\n }\n\n const childProps = child.props as Record<string, unknown>;\n // A function child is a render prop, not a node: mapping it would replace the\n // function with its mapped result and break the component that calls it.\n if (childProps.children != null && typeof childProps.children !== 'function') {\n return React.cloneElement(\n child as React.ReactElement<Record<string, unknown>>,\n {\n children: processChildren(childProps.children as React.ReactNode),\n },\n );\n }\n\n return child;\n });\n };\n\n const processedChildren = processChildren(children);\n const isDialogValid = isValid !== false && isCommandFormValid;\n\n return (\n <Dialog\n {...dialogProps}\n onClose={onClose}\n onConfirm={handleConfirm}\n isValid={isDialogValid}\n isBusy={submission.isSubmitting}\n >\n <div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>\n {processedChildren}\n </div>\n </Dialog>\n );\n};\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * ## Where `TCommand` comes from\n *\n * `TCommand` is an auto-generated TypeScript class produced by the Arc proxy\n * generator from a C# `[Command]` record. `dotnet build` writes a `.ts` file\n * per command with the right property types and a typed `execute()` method;\n * importing the class is all the connection-to-the-backend you need. The\n * class also exposes a `.use()` hook for direct (non-dialog) usage and a\n * `useWithChangeTracking()` variant.\n *\n * ## What happens on confirm\n *\n * 1. If `onBeforeExecute` is supplied, it transforms the command values.\n * Used for generated IDs (`Guid.create()`) that the user did not type in.\n * 2. The command's `execute()` runs through Arc's command pipeline. The\n * backend handler returns either a typed response (mapped to `TResponse`)\n * or a `ValidationResult[]`.\n * 3. On `IsSuccess: true`, `onSuccess(response)` fires and the dialog closes\n * through the dialog host context.\n * 4. On a validation failure, `onValidationFailure(errors)` fires and the\n * form's per-field error display is updated. The dialog stays open.\n * 5. On a domain or transport failure, `onFailed(result)` fires. The dialog\n * stays open and the `CommandResult` is set on the form context so the\n * UI can surface the error to the user.\n *\n * Throughout, the dialog is in the `isBusy` state — every action button is\n * disabled and the confirm button shows a spinner.\n *\n * ## Destructive commands and initial focus\n *\n * The confirm button is focused when the dialog opens, and a focused native\n * button fires `click` from the `keydown` of `Enter`. A command whose form\n * has required fields is protected from a held or double-tapped `Enter` for\n * free, because `isCommandFormValid` keeps confirm disabled until something\n * is filled in. A command that takes **no** input — the typical \"delete\n * this, permanently\" command — has no such gate, so its confirm button is\n * armed the instant the dialog appears.\n *\n * Pass `initialFocus` (forwarded straight to {@link Dialog}) for those:\n *\n * ```tsx\n * <CommandDialog<DeletePerson>\n * command={DeletePerson}\n * title=\"Delete personal data?\"\n * okLabel=\"Delete\"\n * initialFocus={DialogInitialFocus.Cancel}\n * onSuccess={() => closeDialog(DialogResult.Ok)}>\n * This cannot be undone.\n * </CommandDialog>\n * ```\n *\n * Everything else — the footer, the close (X), `Escape`, and the confirm\n * wiring that runs the command — is untouched.\n *\n * ## Field binding\n *\n * Children that are `CommandFormField` instances (`InputTextField`,\n * `NumberField`, `DropdownField`, every `@cratis/components/CommandForm/fields`\n * widget) bind to a property on the command via the `value` accessor:\n *\n * ```tsx\n * <InputTextField value={c => c.name} title=\"Name\" />\n * ```\n *\n * The accessor's argument is the command instance — TypeScript infers\n * `c.name` is a string and the field type-checks against that. Arbitrary\n * non-field children (custom layout, additional text, decorative elements)\n * are rendered as plain content.\n *\n * ## Typed dialog host usage\n *\n * Combine with `useDialog<CommandResult<TResponse>>()` from\n * `@cratis/arc.react/dialogs` to get a fully-typed result at the call site:\n *\n * ```tsx\n * import { useDialog, DialogResult } from '@cratis/arc.react/dialogs';\n * import { CommandDialog } from '@cratis/components/CommandDialog';\n * import { RegisterAuthor } from './RegisterAuthor'; // proxy from C#\n *\n * type RegisterAuthorResponse = { authorId: string };\n *\n * const RegisterAuthorDialog = () => {\n * const { closeDialog } = useDialogContext<CommandResult<RegisterAuthorResponse>>();\n * return (\n * <CommandDialog<RegisterAuthor, RegisterAuthorResponse>\n * command={RegisterAuthor}\n * title=\"Register author\"\n * okLabel=\"Register\"\n * onSuccess={(response) => closeDialog(DialogResult.Ok)}\n * onCancel={() => closeDialog(DialogResult.Cancelled)}>\n * <InputTextField value={c => c.name} title=\"Name\" />\n * <InputTextField value={c => c.email} title=\"Email\" />\n * </CommandDialog>\n * );\n * };\n * ```\n *\n * ## What's special vs. raw Dialog + CommandForm\n *\n * - Confirm wiring (`onConfirm` → `commandInstance.execute()`) is handled\n * internally; you only supply `onSuccess` / `onValidationFailure` / `onFailed`.\n * - The dialog's `isBusy` state tracks the in-flight command without manual\n * `useState`.\n * - Field error propagation from `CommandResult.validationResults` to the\n * form context is automatic.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n * @param props - {@link CommandDialogProps}.\n */\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(\n props: CommandDialogProps<TCommand, TResponse>,\n) => {\n const {\n title,\n subtitle,\n placement,\n closeIcon,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons = DialogButtons.OkCancel,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n onBeforeExecute,\n confirmBeforeExecute,\n className,\n pt,\n ptOptions,\n unstyled,\n children,\n ...commandFormProps\n } = props;\n\n const dialogProps = {\n title,\n subtitle,\n placement,\n closeIcon,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n className,\n pt,\n ptOptions,\n unstyled,\n } satisfies ForwardedDialogProps;\n\n return (\n <CommandForm<TCommand, TResponse> {...commandFormProps}>\n <CommandDialogWrapper<TCommand, TResponse>\n {...dialogProps}\n onSuccess={props.onSuccess}\n onValidationFailure={props.onValidationFailure}\n onFailed={props.onFailed}\n onException={props.onException}\n onUnauthorized={props.onUnauthorized}\n onBeforeExecute={onBeforeExecute}\n confirmBeforeExecute={confirmBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n );\n};\n\nconst CommandDialogColumnWrapper = ({ children }: { children: React.ReactNode }) => (\n <CommandForm.Column>{children}</CommandForm.Column>\n);\nmarkAsCommandFormColumn(CommandDialogColumnWrapper);\n\nCommandDialogComponent.Column = CommandDialogColumnWrapper;\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * See {@link CommandDialogComponent} for full documentation.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n */\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["_jsx"],"mappings":";;;;;;;;AAwEA,MAAM,oBAAoB,GAAG,CAA8C,EACvE,OAAO,EACP,OAAO,EACP,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,GAAG,WAAW,EASjB,KAAI;AACD,IAAA,MAAM,EACF,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EAAE,kBAAkB,GAC9B,GAAG,qBAAqB,EAAY;AACrC,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAY;AACtD,IAAA,MAAM,UAAU,GAAG,mBAAmB,CAClC,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,CACxF;AAED,IAAA,MAAM,aAAa,GAAG,YAAW;AAC7B,QAAA,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE;AACrC,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,KAAK;AAEzB,QAAA,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;AACnB,YAAA,MAAM,QAAQ,GAAG,MAAM,CAAC;AACxB,YAAA,IAAI,MAAM,CAAC,aAAa,EAAE;gBACtB,MAAM,WAAW,GAAG,MAAM,CAAC,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AY;QACZ,OAAO;QACP,WAAW;QACX,QAAQ;QACR,OAAO;QACP,WAAW;QACX,cAAc;QACd,OAAO;QACP,OAAO;QACP,SAAS;QACT,QAAQ;QACR,SAAS;QACT,EAAE;QACF,SAAS;QACT,QAAQ;KACoB;IAEhC,QACIA,GAAA,CAAC,WAAW,EAAA,EAAA,GAA0B,gBAAgB,YAClDA,GAAA,CAAC,oBAAoB,EAAA,EAAA,GACb,WAAW,EACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,oBAAoB,EAAA,QAAA,EAEzC,QAAQ,EAAA,CACU,EAAA,CACb;AAEtB,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,EAAE,QAAQ,EAAiC,MAC3EA,GAAA,CAAC,WAAW,CAAC,MAAM,cAAE,QAAQ,EAAA,CAAsB,CACtD;AACD,uBAAuB,CAAC,0BAA0B,CAAC;AAEnD,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAcnD,MAAM,aAAa,GAAG;;"}
|
|
1
|
+
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.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 { DialogButtons, DialogResult } from '@cratis/arc.react/dialogs';\nimport { Dialog, type DialogProps } from '../Dialogs/Dialog';\nimport React from 'react';\nimport {\n CommandForm,\n CommandFormFieldWrapper,\n useCommandFormContext,\n useCommandInstance,\n type CommandFormProps,\n} from '@cratis/arc.react/commands';\nimport type { BeforeExecuteCallback } from './applyBeforeExecute';\nimport type { ConfirmBeforeExecute } from './confirmBeforeExecute';\nimport { useCommandExecution } from './useCommandExecution';\nimport {\n isCommandFormField,\n markAsCommandFormColumn,\n} from '../CommandForm/commandFormMarkers';\n\n/**\n * Props for {@link CommandDialog}. Combines the props of a `CommandForm`\n * (`command`, `initialValues`, `onSuccess`, `onValidationFailure`, `onFailed`,\n * `onBeforeExecute`, etc.) with the props of a {@link Dialog} (`title`,\n * `buttons`, `width`, `pt`, `unstyled`, …). Dialog presentation props\n * such as `subtitle`, `placement`, and `closeIcon` are forwarded to the dialog.\n *\n * @typeParam TCommand - The command record type (must extend `object`).\n * @typeParam TResponse - The response payload type returned by a successful command. Defaults to `object`.\n */\nexport interface CommandDialogProps<TCommand extends object, TResponse = object>\n extends\n Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>,\n Omit<DialogProps, 'children' | 'isBusy'> {\n /**\n * A transformer invoked with the current command values immediately before\n * the command executes on confirm. It **must return** the values to run with\n * (mutated or not) — a callback that returns nothing does not execute the\n * command with `undefined`; the current values are kept and a warning is\n * logged. May be async.\n *\n * ⚠️ It runs **only on submit**, after the form has already been validated,\n * so a value produced here can never satisfy required-field validation — the\n * submit button stays disabled if a required value is only seeded here. Seed\n * required values through `initialValues`; reserve `onBeforeExecute` for\n * transforms that do not affect validity (for example a generated id).\n */\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n\n /**\n * Ask whether to run the command after validation and `onBeforeExecute`.\n * Receives the transformed values. Only `true` executes; all other outcomes\n * keep the dialog open. May return a promise (for example from a confirmation dialog).\n * If command values change while confirmation is pending, execution is skipped\n * and the dialog stays open; confirm the new values again.\n * Unlike `onConfirm`, this runs before execution, not after success.\n */\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n\n /**\n * Form fields and arbitrary content for the dialog body. Children that are\n * `CommandFormField` instances are automatically wrapped so they bind to\n * the command instance.\n */\n children?: React.ReactNode;\n}\n\n// Requiring each key here makes a newly added Dialog prop fail compilation until it is routed.\ntype ForwardedDialogProps = Omit<DialogProps, 'children' | 'isBusy'> &\n Record<keyof Omit<DialogProps, 'children' | 'isBusy'>, unknown>;\n\nconst CommandDialogWrapper = <TCommand extends object, TResponse = object>({\n isValid,\n onClose,\n onConfirm,\n onSuccess,\n onValidationFailure,\n onFailed,\n onException,\n onUnauthorized,\n onBeforeExecute,\n confirmBeforeExecute,\n children,\n ...dialogProps\n}: Omit<DialogProps, 'isBusy'> & {\n onSuccess?: CommandFormProps<TCommand, TResponse>['onSuccess'];\n onValidationFailure?: CommandFormProps<TCommand, TResponse>['onValidationFailure'];\n onFailed?: CommandFormProps<TCommand, TResponse>['onFailed'];\n onException?: CommandFormProps<TCommand, TResponse>['onException'];\n onUnauthorized?: CommandFormProps<TCommand, TResponse>['onUnauthorized'];\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n}) => {\n const {\n setCommandValues,\n setCommandResult,\n isValid: isCommandFormValid,\n } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n const submission = useCommandExecution<TCommand, TResponse>(\n commandInstance, setCommandValues, onBeforeExecute, confirmBeforeExecute, onException,\n );\n\n const handleConfirm = async () => {\n const result = await submission.run();\n if (!result) return false;\n\n if (!result.isSuccess) {\n await onFailed?.(result);\n if (result.hasExceptions) {\n await onException?.(result.exceptionMessages, result.exceptionStackTrace);\n }\n if (!result.isAuthorized) await onUnauthorized?.();\n if (!result.isValid) {\n await onValidationFailure?.(result.validationResults);\n }\n if (submission.isMounted()) setCommandResult(result);\n return false;\n }\n\n await onSuccess?.(result.response as TResponse);\n if (onConfirm) {\n const closeResult = await onConfirm();\n return closeResult === true;\n }\n if (onClose) {\n const closeResult = await onClose(DialogResult.Ok);\n return closeResult !== false;\n }\n return true;\n };\n\n const processChildren = (nodes: React.ReactNode): React.ReactNode => {\n return React.Children.map(nodes, (child) => {\n if (!React.isValidElement(child)) return child;\n\n const component = child.type as React.ComponentType<unknown>;\n if (isCommandFormField(component)) {\n type FieldElement = Parameters<\n typeof CommandFormFieldWrapper\n >[0]['field'];\n // SAFETY: isCommandFormField guards that child.type is a command form field component.\n return (\n <CommandFormFieldWrapper field={child as unknown as FieldElement} />\n );\n }\n\n const childProps = child.props as Record<string, unknown>;\n // A function child is a render prop, not a node: mapping it would replace the\n // function with its mapped result and break the component that calls it.\n if (childProps.children != null && typeof childProps.children !== 'function') {\n return React.cloneElement(\n child as React.ReactElement<Record<string, unknown>>,\n {\n children: processChildren(childProps.children as React.ReactNode),\n },\n );\n }\n\n return child;\n });\n };\n\n const processedChildren = processChildren(children);\n const isDialogValid = isValid !== false && isCommandFormValid;\n\n return (\n <Dialog\n {...dialogProps}\n onClose={onClose}\n onConfirm={handleConfirm}\n isValid={isDialogValid}\n isBusy={submission.isSubmitting}\n >\n <div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>\n {processedChildren}\n </div>\n </Dialog>\n );\n};\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * ## Where `TCommand` comes from\n *\n * `TCommand` is an auto-generated TypeScript class produced by the Arc proxy\n * generator from a C# `[Command]` record. `dotnet build` writes a `.ts` file\n * per command with the right property types and a typed `execute()` method;\n * importing the class is all the connection-to-the-backend you need. The\n * class also exposes a `.use()` hook for direct (non-dialog) usage and a\n * `useWithChangeTracking()` variant.\n *\n * ## What happens on confirm\n *\n * 1. If `onBeforeExecute` is supplied, it transforms the command values.\n * Used for generated IDs (`Guid.create()`) that the user did not type in.\n * 2. The command's `execute()` runs through Arc's command pipeline. The\n * backend handler returns either a typed response (mapped to `TResponse`)\n * or a `ValidationResult[]`.\n * 3. On `IsSuccess: true`, `onSuccess(response)` fires and the dialog closes\n * through the dialog host context.\n * 4. On a validation failure, `onValidationFailure(errors)` fires and the\n * form's per-field error display is updated. The dialog stays open.\n * 5. On a domain or transport failure, `onFailed(result)` fires. The dialog\n * stays open and the `CommandResult` is set on the form context so the\n * UI can surface the error to the user.\n *\n * Throughout, the dialog is in the `isBusy` state — the confirm button keeps\n * focus but is `aria-disabled` and ignores activation, the other action\n * buttons are disabled, and the confirm button shows a spinner.\n *\n * ## Destructive commands and initial focus\n *\n * The confirm button is focused when the dialog opens, and a focused native\n * button fires `click` from the `keydown` of `Enter`. A command whose form\n * has required fields is protected from a held or double-tapped `Enter` for\n * free, because `isCommandFormValid` keeps confirm disabled until something\n * is filled in. A command that takes **no** input — the typical \"delete\n * this, permanently\" command — has no such gate, so its confirm button is\n * armed the instant the dialog appears.\n *\n * Pass `initialFocus` (forwarded straight to {@link Dialog}) for those:\n *\n * ```tsx\n * <CommandDialog<DeletePerson>\n * command={DeletePerson}\n * title=\"Delete personal data?\"\n * okLabel=\"Delete\"\n * initialFocus={DialogInitialFocus.Cancel}\n * onSuccess={() => closeDialog(DialogResult.Ok)}>\n * This cannot be undone.\n * </CommandDialog>\n * ```\n *\n * Everything else — the footer, the close (X), `Escape`, and the confirm\n * wiring that runs the command — is untouched.\n *\n * ## Field binding\n *\n * Children that are `CommandFormField` instances (`InputTextField`,\n * `NumberField`, `DropdownField`, every `@cratis/components/CommandForm/fields`\n * widget) bind to a property on the command via the `value` accessor:\n *\n * ```tsx\n * <InputTextField value={c => c.name} title=\"Name\" />\n * ```\n *\n * The accessor's argument is the command instance — TypeScript infers\n * `c.name` is a string and the field type-checks against that. Arbitrary\n * non-field children (custom layout, additional text, decorative elements)\n * are rendered as plain content.\n *\n * ## Typed dialog host usage\n *\n * Combine with `useDialog<CommandResult<TResponse>>()` from\n * `@cratis/arc.react/dialogs` to get a fully-typed result at the call site:\n *\n * ```tsx\n * import { useDialog, DialogResult } from '@cratis/arc.react/dialogs';\n * import { CommandDialog } from '@cratis/components/CommandDialog';\n * import { RegisterAuthor } from './RegisterAuthor'; // proxy from C#\n *\n * type RegisterAuthorResponse = { authorId: string };\n *\n * const RegisterAuthorDialog = () => {\n * const { closeDialog } = useDialogContext<CommandResult<RegisterAuthorResponse>>();\n * return (\n * <CommandDialog<RegisterAuthor, RegisterAuthorResponse>\n * command={RegisterAuthor}\n * title=\"Register author\"\n * okLabel=\"Register\"\n * onSuccess={(response) => closeDialog(DialogResult.Ok)}\n * onCancel={() => closeDialog(DialogResult.Cancelled)}>\n * <InputTextField value={c => c.name} title=\"Name\" />\n * <InputTextField value={c => c.email} title=\"Email\" />\n * </CommandDialog>\n * );\n * };\n * ```\n *\n * ## What's special vs. raw Dialog + CommandForm\n *\n * - Confirm wiring (`onConfirm` → `commandInstance.execute()`) is handled\n * internally; you only supply `onSuccess` / `onValidationFailure` / `onFailed`.\n * - The dialog's `isBusy` state tracks the in-flight command without manual\n * `useState`.\n * - Field error propagation from `CommandResult.validationResults` to the\n * form context is automatic.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n * @param props - {@link CommandDialogProps}.\n */\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(\n props: CommandDialogProps<TCommand, TResponse>,\n) => {\n const {\n title,\n subtitle,\n placement,\n closeIcon,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons = DialogButtons.OkCancel,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n onBeforeExecute,\n confirmBeforeExecute,\n className,\n pt,\n ptOptions,\n unstyled,\n children,\n ...commandFormProps\n } = props;\n\n const dialogProps = {\n title,\n subtitle,\n placement,\n closeIcon,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n className,\n pt,\n ptOptions,\n unstyled,\n } satisfies ForwardedDialogProps;\n\n return (\n <CommandForm<TCommand, TResponse> {...commandFormProps}>\n <CommandDialogWrapper<TCommand, TResponse>\n {...dialogProps}\n onSuccess={props.onSuccess}\n onValidationFailure={props.onValidationFailure}\n onFailed={props.onFailed}\n onException={props.onException}\n onUnauthorized={props.onUnauthorized}\n onBeforeExecute={onBeforeExecute}\n confirmBeforeExecute={confirmBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n );\n};\n\nconst CommandDialogColumnWrapper = ({ children }: { children: React.ReactNode }) => (\n <CommandForm.Column>{children}</CommandForm.Column>\n);\nmarkAsCommandFormColumn(CommandDialogColumnWrapper);\n\nCommandDialogComponent.Column = CommandDialogColumnWrapper;\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * See {@link CommandDialogComponent} for full documentation.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n */\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["_jsx"],"mappings":";;;;;;;;AAwEA,MAAM,oBAAoB,GAAG,CAA8C,EACvE,OAAO,EACP,OAAO,EACP,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,GAAG,WAAW,EASjB,KAAI;AACD,IAAA,MAAM,EACF,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EAAE,kBAAkB,GAC9B,GAAG,qBAAqB,EAAY;AACrC,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAY;AACtD,IAAA,MAAM,UAAU,GAAG,mBAAmB,CAClC,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,CACxF;AAED,IAAA,MAA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,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,eAAe,EACf,oBAAoB,EACpB,SAAS,EACT,EAAE,EACF,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,gBAAgB,EACtB,GAAG,KAAK;AAET,IAAA,MAAM,WAAW,GAAG;QAChB,KAAK;QACL,QAAQ;QACR,SAAS;QACT,SAAS;QACT,OAAO;QACP,KAAK;QACL,KAAK;QACL,YAAY;QACZ,SAAS;QACT,OAAO;QACP,YAAY;QACZ,OAAO;QACP,WAAW;QACX,QAAQ;QACR,OAAO;QACP,WAAW;QACX,cAAc;QACd,OAAO;QACP,OAAO;QACP,SAAS;QACT,QAAQ;QACR,SAAS;QACT,EAAE;QACF,SAAS;QACT,QAAQ;KACoB;IAEhC,QACIA,GAAA,CAAC,WAAW,EAAA,EAAA,GAA0B,gBAAgB,YAClDA,GAAA,CAAC,oBAAoB,EAAA,EAAA,GACb,WAAW,EACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,oBAAoB,EAAA,QAAA,EAEzC,QAAQ,EAAA,CACU,EAAA,CACb;AAEtB,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,EAAE,QAAQ,EAAiC,MAC3EA,GAAA,CAAC,WAAW,CAAC,MAAM,cAAE,QAAQ,EAAA,CAAsB,CACtD;AACD,uBAAuB,CAAC,0BAA0B,CAAC;AAEnD,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAcnD,MAAM,aAAa,GAAG;;"}
|
|
@@ -62,6 +62,12 @@ export interface CratisDialogMessages {
|
|
|
62
62
|
no?: string;
|
|
63
63
|
/** Accessible name for the header close (×) action. */
|
|
64
64
|
close?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Polite announcement made when a confirm is refused and the dialog stays open
|
|
67
|
+
* (validation failure or business rule). Defaults to
|
|
68
|
+
* 'The action was not completed. Review the dialog and try again.'
|
|
69
|
+
*/
|
|
70
|
+
refused?: string;
|
|
65
71
|
}
|
|
66
72
|
/** Localizable navigation labels owned by {@link CommandStepper} / {@link StepperCommandDialog}. */
|
|
67
73
|
export interface CratisStepperMessages {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CratisComponentsProvider.d.ts","sourceRoot":"","sources":["../../../Common/CratisComponentsProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,6BAA0B,CAAC;AAEtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,yBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAgC,CAAC;AAM/E,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA2C,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA0C,CAAC;AAErF,wDAAwD;AACxD,MAAM,WAAW,uBAAuB;IACpC,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAChC,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,sEAAsE;AACtE,MAAM,WAAW,wBAAwB;IACrC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,2EAA2E;AAC3E,MAAM,WAAW,sBAAsB;IACnC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACjC,2EAA2E;IAC3E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"CratisComponentsProvider.d.ts","sourceRoot":"","sources":["../../../Common/CratisComponentsProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,6BAA0B,CAAC;AAEtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,yBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAgC,CAAC;AAM/E,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA2C,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA0C,CAAC;AAErF,wDAAwD;AACxD,MAAM,WAAW,uBAAuB;IACpC,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AE,QAAQ,GAAG,SAAS,CAAC;IACnC,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;IAC9C;;;OAGG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,2BAA2B;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,UAC7B,sBAAsB,GAAG,SAAS,KAC1C,sBAIF,CAAC;AAoEF,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,6GASlC,6BAA6B,gCAyB/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CratisComponentsProvider.js","sources":["../../../Common/CratisComponentsProvider.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 { useMemo, type ReactNode } from 'react';\nimport { I18nProvider } from 'react-aria-components/I18nProvider';\nimport { merge } from 'ts-deepmerge';\nimport { Toaster, type ToasterProps } from '../Notifications/Toaster';\nimport { unstable_RendererRoot } from '../renderer/RendererContext';\nimport type { CratisRendererSetup, unstable_UiLibrary } from '../renderer/manifest';\nimport type { CratisOverlayEnvironment } from '../renderer/overlayEnvironment';\nimport { CratisComponentsContext } from '../configuration/CratisComponentsContext';\nimport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\n\nconst RendererRoot = unstable_RendererRoot;\n\nexport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\nexport { useCratisComponentsConfig } from '../configuration/CratisComponentsContext';\n\n/** Localizable labels owned by the Cratis paginator. */\nexport interface CratisPaginatorMessages {\n /** Pagination navigation-region name. */\n navigation?: string;\n /** First-page action label. */\n first?: string;\n /** Previous-page action label. */\n previous?: string;\n /** Next-page action label. */\n next?: string;\n /** Last-page action label. */\n last?: string;\n /** Builds a numbered page button's accessible name from its one-based page number. */\n page?: (page: number) => string;\n /** Accessible name for the numbered-page group. */\n pages?: string;\n}\n\n/** Localizable labels owned by the Cratis date picker composition. */\nexport interface CratisDatePickerMessages {\n /** Today action label. */\n today?: string;\n /** Clear action label. */\n clear?: string;\n /** Calendar-trigger label. */\n openCalendar?: string;\n /** Previous-month action label. */\n previousMonth?: string;\n /** Next-month action label. */\n nextMonth?: string;\n /**\n * Accessible name for the segmented date input when neither an explicit\n * `aria-label` nor a `placeholder` is supplied. Previously an orphaned\n * `'Date'` literal with no override path.\n */\n label?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Dropdown} composition. */\nexport interface CratisDropdownMessages {\n /** Accessible name for the options-popover trigger. */\n showOptions?: string;\n /** Accessible name for the clear-selection action. */\n clearSelection?: string;\n}\n\n/**\n * Localizable action and dismissal labels shared by every Cratis-owned dialog\n * surface — {@link Dialog}, {@link CommandDialog}, and {@link StepperCommandDialog}.\n */\nexport interface CratisDialogMessages {\n /** Primary confirmation label (the `Ok` action in `DialogButtons.Ok*`). */\n ok?: string;\n /** Cancellation label (the `Cancel` action, and the Stepper footer Cancel). */\n cancel?: string;\n /** Affirmative label (the `Yes` action in `DialogButtons.YesNo*`). */\n yes?: string;\n /** Negative label (the `No` action in `DialogButtons.YesNo*`). */\n no?: string;\n /** Accessible name for the header close (×) action. */\n close?: string;\n}\n\n/** Localizable navigation labels owned by {@link CommandStepper} / {@link StepperCommandDialog}. */\nexport interface CratisStepperMessages {\n /** Advance-to-next-step action label. */\n next?: string;\n /** Return-to-previous-step action label. */\n previous?: string;\n /** Final-step submit action label. */\n submit?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toaster}. */\nexport interface CratisNotificationsMessages {\n /** Accessible name for a toast's dismiss action. */\n dismiss?: string;\n /** Accessible name for the toast region landmark. */\n region?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link DataTableCore} composition. */\nexport interface CratisDataTableMessages {\n /** Accessible name for a single-selection row control. */\n selectRow?: string;\n /** Accessible name for the select-all control in a multiple-selection header. */\n selectAllRows?: string;\n /** Placeholder for the loaded-page search input. */\n search?: string;\n /** Accessible name for the loaded-page search input. */\n searchAriaLabel?: string;\n /** Message shown while loading an empty table. */\n loading?: string;\n /** Message shown when a query fails. */\n failed?: string;\n /** Message shown when a query denies access. */\n unauthorized?: string;\n /** Message shown when a search or filter leaves no rows on the loaded page. */\n filteredEmpty?: string;\n /** Message shown when a search or filter leaves no rows in server mode. */\n filteredEmptyServer?: string;\n}\n\n/** Localizable accessible names for the Cratis filter panel and its searches. */\nexport interface CratisFilterMessages {\n /** FilterPanel dialog name. Defaults to 'Filters'. */\n label?: string;\n /**\n * Search-input name for FilterPanel, its option groups, and standalone CheckboxListFilter.\n * Unset by default so an effective search placeholder retains precedence over 'Search'.\n * PivotViewer supplies group-specific names instead of using this shared name for its groups.\n */\n searchAriaLabel?: string;\n}\n\n/** Localizable labels owned by the Cratis column-filter popup. */\nexport interface CratisColumnFilterMessages {\n /** Builds the filter-trigger accessible name from the effective field. */\n filterTriggerAriaLabel?: (field: string) => string;\n /** Builds the value-control accessible name from the effective field. */\n valueAriaLabel?: (field: string) => string;\n /** Accessible name for the match-mode selector. */\n matchModeAriaLabel?: string;\n /** Localizes a match mode while retaining its default label as fallback input. */\n matchModeLabel?: (mode: string, defaultLabel: string) => string;\n /** Clear action label. */\n clear?: string;\n /** Apply action label. */\n apply?: string;\n /** Boolean true option label. */\n true?: string;\n /** Boolean false option label. */\n false?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toolbar} composition. */\nexport interface CratisToolbarMessages {\n /** Accessible toolbar name used when neither `aria-label` nor `aria-labelledby` is supplied. */\n label?: string;\n /** Accessible name of the close button in a drawer {@link ToolbarFolder}. Defaults to 'Close'. */\n closeDrawer?: string;\n}\n\n/** Components-owned message groups. */\nexport interface CratisComponentsMessages {\n /** Paginator labels. */\n paginator?: CratisPaginatorMessages;\n /** Date-picker labels. */\n datePicker?: CratisDatePickerMessages;\n /** Dropdown labels. */\n dropdown?: CratisDropdownMessages;\n /** Dialog action/dismissal labels shared by Dialog, CommandDialog, and StepperCommandDialog. */\n dialog?: CratisDialogMessages;\n /** Stepper navigation labels shared by CommandStepper and StepperCommandDialog. */\n stepper?: CratisStepperMessages;\n /** Toaster labels. */\n notifications?: CratisNotificationsMessages;\n /** DataTable search, selection, and query-state messages. */\n dataTable?: CratisDataTableMessages;\n /** FilterPanel dialog and search-input accessible names. */\n filter?: CratisFilterMessages;\n /** Column-filter popup labels and match-mode copy. */\n columnFilter?: CratisColumnFilterMessages;\n /** Toolbar accessible-name fallback. */\n toolbar?: CratisToolbarMessages;\n}\n\n/**\n * Components-owned icon vocabulary. Every name is a concept the library draws in more than one\n * place; registering one replaces that concept's built-in glyph everywhere it is drawn, without\n * touching the surrounding element, its part, or its accessible name.\n *\n * Resolution per site is `per-component prop → provider icon → built-in glyph`: a named prop such\n * as `Dialog`'s `closeIcon` means \"this one call site\" and keeps winning, while the provider\n * replaces the built-in default for the whole product. Registering nothing renders exactly what the\n * library renders today, because the built-in glyph stays at its call site and is never part of\n * {@link cratisDefaults}.\n *\n * A name registered as `null` draws no glyph while the button, its part, and its accessible name\n * remain — the same meaning `closeIcon={null}` already has.\n */\nexport interface CratisComponentsIcons {\n /** Dismissal mark. Drawn by `Dialog`'s header close, `Toaster`'s dismiss, `ChatSidebar`, the `Chat` panel, and the PivotViewer detail panel. Defaults to `×`. */\n close?: ReactNode;\n /** Remove-this-value mark. Drawn by `TagGroup`'s tag remove, `Chip`'s remove control, and `CommandForm`'s chips field. Defaults to `×`. */\n remove?: ReactNode;\n /** Expand/collapse chevron on a closed-by-default surface. Drawn by `Dropdown`'s trigger and `ComboBox`'s trigger. Defaults to `⌄` (`▾` in `ComboBox`). */\n expand?: ReactNode;\n /** Ascending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▲`. */\n sortAscending?: ReactNode;\n /** Descending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▼`. */\n sortDescending?: ReactNode;\n /** Step-backwards mark. Drawn by `TablePaginator`'s previous page and the date picker's previous month. Defaults to `‹`. */\n previous?: ReactNode;\n /** Step-forwards mark. Drawn by `TablePaginator`'s next page and the date picker's next month. Defaults to `›`. */\n next?: ReactNode;\n /** Clear-the-current-value mark. Drawn by `Dropdown`'s clear-selection action and the PivotViewer filter panel's clear action. Defaults to `×`. */\n clear?: ReactNode;\n}\n\ninterface LegacyLocaleMessages {\n today?: string;\n clear?: string;\n aria?: {\n navigation?: string;\n firstPageLabel?: string;\n prevPageLabel?: string;\n nextPageLabel?: string;\n lastPageLabel?: string;\n };\n [message: string]: unknown;\n}\n\n/** Renderer-independent application configuration for Components. */\nexport interface CratisComponentsConfig {\n /** BCP 47 locale used by React Aria for dates, numbers, and interaction announcements. */\n locale?: string;\n /** Cratis-owned labels not supplied by the platform's internationalization APIs. */\n messages?: CratisComponentsMessages;\n /** Cratis-owned icon vocabulary replacing the built-in glyphs the library draws. */\n icons?: CratisComponentsIcons;\n /**\n * @deprecated Use {@link messages}; React Aria supplies its own locale data.\n */\n locales?: Record<string, LegacyLocaleMessages>;\n}\n\n/** Props for the application-root Components provider. */\nexport interface CratisComponentsProviderProps {\n /** Locale and Components-owned messages. */\n value?: CratisComponentsConfig;\n /** Mounts the global toaster with defaults or explicit options. */\n toaster?: boolean | ToasterProps;\n /**\n * Selects one stable presentation library. The broader generic manifest and ordered,\n * last-wins composition form remain experimental.\n */\n library?: unstable_UiLibrary | readonly unstable_UiLibrary[];\n /** Experimental profile-promise behavior. Defaults to strict. */\n libraryMode?: 'strict' | 'degrade';\n /** Terminal slot fallback behavior. Defaults to the built-in Core implementation. */\n rendererFallback?: 'core' | 'throw';\n /** Host environment for overlay portal containers. */\n overlayEnvironment?: CratisOverlayEnvironment;\n /**\n * Non-secret renderer setup attestations. Values are booleans so credentials and license\n * tokens never cross the Components provider boundary.\n */\n rendererSetup?: CratisRendererSetup;\n /** Application content. */\n children: ReactNode;\n}\n\n/**\n * Deep-merges consumer configuration over {@link cratisDefaults}.\n *\n * `icons` merges by name only. An icon value is an opaque node — often a React element — so it is\n * carried over by identity instead of being deep-merged into, while a partial map still leaves every\n * unregistered name to its built-in glyph.\n */\nexport const mergeCratisComponentsConfig = (\n value: CratisComponentsConfig | undefined,\n): CratisComponentsConfig => {\n const { icons, ...rest } = value ?? {};\n const merged = merge(cratisDefaults, rest) as CratisComponentsConfig;\n return icons ? { ...merged, icons: { ...cratisDefaults.icons, ...icons } } : merged;\n};\n\nconst withLegacyLocaleMessages = (\n config: CratisComponentsConfig,\n explicitMessages: CratisComponentsMessages | undefined,\n): CratisComponentsConfig => {\n const legacy = config.locale ? config.locales?.[config.locale] : undefined;\n if (!legacy) return config;\n return {\n ...config,\n messages: {\n ...config.messages,\n paginator: {\n ...config.messages?.paginator,\n navigation:\n explicitMessages?.paginator?.navigation ??\n legacy.aria?.navigation ??\n config.messages?.paginator?.navigation,\n first:\n explicitMessages?.paginator?.first ??\n legacy.aria?.firstPageLabel ??\n config.messages?.paginator?.first,\n previous:\n explicitMessages?.paginator?.previous ??\n legacy.aria?.prevPageLabel ??\n config.messages?.paginator?.previous,\n next:\n explicitMessages?.paginator?.next ??\n legacy.aria?.nextPageLabel ??\n config.messages?.paginator?.next,\n last:\n explicitMessages?.paginator?.last ??\n legacy.aria?.lastPageLabel ??\n config.messages?.paginator?.last,\n },\n datePicker: {\n ...config.messages?.datePicker,\n today:\n explicitMessages?.datePicker?.today ??\n legacy.today ??\n config.messages?.datePicker?.today,\n clear:\n explicitMessages?.datePicker?.clear ??\n legacy.clear ??\n config.messages?.datePicker?.clear,\n openCalendar:\n explicitMessages?.datePicker?.openCalendar ??\n config.messages?.datePicker?.openCalendar,\n previousMonth:\n explicitMessages?.datePicker?.previousMonth ??\n config.messages?.datePicker?.previousMonth,\n nextMonth:\n explicitMessages?.datePicker?.nextMonth ??\n config.messages?.datePicker?.nextMonth,\n },\n },\n };\n};\n\nconst validLocale = (locale: string | undefined) => {\n if (!locale) return 'en-US';\n try {\n return new Intl.Locale(locale).toString();\n } catch {\n return 'en-US';\n }\n};\n\n/** Application root for locale, labels, and the optional app-wide toaster. */\nexport const CratisComponentsProvider = ({\n value,\n toaster,\n library,\n libraryMode,\n rendererFallback,\n overlayEnvironment,\n rendererSetup,\n children,\n}: CratisComponentsProviderProps) => {\n const resolved = useMemo(\n () =>\n withLegacyLocaleMessages(mergeCratisComponentsConfig(value), value?.messages),\n [value],\n );\n\n return (\n <RendererRoot\n library={library}\n libraryMode={libraryMode}\n rendererFallback={rendererFallback}\n overlayEnvironment={overlayEnvironment}\n rendererSetup={rendererSetup}\n >\n <CratisComponentsContext.Provider value={resolved}>\n <I18nProvider locale={validLocale(resolved.locale)}>\n {children}\n {toaster && (\n <Toaster {...(typeof toaster === 'object' ? toaster : {})} />\n )}\n </I18nProvider>\n </CratisComponentsContext.Provider>\n </RendererRoot>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAaA,MAAM,YAAY,GAAG,qBAAqB;AAyQnC,MAAM,2BAA2B,GAAG,CACvC,KAAyC,KACjB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,EAAE,IAAI,CAA2B;IACpE,OAAO,KAAK,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAAM;AACvF;AAEA,MAAM,wBAAwB,GAAG,CAC7B,MAA8B,EAC9B,gBAAsD,KAC9B;IACxB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS;AAC1E,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,MAAM;IAC1B,OAAO;AACH,QAAA,GAAG,MAAM;AACT,QAAA,QAAQ,EAAE;YACN,GAAG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,CAAC,MAAM,CAAC,EAAA,QAAA,EAAA,CAC7C,QAAQ,EACR,OAAO,KACJD,GAAA,CAAC,OAAO,QAAM,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,EAAE,CAAC,GAAI,CAChE,CAAA,EAAA,CACU,EAAA,CACgB,EAAA,CACxB;AAEvB;;"}
|
|
1
|
+
{"version":3,"file":"CratisComponentsProvider.js","sources":["../../../Common/CratisComponentsProvider.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 { useMemo, type ReactNode } from 'react';\nimport { I18nProvider } from 'react-aria-components/I18nProvider';\nimport { merge } from 'ts-deepmerge';\nimport { Toaster, type ToasterProps } from '../Notifications/Toaster';\nimport { unstable_RendererRoot } from '../renderer/RendererContext';\nimport type { CratisRendererSetup, unstable_UiLibrary } from '../renderer/manifest';\nimport type { CratisOverlayEnvironment } from '../renderer/overlayEnvironment';\nimport { CratisComponentsContext } from '../configuration/CratisComponentsContext';\nimport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\n\nconst RendererRoot = unstable_RendererRoot;\n\nexport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\nexport { useCratisComponentsConfig } from '../configuration/CratisComponentsContext';\n\n/** Localizable labels owned by the Cratis paginator. */\nexport interface CratisPaginatorMessages {\n /** Pagination navigation-region name. */\n navigation?: string;\n /** First-page action label. */\n first?: string;\n /** Previous-page action label. */\n previous?: string;\n /** Next-page action label. */\n next?: string;\n /** Last-page action label. */\n last?: string;\n /** Builds a numbered page button's accessible name from its one-based page number. */\n page?: (page: number) => string;\n /** Accessible name for the numbered-page group. */\n pages?: string;\n}\n\n/** Localizable labels owned by the Cratis date picker composition. */\nexport interface CratisDatePickerMessages {\n /** Today action label. */\n today?: string;\n /** Clear action label. */\n clear?: string;\n /** Calendar-trigger label. */\n openCalendar?: string;\n /** Previous-month action label. */\n previousMonth?: string;\n /** Next-month action label. */\n nextMonth?: string;\n /**\n * Accessible name for the segmented date input when neither an explicit\n * `aria-label` nor a `placeholder` is supplied. Previously an orphaned\n * `'Date'` literal with no override path.\n */\n label?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Dropdown} composition. */\nexport interface CratisDropdownMessages {\n /** Accessible name for the options-popover trigger. */\n showOptions?: string;\n /** Accessible name for the clear-selection action. */\n clearSelection?: string;\n}\n\n/**\n * Localizable action and dismissal labels shared by every Cratis-owned dialog\n * surface — {@link Dialog}, {@link CommandDialog}, and {@link StepperCommandDialog}.\n */\nexport interface CratisDialogMessages {\n /** Primary confirmation label (the `Ok` action in `DialogButtons.Ok*`). */\n ok?: string;\n /** Cancellation label (the `Cancel` action, and the Stepper footer Cancel). */\n cancel?: string;\n /** Affirmative label (the `Yes` action in `DialogButtons.YesNo*`). */\n yes?: string;\n /** Negative label (the `No` action in `DialogButtons.YesNo*`). */\n no?: string;\n /** Accessible name for the header close (×) action. */\n close?: string;\n /**\n * Polite announcement made when a confirm is refused and the dialog stays open\n * (validation failure or business rule). Defaults to\n * 'The action was not completed. Review the dialog and try again.'\n */\n refused?: string;\n}\n\n/** Localizable navigation labels owned by {@link CommandStepper} / {@link StepperCommandDialog}. */\nexport interface CratisStepperMessages {\n /** Advance-to-next-step action label. */\n next?: string;\n /** Return-to-previous-step action label. */\n previous?: string;\n /** Final-step submit action label. */\n submit?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toaster}. */\nexport interface CratisNotificationsMessages {\n /** Accessible name for a toast's dismiss action. */\n dismiss?: string;\n /** Accessible name for the toast region landmark. */\n region?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link DataTableCore} composition. */\nexport interface CratisDataTableMessages {\n /** Accessible name for a single-selection row control. */\n selectRow?: string;\n /** Accessible name for the select-all control in a multiple-selection header. */\n selectAllRows?: string;\n /** Placeholder for the loaded-page search input. */\n search?: string;\n /** Accessible name for the loaded-page search input. */\n searchAriaLabel?: string;\n /** Message shown while loading an empty table. */\n loading?: string;\n /** Message shown when a query fails. */\n failed?: string;\n /** Message shown when a query denies access. */\n unauthorized?: string;\n /** Message shown when a search or filter leaves no rows on the loaded page. */\n filteredEmpty?: string;\n /** Message shown when a search or filter leaves no rows in server mode. */\n filteredEmptyServer?: string;\n}\n\n/** Localizable accessible names for the Cratis filter panel and its searches. */\nexport interface CratisFilterMessages {\n /** FilterPanel dialog name. Defaults to 'Filters'. */\n label?: string;\n /**\n * Search-input name for FilterPanel, its option groups, and standalone CheckboxListFilter.\n * Unset by default so an effective search placeholder retains precedence over 'Search'.\n * PivotViewer supplies group-specific names instead of using this shared name for its groups.\n */\n searchAriaLabel?: string;\n}\n\n/** Localizable labels owned by the Cratis column-filter popup. */\nexport interface CratisColumnFilterMessages {\n /** Builds the filter-trigger accessible name from the effective field. */\n filterTriggerAriaLabel?: (field: string) => string;\n /** Builds the value-control accessible name from the effective field. */\n valueAriaLabel?: (field: string) => string;\n /** Accessible name for the match-mode selector. */\n matchModeAriaLabel?: string;\n /** Localizes a match mode while retaining its default label as fallback input. */\n matchModeLabel?: (mode: string, defaultLabel: string) => string;\n /** Clear action label. */\n clear?: string;\n /** Apply action label. */\n apply?: string;\n /** Boolean true option label. */\n true?: string;\n /** Boolean false option label. */\n false?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toolbar} composition. */\nexport interface CratisToolbarMessages {\n /** Accessible toolbar name used when neither `aria-label` nor `aria-labelledby` is supplied. */\n label?: string;\n /** Accessible name of the close button in a drawer {@link ToolbarFolder}. Defaults to 'Close'. */\n closeDrawer?: string;\n}\n\n/** Components-owned message groups. */\nexport interface CratisComponentsMessages {\n /** Paginator labels. */\n paginator?: CratisPaginatorMessages;\n /** Date-picker labels. */\n datePicker?: CratisDatePickerMessages;\n /** Dropdown labels. */\n dropdown?: CratisDropdownMessages;\n /** Dialog action/dismissal labels shared by Dialog, CommandDialog, and StepperCommandDialog. */\n dialog?: CratisDialogMessages;\n /** Stepper navigation labels shared by CommandStepper and StepperCommandDialog. */\n stepper?: CratisStepperMessages;\n /** Toaster labels. */\n notifications?: CratisNotificationsMessages;\n /** DataTable search, selection, and query-state messages. */\n dataTable?: CratisDataTableMessages;\n /** FilterPanel dialog and search-input accessible names. */\n filter?: CratisFilterMessages;\n /** Column-filter popup labels and match-mode copy. */\n columnFilter?: CratisColumnFilterMessages;\n /** Toolbar accessible-name fallback. */\n toolbar?: CratisToolbarMessages;\n}\n\n/**\n * Components-owned icon vocabulary. Every name is a concept the library draws in more than one\n * place; registering one replaces that concept's built-in glyph everywhere it is drawn, without\n * touching the surrounding element, its part, or its accessible name.\n *\n * Resolution per site is `per-component prop → provider icon → built-in glyph`: a named prop such\n * as `Dialog`'s `closeIcon` means \"this one call site\" and keeps winning, while the provider\n * replaces the built-in default for the whole product. Registering nothing renders exactly what the\n * library renders today, because the built-in glyph stays at its call site and is never part of\n * {@link cratisDefaults}.\n *\n * A name registered as `null` draws no glyph while the button, its part, and its accessible name\n * remain — the same meaning `closeIcon={null}` already has.\n */\nexport interface CratisComponentsIcons {\n /** Dismissal mark. Drawn by `Dialog`'s header close, `Toaster`'s dismiss, `ChatSidebar`, the `Chat` panel, and the PivotViewer detail panel. Defaults to `×`. */\n close?: ReactNode;\n /** Remove-this-value mark. Drawn by `TagGroup`'s tag remove, `Chip`'s remove control, and `CommandForm`'s chips field. Defaults to `×`. */\n remove?: ReactNode;\n /** Expand/collapse chevron on a closed-by-default surface. Drawn by `Dropdown`'s trigger and `ComboBox`'s trigger. Defaults to `⌄` (`▾` in `ComboBox`). */\n expand?: ReactNode;\n /** Ascending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▲`. */\n sortAscending?: ReactNode;\n /** Descending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▼`. */\n sortDescending?: ReactNode;\n /** Step-backwards mark. Drawn by `TablePaginator`'s previous page and the date picker's previous month. Defaults to `‹`. */\n previous?: ReactNode;\n /** Step-forwards mark. Drawn by `TablePaginator`'s next page and the date picker's next month. Defaults to `›`. */\n next?: ReactNode;\n /** Clear-the-current-value mark. Drawn by `Dropdown`'s clear-selection action and the PivotViewer filter panel's clear action. Defaults to `×`. */\n clear?: ReactNode;\n}\n\ninterface LegacyLocaleMessages {\n today?: string;\n clear?: string;\n aria?: {\n navigation?: string;\n firstPageLabel?: string;\n prevPageLabel?: string;\n nextPageLabel?: string;\n lastPageLabel?: string;\n };\n [message: string]: unknown;\n}\n\n/** Renderer-independent application configuration for Components. */\nexport interface CratisComponentsConfig {\n /** BCP 47 locale used by React Aria for dates, numbers, and interaction announcements. */\n locale?: string;\n /** Cratis-owned labels not supplied by the platform's internationalization APIs. */\n messages?: CratisComponentsMessages;\n /** Cratis-owned icon vocabulary replacing the built-in glyphs the library draws. */\n icons?: CratisComponentsIcons;\n /**\n * @deprecated Use {@link messages}; React Aria supplies its own locale data.\n */\n locales?: Record<string, LegacyLocaleMessages>;\n}\n\n/** Props for the application-root Components provider. */\nexport interface CratisComponentsProviderProps {\n /** Locale and Components-owned messages. */\n value?: CratisComponentsConfig;\n /** Mounts the global toaster with defaults or explicit options. */\n toaster?: boolean | ToasterProps;\n /**\n * Selects one stable presentation library. The broader generic manifest and ordered,\n * last-wins composition form remain experimental.\n */\n library?: unstable_UiLibrary | readonly unstable_UiLibrary[];\n /** Experimental profile-promise behavior. Defaults to strict. */\n libraryMode?: 'strict' | 'degrade';\n /** Terminal slot fallback behavior. Defaults to the built-in Core implementation. */\n rendererFallback?: 'core' | 'throw';\n /** Host environment for overlay portal containers. */\n overlayEnvironment?: CratisOverlayEnvironment;\n /**\n * Non-secret renderer setup attestations. Values are booleans so credentials and license\n * tokens never cross the Components provider boundary.\n */\n rendererSetup?: CratisRendererSetup;\n /** Application content. */\n children: ReactNode;\n}\n\n/**\n * Deep-merges consumer configuration over {@link cratisDefaults}.\n *\n * `icons` merges by name only. An icon value is an opaque node — often a React element — so it is\n * carried over by identity instead of being deep-merged into, while a partial map still leaves every\n * unregistered name to its built-in glyph.\n */\nexport const mergeCratisComponentsConfig = (\n value: CratisComponentsConfig | undefined,\n): CratisComponentsConfig => {\n const { icons, ...rest } = value ?? {};\n const merged = merge(cratisDefaults, rest) as CratisComponentsConfig;\n return icons ? { ...merged, icons: { ...cratisDefaults.icons, ...icons } } : merged;\n};\n\nconst withLegacyLocaleMessages = (\n config: CratisComponentsConfig,\n explicitMessages: CratisComponentsMessages | undefined,\n): CratisComponentsConfig => {\n const legacy = config.locale ? config.locales?.[config.locale] : undefined;\n if (!legacy) return config;\n return {\n ...config,\n messages: {\n ...config.messages,\n paginator: {\n ...config.messages?.paginator,\n navigation:\n explicitMessages?.paginator?.navigation ??\n legacy.aria?.navigation ??\n config.messages?.paginator?.navigation,\n first:\n explicitMessages?.paginator?.first ??\n legacy.aria?.firstPageLabel ??\n config.messages?.paginator?.first,\n previous:\n explicitMessages?.paginator?.previous ??\n legacy.aria?.prevPageLabel ??\n config.messages?.paginator?.previous,\n next:\n explicitMessages?.paginator?.next ??\n legacy.aria?.nextPageLabel ??\n config.messages?.paginator?.next,\n last:\n explicitMessages?.paginator?.last ??\n legacy.aria?.lastPageLabel ??\n config.messages?.paginator?.last,\n },\n datePicker: {\n ...config.messages?.datePicker,\n today:\n explicitMessages?.datePicker?.today ??\n legacy.today ??\n config.messages?.datePicker?.today,\n clear:\n explicitMessages?.datePicker?.clear ??\n legacy.clear ??\n config.messages?.datePicker?.clear,\n openCalendar:\n explicitMessages?.datePicker?.openCalendar ??\n config.messages?.datePicker?.openCalendar,\n previousMonth:\n explicitMessages?.datePicker?.previousMonth ??\n config.messages?.datePicker?.previousMonth,\n nextMonth:\n explicitMessages?.datePicker?.nextMonth ??\n config.messages?.datePicker?.nextMonth,\n },\n },\n };\n};\n\nconst validLocale = (locale: string | undefined) => {\n if (!locale) return 'en-US';\n try {\n return new Intl.Locale(locale).toString();\n } catch {\n return 'en-US';\n }\n};\n\n/** Application root for locale, labels, and the optional app-wide toaster. */\nexport const CratisComponentsProvider = ({\n value,\n toaster,\n library,\n libraryMode,\n rendererFallback,\n overlayEnvironment,\n rendererSetup,\n children,\n}: CratisComponentsProviderProps) => {\n const resolved = useMemo(\n () =>\n withLegacyLocaleMessages(mergeCratisComponentsConfig(value), value?.messages),\n [value],\n );\n\n return (\n <RendererRoot\n library={library}\n libraryMode={libraryMode}\n rendererFallback={rendererFallback}\n overlayEnvironment={overlayEnvironment}\n rendererSetup={rendererSetup}\n >\n <CratisComponentsContext.Provider value={resolved}>\n <I18nProvider locale={validLocale(resolved.locale)}>\n {children}\n {toaster && (\n <Toaster {...(typeof toaster === 'object' ? toaster : {})} />\n )}\n </I18nProvider>\n </CratisComponentsContext.Provider>\n </RendererRoot>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAaA,MAAM,YAAY,GAAG,qBAAqB;AA+QnC,MAAM,2BAA2B,GAAG,CACvC,KAAyC,KACjB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,EAAE,IAAI,CAA2B;IACpE,OAAO,KAAK,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAAM;AACvF;AAEA,MAAM,wBAAwB,GAAG,CAC7B,MAA8B,EAC9B,gBAAsD,KAC9B;IACxB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS;AAC1E,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,MAAM;IAC1B,OAAO;AACH,QAAA,GAAG,MAAM;AACT,QAAA,QAAQ,EAAE;YACN,GAAG,MAAM,CAAC,QAAQ;AAClB,YAAA,SAAS,EAAE;AACP,gBAAA,GAAG,MAAM,CAAC,QAAQ,EAAE,SAAS;AAC7B,gBAAA,UAAU,EACN,gBAAgB,EAAE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AG,EAAE,CAAC,GAAI,CAChE,CAAA,EAAA,CACU,EAAA,CACgB,EAAA,CACxB;AAEvB;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type React from 'react';
|
|
1
2
|
import type { DialogProps } from './Dialog.js';
|
|
2
3
|
/**
|
|
3
4
|
* A modal dialog with Arc host integration, typed footer actions, busy/validity
|
|
4
5
|
* state, controlled dismissal, and stable Cratis-owned styling parts.
|
|
5
6
|
*/
|
|
6
|
-
export declare const DialogImplementation: ({ title, subtitle, placement, closeIcon, visible, onClose, onConfirm, onCancel, buttons, initialFocus, children, width, style, contentStyle, isValid, isBusy, okLabel, cancelLabel, yesLabel, noLabel, closeAriaLabel, dismissable, className, pt, }: DialogProps) =>
|
|
7
|
+
export declare const DialogImplementation: ({ title, subtitle, placement, closeIcon, visible, onClose, onConfirm, onCancel, buttons, initialFocus, children, width, style, contentStyle, isValid, isBusy, okLabel, cancelLabel, yesLabel, noLabel, closeAriaLabel, dismissable, className, pt, }: DialogProps) => React.JSX.Element | null;
|
|
7
8
|
//# sourceMappingURL=DialogImplementation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogImplementation.d.ts","sourceRoot":"","sources":["../../../Dialogs/DialogImplementation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DialogImplementation.d.ts","sourceRoot":"","sources":["../../../Dialogs/DialogImplementation.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAU,CAAC;AAiC5C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,yPAyB9B,WAAW,6BAkdb,CAAC"}
|
|
@@ -16,6 +16,17 @@ import { classNames } from '../ClassNames/classNames.js';
|
|
|
16
16
|
import { openDialogTier, closeDialogTier, DIALOG_ZINDEX_TOKEN, dialogZIndexForTier } from '../renderer/dialogStack.js';
|
|
17
17
|
import { DialogStackContext } from '../renderer/DialogStackContext.js';
|
|
18
18
|
|
|
19
|
+
const visuallyHidden = {
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
width: 1,
|
|
22
|
+
height: 1,
|
|
23
|
+
margin: -1,
|
|
24
|
+
padding: 0,
|
|
25
|
+
overflow: 'hidden',
|
|
26
|
+
clipPath: 'inset(50%)',
|
|
27
|
+
whiteSpace: 'nowrap',
|
|
28
|
+
border: 0,
|
|
29
|
+
};
|
|
19
30
|
const subscribeToBrowserEnvironment = () => () => undefined;
|
|
20
31
|
const useIsBrowser = () => useSyncExternalStore(subscribeToBrowserEnvironment, () => true, () => false);
|
|
21
32
|
const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon, visible = true, onClose, onConfirm, onCancel, buttons = DialogButtons.OkCancel, initialFocus = DialogInitialFocus.Confirm, children, width = '450px', style, contentStyle, isValid, isBusy = false, okLabel, cancelLabel, yesLabel, noLabel, closeAriaLabel, dismissable, className, pt, }) => {
|
|
@@ -27,6 +38,8 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
27
38
|
const resolvedYesLabel = yesLabel ?? dialogMessages?.yes ?? 'Yes';
|
|
28
39
|
const resolvedNoLabel = noLabel ?? dialogMessages?.no ?? 'No';
|
|
29
40
|
const resolvedCloseAriaLabel = closeAriaLabel ?? dialogMessages?.close ?? 'Close';
|
|
41
|
+
const resolvedRefusedMessage = dialogMessages?.refused ??
|
|
42
|
+
'The action was not completed. Review the dialog and try again.';
|
|
30
43
|
const icon = useCratisIcon();
|
|
31
44
|
const resolvedCloseIcon = icon('close', '×', closeIcon);
|
|
32
45
|
let contextCloseDialog;
|
|
@@ -43,6 +56,9 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
43
56
|
const titleRef = useRef(null);
|
|
44
57
|
const confirmRef = useRef(null);
|
|
45
58
|
const cancelRef = useRef(null);
|
|
59
|
+
const [refusals, setRefusals] = useState(0);
|
|
60
|
+
const handledRefusals = useRef(0);
|
|
61
|
+
const [announcement, setAnnouncement] = useState(null);
|
|
46
62
|
const isDialogValid = isValid !== false;
|
|
47
63
|
const hasDismissingButton = typeof buttons === 'number' && buttons !== DialogButtons.Ok;
|
|
48
64
|
const resolvedInitialFocus = initialFocus === DialogInitialFocus.Cancel && !hasDismissingButton
|
|
@@ -75,8 +91,38 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
75
91
|
const frame = requestAnimationFrame(() => target?.focus());
|
|
76
92
|
return () => cancelAnimationFrame(frame);
|
|
77
93
|
}, [focusesConfirmButton, focusesDismissingButton, visible]);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!visible || !isBusy)
|
|
96
|
+
return;
|
|
97
|
+
setAnnouncement(null);
|
|
98
|
+
const active = document.activeElement;
|
|
99
|
+
if (active && active !== document.body)
|
|
100
|
+
return;
|
|
101
|
+
if (confirmRef.current) {
|
|
102
|
+
confirmRef.current.focus();
|
|
103
|
+
}
|
|
104
|
+
else if (titleRef.current) {
|
|
105
|
+
titleRef.current.tabIndex = -1;
|
|
106
|
+
titleRef.current.focus();
|
|
107
|
+
}
|
|
108
|
+
}, [isBusy, visible]);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (refusals === handledRefusals.current || isBusy)
|
|
111
|
+
return;
|
|
112
|
+
handledRefusals.current = refusals;
|
|
113
|
+
const confirm = confirmRef.current;
|
|
114
|
+
if (confirm && !confirm.disabled) {
|
|
115
|
+
confirm.focus();
|
|
116
|
+
}
|
|
117
|
+
else if (titleRef.current) {
|
|
118
|
+
titleRef.current.tabIndex = -1;
|
|
119
|
+
titleRef.current.focus();
|
|
120
|
+
}
|
|
121
|
+
setAnnouncement({ key: refusals, text: resolvedRefusedMessage });
|
|
122
|
+
}, [refusals, isBusy, resolvedRefusedMessage]);
|
|
78
123
|
const handleClose = async (result) => {
|
|
79
124
|
let shouldCloseThroughContext = true;
|
|
125
|
+
const isConfirming = result === DialogResult.Ok || result === DialogResult.Yes;
|
|
80
126
|
if (result === DialogResult.Ok || result === DialogResult.Yes) {
|
|
81
127
|
if (onConfirm) {
|
|
82
128
|
const closeResult = await onConfirm();
|
|
@@ -97,10 +143,22 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
97
143
|
}
|
|
98
144
|
if (shouldCloseThroughContext)
|
|
99
145
|
contextCloseDialog?.(result);
|
|
146
|
+
else if (isConfirming)
|
|
147
|
+
setRefusals((count) => count + 1);
|
|
100
148
|
};
|
|
101
149
|
const footerButton = (result, label, primary, focused) => (jsxs("button", { ...(primary ? pt?.confirm : pt?.cancel), type: 'button', className: classNames('cratis-dialog__button', primary
|
|
102
150
|
? 'cratis-dialog__button--primary'
|
|
103
|
-
: 'cratis-dialog__button--secondary', primary ? pt?.confirm?.className : pt?.cancel?.className), "data-cratis-part": primary ? 'confirm' : 'cancel', "data-disabled": (primary ? !isDialogValid || isBusy : isBusy) || undefined, "data-busy": isBusy || undefined, ref: primary ? confirmRef : focused ? cancelRef : undefined, onClick: () =>
|
|
151
|
+
: 'cratis-dialog__button--secondary', primary ? pt?.confirm?.className : pt?.cancel?.className), "data-cratis-part": primary ? 'confirm' : 'cancel', "data-disabled": (primary ? !isDialogValid || isBusy : isBusy) || undefined, "data-busy": isBusy || undefined, ref: primary ? confirmRef : focused ? cancelRef : undefined, onClick: () => {
|
|
152
|
+
if (isBusy)
|
|
153
|
+
return;
|
|
154
|
+
void handleClose(result);
|
|
155
|
+
}, onKeyDown: primary
|
|
156
|
+
? (event) => {
|
|
157
|
+
if (event.repeat && (event.key === 'Enter' || event.key === ' '))
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
}
|
|
160
|
+
: undefined, disabled: primary ? !isDialogValid : isBusy, autoFocus: focused, "aria-disabled": primary && isBusy ? true : undefined, "aria-busy": primary && isBusy ? true : undefined, children: [primary && isBusy && (jsx("span", { className: 'cratis-dialog__spinner', "aria-hidden": 'true' })), jsx("span", { children: label })] }, `${result}-${label}`));
|
|
161
|
+
const isFooterScopeBusy = isBusy && typeof buttons !== 'number';
|
|
104
162
|
const predefinedFooter = () => {
|
|
105
163
|
if (typeof buttons !== 'number')
|
|
106
164
|
return buttons;
|
|
@@ -117,7 +175,7 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
117
175
|
return null;
|
|
118
176
|
}
|
|
119
177
|
};
|
|
120
|
-
const dialogDocument = (jsx(DialogStackContext.Provider, { value: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN, children: jsx(Dialog, { className: 'cratis-dialog__document', "aria-describedby": hasSubtitle ? subtitleId : undefined, children: jsxs(Fragment, { children: [jsxs("header", { ...pt?.header, className: classNames('cratis-dialog__header', pt?.header?.className), style: pt?.header?.style, "data-cratis-part": 'header', children: [jsx(Heading, { ...pt?.title, slot: 'title', tabIndex: focusesTitle ? -1 : undefined, ref: titleRef, className: classNames('cratis-dialog__title', pt?.title?.className), style: pt?.title?.style, "data-cratis-part": 'title', children: title }), hasSubtitle && (jsx("p", { ...pt?.subtitle, id: subtitleId, className: classNames('cratis-dialog__subtitle', pt?.subtitle?.className), style: pt?.subtitle?.style, "data-cratis-part": 'subtitle', children: subtitle })), allowsDismissal && (jsx("button", { ...pt?.close, type: 'button', disabled: isBusy, className: classNames('cratis-dialog__close', pt?.close?.className), "data-cratis-part": 'close', "data-disabled": isBusy || undefined, "data-busy": isBusy || undefined, "aria-label": resolvedCloseAriaLabel, onClick: () => void handleClose(DialogResult.Cancelled), children: jsx("span", { "aria-hidden": 'true', children: resolvedCloseIcon }) }))] }), 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 }) }), buttons !== null && (jsx("footer", { ...pt?.footer, className: classNames('cratis-dialog__footer', pt?.footer?.className), style: pt?.footer?.style, "data-cratis-part": 'footer', children: jsx("fieldset", { className: 'cratis-dialog__busy-scope cratis-dialog__busy-scope--footer', "data-cratis-part": 'busy-scope', "data-busy": isBusy || undefined, disabled:
|
|
178
|
+
const dialogDocument = (jsx(DialogStackContext.Provider, { value: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN, children: jsx(Dialog, { className: 'cratis-dialog__document', "aria-describedby": hasSubtitle ? subtitleId : undefined, children: jsxs(Fragment, { children: [jsxs("header", { ...pt?.header, className: classNames('cratis-dialog__header', pt?.header?.className), style: pt?.header?.style, "data-cratis-part": 'header', children: [jsx(Heading, { ...pt?.title, slot: 'title', tabIndex: focusesTitle ? -1 : undefined, ref: titleRef, className: classNames('cratis-dialog__title', pt?.title?.className), style: pt?.title?.style, "data-cratis-part": 'title', children: title }), hasSubtitle && (jsx("p", { ...pt?.subtitle, id: subtitleId, className: classNames('cratis-dialog__subtitle', pt?.subtitle?.className), style: pt?.subtitle?.style, "data-cratis-part": 'subtitle', children: subtitle })), allowsDismissal && (jsx("button", { ...pt?.close, type: 'button', disabled: isBusy, className: classNames('cratis-dialog__close', pt?.close?.className), "data-cratis-part": 'close', "data-disabled": isBusy || undefined, "data-busy": isBusy || undefined, "aria-label": resolvedCloseAriaLabel, onClick: () => void handleClose(DialogResult.Cancelled), children: jsx("span", { "aria-hidden": 'true', children: resolvedCloseIcon }) }))] }), 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 }) }), buttons !== null && (jsx("footer", { ...pt?.footer, className: classNames('cratis-dialog__footer', pt?.footer?.className), style: pt?.footer?.style, "data-cratis-part": 'footer', children: jsx("fieldset", { className: 'cratis-dialog__busy-scope cratis-dialog__busy-scope--footer', "data-cratis-part": 'busy-scope', "data-busy": isBusy || undefined, disabled: isFooterScopeBusy, inert: isFooterScopeBusy, "aria-busy": isBusy || undefined, children: predefinedFooter() }) })), 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) })] }) }) }));
|
|
121
179
|
const dialogStyle = { width, ...pt?.root?.style, ...style };
|
|
122
180
|
if (!isBrowser) {
|
|
123
181
|
if (!visible)
|
|
@@ -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, useDialogContext } from '@cratis/arc.react/dialogs';\nimport { Dialog as AriaDialog, Heading } from 'react-aria-components/Dialog';\nimport { Modal, ModalOverlay } from 'react-aria-components/Modal';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport { useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { DialogInitialFocus } from './DialogInitialFocus';\nimport type { DialogProps } from './Dialog';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport {\n DIALOG_ZINDEX_TOKEN,\n closeDialogTier,\n dialogZIndexForTier,\n openDialogTier,\n} from '../renderer/dialogStack';\nimport { DialogStackContext } from '../renderer/DialogStackContext';\nimport { classNames } from '../ClassNames/classNames';\n\nconst subscribeToBrowserEnvironment = () => () => undefined;\nconst useIsBrowser = () =>\n useSyncExternalStore(\n subscribeToBrowserEnvironment,\n () => true,\n () => false,\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 = ({\n title,\n subtitle,\n placement = 'center',\n closeIcon,\n visible = true,\n onClose,\n onConfirm,\n onCancel,\n buttons = DialogButtons.OkCancel,\n initialFocus = DialogInitialFocus.Confirm,\n children,\n width = '450px',\n style,\n contentStyle,\n isValid,\n isBusy = false,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n closeAriaLabel,\n dismissable,\n className,\n pt,\n}: DialogProps) => {\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const { messages } = useCratisComponentsConfig();\n const dialogMessages = messages?.dialog;\n const resolvedOkLabel = okLabel ?? dialogMessages?.ok ?? 'Ok';\n const resolvedCancelLabel = cancelLabel ?? dialogMessages?.cancel ?? 'Cancel';\n const resolvedYesLabel = yesLabel ?? dialogMessages?.yes ?? 'Yes';\n const resolvedNoLabel = noLabel ?? dialogMessages?.no ?? 'No';\n const resolvedCloseAriaLabel = closeAriaLabel ?? dialogMessages?.close ?? 'Close';\n const icon = useCratisIcon();\n const resolvedCloseIcon = icon('close', '×', closeIcon);\n let contextCloseDialog: ((result: DialogResult) => void) | undefined;\n try {\n const context = useDialogContext();\n contextCloseDialog = context?.closeDialog;\n } catch {\n contextCloseDialog = undefined;\n }\n\n const isBrowser = useIsBrowser();\n const subtitleId = useId();\n const hasSubtitle = subtitle !== undefined && subtitle !== null && subtitle !== false;\n const titleRef = useRef<HTMLHeadingElement>(null);\n const confirmRef = useRef<HTMLButtonElement>(null);\n const cancelRef = useRef<HTMLButtonElement>(null);\n\n const isDialogValid = isValid !== false;\n const hasDismissingButton =\n typeof buttons === 'number' && buttons !== DialogButtons.Ok;\n const resolvedInitialFocus =\n initialFocus === DialogInitialFocus.Cancel && !hasDismissingButton\n ? DialogInitialFocus.Content\n : initialFocus;\n const focusesConfirmButton = resolvedInitialFocus === DialogInitialFocus.Confirm;\n const focusesDismissingButton = resolvedInitialFocus === DialogInitialFocus.Cancel;\n const focusesTitle = resolvedInitialFocus === DialogInitialFocus.Content;\n const allowsDismissal = dismissable ?? typeof buttons === 'number';\n const isDismissable = allowsDismissal && !isBusy;\n\n // Assigns this dialog a strictly increasing tier for as long as it is visible, so a second\n // dialog opened while this one is still open - from anywhere, not necessarily as a React\n // child of this one - stacks above it rather than colliding on the same static z-index.\n const [dialogTier, setDialogTier] = useState<number | null>(null);\n useLayoutEffect(() => {\n if (!visible) {\n setDialogTier(null);\n return;\n }\n const tier = openDialogTier();\n setDialogTier(tier);\n return () => closeDialogTier(tier);\n }, [visible]);\n const resolvedZIndex = dialogTier === null ? undefined : dialogZIndexForTier(dialogTier);\n\n useEffect(() => {\n if (!visible) return;\n const target = focusesConfirmButton\n ? confirmRef.current\n : focusesDismissingButton\n ? cancelRef.current\n : titleRef.current;\n const frame = requestAnimationFrame(() => target?.focus());\n return () => cancelAnimationFrame(frame);\n }, [focusesConfirmButton, focusesDismissingButton, visible]);\n\n const handleClose = async (result: DialogResult) => {\n let shouldCloseThroughContext = true;\n\n if (result === DialogResult.Ok || result === DialogResult.Yes) {\n if (onConfirm) {\n const closeResult = await onConfirm();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n } else if (onCancel) {\n const closeResult = await onCancel();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n\n if (shouldCloseThroughContext) contextCloseDialog?.(result);\n };\n\n const footerButton = (\n result: DialogResult,\n label: string,\n primary: boolean,\n focused: boolean,\n ) => (\n <button\n key={`${result}-${label}`}\n {...(primary ? pt?.confirm : pt?.cancel)}\n type='button'\n className={classNames(\n 'cratis-dialog__button',\n primary\n ? 'cratis-dialog__button--primary'\n : 'cratis-dialog__button--secondary',\n primary ? pt?.confirm?.className : pt?.cancel?.className,\n )}\n data-cratis-part={primary ? 'confirm' : 'cancel'}\n data-disabled={(primary ? !isDialogValid || isBusy : isBusy) || undefined}\n data-busy={isBusy || undefined}\n ref={primary ? confirmRef : focused ? cancelRef : undefined}\n onClick={() => void handleClose(result)}\n disabled={primary ? !isDialogValid || isBusy : isBusy}\n autoFocus={focused}\n aria-busy={primary && isBusy ? true : undefined}\n >\n {primary && isBusy && (\n <span className='cratis-dialog__spinner' aria-hidden='true' />\n )}\n <span>{label}</span>\n </button>\n );\n\n const predefinedFooter = () => {\n if (typeof buttons !== 'number') return buttons;\n\n switch (buttons) {\n case DialogButtons.Ok:\n return footerButton(\n DialogResult.Ok,\n resolvedOkLabel,\n true,\n focusesConfirmButton,\n );\n case DialogButtons.OkCancel:\n return (\n <>\n {footerButton(\n DialogResult.Ok,\n resolvedOkLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(\n DialogResult.Cancelled,\n resolvedCancelLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n case DialogButtons.YesNo:\n return (\n <>\n {footerButton(\n DialogResult.Yes,\n resolvedYesLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(\n DialogResult.No,\n resolvedNoLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n case DialogButtons.YesNoCancel:\n return (\n <>\n {footerButton(\n DialogResult.Yes,\n resolvedYesLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(DialogResult.No, resolvedNoLabel, false, false)}\n {footerButton(\n DialogResult.Cancelled,\n resolvedCancelLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n default:\n return null;\n }\n };\n\n const dialogDocument = (\n <DialogStackContext.Provider value={resolvedZIndex ?? DIALOG_ZINDEX_TOKEN}>\n <AriaDialog\n className='cratis-dialog__document'\n aria-describedby={hasSubtitle ? subtitleId : undefined}\n >\n <>\n <header\n {...pt?.header}\n className={classNames('cratis-dialog__header', pt?.header?.className)}\n style={pt?.header?.style}\n data-cratis-part='header'\n >\n <Heading\n {...pt?.title}\n slot='title'\n tabIndex={focusesTitle ? -1 : undefined}\n ref={titleRef}\n className={classNames(\n 'cratis-dialog__title',\n pt?.title?.className,\n )}\n style={pt?.title?.style}\n data-cratis-part='title'\n >\n {title}\n </Heading>\n {hasSubtitle && (\n <p\n {...pt?.subtitle}\n id={subtitleId}\n className={classNames(\n 'cratis-dialog__subtitle',\n pt?.subtitle?.className,\n )}\n style={pt?.subtitle?.style}\n data-cratis-part='subtitle'\n >\n {subtitle}\n </p>\n )}\n {allowsDismissal && (\n <button\n {...pt?.close}\n type='button'\n disabled={isBusy}\n className={classNames(\n 'cratis-dialog__close',\n pt?.close?.className,\n )}\n data-cratis-part='close'\n data-disabled={isBusy || undefined}\n data-busy={isBusy || undefined}\n aria-label={resolvedCloseAriaLabel}\n onClick={() => void handleClose(DialogResult.Cancelled)}\n >\n <span aria-hidden='true'>{resolvedCloseIcon}</span>\n </button>\n )}\n </header>\n <div\n {...pt?.content}\n className={classNames(\n 'cratis-dialog__content',\n pt?.content?.className,\n )}\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 {buttons !== null && (\n <footer\n {...pt?.footer}\n className={classNames(\n 'cratis-dialog__footer',\n pt?.footer?.className,\n )}\n style={pt?.footer?.style}\n data-cratis-part='footer'\n >\n <fieldset\n className='cratis-dialog__busy-scope cratis-dialog__busy-scope--footer'\n data-cratis-part='busy-scope'\n data-busy={isBusy || undefined}\n disabled={isBusy}\n inert={isBusy}\n aria-busy={isBusy || undefined}\n >\n {predefinedFooter()}\n </fieldset>\n </footer>\n )}\n </>\n </AriaDialog>\n </DialogStackContext.Provider>\n );\n\n const dialogStyle = { width, ...pt?.root?.style, ...style };\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) {\n if (!visible) return null;\n return (\n <div\n {...pt?.backdrop}\n className={classNames('cratis-dialog__backdrop', pt?.backdrop?.className)}\n style={{\n zIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN,\n ...pt?.backdrop?.style,\n }}\n data-cratis-part='backdrop'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <div\n {...pt?.positioner}\n className={classNames(\n 'cratis-dialog__positioner',\n pt?.positioner?.className,\n )}\n style={pt?.positioner?.style}\n data-cratis-part='positioner'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <section\n {...pt?.root}\n className={classNames(\n 'cratis-dialog',\n pt?.root?.className,\n className,\n )}\n style={dialogStyle}\n data-cratis-part='root'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n {dialogDocument}\n </section>\n </div>\n </div>\n );\n }\n\n return (\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <ModalOverlay\n {...pt?.backdrop}\n isOpen={visible}\n onOpenChange={(open) => {\n if (!open && !isBusy) void handleClose(DialogResult.Cancelled);\n }}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={!isDismissable}\n className={classNames('cratis-dialog__backdrop', pt?.backdrop?.className)}\n style={{\n zIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN,\n ...pt?.backdrop?.style,\n }}\n data-cratis-part='backdrop'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <div\n {...pt?.positioner}\n className={classNames(\n 'cratis-dialog__positioner',\n pt?.positioner?.className,\n )}\n style={pt?.positioner?.style}\n data-cratis-part='positioner'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <Modal\n {...pt?.root}\n className={classNames(\n 'cratis-dialog',\n pt?.root?.className,\n className,\n )}\n style={dialogStyle}\n data-cratis-part='root'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n {dialogDocument}\n </Modal>\n </div>\n </ModalOverlay>\n </UNSAFE_PortalProvider>\n );\n};\n"],"names":["_jsxs","_jsx","_Fragment","AriaDialog"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAM,6BAA6B,GAAG,MAAM,MAAM,SAAS;AAC3D,MAAM,YAAY,GAAG,MACjB,oBAAoB,CAChB,6BAA6B,EAC7B,MAAM,IAAI,EACV,MAAM,KAAK,CACd;AAME,MAAM,oBAAoB,GAAG,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,QAAQ,EACpB,SAAS,EACT,OAAO,GAAG,IAAI,EACd,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,GAAG,aAAa,CAAC,QAAQ,EAChC,YAAY,GAAG,kBAAkB,CAAC,OAAO,EACzC,QAAQ,EACR,KAAK,GAAG,OAAO,EACf,KAAK,EACL,YAAY,EACZ,OAAO,EACP,MAAM,GAAG,KAAK,EACd,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,EACP,cAAc,EACd,WAAW,EACX,SAAS,EACT,EAAE,GACQ,KAAI;AACd,IAAA,MAAM,kBAAkB,GAAG,8BAA8B,EAAE;AAC3D,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,yBAAyB,EAAE;AAChD,IAAA,MAAM,cAAc,GAAG,QAAQ,EAAE,MAAM;IACvC,MAAM,eAAe,GAAG,OAAO,IAAI,cAAc,EAAE,EAAE,IAAI,IAAI;IAC7D,MAAM,mBAAmB,GAAG,WAAW,IAAI,cAAc,EAAE,MAAM,IAAI,QAAQ;IAC7E,MAAM,gBAAgB,GAAG,QAAQ,IAAI,cAAc,EAAE,GAAG,IAAI,KAAK;IACjE,MAAM,eAAe,GAAG,OAAO,IAAI,cAAc,EAAE,EAAE,IAAI,IAAI;IAC7D,MAAM,sBAAsB,GAAG,cAAc,IAAI,cAAc,EAAE,KAAK,IAAI,OAAO;AACjF,IAAA,MA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AAA,EAAA,GACE,EAAE,EAAE,IAAI,EACZ,SAAS,EAAE,UAAU,CACjB,eAAe,EACf,EAAE,EAAE,IAAI,EAAE,SAAS,EACnB,SAAS,CACZ,EACD,KAAK,EAAE,WAAW,EAAA,kBAAA,EACD,MAAM,oBACP,SAAS,EAAA,WAAA,EACd,OAAO,IAAI,SAAS,eACpB,MAAM,IAAI,SAAS,EAAA,QAAA,EAE7B,cAAc,GACX,EAAA,CACN,EAAA,CACK,EAAA,CACK;AAEhC;;"}
|
|
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, useDialogContext } from '@cratis/arc.react/dialogs';\nimport { Dialog as AriaDialog, Heading } from 'react-aria-components/Dialog';\nimport { Modal, ModalOverlay } from 'react-aria-components/Modal';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport type React from 'react';\nimport { useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { DialogInitialFocus } from './DialogInitialFocus';\nimport type { DialogProps } from './Dialog';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport {\n DIALOG_ZINDEX_TOKEN,\n closeDialogTier,\n dialogZIndexForTier,\n openDialogTier,\n} from '../renderer/dialogStack';\nimport { DialogStackContext } from '../renderer/DialogStackContext';\nimport { classNames } from '../ClassNames/classNames';\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\nconst subscribeToBrowserEnvironment = () => () => undefined;\nconst useIsBrowser = () =>\n useSyncExternalStore(\n subscribeToBrowserEnvironment,\n () => true,\n () => false,\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 = ({\n title,\n subtitle,\n placement = 'center',\n closeIcon,\n visible = true,\n onClose,\n onConfirm,\n onCancel,\n buttons = DialogButtons.OkCancel,\n initialFocus = DialogInitialFocus.Confirm,\n children,\n width = '450px',\n style,\n contentStyle,\n isValid,\n isBusy = false,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n closeAriaLabel,\n dismissable,\n className,\n pt,\n}: DialogProps) => {\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const { messages } = useCratisComponentsConfig();\n const dialogMessages = messages?.dialog;\n const resolvedOkLabel = okLabel ?? dialogMessages?.ok ?? 'Ok';\n const resolvedCancelLabel = cancelLabel ?? dialogMessages?.cancel ?? 'Cancel';\n const resolvedYesLabel = yesLabel ?? dialogMessages?.yes ?? 'Yes';\n const resolvedNoLabel = noLabel ?? dialogMessages?.no ?? 'No';\n const resolvedCloseAriaLabel = closeAriaLabel ?? dialogMessages?.close ?? 'Close';\n const resolvedRefusedMessage =\n dialogMessages?.refused ??\n 'The action was not completed. Review the dialog and try again.';\n const icon = useCratisIcon();\n const resolvedCloseIcon = icon('close', '×', closeIcon);\n let contextCloseDialog: ((result: DialogResult) => void) | undefined;\n try {\n const context = useDialogContext();\n contextCloseDialog = context?.closeDialog;\n } catch {\n contextCloseDialog = undefined;\n }\n\n const isBrowser = useIsBrowser();\n const subtitleId = useId();\n const hasSubtitle = subtitle !== undefined && subtitle !== null && subtitle !== false;\n const titleRef = useRef<HTMLHeadingElement>(null);\n const confirmRef = useRef<HTMLButtonElement>(null);\n const cancelRef = useRef<HTMLButtonElement>(null);\n\n const [refusals, setRefusals] = useState(0);\n const handledRefusals = useRef(0);\n const [announcement, setAnnouncement] = useState<{ key: number; text: string } | null>(null);\n const isDialogValid = isValid !== false;\n const hasDismissingButton =\n typeof buttons === 'number' && buttons !== DialogButtons.Ok;\n const resolvedInitialFocus =\n initialFocus === DialogInitialFocus.Cancel && !hasDismissingButton\n ? DialogInitialFocus.Content\n : initialFocus;\n const focusesConfirmButton = resolvedInitialFocus === DialogInitialFocus.Confirm;\n const focusesDismissingButton = resolvedInitialFocus === DialogInitialFocus.Cancel;\n const focusesTitle = resolvedInitialFocus === DialogInitialFocus.Content;\n const allowsDismissal = dismissable ?? typeof buttons === 'number';\n const isDismissable = allowsDismissal && !isBusy;\n\n // Assigns this dialog a strictly increasing tier for as long as it is visible, so a second\n // dialog opened while this one is still open - from anywhere, not necessarily as a React\n // child of this one - stacks above it rather than colliding on the same static z-index.\n const [dialogTier, setDialogTier] = useState<number | null>(null);\n useLayoutEffect(() => {\n if (!visible) {\n setDialogTier(null);\n return;\n }\n const tier = openDialogTier();\n setDialogTier(tier);\n return () => closeDialogTier(tier);\n }, [visible]);\n const resolvedZIndex = dialogTier === null ? undefined : dialogZIndexForTier(dialogTier);\n\n useEffect(() => {\n if (!visible) return;\n const target = focusesConfirmButton\n ? confirmRef.current\n : focusesDismissingButton\n ? cancelRef.current\n : titleRef.current;\n const frame = requestAnimationFrame(() => target?.focus());\n return () => cancelAnimationFrame(frame);\n }, [focusesConfirmButton, focusesDismissingButton, visible]);\n\n // Keyboard focus must never be stranded on <body> while work is in flight: the confirm\n // button stays focusable (aria-disabled), and a focus held by a now-inert field moves to it.\n useEffect(() => {\n if (!visible || !isBusy) return;\n setAnnouncement(null);\n const active = document.activeElement;\n if (active && active !== document.body) return;\n if (confirmRef.current) {\n confirmRef.current.focus();\n } else if (titleRef.current) {\n titleRef.current.tabIndex = -1;\n titleRef.current.focus();\n }\n }, [isBusy, visible]);\n\n // A refused confirm (the dialog stays open) returns focus to the confirm button, or to the\n // title when confirm is not enabled, and announces the outcome through the live region.\n useEffect(() => {\n // Each refusal is handled once: a later busy-to-idle change, such as a successful retry,\n // must neither move focus nor announce the earlier refusal again.\n if (refusals === handledRefusals.current || isBusy) return;\n handledRefusals.current = refusals;\n const confirm = confirmRef.current;\n if (confirm && !confirm.disabled) {\n confirm.focus();\n } else if (titleRef.current) {\n titleRef.current.tabIndex = -1;\n titleRef.current.focus();\n }\n setAnnouncement({ key: refusals, text: resolvedRefusedMessage });\n }, [refusals, isBusy, resolvedRefusedMessage]);\n\n const handleClose = async (result: DialogResult) => {\n let shouldCloseThroughContext = true;\n const isConfirming = result === DialogResult.Ok || result === DialogResult.Yes;\n\n if (result === DialogResult.Ok || result === DialogResult.Yes) {\n if (onConfirm) {\n const closeResult = await onConfirm();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n } else if (onCancel) {\n const closeResult = await onCancel();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n\n if (shouldCloseThroughContext) contextCloseDialog?.(result);\n else if (isConfirming) setRefusals((count) => count + 1);\n };\n\n const footerButton = (\n result: DialogResult,\n label: string,\n primary: boolean,\n focused: boolean,\n ) => (\n <button\n key={`${result}-${label}`}\n {...(primary ? pt?.confirm : pt?.cancel)}\n type='button'\n className={classNames(\n 'cratis-dialog__button',\n primary\n ? 'cratis-dialog__button--primary'\n : 'cratis-dialog__button--secondary',\n primary ? pt?.confirm?.className : pt?.cancel?.className,\n )}\n data-cratis-part={primary ? 'confirm' : 'cancel'}\n data-disabled={(primary ? !isDialogValid || isBusy : isBusy) || undefined}\n data-busy={isBusy || undefined}\n ref={primary ? confirmRef : focused ? cancelRef : undefined}\n onClick={() => {\n if (isBusy) return;\n void handleClose(result);\n }}\n onKeyDown={\n primary\n ? (event) => {\n // A held key must not re-submit when focus returns after a refusal.\n if (event.repeat && (event.key === 'Enter' || event.key === ' '))\n event.preventDefault();\n }\n : undefined\n }\n disabled={primary ? !isDialogValid : isBusy}\n autoFocus={focused}\n aria-disabled={primary && isBusy ? true : undefined}\n aria-busy={primary && isBusy ? true : undefined}\n >\n {primary && isBusy && (\n <span className='cratis-dialog__spinner' aria-hidden='true' />\n )}\n <span>{label}</span>\n </button>\n );\n\n // The predefined footer keeps the confirm button focusable while busy, so only a custom\n // footer needs the whole scope disabled; predefined secondary buttons disable themselves.\n const isFooterScopeBusy = isBusy && typeof buttons !== 'number';\n\n const predefinedFooter = () => {\n if (typeof buttons !== 'number') return buttons;\n\n switch (buttons) {\n case DialogButtons.Ok:\n return footerButton(\n DialogResult.Ok,\n resolvedOkLabel,\n true,\n focusesConfirmButton,\n );\n case DialogButtons.OkCancel:\n return (\n <>\n {footerButton(\n DialogResult.Ok,\n resolvedOkLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(\n DialogResult.Cancelled,\n resolvedCancelLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n case DialogButtons.YesNo:\n return (\n <>\n {footerButton(\n DialogResult.Yes,\n resolvedYesLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(\n DialogResult.No,\n resolvedNoLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n case DialogButtons.YesNoCancel:\n return (\n <>\n {footerButton(\n DialogResult.Yes,\n resolvedYesLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(DialogResult.No, resolvedNoLabel, false, false)}\n {footerButton(\n DialogResult.Cancelled,\n resolvedCancelLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n default:\n return null;\n }\n };\n\n const dialogDocument = (\n <DialogStackContext.Provider value={resolvedZIndex ?? DIALOG_ZINDEX_TOKEN}>\n <AriaDialog\n className='cratis-dialog__document'\n aria-describedby={hasSubtitle ? subtitleId : undefined}\n >\n <>\n <header\n {...pt?.header}\n className={classNames('cratis-dialog__header', pt?.header?.className)}\n style={pt?.header?.style}\n data-cratis-part='header'\n >\n <Heading\n {...pt?.title}\n slot='title'\n tabIndex={focusesTitle ? -1 : undefined}\n ref={titleRef}\n className={classNames(\n 'cratis-dialog__title',\n pt?.title?.className,\n )}\n style={pt?.title?.style}\n data-cratis-part='title'\n >\n {title}\n </Heading>\n {hasSubtitle && (\n <p\n {...pt?.subtitle}\n id={subtitleId}\n className={classNames(\n 'cratis-dialog__subtitle',\n pt?.subtitle?.className,\n )}\n style={pt?.subtitle?.style}\n data-cratis-part='subtitle'\n >\n {subtitle}\n </p>\n )}\n {allowsDismissal && (\n <button\n {...pt?.close}\n type='button'\n disabled={isBusy}\n className={classNames(\n 'cratis-dialog__close',\n pt?.close?.className,\n )}\n data-cratis-part='close'\n data-disabled={isBusy || undefined}\n data-busy={isBusy || undefined}\n aria-label={resolvedCloseAriaLabel}\n onClick={() => void handleClose(DialogResult.Cancelled)}\n >\n <span aria-hidden='true'>{resolvedCloseIcon}</span>\n </button>\n )}\n </header>\n <div\n {...pt?.content}\n className={classNames(\n 'cratis-dialog__content',\n pt?.content?.className,\n )}\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 {buttons !== null && (\n <footer\n {...pt?.footer}\n className={classNames(\n 'cratis-dialog__footer',\n pt?.footer?.className,\n )}\n style={pt?.footer?.style}\n data-cratis-part='footer'\n >\n <fieldset\n className='cratis-dialog__busy-scope cratis-dialog__busy-scope--footer'\n data-cratis-part='busy-scope'\n data-busy={isBusy || undefined}\n disabled={isFooterScopeBusy}\n inert={isFooterScopeBusy}\n aria-busy={isBusy || undefined}\n >\n {predefinedFooter()}\n </fieldset>\n </footer>\n )}\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 </AriaDialog>\n </DialogStackContext.Provider>\n );\n\n const dialogStyle = { width, ...pt?.root?.style, ...style };\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) {\n if (!visible) return null;\n return (\n <div\n {...pt?.backdrop}\n className={classNames('cratis-dialog__backdrop', pt?.backdrop?.className)}\n style={{\n zIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN,\n ...pt?.backdrop?.style,\n }}\n data-cratis-part='backdrop'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <div\n {...pt?.positioner}\n className={classNames(\n 'cratis-dialog__positioner',\n pt?.positioner?.className,\n )}\n style={pt?.positioner?.style}\n data-cratis-part='positioner'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <section\n {...pt?.root}\n className={classNames(\n 'cratis-dialog',\n pt?.root?.className,\n className,\n )}\n style={dialogStyle}\n data-cratis-part='root'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n {dialogDocument}\n </section>\n </div>\n </div>\n );\n }\n\n return (\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <ModalOverlay\n {...pt?.backdrop}\n isOpen={visible}\n onOpenChange={(open) => {\n if (!open && !isBusy) void handleClose(DialogResult.Cancelled);\n }}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={!isDismissable}\n className={classNames('cratis-dialog__backdrop', pt?.backdrop?.className)}\n style={{\n zIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN,\n ...pt?.backdrop?.style,\n }}\n data-cratis-part='backdrop'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <div\n {...pt?.positioner}\n className={classNames(\n 'cratis-dialog__positioner',\n pt?.positioner?.className,\n )}\n style={pt?.positioner?.style}\n data-cratis-part='positioner'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <Modal\n {...pt?.root}\n className={classNames(\n 'cratis-dialog',\n pt?.root?.className,\n className,\n )}\n style={dialogStyle}\n data-cratis-part='root'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n {dialogDocument}\n </Modal>\n </div>\n </ModalOverlay>\n </UNSAFE_PortalProvider>\n );\n};\n"],"names":["_jsxs","_jsx","_Fragment","AriaDialog"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,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,6BAA6B,GAAG,MAAM,MAAM,SAAS;AAC3D,MAAM,YAAY,GAAG,MACjB,oBAAoB,CAChB,6BAA6B,EAC7B,MAAM,IAAI,EACV,MAAM,KAAK,CACd;AAME,MAAM,oBAAoB,GAAG,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,QAAQ,EACpB,SAAS,EACT,OAAO,GAAG,IAAI,EACd,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,GAAG,aAAa,CAAC,QAAQ,EAChC,YAAY,GAAG,kBAAkB,CAAC,OAAO,EACzC,QAAQ,EACR,KAAK,GAAG,OAAO,EACf,KAAK,EACL,YAAY,EACZ,OAAO,EACP,MAAM,GAAG,KAAK,EACd,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,EACP,cAAc,EACd,WAAW,EACX,SAAS,EACT,EAAE,GACQ,KAAI;AACd,IAAA,MAAM,kBAAkB,GAAG,8BAA8B,EAAE;AAC3D,IAAA,MAAM,EAAE,QAAQ,EAAE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