@cratis/components 4.38.1 → 4.39.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/Chat/ChatSidebar.d.ts.map +1 -1
- package/dist/esm/Chat/ChatSidebar.js +2 -2
- package/dist/esm/Chat/ChatSidebar.js.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.d.ts +1 -1
- package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.js +5 -2
- package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/esm/CommandDialog/CommandStepperContent.js +1 -1
- package/dist/esm/CommandDialog/CommandStepperContent.js.map +1 -1
- package/dist/esm/CommandDialog/StepperCommandDialog.d.ts +7 -0
- package/dist/esm/CommandDialog/StepperCommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/StepperCommandDialog.js +4 -4
- package/dist/esm/CommandDialog/StepperCommandDialog.js.map +1 -1
- package/dist/esm/CommandForm/fields/CheckboxField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/CheckboxField.js +1 -1
- package/dist/esm/CommandForm/fields/CheckboxField.js.map +1 -1
- package/dist/esm/CommandForm/fields/ChipsField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/ChipsField.js +1 -1
- package/dist/esm/CommandForm/fields/ChipsField.js.map +1 -1
- package/dist/esm/CommandForm/fields/ColorPickerField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/ColorPickerField.js +1 -1
- package/dist/esm/CommandForm/fields/ColorPickerField.js.map +1 -1
- package/dist/esm/CommandForm/fields/NumberField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/NumberField.js +1 -1
- package/dist/esm/CommandForm/fields/NumberField.js.map +1 -1
- package/dist/esm/CommandForm/fields/PasswordField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/PasswordField.js +1 -1
- package/dist/esm/CommandForm/fields/PasswordField.js.map +1 -1
- package/dist/esm/CommandForm/fields/RadioButtonField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/RadioButtonField.js +1 -1
- package/dist/esm/CommandForm/fields/RadioButtonField.js.map +1 -1
- package/dist/esm/CommandForm/fields/RadioGroupField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/RadioGroupField.js +1 -1
- package/dist/esm/CommandForm/fields/RadioGroupField.js.map +1 -1
- package/dist/esm/CommandForm/fields/RatingField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/RatingField.js +1 -1
- package/dist/esm/CommandForm/fields/RatingField.js.map +1 -1
- package/dist/esm/CommandForm/fields/SliderField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/SliderField.js +1 -1
- package/dist/esm/CommandForm/fields/SliderField.js.map +1 -1
- package/dist/esm/CommandForm/fields/ToggleSwitchField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/ToggleSwitchField.js +1 -1
- package/dist/esm/CommandForm/fields/ToggleSwitchField.js.map +1 -1
- package/dist/esm/Common/ActionMenubar.d.ts.map +1 -1
- package/dist/esm/Common/ActionMenubar.js +1 -1
- package/dist/esm/Common/ActionMenubar.js.map +1 -1
- package/dist/esm/Common/Breadcrumbs.d.ts.map +1 -1
- package/dist/esm/Common/Breadcrumbs.js +1 -1
- package/dist/esm/Common/Breadcrumbs.js.map +1 -1
- package/dist/esm/Common/Button.d.ts.map +1 -1
- package/dist/esm/Common/Button.js +4 -1
- package/dist/esm/Common/Button.js.map +1 -1
- package/dist/esm/Common/CheckboxImplementation.d.ts.map +1 -1
- package/dist/esm/Common/CheckboxImplementation.js +1 -1
- package/dist/esm/Common/CheckboxImplementation.js.map +1 -1
- package/dist/esm/Common/ComboBox.js +1 -1
- package/dist/esm/Common/ComboBox.js.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.d.ts +14 -1
- package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.js +6 -2
- package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.d.ts.map +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.js +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.js.map +1 -1
- package/dist/esm/Common/FormElement.js +1 -1
- package/dist/esm/Common/FormElement.js.map +1 -1
- package/dist/esm/Common/IconButton.d.ts.map +1 -1
- package/dist/esm/Common/IconButton.js +4 -1
- package/dist/esm/Common/IconButton.js.map +1 -1
- package/dist/esm/Common/NumberInput.d.ts.map +1 -1
- package/dist/esm/Common/NumberInput.js +1 -1
- package/dist/esm/Common/NumberInput.js.map +1 -1
- package/dist/esm/Common/Page.d.ts +1 -1
- package/dist/esm/Common/Page.d.ts.map +1 -1
- package/dist/esm/Common/Page.js +11 -2
- package/dist/esm/Common/Page.js.map +1 -1
- package/dist/esm/Common/RadioImplementation.d.ts.map +1 -1
- package/dist/esm/Common/RadioImplementation.js +1 -1
- package/dist/esm/Common/RadioImplementation.js.map +1 -1
- package/dist/esm/Common/SurfaceImplementation.d.ts.map +1 -1
- package/dist/esm/Common/SurfaceImplementation.js +1 -1
- package/dist/esm/Common/SurfaceImplementation.js.map +1 -1
- package/dist/esm/Common/SwitchImplementation.d.ts.map +1 -1
- package/dist/esm/Common/SwitchImplementation.js +1 -1
- package/dist/esm/Common/SwitchImplementation.js.map +1 -1
- package/dist/esm/Common/Tabs.d.ts.map +1 -1
- package/dist/esm/Common/Tabs.js +1 -1
- package/dist/esm/Common/Tabs.js.map +1 -1
- package/dist/esm/Common/TagGroup.d.ts.map +1 -1
- package/dist/esm/Common/TagGroup.js +1 -1
- package/dist/esm/Common/TagGroup.js.map +1 -1
- package/dist/esm/Common/TextArea.d.ts.map +1 -1
- package/dist/esm/Common/TextArea.js +4 -1
- package/dist/esm/Common/TextArea.js.map +1 -1
- package/dist/esm/Common/TextInput.d.ts.map +1 -1
- package/dist/esm/Common/TextInput.js +4 -1
- package/dist/esm/Common/TextInput.js.map +1 -1
- package/dist/esm/Common/ToggleGroup.d.ts.map +1 -1
- package/dist/esm/Common/ToggleGroup.js +1 -1
- package/dist/esm/Common/ToggleGroup.js.map +1 -1
- package/dist/esm/Common/buttonDescriptor.d.ts +7 -0
- package/dist/esm/Common/buttonDescriptor.d.ts.map +1 -0
- package/dist/esm/Common/buttonDescriptor.js +28 -0
- package/dist/esm/Common/buttonDescriptor.js.map +1 -0
- package/dist/esm/Common/textFieldDescriptors.d.ts +7 -0
- package/dist/esm/Common/textFieldDescriptors.d.ts.map +1 -0
- package/dist/esm/Common/textFieldDescriptors.js +25 -0
- package/dist/esm/Common/textFieldDescriptors.js.map +1 -0
- package/dist/esm/ComponentPicker/ComponentHighlight.d.ts +14 -0
- package/dist/esm/ComponentPicker/ComponentHighlight.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/ComponentHighlight.js +12 -0
- package/dist/esm/ComponentPicker/ComponentHighlight.js.map +1 -0
- package/dist/esm/ComponentPicker/ComponentPicker.d.ts +24 -0
- package/dist/esm/ComponentPicker/ComponentPicker.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/ComponentPicker.js +116 -0
- package/dist/esm/ComponentPicker/ComponentPicker.js.map +1 -0
- package/dist/esm/ComponentPicker/ComponentResolver.d.ts +6 -0
- package/dist/esm/ComponentPicker/ComponentResolver.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/ComponentResolver.js +4 -0
- package/dist/esm/ComponentPicker/ComponentResolver.js.map +1 -0
- package/dist/esm/ComponentPicker/HighlightFrame.d.ts +14 -0
- package/dist/esm/ComponentPicker/HighlightFrame.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/HighlightFrame.js +70 -0
- package/dist/esm/ComponentPicker/HighlightFrame.js.map +1 -0
- package/dist/esm/ComponentPicker/PickedAncestor.d.ts +10 -0
- package/dist/esm/ComponentPicker/PickedAncestor.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/PickedAncestor.js +4 -0
- package/dist/esm/ComponentPicker/PickedAncestor.js.map +1 -0
- package/dist/esm/ComponentPicker/PickedComponent.d.ts +23 -0
- package/dist/esm/ComponentPicker/PickedComponent.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/PickedComponent.js +4 -0
- package/dist/esm/ComponentPicker/PickedComponent.js.map +1 -0
- package/dist/esm/ComponentPicker/PickedPresentationProperty.d.ts +22 -0
- package/dist/esm/ComponentPicker/PickedPresentationProperty.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/PickedPresentationProperty.js +4 -0
- package/dist/esm/ComponentPicker/PickedPresentationProperty.js.map +1 -0
- package/dist/esm/ComponentPicker/PickedRect.d.ts +20 -0
- package/dist/esm/ComponentPicker/PickedRect.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/PickedRect.js +4 -0
- package/dist/esm/ComponentPicker/PickedRect.js.map +1 -0
- package/dist/esm/ComponentPicker/PresentationPropertyEditor.d.ts +25 -0
- package/dist/esm/ComponentPicker/PresentationPropertyEditor.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/PresentationPropertyEditor.js +51 -0
- package/dist/esm/ComponentPicker/PresentationPropertyEditor.js.map +1 -0
- package/dist/esm/ComponentPicker/componentElements.d.ts +14 -0
- package/dist/esm/ComponentPicker/componentElements.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/componentElements.js +18 -0
- package/dist/esm/ComponentPicker/componentElements.js.map +1 -0
- package/dist/esm/ComponentPicker/describeComponentElement.d.ts +11 -0
- package/dist/esm/ComponentPicker/describeComponentElement.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/describeComponentElement.js +63 -0
- package/dist/esm/ComponentPicker/describeComponentElement.js.map +1 -0
- package/dist/esm/ComponentPicker/index.d.ts +24 -0
- package/dist/esm/ComponentPicker/index.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/index.js +12 -0
- package/dist/esm/ComponentPicker/index.js.map +1 -0
- package/dist/esm/ComponentPicker/pickerStacking.d.ts +3 -0
- package/dist/esm/ComponentPicker/pickerStacking.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/pickerStacking.js +10 -0
- package/dist/esm/ComponentPicker/pickerStacking.js.map +1 -0
- package/dist/esm/ComponentPicker/proposedChanges.d.ts +11 -0
- package/dist/esm/ComponentPicker/proposedChanges.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/proposedChanges.js +6 -0
- package/dist/esm/ComponentPicker/proposedChanges.js.map +1 -0
- package/dist/esm/ComponentPicker/useComponentPicker.d.ts +30 -0
- package/dist/esm/ComponentPicker/useComponentPicker.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/useComponentPicker.js +31 -0
- package/dist/esm/ComponentPicker/useComponentPicker.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemEditor.d.ts.map +1 -1
- package/dist/esm/ConfigurationEditor/OrderedItemEditor.js +1 -1
- package/dist/esm/ConfigurationEditor/OrderedItemEditor.js.map +1 -1
- package/dist/esm/ConfigurationEditor/PropertyControls.d.ts.map +1 -1
- package/dist/esm/ConfigurationEditor/PropertyControls.js +1 -1
- package/dist/esm/ConfigurationEditor/PropertyControls.js.map +1 -1
- package/dist/esm/DataPage/DataPage.js +1 -1
- package/dist/esm/DataPage/DataPage.js.map +1 -1
- package/dist/esm/DataTables/DataTableCore.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableCore.js +1 -1
- package/dist/esm/DataTables/DataTableCore.js.map +1 -1
- package/dist/esm/DataTables/DataTableHeaderCell.d.ts +2 -2
- package/dist/esm/DataTables/DataTableHeaderCell.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableHeaderCell.js +7 -2
- package/dist/esm/DataTables/DataTableHeaderCell.js.map +1 -1
- package/dist/esm/DataTables/TablePaginatorImplementation.d.ts.map +1 -1
- package/dist/esm/DataTables/TablePaginatorImplementation.js +1 -1
- package/dist/esm/DataTables/TablePaginatorImplementation.js.map +1 -1
- package/dist/esm/DataTables/columnDescriptor.d.ts +4 -0
- package/dist/esm/DataTables/columnDescriptor.d.ts.map +1 -0
- package/dist/esm/DataTables/columnDescriptor.js +10 -0
- package/dist/esm/DataTables/columnDescriptor.js.map +1 -0
- package/dist/esm/Dialogs/Dialog.d.ts +18 -0
- package/dist/esm/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/esm/Dialogs/Dialog.js.map +1 -1
- package/dist/esm/Dialogs/DialogGlobalHeaderActions.d.ts +8 -0
- package/dist/esm/Dialogs/DialogGlobalHeaderActions.d.ts.map +1 -0
- package/dist/esm/Dialogs/DialogGlobalHeaderActions.js +6 -0
- package/dist/esm/Dialogs/DialogGlobalHeaderActions.js.map +1 -0
- package/dist/esm/Dialogs/DialogImplementation.d.ts +1 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.js +22 -6
- package/dist/esm/Dialogs/DialogImplementation.js.map +1 -1
- package/dist/esm/Dialogs/dialogDescriptor.d.ts +4 -0
- package/dist/esm/Dialogs/dialogDescriptor.d.ts.map +1 -0
- package/dist/esm/Dialogs/dialogDescriptor.js +12 -0
- package/dist/esm/Dialogs/dialogDescriptor.js.map +1 -0
- package/dist/esm/Dialogs/index.d.ts +3 -0
- package/dist/esm/Dialogs/index.d.ts.map +1 -1
- package/dist/esm/Display/Avatar.d.ts.map +1 -1
- package/dist/esm/Display/Avatar.js +1 -1
- package/dist/esm/Display/Avatar.js.map +1 -1
- package/dist/esm/Display/Badge.d.ts.map +1 -1
- package/dist/esm/Display/Badge.js +1 -1
- package/dist/esm/Display/Badge.js.map +1 -1
- package/dist/esm/Display/Chip.d.ts.map +1 -1
- package/dist/esm/Display/Chip.js +1 -1
- package/dist/esm/Display/Chip.js.map +1 -1
- package/dist/esm/Display/Message.d.ts.map +1 -1
- package/dist/esm/Display/Message.js +1 -1
- package/dist/esm/Display/Message.js.map +1 -1
- package/dist/esm/Display/ProgressBarImplementation.d.ts.map +1 -1
- package/dist/esm/Display/ProgressBarImplementation.js +1 -1
- package/dist/esm/Display/ProgressBarImplementation.js.map +1 -1
- package/dist/esm/Display/ProgressSpinner.d.ts.map +1 -1
- package/dist/esm/Display/ProgressSpinner.js +1 -1
- package/dist/esm/Display/ProgressSpinner.js.map +1 -1
- package/dist/esm/Display/Skeleton.d.ts.map +1 -1
- package/dist/esm/Display/Skeleton.js +1 -1
- package/dist/esm/Display/Skeleton.js.map +1 -1
- package/dist/esm/Display/Tag.d.ts.map +1 -1
- package/dist/esm/Display/Tag.js +1 -1
- package/dist/esm/Display/Tag.js.map +1 -1
- package/dist/esm/Dropdown/DropdownImplementation.js +4 -4
- package/dist/esm/Dropdown/DropdownImplementation.js.map +1 -1
- package/dist/esm/IconPicker/IconPicker.d.ts.map +1 -1
- package/dist/esm/IconPicker/IconPicker.js +1 -1
- package/dist/esm/IconPicker/IconPicker.js.map +1 -1
- package/dist/esm/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/esm/MarkdownEditor/MarkdownEditor.js +1 -1
- package/dist/esm/MarkdownEditor/MarkdownEditor.js.map +1 -1
- package/dist/esm/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/esm/Toolbar/Toolbar.js +1 -1
- package/dist/esm/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/configuration/DialogHeaderActionsRenderer.d.ts +8 -0
- package/dist/esm/configuration/DialogHeaderActionsRenderer.d.ts.map +1 -0
- package/dist/esm/configuration/DialogHeaderActionsRenderer.js +4 -0
- package/dist/esm/configuration/DialogHeaderActionsRenderer.js.map +1 -0
- package/dist/esm/configuration/DialogHeaderContext.d.ts +13 -0
- package/dist/esm/configuration/DialogHeaderContext.d.ts.map +1 -0
- package/dist/esm/configuration/DialogHeaderContext.js +4 -0
- package/dist/esm/configuration/DialogHeaderContext.js.map +1 -0
- package/dist/esm/configuration/DialogSliceLocation.d.ts +13 -0
- package/dist/esm/configuration/DialogSliceLocation.d.ts.map +1 -0
- package/dist/esm/configuration/DialogSliceLocation.js +4 -0
- package/dist/esm/configuration/DialogSliceLocation.js.map +1 -0
- package/dist/esm/configuration/identity/ComponentDescriptor.d.ts +12 -0
- package/dist/esm/configuration/identity/ComponentDescriptor.d.ts.map +1 -0
- package/dist/esm/configuration/identity/ComponentDescriptor.js +4 -0
- package/dist/esm/configuration/identity/ComponentDescriptor.js.map +1 -0
- package/dist/esm/configuration/identity/ComponentMarkerAttributes.d.ts +10 -0
- package/dist/esm/configuration/identity/ComponentMarkerAttributes.d.ts.map +1 -0
- package/dist/esm/configuration/identity/ComponentMarkerAttributes.js +4 -0
- package/dist/esm/configuration/identity/ComponentMarkerAttributes.js.map +1 -0
- package/dist/esm/configuration/identity/PresentationChange.d.ts +11 -0
- package/dist/esm/configuration/identity/PresentationChange.d.ts.map +1 -0
- package/dist/esm/configuration/identity/PresentationChange.js +4 -0
- package/dist/esm/configuration/identity/PresentationChange.js.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyDescriptor.d.ts +22 -0
- package/dist/esm/configuration/identity/PresentationPropertyDescriptor.d.ts.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyDescriptor.js +4 -0
- package/dist/esm/configuration/identity/PresentationPropertyDescriptor.js.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyType.d.ts +3 -0
- package/dist/esm/configuration/identity/PresentationPropertyType.d.ts.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyType.js +4 -0
- package/dist/esm/configuration/identity/PresentationPropertyType.js.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyValue.d.ts +3 -0
- package/dist/esm/configuration/identity/PresentationPropertyValue.d.ts.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyValue.js +4 -0
- package/dist/esm/configuration/identity/PresentationPropertyValue.js.map +1 -0
- package/dist/esm/configuration/identity/RegisteredComponent.d.ts +9 -0
- package/dist/esm/configuration/identity/RegisteredComponent.d.ts.map +1 -0
- package/dist/esm/configuration/identity/RegisteredComponent.js +4 -0
- package/dist/esm/configuration/identity/RegisteredComponent.js.map +1 -0
- package/dist/esm/configuration/identity/componentIdentityAttributes.d.ts +7 -0
- package/dist/esm/configuration/identity/componentIdentityAttributes.d.ts.map +1 -0
- package/dist/esm/configuration/identity/componentIdentityAttributes.js +6 -0
- package/dist/esm/configuration/identity/componentIdentityAttributes.js.map +1 -0
- package/dist/esm/configuration/identity/componentInstances.d.ts +30 -0
- package/dist/esm/configuration/identity/componentInstances.d.ts.map +1 -0
- package/dist/esm/configuration/identity/componentInstances.js +61 -0
- package/dist/esm/configuration/identity/componentInstances.js.map +1 -0
- package/dist/esm/configuration/identity/componentMarker.d.ts +9 -0
- package/dist/esm/configuration/identity/componentMarker.d.ts.map +1 -0
- package/dist/esm/configuration/identity/componentMarker.js +7 -0
- package/dist/esm/configuration/identity/componentMarker.js.map +1 -0
- package/dist/esm/configuration/identity/describeComponent.d.ts +11 -0
- package/dist/esm/configuration/identity/describeComponent.d.ts.map +1 -0
- package/dist/esm/configuration/identity/describeComponent.js +4 -0
- package/dist/esm/configuration/identity/describeComponent.js.map +1 -0
- package/dist/esm/configuration/identity/useComponentPresentation.d.ts +15 -0
- package/dist/esm/configuration/identity/useComponentPresentation.d.ts.map +1 -0
- package/dist/esm/configuration/identity/useComponentPresentation.js +18 -0
- package/dist/esm/configuration/identity/useComponentPresentation.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/renderer/dialogStack.d.ts +2 -0
- package/dist/esm/renderer/dialogStack.d.ts.map +1 -1
- package/dist/esm/renderer/dialogStack.js +2 -1
- package/dist/esm/renderer/dialogStack.js.map +1 -1
- package/dist/esm/types/parts.d.ts +25 -2
- package/dist/esm/types/parts.d.ts.map +1 -1
- package/dist/esm/types/parts.js +25 -2
- package/dist/esm/types/parts.js.map +1 -1
- package/package.json +6 -2
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.39.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.39.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.39.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.39.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.39.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.39.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.39.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.39.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.39.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.39.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.39.0",
|
|
266
266
|
"primereact": ">=10.9.9 <11",
|
|
267
267
|
"react": "^19.0.0",
|
|
268
268
|
"react-dom": "^19.0.0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatSidebar.d.ts","sourceRoot":"","sources":["../../../Chat/ChatSidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,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AC,EAAE,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAEtF;;;;;;OAMG;IACH,aAAa,EAAE,CACX,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,WAAW,EAAE,KACtB,IAAI,CAAC;IAEV;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAC;IAEvE;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAE5C,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAE5B,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAiBD;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,GACpB,QAAQ,SAAS,WAAW,GAAG,WAAW,EAC1C,MAAM,SAAS,SAAS,GAAG,SAAS,2QAuBrC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,+CAsRpC,CAAC"}
|
|
@@ -93,9 +93,9 @@ const ChatSidebar = ({ open, onClose, topics, messages, topicActions, renderHead
|
|
|
93
93
|
return modal ? (jsx(ModalOverlay, { ...pt?.backdrop, isOpen: open, onOpenChange: (openState) => {
|
|
94
94
|
if (!openState)
|
|
95
95
|
onClose();
|
|
96
|
-
}, isDismissable: modal, isKeyboardDismissDisabled: !modal, className: classNames('cratis-chat-sidebar__backdrop', pt?.backdrop?.className), "data-cratis-part": 'backdrop', "data-modal": modal, "data-open": open || undefined, "data-selected": openTopicId !== undefined || undefined, children: jsx(Modal, { ...pt?.root, className: classNames('cratis-chat-sidebar', pt?.root?.className, className), style: { width, ...pt?.root?.style }, "data-cratis-part": 'root', "data-position": position, "data-open": open || undefined, "data-selected": openTopicId !== undefined || undefined, children: panel }) })) : (nonModalPhase !== 'closed' &&
|
|
96
|
+
}, isDismissable: modal, isKeyboardDismissDisabled: !modal, className: classNames('cratis-chat-sidebar__backdrop', pt?.backdrop?.className), "data-cratis-part": 'backdrop', "data-modal": modal, "data-open": open || undefined, "data-selected": openTopicId !== undefined || undefined, children: jsx(Modal, { ...pt?.root, className: classNames('cratis-chat-sidebar', pt?.root?.className, className), style: { width, ...pt?.root?.style }, "data-cratis-part": 'root', "data-cratis-component": 'ChatSidebar', "data-position": position, "data-open": open || undefined, "data-selected": openTopicId !== undefined || undefined, children: panel }) })) : (nonModalPhase !== 'closed' &&
|
|
97
97
|
portalContainer &&
|
|
98
|
-
createPortal(jsx("div", { ...pt?.backdrop, className: classNames('cratis-chat-sidebar__backdrop', pt?.backdrop?.className), "data-cratis-part": 'backdrop', "data-modal": false, "data-open": open || undefined, "data-selected": openTopicId !== undefined || undefined, "data-entering": nonModalPhase === 'entering' || undefined, "data-exiting": nonModalPhase === 'exiting' || undefined, children: jsx("div", { ...pt?.root, ref: nonModalPanel, className: classNames('cratis-chat-sidebar', pt?.root?.className, className), style: { width, ...pt?.root?.style }, "data-cratis-part": 'root', "data-position": position, "data-open": open || undefined, "data-selected": openTopicId !== undefined || undefined, "data-entering": nonModalPhase === 'entering' || undefined, "data-exiting": nonModalPhase === 'exiting' || undefined, onAnimationEnd: (event) => {
|
|
98
|
+
createPortal(jsx("div", { ...pt?.backdrop, className: classNames('cratis-chat-sidebar__backdrop', pt?.backdrop?.className), "data-cratis-part": 'backdrop', "data-modal": false, "data-open": open || undefined, "data-selected": openTopicId !== undefined || undefined, "data-entering": nonModalPhase === 'entering' || undefined, "data-exiting": nonModalPhase === 'exiting' || undefined, children: jsx("div", { ...pt?.root, ref: nonModalPanel, className: classNames('cratis-chat-sidebar', pt?.root?.className, className), style: { width, ...pt?.root?.style }, "data-cratis-part": 'root', "data-cratis-component": 'ChatSidebar', "data-position": position, "data-open": open || undefined, "data-selected": openTopicId !== undefined || undefined, "data-entering": nonModalPhase === 'entering' || undefined, "data-exiting": nonModalPhase === 'exiting' || undefined, onAnimationEnd: (event) => {
|
|
99
99
|
pt?.root?.onAnimationEnd?.(event);
|
|
100
100
|
if (event.target !== event.currentTarget)
|
|
101
101
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatSidebar.js","sources":["../../../Chat/ChatSidebar.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 { useEffect, useRef, useState } from 'react';\nimport type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { Modal, ModalOverlay } from 'react-aria-components';\nimport type { ChatConversationLabels, ChatConversationProps } from './ChatConversation';\nimport { ChatConversation } from './ChatConversation';\nimport { sameChatIdentifier, type ChatIdentifier } from './ChatIdentifier';\nimport type { ChatMention } from './ChatMention';\nimport type { ChatMessage } from './ChatMessage';\nimport type { ChatTopic } from './ChatTopic';\nimport type { ChatTopicAction } from './ChatTopicAction';\nimport type { ChatStatus } from './ChatStatus';\nimport type { ChatTopicListLabels } from './ChatTopicList';\nimport { ChatTopicList } from './ChatTopicList';\nimport { isTopicUnnamed as defaultIsTopicUnnamed } from './isTopicUnnamed';\nimport { shouldRequestTopicName } from './shouldRequestTopicName';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport type { ExactPartKeys } from '../types/ExactPartKeys';\nimport type { PartsOf } from '../types/parts';\nimport { classNames } from '../ClassNames/classNames';\n\ntype ChatSidebarPartAttributes<TElement> = HTMLAttributes<TElement> & {\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\ntype ChatSidebarButtonAttributes = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'type'\n>;\n\n/** Stable Cratis-owned parts for styling a {@link ChatSidebar}. */\nexport interface ChatSidebarParts {\n /** Viewport overlay layer the sidebar portals into — only paints/blocks when {@link ChatSidebarProps.modal} is true. */\n backdrop?: ChatSidebarPartAttributes<HTMLDivElement>;\n /** The sidebar panel itself. */\n root?: ChatSidebarPartAttributes<HTMLDivElement>;\n /** Header containing the back affordance, title, and close button. */\n header?: ChatSidebarPartAttributes<HTMLElement>;\n /** The topic list title, or the open topic's name. */\n title?: ChatSidebarPartAttributes<HTMLHeadingElement>;\n /** Back-to-topics button, present only while a topic is open. */\n back?: ChatSidebarButtonAttributes;\n /** Close button. */\n close?: ChatSidebarButtonAttributes;\n /** The topic list / conversation content region. */\n content?: ChatSidebarPartAttributes<HTMLDivElement>;\n}\n\nconst chatSidebarPartsMatchManifest: ExactPartKeys<\n ChatSidebarParts,\n PartsOf<'ChatSidebar'>\n> = true;\nvoid chatSidebarPartsMatchManifest;\n\n/** Overrides for every label the {@link ChatSidebar} and its children render. Any field left\n * unset falls back to a literal English default. */\nexport interface ChatSidebarLabels {\n /** The sidebar's title while the topic list is showing. Defaults to `'Topics'`. */\n topics?: string;\n\n /** Placeholder title for a topic that has not been named yet. Defaults to `'New topic'`. */\n unnamedTopic?: string;\n\n /** Tooltip/accessible label for the back-to-topics button. Defaults to `'Back to topics'`. */\n back?: string;\n\n /** Accessible label for the close button. Defaults to `'Close chat'`. */\n close?: string;\n\n /** Labels forwarded to the {@link ChatTopicList}. */\n topicList?: ChatTopicListLabels;\n\n /** Labels forwarded to the {@link ChatConversation}. */\n conversation?: ChatConversationLabels;\n}\n\n/**\n * Props for {@link ChatSidebar}.\n * @typeParam TMessage The host's message type — anything extending {@link ChatMessage}.\n * @typeParam TTopic The host's topic type — anything extending {@link ChatTopic}.\n */\nexport interface ChatSidebarProps<\n TMessage extends ChatMessage = ChatMessage,\n TTopic extends ChatTopic = ChatTopic,\n> extends Omit<\n ChatConversationProps<TMessage>,\n 'messages' | 'onSendMessage' | 'labels' | 'className' | 'status'\n> {\n /**\n * Renders host content in the header, between the title and the close button, for example a\n * rename control for the open topic. Nothing is rendered when it returns null or undefined.\n * @param openTopic The open topic, or undefined while the topic list is shown.\n * @returns What to render in the header.\n */\n renderHeaderActions?: (openTopic: TTopic | undefined) => ReactNode;\n\n /** Whether the sidebar is open. */\n open: boolean;\n\n /** Invoked when the sidebar asks to close — the host owns {@link open}, so closing means the host flips it. */\n onClose: () => void;\n\n /**\n * The topics, in any order. Hand this the array a live (observable) query delivers and the\n * sidebar re-renders as it changes.\n */\n topics: TTopic[];\n\n /**\n * The messages — either the whole chat or just the open topic's; the sidebar shows those of\n * the open topic by matching on `topicId` either way. Hand this the array a live\n * (observable) query delivers and the conversation re-renders as it changes.\n */\n messages: TMessage[];\n\n /** The host's actions to offer on each topic where they are available. The inherited `actions` prop applies only to messages. */\n topicActions?: ChatTopicAction<TTopic>[];\n\n /** Topic-list query display state. Defaults to ready when omitted. */\n topicsStatus?: ChatStatus;\n\n /** Conversation query display state. Defaults to ready when omitted. */\n messagesStatus?: ChatStatus;\n\n /**\n * The open topic, for hosts that own the selection themselves: an identifier opens that\n * topic's conversation, `null` shows the topic list, and leaving the prop unset lets the\n * sidebar keep the selection internally.\n */\n selectedTopicId?: ChatIdentifier | null;\n\n /**\n * Invoked when the open topic changes — a topic was opened (or just started), or the person\n * went back to the list.\n * @param topicId The identifier of the topic now open, or undefined for the list.\n * @param topic The topic itself, when it is known in {@link topics}.\n */\n onTopicSelected?: (topicId: ChatIdentifier | undefined, topic?: TTopic) => void;\n\n /**\n * Invoked when a new topic is asked for. Creating the topic is the host's business; answer\n * with its identifier (directly or through a promise) and the sidebar opens it, ready for\n * the first message. Omit to leave the new-topic affordance off.\n * @returns The identifier of the topic that was started, when the host created one.\n */\n onStartTopic?: () => ChatIdentifier | undefined | Promise<ChatIdentifier | undefined>;\n\n /**\n * Invoked when a message is sent, with the topic it belongs to, the trimmed body and who it\n * mentions. Everything else about persisting the message is the host's business.\n * @param topicId The identifier of the topic the message was sent in.\n * @param body The message text, mentions written into it as plain `@Name`.\n * @param mentions Who the body mentions.\n */\n onSendMessage: (\n topicId: ChatIdentifier,\n body: string,\n mentions: ChatMention[],\n ) => void;\n\n /**\n * Invoked when the very first message is sent in a topic that has no name yet — the host\n * asks its LLM (or whatever it prefers) for a good name and supplies it through the topic\n * data; until then the topic renders its pending placeholder. Not invoked again for later\n * messages, and never for a topic that already has a name.\n * @param topic The topic that needs a name.\n * @param firstMessageBody The message to derive the name from.\n */\n onRequestTopicName?: (topic: TTopic, firstMessageBody: string) => void;\n\n /**\n * Decides whether a topic counts as unnamed — see {@link ChatTopicListProps.isTopicUnnamed}.\n * @param topic The topic to check.\n * @returns True when the topic has no usable name yet.\n */\n isTopicUnnamed?: (topic: TTopic) => boolean;\n\n /** Which edge the sidebar opens from. Defaults to `'right'`. */\n position?: 'left' | 'right';\n\n /** The sidebar's width, any CSS length. Defaults to `'24rem'`. */\n width?: string;\n\n /**\n * Whether the sidebar is modal — a backdrop behind it, and dismissing by Escape or clicking\n * outside. Defaults to false: a chat lives *next to* the work, so it should not block it —\n * the background stays visible and interactive, and only the close/back affordances dismiss it.\n */\n modal?: boolean;\n\n /** Overrides for every label rendered. Unset fields fall back to literal English defaults. */\n labels?: ChatSidebarLabels;\n\n /** Additional class name for the sidebar's panel element. */\n className?: string;\n\n /** Cratis-owned per-part attributes. */\n pt?: ChatSidebarParts;\n}\n\nconst BackIcon = () => (\n <svg\n width='14'\n height='14'\n viewBox='0 0 24 24'\n fill='none'\n stroke='currentColor'\n strokeWidth='2.5'\n aria-hidden='true'\n >\n <line x1='19' y1='12' x2='5' y2='12' />\n <polyline points='12 19 5 12 12 5' />\n </svg>\n);\n\n/**\n * A topic-based chat in a sidebar next to the view, built on Components' own overlay primitives\n * (React Aria internally, for accessible dismissal and focus handling). It opens on the topic\n * list; picking a topic (or starting a new one) slides into that conversation, with a back\n * affordance to the list. Everything about *data* is the host's: topics and messages come in as\n * arrays (hand it live query data and it stays current), sends and new topics go out as\n * callbacks, and when the first message lands in an unnamed topic the sidebar asks the host for\n * a name through {@link ChatSidebarProps.onRequestTopicName | onRequestTopicName} — rendering a\n * pending placeholder until the name arrives.\n */\nexport const ChatSidebar = <\n TMessage extends ChatMessage = ChatMessage,\n TTopic extends ChatTopic = ChatTopic,\n>({\n open,\n onClose,\n topics,\n messages,\n topicActions,\n renderHeaderActions,\n topicsStatus,\n messagesStatus,\n selectedTopicId,\n onTopicSelected,\n onStartTopic,\n onSendMessage,\n onRequestTopicName,\n isTopicUnnamed,\n position = 'right',\n width = '24rem',\n modal = false,\n labels,\n className,\n pt,\n ...conversation\n}: ChatSidebarProps<TMessage, TTopic>) => {\n const icon = useCratisIcon();\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const [mounted, setMounted] = useState(false);\n const nonModalPanel = useRef<HTMLDivElement>(null);\n const [nonModalPhase, setNonModalPhase] = useState<\n 'closed' | 'entering' | 'open' | 'exiting'\n >('closed');\n\n useEffect(() => setMounted(true), []);\n useEffect(() => {\n setNonModalPhase((phase) =>\n open ? 'entering' : phase === 'closed' ? 'closed' : 'exiting',\n );\n }, [open]);\n const portalContainer = !modal && mounted && nonModalPhase !== 'closed'\n ? overlayEnvironment.getContainer()\n : null;\n useEffect(() => {\n if (nonModalPhase !== 'entering' && nonModalPhase !== 'exiting') return;\n if (!modal && (\n window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ||\n nonModalPanel.current?.getAnimations?.().length === 0\n )) {\n setNonModalPhase(nonModalPhase === 'entering' ? 'open' : 'closed');\n return;\n }\n const timeout = setTimeout(() => {\n setNonModalPhase(nonModalPhase === 'entering' ? 'open' : 'closed');\n }, 250);\n return () => clearTimeout(timeout);\n }, [modal, nonModalPhase, portalContainer]);\n\n const [internalSelectedId, setInternalSelectedId] = useState<\n ChatIdentifier | undefined\n >();\n const isControlled = selectedTopicId !== undefined;\n const openTopicId = isControlled\n ? (selectedTopicId ?? undefined)\n : internalSelectedId;\n const openTopic =\n openTopicId === undefined\n ? undefined\n : topics.find((topic) => sameChatIdentifier(topic.id, openTopicId));\n const unnamed = isTopicUnnamed ?? defaultIsTopicUnnamed;\n\n const select = (topicId: ChatIdentifier | undefined, topic?: TTopic) => {\n if (!isControlled) {\n setInternalSelectedId(topicId);\n }\n onTopicSelected?.(\n topicId,\n topic ??\n (topicId === undefined\n ? undefined\n : topics.find((candidate) =>\n sameChatIdentifier(candidate.id, topicId),\n )),\n );\n };\n\n const startTopic = async () => {\n const topicId = await onStartTopic?.();\n if (topicId !== undefined) {\n select(topicId);\n }\n };\n\n const openMessages =\n openTopicId === undefined\n ? []\n : messages.filter((message) =>\n sameChatIdentifier(message.topicId, openTopicId),\n );\n\n const send = (body: string, mentions: ChatMention[]) => {\n if (openTopicId === undefined) return;\n onSendMessage(openTopicId, body, mentions);\n if (\n openTopic &&\n shouldRequestTopicName(unnamed(openTopic), openMessages.length)\n ) {\n onRequestTopicName?.(openTopic, body);\n }\n };\n\n const title =\n openTopicId === undefined\n ? (labels?.topics ?? 'Topics')\n : openTopic && !unnamed(openTopic)\n ? openTopic.name\n : (labels?.unnamedTopic ?? 'New topic');\n const titleIsPending =\n openTopicId !== undefined && (!openTopic || unnamed(openTopic));\n\n const panel = (\n <>\n <header\n {...pt?.header}\n className={classNames(\n 'cratis-chat-sidebar__header',\n pt?.header?.className,\n )}\n data-cratis-part='header'\n >\n {openTopicId !== undefined && (\n <button\n {...pt?.back}\n type='button'\n className={classNames(\n 'cratis-chat-sidebar__back',\n pt?.back?.className,\n )}\n data-cratis-part='back'\n title={labels?.back ?? 'Back to topics'}\n aria-label={labels?.back ?? 'Back to topics'}\n onClick={() => select(undefined)}\n >\n <BackIcon />\n </button>\n )}\n <h2\n {...pt?.title}\n className={classNames(\n 'cratis-chat-sidebar__title',\n titleIsPending\n ? 'cratis-chat-sidebar__title--pending'\n : undefined,\n pt?.title?.className,\n )}\n data-cratis-part='title'\n >\n {title}\n </h2>\n {renderHeaderActions?.(openTopic)}\n <button\n {...pt?.close}\n type='button'\n className={classNames(\n 'cratis-chat-sidebar__close',\n pt?.close?.className,\n )}\n data-cratis-part='close'\n aria-label={labels?.close ?? 'Close chat'}\n onClick={onClose}\n >\n <span aria-hidden='true'>{icon('close', '×')}</span>\n </button>\n </header>\n <div\n {...pt?.content}\n className={classNames(\n 'cratis-chat-sidebar__content',\n pt?.content?.className,\n )}\n data-cratis-part='content'\n >\n {openTopicId === undefined ? (\n <ChatTopicList<TTopic>\n topics={topics}\n topicActions={topicActions}\n status={topicsStatus}\n onOpen={(topic) => select(topic.id, topic)}\n onStart={\n onStartTopic\n ? () => {\n void startTopic();\n }\n : undefined\n }\n authorOf={conversation.authorOf}\n renderAvatar={conversation.renderAvatar}\n isTopicUnnamed={isTopicUnnamed}\n buildAvatarUrl={conversation.buildAvatarUrl}\n labels={{\n unnamedTopic: labels?.unnamedTopic,\n ...labels?.topicList,\n }}\n />\n ) : (\n <ChatConversation<TMessage>\n {...conversation}\n messages={openMessages}\n status={messagesStatus}\n onSendMessage={send}\n labels={labels?.conversation}\n />\n )}\n </div>\n </>\n );\n\n return modal ? (\n <ModalOverlay\n {...pt?.backdrop}\n isOpen={open}\n onOpenChange={(openState) => {\n if (!openState) onClose();\n }}\n isDismissable={modal}\n isKeyboardDismissDisabled={!modal}\n className={classNames(\n 'cratis-chat-sidebar__backdrop',\n pt?.backdrop?.className,\n )}\n data-cratis-part='backdrop'\n data-modal={modal}\n data-open={open || undefined}\n data-selected={openTopicId !== undefined || undefined}\n >\n <Modal\n {...pt?.root}\n className={classNames(\n 'cratis-chat-sidebar',\n pt?.root?.className,\n className,\n )}\n style={{ width, ...pt?.root?.style }}\n data-cratis-part='root'\n data-position={position}\n data-open={open || undefined}\n data-selected={openTopicId !== undefined || undefined}\n >\n {panel}\n </Modal>\n </ModalOverlay>\n ) : (\n // Non-modal: a chat lives *next to* the work, so the background must stay visible and\n // interactive. React Aria's Modal blocks its backdrop by design (its dismissal props only\n // gate how it closes, never whether it intercepts), so the default is a plain portaled\n // layer with no dismissal behavior at all — only the close/back affordances dismiss it.\n nonModalPhase !== 'closed' &&\n portalContainer &&\n createPortal(\n <div\n {...pt?.backdrop}\n className={classNames(\n 'cratis-chat-sidebar__backdrop',\n pt?.backdrop?.className,\n )}\n data-cratis-part='backdrop'\n data-modal={false}\n data-open={open || undefined}\n data-selected={openTopicId !== undefined || undefined}\n data-entering={nonModalPhase === 'entering' || undefined}\n data-exiting={nonModalPhase === 'exiting' || undefined}\n >\n <div\n {...pt?.root}\n ref={nonModalPanel}\n className={classNames(\n 'cratis-chat-sidebar',\n pt?.root?.className,\n className,\n )}\n style={{ width, ...pt?.root?.style }}\n data-cratis-part='root'\n data-position={position}\n data-open={open || undefined}\n data-selected={openTopicId !== undefined || undefined}\n data-entering={nonModalPhase === 'entering' || undefined}\n data-exiting={nonModalPhase === 'exiting' || undefined}\n onAnimationEnd={(event) => {\n pt?.root?.onAnimationEnd?.(event);\n if (event.target !== event.currentTarget) return;\n setNonModalPhase((phase) =>\n phase === 'entering' ? 'open' : phase === 'exiting' ? 'closed' : phase,\n );\n }}\n >\n {panel}\n </div>\n </div>,\n portalContainer,\n )\n );\n};\n"],"names":["_jsxs","_jsx","isTopicUnnamed","defaultIsTopicUnnamed","_Fragment"],"mappings":";;;;;;;;;;;;;AA4MA,MAAM,QAAQ,GAAG,OACbA,IAAA,CAAA,KAAA,EAAA,EACI,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EAAA,aAAA,EACL,MAAM,EAAA,QAAA,EAAA,CAElBC,GAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,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,SAAS,EAAA,cAAA,EAC1C,aAAa,KAAK,SAAS,IAAI,SAAS,EACtD,cAAc,EAAE,CAAC,KAAK,KAAI;oBACtB,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,KAAK,CAAC;AACjC,oBAAA,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,aAAa;wBAAE;AAC1C,oBAAA,gBAAgB,CAAC,CAAC,KAAK,KACnB,KAAK,KAAK,UAAU,GAAG,MAAM,GAAG,KAAK,KAAK,SAAS,GAAG,QAAQ,GAAG,KAAK,CACzE;gBACL,CAAC,EAAA,QAAA,EAEA,KAAK,EAAA,CACJ,EAAA,CACJ,EACN,eAAe,CAClB,CACJ;AACL;;"}
|
|
1
|
+
{"version":3,"file":"ChatSidebar.js","sources":["../../../Chat/ChatSidebar.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 { useEffect, useRef, useState } from 'react';\nimport type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { Modal, ModalOverlay } from 'react-aria-components';\nimport type { ChatConversationLabels, ChatConversationProps } from './ChatConversation';\nimport { ChatConversation } from './ChatConversation';\nimport { sameChatIdentifier, type ChatIdentifier } from './ChatIdentifier';\nimport type { ChatMention } from './ChatMention';\nimport type { ChatMessage } from './ChatMessage';\nimport type { ChatTopic } from './ChatTopic';\nimport type { ChatTopicAction } from './ChatTopicAction';\nimport type { ChatStatus } from './ChatStatus';\nimport type { ChatTopicListLabels } from './ChatTopicList';\nimport { ChatTopicList } from './ChatTopicList';\nimport { isTopicUnnamed as defaultIsTopicUnnamed } from './isTopicUnnamed';\nimport { shouldRequestTopicName } from './shouldRequestTopicName';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport type { ExactPartKeys } from '../types/ExactPartKeys';\nimport type { PartsOf } from '../types/parts';\nimport { classNames } from '../ClassNames/classNames';\n\ntype ChatSidebarPartAttributes<TElement> = HTMLAttributes<TElement> & {\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\ntype ChatSidebarButtonAttributes = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'type'\n>;\n\n/** Stable Cratis-owned parts for styling a {@link ChatSidebar}. */\nexport interface ChatSidebarParts {\n /** Viewport overlay layer the sidebar portals into — only paints/blocks when {@link ChatSidebarProps.modal} is true. */\n backdrop?: ChatSidebarPartAttributes<HTMLDivElement>;\n /** The sidebar panel itself. */\n root?: ChatSidebarPartAttributes<HTMLDivElement>;\n /** Header containing the back affordance, title, and close button. */\n header?: ChatSidebarPartAttributes<HTMLElement>;\n /** The topic list title, or the open topic's name. */\n title?: ChatSidebarPartAttributes<HTMLHeadingElement>;\n /** Back-to-topics button, present only while a topic is open. */\n back?: ChatSidebarButtonAttributes;\n /** Close button. */\n close?: ChatSidebarButtonAttributes;\n /** The topic list / conversation content region. */\n content?: ChatSidebarPartAttributes<HTMLDivElement>;\n}\n\nconst chatSidebarPartsMatchManifest: ExactPartKeys<\n ChatSidebarParts,\n PartsOf<'ChatSidebar'>\n> = true;\nvoid chatSidebarPartsMatchManifest;\n\n/** Overrides for every label the {@link ChatSidebar} and its children render. Any field left\n * unset falls back to a literal English default. */\nexport interface ChatSidebarLabels {\n /** The sidebar's title while the topic list is showing. Defaults to `'Topics'`. */\n topics?: string;\n\n /** Placeholder title for a topic that has not been named yet. Defaults to `'New topic'`. */\n unnamedTopic?: string;\n\n /** Tooltip/accessible label for the back-to-topics button. Defaults to `'Back to topics'`. */\n back?: string;\n\n /** Accessible label for the close button. Defaults to `'Close chat'`. */\n close?: string;\n\n /** Labels forwarded to the {@link ChatTopicList}. */\n topicList?: ChatTopicListLabels;\n\n /** Labels forwarded to the {@link ChatConversation}. */\n conversation?: ChatConversationLabels;\n}\n\n/**\n * Props for {@link ChatSidebar}.\n * @typeParam TMessage The host's message type — anything extending {@link ChatMessage}.\n * @typeParam TTopic The host's topic type — anything extending {@link ChatTopic}.\n */\nexport interface ChatSidebarProps<\n TMessage extends ChatMessage = ChatMessage,\n TTopic extends ChatTopic = ChatTopic,\n> extends Omit<\n ChatConversationProps<TMessage>,\n 'messages' | 'onSendMessage' | 'labels' | 'className' | 'status'\n> {\n /**\n * Renders host content in the header, between the title and the close button, for example a\n * rename control for the open topic. Nothing is rendered when it returns null or undefined.\n * @param openTopic The open topic, or undefined while the topic list is shown.\n * @returns What to render in the header.\n */\n renderHeaderActions?: (openTopic: TTopic | undefined) => ReactNode;\n\n /** Whether the sidebar is open. */\n open: boolean;\n\n /** Invoked when the sidebar asks to close — the host owns {@link open}, so closing means the host flips it. */\n onClose: () => void;\n\n /**\n * The topics, in any order. Hand this the array a live (observable) query delivers and the\n * sidebar re-renders as it changes.\n */\n topics: TTopic[];\n\n /**\n * The messages — either the whole chat or just the open topic's; the sidebar shows those of\n * the open topic by matching on `topicId` either way. Hand this the array a live\n * (observable) query delivers and the conversation re-renders as it changes.\n */\n messages: TMessage[];\n\n /** The host's actions to offer on each topic where they are available. The inherited `actions` prop applies only to messages. */\n topicActions?: ChatTopicAction<TTopic>[];\n\n /** Topic-list query display state. Defaults to ready when omitted. */\n topicsStatus?: ChatStatus;\n\n /** Conversation query display state. Defaults to ready when omitted. */\n messagesStatus?: ChatStatus;\n\n /**\n * The open topic, for hosts that own the selection themselves: an identifier opens that\n * topic's conversation, `null` shows the topic list, and leaving the prop unset lets the\n * sidebar keep the selection internally.\n */\n selectedTopicId?: ChatIdentifier | null;\n\n /**\n * Invoked when the open topic changes — a topic was opened (or just started), or the person\n * went back to the list.\n * @param topicId The identifier of the topic now open, or undefined for the list.\n * @param topic The topic itself, when it is known in {@link topics}.\n */\n onTopicSelected?: (topicId: ChatIdentifier | undefined, topic?: TTopic) => void;\n\n /**\n * Invoked when a new topic is asked for. Creating the topic is the host's business; answer\n * with its identifier (directly or through a promise) and the sidebar opens it, ready for\n * the first message. Omit to leave the new-topic affordance off.\n * @returns The identifier of the topic that was started, when the host created one.\n */\n onStartTopic?: () => ChatIdentifier | undefined | Promise<ChatIdentifier | undefined>;\n\n /**\n * Invoked when a message is sent, with the topic it belongs to, the trimmed body and who it\n * mentions. Everything else about persisting the message is the host's business.\n * @param topicId The identifier of the topic the message was sent in.\n * @param body The message text, mentions written into it as plain `@Name`.\n * @param mentions Who the body mentions.\n */\n onSendMessage: (\n topicId: ChatIdentifier,\n body: string,\n mentions: ChatMention[],\n ) => void;\n\n /**\n * Invoked when the very first message is sent in a topic that has no name yet — the host\n * asks its LLM (or whatever it prefers) for a good name and supplies it through the topic\n * data; until then the topic renders its pending placeholder. Not invoked again for later\n * messages, and never for a topic that already has a name.\n * @param topic The topic that needs a name.\n * @param firstMessageBody The message to derive the name from.\n */\n onRequestTopicName?: (topic: TTopic, firstMessageBody: string) => void;\n\n /**\n * Decides whether a topic counts as unnamed — see {@link ChatTopicListProps.isTopicUnnamed}.\n * @param topic The topic to check.\n * @returns True when the topic has no usable name yet.\n */\n isTopicUnnamed?: (topic: TTopic) => boolean;\n\n /** Which edge the sidebar opens from. Defaults to `'right'`. */\n position?: 'left' | 'right';\n\n /** The sidebar's width, any CSS length. Defaults to `'24rem'`. */\n width?: string;\n\n /**\n * Whether the sidebar is modal — a backdrop behind it, and dismissing by Escape or clicking\n * outside. Defaults to false: a chat lives *next to* the work, so it should not block it —\n * the background stays visible and interactive, and only the close/back affordances dismiss it.\n */\n modal?: boolean;\n\n /** Overrides for every label rendered. Unset fields fall back to literal English defaults. */\n labels?: ChatSidebarLabels;\n\n /** Additional class name for the sidebar's panel element. */\n className?: string;\n\n /** Cratis-owned per-part attributes. */\n pt?: ChatSidebarParts;\n}\n\nconst BackIcon = () => (\n <svg\n width='14'\n height='14'\n viewBox='0 0 24 24'\n fill='none'\n stroke='currentColor'\n strokeWidth='2.5'\n aria-hidden='true'\n >\n <line x1='19' y1='12' x2='5' y2='12' />\n <polyline points='12 19 5 12 12 5' />\n </svg>\n);\n\n/**\n * A topic-based chat in a sidebar next to the view, built on Components' own overlay primitives\n * (React Aria internally, for accessible dismissal and focus handling). It opens on the topic\n * list; picking a topic (or starting a new one) slides into that conversation, with a back\n * affordance to the list. Everything about *data* is the host's: topics and messages come in as\n * arrays (hand it live query data and it stays current), sends and new topics go out as\n * callbacks, and when the first message lands in an unnamed topic the sidebar asks the host for\n * a name through {@link ChatSidebarProps.onRequestTopicName | onRequestTopicName} — rendering a\n * pending placeholder until the name arrives.\n */\nexport const ChatSidebar = <\n TMessage extends ChatMessage = ChatMessage,\n TTopic extends ChatTopic = ChatTopic,\n>({\n open,\n onClose,\n topics,\n messages,\n topicActions,\n renderHeaderActions,\n topicsStatus,\n messagesStatus,\n selectedTopicId,\n onTopicSelected,\n onStartTopic,\n onSendMessage,\n onRequestTopicName,\n isTopicUnnamed,\n position = 'right',\n width = '24rem',\n modal = false,\n labels,\n className,\n pt,\n ...conversation\n}: ChatSidebarProps<TMessage, TTopic>) => {\n const icon = useCratisIcon();\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const [mounted, setMounted] = useState(false);\n const nonModalPanel = useRef<HTMLDivElement>(null);\n const [nonModalPhase, setNonModalPhase] = useState<\n 'closed' | 'entering' | 'open' | 'exiting'\n >('closed');\n\n useEffect(() => setMounted(true), []);\n useEffect(() => {\n setNonModalPhase((phase) =>\n open ? 'entering' : phase === 'closed' ? 'closed' : 'exiting',\n );\n }, [open]);\n const portalContainer = !modal && mounted && nonModalPhase !== 'closed'\n ? overlayEnvironment.getContainer()\n : null;\n useEffect(() => {\n if (nonModalPhase !== 'entering' && nonModalPhase !== 'exiting') return;\n if (!modal && (\n window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ||\n nonModalPanel.current?.getAnimations?.().length === 0\n )) {\n setNonModalPhase(nonModalPhase === 'entering' ? 'open' : 'closed');\n return;\n }\n const timeout = setTimeout(() => {\n setNonModalPhase(nonModalPhase === 'entering' ? 'open' : 'closed');\n }, 250);\n return () => clearTimeout(timeout);\n }, [modal, nonModalPhase, portalContainer]);\n\n const [internalSelectedId, setInternalSelectedId] = useState<\n ChatIdentifier | undefined\n >();\n const isControlled = selectedTopicId !== undefined;\n const openTopicId = isControlled\n ? (selectedTopicId ?? undefined)\n : internalSelectedId;\n const openTopic =\n openTopicId === undefined\n ? undefined\n : topics.find((topic) => sameChatIdentifier(topic.id, openTopicId));\n const unnamed = isTopicUnnamed ?? defaultIsTopicUnnamed;\n\n const select = (topicId: ChatIdentifier | undefined, topic?: TTopic) => {\n if (!isControlled) {\n setInternalSelectedId(topicId);\n }\n onTopicSelected?.(\n topicId,\n topic ??\n (topicId === undefined\n ? undefined\n : topics.find((candidate) =>\n sameChatIdentifier(candidate.id, topicId),\n )),\n );\n };\n\n const startTopic = async () => {\n const topicId = await onStartTopic?.();\n if (topicId !== undefined) {\n select(topicId);\n }\n };\n\n const openMessages =\n openTopicId === undefined\n ? []\n : messages.filter((message) =>\n sameChatIdentifier(message.topicId, openTopicId),\n );\n\n const send = (body: string, mentions: ChatMention[]) => {\n if (openTopicId === undefined) return;\n onSendMessage(openTopicId, body, mentions);\n if (\n openTopic &&\n shouldRequestTopicName(unnamed(openTopic), openMessages.length)\n ) {\n onRequestTopicName?.(openTopic, body);\n }\n };\n\n const title =\n openTopicId === undefined\n ? (labels?.topics ?? 'Topics')\n : openTopic && !unnamed(openTopic)\n ? openTopic.name\n : (labels?.unnamedTopic ?? 'New topic');\n const titleIsPending =\n openTopicId !== undefined && (!openTopic || unnamed(openTopic));\n\n const panel = (\n <>\n <header\n {...pt?.header}\n className={classNames(\n 'cratis-chat-sidebar__header',\n pt?.header?.className,\n )}\n data-cratis-part='header'\n >\n {openTopicId !== undefined && (\n <button\n {...pt?.back}\n type='button'\n className={classNames(\n 'cratis-chat-sidebar__back',\n pt?.back?.className,\n )}\n data-cratis-part='back'\n title={labels?.back ?? 'Back to topics'}\n aria-label={labels?.back ?? 'Back to topics'}\n onClick={() => select(undefined)}\n >\n <BackIcon />\n </button>\n )}\n <h2\n {...pt?.title}\n className={classNames(\n 'cratis-chat-sidebar__title',\n titleIsPending\n ? 'cratis-chat-sidebar__title--pending'\n : undefined,\n pt?.title?.className,\n )}\n data-cratis-part='title'\n >\n {title}\n </h2>\n {renderHeaderActions?.(openTopic)}\n <button\n {...pt?.close}\n type='button'\n className={classNames(\n 'cratis-chat-sidebar__close',\n pt?.close?.className,\n )}\n data-cratis-part='close'\n aria-label={labels?.close ?? 'Close chat'}\n onClick={onClose}\n >\n <span aria-hidden='true'>{icon('close', '×')}</span>\n </button>\n </header>\n <div\n {...pt?.content}\n className={classNames(\n 'cratis-chat-sidebar__content',\n pt?.content?.className,\n )}\n data-cratis-part='content'\n >\n {openTopicId === undefined ? (\n <ChatTopicList<TTopic>\n topics={topics}\n topicActions={topicActions}\n status={topicsStatus}\n onOpen={(topic) => select(topic.id, topic)}\n onStart={\n onStartTopic\n ? () => {\n void startTopic();\n }\n : undefined\n }\n authorOf={conversation.authorOf}\n renderAvatar={conversation.renderAvatar}\n isTopicUnnamed={isTopicUnnamed}\n buildAvatarUrl={conversation.buildAvatarUrl}\n labels={{\n unnamedTopic: labels?.unnamedTopic,\n ...labels?.topicList,\n }}\n />\n ) : (\n <ChatConversation<TMessage>\n {...conversation}\n messages={openMessages}\n status={messagesStatus}\n onSendMessage={send}\n labels={labels?.conversation}\n />\n )}\n </div>\n </>\n );\n\n return modal ? (\n <ModalOverlay\n {...pt?.backdrop}\n isOpen={open}\n onOpenChange={(openState) => {\n if (!openState) onClose();\n }}\n isDismissable={modal}\n isKeyboardDismissDisabled={!modal}\n className={classNames(\n 'cratis-chat-sidebar__backdrop',\n pt?.backdrop?.className,\n )}\n data-cratis-part='backdrop'\n data-modal={modal}\n data-open={open || undefined}\n data-selected={openTopicId !== undefined || undefined}\n >\n <Modal\n {...pt?.root}\n className={classNames(\n 'cratis-chat-sidebar',\n pt?.root?.className,\n className,\n )}\n style={{ width, ...pt?.root?.style }}\n data-cratis-part='root'\n data-cratis-component='ChatSidebar'\n data-position={position}\n data-open={open || undefined}\n data-selected={openTopicId !== undefined || undefined}\n >\n {panel}\n </Modal>\n </ModalOverlay>\n ) : (\n // Non-modal: a chat lives *next to* the work, so the background must stay visible and\n // interactive. React Aria's Modal blocks its backdrop by design (its dismissal props only\n // gate how it closes, never whether it intercepts), so the default is a plain portaled\n // layer with no dismissal behavior at all — only the close/back affordances dismiss it.\n nonModalPhase !== 'closed' &&\n portalContainer &&\n createPortal(\n <div\n {...pt?.backdrop}\n className={classNames(\n 'cratis-chat-sidebar__backdrop',\n pt?.backdrop?.className,\n )}\n data-cratis-part='backdrop'\n data-modal={false}\n data-open={open || undefined}\n data-selected={openTopicId !== undefined || undefined}\n data-entering={nonModalPhase === 'entering' || undefined}\n data-exiting={nonModalPhase === 'exiting' || undefined}\n >\n <div\n {...pt?.root}\n ref={nonModalPanel}\n className={classNames(\n 'cratis-chat-sidebar',\n pt?.root?.className,\n className,\n )}\n style={{ width, ...pt?.root?.style }}\n data-cratis-part='root'\n data-cratis-component='ChatSidebar'\n data-position={position}\n data-open={open || undefined}\n data-selected={openTopicId !== undefined || undefined}\n data-entering={nonModalPhase === 'entering' || undefined}\n data-exiting={nonModalPhase === 'exiting' || undefined}\n onAnimationEnd={(event) => {\n pt?.root?.onAnimationEnd?.(event);\n if (event.target !== event.currentTarget) return;\n setNonModalPhase((phase) =>\n phase === 'entering' ? 'open' : phase === 'exiting' ? 'closed' : phase,\n );\n }}\n >\n {panel}\n </div>\n </div>,\n portalContainer,\n )\n );\n};\n"],"names":["_jsxs","_jsx","isTopicUnnamed","defaultIsTopicUnnamed","_Fragment"],"mappings":";;;;;;;;;;;;;AA4MA,MAAM,QAAQ,GAAG,OACbA,IAAA,CAAA,KAAA,EAAA,EACI,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,K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EAAA,uBAAA,EACD,aAAa,EAAA,eAAA,EACpB,QAAQ,eACZ,IAAI,IAAI,SAAS,EAAA,eAAA,EACb,WAAW,KAAK,SAAS,IAAI,SAAS,EAAA,eAAA,EACtC,aAAa,KAAK,UAAU,IAAI,SAAS,EAAA,cAAA,EAC1C,aAAa,KAAK,SAAS,IAAI,SAAS,EACtD,cAAc,EAAE,CAAC,KAAK,KAAI;oBACtB,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,KAAK,CAAC;AACjC,oBAAA,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,aAAa;wBAAE;AAC1C,oBAAA,gBAAgB,CAAC,CAAC,KAAK,KACnB,KAAK,KAAK,UAAU,GAAG,MAAM,GAAG,KAAK,KAAK,SAAS,GAAG,QAAQ,GAAG,KAAK,CACzE;gBACL,CAAC,EAAA,QAAA,EAEA,KAAK,EAAA,CACJ,EAAA,CACJ,EACN,eAAe,CAClB,CACJ;AACL;;"}
|
|
@@ -13,7 +13,7 @@ import type { ConfirmBeforeExecute } from './confirmBeforeExecute.js';
|
|
|
13
13
|
* @typeParam TCommand - The command record type (must extend `object`).
|
|
14
14
|
* @typeParam TResponse - The response payload type returned by a successful command. Defaults to `object`.
|
|
15
15
|
*/
|
|
16
|
-
export interface CommandDialogProps<TCommand extends object, TResponse = object> extends Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>, Omit<DialogProps, 'children' | 'isBusy'> {
|
|
16
|
+
export interface CommandDialogProps<TCommand extends object, TResponse = object> extends Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>, Omit<DialogProps, 'children' | 'isBusy' | 'isCommandDialog'> {
|
|
17
17
|
/**
|
|
18
18
|
* A transformer invoked with the current command values immediately before
|
|
19
19
|
* the command executes on confirm. It **must return** the values to run with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.tsx"],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,CAAC,CAAC;IAElD;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAEtD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAqHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AACH,QAAA,MAAM,sBAAsB;KAAI,QAAQ,SAAS,MAAM,WAAW,SAAS,kBAChE,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC;;CA0FjD,CAAC;AAEF,QAAA,MAAM,0BAA0B,iBAAkB;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,sBAE9E,CAAC;AAKF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,+BAAyB,CAAC"}
|
|
@@ -58,15 +58,18 @@ const CommandDialogWrapper = ({ isValid, onClose, onConfirm, onSuccess, onValida
|
|
|
58
58
|
};
|
|
59
59
|
const processedChildren = processChildren(children);
|
|
60
60
|
const isDialogValid = isValid !== false && isCommandFormValid;
|
|
61
|
-
return (jsx(Dialog, { ...dialogProps, onClose: onClose, onConfirm: handleConfirm, isValid: isDialogValid, isBusy: submission.isSubmitting, children: jsx("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: processedChildren }) }));
|
|
61
|
+
return (jsx(Dialog, { ...dialogProps, onClose: onClose, onConfirm: handleConfirm, isValid: isDialogValid, isBusy: submission.isSubmitting, isCommandDialog: true, children: jsx("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: processedChildren }) }));
|
|
62
62
|
};
|
|
63
63
|
const CommandDialogComponent = (props) => {
|
|
64
|
-
const { title, subtitle, placement, closeIcon, visible, width, style, contentStyle, resizable, buttons = DialogButtons.OkCancel, initialFocus, okLabel, cancelLabel, yesLabel, noLabel, dismissable, dismissOnOutsideClick, closeOnEscape, showCloseButton, closeAriaLabel, isValid, onClose, onConfirm, onCancel, onBeforeExecute, confirmBeforeExecute, className, pt, ptOptions, unstyled, children, ...commandFormProps } = props;
|
|
64
|
+
const { title, subtitle, placement, closeIcon, headerActions, hideGlobalHeaderActions, sliceLocation, visible, width, style, contentStyle, resizable, buttons = DialogButtons.OkCancel, initialFocus, okLabel, cancelLabel, yesLabel, noLabel, dismissable, dismissOnOutsideClick, closeOnEscape, showCloseButton, closeAriaLabel, isValid, onClose, onConfirm, onCancel, onBeforeExecute, confirmBeforeExecute, className, pt, ptOptions, unstyled, children, ...commandFormProps } = props;
|
|
65
65
|
const dialogProps = {
|
|
66
66
|
title,
|
|
67
67
|
subtitle,
|
|
68
68
|
placement,
|
|
69
69
|
closeIcon,
|
|
70
|
+
headerActions,
|
|
71
|
+
hideGlobalHeaderActions,
|
|
72
|
+
sliceLocation,
|
|
70
73
|
visible,
|
|
71
74
|
width,
|
|
72
75
|
style,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogButtons, DialogResult } from '@cratis/arc.react/dialogs';\nimport { Dialog, type DialogProps } from '../Dialogs/Dialog';\nimport React from 'react';\nimport {\n CommandForm,\n CommandFormFieldWrapper,\n useCommandFormContext,\n useCommandInstance,\n type CommandFormProps,\n} from '@cratis/arc.react/commands';\nimport type { BeforeExecuteCallback } from './applyBeforeExecute';\nimport type { ConfirmBeforeExecute } from './confirmBeforeExecute';\nimport { useCommandExecution } from './useCommandExecution';\nimport {\n isCommandFormField,\n markAsCommandFormColumn,\n} from '../CommandForm/commandFormMarkers';\n\n/**\n * Props for {@link CommandDialog}. Combines the props of a `CommandForm`\n * (`command`, `initialValues`, `onSuccess`, `onValidationFailure`, `onFailed`,\n * `onBeforeExecute`, etc.) with the props of a {@link Dialog} (`title`,\n * `buttons`, `width`, `pt`, `unstyled`, …). Dialog presentation props\n * such as `subtitle`, `placement`, and `closeIcon` are forwarded to the dialog.\n *\n * @typeParam TCommand - The command record type (must extend `object`).\n * @typeParam TResponse - The response payload type returned by a successful command. Defaults to `object`.\n */\nexport interface CommandDialogProps<TCommand extends object, TResponse = object>\n extends\n Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>,\n Omit<DialogProps, 'children' | 'isBusy'> {\n /**\n * A transformer invoked with the current command values immediately before\n * the command executes on confirm. It **must return** the values to run with\n * (mutated or not) — a callback that returns nothing does not execute the\n * command with `undefined`; the current values are kept and a warning is\n * logged. May be async.\n *\n * ⚠️ It runs **only on submit**, after the form has already been validated,\n * so a value produced here can never satisfy required-field validation — the\n * submit button stays disabled if a required value is only seeded here. Seed\n * required values through `initialValues`; reserve `onBeforeExecute` for\n * transforms that do not affect validity (for example a generated id).\n */\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n\n /**\n * Ask whether to run the command after validation and `onBeforeExecute`.\n * Receives the transformed values. Only `true` executes; all other outcomes\n * keep the dialog open. May return a promise (for example from a confirmation dialog).\n * If command values change while confirmation is pending, execution is skipped\n * and the dialog stays open; confirm the new values again.\n * Unlike `onConfirm`, this runs before execution, not after success.\n */\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n\n /**\n * Form fields and arbitrary content for the dialog body. Children that are\n * `CommandFormField` instances are automatically wrapped so they bind to\n * the command instance.\n */\n children?: React.ReactNode;\n}\n\n// Requiring each key here makes a newly added Dialog prop fail compilation until it is routed.\ntype ForwardedDialogProps = Omit<DialogProps, 'children' | 'isBusy'> &\n Record<keyof Omit<DialogProps, 'children' | 'isBusy'>, unknown>;\n\nconst CommandDialogWrapper = <TCommand extends object, TResponse = object>({\n isValid,\n onClose,\n onConfirm,\n onSuccess,\n onValidationFailure,\n onFailed,\n onException,\n onUnauthorized,\n onBeforeExecute,\n confirmBeforeExecute,\n children,\n ...dialogProps\n}: Omit<DialogProps, 'isBusy'> & {\n onSuccess?: CommandFormProps<TCommand, TResponse>['onSuccess'];\n onValidationFailure?: CommandFormProps<TCommand, TResponse>['onValidationFailure'];\n onFailed?: CommandFormProps<TCommand, TResponse>['onFailed'];\n onException?: CommandFormProps<TCommand, TResponse>['onException'];\n onUnauthorized?: CommandFormProps<TCommand, TResponse>['onUnauthorized'];\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n}) => {\n const {\n setCommandValues,\n setCommandResult,\n isValid: isCommandFormValid,\n } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n const submission = useCommandExecution<TCommand, TResponse>(\n commandInstance, setCommandValues, onBeforeExecute, confirmBeforeExecute, onException,\n );\n\n const handleConfirm = async () => {\n const result = await submission.run();\n if (!result) return false;\n\n if (!result.isSuccess) {\n await onFailed?.(result);\n if (result.hasExceptions) {\n await onException?.(result.exceptionMessages, result.exceptionStackTrace);\n }\n if (!result.isAuthorized) await onUnauthorized?.();\n if (!result.isValid) {\n await onValidationFailure?.(result.validationResults);\n }\n if (submission.isMounted()) setCommandResult(result);\n return false;\n }\n\n await onSuccess?.(result.response as TResponse);\n if (onConfirm) {\n const closeResult = await onConfirm();\n return closeResult === true;\n }\n if (onClose) {\n const closeResult = await onClose(DialogResult.Ok);\n return closeResult !== false;\n }\n return true;\n };\n\n const processChildren = (nodes: React.ReactNode): React.ReactNode => {\n return React.Children.map(nodes, (child) => {\n if (!React.isValidElement(child)) return child;\n\n const component = child.type as React.ComponentType<unknown>;\n if (isCommandFormField(component)) {\n type FieldElement = Parameters<\n typeof CommandFormFieldWrapper\n >[0]['field'];\n // SAFETY: isCommandFormField guards that child.type is a command form field component.\n return (\n <CommandFormFieldWrapper field={child as unknown as FieldElement} />\n );\n }\n\n const childProps = child.props as Record<string, unknown>;\n // A function child is a render prop, not a node: mapping it would replace the\n // function with its mapped result and break the component that calls it.\n if (childProps.children != null && typeof childProps.children !== 'function') {\n return React.cloneElement(\n child as React.ReactElement<Record<string, unknown>>,\n {\n children: processChildren(childProps.children as React.ReactNode),\n },\n );\n }\n\n return child;\n });\n };\n\n const processedChildren = processChildren(children);\n const isDialogValid = isValid !== false && isCommandFormValid;\n\n return (\n <Dialog\n {...dialogProps}\n onClose={onClose}\n onConfirm={handleConfirm}\n isValid={isDialogValid}\n isBusy={submission.isSubmitting}\n >\n <div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>\n {processedChildren}\n </div>\n </Dialog>\n );\n};\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * ## Where `TCommand` comes from\n *\n * `TCommand` is an auto-generated TypeScript class produced by the Arc proxy\n * generator from a C# `[Command]` record. `dotnet build` writes a `.ts` file\n * per command with the right property types and a typed `execute()` method;\n * importing the class is all the connection-to-the-backend you need. The\n * class also exposes a `.use()` hook for direct (non-dialog) usage and a\n * `useWithChangeTracking()` variant.\n *\n * ## What happens on confirm\n *\n * 1. If `onBeforeExecute` is supplied, it transforms the command values.\n * Used for generated IDs (`Guid.create()`) that the user did not type in.\n * 2. The command's `execute()` runs through Arc's command pipeline. The\n * backend handler returns either a typed response (mapped to `TResponse`)\n * or a `ValidationResult[]`.\n * 3. On `IsSuccess: true`, `onSuccess(response)` fires and the dialog closes\n * through the dialog host context.\n * 4. On a validation failure, `onValidationFailure(errors)` fires and the\n * form's per-field error display is updated. The dialog stays open.\n * 5. On a domain or transport failure, `onFailed(result)` fires. The dialog\n * stays open and the `CommandResult` is set on the form context so the\n * UI can surface the error to the user.\n *\n * Throughout, the dialog is in the `isBusy` state — the confirm button keeps\n * focus but is `aria-disabled` and ignores activation, the other action\n * buttons are disabled, and the confirm button shows a spinner.\n *\n * ## Destructive commands and initial focus\n *\n * The confirm button is focused when the dialog opens, and a focused native\n * button fires `click` from the `keydown` of `Enter`. A command whose form\n * has required fields is protected from a held or double-tapped `Enter` for\n * free, because `isCommandFormValid` keeps confirm disabled until something\n * is filled in. A command that takes **no** input — the typical \"delete\n * this, permanently\" command — has no such gate, so its confirm button is\n * armed the instant the dialog appears.\n *\n * Pass `initialFocus` (forwarded straight to {@link Dialog}) for those:\n *\n * ```tsx\n * <CommandDialog<DeletePerson>\n * command={DeletePerson}\n * title=\"Delete personal data?\"\n * okLabel=\"Delete\"\n * initialFocus={DialogInitialFocus.Cancel}\n * onSuccess={() => closeDialog(DialogResult.Ok)}>\n * This cannot be undone.\n * </CommandDialog>\n * ```\n *\n * Everything else — the footer, the close (X), `Escape`, and the confirm\n * wiring that runs the command — is untouched.\n *\n * ## Field binding\n *\n * Children that are `CommandFormField` instances (`InputTextField`,\n * `NumberField`, `DropdownField`, every `@cratis/components/CommandForm/fields`\n * widget) bind to a property on the command via the `value` accessor:\n *\n * ```tsx\n * <InputTextField value={c => c.name} title=\"Name\" />\n * ```\n *\n * The accessor's argument is the command instance — TypeScript infers\n * `c.name` is a string and the field type-checks against that. Arbitrary\n * non-field children (custom layout, additional text, decorative elements)\n * are rendered as plain content.\n *\n * ## Typed dialog host usage\n *\n * Combine with `useDialog<CommandResult<TResponse>>()` from\n * `@cratis/arc.react/dialogs` to get a fully-typed result at the call site:\n *\n * ```tsx\n * import { useDialog, DialogResult } from '@cratis/arc.react/dialogs';\n * import { CommandDialog } from '@cratis/components/CommandDialog';\n * import { RegisterAuthor } from './RegisterAuthor'; // proxy from C#\n *\n * type RegisterAuthorResponse = { authorId: string };\n *\n * const RegisterAuthorDialog = () => {\n * const { closeDialog } = useDialogContext<CommandResult<RegisterAuthorResponse>>();\n * return (\n * <CommandDialog<RegisterAuthor, RegisterAuthorResponse>\n * command={RegisterAuthor}\n * title=\"Register author\"\n * okLabel=\"Register\"\n * onSuccess={(response) => closeDialog(DialogResult.Ok)}\n * onCancel={() => closeDialog(DialogResult.Cancelled)}>\n * <InputTextField value={c => c.name} title=\"Name\" />\n * <InputTextField value={c => c.email} title=\"Email\" />\n * </CommandDialog>\n * );\n * };\n * ```\n *\n * ## What's special vs. raw Dialog + CommandForm\n *\n * - Confirm wiring (`onConfirm` → `commandInstance.execute()`) is handled\n * internally; you only supply `onSuccess` / `onValidationFailure` / `onFailed`.\n * - The dialog's `isBusy` state tracks the in-flight command without manual\n * `useState`.\n * - Field error propagation from `CommandResult.validationResults` to the\n * form context is automatic.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n * @param props - {@link CommandDialogProps}.\n */\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(\n props: CommandDialogProps<TCommand, TResponse>,\n) => {\n const {\n title,\n subtitle,\n placement,\n closeIcon,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons = DialogButtons.OkCancel,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n dismissOnOutsideClick,\n closeOnEscape,\n showCloseButton,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n onBeforeExecute,\n confirmBeforeExecute,\n className,\n pt,\n ptOptions,\n unstyled,\n children,\n ...commandFormProps\n } = props;\n\n const dialogProps = {\n title,\n subtitle,\n placement,\n closeIcon,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n dismissOnOutsideClick,\n closeOnEscape,\n showCloseButton,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n className,\n pt,\n ptOptions,\n unstyled,\n } satisfies ForwardedDialogProps;\n\n return (\n <CommandForm<TCommand, TResponse> {...commandFormProps}>\n <CommandDialogWrapper<TCommand, TResponse>\n {...dialogProps}\n onSuccess={props.onSuccess}\n onValidationFailure={props.onValidationFailure}\n onFailed={props.onFailed}\n onException={props.onException}\n onUnauthorized={props.onUnauthorized}\n onBeforeExecute={onBeforeExecute}\n confirmBeforeExecute={confirmBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n );\n};\n\nconst CommandDialogColumnWrapper = ({ children }: { children: React.ReactNode }) => (\n <CommandForm.Column>{children}</CommandForm.Column>\n);\nmarkAsCommandFormColumn(CommandDialogColumnWrapper);\n\nCommandDialogComponent.Column = CommandDialogColumnWrapper;\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * See {@link CommandDialogComponent} for full documentation.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n */\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["_jsx"],"mappings":";;;;;;;;AAwEA,MAAM,oBAAoB,GAAG,CAA8C,EACvE,OAAO,EACP,OAAO,EACP,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,GAAG,WAAW,EASjB,KAAI;AACD,IAAA,MAAM,EACF,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EAAE,kBAAkB,GAC9B,GAAG,qBAAqB,EAAY;AACrC,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAY;AACtD,IAAA,MAAM,UAAU,GAAG,mBAAmB,CAClC,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,CACxF;AAED,IAAA,MAAM,aAAa,GAAG,YAAW;AAC7B,QAAA,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE;A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AAe,EACf,oBAAoB,EACpB,SAAS,EACT,EAAE,EACF,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,gBAAgB,EACtB,GAAG,KAAK;AAET,IAAA,MAAM,WAAW,GAAG;QAChB,KAAK;QACL,QAAQ;QACR,SAAS;QACT,SAAS;QACT,OAAO;QACP,KAAK;QACL,KAAK;QACL,YAAY;QACZ,SAAS;QACT,OAAO;QACP,YAAY;QACZ,OAAO;QACP,WAAW;QACX,QAAQ;QACR,OAAO;QACP,WAAW;QACX,qBAAqB;QACrB,aAAa;QACb,eAAe;QACf,cAAc;QACd,OAAO;QACP,OAAO;QACP,SAAS;QACT,QAAQ;QACR,SAAS;QACT,EAAE;QACF,SAAS;QACT,QAAQ;KACoB;IAEhC,QACIA,GAAA,CAAC,WAAW,EAAA,EAAA,GAA0B,gBAAgB,YAClDA,GAAA,CAAC,oBAAoB,EAAA,EAAA,GACb,WAAW,EACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,oBAAoB,EAAA,QAAA,EAEzC,QAAQ,EAAA,CACU,EAAA,CACb;AAEtB,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,EAAE,QAAQ,EAAiC,MAC3EA,GAAA,CAAC,WAAW,CAAC,MAAM,cAAE,QAAQ,EAAA,CAAsB,CACtD;AACD,uBAAuB,CAAC,0BAA0B,CAAC;AAEnD,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAcnD,MAAM,aAAa,GAAG;;"}
|
|
1
|
+
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogButtons, DialogResult } from '@cratis/arc.react/dialogs';\nimport { Dialog, type DialogProps } from '../Dialogs/Dialog';\nimport React from 'react';\nimport {\n CommandForm,\n CommandFormFieldWrapper,\n useCommandFormContext,\n useCommandInstance,\n type CommandFormProps,\n} from '@cratis/arc.react/commands';\nimport type { BeforeExecuteCallback } from './applyBeforeExecute';\nimport type { ConfirmBeforeExecute } from './confirmBeforeExecute';\nimport { useCommandExecution } from './useCommandExecution';\nimport {\n isCommandFormField,\n markAsCommandFormColumn,\n} from '../CommandForm/commandFormMarkers';\n\n/**\n * Props for {@link CommandDialog}. Combines the props of a `CommandForm`\n * (`command`, `initialValues`, `onSuccess`, `onValidationFailure`, `onFailed`,\n * `onBeforeExecute`, etc.) with the props of a {@link Dialog} (`title`,\n * `buttons`, `width`, `pt`, `unstyled`, …). Dialog presentation props\n * such as `subtitle`, `placement`, and `closeIcon` are forwarded to the dialog.\n *\n * @typeParam TCommand - The command record type (must extend `object`).\n * @typeParam TResponse - The response payload type returned by a successful command. Defaults to `object`.\n */\nexport interface CommandDialogProps<TCommand extends object, TResponse = object>\n extends\n Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>,\n Omit<DialogProps, 'children' | 'isBusy' | 'isCommandDialog'> {\n /**\n * A transformer invoked with the current command values immediately before\n * the command executes on confirm. It **must return** the values to run with\n * (mutated or not) — a callback that returns nothing does not execute the\n * command with `undefined`; the current values are kept and a warning is\n * logged. May be async.\n *\n * ⚠️ It runs **only on submit**, after the form has already been validated,\n * so a value produced here can never satisfy required-field validation — the\n * submit button stays disabled if a required value is only seeded here. Seed\n * required values through `initialValues`; reserve `onBeforeExecute` for\n * transforms that do not affect validity (for example a generated id).\n */\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n\n /**\n * Ask whether to run the command after validation and `onBeforeExecute`.\n * Receives the transformed values. Only `true` executes; all other outcomes\n * keep the dialog open. May return a promise (for example from a confirmation dialog).\n * If command values change while confirmation is pending, execution is skipped\n * and the dialog stays open; confirm the new values again.\n * Unlike `onConfirm`, this runs before execution, not after success.\n */\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n\n /**\n * Form fields and arbitrary content for the dialog body. Children that are\n * `CommandFormField` instances are automatically wrapped so they bind to\n * the command instance.\n */\n children?: React.ReactNode;\n}\n\n// Requiring each key here makes a newly added Dialog prop fail compilation until it is routed.\ntype ForwardedDialogProps = Omit<DialogProps, 'children' | 'isBusy' | 'isCommandDialog'> &\n Record<keyof Omit<DialogProps, 'children' | 'isBusy' | 'isCommandDialog'>, unknown>;\n\nconst CommandDialogWrapper = <TCommand extends object, TResponse = object>({\n isValid,\n onClose,\n onConfirm,\n onSuccess,\n onValidationFailure,\n onFailed,\n onException,\n onUnauthorized,\n onBeforeExecute,\n confirmBeforeExecute,\n children,\n ...dialogProps\n}: Omit<DialogProps, 'isBusy'> & {\n onSuccess?: CommandFormProps<TCommand, TResponse>['onSuccess'];\n onValidationFailure?: CommandFormProps<TCommand, TResponse>['onValidationFailure'];\n onFailed?: CommandFormProps<TCommand, TResponse>['onFailed'];\n onException?: CommandFormProps<TCommand, TResponse>['onException'];\n onUnauthorized?: CommandFormProps<TCommand, TResponse>['onUnauthorized'];\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n}) => {\n const {\n setCommandValues,\n setCommandResult,\n isValid: isCommandFormValid,\n } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n const submission = useCommandExecution<TCommand, TResponse>(\n commandInstance, setCommandValues, onBeforeExecute, confirmBeforeExecute, onException,\n );\n\n const handleConfirm = async () => {\n const result = await submission.run();\n if (!result) return false;\n\n if (!result.isSuccess) {\n await onFailed?.(result);\n if (result.hasExceptions) {\n await onException?.(result.exceptionMessages, result.exceptionStackTrace);\n }\n if (!result.isAuthorized) await onUnauthorized?.();\n if (!result.isValid) {\n await onValidationFailure?.(result.validationResults);\n }\n if (submission.isMounted()) setCommandResult(result);\n return false;\n }\n\n await onSuccess?.(result.response as TResponse);\n if (onConfirm) {\n const closeResult = await onConfirm();\n return closeResult === true;\n }\n if (onClose) {\n const closeResult = await onClose(DialogResult.Ok);\n return closeResult !== false;\n }\n return true;\n };\n\n const processChildren = (nodes: React.ReactNode): React.ReactNode => {\n return React.Children.map(nodes, (child) => {\n if (!React.isValidElement(child)) return child;\n\n const component = child.type as React.ComponentType<unknown>;\n if (isCommandFormField(component)) {\n type FieldElement = Parameters<\n typeof CommandFormFieldWrapper\n >[0]['field'];\n // SAFETY: isCommandFormField guards that child.type is a command form field component.\n return (\n <CommandFormFieldWrapper field={child as unknown as FieldElement} />\n );\n }\n\n const childProps = child.props as Record<string, unknown>;\n // A function child is a render prop, not a node: mapping it would replace the\n // function with its mapped result and break the component that calls it.\n if (childProps.children != null && typeof childProps.children !== 'function') {\n return React.cloneElement(\n child as React.ReactElement<Record<string, unknown>>,\n {\n children: processChildren(childProps.children as React.ReactNode),\n },\n );\n }\n\n return child;\n });\n };\n\n const processedChildren = processChildren(children);\n const isDialogValid = isValid !== false && isCommandFormValid;\n\n return (\n <Dialog\n {...dialogProps}\n onClose={onClose}\n onConfirm={handleConfirm}\n isValid={isDialogValid}\n isBusy={submission.isSubmitting}\n isCommandDialog\n >\n <div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>\n {processedChildren}\n </div>\n </Dialog>\n );\n};\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * ## Where `TCommand` comes from\n *\n * `TCommand` is an auto-generated TypeScript class produced by the Arc proxy\n * generator from a C# `[Command]` record. `dotnet build` writes a `.ts` file\n * per command with the right property types and a typed `execute()` method;\n * importing the class is all the connection-to-the-backend you need. The\n * class also exposes a `.use()` hook for direct (non-dialog) usage and a\n * `useWithChangeTracking()` variant.\n *\n * ## What happens on confirm\n *\n * 1. If `onBeforeExecute` is supplied, it transforms the command values.\n * Used for generated IDs (`Guid.create()`) that the user did not type in.\n * 2. The command's `execute()` runs through Arc's command pipeline. The\n * backend handler returns either a typed response (mapped to `TResponse`)\n * or a `ValidationResult[]`.\n * 3. On `IsSuccess: true`, `onSuccess(response)` fires and the dialog closes\n * through the dialog host context.\n * 4. On a validation failure, `onValidationFailure(errors)` fires and the\n * form's per-field error display is updated. The dialog stays open.\n * 5. On a domain or transport failure, `onFailed(result)` fires. The dialog\n * stays open and the `CommandResult` is set on the form context so the\n * UI can surface the error to the user.\n *\n * Throughout, the dialog is in the `isBusy` state — the confirm button keeps\n * focus but is `aria-disabled` and ignores activation, the other action\n * buttons are disabled, and the confirm button shows a spinner.\n *\n * ## Destructive commands and initial focus\n *\n * The confirm button is focused when the dialog opens, and a focused native\n * button fires `click` from the `keydown` of `Enter`. A command whose form\n * has required fields is protected from a held or double-tapped `Enter` for\n * free, because `isCommandFormValid` keeps confirm disabled until something\n * is filled in. A command that takes **no** input — the typical \"delete\n * this, permanently\" command — has no such gate, so its confirm button is\n * armed the instant the dialog appears.\n *\n * Pass `initialFocus` (forwarded straight to {@link Dialog}) for those:\n *\n * ```tsx\n * <CommandDialog<DeletePerson>\n * command={DeletePerson}\n * title=\"Delete personal data?\"\n * okLabel=\"Delete\"\n * initialFocus={DialogInitialFocus.Cancel}\n * onSuccess={() => closeDialog(DialogResult.Ok)}>\n * This cannot be undone.\n * </CommandDialog>\n * ```\n *\n * Everything else — the footer, the close (X), `Escape`, and the confirm\n * wiring that runs the command — is untouched.\n *\n * ## Field binding\n *\n * Children that are `CommandFormField` instances (`InputTextField`,\n * `NumberField`, `DropdownField`, every `@cratis/components/CommandForm/fields`\n * widget) bind to a property on the command via the `value` accessor:\n *\n * ```tsx\n * <InputTextField value={c => c.name} title=\"Name\" />\n * ```\n *\n * The accessor's argument is the command instance — TypeScript infers\n * `c.name` is a string and the field type-checks against that. Arbitrary\n * non-field children (custom layout, additional text, decorative elements)\n * are rendered as plain content.\n *\n * ## Typed dialog host usage\n *\n * Combine with `useDialog<CommandResult<TResponse>>()` from\n * `@cratis/arc.react/dialogs` to get a fully-typed result at the call site:\n *\n * ```tsx\n * import { useDialog, DialogResult } from '@cratis/arc.react/dialogs';\n * import { CommandDialog } from '@cratis/components/CommandDialog';\n * import { RegisterAuthor } from './RegisterAuthor'; // proxy from C#\n *\n * type RegisterAuthorResponse = { authorId: string };\n *\n * const RegisterAuthorDialog = () => {\n * const { closeDialog } = useDialogContext<CommandResult<RegisterAuthorResponse>>();\n * return (\n * <CommandDialog<RegisterAuthor, RegisterAuthorResponse>\n * command={RegisterAuthor}\n * title=\"Register author\"\n * okLabel=\"Register\"\n * onSuccess={(response) => closeDialog(DialogResult.Ok)}\n * onCancel={() => closeDialog(DialogResult.Cancelled)}>\n * <InputTextField value={c => c.name} title=\"Name\" />\n * <InputTextField value={c => c.email} title=\"Email\" />\n * </CommandDialog>\n * );\n * };\n * ```\n *\n * ## What's special vs. raw Dialog + CommandForm\n *\n * - Confirm wiring (`onConfirm` → `commandInstance.execute()`) is handled\n * internally; you only supply `onSuccess` / `onValidationFailure` / `onFailed`.\n * - The dialog's `isBusy` state tracks the in-flight command without manual\n * `useState`.\n * - Field error propagation from `CommandResult.validationResults` to the\n * form context is automatic.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n * @param props - {@link CommandDialogProps}.\n */\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(\n props: CommandDialogProps<TCommand, TResponse>,\n) => {\n const {\n title,\n subtitle,\n placement,\n closeIcon,\n headerActions,\n hideGlobalHeaderActions,\n sliceLocation,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons = DialogButtons.OkCancel,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n dismissOnOutsideClick,\n closeOnEscape,\n showCloseButton,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n onBeforeExecute,\n confirmBeforeExecute,\n className,\n pt,\n ptOptions,\n unstyled,\n children,\n ...commandFormProps\n } = props;\n\n const dialogProps = {\n title,\n subtitle,\n placement,\n closeIcon,\n headerActions,\n hideGlobalHeaderActions,\n sliceLocation,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n dismissOnOutsideClick,\n closeOnEscape,\n showCloseButton,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n className,\n pt,\n ptOptions,\n unstyled,\n } satisfies ForwardedDialogProps;\n\n return (\n <CommandForm<TCommand, TResponse> {...commandFormProps}>\n <CommandDialogWrapper<TCommand, TResponse>\n {...dialogProps}\n onSuccess={props.onSuccess}\n onValidationFailure={props.onValidationFailure}\n onFailed={props.onFailed}\n onException={props.onException}\n onUnauthorized={props.onUnauthorized}\n onBeforeExecute={onBeforeExecute}\n confirmBeforeExecute={confirmBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n );\n};\n\nconst CommandDialogColumnWrapper = ({ children }: { children: React.ReactNode }) => (\n <CommandForm.Column>{children}</CommandForm.Column>\n);\nmarkAsCommandFormColumn(CommandDialogColumnWrapper);\n\nCommandDialogComponent.Column = CommandDialogColumnWrapper;\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * See {@link CommandDialogComponent} for full documentation.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n */\nexport const CommandDialog = Command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f,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,oBAAoB,EAAA,QAAA,EAEzC,QAAQ,EAAA,CACU,EAAA,CACb;AAEtB,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,EAAE,QAAQ,EAAiC,MAC3EA,GAAA,CAAC,WAAW,CAAC,MAAM,cAAE,QAAQ,EAAA,CAAsB,CACtD;AACD,uBAAuB,CAAC,0BAA0B,CAAC;AAEnD,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAcnD,MAAM,aAAa,GAAG;;"}
|
|
@@ -125,7 +125,7 @@ const CommandStepperContent = ({ activeStep, visitedSteps, children, onActiveSte
|
|
|
125
125
|
.join(' '), "data-cratis-part": 'panel', "data-part": 'panel', "data-busy": isStepperBusy || undefined, "data-invalid": stepErrors[index] || undefined, "data-selected": index === currentStep || undefined, "data-visited": visitedSteps.has(index) || undefined, "aria-label": String(panel.props.header ?? `Step ${index + 1}`), "aria-labelledby": pt?.panel?.['aria-labelledby'] ?? (pt?.header?.id == null ? `${stepperId}-step-${index}` : undefined), children: disableFieldsWhileSubmitting ? (jsx("fieldset", { disabled: isSubmitting, inert: isSubmitting, style: { display: 'contents' }, children: processChildren(panel.props.children) })) : processChildren(panel.props.children) }, index))) }));
|
|
126
126
|
return (jsxs("div", { className: `cratis-command-stepper cratis-command-stepper--${orientation}`, "data-orientation": orientation, children: [start, jsx("div", { ...pt?.root, className: ['cratis-command-stepper__root', pt?.root?.className]
|
|
127
127
|
.filter(Boolean)
|
|
128
|
-
.join(' '), "data-cratis-part": 'root', "data-part": 'root', "data-value": currentStep, "data-orientation": orientation, "data-busy": isStepperBusy || undefined, "data-invalid": hasAnyStepErrors || undefined, children: headerPosition === 'bottom' ? (jsxs(Fragment, { children: [stepperPanels, stepperList] })) : (jsxs(Fragment, { children: [stepperList, stepperPanels] })) }), end, showNavigation && (jsxs("div", { style: {
|
|
128
|
+
.join(' '), "data-cratis-part": 'root', "data-cratis-component": 'CommandStepper', "data-part": 'root', "data-value": currentStep, "data-orientation": orientation, "data-busy": isStepperBusy || undefined, "data-invalid": hasAnyStepErrors || undefined, children: headerPosition === 'bottom' ? (jsxs(Fragment, { children: [stepperPanels, stepperList] })) : (jsxs(Fragment, { children: [stepperList, stepperPanels] })) }), end, showNavigation && (jsxs("div", { style: {
|
|
129
129
|
display: 'flex',
|
|
130
130
|
alignItems: 'center',
|
|
131
131
|
width: '100%',
|
|
@@ -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":";;;;;;;;;;;;;;;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,CAAC,KAA8C;YACvE,MAAM,IAAI,GAAG,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC;AAC9C,YAAA,IAAI,IAAI;AAAE,gBAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9B;AAEA,QAAA,MAAM,UAAU,GAAG,KAAK,CAAC,KAAgC;AACzD,QAAA,IAAI,UAAU,CAAC,QAAQ,IAAI,IAAI,EAAE;YAC7B,KAAK,CAAC,IAAI,CACN,GAAG,yBAAy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AAQ,EAAE,MAAM,EAChB,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAExBA,GAAA,CAAA,MAAA,EAAA,EAAA,QAAA,EAAO,qBAAqB,EAAA,CAAQ,EAAA,CAC/B,CACZ,EACDA,aAAK,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAA,CAAI,EAC1B,CAAC,UAAU,KACRA,GAAA,CAAC,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-cratis-component='CommandStepper'\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;IAC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AChC,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,6 +1,7 @@
|
|
|
1
1
|
import React, { type CSSProperties } from 'react';
|
|
2
2
|
import { type CommandFormProps } from '@cratis/arc.react/commands';
|
|
3
3
|
import { type DialogProps, type CloseDialog, type ConfirmCallback, type CancelCallback } from '../Dialogs/Dialog.js';
|
|
4
|
+
import type { DialogSliceLocation } from '../configuration/DialogSliceLocation.js';
|
|
4
5
|
import type { StepperCustomizationProps } from './CommandStepper.js';
|
|
5
6
|
import type { BeforeExecuteCallback } from './applyBeforeExecute.js';
|
|
6
7
|
import type { ConfirmBeforeExecute } from './confirmBeforeExecute.js';
|
|
@@ -38,6 +39,12 @@ export interface StepperCommandDialogProps<TCommand extends object, TResponse =
|
|
|
38
39
|
confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;
|
|
39
40
|
/** Dialog title text. */
|
|
40
41
|
title: string;
|
|
42
|
+
/** Actions rendered in the dialog header before the close button. */
|
|
43
|
+
headerActions?: React.ReactNode;
|
|
44
|
+
/** Suppresses the app-wide header actions registered on `CratisComponentsProvider` for this dialog. */
|
|
45
|
+
hideGlobalHeaderActions?: boolean;
|
|
46
|
+
/** Where this dialog's opener sits in the application; passed to app-wide header actions. */
|
|
47
|
+
sliceLocation?: DialogSliceLocation;
|
|
41
48
|
/** Controls dialog visibility. Defaults to `true`. */
|
|
42
49
|
visible?: boolean;
|
|
43
50
|
/** Dialog width. */
|