@cratis/components 4.35.1 → 4.37.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.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.js +4 -1
- package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/esm/CommandForm/fields/CalendarField.d.ts +5 -0
- package/dist/esm/CommandForm/fields/CalendarField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/CalendarField.js +1 -1
- package/dist/esm/CommandForm/fields/CalendarField.js.map +1 -1
- package/dist/esm/Common/DatePickerInput.d.ts +5 -0
- package/dist/esm/Common/DatePickerInput.d.ts.map +1 -1
- package/dist/esm/Common/DatePickerInput.js.map +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.d.ts +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.d.ts.map +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.js +2 -2
- package/dist/esm/Common/DatePickerInputImplementation.js.map +1 -1
- package/dist/esm/Dialogs/Dialog.d.ts +10 -1
- package/dist/esm/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/esm/Dialogs/Dialog.js.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts +1 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.js +7 -5
- package/dist/esm/Dialogs/DialogImplementation.js.map +1 -1
- package/dist/esm/Dialogs/resolveDialogDismissal.d.ts +8 -0
- package/dist/esm/Dialogs/resolveDialogDismissal.d.ts.map +1 -0
- package/dist/esm/Dialogs/resolveDialogDismissal.js +11 -0
- package/dist/esm/Dialogs/resolveDialogDismissal.js.map +1 -0
- 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.37.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.37.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.37.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.37.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.37.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.37.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.37.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.37.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.37.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.37.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.37.0",
|
|
266
266
|
"primereact": ">=10.9.9 <11",
|
|
267
267
|
"react": "^19.0.0",
|
|
268
268
|
"react-dom": "^19.0.0"
|
|
@@ -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;AA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ClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAAwB,CAAC;AAOnE;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB,CAAC,QAAQ,SAAS,MAAM,EAAE,SAAS,GAAG,MAAM,CAC3E,SACI,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,iBAAiB,CAAC,EAC3E,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5C;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAElD;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC,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;;CAoFjD,CAAC;AAEF,QAAA,MAAM,0BAA0B,iBAAkB;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,sBAE9E,CAAC;AAKF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,+BAAyB,CAAC"}
|
|
@@ -61,7 +61,7 @@ const CommandDialogWrapper = ({ isValid, onClose, onConfirm, onSuccess, onValida
|
|
|
61
61
|
return (jsx(Dialog, { ...dialogProps, onClose: onClose, onConfirm: handleConfirm, isValid: isDialogValid, isBusy: submission.isSubmitting, children: jsx("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: processedChildren }) }));
|
|
62
62
|
};
|
|
63
63
|
const CommandDialogComponent = (props) => {
|
|
64
|
-
const { title, subtitle, placement, closeIcon, visible, width, style, contentStyle, resizable, buttons = DialogButtons.OkCancel, initialFocus, okLabel, cancelLabel, yesLabel, noLabel, dismissable, closeAriaLabel, isValid, onClose, onConfirm, onCancel, onBeforeExecute, confirmBeforeExecute, className, pt, ptOptions, unstyled, children, ...commandFormProps } = props;
|
|
64
|
+
const { title, subtitle, placement, closeIcon, visible, width, style, contentStyle, resizable, buttons = DialogButtons.OkCancel, initialFocus, okLabel, cancelLabel, yesLabel, noLabel, dismissable, dismissOnOutsideClick, closeOnEscape, showCloseButton, closeAriaLabel, isValid, onClose, onConfirm, onCancel, onBeforeExecute, confirmBeforeExecute, className, pt, ptOptions, unstyled, children, ...commandFormProps } = props;
|
|
65
65
|
const dialogProps = {
|
|
66
66
|
title,
|
|
67
67
|
subtitle,
|
|
@@ -79,6 +79,9 @@ const CommandDialogComponent = (props) => {
|
|
|
79
79
|
yesLabel,
|
|
80
80
|
noLabel,
|
|
81
81
|
dismissable,
|
|
82
|
+
dismissOnOutsideClick,
|
|
83
|
+
closeOnEscape,
|
|
84
|
+
showCloseButton,
|
|
82
85
|
closeAriaLabel,
|
|
83
86
|
isValid,
|
|
84
87
|
onClose,
|
|
@@ -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 — 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,MAAM,aAAa,GAAG,YAA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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;;"}
|
|
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 dismissOnOutsideClick,\n closeOnEscape,\n showCloseButton,\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 dismissOnOutsideClick,\n closeOnEscape,\n showCloseButton,\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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,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;;"}
|
|
@@ -20,6 +20,11 @@ interface CalendarFieldComponentProps extends WrappedFieldProps<Date | null>, Fi
|
|
|
20
20
|
minDate?: Date;
|
|
21
21
|
/** Latest selectable date. */
|
|
22
22
|
maxDate?: Date;
|
|
23
|
+
/**
|
|
24
|
+
* Keep outside controls interactive while the calendar is open. An outside
|
|
25
|
+
* click dismisses the popover and reaches its target. Defaults to false.
|
|
26
|
+
*/
|
|
27
|
+
isNonModal?: boolean;
|
|
23
28
|
/** Extra CSS class name combined with the default `w-full`. */
|
|
24
29
|
className?: string;
|
|
25
30
|
/** Cratis-owned per-part attributes applied to the date picker. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarField.d.ts","sourceRoot":"","sources":["../../../../CommandForm/fields/CalendarField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAEH,KAAK,0BAA0B,EAClC,MAAM,iCAA8B,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEH,KAAK,uBAAuB,EAC/B,MAAM,yBAAsB,CAAC;AAE9B;;GAEG;AACH,UAAU,2BACN,SAAQ,iBAAiB,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,uBAAuB;IAC/D,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CA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IAChC,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,mEAAmE;IACnE,EAAE,CAAC,EAAE,0BAA0B,CAAC;IAEhC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,0NAmCzB,CAAC"}
|
|
@@ -9,7 +9,7 @@ const CalendarField = asCommandFormField((props) => {
|
|
|
9
9
|
ariaLabel: props.pt?.input?.['aria-label'],
|
|
10
10
|
ariaDescribedBy: props.pt?.input?.['aria-describedby'],
|
|
11
11
|
});
|
|
12
|
-
return (jsxs(Fragment, { children: [jsx(DatePickerInput, { id: accessibility.controlId, "aria-label": accessibility.ariaLabel, "aria-describedby": accessibility.ariaDescribedBy, value: props.value, onChange: (value) => props.onChange(value), onBlur: props.onBlur, invalid: props.invalid, placeholder: props.placeholder, dateFormat: props.dateFormat, showIcon: props.showIcon, showTime: props.showTime, hourFormat: props.hourFormat, minDate: props.minDate, maxDate: props.maxDate, className: props.className, pt: props.pt, ptOptions: props.ptOptions, unstyled: props.unstyled }), accessibility.hiddenError] }));
|
|
12
|
+
return (jsxs(Fragment, { children: [jsx(DatePickerInput, { id: accessibility.controlId, "aria-label": accessibility.ariaLabel, "aria-describedby": accessibility.ariaDescribedBy, value: props.value, onChange: (value) => props.onChange(value), onBlur: props.onBlur, invalid: props.invalid, placeholder: props.placeholder, dateFormat: props.dateFormat, showIcon: props.showIcon, showTime: props.showTime, hourFormat: props.hourFormat, minDate: props.minDate, maxDate: props.maxDate, isNonModal: props.isNonModal, className: props.className, pt: props.pt, ptOptions: props.ptOptions, unstyled: props.unstyled }), accessibility.hiddenError] }));
|
|
13
13
|
}, { defaultValue: null });
|
|
14
14
|
|
|
15
15
|
export { CalendarField };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarField.js","sources":["../../../../CommandForm/fields/CalendarField.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 { asCommandFormField, type WrappedFieldProps } from '@cratis/arc.react/commands';\nimport {\n DatePickerInput,\n type DatePickerInputPassThrough,\n} from '../../Common/DatePickerInput';\nimport React from 'react';\nimport {\n useFieldAccessibility,\n type FieldAccessibilityProps,\n} from './fieldAccessibility';\n\n/**\n * Component-level props for {@link CalendarField}.\n */\ninterface CalendarFieldComponentProps\n extends WrappedFieldProps<Date | null>, FieldAccessibilityProps {\n /** Placeholder text shown when no date is selected. */\n placeholder?: string;\n\n /** legacy date format mask (e.g. `'yy-mm-dd'`). */\n dateFormat?: string;\n\n /** When true, renders a trailing calendar icon button. */\n showIcon?: boolean;\n\n /** When true, includes time selection alongside the date. */\n showTime?: boolean;\n\n /** Hour format used when {@link showTime} is true. */\n hourFormat?: '12' | '24';\n\n /** Earliest selectable date. */\n minDate?: Date;\n\n /** Latest selectable date. */\n maxDate?: Date;\n\n /** Extra CSS class name combined with the default `w-full`. */\n className?: string;\n\n /** Cratis-owned per-part attributes applied to the date picker. */\n pt?: DatePickerInputPassThrough;\n\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n}\n\n/**\n * A date (or date-time) picker field bound to a `Date | null` property on a\n * Cratis Arc command. Set `showTime` to add a time selector alongside the\n * date. See {@link InputTextField} for the full `value={c => c.prop}`\n * binding model.\n *\n * ```tsx\n * <CalendarField value={c => c.dueDate}\n * title=\"Due date\"\n * showIcon\n * minDate={new Date()} />\n * ```\n */\nexport const CalendarField = asCommandFormField<CalendarFieldComponentProps>(\n (props) => {\n const accessibility = useFieldAccessibility(props, {\n id: props.pt?.input?.id,\n ariaLabel: props.pt?.input?.['aria-label'],\n ariaDescribedBy: props.pt?.input?.['aria-describedby'],\n });\n return (\n <>\n <DatePickerInput\n id={accessibility.controlId}\n aria-label={accessibility.ariaLabel}\n aria-describedby={accessibility.ariaDescribedBy}\n value={props.value}\n onChange={(value) => props.onChange(value)}\n onBlur={props.onBlur}\n invalid={props.invalid}\n placeholder={props.placeholder}\n dateFormat={props.dateFormat}\n showIcon={props.showIcon}\n showTime={props.showTime}\n hourFormat={props.hourFormat}\n minDate={props.minDate}\n maxDate={props.maxDate}\n className={props.className}\n pt={props.pt}\n ptOptions={props.ptOptions}\n unstyled={props.unstyled}\n />\n {accessibility.hiddenError}\n </>\n );\n },\n { defaultValue: null },\n);\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"CalendarField.js","sources":["../../../../CommandForm/fields/CalendarField.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 { asCommandFormField, type WrappedFieldProps } from '@cratis/arc.react/commands';\nimport {\n DatePickerInput,\n type DatePickerInputPassThrough,\n} from '../../Common/DatePickerInput';\nimport React from 'react';\nimport {\n useFieldAccessibility,\n type FieldAccessibilityProps,\n} from './fieldAccessibility';\n\n/**\n * Component-level props for {@link CalendarField}.\n */\ninterface CalendarFieldComponentProps\n extends WrappedFieldProps<Date | null>, FieldAccessibilityProps {\n /** Placeholder text shown when no date is selected. */\n placeholder?: string;\n\n /** legacy date format mask (e.g. `'yy-mm-dd'`). */\n dateFormat?: string;\n\n /** When true, renders a trailing calendar icon button. */\n showIcon?: boolean;\n\n /** When true, includes time selection alongside the date. */\n showTime?: boolean;\n\n /** Hour format used when {@link showTime} is true. */\n hourFormat?: '12' | '24';\n\n /** Earliest selectable date. */\n minDate?: Date;\n\n /** Latest selectable date. */\n maxDate?: Date;\n\n /**\n * Keep outside controls interactive while the calendar is open. An outside\n * click dismisses the popover and reaches its target. Defaults to false.\n */\n isNonModal?: boolean;\n\n /** Extra CSS class name combined with the default `w-full`. */\n className?: string;\n\n /** Cratis-owned per-part attributes applied to the date picker. */\n pt?: DatePickerInputPassThrough;\n\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n}\n\n/**\n * A date (or date-time) picker field bound to a `Date | null` property on a\n * Cratis Arc command. Set `showTime` to add a time selector alongside the\n * date. See {@link InputTextField} for the full `value={c => c.prop}`\n * binding model.\n *\n * ```tsx\n * <CalendarField value={c => c.dueDate}\n * title=\"Due date\"\n * showIcon\n * minDate={new Date()} />\n * ```\n */\nexport const CalendarField = asCommandFormField<CalendarFieldComponentProps>(\n (props) => {\n const accessibility = useFieldAccessibility(props, {\n id: props.pt?.input?.id,\n ariaLabel: props.pt?.input?.['aria-label'],\n ariaDescribedBy: props.pt?.input?.['aria-describedby'],\n });\n return (\n <>\n <DatePickerInput\n id={accessibility.controlId}\n aria-label={accessibility.ariaLabel}\n aria-describedby={accessibility.ariaDescribedBy}\n value={props.value}\n onChange={(value) => props.onChange(value)}\n onBlur={props.onBlur}\n invalid={props.invalid}\n placeholder={props.placeholder}\n dateFormat={props.dateFormat}\n showIcon={props.showIcon}\n showTime={props.showTime}\n hourFormat={props.hourFormat}\n minDate={props.minDate}\n maxDate={props.maxDate}\n isNonModal={props.isNonModal}\n className={props.className}\n pt={props.pt}\n ptOptions={props.ptOptions}\n unstyled={props.unstyled}\n />\n {accessibility.hiddenError}\n </>\n );\n },\n { defaultValue: null },\n);\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;MA4Ea,aAAa,GAAG,kBAAkB,CAC3C,CAAC,KAAK,KAAI;AACN,IAAA,MAAM,aAAa,GAAG,qBAAqB,CAAC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string;
|
|
72
72
|
/** Shows Today and Clear actions. */
|
|
73
73
|
showButtonBar?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Keep outside controls interactive while the calendar is open. An outside
|
|
76
|
+
* click dismisses the popover and reaches its target. Defaults to false.
|
|
77
|
+
*/
|
|
78
|
+
isNonModal?: boolean;
|
|
74
79
|
/** Visible text while no date is selected. */
|
|
75
80
|
placeholder?: string;
|
|
76
81
|
/** Deprecated renderer mask; locale controls formatting now. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerInput.d.ts","sourceRoot":"","sources":["../../../Common/DatePickerInput.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACjB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAAwB,CAAC;AAM5D,UAAU,wBAAyB,SAAQ,IAAI,CAC3C,cAAc,CAAC,WAAW,CAAC,EAC3B,cAAc,GAAG,UAAU,GAAG,MAAM,CACvC;IACG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,CAAC,SAAS,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACxE;AAED,KAAK,0BAA0B,GAAG,IAAI,CAClC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,SAAS,GAAG,OAAO,CACt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IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,gCAAgC;IAChC,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,wCAAwC;IACxC,EAAE,CAAC,EAAE,0BAA0B,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mDAAmD;IACnD,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAQD;;;GAGG;AACH,eAAO,MAAM,eAAe,UAAW,oBAAoB,+FAG1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerInput.js","sources":["../../../Common/DatePickerInput.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 type {\n ButtonHTMLAttributes,\n CSSProperties,\n FocusEventHandler,\n HTMLAttributes,\n} from 'react';\nimport type { ChangeHandler } from '../types/ChangeHandler';\nimport { unstable_useSlot } from '../renderer/RendererContext';\nimport { renderSlot } from '../renderer/renderSlot';\nimport type { unstable_SlotDeclaration } from '../renderer/slots';\nimport { DatePickerInputImplementation } from './DatePickerInputImplementation';\n\ninterface DatePickerPartAttributes extends Omit<\n HTMLAttributes<HTMLElement>,\n 'defaultValue' | 'onChange' | 'role'\n> {\n id?: string;\n className?: string;\n style?: CSSProperties;\n disabled?: boolean;\n readOnly?: boolean;\n placeholder?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n 'aria-invalid'?: boolean;\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n}\n\ntype DatePickerButtonAttributes = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'value'\n>;\n\n/** Stable Cratis-owned parts for styling a {@link DatePickerInput}. */\nexport interface DatePickerInputPassThrough {\n /** Outer wrapper. */\n root?: DatePickerPartAttributes;\n /** Focusable segmented-input group. */\n group?: DatePickerPartAttributes;\n /** Segmented date input. */\n input?: DatePickerPartAttributes;\n /** Visible empty-value placeholder. */\n placeholder?: DatePickerPartAttributes;\n /** Individual editable date/time segment. */\n segment?: DatePickerPartAttributes;\n /** Calendar popup trigger. */\n trigger?: DatePickerButtonAttributes;\n /** Portaled calendar popover. */\n popover?: DatePickerPartAttributes;\n /** Calendar dialog. */\n dialog?: DatePickerPartAttributes;\n /** Calendar root. */\n calendar?: DatePickerPartAttributes;\n /** Calendar navigation header. */\n header?: DatePickerPartAttributes;\n /** Current month/year heading. */\n heading?: DatePickerPartAttributes;\n /** Previous-month action. */\n previous?: DatePickerButtonAttributes;\n /** Next-month action. */\n next?: DatePickerButtonAttributes;\n /** Calendar grid. */\n grid?: DatePickerPartAttributes;\n /** One calendar cell. */\n cell?: DatePickerPartAttributes;\n /** Today/clear action row. */\n buttonBar?: DatePickerPartAttributes;\n /** Today action; disabled and non-interactive when today falls outside `minDate`/`maxDate`. */\n today?: DatePickerButtonAttributes;\n /** Clear action. */\n clear?: DatePickerButtonAttributes;\n}\n\n/** Props for {@link DatePickerInput}. */\nexport interface DatePickerInputProps {\n /** Controlled JavaScript date value. */\n value: Date | null;\n /** Invoked with the selected JavaScript date or `null` and optional change-origin metadata. */\n onChange: ChangeHandler<Date | null>;\n /** Invoked when focus leaves the picker wrapper. */\n onBlur?: FocusEventHandler<HTMLElement>;\n /** Marks the picker invalid. */\n invalid?: boolean;\n /** Disables every picker control. */\n disabled?: boolean;\n /** Prevents editing while retaining focus semantics. */\n readOnly?: boolean;\n /** DOM id for the segmented-input group. */\n id?: string;\n /** Shows Today and Clear actions. */\n showButtonBar?: boolean;\n /** Visible text while no date is selected. */\n placeholder?: string;\n /** Deprecated renderer mask; locale controls formatting now. */\n dateFormat?: string;\n /** Shows the calendar trigger button. Defaults to `true`. */\n showIcon?: boolean;\n /** Adds hour/minute segments. */\n showTime?: boolean;\n /** Preferred 12- or 24-hour cycle. */\n hourFormat?: '12' | '24';\n /** Earliest selectable date. */\n minDate?: Date;\n /** Latest selectable date. */\n maxDate?: Date;\n /** Extra class name for the outer wrapper. */\n className?: string;\n /** Inline style for the outer wrapper. */\n style?: CSSProperties;\n /** Cratis-owned per-part attributes. */\n pt?: DatePickerInputPassThrough;\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n /** Localized label for the Today action. */\n todayLabel?: string;\n /** Localized label for the Clear action. */\n clearLabel?: string;\n /** Accessible name when no external label is supplied. */\n 'aria-label'?: string;\n /** Id of the element that labels the picker. */\n 'aria-labelledby'?: string;\n /** Id of the element that describes the picker. */\n 'aria-describedby'?: string;\n}\n\nconst coreDatePickerDeclaration = Object.freeze({\n mode: 'atomic',\n fidelity: 'native',\n render: DatePickerInputImplementation,\n}) satisfies unstable_SlotDeclaration<'display.datePicker'>;\n\n/**\n * An internationalized date or date-time picker with Cratis-owned markup parts.\n * The public boundary remains `Date | null`; React Aria's calendar values stay internal.\n */\nexport const DatePickerInput = (props: DatePickerInputProps) => {\n const declaration = unstable_useSlot('display.datePicker', coreDatePickerDeclaration);\n return renderSlot(declaration, props);\n};\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"DatePickerInput.js","sources":["../../../Common/DatePickerInput.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 type {\n ButtonHTMLAttributes,\n CSSProperties,\n FocusEventHandler,\n HTMLAttributes,\n} from 'react';\nimport type { ChangeHandler } from '../types/ChangeHandler';\nimport { unstable_useSlot } from '../renderer/RendererContext';\nimport { renderSlot } from '../renderer/renderSlot';\nimport type { unstable_SlotDeclaration } from '../renderer/slots';\nimport { DatePickerInputImplementation } from './DatePickerInputImplementation';\n\ninterface DatePickerPartAttributes extends Omit<\n HTMLAttributes<HTMLElement>,\n 'defaultValue' | 'onChange' | 'role'\n> {\n id?: string;\n className?: string;\n style?: CSSProperties;\n disabled?: boolean;\n readOnly?: boolean;\n placeholder?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n 'aria-invalid'?: boolean;\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n}\n\ntype DatePickerButtonAttributes = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'value'\n>;\n\n/** Stable Cratis-owned parts for styling a {@link DatePickerInput}. */\nexport interface DatePickerInputPassThrough {\n /** Outer wrapper. */\n root?: DatePickerPartAttributes;\n /** Focusable segmented-input group. */\n group?: DatePickerPartAttributes;\n /** Segmented date input. */\n input?: DatePickerPartAttributes;\n /** Visible empty-value placeholder. */\n placeholder?: DatePickerPartAttributes;\n /** Individual editable date/time segment. */\n segment?: DatePickerPartAttributes;\n /** Calendar popup trigger. */\n trigger?: DatePickerButtonAttributes;\n /** Portaled calendar popover. */\n popover?: DatePickerPartAttributes;\n /** Calendar dialog. */\n dialog?: DatePickerPartAttributes;\n /** Calendar root. */\n calendar?: DatePickerPartAttributes;\n /** Calendar navigation header. */\n header?: DatePickerPartAttributes;\n /** Current month/year heading. */\n heading?: DatePickerPartAttributes;\n /** Previous-month action. */\n previous?: DatePickerButtonAttributes;\n /** Next-month action. */\n next?: DatePickerButtonAttributes;\n /** Calendar grid. */\n grid?: DatePickerPartAttributes;\n /** One calendar cell. */\n cell?: DatePickerPartAttributes;\n /** Today/clear action row. */\n buttonBar?: DatePickerPartAttributes;\n /** Today action; disabled and non-interactive when today falls outside `minDate`/`maxDate`. */\n today?: DatePickerButtonAttributes;\n /** Clear action. */\n clear?: DatePickerButtonAttributes;\n}\n\n/** Props for {@link DatePickerInput}. */\nexport interface DatePickerInputProps {\n /** Controlled JavaScript date value. */\n value: Date | null;\n /** Invoked with the selected JavaScript date or `null` and optional change-origin metadata. */\n onChange: ChangeHandler<Date | null>;\n /** Invoked when focus leaves the picker wrapper. */\n onBlur?: FocusEventHandler<HTMLElement>;\n /** Marks the picker invalid. */\n invalid?: boolean;\n /** Disables every picker control. */\n disabled?: boolean;\n /** Prevents editing while retaining focus semantics. */\n readOnly?: boolean;\n /** DOM id for the segmented-input group. */\n id?: string;\n /** Shows Today and Clear actions. */\n showButtonBar?: boolean;\n /**\n * Keep outside controls interactive while the calendar is open. An outside\n * click dismisses the popover and reaches its target. Defaults to false.\n */\n isNonModal?: boolean;\n /** Visible text while no date is selected. */\n placeholder?: string;\n /** Deprecated renderer mask; locale controls formatting now. */\n dateFormat?: string;\n /** Shows the calendar trigger button. Defaults to `true`. */\n showIcon?: boolean;\n /** Adds hour/minute segments. */\n showTime?: boolean;\n /** Preferred 12- or 24-hour cycle. */\n hourFormat?: '12' | '24';\n /** Earliest selectable date. */\n minDate?: Date;\n /** Latest selectable date. */\n maxDate?: Date;\n /** Extra class name for the outer wrapper. */\n className?: string;\n /** Inline style for the outer wrapper. */\n style?: CSSProperties;\n /** Cratis-owned per-part attributes. */\n pt?: DatePickerInputPassThrough;\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n /** Localized label for the Today action. */\n todayLabel?: string;\n /** Localized label for the Clear action. */\n clearLabel?: string;\n /** Accessible name when no external label is supplied. */\n 'aria-label'?: string;\n /** Id of the element that labels the picker. */\n 'aria-labelledby'?: string;\n /** Id of the element that describes the picker. */\n 'aria-describedby'?: string;\n}\n\nconst coreDatePickerDeclaration = Object.freeze({\n mode: 'atomic',\n fidelity: 'native',\n render: DatePickerInputImplementation,\n}) satisfies unstable_SlotDeclaration<'display.datePicker'>;\n\n/**\n * An internationalized date or date-time picker with Cratis-owned markup parts.\n * The public boundary remains `Date | null`; React Aria's calendar values stay internal.\n */\nexport const DatePickerInput = (props: DatePickerInputProps) => {\n const declaration = unstable_useSlot('display.datePicker', coreDatePickerDeclaration);\n return renderSlot(declaration, props);\n};\n"],"names":[],"mappings":";;;;AA4IA,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;AAC5C,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,MAAM,EAAE,6BAA6B;AACxC,CAAA,CAA0D;AAMpD,MAAM,eAAe,GAAG,CAAC,KAA2B,KAAI;IAC3D,MAAM,WAAW,GAAG,gBAAgB,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;AACrF,IAAA,OAAO,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC;AACzC;;"}
|
|
@@ -3,5 +3,5 @@ import type { DatePickerInputProps } from './DatePickerInput.js';
|
|
|
3
3
|
* An internationalized date or date-time picker with Cratis-owned markup parts.
|
|
4
4
|
* The public boundary remains `Date | null`; React Aria's calendar values stay internal.
|
|
5
5
|
*/
|
|
6
|
-
export declare const DatePickerInputImplementation: ({ value, onChange, onBlur, invalid, disabled, readOnly, id, showButtonBar, placeholder, showIcon, showTime, hourFormat, minDate, maxDate, className, style, pt, todayLabel, clearLabel, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, }: DatePickerInputProps) => import("react").JSX.Element;
|
|
6
|
+
export declare const DatePickerInputImplementation: ({ value, onChange, onBlur, invalid, disabled, readOnly, id, showButtonBar, isNonModal, placeholder, showIcon, showTime, hourFormat, minDate, maxDate, className, style, pt, todayLabel, clearLabel, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, }: DatePickerInputProps) => import("react").JSX.Element;
|
|
7
7
|
//# sourceMappingURL=DatePickerInputImplementation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerInputImplementation.d.ts","sourceRoot":"","sources":["../../../Common/DatePickerInputImplementation.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAmB,CAAC;AAe9D;;;GAGG;AACH,eAAO,MAAM,6BAA6B
|
|
1
|
+
{"version":3,"file":"DatePickerInputImplementation.d.ts","sourceRoot":"","sources":["../../../Common/DatePickerInputImplementation.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAmB,CAAC;AAe9D;;;GAGG;AACH,eAAO,MAAM,6BAA6B,2SAwBvC,oBAAoB,gCA6YtB,CAAC"}
|
|
@@ -24,7 +24,7 @@ const asDateValue = (value, showTime) => {
|
|
|
24
24
|
return showTime ? zoned : toCalendarDate(zoned);
|
|
25
25
|
};
|
|
26
26
|
const asDate = (value) => value ? value.toDate(getLocalTimeZone()) : null;
|
|
27
|
-
const DatePickerInputImplementation = ({ value, onChange, onBlur, invalid, disabled, readOnly, id, showButtonBar, placeholder, showIcon = true, showTime, hourFormat, minDate, maxDate, className, style, pt, todayLabel, clearLabel, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, }) => {
|
|
27
|
+
const DatePickerInputImplementation = ({ value, onChange, onBlur, invalid, disabled, readOnly, id, showButtonBar, isNonModal = false, placeholder, showIcon = true, showTime, hourFormat, minDate, maxDate, className, style, pt, todayLabel, clearLabel, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, }) => {
|
|
28
28
|
const [isPickerOpen, setIsPickerOpen] = useState(false);
|
|
29
29
|
const overlayEnvironment = unstable_useOverlayEnvironment();
|
|
30
30
|
const nearestDialogZIndex = useNearestDialogZIndex();
|
|
@@ -78,7 +78,7 @@ const DatePickerInputImplementation = ({ value, onChange, onBlur, invalid, disab
|
|
|
78
78
|
effectiveReadOnly ||
|
|
79
79
|
undefined, "data-readonly": effectiveReadOnly || undefined, "data-selected": value !== null || undefined })), "aria-label": pt?.trigger?.['aria-label'] ??
|
|
80
80
|
datePickerMessages?.openCalendar ??
|
|
81
|
-
'Open calendar', children: jsx("span", { "aria-hidden": 'true', children: "\u25A6" }) }))] }), jsx(Popover, { ...pt?.popover, className: classNames('cratis-date-picker__popover', pt?.popover?.className), style: {
|
|
81
|
+
'Open calendar', children: jsx("span", { "aria-hidden": 'true', children: "\u25A6" }) }))] }), jsx(Popover, { ...pt?.popover, isNonModal: isNonModal, className: classNames('cratis-date-picker__popover', pt?.popover?.className), style: {
|
|
82
82
|
zIndex: resolvedPopoverZIndex,
|
|
83
83
|
...pt?.popover?.style,
|
|
84
84
|
}, "data-cratis-part": 'popover', "data-open": true, placement: 'bottom start', children: jsxs(Dialog, { ...pt?.dialog, className: classNames('cratis-date-picker__dialog', pt?.dialog?.className), "data-cratis-part": 'dialog', "data-open": true, children: [jsxs(Calendar, { ...pt?.calendar, className: classNames('cratis-date-picker__calendar', pt?.calendar?.className), "data-cratis-part": 'calendar', "data-open": true, children: [jsxs("header", { ...pt?.header, className: classNames('cratis-date-picker__header', pt?.header?.className), "data-cratis-part": 'header', children: [jsx(Button, { ...asReactAriaButtonProps(pt?.previous), slot: 'previous', className: classNames('cratis-date-picker__nav', pt?.previous?.className), "data-cratis-part": 'previous', "aria-label": pt?.previous?.['aria-label'] ??
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerInputImplementation.js","sources":["../../../Common/DatePickerInputImplementation.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 { useState } from 'react';\nimport {\n Button,\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n DateInput,\n DatePicker as AriaDatePicker,\n DateSegment,\n Group,\n Popover,\n type DateValue,\n} from 'react-aria-components/DatePicker';\nimport { Dialog } from 'react-aria-components/Dialog';\nimport { Heading } from 'react-aria-components/Heading';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { useCratisComponentsConfig } from './CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport { OVERLAY_OFFSET, zIndexAboveDialog } from '../renderer/dialogStack';\nimport { useNearestDialogZIndex } from '../renderer/DialogStackContext';\nimport { asReactAriaButtonProps } from './reactAriaProps';\nimport {\n fromDate,\n getLocalTimeZone,\n today,\n toCalendarDate,\n} from '@internationalized/date';\nimport type { DatePickerInputProps } from './DatePickerInput';\nimport { classNames } from '../ClassNames/classNames';\n\nconst asDateValue = (\n value: Date | null,\n showTime: boolean | undefined,\n): DateValue | null => {\n if (!value) return null;\n const zoned = fromDate(value, getLocalTimeZone());\n return showTime ? zoned : toCalendarDate(zoned);\n};\n\nconst asDate = (value: DateValue | null): Date | null =>\n value ? value.toDate(getLocalTimeZone()) : null;\n\n/**\n * An internationalized date or date-time picker with Cratis-owned markup parts.\n * The public boundary remains `Date | null`; React Aria's calendar values stay internal.\n */\nexport const DatePickerInputImplementation = ({\n value,\n onChange,\n onBlur,\n invalid,\n disabled,\n readOnly,\n id,\n showButtonBar,\n placeholder,\n showIcon = true,\n showTime,\n hourFormat,\n minDate,\n maxDate,\n className,\n style,\n pt,\n todayLabel,\n clearLabel,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n}: DatePickerInputProps) => {\n const [isPickerOpen, setIsPickerOpen] = useState(false);\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const nearestDialogZIndex = useNearestDialogZIndex();\n const resolvedPopoverZIndex =\n nearestDialogZIndex === null\n ? 'var(--cratis-z-index-overlay)'\n : zIndexAboveDialog(nearestDialogZIndex, OVERLAY_OFFSET);\n const { messages } = useCratisComponentsConfig();\n const datePickerMessages = messages?.datePicker;\n const icon = useCratisIcon();\n const resolvedTodayLabel = todayLabel ?? datePickerMessages?.today ?? 'Today';\n const resolvedClearLabel = clearLabel ?? datePickerMessages?.clear ?? 'Clear';\n const timeZone = getLocalTimeZone();\n const minValue = asDateValue(minDate ?? null, showTime) ?? undefined;\n const maxValue = asDateValue(maxDate ?? null, showTime) ?? undefined;\n const todayDate = today(timeZone).toDate(timeZone);\n // Compare the same granularity that the action emits. In date-time mode the Today action\n // retains its existing local-midnight value, which can legitimately fall before a same-day\n // minDate carrying a later time.\n const todayValue = asDateValue(todayDate, showTime)!;\n const isTodayOutOfBounds =\n (minValue !== undefined && todayValue.compare(minValue) < 0) ||\n (maxValue !== undefined && todayValue.compare(maxValue) > 0);\n const rootClassName = classNames(\n 'cratis-date-picker',\n pt?.root?.className,\n className,\n );\n const inputId = id ?? pt?.input?.id;\n const effectiveDisabled = disabled ?? pt?.input?.disabled ?? false;\n const effectiveReadOnly = readOnly ?? pt?.input?.readOnly ?? false;\n const effectiveInvalid = invalid ?? pt?.input?.['aria-invalid'] ?? false;\n const actionsDisabled = effectiveDisabled || effectiveReadOnly;\n const clearDisabled = actionsDisabled || pt?.clear?.disabled || false;\n const effectivePlaceholder = placeholder ?? pt?.input?.placeholder;\n const effectiveAriaLabel =\n ariaLabel ??\n pt?.input?.['aria-label'] ??\n effectivePlaceholder ??\n datePickerMessages?.label ??\n 'Date';\n const effectiveAriaLabelledby = ariaLabelledby ?? pt?.input?.['aria-labelledby'];\n const effectiveAriaDescribedby = ariaDescribedby ?? pt?.input?.['aria-describedby'];\n const inputPartAttributes = {\n ...pt?.input,\n id: undefined,\n className: undefined,\n style: undefined,\n disabled: undefined,\n readOnly: undefined,\n placeholder: undefined,\n 'aria-label': undefined,\n 'aria-labelledby': undefined,\n 'aria-describedby': undefined,\n 'aria-invalid': undefined,\n };\n\n return (\n <div\n {...pt?.root}\n className={rootClassName}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-open={isPickerOpen || undefined}\n data-selected={value !== null || undefined}\n onBlur={onBlur}\n >\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <AriaDatePicker\n value={asDateValue(value, showTime)}\n onChange={(next) => onChange(asDate(next), { source: 'user' })}\n isDisabled={effectiveDisabled}\n isReadOnly={effectiveReadOnly}\n isInvalid={effectiveInvalid}\n isOpen={isPickerOpen}\n onOpenChange={(nextIsOpen) => {\n if (!nextIsOpen || !effectiveReadOnly) setIsPickerOpen(nextIsOpen);\n }}\n minValue={minValue}\n maxValue={maxValue}\n granularity={showTime ? 'minute' : 'day'}\n hourCycle={\n hourFormat === '12' ? 12 : hourFormat === '24' ? 24 : undefined\n }\n aria-label={effectiveAriaLabel}\n aria-labelledby={effectiveAriaLabelledby}\n aria-describedby={effectiveAriaDescribedby}\n className='cratis-date-picker__picker'\n >\n {({ isOpen }) => (\n <>\n <Group\n {...pt?.group}\n id={inputId}\n aria-invalid={effectiveInvalid || undefined}\n className={classNames(\n 'cratis-date-picker__group',\n pt?.group?.className,\n )}\n data-cratis-part='group'\n data-empty={value === null || undefined}\n render={(groupProps) => (\n <div\n {...groupProps}\n data-open={isOpen || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={value !== null || undefined}\n />\n )}\n >\n <DateInput\n {...inputPartAttributes}\n className={classNames(\n 'cratis-date-picker__input',\n pt?.input?.className,\n )}\n style={pt?.input?.style}\n data-cratis-part='input'\n data-placeholder={effectivePlaceholder}\n render={(inputProps) => (\n <div\n {...inputProps}\n data-open={isOpen || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={value !== null || undefined}\n />\n )}\n >\n {(segment) => (\n <DateSegment\n {...pt?.segment}\n segment={segment}\n className={classNames(\n 'cratis-date-picker__segment',\n pt?.segment?.className,\n )}\n data-cratis-part='segment'\n render={(segmentProps) => (\n <span\n {...segmentProps}\n data-invalid={\n effectiveInvalid || undefined\n }\n data-disabled={\n effectiveDisabled || undefined\n }\n data-readonly={\n effectiveReadOnly || undefined\n }\n />\n )}\n />\n )}\n </DateInput>\n {value === null && effectivePlaceholder && (\n <span\n {...pt?.placeholder}\n className={classNames(\n 'cratis-date-picker__placeholder',\n pt?.placeholder?.className,\n )}\n data-cratis-part='placeholder'\n aria-hidden='true'\n >\n {effectivePlaceholder}\n </span>\n )}\n {showIcon && (\n <Button\n {...asReactAriaButtonProps(pt?.trigger)}\n isDisabled={\n effectiveDisabled || effectiveReadOnly\n }\n className={classNames(\n 'cratis-date-picker__trigger',\n pt?.trigger?.className,\n )}\n data-cratis-part='trigger'\n render={(triggerProps) => (\n <button\n {...triggerProps}\n data-open={isOpen || undefined}\n data-invalid={\n effectiveInvalid || undefined\n }\n data-disabled={\n effectiveDisabled ||\n effectiveReadOnly ||\n undefined\n }\n data-readonly={\n effectiveReadOnly || undefined\n }\n data-selected={\n value !== null || undefined\n }\n />\n )}\n aria-label={\n pt?.trigger?.['aria-label'] ??\n datePickerMessages?.openCalendar ??\n 'Open calendar'\n }\n >\n <span aria-hidden='true'>▦</span>\n </Button>\n )}\n </Group>\n <Popover\n {...pt?.popover}\n className={classNames(\n 'cratis-date-picker__popover',\n pt?.popover?.className,\n )}\n style={{\n zIndex: resolvedPopoverZIndex,\n ...pt?.popover?.style,\n }}\n data-cratis-part='popover'\n data-open\n placement='bottom start'\n >\n <Dialog\n {...pt?.dialog}\n className={classNames(\n 'cratis-date-picker__dialog',\n pt?.dialog?.className,\n )}\n data-cratis-part='dialog'\n data-open\n >\n <Calendar\n {...pt?.calendar}\n className={classNames(\n 'cratis-date-picker__calendar',\n pt?.calendar?.className,\n )}\n data-cratis-part='calendar'\n data-open\n >\n <header\n {...pt?.header}\n className={classNames(\n 'cratis-date-picker__header',\n pt?.header?.className,\n )}\n data-cratis-part='header'\n >\n <Button\n {...asReactAriaButtonProps(pt?.previous)}\n slot='previous'\n className={classNames(\n 'cratis-date-picker__nav',\n pt?.previous?.className,\n )}\n data-cratis-part='previous'\n aria-label={\n pt?.previous?.['aria-label'] ??\n datePickerMessages?.previousMonth ??\n 'Previous month'\n }\n >\n <span aria-hidden='true'>\n {icon('previous', '‹')}\n </span>\n </Button>\n <Heading\n {...pt?.heading}\n className={classNames(\n 'cratis-date-picker__heading',\n pt?.heading?.className,\n )}\n data-cratis-part='heading'\n />\n <Button\n {...asReactAriaButtonProps(pt?.next)}\n slot='next'\n className={classNames(\n 'cratis-date-picker__nav',\n pt?.next?.className,\n )}\n data-cratis-part='next'\n aria-label={\n pt?.next?.['aria-label'] ??\n datePickerMessages?.nextMonth ??\n 'Next month'\n }\n >\n <span aria-hidden='true'>\n {icon('next', '›')}\n </span>\n </Button>\n </header>\n <CalendarGrid\n {...pt?.grid}\n className={classNames(\n 'cratis-date-picker__grid',\n pt?.grid?.className,\n )}\n data-cratis-part='grid'\n >\n <CalendarGridHeader>\n {(day) => (\n <CalendarHeaderCell>\n {day}\n </CalendarHeaderCell>\n )}\n </CalendarGridHeader>\n <CalendarGridBody>\n {(date) => (\n <CalendarCell\n {...pt?.cell}\n date={date}\n className={classNames(\n 'cratis-date-picker__cell',\n pt?.cell?.className,\n )}\n data-cratis-part='cell'\n />\n )}\n </CalendarGridBody>\n </CalendarGrid>\n </Calendar>\n {showButtonBar && (\n <div\n {...pt?.buttonBar}\n className={classNames(\n 'cratis-date-picker__button-bar',\n pt?.buttonBar?.className,\n )}\n data-cratis-part='button-bar'\n >\n <button\n {...pt?.today}\n type='button'\n className={classNames(\n 'cratis-date-picker__action',\n pt?.today?.className,\n )}\n data-cratis-part='today'\n data-disabled={\n actionsDisabled || isTodayOutOfBounds || undefined\n }\n disabled={actionsDisabled || isTodayOutOfBounds}\n aria-disabled={\n actionsDisabled || isTodayOutOfBounds || undefined\n }\n onClick={(event) => {\n if (actionsDisabled || isTodayOutOfBounds) return;\n onChange(todayDate, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n >\n {resolvedTodayLabel}\n </button>\n <button\n {...pt?.clear}\n type='button'\n className={classNames(\n 'cratis-date-picker__action',\n pt?.clear?.className,\n )}\n data-cratis-part='clear'\n data-disabled={clearDisabled || undefined}\n disabled={clearDisabled}\n aria-disabled={clearDisabled || pt?.clear?.['aria-disabled'] || undefined}\n onClick={(event) => {\n if (clearDisabled) return;\n onChange(null, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n >\n {resolvedClearLabel}\n </button>\n </div>\n )}\n </Dialog>\n </Popover>\n </>\n )}\n </AriaDatePicker>\n </UNSAFE_PortalProvider>\n </div>\n );\n};\n"],"names":["_jsx","AriaDatePicker","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,MAAM,WAAW,GAAG,CAChB,KAAkB,EAClB,QAA6B,KACX;AAClB,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,IAAI;IACvB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,CAAC;AACjD,IAAA,OAAO,QAAQ,GAAG,KAAK,GAA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B,IAAI,SAAS,EAEtD,OAAO,EAAE,CAAC,KAAK,KAAI;oDACf,IAAI,eAAe,IAAI,kBAAkB;wDAAE;oDAC3C,QAAQ,CAAC,SAAS,EAAE;AAChB,wDAAA,MAAM,EAAE,MAAM;wDACd,WAAW,EAAE,KAAK,CAAC,WAAW;AACjC,qDAAA,CAAC;gDACN,CAAC,EAAA,QAAA,EAEA,kBAAkB,EAAA,CACd,EACTA,GAAA,CAAA,QAAA,EAAA,EAAA,GACQ,EAAE,EAAE,KAAK,EACb,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,UAAU,CACjB,4BAA4B,EAC5B,EAAE,EAAE,KAAK,EAAE,SAAS,CACvB,EAAA,kBAAA,EACgB,OAAO,EAAA,eAAA,EACT,aAAa,IAAI,SAAS,EACzC,QAAQ,EAAE,aAAa,EAAA,eAAA,EACR,aAAa,IAAI,EAAE,EAAE,KAAK,GAAG,eAAe,CAAC,IAAI,SAAS,EACzE,OAAO,EAAE,CAAC,KAAK,KAAI;AACf,oDAAA,IAAI,aAAa;wDAAE;oDACnB,QAAQ,CAAC,IAAI,EAAE;AACX,wDAAA,MAAM,EAAE,MAAM;wDACd,WAAW,EAAE,KAAK,CAAC,WAAW;AACjC,qDAAA,CAAC;AACN,gDAAA,CAAC,EAAA,QAAA,EAEA,kBAAkB,EAAA,CACd,CAAA,EAAA,CACP,CACT,CAAA,EAAA,CACI,EAAA,CACH,CAAA,EAAA,CACX,CACN,EAAA,CACY,EAAA,CACG,EAAA,CACtB;AAEd;;"}
|
|
1
|
+
{"version":3,"file":"DatePickerInputImplementation.js","sources":["../../../Common/DatePickerInputImplementation.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 { useState } from 'react';\nimport {\n Button,\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n DateInput,\n DatePicker as AriaDatePicker,\n DateSegment,\n Group,\n Popover,\n type DateValue,\n} from 'react-aria-components/DatePicker';\nimport { Dialog } from 'react-aria-components/Dialog';\nimport { Heading } from 'react-aria-components/Heading';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { useCratisComponentsConfig } from './CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport { OVERLAY_OFFSET, zIndexAboveDialog } from '../renderer/dialogStack';\nimport { useNearestDialogZIndex } from '../renderer/DialogStackContext';\nimport { asReactAriaButtonProps } from './reactAriaProps';\nimport {\n fromDate,\n getLocalTimeZone,\n today,\n toCalendarDate,\n} from '@internationalized/date';\nimport type { DatePickerInputProps } from './DatePickerInput';\nimport { classNames } from '../ClassNames/classNames';\n\nconst asDateValue = (\n value: Date | null,\n showTime: boolean | undefined,\n): DateValue | null => {\n if (!value) return null;\n const zoned = fromDate(value, getLocalTimeZone());\n return showTime ? zoned : toCalendarDate(zoned);\n};\n\nconst asDate = (value: DateValue | null): Date | null =>\n value ? value.toDate(getLocalTimeZone()) : null;\n\n/**\n * An internationalized date or date-time picker with Cratis-owned markup parts.\n * The public boundary remains `Date | null`; React Aria's calendar values stay internal.\n */\nexport const DatePickerInputImplementation = ({\n value,\n onChange,\n onBlur,\n invalid,\n disabled,\n readOnly,\n id,\n showButtonBar,\n isNonModal = false,\n placeholder,\n showIcon = true,\n showTime,\n hourFormat,\n minDate,\n maxDate,\n className,\n style,\n pt,\n todayLabel,\n clearLabel,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n}: DatePickerInputProps) => {\n const [isPickerOpen, setIsPickerOpen] = useState(false);\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const nearestDialogZIndex = useNearestDialogZIndex();\n const resolvedPopoverZIndex =\n nearestDialogZIndex === null\n ? 'var(--cratis-z-index-overlay)'\n : zIndexAboveDialog(nearestDialogZIndex, OVERLAY_OFFSET);\n const { messages } = useCratisComponentsConfig();\n const datePickerMessages = messages?.datePicker;\n const icon = useCratisIcon();\n const resolvedTodayLabel = todayLabel ?? datePickerMessages?.today ?? 'Today';\n const resolvedClearLabel = clearLabel ?? datePickerMessages?.clear ?? 'Clear';\n const timeZone = getLocalTimeZone();\n const minValue = asDateValue(minDate ?? null, showTime) ?? undefined;\n const maxValue = asDateValue(maxDate ?? null, showTime) ?? undefined;\n const todayDate = today(timeZone).toDate(timeZone);\n // Compare the same granularity that the action emits. In date-time mode the Today action\n // retains its existing local-midnight value, which can legitimately fall before a same-day\n // minDate carrying a later time.\n const todayValue = asDateValue(todayDate, showTime)!;\n const isTodayOutOfBounds =\n (minValue !== undefined && todayValue.compare(minValue) < 0) ||\n (maxValue !== undefined && todayValue.compare(maxValue) > 0);\n const rootClassName = classNames(\n 'cratis-date-picker',\n pt?.root?.className,\n className,\n );\n const inputId = id ?? pt?.input?.id;\n const effectiveDisabled = disabled ?? pt?.input?.disabled ?? false;\n const effectiveReadOnly = readOnly ?? pt?.input?.readOnly ?? false;\n const effectiveInvalid = invalid ?? pt?.input?.['aria-invalid'] ?? false;\n const actionsDisabled = effectiveDisabled || effectiveReadOnly;\n const clearDisabled = actionsDisabled || pt?.clear?.disabled || false;\n const effectivePlaceholder = placeholder ?? pt?.input?.placeholder;\n const effectiveAriaLabel =\n ariaLabel ??\n pt?.input?.['aria-label'] ??\n effectivePlaceholder ??\n datePickerMessages?.label ??\n 'Date';\n const effectiveAriaLabelledby = ariaLabelledby ?? pt?.input?.['aria-labelledby'];\n const effectiveAriaDescribedby = ariaDescribedby ?? pt?.input?.['aria-describedby'];\n const inputPartAttributes = {\n ...pt?.input,\n id: undefined,\n className: undefined,\n style: undefined,\n disabled: undefined,\n readOnly: undefined,\n placeholder: undefined,\n 'aria-label': undefined,\n 'aria-labelledby': undefined,\n 'aria-describedby': undefined,\n 'aria-invalid': undefined,\n };\n\n return (\n <div\n {...pt?.root}\n className={rootClassName}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-open={isPickerOpen || undefined}\n data-selected={value !== null || undefined}\n onBlur={onBlur}\n >\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <AriaDatePicker\n value={asDateValue(value, showTime)}\n onChange={(next) => onChange(asDate(next), { source: 'user' })}\n isDisabled={effectiveDisabled}\n isReadOnly={effectiveReadOnly}\n isInvalid={effectiveInvalid}\n isOpen={isPickerOpen}\n onOpenChange={(nextIsOpen) => {\n if (!nextIsOpen || !effectiveReadOnly) setIsPickerOpen(nextIsOpen);\n }}\n minValue={minValue}\n maxValue={maxValue}\n granularity={showTime ? 'minute' : 'day'}\n hourCycle={\n hourFormat === '12' ? 12 : hourFormat === '24' ? 24 : undefined\n }\n aria-label={effectiveAriaLabel}\n aria-labelledby={effectiveAriaLabelledby}\n aria-describedby={effectiveAriaDescribedby}\n className='cratis-date-picker__picker'\n >\n {({ isOpen }) => (\n <>\n <Group\n {...pt?.group}\n id={inputId}\n aria-invalid={effectiveInvalid || undefined}\n className={classNames(\n 'cratis-date-picker__group',\n pt?.group?.className,\n )}\n data-cratis-part='group'\n data-empty={value === null || undefined}\n render={(groupProps) => (\n <div\n {...groupProps}\n data-open={isOpen || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={value !== null || undefined}\n />\n )}\n >\n <DateInput\n {...inputPartAttributes}\n className={classNames(\n 'cratis-date-picker__input',\n pt?.input?.className,\n )}\n style={pt?.input?.style}\n data-cratis-part='input'\n data-placeholder={effectivePlaceholder}\n render={(inputProps) => (\n <div\n {...inputProps}\n data-open={isOpen || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={value !== null || undefined}\n />\n )}\n >\n {(segment) => (\n <DateSegment\n {...pt?.segment}\n segment={segment}\n className={classNames(\n 'cratis-date-picker__segment',\n pt?.segment?.className,\n )}\n data-cratis-part='segment'\n render={(segmentProps) => (\n <span\n {...segmentProps}\n data-invalid={\n effectiveInvalid || undefined\n }\n data-disabled={\n effectiveDisabled || undefined\n }\n data-readonly={\n effectiveReadOnly || undefined\n }\n />\n )}\n />\n )}\n </DateInput>\n {value === null && effectivePlaceholder && (\n <span\n {...pt?.placeholder}\n className={classNames(\n 'cratis-date-picker__placeholder',\n pt?.placeholder?.className,\n )}\n data-cratis-part='placeholder'\n aria-hidden='true'\n >\n {effectivePlaceholder}\n </span>\n )}\n {showIcon && (\n <Button\n {...asReactAriaButtonProps(pt?.trigger)}\n isDisabled={\n effectiveDisabled || effectiveReadOnly\n }\n className={classNames(\n 'cratis-date-picker__trigger',\n pt?.trigger?.className,\n )}\n data-cratis-part='trigger'\n render={(triggerProps) => (\n <button\n {...triggerProps}\n data-open={isOpen || undefined}\n data-invalid={\n effectiveInvalid || undefined\n }\n data-disabled={\n effectiveDisabled ||\n effectiveReadOnly ||\n undefined\n }\n data-readonly={\n effectiveReadOnly || undefined\n }\n data-selected={\n value !== null || undefined\n }\n />\n )}\n aria-label={\n pt?.trigger?.['aria-label'] ??\n datePickerMessages?.openCalendar ??\n 'Open calendar'\n }\n >\n <span aria-hidden='true'>▦</span>\n </Button>\n )}\n </Group>\n <Popover\n {...pt?.popover}\n isNonModal={isNonModal}\n className={classNames(\n 'cratis-date-picker__popover',\n pt?.popover?.className,\n )}\n style={{\n zIndex: resolvedPopoverZIndex,\n ...pt?.popover?.style,\n }}\n data-cratis-part='popover'\n data-open\n placement='bottom start'\n >\n <Dialog\n {...pt?.dialog}\n className={classNames(\n 'cratis-date-picker__dialog',\n pt?.dialog?.className,\n )}\n data-cratis-part='dialog'\n data-open\n >\n <Calendar\n {...pt?.calendar}\n className={classNames(\n 'cratis-date-picker__calendar',\n pt?.calendar?.className,\n )}\n data-cratis-part='calendar'\n data-open\n >\n <header\n {...pt?.header}\n className={classNames(\n 'cratis-date-picker__header',\n pt?.header?.className,\n )}\n data-cratis-part='header'\n >\n <Button\n {...asReactAriaButtonProps(pt?.previous)}\n slot='previous'\n className={classNames(\n 'cratis-date-picker__nav',\n pt?.previous?.className,\n )}\n data-cratis-part='previous'\n aria-label={\n pt?.previous?.['aria-label'] ??\n datePickerMessages?.previousMonth ??\n 'Previous month'\n }\n >\n <span aria-hidden='true'>\n {icon('previous', '‹')}\n </span>\n </Button>\n <Heading\n {...pt?.heading}\n className={classNames(\n 'cratis-date-picker__heading',\n pt?.heading?.className,\n )}\n data-cratis-part='heading'\n />\n <Button\n {...asReactAriaButtonProps(pt?.next)}\n slot='next'\n className={classNames(\n 'cratis-date-picker__nav',\n pt?.next?.className,\n )}\n data-cratis-part='next'\n aria-label={\n pt?.next?.['aria-label'] ??\n datePickerMessages?.nextMonth ??\n 'Next month'\n }\n >\n <span aria-hidden='true'>\n {icon('next', '›')}\n </span>\n </Button>\n </header>\n <CalendarGrid\n {...pt?.grid}\n className={classNames(\n 'cratis-date-picker__grid',\n pt?.grid?.className,\n )}\n data-cratis-part='grid'\n >\n <CalendarGridHeader>\n {(day) => (\n <CalendarHeaderCell>\n {day}\n </CalendarHeaderCell>\n )}\n </CalendarGridHeader>\n <CalendarGridBody>\n {(date) => (\n <CalendarCell\n {...pt?.cell}\n date={date}\n className={classNames(\n 'cratis-date-picker__cell',\n pt?.cell?.className,\n )}\n data-cratis-part='cell'\n />\n )}\n </CalendarGridBody>\n </CalendarGrid>\n </Calendar>\n {showButtonBar && (\n <div\n {...pt?.buttonBar}\n className={classNames(\n 'cratis-date-picker__button-bar',\n pt?.buttonBar?.className,\n )}\n data-cratis-part='button-bar'\n >\n <button\n {...pt?.today}\n type='button'\n className={classNames(\n 'cratis-date-picker__action',\n pt?.today?.className,\n )}\n data-cratis-part='today'\n data-disabled={\n actionsDisabled || isTodayOutOfBounds || undefined\n }\n disabled={actionsDisabled || isTodayOutOfBounds}\n aria-disabled={\n actionsDisabled || isTodayOutOfBounds || undefined\n }\n onClick={(event) => {\n if (actionsDisabled || isTodayOutOfBounds) return;\n onChange(todayDate, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n >\n {resolvedTodayLabel}\n </button>\n <button\n {...pt?.clear}\n type='button'\n className={classNames(\n 'cratis-date-picker__action',\n pt?.clear?.className,\n )}\n data-cratis-part='clear'\n data-disabled={clearDisabled || undefined}\n disabled={clearDisabled}\n aria-disabled={clearDisabled || pt?.clear?.['aria-disabled'] || undefined}\n onClick={(event) => {\n if (clearDisabled) return;\n onChange(null, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n >\n {resolvedClearLabel}\n </button>\n </div>\n )}\n </Dialog>\n </Popover>\n </>\n )}\n </AriaDatePicker>\n </UNSAFE_PortalProvider>\n </div>\n );\n};\n"],"names":["_jsx","AriaDatePicker","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,MAAM,WAAW,GAAG,CAChB,KAAkB,EAClB,QAA6B,KACX;AAClB,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,IAAI;IACvB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,CAAC;AACjD,IAAA,OAAO,QAAQ,GAAG,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC;AACnD,CAAC;AAED,MAAM,MAAM,GAAG,CAAC,KAAuB,KACnC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC,GAAG,IAAI;AAM5C,MAAM,6BAA6B,GAAG,CAAC,EAC1C,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,aAAa,EACb,UAAU,GAAG,KAAK,EAClB,WAAW,EACX,QAAQ,GAAG,IAAI,EACf,QAAQ,EACR,UAAU,EACV,OAAO,EACP,OAAO,EACP,SAAS,EACT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AAS,EAAE,UAAU,CACjB,4BAA4B,EAC5B,EAAE,EAAE,KAAK,EAAE,SAAS,CACvB,EAAA,kBAAA,EACgB,OAAO,EAAA,eAAA,EACT,aAAa,IAAI,SAAS,EACzC,QAAQ,EAAE,aAAa,EAAA,eAAA,EACR,aAAa,IAAI,EAAE,EAAE,KAAK,GAAG,eAAe,CAAC,IAAI,SAAS,EACzE,OAAO,EAAE,CAAC,KAAK,KAAI;AACf,oDAAA,IAAI,aAAa;wDAAE;oDACnB,QAAQ,CAAC,IAAI,EAAE;AACX,wDAAA,MAAM,EAAE,MAAM;wDACd,WAAW,EAAE,KAAK,CAAC,WAAW;AACjC,qDAAA,CAAC;AACN,gDAAA,CAAC,EAAA,QAAA,EAEA,kBAAkB,EAAA,CACd,CAAA,EAAA,CACP,CACT,CAAA,EAAA,CACI,EAAA,CACH,CAAA,EAAA,CACX,CACN,EAAA,CACY,EAAA,CACG,EAAA,CACtB;AAEd;;"}
|
|
@@ -99,8 +99,17 @@ export interface DialogProps {
|
|
|
99
99
|
noLabel?: string;
|
|
100
100
|
/** Accessible label for the header close button. Falls back to the provider's `dialog.close` message, then `'Close'`. */
|
|
101
101
|
closeAriaLabel?: string;
|
|
102
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Combined default for header, Escape, and backdrop dismissal. Defaults to true
|
|
104
|
+
* for predefined buttons and false for custom/no footer. Independent props override it.
|
|
105
|
+
*/
|
|
103
106
|
dismissable?: boolean;
|
|
107
|
+
/** Whether outside clicks dismiss the dialog. Falls back to `dismissable`; blocked while busy. */
|
|
108
|
+
dismissOnOutsideClick?: boolean;
|
|
109
|
+
/** Whether Escape dismisses the dialog. Falls back to `dismissable`; blocked while busy. */
|
|
110
|
+
closeOnEscape?: boolean;
|
|
111
|
+
/** Whether to show the header close button. Falls back to `dismissable`; disabled while busy. */
|
|
112
|
+
showCloseButton?: boolean;
|
|
104
113
|
/** Extra class name for the modal root. */
|
|
105
114
|
className?: string;
|
|
106
115
|
/** C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;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kGAAkG;IAClG,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,4FAA4F;IAC5F,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iGAAiG;IACjG,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAQD;;;GAGG;AACH,eAAO,MAAM,MAAM,UAAW,WAAW,+FAGxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../../../Dialogs/Dialog.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 type { DialogResult, DialogButtons } from '@cratis/arc.react/dialogs';\nimport type {\n ButtonHTMLAttributes,\n CSSProperties,\n HTMLAttributes,\n ReactNode,\n} from 'react';\nimport { unstable_useSlot } from '../renderer/RendererContext';\nimport { renderSlot } from '../renderer/renderSlot';\nimport type { unstable_SlotDeclaration } from '../renderer/slots';\nimport type { DialogInitialFocus } from './DialogInitialFocus';\nimport { DialogImplementation } from './DialogImplementation';\n\n/** Callback handling a typed dialog result; return `false` to keep the dialog open. */\nexport type CloseDialog = (\n result: DialogResult,\n) => boolean | void | Promise<boolean> | Promise<void>;\n\n/** Confirmation callback; return `true` to permit host closure. */\nexport type ConfirmCallback = () => boolean | void | Promise<boolean> | Promise<void>;\n/** Cancellation callback; return `true` to permit host closure. */\nexport type CancelCallback = () => boolean | void | Promise<boolean> | Promise<void>;\n\ntype DialogPartAttributes<TElement> = HTMLAttributes<TElement> & {\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\ntype DialogButtonAttributes = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'value'\n>;\n\n/**\n * Where a {@link Dialog} sits in the viewport. `center` is the classic modal; `start` and `end`\n * make it a full-height side sheet against the inline-start or inline-end edge.\n */\nexport type DialogPlacement = 'center' | 'start' | 'end';\n\n/** Stable Cratis-owned parts for styling a {@link Dialog}. */\nexport interface DialogParts {\n /** Viewport backdrop and dismissal surface. */\n backdrop?: DialogPartAttributes<HTMLDivElement>;\n /** Viewport positioning wrapper. */\n positioner?: DialogPartAttributes<HTMLDivElement>;\n /** Modal root. */\n root?: DialogPartAttributes<HTMLDivElement>;\n /** Header containing title and optional close action. */\n header?: DialogPartAttributes<HTMLElement>;\n /** Dialog heading. */\n title?: DialogPartAttributes<HTMLHeadingElement>;\n /** Secondary line under the heading, rendered only when `subtitle` is set. */\n subtitle?: DialogPartAttributes<HTMLParagraphElement>;\n /** Header close button. */\n close?: DialogButtonAttributes;\n /** Dialog content region. */\n content?: DialogPartAttributes<HTMLDivElement>;\n /** Footer action region. */\n footer?: DialogPartAttributes<HTMLElement>;\n /** Primary confirmation button. */\n confirm?: DialogButtonAttributes;\n /** Secondary dismissal button(s). */\n cancel?: DialogButtonAttributes;\n}\n\n/** Props for {@link Dialog}. */\nexport interface DialogProps {\n /** Dialog heading. */\n title: string;\n /**\n * Secondary line under the heading — a reference, a status, a short summary. Announced as the\n * dialog's description.\n */\n subtitle?: ReactNode;\n /**\n * Viewport placement. `center` (default) is a modal; `start` and `end` render a full-height\n * side sheet against that inline edge, sliding in from it. Dismissal, focus and busy behavior\n * are identical across placements.\n */\n placement?: DialogPlacement;\n /**\n * Glyph for the header close button. Names this one dialog and wins over the provider's\n * `icons.close`; defaults to a multiplication sign when neither is set.\n */\n closeIcon?: ReactNode;\n /** Controlled open state. Defaults to `true`. */\n visible?: boolean;\n /** Combined result callback used when a dedicated confirm/cancel callback is absent. */\n onClose?: CloseDialog;\n /** Invoked by primary confirmation actions. */\n onConfirm?: ConfirmCallback;\n /** Invoked by cancellation actions. */\n onCancel?: CancelCallback;\n /** Predefined Arc buttons, custom footer content, or `null` for no footer. */\n buttons?: DialogButtons | ReactNode;\n /** Initial focus target. Defaults to the confirmation action. */\n initialFocus?: DialogInitialFocus;\n /** Dialog body content. */\n children: ReactNode;\n /** CSS width. Defaults to `450px`. */\n width?: string;\n /** Modal-root inline style. */\n style?: CSSProperties;\n /** Content-region inline style. */\n contentStyle?: CSSProperties;\n /**\n * @deprecated The Cratis dialog is viewport-bounded rather than resizable. Remove this prop.\n */\n resizable?: boolean;\n /** Whether the primary action is enabled. Defaults to `true`. */\n isValid?: boolean;\n /** Disables every action and dismissal path while work is in flight. */\n isBusy?: boolean;\n /** Label for the Ok action. Falls back to the provider's `dialog.ok` message, then `'Ok'`. */\n okLabel?: string;\n /** Label for the Cancel action. Falls back to the provider's `dialog.cancel` message, then `'Cancel'`. */\n cancelLabel?: string;\n /** Label for the Yes action. Falls back to the provider's `dialog.yes` message, then `'Yes'`. */\n yesLabel?: string;\n /** Label for the No action. Falls back to the provider's `dialog.no` message, then `'No'`. */\n noLabel?: string;\n /** Accessible label for the header close button. Falls back to the provider's `dialog.close` message, then `'Close'`. */\n closeAriaLabel?: string;\n
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../../Dialogs/Dialog.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 type { DialogResult, DialogButtons } from '@cratis/arc.react/dialogs';\nimport type {\n ButtonHTMLAttributes,\n CSSProperties,\n HTMLAttributes,\n ReactNode,\n} from 'react';\nimport { unstable_useSlot } from '../renderer/RendererContext';\nimport { renderSlot } from '../renderer/renderSlot';\nimport type { unstable_SlotDeclaration } from '../renderer/slots';\nimport type { DialogInitialFocus } from './DialogInitialFocus';\nimport { DialogImplementation } from './DialogImplementation';\n\n/** Callback handling a typed dialog result; return `false` to keep the dialog open. */\nexport type CloseDialog = (\n result: DialogResult,\n) => boolean | void | Promise<boolean> | Promise<void>;\n\n/** Confirmation callback; return `true` to permit host closure. */\nexport type ConfirmCallback = () => boolean | void | Promise<boolean> | Promise<void>;\n/** Cancellation callback; return `true` to permit host closure. */\nexport type CancelCallback = () => boolean | void | Promise<boolean> | Promise<void>;\n\ntype DialogPartAttributes<TElement> = HTMLAttributes<TElement> & {\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\ntype DialogButtonAttributes = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'value'\n>;\n\n/**\n * Where a {@link Dialog} sits in the viewport. `center` is the classic modal; `start` and `end`\n * make it a full-height side sheet against the inline-start or inline-end edge.\n */\nexport type DialogPlacement = 'center' | 'start' | 'end';\n\n/** Stable Cratis-owned parts for styling a {@link Dialog}. */\nexport interface DialogParts {\n /** Viewport backdrop and dismissal surface. */\n backdrop?: DialogPartAttributes<HTMLDivElement>;\n /** Viewport positioning wrapper. */\n positioner?: DialogPartAttributes<HTMLDivElement>;\n /** Modal root. */\n root?: DialogPartAttributes<HTMLDivElement>;\n /** Header containing title and optional close action. */\n header?: DialogPartAttributes<HTMLElement>;\n /** Dialog heading. */\n title?: DialogPartAttributes<HTMLHeadingElement>;\n /** Secondary line under the heading, rendered only when `subtitle` is set. */\n subtitle?: DialogPartAttributes<HTMLParagraphElement>;\n /** Header close button. */\n close?: DialogButtonAttributes;\n /** Dialog content region. */\n content?: DialogPartAttributes<HTMLDivElement>;\n /** Footer action region. */\n footer?: DialogPartAttributes<HTMLElement>;\n /** Primary confirmation button. */\n confirm?: DialogButtonAttributes;\n /** Secondary dismissal button(s). */\n cancel?: DialogButtonAttributes;\n}\n\n/** Props for {@link Dialog}. */\nexport interface DialogProps {\n /** Dialog heading. */\n title: string;\n /**\n * Secondary line under the heading — a reference, a status, a short summary. Announced as the\n * dialog's description.\n */\n subtitle?: ReactNode;\n /**\n * Viewport placement. `center` (default) is a modal; `start` and `end` render a full-height\n * side sheet against that inline edge, sliding in from it. Dismissal, focus and busy behavior\n * are identical across placements.\n */\n placement?: DialogPlacement;\n /**\n * Glyph for the header close button. Names this one dialog and wins over the provider's\n * `icons.close`; defaults to a multiplication sign when neither is set.\n */\n closeIcon?: ReactNode;\n /** Controlled open state. Defaults to `true`. */\n visible?: boolean;\n /** Combined result callback used when a dedicated confirm/cancel callback is absent. */\n onClose?: CloseDialog;\n /** Invoked by primary confirmation actions. */\n onConfirm?: ConfirmCallback;\n /** Invoked by cancellation actions. */\n onCancel?: CancelCallback;\n /** Predefined Arc buttons, custom footer content, or `null` for no footer. */\n buttons?: DialogButtons | ReactNode;\n /** Initial focus target. Defaults to the confirmation action. */\n initialFocus?: DialogInitialFocus;\n /** Dialog body content. */\n children: ReactNode;\n /** CSS width. Defaults to `450px`. */\n width?: string;\n /** Modal-root inline style. */\n style?: CSSProperties;\n /** Content-region inline style. */\n contentStyle?: CSSProperties;\n /**\n * @deprecated The Cratis dialog is viewport-bounded rather than resizable. Remove this prop.\n */\n resizable?: boolean;\n /** Whether the primary action is enabled. Defaults to `true`. */\n isValid?: boolean;\n /** Disables every action and dismissal path while work is in flight. */\n isBusy?: boolean;\n /** Label for the Ok action. Falls back to the provider's `dialog.ok` message, then `'Ok'`. */\n okLabel?: string;\n /** Label for the Cancel action. Falls back to the provider's `dialog.cancel` message, then `'Cancel'`. */\n cancelLabel?: string;\n /** Label for the Yes action. Falls back to the provider's `dialog.yes` message, then `'Yes'`. */\n yesLabel?: string;\n /** Label for the No action. Falls back to the provider's `dialog.no` message, then `'No'`. */\n noLabel?: string;\n /** Accessible label for the header close button. Falls back to the provider's `dialog.close` message, then `'Close'`. */\n closeAriaLabel?: string;\n /**\n * Combined default for header, Escape, and backdrop dismissal. Defaults to true\n * for predefined buttons and false for custom/no footer. Independent props override it.\n */\n dismissable?: boolean;\n /** Whether outside clicks dismiss the dialog. Falls back to `dismissable`; blocked while busy. */\n dismissOnOutsideClick?: boolean;\n /** Whether Escape dismisses the dialog. Falls back to `dismissable`; blocked while busy. */\n closeOnEscape?: boolean;\n /** Whether to show the header close button. Falls back to `dismissable`; disabled while busy. */\n showCloseButton?: boolean;\n /** Extra class name for the modal root. */\n className?: string;\n /** Cratis-owned per-part attributes. */\n pt?: DialogParts;\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n}\n\nconst coreDialogDeclaration = Object.freeze({\n mode: 'atomic',\n fidelity: 'native',\n render: DialogImplementation,\n}) satisfies unstable_SlotDeclaration<'dialogs.dialog'>;\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 Dialog = (props: DialogProps) => {\n const declaration = unstable_useSlot('dialogs.dialog', coreDialogDeclaration);\n return renderSlot(declaration, props);\n};\n"],"names":[],"mappings":";;;;AAsJA,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC;AACxC,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,MAAM,EAAE,oBAAoB;AAC/B,CAAA,CAAsD;AAMhD,MAAM,MAAM,GAAG,CAAC,KAAkB,KAAI;IACzC,MAAM,WAAW,GAAG,gBAAgB,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;AAC7E,IAAA,OAAO,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC;AACzC;;"}
|
|
@@ -4,5 +4,5 @@ import type { DialogProps } from './Dialog.js';
|
|
|
4
4
|
* A modal dialog with Arc host integration, typed footer actions, busy/validity
|
|
5
5
|
* state, controlled dismissal, and stable Cratis-owned styling parts.
|
|
6
6
|
*/
|
|
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
|
+
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, dismissOnOutsideClick, closeOnEscape, showCloseButton, className, pt, }: DialogProps) => React.JSX.Element | null;
|
|
8
8
|
//# sourceMappingURL=DialogImplementation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAkC5C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,gTA4B9B,WAAW,6BAmdb,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { UNSAFE_PortalProvider } from 'react-aria';
|
|
|
6
6
|
import { useId, useRef, useState, useLayoutEffect, useEffect, useSyncExternalStore } from 'react';
|
|
7
7
|
import { unstable_useOverlayEnvironment } from '../renderer/RendererContext.js';
|
|
8
8
|
import { DialogInitialFocus } from './DialogInitialFocus.js';
|
|
9
|
+
import { resolveDialogDismissal } from './resolveDialogDismissal.js';
|
|
9
10
|
import 'react-aria-components/I18nProvider';
|
|
10
11
|
import 'ts-deepmerge';
|
|
11
12
|
import 'react-dom';
|
|
@@ -29,7 +30,7 @@ const visuallyHidden = {
|
|
|
29
30
|
};
|
|
30
31
|
const subscribeToBrowserEnvironment = () => () => undefined;
|
|
31
32
|
const useIsBrowser = () => useSyncExternalStore(subscribeToBrowserEnvironment, () => true, () => false);
|
|
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, }) => {
|
|
33
|
+
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, dismissOnOutsideClick, closeOnEscape, showCloseButton, className, pt, }) => {
|
|
33
34
|
const overlayEnvironment = unstable_useOverlayEnvironment();
|
|
34
35
|
const { messages } = useCratisComponentsConfig();
|
|
35
36
|
const dialogMessages = messages?.dialog;
|
|
@@ -67,8 +68,9 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
67
68
|
const focusesConfirmButton = resolvedInitialFocus === DialogInitialFocus.Confirm;
|
|
68
69
|
const focusesDismissingButton = resolvedInitialFocus === DialogInitialFocus.Cancel;
|
|
69
70
|
const focusesTitle = resolvedInitialFocus === DialogInitialFocus.Content;
|
|
70
|
-
const
|
|
71
|
-
|
|
71
|
+
const { allowsOutsideDismissal, allowsEscapeDismissal, showsCloseButton } = resolveDialogDismissal({
|
|
72
|
+
buttons, dismissable, dismissOnOutsideClick, closeOnEscape, showCloseButton, isBusy,
|
|
73
|
+
});
|
|
72
74
|
const [dialogTier, setDialogTier] = useState(null);
|
|
73
75
|
useLayoutEffect(() => {
|
|
74
76
|
if (!visible) {
|
|
@@ -175,7 +177,7 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
175
177
|
return null;
|
|
176
178
|
}
|
|
177
179
|
};
|
|
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 })),
|
|
180
|
+
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 })), showsCloseButton && (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) })] }) }) }));
|
|
179
181
|
const dialogStyle = { width, ...pt?.root?.style, ...style };
|
|
180
182
|
if (!isBrowser) {
|
|
181
183
|
if (!visible)
|
|
@@ -188,7 +190,7 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
188
190
|
return (jsx(UNSAFE_PortalProvider, { getContainer: overlayEnvironment.getContainer, children: jsx(ModalOverlay, { ...pt?.backdrop, isOpen: visible, onOpenChange: (open) => {
|
|
189
191
|
if (!open && !isBusy)
|
|
190
192
|
void handleClose(DialogResult.Cancelled);
|
|
191
|
-
}, isDismissable:
|
|
193
|
+
}, isDismissable: allowsOutsideDismissal, isKeyboardDismissDisabled: !allowsEscapeDismissal, className: classNames('cratis-dialog__backdrop', pt?.backdrop?.className), style: {
|
|
192
194
|
zIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN,
|
|
193
195
|
...pt?.backdrop?.style,
|
|
194
196
|
}, "data-cratis-part": 'backdrop', "data-placement": placement, "data-open": visible || undefined, "data-busy": isBusy || undefined, children: jsx("div", { ...pt?.positioner, className: classNames('cratis-dialog__positioner', pt?.positioner?.className), style: pt?.positioner?.style, "data-cratis-part": 'positioner', "data-placement": placement, "data-open": visible || undefined, "data-busy": isBusy || undefined, children: jsx(Modal, { ...pt?.root, className: classNames('cratis-dialog', pt?.root?.className, className), style: dialogStyle, "data-cratis-part": 'root', "data-placement": placement, "data-open": visible || undefined, "data-busy": isBusy || undefined, children: dialogDocument }) }) }) }));
|
|
@@ -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 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,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sBACX,YAAY,EAAA,gBAAA,EACb,SAAS,EAAA,WAAA,EACd,OAAO,IAAI,SAAS,EAAA,WAAA,EACpB,MAAM,IAAI,SAAS,EAAA,QAAA,EAE9BA,IAAC,KAAK,EAAA,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 { resolveDialogDismissal } from './resolveDialogDismissal';\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 dismissOnOutsideClick,\n closeOnEscape,\n showCloseButton,\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 { allowsOutsideDismissal, allowsEscapeDismissal, showsCloseButton } = resolveDialogDismissal({\n buttons, dismissable, dismissOnOutsideClick, closeOnEscape, showCloseButton, isBusy,\n });\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 {showsCloseButton && (\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={allowsOutsideDismissal}\n isKeyboardDismissDisabled={!allowsEscapeDismissal}\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":";;;;;;;;;;;;;;;;;;;AAyBA,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,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AAc,IAAI,mBAAmB;AAC7C,gBAAA,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK;aACzB,EAAA,kBAAA,EACgB,UAAU,oBACX,SAAS,EAAA,WAAA,EACd,OAAO,IAAI,SAAS,eACpB,MAAM,IAAI,SAAS,EAAA,QAAA,EAE9BA,GAAA,CAAA,KAAA,EAAA,EAAA,GACQ,EAAE,EAAE,UAAU,EAClB,SAAS,EAAE,UAAU,CACjB,2BAA2B,EAC3B,EAAE,EAAE,UAAU,EAAE,SAAS,CAC5B,EACD,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,sBACX,YAAY,EAAA,gBAAA,EACb,SAAS,EAAA,WAAA,EACd,OAAO,IAAI,SAAS,EAAA,WAAA,EACpB,MAAM,IAAI,SAAS,EAAA,QAAA,EAE9BA,IAAC,KAAK,EAAA,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;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DialogProps } from './Dialog.js';
|
|
2
|
+
/** Resolve independent dismissal paths without allowing overrides to bypass busy state. */
|
|
3
|
+
export declare const resolveDialogDismissal: ({ buttons, dismissable, dismissOnOutsideClick, closeOnEscape, showCloseButton, isBusy, }: Pick<DialogProps, 'buttons' | 'dismissable' | 'dismissOnOutsideClick' | 'closeOnEscape' | 'showCloseButton' | 'isBusy'>) => {
|
|
4
|
+
allowsOutsideDismissal: boolean;
|
|
5
|
+
allowsEscapeDismissal: boolean;
|
|
6
|
+
showsCloseButton: boolean;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=resolveDialogDismissal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveDialogDismissal.d.ts","sourceRoot":"","sources":["../../../Dialogs/resolveDialogDismissal.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAU,CAAC;AAE5C,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,6FAOhC,IAAI,CACH,WAAW,EACT,SAAS,GACT,aAAa,GACb,uBAAuB,GACvB,eAAe,GACf,iBAAiB,GACjB,QAAQ,CACb;IAGO,sBAAsB;IACtB,qBAAqB;IACrB,gBAAgB;CAEvB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const resolveDialogDismissal = ({ buttons, dismissable, dismissOnOutsideClick, closeOnEscape, showCloseButton, isBusy, }) => {
|
|
2
|
+
const allowsDismissal = dismissable ?? typeof buttons === 'number';
|
|
3
|
+
return {
|
|
4
|
+
allowsOutsideDismissal: (dismissOnOutsideClick ?? allowsDismissal) && !isBusy,
|
|
5
|
+
allowsEscapeDismissal: (closeOnEscape ?? allowsDismissal) && !isBusy,
|
|
6
|
+
showsCloseButton: showCloseButton ?? allowsDismissal,
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { resolveDialogDismissal };
|
|
11
|
+
//# sourceMappingURL=resolveDialogDismissal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveDialogDismissal.js","sources":["../../../Dialogs/resolveDialogDismissal.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { DialogProps } from './Dialog';\n\n/** Resolve independent dismissal paths without allowing overrides to bypass busy state. */\nexport const resolveDialogDismissal = ({\n buttons,\n dismissable,\n dismissOnOutsideClick,\n closeOnEscape,\n showCloseButton,\n isBusy,\n}: Pick<\n DialogProps,\n | 'buttons'\n | 'dismissable'\n | 'dismissOnOutsideClick'\n | 'closeOnEscape'\n | 'showCloseButton'\n | 'isBusy'\n>) => {\n const allowsDismissal = dismissable ?? typeof buttons === 'number';\n return {\n allowsOutsideDismissal: (dismissOnOutsideClick ?? allowsDismissal) && !isBusy,\n allowsEscapeDismissal: (closeOnEscape ?? allowsDismissal) && !isBusy,\n showsCloseButton: showCloseButton ?? allowsDismissal,\n };\n};\n"],"names":[],"mappings":"AAMO,MAAM,sBAAsB,GAAG,CAAC,EACnC,OAAO,EACP,WAAW,EACX,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,MAAM,GAST,KAAI;IACD,MAAM,eAAe,GAAG,WAAW,IAAI,OAAO,OAAO,KAAK,QAAQ;IAClE,OAAO;QACH,sBAAsB,EAAE,CAAC,qBAAqB,IAAI,eAAe,KAAK,CAAC,MAAM;QAC7E,qBAAqB,EAAE,CAAC,aAAa,IAAI,eAAe,KAAK,CAAC,MAAM;QACpE,gBAAgB,EAAE,eAAe,IAAI,eAAe;KACvD;AACL;;"}
|
package/package.json
CHANGED