@cratis/components 4.37.0 → 4.38.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/CommandStepperContent.js +1 -0
- package/dist/esm/CommandDialog/CommandStepperContent.js.map +1 -1
- package/dist/esm/CommandDialog/StepperCommandDialog.js +1 -0
- package/dist/esm/CommandDialog/StepperCommandDialog.js.map +1 -1
- package/dist/esm/Common/Breadcrumbs.d.ts +1 -1
- package/dist/esm/Common/Breadcrumbs.d.ts.map +1 -1
- package/dist/esm/Common/Breadcrumbs.js.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.d.ts +9 -0
- package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.js +4 -2
- package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.js +1 -0
- package/dist/esm/Common/DatePickerInputImplementation.js.map +1 -1
- package/dist/esm/DataTables/ColumnFilterMenu.js +1 -0
- package/dist/esm/DataTables/ColumnFilterMenu.js.map +1 -1
- package/dist/esm/DataTables/TablePaginatorImplementation.js +1 -0
- package/dist/esm/DataTables/TablePaginatorImplementation.js.map +1 -1
- package/dist/esm/DataTables/useDataTableMessages.js +1 -0
- package/dist/esm/DataTables/useDataTableMessages.js.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.js +1 -0
- package/dist/esm/Dialogs/DialogImplementation.js.map +1 -1
- package/dist/esm/Dropdown/DropdownImplementation.js +1 -0
- package/dist/esm/Dropdown/DropdownImplementation.js.map +1 -1
- package/dist/esm/Toolbar/Toolbar.js +1 -0
- package/dist/esm/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/Toolbar/ToolbarFolder.js +1 -0
- package/dist/esm/Toolbar/ToolbarFolder.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/package.json +1 -1
package/compat-manifest.json
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
{
|
|
69
69
|
"name": "@cratis/components",
|
|
70
70
|
"role": "core",
|
|
71
|
-
"version": "4.
|
|
71
|
+
"version": "4.38.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.38.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.38.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.38.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.38.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.38.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.38.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.38.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.38.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.38.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.38.0",
|
|
266
266
|
"primereact": ">=10.9.9 <11",
|
|
267
267
|
"react": "^19.0.0",
|
|
268
268
|
"react-dom": "^19.0.0"
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import React, { useId, useMemo, useEffect } from 'react';
|
|
3
3
|
import { Button } from '../Common/Button.js';
|
|
4
4
|
import 'react-aria-components/I18nProvider';
|
|
5
|
+
import 'react-aria-components';
|
|
5
6
|
import 'ts-deepmerge';
|
|
6
7
|
import 'react-dom';
|
|
7
8
|
import { useCratisComponentsConfig } from '../configuration/CratisComponentsContext.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandStepperContent.js","sources":["../../../CommandDialog/CommandStepperContent.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, { useEffect, useId, useMemo } from 'react';\nimport { Button } from '../Common/Button';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { CommandFormFieldWrapper } from '@cratis/arc.react/commands';\nimport { isCommandFormField } from '../CommandForm/commandFormMarkers';\nimport type { StepperPanelProps } from './StepperPanel';\nimport { getStepPanels } from './stepChildren';\nimport { transitionStep } from './transitionStep';\nimport type { StepperCustomizationProps } from './CommandStepper';\n\n/**\n * Controlled state and validation props for {@link CommandStepperContent}.\n *\n * @remarks\n * `CommandStepperContent` is a private implementation primitive shared by\n * {@link CommandStepper} and `StepperCommandDialog` — it is deliberately not\n * re-exported from the `./CommandStepper` or `./CommandDialog` package\n * subpaths, so this type is documented for maintainers only.\n */\nexport interface CommandStepperContentProps extends StepperCustomizationProps {\n /** The active step index. */\n activeStep: number;\n /** The indices that have been visited. */\n visitedSteps: Set<number>;\n /** StepperPanel children defining each wizard step. */\n children?: React.ReactNode;\n /** Callback for active step changes. */\n onActiveStepChange?: (stepIndex: number) => void;\n /** Callback for visited step changes. */\n onVisitedStepsChange?: (visitedSteps: Set<number>) => void;\n /** Callback that receives validation state for each step. */\n onStepErrorsChange?: (stepErrors: boolean[]) => void;\n /** Provides validation errors for individual fields. */\n getFieldError?: (fieldName: string) => unknown;\n /** Whether to show built-in previous and next buttons. Defaults to `true`. */\n showNavigation?: boolean;\n /** Whether to show built-in submit on the last step. Defaults to `true`. */\n showSubmit?: boolean;\n /** Label for the next step button. Falls back to the provider's `stepper.next` message, then `'Next'`. */\n nextLabel?: string;\n /** Label for the previous step button. Falls back to the provider's `stepper.previous` message, then `'Previous'`. */\n previousLabel?: string;\n /** Label for the submit button. Falls back to the provider's `stepper.submit` message, then `'Submit'`. */\n okLabel?: string;\n /** Whether navigation controls are busy. */\n isBusy?: boolean;\n /** Whether submit is currently executing. */\n isSubmitting?: boolean;\n /** Locks form fields during a guarded submission without changing unguarded forms. */\n disableFieldsWhileSubmitting?: boolean;\n /** Disables submit regardless of current step state. */\n isSubmitDisabled?: boolean;\n /** Submit callback invoked on the last step. */\n onSubmit?: () => void | Promise<void>;\n}\n\n/** Extracts the property name from an accessor function like `c => c.name`. */\nconst getPropertyName = (accessor: ((obj: unknown) => unknown) | unknown): string => {\n if (typeof accessor !== 'function') return '';\n const fnStr = accessor.toString();\n const match = fnStr.match(/\\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);\n return match ? match[1] : '';\n};\n\n/** Recursively collects all CommandFormField property names from a React node tree. */\nconst extractFieldNamesFromNode = (nodes: React.ReactNode): string[] => {\n const names: string[] = [];\n React.Children.forEach(nodes, (child) => {\n if (!React.isValidElement(child)) return;\n const component = child.type as React.ComponentType<unknown>;\n if (isCommandFormField(component)) {\n const fieldProps = child.props as { value?: (obj: unknown) => unknown };\n const name = getPropertyName(fieldProps.value);\n if (name) names.push(name);\n }\n\n const childProps = child.props as Record<string, unknown>;\n if (childProps.children != null) {\n names.push(\n ...extractFieldNamesFromNode(childProps.children as React.ReactNode),\n );\n }\n });\n return names;\n};\n\nconst 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<typeof CommandFormFieldWrapper>[0]['field'];\n // SAFETY: displayName identifies the Arc command field shape before it reaches the wrapper.\n return <CommandFormFieldWrapper field={child as unknown as FieldElement} />;\n }\n\n const childProps = child.props as Record<string, unknown>;\n if (childProps.children != null) {\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/**\n * @internal Renders the visual stepper body — step headers, panels, and the\n * built-in Previous / Next / Submit navigation — without any Arc\n * `CommandForm` wiring. This is a private implementation primitive shared by\n * {@link CommandStepper} and `StepperCommandDialog`; it is intentionally\n * **not** re-exported from the `./CommandStepper` or `./CommandDialog`\n * package subpaths and may change shape without a major version bump.\n */\nexport const CommandStepperContent = ({\n activeStep,\n visitedSteps,\n children,\n onActiveStepChange,\n onVisitedStepsChange,\n onStepErrorsChange,\n getFieldError,\n showNavigation = true,\n showSubmit = true,\n nextLabel,\n previousLabel,\n okLabel,\n isBusy = false,\n isSubmitting = false,\n disableFieldsWhileSubmitting = false,\n isSubmitDisabled = false,\n onSubmit,\n linear = true,\n orientation = 'horizontal',\n headerPosition = 'top',\n start,\n end,\n onChangeStep,\n pt,\n}: CommandStepperContentProps) => {\n const { messages } = useCratisComponentsConfig();\n const stepperId = useId();\n const resolvedNextLabel = nextLabel ?? messages?.stepper?.next ?? 'Next';\n const resolvedPreviousLabel =\n previousLabel ?? messages?.stepper?.previous ?? 'Previous';\n const resolvedOkLabel = okLabel ?? messages?.stepper?.submit ?? 'Submit';\n\n // The steps that actually render. Conditional steps (`{condition && <StepperPanel/>}`)\n // leave falsy children behind, so the count, the per-step validation state and what the\n // Stepper renders are all derived from this one list — they cannot drift apart.\n const panels = useMemo(\n () => getStepPanels(children) as React.ReactElement<StepperPanelProps>[],\n [children],\n );\n const stepCount = panels.length;\n\n // A conditional step can vanish after the user has advanced past it, which leaves the\n // incoming index pointing at a step that is no longer rendered. Clamp it into the set that\n // is, so the panel shown, the validation state read and the buttons offered all belong to a\n // step that exists.\n const currentStep = Math.min(Math.max(activeStep, 0), Math.max(stepCount - 1, 0));\n const isLastStep = currentStep >= stepCount - 1;\n const isFirstStep = currentStep <= 0;\n\n const stepFieldNames = useMemo(\n () => panels.map((panel) => extractFieldNamesFromNode(panel.props.children)),\n [panels],\n );\n\n const stepErrors = useMemo(\n () =>\n stepFieldNames.map((fields) =>\n fields.some((fieldName) => !!getFieldError?.(fieldName)),\n ),\n [stepFieldNames, getFieldError],\n );\n\n useEffect(() => {\n onStepErrorsChange?.(stepErrors);\n }, [onStepErrorsChange, stepErrors]);\n\n const isCurrentStepInvalid = stepErrors[currentStep] ?? false;\n const hasAnyStepErrors = stepErrors.some((hasError) => hasError);\n\n const changeStep = (index: number, fromHeader = false) => transitionStep({\n index,\n currentStep,\n stepCount,\n isCurrentStepInvalid,\n linear,\n fromHeader,\n visitedSteps,\n onActiveStepChange,\n onVisitedStepsChange,\n onChangeStep,\n });\n\n const isStepperBusy = isBusy || isSubmitting;\n\n const stepperList = (\n <ol\n {...pt?.list}\n className={['cratis-command-stepper__list', pt?.list?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='list'\n data-part='list'\n data-busy={isStepperBusy || undefined}\n data-invalid={hasAnyStepErrors || undefined}\n >\n {panels.map((panel, index) => {\n const selected = index === currentStep;\n const visited = visitedSteps.has(index);\n const invalid = stepErrors[index] ?? false;\n const headerDisabled = linear && !selected;\n\n return (\n <li\n key={index}\n {...pt?.step}\n className={['cratis-command-stepper__step', pt?.step?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='step'\n data-part='step'\n data-active={selected || undefined}\n data-selected={selected || undefined}\n data-visited={visited || undefined}\n data-invalid={invalid || undefined}\n data-busy={isStepperBusy || undefined}\n >\n <button\n {...pt?.header}\n type='button'\n id={pt?.header?.id ?? `${stepperId}-step-${index}`}\n className={[\n 'cratis-command-stepper__header',\n pt?.header?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='header'\n data-part='header'\n data-busy={isStepperBusy || undefined}\n data-disabled={headerDisabled || undefined}\n data-invalid={invalid || undefined}\n data-selected={selected || undefined}\n data-visited={visited || undefined}\n disabled={headerDisabled}\n aria-current={selected ? 'step' : undefined}\n onClick={() => changeStep(index, true)}\n >\n <span\n {...pt?.number}\n className={[\n 'cratis-command-stepper__number',\n pt?.number?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={pt?.number?.style}\n data-cratis-part='number'\n data-part='number'\n data-busy={isStepperBusy || undefined}\n data-invalid={invalid || undefined}\n data-selected={selected || undefined}\n data-visited={visited || undefined}\n >\n {index + 1}\n </span>\n <span\n {...pt?.title}\n className={[\n 'cratis-command-stepper__title',\n pt?.title?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='title'\n data-part='title'\n data-busy={isStepperBusy || undefined}\n data-invalid={invalid || undefined}\n data-selected={selected || undefined}\n data-visited={visited || undefined}\n >\n {panel.props.header}\n </span>\n </button>\n {index < stepCount - 1 && (\n <span\n {...pt?.separator}\n className={[\n 'cratis-command-stepper__separator',\n pt?.separator?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='separator'\n data-part='separator'\n data-busy={isStepperBusy || undefined}\n data-invalid={invalid || undefined}\n data-visited={visited || undefined}\n aria-hidden='true'\n />\n )}\n </li>\n );\n })}\n </ol>\n );\n\n const stepperPanels = (\n <div\n {...pt?.panels}\n className={['cratis-command-stepper__panels', pt?.panels?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='panels'\n data-part='panels'\n data-busy={isStepperBusy || undefined}\n data-invalid={hasAnyStepErrors || undefined}\n >\n {panels.map((panel, index) => (\n <section\n key={index}\n {...pt?.panel}\n hidden={index !== currentStep}\n className={['cratis-command-stepper__panel', pt?.panel?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='panel'\n data-part='panel'\n data-busy={isStepperBusy || undefined}\n data-invalid={stepErrors[index] || undefined}\n data-selected={index === currentStep || undefined}\n data-visited={visitedSteps.has(index) || undefined}\n aria-label={String(panel.props.header ?? `Step ${index + 1}`)}\n aria-labelledby={pt?.panel?.['aria-labelledby'] ?? (pt?.header?.id == null ? `${stepperId}-step-${index}` : undefined)}\n >\n {disableFieldsWhileSubmitting ? (\n <fieldset disabled={isSubmitting} inert={isSubmitting} style={{ display: 'contents' }}>\n {processChildren(panel.props.children)}\n </fieldset>\n ) : processChildren(panel.props.children)}\n </section>\n ))}\n </div>\n );\n\n return (\n <div\n className={`cratis-command-stepper cratis-command-stepper--${orientation}`}\n data-orientation={orientation}\n >\n {start}\n <div\n {...pt?.root}\n className={['cratis-command-stepper__root', pt?.root?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='root'\n data-part='root'\n data-value={currentStep}\n data-orientation={orientation}\n data-busy={isStepperBusy || undefined}\n data-invalid={hasAnyStepErrors || undefined}\n >\n {headerPosition === 'bottom' ? (\n <>\n {stepperPanels}\n {stepperList}\n </>\n ) : (\n <>\n {stepperList}\n {stepperPanels}\n </>\n )}\n </div>\n {end}\n\n {showNavigation && (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n gap: '0.75rem',\n }}\n >\n {!isFirstStep && (\n <Button\n variant='outline'\n onClick={() => changeStep(currentStep - 1)}\n disabled={isBusy}\n style={{ width: 'auto' }}\n >\n <span>{resolvedPreviousLabel}</span>\n </Button>\n )}\n <div style={{ flex: 1 }} />\n {!isLastStep && (\n <Button\n onClick={() => changeStep(currentStep + 1)}\n disabled={isBusy || isSubmitting || isCurrentStepInvalid}\n style={{ width: 'auto' }}\n >\n <span>{resolvedNextLabel}</span>\n </Button>\n )}\n {isLastStep && showSubmit && (\n <Button\n onClick={() => void onSubmit?.()}\n disabled={\n isBusy ||\n isSubmitting ||\n isSubmitDisabled ||\n hasAnyStepErrors\n }\n autoFocus\n style={{ width: 'auto' }}\n >\n {isSubmitting && (\n <span\n className='cratis-dialog__spinner'\n aria-hidden='true'\n />\n )}\n <span>{resolvedOkLabel}</span>\n </Button>\n )}\n </div>\n )}\n </div>\n );\n};\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";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AAC,MAAM,EAAA,EACH,OAAO,EAAE,MAAM,UAAU,CAAC,WAAW,GAAG,CAAC,CAAC,EAC1C,QAAQ,EAAE,MAAM,IAAI,YAAY,IAAI,oBAAoB,EACxD,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAExBA,GAAA,CAAA,MAAA,EAAA,EAAA,QAAA,EAAO,iBAAiB,EAAA,CAAQ,EAAA,CAC3B,CACZ,EACA,UAAU,IAAI,UAAU,KACrBC,IAAA,CAAC,MAAM,IACH,OAAO,EAAE,MAAM,KAAK,QAAQ,IAAI,EAChC,QAAQ,EACJ,MAAM;4BACN,YAAY;4BACZ,gBAAgB;AAChB,4BAAA,gBAAgB,EAEpB,SAAS,EAAA,IAAA,EACT,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAA,QAAA,EAAA,CAEvB,YAAY,KACTD,GAAA,CAAA,MAAA,EAAA,EACI,SAAS,EAAC,wBAAwB,EAAA,aAAA,EACtB,MAAM,EAAA,CACpB,CACL,EACDA,GAAA,CAAA,MAAA,EAAA,EAAA,QAAA,EAAO,eAAe,EAAA,CAAQ,CAAA,EAAA,CACzB,CACZ,CAAA,EAAA,CACC,CACT,CAAA,EAAA,CACC;AAEd;;"}
|
|
1
|
+
{"version":3,"file":"CommandStepperContent.js","sources":["../../../CommandDialog/CommandStepperContent.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, { useEffect, useId, useMemo } from 'react';\nimport { Button } from '../Common/Button';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { CommandFormFieldWrapper } from '@cratis/arc.react/commands';\nimport { isCommandFormField } from '../CommandForm/commandFormMarkers';\nimport type { StepperPanelProps } from './StepperPanel';\nimport { getStepPanels } from './stepChildren';\nimport { transitionStep } from './transitionStep';\nimport type { StepperCustomizationProps } from './CommandStepper';\n\n/**\n * Controlled state and validation props for {@link CommandStepperContent}.\n *\n * @remarks\n * `CommandStepperContent` is a private implementation primitive shared by\n * {@link CommandStepper} and `StepperCommandDialog` — it is deliberately not\n * re-exported from the `./CommandStepper` or `./CommandDialog` package\n * subpaths, so this type is documented for maintainers only.\n */\nexport interface CommandStepperContentProps extends StepperCustomizationProps {\n /** The active step index. */\n activeStep: number;\n /** The indices that have been visited. */\n visitedSteps: Set<number>;\n /** StepperPanel children defining each wizard step. */\n children?: React.ReactNode;\n /** Callback for active step changes. */\n onActiveStepChange?: (stepIndex: number) => void;\n /** Callback for visited step changes. */\n onVisitedStepsChange?: (visitedSteps: Set<number>) => void;\n /** Callback that receives validation state for each step. */\n onStepErrorsChange?: (stepErrors: boolean[]) => void;\n /** Provides validation errors for individual fields. */\n getFieldError?: (fieldName: string) => unknown;\n /** Whether to show built-in previous and next buttons. Defaults to `true`. */\n showNavigation?: boolean;\n /** Whether to show built-in submit on the last step. Defaults to `true`. */\n showSubmit?: boolean;\n /** Label for the next step button. Falls back to the provider's `stepper.next` message, then `'Next'`. */\n nextLabel?: string;\n /** Label for the previous step button. Falls back to the provider's `stepper.previous` message, then `'Previous'`. */\n previousLabel?: string;\n /** Label for the submit button. Falls back to the provider's `stepper.submit` message, then `'Submit'`. */\n okLabel?: string;\n /** Whether navigation controls are busy. */\n isBusy?: boolean;\n /** Whether submit is currently executing. */\n isSubmitting?: boolean;\n /** Locks form fields during a guarded submission without changing unguarded forms. */\n disableFieldsWhileSubmitting?: boolean;\n /** Disables submit regardless of current step state. */\n isSubmitDisabled?: boolean;\n /** Submit callback invoked on the last step. */\n onSubmit?: () => void | Promise<void>;\n}\n\n/** Extracts the property name from an accessor function like `c => c.name`. */\nconst getPropertyName = (accessor: ((obj: unknown) => unknown) | unknown): string => {\n if (typeof accessor !== 'function') return '';\n const fnStr = accessor.toString();\n const match = fnStr.match(/\\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);\n return match ? match[1] : '';\n};\n\n/** Recursively collects all CommandFormField property names from a React node tree. */\nconst extractFieldNamesFromNode = (nodes: React.ReactNode): string[] => {\n const names: string[] = [];\n React.Children.forEach(nodes, (child) => {\n if (!React.isValidElement(child)) return;\n const component = child.type as React.ComponentType<unknown>;\n if (isCommandFormField(component)) {\n const fieldProps = child.props as { value?: (obj: unknown) => unknown };\n const name = getPropertyName(fieldProps.value);\n if (name) names.push(name);\n }\n\n const childProps = child.props as Record<string, unknown>;\n if (childProps.children != null) {\n names.push(\n ...extractFieldNamesFromNode(childProps.children as React.ReactNode),\n );\n }\n });\n return names;\n};\n\nconst 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<typeof CommandFormFieldWrapper>[0]['field'];\n // SAFETY: displayName identifies the Arc command field shape before it reaches the wrapper.\n return <CommandFormFieldWrapper field={child as unknown as FieldElement} />;\n }\n\n const childProps = child.props as Record<string, unknown>;\n if (childProps.children != null) {\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/**\n * @internal Renders the visual stepper body — step headers, panels, and the\n * built-in Previous / Next / Submit navigation — without any Arc\n * `CommandForm` wiring. This is a private implementation primitive shared by\n * {@link CommandStepper} and `StepperCommandDialog`; it is intentionally\n * **not** re-exported from the `./CommandStepper` or `./CommandDialog`\n * package subpaths and may change shape without a major version bump.\n */\nexport const CommandStepperContent = ({\n activeStep,\n visitedSteps,\n children,\n onActiveStepChange,\n onVisitedStepsChange,\n onStepErrorsChange,\n getFieldError,\n showNavigation = true,\n showSubmit = true,\n nextLabel,\n previousLabel,\n okLabel,\n isBusy = false,\n isSubmitting = false,\n disableFieldsWhileSubmitting = false,\n isSubmitDisabled = false,\n onSubmit,\n linear = true,\n orientation = 'horizontal',\n headerPosition = 'top',\n start,\n end,\n onChangeStep,\n pt,\n}: CommandStepperContentProps) => {\n const { messages } = useCratisComponentsConfig();\n const stepperId = useId();\n const resolvedNextLabel = nextLabel ?? messages?.stepper?.next ?? 'Next';\n const resolvedPreviousLabel =\n previousLabel ?? messages?.stepper?.previous ?? 'Previous';\n const resolvedOkLabel = okLabel ?? messages?.stepper?.submit ?? 'Submit';\n\n // The steps that actually render. Conditional steps (`{condition && <StepperPanel/>}`)\n // leave falsy children behind, so the count, the per-step validation state and what the\n // Stepper renders are all derived from this one list — they cannot drift apart.\n const panels = useMemo(\n () => getStepPanels(children) as React.ReactElement<StepperPanelProps>[],\n [children],\n );\n const stepCount = panels.length;\n\n // A conditional step can vanish after the user has advanced past it, which leaves the\n // incoming index pointing at a step that is no longer rendered. Clamp it into the set that\n // is, so the panel shown, the validation state read and the buttons offered all belong to a\n // step that exists.\n const currentStep = Math.min(Math.max(activeStep, 0), Math.max(stepCount - 1, 0));\n const isLastStep = currentStep >= stepCount - 1;\n const isFirstStep = currentStep <= 0;\n\n const stepFieldNames = useMemo(\n () => panels.map((panel) => extractFieldNamesFromNode(panel.props.children)),\n [panels],\n );\n\n const stepErrors = useMemo(\n () =>\n stepFieldNames.map((fields) =>\n fields.some((fieldName) => !!getFieldError?.(fieldName)),\n ),\n [stepFieldNames, getFieldError],\n );\n\n useEffect(() => {\n onStepErrorsChange?.(stepErrors);\n }, [onStepErrorsChange, stepErrors]);\n\n const isCurrentStepInvalid = stepErrors[currentStep] ?? false;\n const hasAnyStepErrors = stepErrors.some((hasError) => hasError);\n\n const changeStep = (index: number, fromHeader = false) => transitionStep({\n index,\n currentStep,\n stepCount,\n isCurrentStepInvalid,\n linear,\n fromHeader,\n visitedSteps,\n onActiveStepChange,\n onVisitedStepsChange,\n onChangeStep,\n });\n\n const isStepperBusy = isBusy || isSubmitting;\n\n const stepperList = (\n <ol\n {...pt?.list}\n className={['cratis-command-stepper__list', pt?.list?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='list'\n data-part='list'\n data-busy={isStepperBusy || undefined}\n data-invalid={hasAnyStepErrors || undefined}\n >\n {panels.map((panel, index) => {\n const selected = index === currentStep;\n const visited = visitedSteps.has(index);\n const invalid = stepErrors[index] ?? false;\n const headerDisabled = linear && !selected;\n\n return (\n <li\n key={index}\n {...pt?.step}\n className={['cratis-command-stepper__step', pt?.step?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='step'\n data-part='step'\n data-active={selected || undefined}\n data-selected={selected || undefined}\n data-visited={visited || undefined}\n data-invalid={invalid || undefined}\n data-busy={isStepperBusy || undefined}\n >\n <button\n {...pt?.header}\n type='button'\n id={pt?.header?.id ?? `${stepperId}-step-${index}`}\n className={[\n 'cratis-command-stepper__header',\n pt?.header?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='header'\n data-part='header'\n data-busy={isStepperBusy || undefined}\n data-disabled={headerDisabled || undefined}\n data-invalid={invalid || undefined}\n data-selected={selected || undefined}\n data-visited={visited || undefined}\n disabled={headerDisabled}\n aria-current={selected ? 'step' : undefined}\n onClick={() => changeStep(index, true)}\n >\n <span\n {...pt?.number}\n className={[\n 'cratis-command-stepper__number',\n pt?.number?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={pt?.number?.style}\n data-cratis-part='number'\n data-part='number'\n data-busy={isStepperBusy || undefined}\n data-invalid={invalid || undefined}\n data-selected={selected || undefined}\n data-visited={visited || undefined}\n >\n {index + 1}\n </span>\n <span\n {...pt?.title}\n className={[\n 'cratis-command-stepper__title',\n pt?.title?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='title'\n data-part='title'\n data-busy={isStepperBusy || undefined}\n data-invalid={invalid || undefined}\n data-selected={selected || undefined}\n data-visited={visited || undefined}\n >\n {panel.props.header}\n </span>\n </button>\n {index < stepCount - 1 && (\n <span\n {...pt?.separator}\n className={[\n 'cratis-command-stepper__separator',\n pt?.separator?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='separator'\n data-part='separator'\n data-busy={isStepperBusy || undefined}\n data-invalid={invalid || undefined}\n data-visited={visited || undefined}\n aria-hidden='true'\n />\n )}\n </li>\n );\n })}\n </ol>\n );\n\n const stepperPanels = (\n <div\n {...pt?.panels}\n className={['cratis-command-stepper__panels', pt?.panels?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='panels'\n data-part='panels'\n data-busy={isStepperBusy || undefined}\n data-invalid={hasAnyStepErrors || undefined}\n >\n {panels.map((panel, index) => (\n <section\n key={index}\n {...pt?.panel}\n hidden={index !== currentStep}\n className={['cratis-command-stepper__panel', pt?.panel?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='panel'\n data-part='panel'\n data-busy={isStepperBusy || undefined}\n data-invalid={stepErrors[index] || undefined}\n data-selected={index === currentStep || undefined}\n data-visited={visitedSteps.has(index) || undefined}\n aria-label={String(panel.props.header ?? `Step ${index + 1}`)}\n aria-labelledby={pt?.panel?.['aria-labelledby'] ?? (pt?.header?.id == null ? `${stepperId}-step-${index}` : undefined)}\n >\n {disableFieldsWhileSubmitting ? (\n <fieldset disabled={isSubmitting} inert={isSubmitting} style={{ display: 'contents' }}>\n {processChildren(panel.props.children)}\n </fieldset>\n ) : processChildren(panel.props.children)}\n </section>\n ))}\n </div>\n );\n\n return (\n <div\n className={`cratis-command-stepper cratis-command-stepper--${orientation}`}\n data-orientation={orientation}\n >\n {start}\n <div\n {...pt?.root}\n className={['cratis-command-stepper__root', pt?.root?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='root'\n data-part='root'\n data-value={currentStep}\n data-orientation={orientation}\n data-busy={isStepperBusy || undefined}\n data-invalid={hasAnyStepErrors || undefined}\n >\n {headerPosition === 'bottom' ? (\n <>\n {stepperPanels}\n {stepperList}\n </>\n ) : (\n <>\n {stepperList}\n {stepperPanels}\n </>\n )}\n </div>\n {end}\n\n {showNavigation && (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n gap: '0.75rem',\n }}\n >\n {!isFirstStep && (\n <Button\n variant='outline'\n onClick={() => changeStep(currentStep - 1)}\n disabled={isBusy}\n style={{ width: 'auto' }}\n >\n <span>{resolvedPreviousLabel}</span>\n </Button>\n )}\n <div style={{ flex: 1 }} />\n {!isLastStep && (\n <Button\n onClick={() => changeStep(currentStep + 1)}\n disabled={isBusy || isSubmitting || isCurrentStepInvalid}\n style={{ width: 'auto' }}\n >\n <span>{resolvedNextLabel}</span>\n </Button>\n )}\n {isLastStep && showSubmit && (\n <Button\n onClick={() => void onSubmit?.()}\n disabled={\n isBusy ||\n isSubmitting ||\n isSubmitDisabled ||\n hasAnyStepErrors\n }\n autoFocus\n style={{ width: 'auto' }}\n >\n {isSubmitting && (\n <span\n className='cratis-dialog__spinner'\n aria-hidden='true'\n />\n )}\n <span>{resolvedOkLabel}</span>\n </Button>\n )}\n </div>\n )}\n </div>\n );\n};\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;AA4DA,MAAM,eAAe,GAAG,CAAC,QAA+C,KAAY;IAChF,IAAI,OAAO,QAAQ,KAAK,UAAU;AAAE,QAAA,OAAO,EAAE;AAC7C,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,EAAE;IACjC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC;AACzD,IAAA,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE;AAChC,CAAC;AAGD,MAAM,yBAAyB,GAAG,CAAC,KAAsB,KAAc;IACnE,MAAM,KAAK,GAAa,EAAE;IAC1B,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,KAAI;AACpC,QAAA,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;YAAE;AAClC,QAAA,MAAM,SAAS,GAAG,KAAK,CAAC,IAAoC;AAC5D,QAAA,IAAI,kBAAkB,CAAC,SAAS,CAAC,EAAE;AAC/B,YAAA,MAAM,UAAU,GAAG,KAAK,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AAO,eAAe,EAAA,CAAQ,CAAA,EAAA,CACzB,CACZ,CAAA,EAAA,CACC,CACT,CAAA,EAAA,CACC;AAEd;;"}
|
|
@@ -3,6 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import { useDialogContext, DialogResult } from '@cratis/arc.react/dialogs';
|
|
4
4
|
import { Button } from '../Common/Button.js';
|
|
5
5
|
import 'react-aria-components/I18nProvider';
|
|
6
|
+
import 'react-aria-components';
|
|
6
7
|
import 'ts-deepmerge';
|
|
7
8
|
import 'react-dom';
|
|
8
9
|
import { useCratisComponentsConfig } from '../configuration/CratisComponentsContext.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepperCommandDialog.js","sources":["../../../CommandDialog/StepperCommandDialog.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, { useState, type CSSProperties } from 'react';\nimport { DialogResult, useDialogContext } from '@cratis/arc.react/dialogs';\nimport { Button } from '../Common/Button';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport {\n CommandForm,\n useCommandFormContext,\n useCommandInstance,\n type CommandFormProps,\n} from '@cratis/arc.react/commands';\nimport {\n Dialog,\n type DialogProps,\n type CloseDialog,\n type ConfirmCallback,\n type CancelCallback,\n} from '../Dialogs/Dialog';\nimport type { StepperCustomizationProps } from './CommandStepper';\nimport { CommandStepperContent } from './CommandStepperContent';\nimport type { BeforeExecuteCallback } from './applyBeforeExecute';\nimport type { ConfirmBeforeExecute } from './confirmBeforeExecute';\nimport { useCommandExecution } from './useCommandExecution';\nimport { getStepPanels } from './stepChildren';\nimport { transitionStep } from './transitionStep';\n\n/**\n * Props for {@link StepperCommandDialog}. Combines the command-form props,\n * the stepper customization props (`linear`, `pt`, …), and dialog-specific\n * props for the outer modal.\n *\n * The Stepper customization props (`pt`/`ptOptions`/`unstyled`) target the\n * inner Stepper. To customize the outer Dialog use `dialogPt`, `dialogPtOptions`,\n * `dialogUnstyled`, and `dialogClassName`.\n *\n * @typeParam TCommand - The command record type.\n * @typeParam TResponse - The response payload type returned by a successful command.\n */\nexport interface StepperCommandDialogProps<TCommand extends object, TResponse = object>\n extends\n Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>,\n StepperCustomizationProps {\n /**\n * A transformer invoked with the current command values immediately before\n * the command executes on submit. 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 every step has already been validated,\n * so a value produced here can never satisfy required-field validation. 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 * Ask before executing the transformed command values; only `true` executes.\n * Fields are disabled from submit until the guarded submission settles. If command values change\n * during that time, execution is skipped; confirm the new values again.\n */\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n /** Dialog title text. */\n title: string;\n /** Controls dialog visibility. Defaults to `true`. */\n visible?: boolean;\n /** Dialog width. */\n width?: string;\n /** Custom CSS styles applied to the dialog. */\n style?: CSSProperties;\n /** Custom CSS styles applied to the dialog content area. */\n contentStyle?: CSSProperties;\n /** Whether the dialog can be resized. Defaults to `false`. */\n resizable?: boolean;\n /** Additional validity gate combined with command form validity. */\n isValid?: boolean;\n /** Fallback close callback. */\n onClose?: CloseDialog;\n /** Confirm callback — called only after successful command execution. */\n onConfirm?: ConfirmCallback;\n /**\n * Cancel callback — invoked for every dismissal that is not a successful submit: the X in the\n * dialog header, the Escape key, and the footer Cancel button when `showCancel` is on. Return\n * `true` to let the dialog close through the dialog context. None of the three is offered while\n * the command is executing.\n */\n onCancel?: CancelCallback;\n /** Label for the submit button shown on the last step when valid. Falls back to the provider's `stepper.submit` message, then `'Submit'`. */\n okLabel?: string;\n /** Label for the next step button. Falls back to the provider's `stepper.next` message, then `'Next'`. */\n nextLabel?: string;\n /** Label for the previous step button. Falls back to the provider's `stepper.previous` message, then `'Previous'`. */\n previousLabel?: string;\n /**\n * Show a Cancel action in the footer. Defaults to `false`, leaving the X in the header as the\n * only way to dismiss. Turn it on for a wizard whose dismissal should be as reachable as its\n * submit — a destructive or long flow, or one presented without a visible header.\n */\n showCancel?: boolean;\n /** Label for the footer cancel button. Falls back to the provider's `dialog.cancel` message, then `'Cancel'`. */\n cancelLabel?: string;\n /**\n * Extra CSS class name forwarded to the underlying Cratis Dialog root.\n * Use the inherited `pt`/`ptOptions`/`unstyled` props to customize the Stepper.\n */\n dialogClassName?: string;\n /** Cratis-owned per-part attributes applied to the outer Dialog. */\n dialogPt?: DialogProps['pt'];\n /**\n * @deprecated Cratis dialog parts always merge. Remove this renderer-era option.\n */\n dialogPtOptions?: DialogProps['ptOptions'];\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `dialogPt` and CSS instead.\n */\n dialogUnstyled?: boolean;\n /** StepperPanel children defining each wizard step. */\n children?: React.ReactNode;\n}\n\ntype StepperCommandDialogWrapperProps<TCommand extends object, TResponse = object> = {\n title: string;\n visible?: boolean;\n width?: string;\n style?: CSSProperties;\n contentStyle?: CSSProperties;\n resizable?: boolean;\n isValid?: boolean;\n onClose?: CloseDialog;\n onConfirm?: ConfirmCallback;\n onCancel?: CancelCallback;\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 okLabel?: string;\n nextLabel?: string;\n previousLabel?: string;\n showCancel?: boolean;\n cancelLabel?: string;\n dialogClassName?: string;\n dialogPt?: DialogProps['pt'];\n dialogPtOptions?: DialogProps['ptOptions'];\n dialogUnstyled?: boolean;\n children?: React.ReactNode;\n} & StepperCustomizationProps;\n\nconst StepperCommandDialogWrapper = <TCommand extends object, TResponse = object>({\n title,\n visible = true,\n width = '600px',\n style,\n contentStyle,\n resizable = false,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n onSuccess,\n onValidationFailure,\n onFailed,\n onException,\n onUnauthorized,\n onBeforeExecute,\n confirmBeforeExecute,\n okLabel,\n nextLabel,\n previousLabel,\n showCancel = false,\n cancelLabel,\n linear = true,\n orientation,\n headerPosition,\n start,\n end,\n onChangeStep,\n pt,\n ptOptions,\n unstyled,\n dialogClassName,\n dialogPt,\n dialogPtOptions,\n dialogUnstyled,\n children,\n}: StepperCommandDialogWrapperProps<TCommand, TResponse>) => {\n const { messages } = useCratisComponentsConfig();\n const stepperMessages = messages?.stepper;\n const dialogMessages = messages?.dialog;\n const resolvedOkLabel = okLabel ?? stepperMessages?.submit ?? 'Submit';\n const resolvedNextLabel = nextLabel ?? stepperMessages?.next ?? 'Next';\n const resolvedPreviousLabel =\n previousLabel ?? stepperMessages?.previous ?? 'Previous';\n const resolvedCancelLabel = cancelLabel ?? dialogMessages?.cancel ?? 'Cancel';\n const {\n setCommandValues,\n setCommandResult,\n isValid: isCommandFormValid,\n getFieldError,\n } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n const submission = useCommandExecution<TCommand, TResponse>(\n commandInstance, setCommandValues, onBeforeExecute, confirmBeforeExecute, onException,\n );\n const isBusy = submission.isSubmitting;\n const [activeStep, setActiveStep] = useState(0);\n const [visitedSteps, setVisitedSteps] = useState<Set<number>>(new Set([0]));\n const [stepErrors, setStepErrors] = useState<boolean[]>([]);\n\n // useDialogContext() is called unconditionally on every render — the try/catch only suppresses\n // the exception when the dialog is used standalone (outside a provider). React's Rules of Hooks\n // are not violated because the hook is always called; the try/catch never skips the call.\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 // Only the steps that actually render count. That count is not fixed: a conditional step\n // (`{condition && <StepperPanel/>}`) can disappear after the user has already advanced past\n // it — a late-resolving query or a `currentValues` overlay flipping the condition is enough.\n // The step the wizard is on is therefore clamped into the set that still renders, and the\n // last/first tests are inequalities, so an index left stranded above the end still resolves\n // to the last surviving step instead of a step that is neither last nor navigable. Same\n // shape as CommandStepperContent, which this dialog's body is.\n const stepCount = getStepPanels(children).length;\n const currentStep = Math.min(Math.max(activeStep, 0), Math.max(stepCount - 1, 0));\n const isLastStep = currentStep >= stepCount - 1;\n const isFirstStep = currentStep <= 0;\n const isDialogValid = isValid !== false && isCommandFormValid;\n const isCurrentStepInvalid = stepErrors[currentStep] ?? false;\n const changeStep = (index: number) => transitionStep({\n index,\n currentStep,\n stepCount,\n isCurrentStepInvalid,\n linear,\n visitedSteps,\n onActiveStepChange: setActiveStep,\n onVisitedStepsChange: setVisitedSteps,\n onChangeStep,\n });\n\n // Both close paths this wrapper owns — the footer Cancel and the successful Submit — run the\n // caller's gate before closing through the dialog host. The header X and Escape are owned by\n // the outer Cratis Dialog instead, which runs the same `onCancel` / `onClose` callbacks; that\n // keeps one contract for the caller no matter which affordance was used.\n const handleClose = async (result: DialogResult) => {\n let shouldCloseThroughContext = true;\n\n if (result === DialogResult.Ok || result === DialogResult.Yes) {\n if (onConfirm) {\n const closeResult = await onConfirm();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n } else if (onCancel) {\n const closeResult = await onCancel();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n\n if (shouldCloseThroughContext) {\n contextCloseDialog?.(result);\n }\n };\n\n // Busy is set before anything is awaited, not just around execute(). `onBeforeExecute` may be\n // async, and from the moment Submit is pressed the dialog is committed to running the command -\n // so every dismissal has to be withdrawn for the whole window, not only for the part of it the\n // request is in flight. Setting it after the transform would leave Cancel live while the command\n // is already on its way: the operator cancels, the dialog closes reporting cancellation, the\n // transform resolves, and the command executes anyway. The `finally` is what releases it, so the\n // flag is cleared on the failure paths and on a transform that throws just as it is on success.\n // Result callbacks run after the submission releases busy.\n const handleSubmit = async () => {\n const result = await submission.run();\n if (!result) return;\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;\n }\n\n await onSuccess?.(result.response as TResponse);\n await handleClose(DialogResult.Ok);\n };\n\n const footer = (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n gap: '0.75rem',\n }}\n >\n {showCancel && (\n <Button\n variant='outline'\n onClick={() => handleClose(DialogResult.Cancelled)}\n disabled={isBusy}\n style={{ width: 'auto' }}\n >\n <span>{resolvedCancelLabel}</span>\n </Button>\n )}\n {!isFirstStep && (\n <Button\n variant='outline'\n onClick={() => changeStep(currentStep - 1)}\n disabled={isBusy}\n style={{ width: 'auto' }}\n >\n <span>{resolvedPreviousLabel}</span>\n </Button>\n )}\n <div style={{ flex: 1 }} />\n {!isLastStep && (\n <Button\n onClick={() => changeStep(currentStep + 1)}\n disabled={isBusy || isCurrentStepInvalid}\n style={{ width: 'auto' }}\n >\n <span>{resolvedNextLabel}</span>\n </Button>\n )}\n {isLastStep && isDialogValid && (\n <Button\n onClick={handleSubmit}\n disabled={isBusy}\n autoFocus\n style={{ width: 'auto' }}\n >\n {isBusy && (\n <span className='cratis-dialog__spinner' aria-hidden='true' />\n )}\n <span>{resolvedOkLabel}</span>\n </Button>\n )}\n </div>\n );\n\n // The header X and the Escape key are withdrawn on the same flag as the footer Cancel. A\n // dismissal that still worked mid-flight would close the dialog and then let onSuccess fire on\n // a dialog that is already gone. `dismissable` is the single switch on the Cratis Dialog that\n // governs all three affordances — the header close button, the backdrop click\n // and `closeOnEscape` — so withdrawing it withdraws every dismissal at once.\n return (\n <Dialog\n title={title}\n visible={visible}\n width={width}\n style={style}\n contentStyle={contentStyle}\n resizable={resizable}\n dismissable={!isBusy}\n buttons={footer}\n onCancel={onCancel}\n onClose={onClose}\n className={dialogClassName}\n pt={dialogPt}\n ptOptions={dialogPtOptions}\n unstyled={dialogUnstyled}\n >\n <CommandStepperContent\n activeStep={currentStep}\n visitedSteps={visitedSteps}\n getFieldError={getFieldError}\n onActiveStepChange={setActiveStep}\n onVisitedStepsChange={setVisitedSteps}\n onStepErrorsChange={setStepErrors}\n showNavigation={false}\n showSubmit={false}\n isSubmitting={confirmBeforeExecute !== undefined && isBusy}\n disableFieldsWhileSubmitting={confirmBeforeExecute !== undefined}\n linear={linear}\n orientation={orientation}\n headerPosition={headerPosition}\n start={start}\n end={end}\n onChangeStep={onChangeStep}\n pt={pt}\n ptOptions={ptOptions}\n unstyled={unstyled}\n >\n {children}\n </CommandStepperContent>\n </Dialog>\n );\n};\n\n/**\n * A multi-step wizard dialog backed by a single Cratis Arc command. Wraps\n * the Cratis-owned Stepper inside a Cratis {@link Dialog}, tracks per-step\n * visit state, surfaces inline error indicators on steps with invalid\n * fields, and executes the bound command when the user submits the last\n * step. Use it when one command has enough fields that they should be\n * broken into named stages; for single-stage commands, use\n * {@link CommandDialog}.\n *\n * ## What `TCommand` is\n *\n * `TCommand` is the auto-generated TypeScript class produced by the Arc\n * proxy generator from a C# `[Command]` record. The wizard fields all bind\n * to properties on this single command — the multi-step UI is purely a\n * presentation grouping of one command's fields, not multiple commands.\n *\n * ## What's unique vs. {@link CommandDialog}\n *\n * - **Progressive disclosure**: fields are grouped into `<StepperPanel>`\n * children and the user advances through them with explicit Previous /\n * Next buttons before reaching Submit on the last step.\n * - **Per-step error indicators**: the step number circle paints red when\n * any field inside that step has a validation error and the step has\n * been visited, so a long wizard doesn't hide a single-field error on\n * page 1 behind page 4. The CratisStepper handles this by reading\n * `getFieldError` from the form context and inspecting which fields\n * belong to which step.\n * - **Visited tracking**: only visited steps show error indicators; an\n * un-visited step is never marked red just because its fields are blank.\n * - **Linear mode (default)**: the user must complete a step before\n * advancing. Set `linear={false}` to allow free navigation.\n * - **Submit only fires on the last step**: the command runs through Arc's\n * command pipeline only when the user clicks the final Submit button —\n * not on every Next click. Failure paths\n * (`onValidationFailure` / `onFailed`) work exactly like\n * {@link CommandDialog}: dialog stays open, errors surface back to the\n * form.\n *\n * ## Typed dialog host usage\n *\n * Same pattern as {@link CommandDialog} — combine with\n * `useDialog<CommandResult<TResponse>>()` from `@cratis/arc.react/dialogs`\n * to get a fully-typed result at the call site:\n *\n * ```tsx\n * import { useDialog, DialogResult } from '@cratis/arc.react/dialogs';\n * import { StepperCommandDialog, StepperPanel } from '@cratis/components/CommandDialog';\n * import { RegisterOrder } from './RegisterOrder'; // proxy from C#\n *\n * const RegisterOrderDialog = () => {\n * const { closeDialog } = useDialogContext<CommandResult<RegisterOrderResponse>>();\n * return (\n * <StepperCommandDialog<RegisterOrder, RegisterOrderResponse>\n * command={RegisterOrder}\n * title=\"New order\"\n * onSuccess={() => closeDialog(DialogResult.Ok)}\n * onCancel={() => closeDialog(DialogResult.Cancelled)}>\n * <StepperPanel header=\"Customer\">\n * <InputTextField value={c => c.customerName} title=\"Name\" />\n * <InputTextField value={c => c.email} title=\"Email\" />\n * </StepperPanel>\n * <StepperPanel header=\"Items\">\n * <ChipsField value={c => c.items} title=\"Items\" />\n * <NumberField value={c => c.quantity} title=\"Quantity\" min={1} />\n * </StepperPanel>\n * <StepperPanel header=\"Confirm\">\n * <CheckboxField value={c => c.confirmed} label=\"I confirm the order\" />\n * </StepperPanel>\n * </StepperCommandDialog>\n * );\n * };\n * ```\n *\n * ## Styling\n *\n * The inherited `pt` / `ptOptions` / `unstyled` props target the inner\n * **Stepper**. Use `dialogPt` / `dialogPtOptions` / `dialogUnstyled` /\n * `dialogClassName` to style the outer **Dialog** independently. See the\n * [pass-through cheat sheet](../../Documentation/Styling/pass-through.md)\n * for the slot reference.\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 StepperCommandDialogProps}.\n */\nconst StepperCommandDialogComponent = <\n TCommand extends object = object,\n TResponse = object,\n>(\n props: StepperCommandDialogProps<TCommand, TResponse>,\n) => {\n const {\n title,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n onBeforeExecute,\n confirmBeforeExecute,\n okLabel,\n nextLabel,\n previousLabel,\n showCancel,\n cancelLabel,\n linear,\n orientation,\n headerPosition,\n start,\n end,\n onChangeStep,\n pt,\n ptOptions,\n unstyled,\n dialogClassName,\n dialogPt,\n dialogPtOptions,\n dialogUnstyled,\n children,\n ...commandFormProps\n } = props;\n\n return (\n <CommandForm<TCommand, TResponse> {...commandFormProps}>\n <StepperCommandDialogWrapper<TCommand, TResponse>\n title={title}\n visible={visible}\n width={width}\n style={style}\n contentStyle={contentStyle}\n resizable={resizable}\n isValid={isValid}\n onClose={onClose}\n onConfirm={onConfirm}\n onCancel={onCancel}\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 okLabel={okLabel}\n nextLabel={nextLabel}\n previousLabel={previousLabel}\n showCancel={showCancel}\n cancelLabel={cancelLabel}\n linear={linear}\n orientation={orientation}\n headerPosition={headerPosition}\n start={start}\n end={end}\n onChangeStep={onChangeStep}\n pt={pt}\n ptOptions={ptOptions}\n unstyled={unstyled}\n dialogClassName={dialogClassName}\n dialogPt={dialogPt}\n dialogPtOptions={dialogPtOptions}\n dialogUnstyled={dialogUnstyled}\n >\n {children}\n </StepperCommandDialogWrapper>\n </CommandForm>\n );\n};\n\n/**\n * A multi-step wizard dialog backed by a single Cratis Arc command. Wraps\n * the Cratis-owned Stepper inside a Cratis {@link Dialog}, tracks per-step\n * visit state, surfaces inline error indicators on steps with invalid\n * fields, and executes the bound command when the user submits the last\n * step. Use it when one command has enough fields that they should be\n * broken into named stages; for single-stage commands, use\n * {@link CommandDialog}.\n *\n * See {@link StepperCommandDialogComponent} 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 StepperCommandDialog = StepperCommandDialogComponent;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;AAuJA,MAAM,2BAA2B,GAAG,CAA8C,EAC9E,KAAK,EACL,OAAO,GAAG,IAAI,EACd,KAAK,GAAG,OAAO,EACf,KAAK,EACL,YAAY,EACZ,SAAS,GAAG,KAAK,EACjB,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,aAAa,EACb,UAAU,GAAG,KAAK,EAClB,WAAW,EACX,MAAM,GAAG,IAAI,EACb,WAAW,EACX,cAAc,EACd,KAAK,EACL,GAAG,EACH,YAAY,EACZ,EAAE,EACF,SAAS,EACT,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,eAAe,EACf,cAAc,EACd,QAAQ,GAC4C,KAAI;AACxD,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,yBAAyB,EAAE;AAChD,IAAA,MAAM,eAAe,GAAG,QAAQ,EAAE,OAAO;AACzC,IAAA,MAAM,cAAc,GAAG,QAAQ,EAAE,MAAM;IACvC,MAAM,eAAe,GAAG,OAAO,IAAI,eAAe,EAAE,MAAM,IAAI,QAAQ;IACtE,MAAM,iBAAiB,GAAG,SAAS,IAAI,eAAe,EA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O,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,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,EAC1C,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAAA,QAAA,EAE7B,QAAQ,EAAA,CACiB,EAAA,CACpB;AAEtB,CAAC;AAgBM,MAAM,oBAAoB,GAAG;;"}
|
|
1
|
+
{"version":3,"file":"StepperCommandDialog.js","sources":["../../../CommandDialog/StepperCommandDialog.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, { useState, type CSSProperties } from 'react';\nimport { DialogResult, useDialogContext } from '@cratis/arc.react/dialogs';\nimport { Button } from '../Common/Button';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport {\n CommandForm,\n useCommandFormContext,\n useCommandInstance,\n type CommandFormProps,\n} from '@cratis/arc.react/commands';\nimport {\n Dialog,\n type DialogProps,\n type CloseDialog,\n type ConfirmCallback,\n type CancelCallback,\n} from '../Dialogs/Dialog';\nimport type { StepperCustomizationProps } from './CommandStepper';\nimport { CommandStepperContent } from './CommandStepperContent';\nimport type { BeforeExecuteCallback } from './applyBeforeExecute';\nimport type { ConfirmBeforeExecute } from './confirmBeforeExecute';\nimport { useCommandExecution } from './useCommandExecution';\nimport { getStepPanels } from './stepChildren';\nimport { transitionStep } from './transitionStep';\n\n/**\n * Props for {@link StepperCommandDialog}. Combines the command-form props,\n * the stepper customization props (`linear`, `pt`, …), and dialog-specific\n * props for the outer modal.\n *\n * The Stepper customization props (`pt`/`ptOptions`/`unstyled`) target the\n * inner Stepper. To customize the outer Dialog use `dialogPt`, `dialogPtOptions`,\n * `dialogUnstyled`, and `dialogClassName`.\n *\n * @typeParam TCommand - The command record type.\n * @typeParam TResponse - The response payload type returned by a successful command.\n */\nexport interface StepperCommandDialogProps<TCommand extends object, TResponse = object>\n extends\n Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>,\n StepperCustomizationProps {\n /**\n * A transformer invoked with the current command values immediately before\n * the command executes on submit. 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 every step has already been validated,\n * so a value produced here can never satisfy required-field validation. 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 * Ask before executing the transformed command values; only `true` executes.\n * Fields are disabled from submit until the guarded submission settles. If command values change\n * during that time, execution is skipped; confirm the new values again.\n */\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n /** Dialog title text. */\n title: string;\n /** Controls dialog visibility. Defaults to `true`. */\n visible?: boolean;\n /** Dialog width. */\n width?: string;\n /** Custom CSS styles applied to the dialog. */\n style?: CSSProperties;\n /** Custom CSS styles applied to the dialog content area. */\n contentStyle?: CSSProperties;\n /** Whether the dialog can be resized. Defaults to `false`. */\n resizable?: boolean;\n /** Additional validity gate combined with command form validity. */\n isValid?: boolean;\n /** Fallback close callback. */\n onClose?: CloseDialog;\n /** Confirm callback — called only after successful command execution. */\n onConfirm?: ConfirmCallback;\n /**\n * Cancel callback — invoked for every dismissal that is not a successful submit: the X in the\n * dialog header, the Escape key, and the footer Cancel button when `showCancel` is on. Return\n * `true` to let the dialog close through the dialog context. None of the three is offered while\n * the command is executing.\n */\n onCancel?: CancelCallback;\n /** Label for the submit button shown on the last step when valid. Falls back to the provider's `stepper.submit` message, then `'Submit'`. */\n okLabel?: string;\n /** Label for the next step button. Falls back to the provider's `stepper.next` message, then `'Next'`. */\n nextLabel?: string;\n /** Label for the previous step button. Falls back to the provider's `stepper.previous` message, then `'Previous'`. */\n previousLabel?: string;\n /**\n * Show a Cancel action in the footer. Defaults to `false`, leaving the X in the header as the\n * only way to dismiss. Turn it on for a wizard whose dismissal should be as reachable as its\n * submit — a destructive or long flow, or one presented without a visible header.\n */\n showCancel?: boolean;\n /** Label for the footer cancel button. Falls back to the provider's `dialog.cancel` message, then `'Cancel'`. */\n cancelLabel?: string;\n /**\n * Extra CSS class name forwarded to the underlying Cratis Dialog root.\n * Use the inherited `pt`/`ptOptions`/`unstyled` props to customize the Stepper.\n */\n dialogClassName?: string;\n /** Cratis-owned per-part attributes applied to the outer Dialog. */\n dialogPt?: DialogProps['pt'];\n /**\n * @deprecated Cratis dialog parts always merge. Remove this renderer-era option.\n */\n dialogPtOptions?: DialogProps['ptOptions'];\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `dialogPt` and CSS instead.\n */\n dialogUnstyled?: boolean;\n /** StepperPanel children defining each wizard step. */\n children?: React.ReactNode;\n}\n\ntype StepperCommandDialogWrapperProps<TCommand extends object, TResponse = object> = {\n title: string;\n visible?: boolean;\n width?: string;\n style?: CSSProperties;\n contentStyle?: CSSProperties;\n resizable?: boolean;\n isValid?: boolean;\n onClose?: CloseDialog;\n onConfirm?: ConfirmCallback;\n onCancel?: CancelCallback;\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 okLabel?: string;\n nextLabel?: string;\n previousLabel?: string;\n showCancel?: boolean;\n cancelLabel?: string;\n dialogClassName?: string;\n dialogPt?: DialogProps['pt'];\n dialogPtOptions?: DialogProps['ptOptions'];\n dialogUnstyled?: boolean;\n children?: React.ReactNode;\n} & StepperCustomizationProps;\n\nconst StepperCommandDialogWrapper = <TCommand extends object, TResponse = object>({\n title,\n visible = true,\n width = '600px',\n style,\n contentStyle,\n resizable = false,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n onSuccess,\n onValidationFailure,\n onFailed,\n onException,\n onUnauthorized,\n onBeforeExecute,\n confirmBeforeExecute,\n okLabel,\n nextLabel,\n previousLabel,\n showCancel = false,\n cancelLabel,\n linear = true,\n orientation,\n headerPosition,\n start,\n end,\n onChangeStep,\n pt,\n ptOptions,\n unstyled,\n dialogClassName,\n dialogPt,\n dialogPtOptions,\n dialogUnstyled,\n children,\n}: StepperCommandDialogWrapperProps<TCommand, TResponse>) => {\n const { messages } = useCratisComponentsConfig();\n const stepperMessages = messages?.stepper;\n const dialogMessages = messages?.dialog;\n const resolvedOkLabel = okLabel ?? stepperMessages?.submit ?? 'Submit';\n const resolvedNextLabel = nextLabel ?? stepperMessages?.next ?? 'Next';\n const resolvedPreviousLabel =\n previousLabel ?? stepperMessages?.previous ?? 'Previous';\n const resolvedCancelLabel = cancelLabel ?? dialogMessages?.cancel ?? 'Cancel';\n const {\n setCommandValues,\n setCommandResult,\n isValid: isCommandFormValid,\n getFieldError,\n } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n const submission = useCommandExecution<TCommand, TResponse>(\n commandInstance, setCommandValues, onBeforeExecute, confirmBeforeExecute, onException,\n );\n const isBusy = submission.isSubmitting;\n const [activeStep, setActiveStep] = useState(0);\n const [visitedSteps, setVisitedSteps] = useState<Set<number>>(new Set([0]));\n const [stepErrors, setStepErrors] = useState<boolean[]>([]);\n\n // useDialogContext() is called unconditionally on every render — the try/catch only suppresses\n // the exception when the dialog is used standalone (outside a provider). React's Rules of Hooks\n // are not violated because the hook is always called; the try/catch never skips the call.\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 // Only the steps that actually render count. That count is not fixed: a conditional step\n // (`{condition && <StepperPanel/>}`) can disappear after the user has already advanced past\n // it — a late-resolving query or a `currentValues` overlay flipping the condition is enough.\n // The step the wizard is on is therefore clamped into the set that still renders, and the\n // last/first tests are inequalities, so an index left stranded above the end still resolves\n // to the last surviving step instead of a step that is neither last nor navigable. Same\n // shape as CommandStepperContent, which this dialog's body is.\n const stepCount = getStepPanels(children).length;\n const currentStep = Math.min(Math.max(activeStep, 0), Math.max(stepCount - 1, 0));\n const isLastStep = currentStep >= stepCount - 1;\n const isFirstStep = currentStep <= 0;\n const isDialogValid = isValid !== false && isCommandFormValid;\n const isCurrentStepInvalid = stepErrors[currentStep] ?? false;\n const changeStep = (index: number) => transitionStep({\n index,\n currentStep,\n stepCount,\n isCurrentStepInvalid,\n linear,\n visitedSteps,\n onActiveStepChange: setActiveStep,\n onVisitedStepsChange: setVisitedSteps,\n onChangeStep,\n });\n\n // Both close paths this wrapper owns — the footer Cancel and the successful Submit — run the\n // caller's gate before closing through the dialog host. The header X and Escape are owned by\n // the outer Cratis Dialog instead, which runs the same `onCancel` / `onClose` callbacks; that\n // keeps one contract for the caller no matter which affordance was used.\n const handleClose = async (result: DialogResult) => {\n let shouldCloseThroughContext = true;\n\n if (result === DialogResult.Ok || result === DialogResult.Yes) {\n if (onConfirm) {\n const closeResult = await onConfirm();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n } else if (onCancel) {\n const closeResult = await onCancel();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n\n if (shouldCloseThroughContext) {\n contextCloseDialog?.(result);\n }\n };\n\n // Busy is set before anything is awaited, not just around execute(). `onBeforeExecute` may be\n // async, and from the moment Submit is pressed the dialog is committed to running the command -\n // so every dismissal has to be withdrawn for the whole window, not only for the part of it the\n // request is in flight. Setting it after the transform would leave Cancel live while the command\n // is already on its way: the operator cancels, the dialog closes reporting cancellation, the\n // transform resolves, and the command executes anyway. The `finally` is what releases it, so the\n // flag is cleared on the failure paths and on a transform that throws just as it is on success.\n // Result callbacks run after the submission releases busy.\n const handleSubmit = async () => {\n const result = await submission.run();\n if (!result) return;\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;\n }\n\n await onSuccess?.(result.response as TResponse);\n await handleClose(DialogResult.Ok);\n };\n\n const footer = (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n gap: '0.75rem',\n }}\n >\n {showCancel && (\n <Button\n variant='outline'\n onClick={() => handleClose(DialogResult.Cancelled)}\n disabled={isBusy}\n style={{ width: 'auto' }}\n >\n <span>{resolvedCancelLabel}</span>\n </Button>\n )}\n {!isFirstStep && (\n <Button\n variant='outline'\n onClick={() => changeStep(currentStep - 1)}\n disabled={isBusy}\n style={{ width: 'auto' }}\n >\n <span>{resolvedPreviousLabel}</span>\n </Button>\n )}\n <div style={{ flex: 1 }} />\n {!isLastStep && (\n <Button\n onClick={() => changeStep(currentStep + 1)}\n disabled={isBusy || isCurrentStepInvalid}\n style={{ width: 'auto' }}\n >\n <span>{resolvedNextLabel}</span>\n </Button>\n )}\n {isLastStep && isDialogValid && (\n <Button\n onClick={handleSubmit}\n disabled={isBusy}\n autoFocus\n style={{ width: 'auto' }}\n >\n {isBusy && (\n <span className='cratis-dialog__spinner' aria-hidden='true' />\n )}\n <span>{resolvedOkLabel}</span>\n </Button>\n )}\n </div>\n );\n\n // The header X and the Escape key are withdrawn on the same flag as the footer Cancel. A\n // dismissal that still worked mid-flight would close the dialog and then let onSuccess fire on\n // a dialog that is already gone. `dismissable` is the single switch on the Cratis Dialog that\n // governs all three affordances — the header close button, the backdrop click\n // and `closeOnEscape` — so withdrawing it withdraws every dismissal at once.\n return (\n <Dialog\n title={title}\n visible={visible}\n width={width}\n style={style}\n contentStyle={contentStyle}\n resizable={resizable}\n dismissable={!isBusy}\n buttons={footer}\n onCancel={onCancel}\n onClose={onClose}\n className={dialogClassName}\n pt={dialogPt}\n ptOptions={dialogPtOptions}\n unstyled={dialogUnstyled}\n >\n <CommandStepperContent\n activeStep={currentStep}\n visitedSteps={visitedSteps}\n getFieldError={getFieldError}\n onActiveStepChange={setActiveStep}\n onVisitedStepsChange={setVisitedSteps}\n onStepErrorsChange={setStepErrors}\n showNavigation={false}\n showSubmit={false}\n isSubmitting={confirmBeforeExecute !== undefined && isBusy}\n disableFieldsWhileSubmitting={confirmBeforeExecute !== undefined}\n linear={linear}\n orientation={orientation}\n headerPosition={headerPosition}\n start={start}\n end={end}\n onChangeStep={onChangeStep}\n pt={pt}\n ptOptions={ptOptions}\n unstyled={unstyled}\n >\n {children}\n </CommandStepperContent>\n </Dialog>\n );\n};\n\n/**\n * A multi-step wizard dialog backed by a single Cratis Arc command. Wraps\n * the Cratis-owned Stepper inside a Cratis {@link Dialog}, tracks per-step\n * visit state, surfaces inline error indicators on steps with invalid\n * fields, and executes the bound command when the user submits the last\n * step. Use it when one command has enough fields that they should be\n * broken into named stages; for single-stage commands, use\n * {@link CommandDialog}.\n *\n * ## What `TCommand` is\n *\n * `TCommand` is the auto-generated TypeScript class produced by the Arc\n * proxy generator from a C# `[Command]` record. The wizard fields all bind\n * to properties on this single command — the multi-step UI is purely a\n * presentation grouping of one command's fields, not multiple commands.\n *\n * ## What's unique vs. {@link CommandDialog}\n *\n * - **Progressive disclosure**: fields are grouped into `<StepperPanel>`\n * children and the user advances through them with explicit Previous /\n * Next buttons before reaching Submit on the last step.\n * - **Per-step error indicators**: the step number circle paints red when\n * any field inside that step has a validation error and the step has\n * been visited, so a long wizard doesn't hide a single-field error on\n * page 1 behind page 4. The CratisStepper handles this by reading\n * `getFieldError` from the form context and inspecting which fields\n * belong to which step.\n * - **Visited tracking**: only visited steps show error indicators; an\n * un-visited step is never marked red just because its fields are blank.\n * - **Linear mode (default)**: the user must complete a step before\n * advancing. Set `linear={false}` to allow free navigation.\n * - **Submit only fires on the last step**: the command runs through Arc's\n * command pipeline only when the user clicks the final Submit button —\n * not on every Next click. Failure paths\n * (`onValidationFailure` / `onFailed`) work exactly like\n * {@link CommandDialog}: dialog stays open, errors surface back to the\n * form.\n *\n * ## Typed dialog host usage\n *\n * Same pattern as {@link CommandDialog} — combine with\n * `useDialog<CommandResult<TResponse>>()` from `@cratis/arc.react/dialogs`\n * to get a fully-typed result at the call site:\n *\n * ```tsx\n * import { useDialog, DialogResult } from '@cratis/arc.react/dialogs';\n * import { StepperCommandDialog, StepperPanel } from '@cratis/components/CommandDialog';\n * import { RegisterOrder } from './RegisterOrder'; // proxy from C#\n *\n * const RegisterOrderDialog = () => {\n * const { closeDialog } = useDialogContext<CommandResult<RegisterOrderResponse>>();\n * return (\n * <StepperCommandDialog<RegisterOrder, RegisterOrderResponse>\n * command={RegisterOrder}\n * title=\"New order\"\n * onSuccess={() => closeDialog(DialogResult.Ok)}\n * onCancel={() => closeDialog(DialogResult.Cancelled)}>\n * <StepperPanel header=\"Customer\">\n * <InputTextField value={c => c.customerName} title=\"Name\" />\n * <InputTextField value={c => c.email} title=\"Email\" />\n * </StepperPanel>\n * <StepperPanel header=\"Items\">\n * <ChipsField value={c => c.items} title=\"Items\" />\n * <NumberField value={c => c.quantity} title=\"Quantity\" min={1} />\n * </StepperPanel>\n * <StepperPanel header=\"Confirm\">\n * <CheckboxField value={c => c.confirmed} label=\"I confirm the order\" />\n * </StepperPanel>\n * </StepperCommandDialog>\n * );\n * };\n * ```\n *\n * ## Styling\n *\n * The inherited `pt` / `ptOptions` / `unstyled` props target the inner\n * **Stepper**. Use `dialogPt` / `dialogPtOptions` / `dialogUnstyled` /\n * `dialogClassName` to style the outer **Dialog** independently. See the\n * [pass-through cheat sheet](../../Documentation/Styling/pass-through.md)\n * for the slot reference.\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 StepperCommandDialogProps}.\n */\nconst StepperCommandDialogComponent = <\n TCommand extends object = object,\n TResponse = object,\n>(\n props: StepperCommandDialogProps<TCommand, TResponse>,\n) => {\n const {\n title,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n onBeforeExecute,\n confirmBeforeExecute,\n okLabel,\n nextLabel,\n previousLabel,\n showCancel,\n cancelLabel,\n linear,\n orientation,\n headerPosition,\n start,\n end,\n onChangeStep,\n pt,\n ptOptions,\n unstyled,\n dialogClassName,\n dialogPt,\n dialogPtOptions,\n dialogUnstyled,\n children,\n ...commandFormProps\n } = props;\n\n return (\n <CommandForm<TCommand, TResponse> {...commandFormProps}>\n <StepperCommandDialogWrapper<TCommand, TResponse>\n title={title}\n visible={visible}\n width={width}\n style={style}\n contentStyle={contentStyle}\n resizable={resizable}\n isValid={isValid}\n onClose={onClose}\n onConfirm={onConfirm}\n onCancel={onCancel}\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 okLabel={okLabel}\n nextLabel={nextLabel}\n previousLabel={previousLabel}\n showCancel={showCancel}\n cancelLabel={cancelLabel}\n linear={linear}\n orientation={orientation}\n headerPosition={headerPosition}\n start={start}\n end={end}\n onChangeStep={onChangeStep}\n pt={pt}\n ptOptions={ptOptions}\n unstyled={unstyled}\n dialogClassName={dialogClassName}\n dialogPt={dialogPt}\n dialogPtOptions={dialogPtOptions}\n dialogUnstyled={dialogUnstyled}\n >\n {children}\n </StepperCommandDialogWrapper>\n </CommandForm>\n );\n};\n\n/**\n * A multi-step wizard dialog backed by a single Cratis Arc command. Wraps\n * the Cratis-owned Stepper inside a Cratis {@link Dialog}, tracks per-step\n * visit state, surfaces inline error indicators on steps with invalid\n * fields, and executes the bound command when the user submits the last\n * step. Use it when one command has enough fields that they should be\n * broken into named stages; for single-stage commands, use\n * {@link CommandDialog}.\n *\n * See {@link StepperCommandDialogComponent} 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 StepperCommandDialog = StepperCommandDialogComponent;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;AAuJA,MAAM,2BAA2B,GAAG,CAA8C,EAC9E,KAAK,EACL,OAAO,GAAG,IAAI,EACd,KAAK,GAAG,OAAO,EACf,KAAK,EACL,YAAY,EACZ,SAAS,GAAG,KAAK,EACjB,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,SAAS,EACT,mB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c,EAC9B,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAAA,QAAA,EAE7B,QAAQ,EAAA,CACiB,EAAA,CACpB;AAEtB,CAAC;AAgBM,MAAM,oBAAoB,GAAG;;"}
|
|
@@ -9,7 +9,7 @@ export interface BreadcrumbItem {
|
|
|
9
9
|
label: ReactNode;
|
|
10
10
|
/** Destination. A segment without one is text rather than a link — as the last segment is. */
|
|
11
11
|
href?: string;
|
|
12
|
-
/**
|
|
12
|
+
/** Legacy press callback. Prefer provider routing with href; manually navigating here can navigate twice. */
|
|
13
13
|
onNavigate?: () => void;
|
|
14
14
|
}
|
|
15
15
|
/** Stable Cratis-owned parts for styling a {@link Breadcrumbs} trail. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../../Common/Breadcrumbs.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAU5D,+GAA+G;AAC/G,MAAM,MAAM,yBAAyB,GAAG,IAAI,CACxC,cAAc,CAAC,WAAW,CAAC,EAC3B,WAAW,GAAG,OAAO,GAAG,OAAO,CAClC,GAAG;IACA,CAAC,aAAa,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC5E,CAAC;AAEF,kDAAkD;AAClD,MAAM,WAAW,cAAc;IAC3B,qBAAqB;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,8FAA8F;IAC9F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.js","sources":["../../../Common/Breadcrumbs.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 HTMLAttributes, type ReactNode } from 'react';\nimport {\n Breadcrumb as AriaBreadcrumb,\n Breadcrumbs as AriaBreadcrumbs,\n Link as AriaLink,\n} from 'react-aria-components/Breadcrumbs';\nimport type { ExactPartKeys } from '../types/ExactPartKeys';\nimport type { PartsOf } from '../types/parts';\nimport { classNames } from '../ClassNames/classNames';\n\n/** Attributes a consumer may hand to one {@link Breadcrumbs} part: class, style, title and data attributes. */\nexport type BreadcrumbsPartAttributes = Pick<\n HTMLAttributes<HTMLElement>,\n 'className' | 'style' | 'title'\n> & {\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\n/** One segment of a {@link Breadcrumbs} trail. */\nexport interface BreadcrumbItem {\n /** Visible label. */\n label: ReactNode;\n /** Destination. A segment without one is text rather than a link — as the last segment is. */\n href?: string;\n /**
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.js","sources":["../../../Common/Breadcrumbs.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 HTMLAttributes, type ReactNode } from 'react';\nimport {\n Breadcrumb as AriaBreadcrumb,\n Breadcrumbs as AriaBreadcrumbs,\n Link as AriaLink,\n} from 'react-aria-components/Breadcrumbs';\nimport type { ExactPartKeys } from '../types/ExactPartKeys';\nimport type { PartsOf } from '../types/parts';\nimport { classNames } from '../ClassNames/classNames';\n\n/** Attributes a consumer may hand to one {@link Breadcrumbs} part: class, style, title and data attributes. */\nexport type BreadcrumbsPartAttributes = Pick<\n HTMLAttributes<HTMLElement>,\n 'className' | 'style' | 'title'\n> & {\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\n/** One segment of a {@link Breadcrumbs} trail. */\nexport interface BreadcrumbItem {\n /** Visible label. */\n label: ReactNode;\n /** Destination. A segment without one is text rather than a link — as the last segment is. */\n href?: string;\n /** Legacy press callback. Prefer provider routing with href; manually navigating here can navigate twice. */\n onNavigate?: () => void;\n}\n\n/** Stable Cratis-owned parts for styling a {@link Breadcrumbs} trail. */\nexport interface BreadcrumbsParts {\n /** The navigation landmark wrapping the trail. */\n root?: BreadcrumbsPartAttributes;\n /** One segment. */\n item?: BreadcrumbsPartAttributes;\n /** A segment's link, rendered for every segment that is not the current page. */\n link?: BreadcrumbsPartAttributes;\n /** The separator between two segments. */\n separator?: BreadcrumbsPartAttributes;\n}\n\nconst breadcrumbsPartsMatchManifest: ExactPartKeys<\n BreadcrumbsParts,\n PartsOf<'Breadcrumbs'>\n> = true;\nvoid breadcrumbsPartsMatchManifest;\n\n/** Props for {@link Breadcrumbs}. */\nexport interface BreadcrumbsProps {\n /** The trail, outermost first. The last item is the current page. */\n items: BreadcrumbItem[];\n /** Separator rendered between segments. Defaults to a slash; decorative either way. */\n separator?: ReactNode;\n /** Accessible name for the landmark. Name it when a page carries more than one trail. */\n 'aria-label'?: string;\n /** Extra class name for the root element. */\n className?: string;\n /** Cratis-owned per-part attributes. */\n pt?: BreadcrumbsParts;\n}\n\n/**\n * A breadcrumb trail.\n *\n * The last segment is the current page: it carries `aria-current=\"page\"` and is never a link, which\n * is what tells a screen-reader user where the trail ends. Earlier segments are links when they have\n * a destination. The trail is an ordered list inside a navigation landmark, so it can be jumped to\n * and its length announced.\n */\nexport const Breadcrumbs = ({\n items,\n separator = '/',\n 'aria-label': ariaLabel,\n className,\n pt,\n}: BreadcrumbsProps) => (\n // React Aria renders the ordered list; the navigation landmark around it is ours, because a\n // trail a screen-reader user cannot jump to is only a list of links.\n <nav aria-label={ariaLabel}>\n <AriaBreadcrumbs\n {...pt?.root}\n className={classNames('cratis-breadcrumbs', pt?.root?.className, className)}\n data-cratis-part='root'\n >\n {items.map((item, index) => {\n const current = index === items.length - 1;\n return (\n <AriaBreadcrumb\n key={`${index}-${String(item.href ?? '')}`}\n {...pt?.item}\n className={classNames('cratis-breadcrumbs__item', pt?.item?.className)}\n data-cratis-part='item'\n data-selected={current || undefined}\n >\n {/*\n * Every segment is a link, including the current page: React Aria hands\n * aria-current=\"page\" and the disabled state to the last one through its link\n * context, so a segment rendered as plain text would silently lose both.\n */}\n <AriaLink\n {...pt?.link}\n href={current ? undefined : item.href}\n onPress={current ? undefined : item.onNavigate}\n className={classNames(\n 'cratis-breadcrumbs__link',\n pt?.link?.className,\n )}\n data-cratis-part='link'\n data-selected={current || undefined}\n >\n {item.label}\n </AriaLink>\n {!current && (\n <span\n {...pt?.separator}\n aria-hidden='true'\n className={classNames(\n 'cratis-breadcrumbs__separator',\n pt?.separator?.className,\n )}\n data-cratis-part='separator'\n >\n {separator}\n </span>\n )}\n </AriaBreadcrumb>\n );\n })}\n </AriaBreadcrumbs>\n </nav>\n);\n"],"names":["_jsx","AriaBreadcrumbs","_jsxs","AriaBreadcrumb","AriaLink"],"mappings":";;;;AAuEO,MAAM,WAAW,GAAG,CAAC,EACxB,KAAK,EACL,SAAS,GAAG,GAAG,EACf,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,EAAE,GACa,MAGfA,GAAA,CAAA,KAAA,EAAA,EAAA,YAAA,EAAiB,SAAS,EAAA,QAAA,EACtBA,GAAA,CAACC,aAAe,EAAA,EAAA,GACR,EAAE,EAAE,IAAI,EACZ,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,EAAA,kBAAA,EAC1D,MAAM,EAAA,QAAA,EAE1B,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,KAAI;YACvB,MAAM,OAAO,GAAG,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC;AAC1C,YAAA,QACIC,IAAA,CAACC,UAAc,EAAA,EAAA,GAEP,EAAE,EAAE,IAAI,EACZ,SAAS,EAAE,UAAU,CAAC,0BAA0B,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,EAAA,kBAAA,EACrD,MAAM,EAAA,eAAA,EACR,OAAO,IAAI,SAAS,EAAA,QAAA,EAAA,CAOnCH,GAAA,CAACI,IAAQ,EAAA,EAAA,GACD,EAAE,EAAE,IAAI,EACZ,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,IAAI,EACrC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,UAAU,EAC9C,SAAS,EAAE,UAAU,CACjB,0BAA0B,EAC1B,EAAE,EAAE,IAAI,EAAE,SAAS,CACtB,EAAA,kBAAA,EACgB,MAAM,EAAA,eAAA,EACR,OAAO,IAAI,SAAS,EAAA,QAAA,EAElC,IAAI,CAAC,KAAK,EAAA,CACJ,EACV,CAAC,OAAO,KACLJ,GAAA,CAAA,MAAA,EAAA,EAAA,GACQ,EAAE,EAAE,SAAS,EAAA,aAAA,EACL,MAAM,EAClB,SAAS,EAAE,UAAU,CACjB,+BAA+B,EAC/B,EAAE,EAAE,SAAS,EAAE,SAAS,CAC3B,EAAA,kBAAA,EACgB,WAAW,EAAA,QAAA,EAE3B,SAAS,EAAA,CACP,CACV,CAAA,EAAA,EApCI,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA,CAAE,CAqC7B;AAErB,QAAA,CAAC,CAAC,EAAA,CACY,EAAA,CAChB;;"}
|
|
@@ -212,8 +212,17 @@ interface LegacyLocaleMessages {
|
|
|
212
212
|
};
|
|
213
213
|
[message: string]: unknown;
|
|
214
214
|
}
|
|
215
|
+
/** Application routing callbacks used by Components links. */
|
|
216
|
+
export interface CratisComponentsRouter {
|
|
217
|
+
/** Navigate to the original link destination for an ordinary same-origin activation. */
|
|
218
|
+
navigate: (href: string) => void;
|
|
219
|
+
/** Resolve a destination to the rendered href, for example to include a router basename. */
|
|
220
|
+
useHref?: (href: string) => string;
|
|
221
|
+
}
|
|
215
222
|
/** Renderer-independent application configuration for Components. */
|
|
216
223
|
export interface CratisComponentsConfig {
|
|
224
|
+
/** Optional client-side router. Omit to retain native or inherited routing behavior. */
|
|
225
|
+
router?: CratisComponentsRouter;
|
|
217
226
|
/** BCP 47 locale used by React Aria for dates, numbers, and interaction announcements. */
|
|
218
227
|
locale?: string;
|
|
219
228
|
/** Cratis-owned labels not supplied by the platform's internationalization APIs. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CratisComponentsProvider.d.ts","sourceRoot":"","sources":["../../../Common/CratisComponentsProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CratisComponentsProvider.d.ts","sourceRoot":"","sources":["../../../Common/CratisComponentsProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIhD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,6BAA0B,CAAC;AAEtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,yBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAgC,CAAC;AAM/E,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA2C,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA0C,CAAC;AAErF,wDAAwD;AACxD,MAAM,WAAW,uBAAuB;IACpC,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd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,GAAG,YAAY,CAAC;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,kBAAkB,GAAG,SAAS,kBAAkB,EAAE,CAAC;IAC7D,iEAAiE;IACjE,WAAW,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACnC,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;IAC9C;;;OAGG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,2BAA2B;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,UAC7B,sBAAsB,GAAG,SAAS,KAC1C,sBAIF,CAAC;AAoEF,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,6GASlC,6BAA6B,gCA+B/B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { I18nProvider } from 'react-aria-components/I18nProvider';
|
|
4
|
+
import { RouterProvider } from 'react-aria-components';
|
|
4
5
|
import { merge } from 'ts-deepmerge';
|
|
5
6
|
import { Toaster } from '../Notifications/Toaster.js';
|
|
6
7
|
import { unstable_RendererRoot } from '../renderer/RendererContext.js';
|
|
@@ -70,7 +71,8 @@ const validLocale = (locale) => {
|
|
|
70
71
|
};
|
|
71
72
|
const CratisComponentsProvider = ({ value, toaster, library, libraryMode, rendererFallback, overlayEnvironment, rendererSetup, children, }) => {
|
|
72
73
|
const resolved = useMemo(() => withLegacyLocaleMessages(mergeCratisComponentsConfig(value), value?.messages), [value]);
|
|
73
|
-
|
|
74
|
+
const content = (jsxs(I18nProvider, { locale: validLocale(resolved.locale), children: [children, toaster && jsx(Toaster, { ...(typeof toaster === 'object' ? toaster : {}) })] }));
|
|
75
|
+
return (jsx(RendererRoot, { library: library, libraryMode: libraryMode, rendererFallback: rendererFallback, overlayEnvironment: overlayEnvironment, rendererSetup: rendererSetup, children: jsx(CratisComponentsContext.Provider, { value: resolved, children: resolved.router ? (jsx(RouterProvider, { navigate: resolved.router.navigate, useHref: resolved.router.useHref, children: content })) : content }) }));
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
export { CratisComponentsProvider, cratisDefaults, mergeCratisComponentsConfig };
|