@cratis/components 4.45.0 → 4.46.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.
@@ -70,7 +70,7 @@
70
70
  {
71
71
  "name": "@cratis/components",
72
72
  "role": "core",
73
- "version": "4.45.0",
73
+ "version": "4.46.0",
74
74
  "releaseMajorRange": ">=4 <5",
75
75
  "independentRelease": false,
76
76
  "private": false,
@@ -94,7 +94,7 @@
94
94
  {
95
95
  "name": "@cratis/eslint-plugin-components",
96
96
  "role": "eslint",
97
- "version": "4.45.0",
97
+ "version": "4.46.0",
98
98
  "releaseMajorRange": ">=4 <5",
99
99
  "independentRelease": false,
100
100
  "private": false,
@@ -107,7 +107,7 @@
107
107
  {
108
108
  "name": "@cratis/components.migrator",
109
109
  "role": "migrator",
110
- "version": "4.45.0",
110
+ "version": "4.46.0",
111
111
  "releaseMajorRange": ">=4 <5",
112
112
  "independentRelease": false,
113
113
  "private": false,
@@ -118,13 +118,13 @@
118
118
  {
119
119
  "name": "@cratis/components.conformance",
120
120
  "role": "conformance",
121
- "version": "4.45.0",
121
+ "version": "4.46.0",
122
122
  "releaseMajorRange": ">=4 <5",
123
123
  "independentRelease": false,
124
124
  "private": false,
125
125
  "packageAccess": "public",
126
126
  "peerDependencies": {
127
- "@cratis/components": "4.45.0",
127
+ "@cratis/components": "4.46.0",
128
128
  "react": "^19.0.0",
129
129
  "react-dom": "^19.0.0"
130
130
  },
@@ -134,13 +134,13 @@
134
134
  {
135
135
  "name": "@cratis/components.mui",
136
136
  "role": "renderer-adapter",
137
- "version": "4.45.0",
137
+ "version": "4.46.0",
138
138
  "releaseMajorRange": ">=4 <5",
139
139
  "independentRelease": false,
140
140
  "private": false,
141
141
  "packageAccess": "public",
142
142
  "peerDependencies": {
143
- "@cratis/components": "4.45.0",
143
+ "@cratis/components": "4.46.0",
144
144
  "@emotion/react": ">=11.5 <12",
145
145
  "@emotion/styled": ">=11.11 <12",
146
146
  "@mui/material": ">=9 <10",
@@ -190,13 +190,13 @@
190
190
  {
191
191
  "name": "@cratis/components.primereact",
192
192
  "role": "renderer-adapter",
193
- "version": "4.45.0",
193
+ "version": "4.46.0",
194
194
  "releaseMajorRange": ">=4 <5",
195
195
  "independentRelease": false,
196
196
  "private": false,
197
197
  "packageAccess": "public",
198
198
  "peerDependencies": {
199
- "@cratis/components": "4.45.0",
199
+ "@cratis/components": "4.46.0",
200
200
  "@primereact/core": ">=11 <12",
201
201
  "@primereact/ui": ">=11 <12",
202
202
  "@primeuix/themes": ">=3 <4",
@@ -258,13 +258,13 @@
258
258
  {
259
259
  "name": "@cratis/components.primereact10",
260
260
  "role": "renderer-adapter",
261
- "version": "4.45.0",
261
+ "version": "4.46.0",
262
262
  "releaseMajorRange": ">=4 <5",
263
263
  "independentRelease": false,
264
264
  "private": false,
265
265
  "packageAccess": "public",
266
266
  "peerDependencies": {
267
- "@cratis/components": "4.45.0",
267
+ "@cratis/components": "4.46.0",
268
268
  "primereact": ">=10.9.9 <11",
269
269
  "react": "^19.0.0",
270
270
  "react-dom": "^19.0.0"
@@ -306,13 +306,13 @@
306
306
  {
307
307
  "name": "@cratis/components.designsystemet",
308
308
  "role": "renderer-adapter",
309
- "version": "4.45.0",
309
+ "version": "4.46.0",
310
310
  "releaseMajorRange": ">=4 <5",
311
311
  "independentRelease": false,
312
312
  "private": false,
313
313
  "packageAccess": "public",
314
314
  "peerDependencies": {
315
- "@cratis/components": "4.45.0",
315
+ "@cratis/components": "4.46.0",
316
316
  "@digdir/designsystemet-css": ">=1.24 <2",
317
317
  "@digdir/designsystemet-react": ">=1.24 <2",
318
318
  "react": "^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;AAC1B,OAAO,EAKH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ldWrapper } from '@cratis/arc.react/commands';
6
6
  import { useCommandExecution } from './useCommandExecution.js';
7
7
  import { markAsCommandFormColumn, isCommandFormField } from '../CommandForm/commandFormMarkers.js';
8
+ import { CommandOverlayContext } from '../CommandForm/commandOverlayContext.js';
8
9
 
9
10
  const CommandDialogWrapper = ({ isValid, onClose, onConfirm, onSuccess, onValidationFailure, onFailed, onException, onUnauthorized, onBeforeExecute, confirmBeforeExecute, children, ...dialogProps }) => {
10
11
  const { setCommandValues, setCommandResult, isValid: isCommandFormValid, } = useCommandFormContext();
@@ -95,7 +96,7 @@ const CommandDialogComponent = (props) => {
95
96
  ptOptions,
96
97
  unstyled,
97
98
  };
98
- return (jsx(CommandForm, { ...commandFormProps, children: jsx(CommandDialogWrapper, { ...dialogProps, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onException: props.onException, onUnauthorized: props.onUnauthorized, onBeforeExecute: onBeforeExecute, confirmBeforeExecute: confirmBeforeExecute, children: children }) }));
99
+ return (jsx(CommandForm, { ...commandFormProps, children: jsx(CommandOverlayContext.Provider, { value: commandFormProps.currentValues, children: jsx(CommandDialogWrapper, { ...dialogProps, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onException: props.onException, onUnauthorized: props.onUnauthorized, onBeforeExecute: onBeforeExecute, confirmBeforeExecute: confirmBeforeExecute, children: children }) }) }));
99
100
  };
100
101
  const CommandDialogColumnWrapper = ({ children }) => (jsx(CommandForm.Column, { children: children }));
101
102
  markAsCommandFormColumn(CommandDialogColumnWrapper);
@@ -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' | 'isCommandDialog'> {\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' | 'isCommandDialog'> &\n Record<keyof Omit<DialogProps, 'children' | 'isBusy' | 'isCommandDialog'>, 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 isCommandDialog\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 headerActions,\n hideGlobalHeaderActions,\n sliceLocation,\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 headerActions,\n hideGlobalHeaderActions,\n sliceLocation,\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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W,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';\nimport { CommandOverlayContext } from '../CommandForm/commandOverlayContext';\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' | 'isCommandDialog'> {\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' | 'isCommandDialog'> &\n Record<keyof Omit<DialogProps, 'children' | 'isBusy' | 'isCommandDialog'>, 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 isCommandDialog\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 headerActions,\n hideGlobalHeaderActions,\n sliceLocation,\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 headerActions,\n hideGlobalHeaderActions,\n sliceLocation,\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 <CommandOverlayContext.Provider value={commandFormProps.currentValues}>\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 </CommandOverlayContext.Provider>\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":";;;;;;;;;AAyEA,MAAM,oBAAoB,GAAG,CAA8C,EACvE,OAAO,EACP,OAAO,EACP,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,GAAG,WAAW,EASjB,KAAI;AACD,IAAA,MAAM,EACF,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EAAE,kBAAkB,GAC9B,GAAG,qBAAqB,EAAY;AACrC,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAY;AACtD,IAAA,MAAM,UAAU,GAAG,mBAAmB,CAClC,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,CACxF;AAED,IAAA,MAAM,aAAa,GAAG,YAAW;AAC7B,QAAA,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE;AACrC,QAAA,IAAI,CAAC,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MAAM,GAAG,0BAA0B;AAcnD,MAAM,aAAa,GAAG;;"}
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ /**
3
+ * Props for {@link AutoCommandFields}.
4
+ */
5
+ export interface AutoCommandFieldsProps<TCommand extends object> {
6
+ /**
7
+ * Property names to leave out of the generated field list.
8
+ */
9
+ exclude?: (keyof TCommand)[];
10
+ /**
11
+ * A read-only reset hint: the same `currentValues` overlay passed to the host form. A change to a
12
+ * property's value discards a generated `GuidField`'s unfinished draft, as in `AutoCommandForm`. It
13
+ * never writes values; the host stays authoritative. Inside `CommandDialog` it defaults to the
14
+ * dialog's own `currentValues`; pass it explicitly for a plain `CommandForm`.
15
+ */
16
+ currentValues?: Partial<TCommand>;
17
+ }
18
+ /**
19
+ * Generates fields from the host command's own properties, using the same type providers, titles,
20
+ * `exclude` and omission rules as {@link AutoCommandForm}, inside an existing `CommandForm` or
21
+ * `CommandDialog`. It renders no form of its own; values, validation and execution belong to the host.
22
+ * Each field binds itself to the host's command context. Steppers and column layouts are not supported.
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * <CommandDialog command={RenameProject} title='Rename project'>
27
+ * <AutoCommandFields<RenameProject> exclude={['projectId']} />
28
+ * </CommandDialog>
29
+ * ```
30
+ */
31
+ export declare function AutoCommandFields<TCommand extends object = object>(props: AutoCommandFieldsProps<TCommand>): React.ReactElement;
32
+ //# sourceMappingURL=AutoCommandFields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoCommandFields.d.ts","sourceRoot":"","sources":["../../../CommandForm/AutoCommandFields.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,QAAQ,SAAS,MAAM;IAC3D;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,QAAQ,CAAC,EAAE,CAAC;IAE7B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CACrC;AAYD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAC9D,KAAK,EAAE,sBAAsB,CAAC,QAAQ,CAAC,GACxC,KAAK,CAAC,YAAY,CAmBpB"}
@@ -0,0 +1,26 @@
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import { useContext, useMemo } from 'react';
3
+ import { CommandFormFieldWrapper, useCommandFormContext } from '@cratis/arc.react/commands';
4
+ import { CommandOverlayContext } from './commandOverlayContext.js';
5
+ import { useCommandPropertyDescriptors, useExcludedProperties, generateFields } from './generatedFields.js';
6
+
7
+ function useHostCommand() {
8
+ try {
9
+ return useCommandFormContext().command;
10
+ }
11
+ catch {
12
+ throw new Error('AutoCommandFields must be rendered inside a CommandForm or CommandDialog.');
13
+ }
14
+ }
15
+ function AutoCommandFields(props) {
16
+ const command = useHostCommand();
17
+ const dialogOverlay = useContext(CommandOverlayContext);
18
+ const propertyDescriptors = useCommandPropertyDescriptors(command);
19
+ const excluded = useExcludedProperties(props.exclude);
20
+ const overlay = props.currentValues ?? dialogOverlay;
21
+ const fields = useMemo(() => generateFields(propertyDescriptors, excluded, overlay), [propertyDescriptors, excluded, overlay]);
22
+ return (jsx(Fragment, { children: fields.map((field) => (jsx(CommandFormFieldWrapper, { field: field }, field.key))) }));
23
+ }
24
+
25
+ export { AutoCommandFields };
26
+ //# sourceMappingURL=AutoCommandFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoCommandFields.js","sources":["../../../CommandForm/AutoCommandFields.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 React, { useContext, useMemo } from 'react';\nimport { CommandFormFieldWrapper, useCommandFormContext } from '@cratis/arc.react/commands';\nimport { CommandOverlayContext } from './commandOverlayContext';\nimport { generateFields, useCommandPropertyDescriptors, useExcludedProperties } from './generatedFields';\n\n/**\n * Props for {@link AutoCommandFields}.\n */\nexport interface AutoCommandFieldsProps<TCommand extends object> {\n /**\n * Property names to leave out of the generated field list.\n */\n exclude?: (keyof TCommand)[];\n\n /**\n * A read-only reset hint: the same `currentValues` overlay passed to the host form. A change to a\n * property's value discards a generated `GuidField`'s unfinished draft, as in `AutoCommandForm`. It\n * never writes values; the host stays authoritative. Inside `CommandDialog` it defaults to the\n * dialog's own `currentValues`; pass it explicitly for a plain `CommandForm`.\n */\n currentValues?: Partial<TCommand>;\n}\n\ntype FieldElement = Parameters<typeof CommandFormFieldWrapper>[0]['field'];\n\nfunction useHostCommand<TCommand extends object>() {\n try {\n return useCommandFormContext<TCommand>().command;\n } catch {\n throw new Error('AutoCommandFields must be rendered inside a CommandForm or CommandDialog.');\n }\n}\n\n/**\n * Generates fields from the host command's own properties, using the same type providers, titles,\n * `exclude` and omission rules as {@link AutoCommandForm}, inside an existing `CommandForm` or\n * `CommandDialog`. It renders no form of its own; values, validation and execution belong to the host.\n * Each field binds itself to the host's command context. Steppers and column layouts are not supported.\n *\n * @example\n * ```tsx\n * <CommandDialog command={RenameProject} title='Rename project'>\n * <AutoCommandFields<RenameProject> exclude={['projectId']} />\n * </CommandDialog>\n * ```\n */\nexport function AutoCommandFields<TCommand extends object = object>(\n props: AutoCommandFieldsProps<TCommand>,\n): React.ReactElement {\n const command = useHostCommand<TCommand>();\n const dialogOverlay = useContext(CommandOverlayContext) as Partial<TCommand> | undefined;\n const propertyDescriptors = useCommandPropertyDescriptors(command as new () => object);\n const excluded = useExcludedProperties<TCommand>(props.exclude);\n const overlay = props.currentValues ?? dialogOverlay;\n const fields = useMemo(\n () => generateFields<TCommand>(propertyDescriptors, excluded, overlay),\n [propertyDescriptors, excluded, overlay],\n );\n\n return (\n <>\n {fields.map((field) => (\n // SAFETY: generated elements are command form field components with fieldName and value props.\n <CommandFormFieldWrapper key={field.key} field={field as unknown as FieldElement} />\n ))}\n </>\n );\n}\n"],"names":["_jsx","_Fragment"],"mappings":";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AAS,CAAC,EAAE,UAAU,CAAC;IAC7D;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,QAAQ,CAAC,EAAE,CAAC;IAE7B;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAmBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAAE,SAAS,GAAG,MAAM,EAChF,KAAK,EAAE,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,GACjD,KAAK,CAAC,YAAY,CA8CpB"}
1
+ {"version":3,"file":"AutoCommandForm.d.ts","sourceRoot":"","sources":["../../../CommandForm/AutoCommandForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAMhF;;;GAGG;AACH,MAAM,WAAW,oBAAoB,CACjC,QAAQ,SAAS,MAAM,EACvB,SAAS,GAAG,MAAM,CACpB,SAAQ,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,UAAU,CAAC;IAC7D;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,QAAQ,CAAC,EAAE,CAAC;IAE7B;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAAE,SAAS,GAAG,MAAM,EAChF,KAAK,EAAE,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,GACjD,KAAK,CAAC,YAAY,CAYpB"}
@@ -1,41 +1,14 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { useMemo } from 'react';
1
+ import { jsxs } from 'react/jsx-runtime';
3
2
  import { CommandForm } from '@cratis/arc.react/commands';
4
- import { Guid } from '@cratis/fundamentals';
5
- import { GuidField } from './fields/GuidField.js';
6
3
  import { registerDefaultFieldTypeProviders } from './defaultFieldTypeProviders.js';
7
- import { resolveFieldTypeProvider } from './fieldTypeProviderRegistry.js';
4
+ import { useCommandPropertyDescriptors, useExcludedProperties, generateFields } from './generatedFields.js';
8
5
 
9
6
  registerDefaultFieldTypeProviders();
10
- function formatTitle(propertyName) {
11
- return propertyName
12
- .replace(/([A-Z])/g, ' $1')
13
- .replace(/^./, (character) => character.toUpperCase())
14
- .trim();
15
- }
16
- function guidFieldResetProps(field, overlayValue) {
17
- if (field !== GuidField) {
18
- return {};
19
- }
20
- return { resetKey: overlayValue instanceof Guid ? overlayValue.toString() : overlayValue };
21
- }
22
7
  function AutoCommandForm(props) {
23
8
  const { exclude, footer, ...commandFormProps } = props;
24
- const propertyDescriptors = useMemo(() => new props.command().propertyDescriptors, [props.command]);
25
- const excluded = useMemo(() => new Set((exclude ?? [])), [exclude]);
26
- const fields = propertyDescriptors
27
- .filter((descriptor) => !excluded.has(descriptor.name))
28
- .map((descriptor) => {
29
- const provider = resolveFieldTypeProvider(descriptor);
30
- if (!provider) {
31
- return null;
32
- }
33
- const Field = provider.component;
34
- return (jsx(Field, { ...guidFieldResetProps(Field, props.currentValues?.[descriptor.name]), fieldName: descriptor.name, value: (instance) => {
35
- return instance[descriptor.name];
36
- }, title: formatTitle(descriptor.name) }, descriptor.name));
37
- })
38
- .filter((field) => field !== null);
9
+ const propertyDescriptors = useCommandPropertyDescriptors(props.command);
10
+ const excluded = useExcludedProperties(exclude);
11
+ const fields = generateFields(propertyDescriptors, excluded, props.currentValues);
39
12
  return (jsxs(CommandForm, { ...commandFormProps, children: [fields, footer] }));
40
13
  }
41
14
 
@@ -1 +1 @@
1
- {"version":3,"file":"AutoCommandForm.js","sources":["../../../CommandForm/AutoCommandForm.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 React from 'react';\nimport { useMemo } from 'react';\nimport type { Command } from '@cratis/arc/commands';\nimport { CommandForm, type CommandFormProps } from '@cratis/arc.react/commands';\nimport { Guid } from '@cratis/fundamentals';\nimport { GuidField } from './fields/GuidField';\nimport { registerDefaultFieldTypeProviders } from './defaultFieldTypeProviders';\nimport { resolveFieldTypeProvider } from './fieldTypeProviderRegistry';\n\nregisterDefaultFieldTypeProviders();\n\n/**\n * Props for {@link AutoCommandForm} - every {@link CommandFormProps} except `children`, which is\n * generated from the command's own properties instead of being written out by hand.\n */\nexport interface AutoCommandFormProps<\n TCommand extends object,\n TResponse = object,\n> extends Omit<CommandFormProps<TCommand, TResponse>, 'children'> {\n /**\n * Property names to leave out of the generated field list - for a property that should not\n * be user-editable, or one a custom field placed elsewhere on the page already covers.\n */\n exclude?: (keyof TCommand)[];\n\n /**\n * Optional content rendered after the generated fields, inside the native Arc form and\n * command context. Supply a submit control here when needed; no action is added by default.\n */\n footer?: React.ReactNode;\n}\n\nfunction formatTitle(propertyName: string): string {\n return propertyName\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (character) => character.toUpperCase())\n .trim();\n}\n\n// An invalid GuidField draft leaves the command value empty, so a changed currentValues overlay must\n// discard the draft even when the native value does not change. Only the registered GuidField itself\n// receives the key: no other provider sees an extra prop.\nfunction guidFieldResetProps(field: unknown, overlayValue: unknown): { resetKey?: unknown } {\n if (field !== GuidField) {\n return {};\n }\n return { resetKey: overlayValue instanceof Guid ? overlayValue.toString() : overlayValue };\n}\n\n/**\n * A `CommandForm` that generates its field list from the command's own properties, choosing each\n * field's component by the property's type through the {@link FieldTypeProvider} registry -\n * `registerFieldTypeProvider` for a type the built-in defaults (`string`, `number`, `boolean`,\n * `Date`) don't cover, or to override one of them. `GuidField` is not a default; register it for\n * Fundamentals `Guid` properties to edit them.\n *\n * A property whose type no registered provider handles is left out of the generated list -\n * `exclude` it explicitly for clarity, or add a `CommandForm` child by hand alongside this\n * component for that one property.\n *\n * @example\n * ```tsx\n * <AutoCommandForm command={RegisterInvoice} exclude={['invoiceId']} />\n * ```\n */\nexport function AutoCommandForm<TCommand extends object = object, TResponse = object>(\n props: AutoCommandFormProps<TCommand, TResponse>,\n): React.ReactElement {\n const { exclude, footer, ...commandFormProps } = props;\n // SAFETY: Arc command constructors expose the Command property-descriptor contract at runtime.\n const propertyDescriptors = useMemo(\n () => (new props.command() as unknown as Command).propertyDescriptors,\n [props.command],\n );\n const excluded = useMemo(\n () => new Set<string>((exclude ?? []) as string[]),\n [exclude],\n );\n\n const fields = propertyDescriptors\n .filter((descriptor) => !excluded.has(descriptor.name))\n .map((descriptor) => {\n const provider = resolveFieldTypeProvider(descriptor);\n if (!provider) {\n return null;\n }\n\n const Field = provider.component;\n return (\n <Field\n key={descriptor.name}\n {...guidFieldResetProps(Field, props.currentValues?.[descriptor.name as keyof TCommand])}\n // The accessor reads the property dynamically, so CommandForm cannot infer the\n // property name from its source text; fieldName states it explicitly.\n fieldName={descriptor.name}\n value={(instance: TCommand) => {\n // SAFETY: Arc descriptors name runtime properties on the same command instance.\n return (instance as unknown as Record<string, unknown>)[\n descriptor.name\n ];\n }}\n title={formatTitle(descriptor.name)}\n />\n );\n })\n .filter((field): field is React.ReactElement => field !== null);\n\n return (\n <CommandForm {...commandFormProps}>\n {fields}\n {footer}\n </CommandForm>\n );\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;AAYA,iCAAiC,EAAE;AAuBnC,SAAS,WAAW,CAAC,YAAoB,EAAA;AACrC,IAAA,OAAO;AACF,SAAA,OAAO,CAAC,UAAU,EAAE,KAAK;AACzB,SAAA,OAAO,CAAC,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC,WAAW,EAAE;AACpD,SAAA,IAAI,EAAE;AACf;AAKA,SAAS,mBAAmB,CAAC,KAAc,EAAE,YAAqB,EAAA;AAC9D,IAAA,IAAI,KAAK,KAAK,SAAS,EAAE;AACrB,QAAA,OAAO,EAAE;IACb;AACA,IAAA,OAAO,EA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C;IAEnE,QACIC,IAAA,CAAC,WAAW,EAAA,EAAA,GAAK,gBAAgB,EAAA,QAAA,EAAA,CAC5B,MAAM,EACN,MAAM,CAAA,EAAA,CACG;AAEtB;;"}
1
+ {"version":3,"file":"AutoCommandForm.js","sources":["../../../CommandForm/AutoCommandForm.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 React from 'react';\nimport { CommandForm, type CommandFormProps } from '@cratis/arc.react/commands';\nimport { registerDefaultFieldTypeProviders } from './defaultFieldTypeProviders';\nimport { generateFields, useCommandPropertyDescriptors, useExcludedProperties } from './generatedFields';\n\nregisterDefaultFieldTypeProviders();\n\n/**\n * Props for {@link AutoCommandForm} - every {@link CommandFormProps} except `children`, which is\n * generated from the command's own properties instead of being written out by hand.\n */\nexport interface AutoCommandFormProps<\n TCommand extends object,\n TResponse = object,\n> extends Omit<CommandFormProps<TCommand, TResponse>, 'children'> {\n /**\n * Property names to leave out of the generated field list - for a property that should not\n * be user-editable, or one a custom field placed elsewhere on the page already covers.\n */\n exclude?: (keyof TCommand)[];\n\n /**\n * Optional content rendered after the generated fields, inside the native Arc form and\n * command context. Supply a submit control here when needed; no action is added by default.\n */\n footer?: React.ReactNode;\n}\n\n/**\n * A `CommandForm` that generates its field list from the command's own properties, choosing each\n * field's component by the property's type through the {@link FieldTypeProvider} registry -\n * `registerFieldTypeProvider` for a type the built-in defaults (`string`, `number`, `boolean`,\n * `Date`) don't cover, or to override one of them. `GuidField` is not a default; register it for\n * Fundamentals `Guid` properties to edit them.\n *\n * A property whose type no registered provider handles is left out of the generated list -\n * `exclude` it explicitly for clarity, or add a `CommandForm` child by hand alongside this\n * component for that one property.\n *\n * @example\n * ```tsx\n * <AutoCommandForm command={RegisterInvoice} exclude={['invoiceId']} />\n * ```\n */\nexport function AutoCommandForm<TCommand extends object = object, TResponse = object>(\n props: AutoCommandFormProps<TCommand, TResponse>,\n): React.ReactElement {\n const { exclude, footer, ...commandFormProps } = props;\n const propertyDescriptors = useCommandPropertyDescriptors(props.command);\n const excluded = useExcludedProperties<TCommand>(exclude);\n const fields = generateFields<TCommand>(propertyDescriptors, excluded, props.currentValues);\n\n return (\n <CommandForm {...commandFormProps}>\n {fields}\n {footer}\n </CommandForm>\n );\n}\n"],"names":["_jsxs"],"mappings":";;;;;AAQA,iCAAiC,EAAE;AAuC7B,SAAU,eAAe,CAC3B,KAAgD,EAAA;IAEhD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,GAAG,KAAK;IACtD,MAAM,mBAAmB,GAAG,6BAA6B,CAAC,KAAK,CAAC,OAAO,CAAC;AACxE,IAAA,MAAM,QAAQ,GAAG,qBAAqB,CAAW,OAAO,CAAC;AACzD,IAAA,MAAM,MAAM,GAAG,cAAc,CAAW,mBAAmB,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC;IAE3F,QACIA,IAAA,CAAC,WAAW,EAAA,EAAA,GAAK,gBAAgB,EAAA,QAAA,EAAA,CAC5B,MAAM,EACN,MAAM,CAAA,EAAA,CACG;AAEtB;;"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Internal: carries a host's `currentValues` overlay to generated fields that sit inside it, so they can
3
+ * derive the reset hint without the caller repeating the prop. Not part of the public API.
4
+ */
5
+ export declare const CommandOverlayContext: import("react").Context<object | undefined>;
6
+ //# sourceMappingURL=commandOverlayContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandOverlayContext.d.ts","sourceRoot":"","sources":["../../../CommandForm/commandOverlayContext.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,6CAA+C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+
3
+ const CommandOverlayContext = createContext(undefined);
4
+
5
+ export { CommandOverlayContext };
6
+ //# sourceMappingURL=commandOverlayContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandOverlayContext.js","sources":["../../../CommandForm/commandOverlayContext.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { createContext } from 'react';\n\n/**\n * Internal: carries a host's `currentValues` overlay to generated fields that sit inside it, so they can\n * derive the reset hint without the caller repeating the prop. Not part of the public API.\n */\nexport const CommandOverlayContext = createContext<object | undefined>(undefined);\n"],"names":[],"mappings":";;MASa,qBAAqB,GAAG,aAAa,CAAqB,SAAS;;"}
@@ -0,0 +1,15 @@
1
+ import type React from 'react';
2
+ import type { PropertyDescriptor } from '@cratis/arc/reflection';
3
+ /**
4
+ * Reads the property descriptors of a command constructor. Metadata only: the instance is never executed.
5
+ */
6
+ export declare function useCommandPropertyDescriptors(command: new () => object): PropertyDescriptor[];
7
+ /**
8
+ * Memoises the set of excluded property names.
9
+ */
10
+ export declare function useExcludedProperties<TCommand extends object>(exclude: (keyof TCommand)[] | undefined): Set<string>;
11
+ /**
12
+ * Generates one keyed field element per descriptor that is not excluded and has a registered provider.
13
+ */
14
+ export declare function generateFields<TCommand extends object>(propertyDescriptors: PropertyDescriptor[], excluded: Set<string>, currentValues: Partial<TCommand> | undefined): React.ReactElement[];
15
+ //# sourceMappingURL=generatedFields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generatedFields.d.ts","sourceRoot":"","sources":["../../../CommandForm/generatedFields.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAyBjE;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,UAAU,MAAM,GAAG,kBAAkB,EAAE,CAG7F;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,QAAQ,CAAC,EAAE,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,CAEnH;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,SAAS,MAAM,EAClD,mBAAmB,EAAE,kBAAkB,EAAE,EACzC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,GAC7C,KAAK,CAAC,YAAY,EAAE,CA4BtB"}
@@ -0,0 +1,44 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import { Guid } from '@cratis/fundamentals';
4
+ import { GuidField } from './fields/GuidField.js';
5
+ import { registerDefaultFieldTypeProviders } from './defaultFieldTypeProviders.js';
6
+ import { resolveFieldTypeProvider } from './fieldTypeProviderRegistry.js';
7
+
8
+ registerDefaultFieldTypeProviders();
9
+ function formatTitle(propertyName) {
10
+ return propertyName
11
+ .replace(/([A-Z])/g, ' $1')
12
+ .replace(/^./, (character) => character.toUpperCase())
13
+ .trim();
14
+ }
15
+ function guidFieldResetProps(field, overlayValue) {
16
+ if (field !== GuidField) {
17
+ return {};
18
+ }
19
+ return { resetKey: overlayValue instanceof Guid ? overlayValue.toString() : overlayValue };
20
+ }
21
+ function useCommandPropertyDescriptors(command) {
22
+ return useMemo(() => new command().propertyDescriptors, [command]);
23
+ }
24
+ function useExcludedProperties(exclude) {
25
+ return useMemo(() => new Set((exclude ?? [])), [exclude]);
26
+ }
27
+ function generateFields(propertyDescriptors, excluded, currentValues) {
28
+ return propertyDescriptors
29
+ .filter((descriptor) => !excluded.has(descriptor.name))
30
+ .map((descriptor) => {
31
+ const provider = resolveFieldTypeProvider(descriptor);
32
+ if (!provider) {
33
+ return null;
34
+ }
35
+ const Field = provider.component;
36
+ return (jsx(Field, { ...guidFieldResetProps(Field, currentValues?.[descriptor.name]), fieldName: descriptor.name, value: (instance) => {
37
+ return instance[descriptor.name];
38
+ }, title: formatTitle(descriptor.name) }, descriptor.name));
39
+ })
40
+ .filter((field) => field !== null);
41
+ }
42
+
43
+ export { generateFields, useCommandPropertyDescriptors, useExcludedProperties };
44
+ //# sourceMappingURL=generatedFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generatedFields.js","sources":["../../../CommandForm/generatedFields.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 React from 'react';\nimport { useMemo } from 'react';\nimport type { Command } from '@cratis/arc/commands';\nimport type { PropertyDescriptor } from '@cratis/arc/reflection';\nimport { Guid } from '@cratis/fundamentals';\nimport { GuidField } from './fields/GuidField';\nimport { registerDefaultFieldTypeProviders } from './defaultFieldTypeProviders';\nimport { resolveFieldTypeProvider } from './fieldTypeProviderRegistry';\n\nregisterDefaultFieldTypeProviders();\n\nfunction formatTitle(propertyName: string): string {\n return propertyName\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (character) => character.toUpperCase())\n .trim();\n}\n\n// An invalid GuidField draft leaves the command value empty, so a changed currentValues overlay must\n// discard the draft even when the native value does not change. Only the registered GuidField itself\n// receives the key: no other provider sees an extra prop.\nfunction guidFieldResetProps(field: unknown, overlayValue: unknown): { resetKey?: unknown } {\n if (field !== GuidField) {\n return {};\n }\n return { resetKey: overlayValue instanceof Guid ? overlayValue.toString() : overlayValue };\n}\n\n/**\n * Reads the property descriptors of a command constructor. Metadata only: the instance is never executed.\n */\nexport function useCommandPropertyDescriptors(command: new () => object): PropertyDescriptor[] {\n // SAFETY: Arc command constructors expose the Command property-descriptor contract at runtime.\n return useMemo(() => (new command() as unknown as Command).propertyDescriptors, [command]);\n}\n\n/**\n * Memoises the set of excluded property names.\n */\nexport function useExcludedProperties<TCommand extends object>(exclude: (keyof TCommand)[] | undefined): Set<string> {\n return useMemo(() => new Set<string>((exclude ?? []) as string[]), [exclude]);\n}\n\n/**\n * Generates one keyed field element per descriptor that is not excluded and has a registered provider.\n */\nexport function generateFields<TCommand extends object>(\n propertyDescriptors: PropertyDescriptor[],\n excluded: Set<string>,\n currentValues: Partial<TCommand> | undefined,\n): React.ReactElement[] {\n return propertyDescriptors\n .filter((descriptor) => !excluded.has(descriptor.name))\n .map((descriptor) => {\n const provider = resolveFieldTypeProvider(descriptor);\n if (!provider) {\n return null;\n }\n\n const Field = provider.component;\n return (\n <Field\n key={descriptor.name}\n {...guidFieldResetProps(Field, currentValues?.[descriptor.name as keyof TCommand])}\n // The accessor reads the property dynamically, so CommandForm cannot infer the\n // property name from its source text; fieldName states it explicitly.\n fieldName={descriptor.name}\n value={(instance: TCommand) => {\n // SAFETY: Arc descriptors name runtime properties on the same command instance.\n return (instance as unknown as Record<string, unknown>)[\n descriptor.name\n ];\n }}\n title={formatTitle(descriptor.name)}\n />\n );\n })\n .filter((field): field is React.ReactElement => field !== null);\n}\n"],"names":["_jsx"],"mappings":";;;;;;;AAYA,iCAAiC,EAAE;AAEnC,SAAS,WAAW,CAAC,YAAoB,EAAA;AACrC,IAAA,OAAO;AACF,SAAA,OAAO,CAAC,UAAU,EAAE,KAAK;AACzB,SAAA,OAAO,CAAC,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC,WAAW,EAAE;AACpD,SAAA,IAAI,EAAE;AACf;AAKA,SAAS,mBAAmB,CAAC,KAAc,EAAE,YAAqB,EAAA;AAC9D,IAAA,IAAI,KAAK,KAAK,SAAS,EAAE;AACrB,QAAA,OAAO,EAAE;IACb;AACA,IAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,YAAY,IAAI,GAAG,YAAY,CAAC,QAAQ,EAAE,GAAG,YAAY,EAAE;AAC9F;AAKM,SAAU,6BAA6B,CAAC,OAAyB,EAAA;AAEnE,IAAA,OAAO,OAAO,CAAC,MAAO,IAAI,OAAO,EAAyB,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC;AAC9F;AAKM,SAAU,qBAAqB,CAA0B,OAAuC,EAAA;AAClG,IAAA,OAAO,OAAO,CAAC,MAAM,IAAI,GAAG,EAAU,OAAO,IAAI,EAAE,EAAc,EAAE,CAAC,OAAO,CAAC,CAAC;AACjF;SAKgB,cAAc,CAC1B,mBAAyC,EACzC,QAAqB,EACrB,aAA4C,EAAA;AAE5C,IAAA,OAAO;AACF,SAAA,MAAM,CAAC,CAAC,UAAU,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;AACrD,SAAA,GAAG,CAAC,CAAC,UAAU,KAAI;AAChB,QAAA,MAAM,QAAQ,GAAG,wBAAwB,CAAC,UAAU,CAAC;QACrD,IAAI,CAAC,QAAQ,EAAE;AACX,YAAA,OAAO,IAAI;QACf;AAEA,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS;AAChC,QAAA,QACIA,GAAA,CAAC,KAAK,EAAA,EAAA,GAEE,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAAC,IAAsB,CAAC,CAAC,EAGlF,SAAS,EAAE,UAAU,CAAC,IAAI,EAC1B,KAAK,EAAE,CAAC,QAAkB,KAAI;AAE1B,gBAAA,OAAQ,QAA+C,CACnD,UAAU,CAAC,IAAI,CAClB;AACL,YAAA,CAAC,EACD,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAX9B,UAAU,CAAC,IAAI,CAYtB;AAEV,IAAA,CAAC;SACA,MAAM,CAAC,CAAC,KAAK,KAAkC,KAAK,KAAK,IAAI,CAAC;AACvE;;"}
@@ -3,4 +3,5 @@ export * from './fields/index.js';
3
3
  export * from './FieldTypeProvider.js';
4
4
  export * from './fieldTypeProviderRegistry.js';
5
5
  export * from './AutoCommandForm.js';
6
+ export * from './AutoCommandFields.js';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../CommandForm/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAsB,CAAC;AACrC,cAAc,mBAAU,CAAC;AACzB,cAAc,wBAAqB,CAAC;AACpC,cAAc,gCAA6B,CAAC;AAC5C,cAAc,sBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../CommandForm/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAsB,CAAC;AACrC,cAAc,mBAAU,CAAC;AACzB,cAAc,wBAAqB,CAAC;AACpC,cAAc,gCAA6B,CAAC;AAC5C,cAAc,sBAAmB,CAAC;AAClC,cAAc,wBAAqB,CAAC"}
@@ -18,4 +18,5 @@ export { ToggleSwitchField } from './fields/ToggleSwitchField.js';
18
18
  export { RatingField } from './fields/RatingField.js';
19
19
  export { clearFieldTypeProviders, registerFieldTypeProvider, resolveFieldTypeProvider } from './fieldTypeProviderRegistry.js';
20
20
  export { AutoCommandForm } from './AutoCommandForm.js';
21
+ export { AutoCommandFields } from './AutoCommandFields.js';
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/components",
3
- "version": "4.45.0",
3
+ "version": "4.46.0",
4
4
  "description": "React components for CQRS and event-sourced apps — command dialogs, typed forms, and query-backed data tables for Cratis Arc",
5
5
  "keywords": [
6
6
  "react",