@open-pioneer/feature-editing 1.4.0-dev.20260727093741 → 1.4.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/CHANGELOG.md +3 -1
- package/api/editor/context.js.map +1 -1
- package/api/editor/editor.d.ts +2 -2
- package/api/editor/editor.js.map +1 -1
- package/api/model/InteractionOptions.d.ts +1 -1
- package/implementation/FeatureEditor.js.map +1 -1
- package/implementation/components/action-selector/ActionSelector.js.map +1 -1
- package/implementation/components/action-selector/DrawingControls.js.map +1 -1
- package/implementation/components/action-selector/SelectButton.js.map +1 -1
- package/implementation/components/action-selector/TemplateItem.js.map +1 -1
- package/implementation/components/action-selector/TemplateSelector.js.map +1 -1
- package/implementation/components/controls/ColorPickerControl.js +1 -1
- package/implementation/components/controls/ColorPickerControl.js.map +1 -1
- package/implementation/components/controls/ComboBoxControl.js.map +1 -1
- package/implementation/components/controls/DefaultControl.js +1 -1
- package/implementation/components/controls/DefaultControl.js.map +1 -1
- package/implementation/components/controls/NumberFieldControl.js.map +1 -1
- package/implementation/components/controls/RadioGroupControl.js.map +1 -1
- package/implementation/components/controls/SelectControl.js.map +1 -1
- package/implementation/components/controls/option-hooks.js.map +1 -1
- package/implementation/components/property-editor/ButtonRow.js +1 -1
- package/implementation/components/property-editor/ButtonRow.js.map +1 -1
- package/implementation/components/property-editor/CancelConfirmationDialog.js.map +1 -1
- package/implementation/components/property-editor/DeleteConfirmationDialog.js.map +1 -1
- package/implementation/components/property-editor/PropertyEditor.js +6 -3
- package/implementation/components/property-editor/PropertyEditor.js.map +1 -1
- package/implementation/components/property-editor/PropertyField.js.map +1 -1
- package/implementation/components/property-editor/PropertyForm.js +1 -1
- package/implementation/components/property-editor/PropertyForm.js.map +1 -1
- package/implementation/context/PropertyFormContext.js.map +1 -1
- package/implementation/context/usePropertyFormContext.js.map +1 -1
- package/implementation/editor/editorHooks.d.ts +1 -1
- package/implementation/editor/editorHooks.js +1 -1
- package/implementation/editor/editorHooks.js.map +1 -1
- package/implementation/editor/useEditingCallbacks.d.ts +1 -1
- package/implementation/editor/useEditingCallbacks.js +1 -1
- package/implementation/editor/useEditingCallbacks.js.map +1 -1
- package/implementation/geometry-editing/controller/DrawingSession.js.map +1 -1
- package/implementation/geometry-editing/controller/EditingController.d.ts +2 -2
- package/implementation/geometry-editing/controller/EditingController.js.map +1 -1
- package/implementation/geometry-editing/controller/UndoManager.js.map +1 -1
- package/implementation/geometry-editing/controller/geometryState.js.map +1 -1
- package/implementation/geometry-editing/interactions/BaseInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/DoubleClickInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/DrawingInteraction.d.ts +4 -4
- package/implementation/geometry-editing/interactions/DrawingInteraction.js +2 -2
- package/implementation/geometry-editing/interactions/DrawingInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/HighlightingInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/KeyboardInteraction.d.ts +1 -1
- package/implementation/geometry-editing/interactions/KeyboardInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/ModificationInteraction.d.ts +1 -1
- package/implementation/geometry-editing/interactions/ModificationInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/SelectionInteraction.d.ts +2 -2
- package/implementation/geometry-editing/interactions/SelectionInteraction.js +1 -1
- package/implementation/geometry-editing/interactions/SelectionInteraction.js.map +1 -1
- package/implementation/geometry-editing/interactions/SnappingInteraction.d.ts +1 -1
- package/implementation/geometry-editing/interactions/SnappingInteraction.js.map +1 -1
- package/implementation/geometry-editing/useGeometryEditing.d.ts +1 -1
- package/implementation/geometry-editing/useGeometryEditing.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# @open-pioneer/feature-editing
|
|
2
2
|
|
|
3
|
-
## 1.4.0
|
|
3
|
+
## 1.4.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- c30396d: Update Chakra to 3.36.1
|
|
8
|
+
- d862003: Update to trails core-packages 4.7.0
|
|
8
9
|
|
|
9
10
|
### Patch Changes
|
|
10
11
|
|
|
11
12
|
- 078bef5: Use private JavaScript properties (#) instead of TypeScript keyword.
|
|
13
|
+
- c16a401: Migrated from eslint to oxlint and from prettier to oxfmt.
|
|
12
14
|
|
|
13
15
|
## 1.3.0
|
|
14
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["context.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport type { ReactiveMap } from \"@conterra/reactivity-core\";\nimport type { Layer } from \"@open-pioneer/map\";\nimport type { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport type { Feature } from \"ol\";\nimport { useCustomFormContext as useCustomFormContextImpl } from \"../../implementation/context/usePropertyFormContext\";\nimport type { CreationStep, ModificationStep, UpdateStep } from \"../model/EditingStep\";\nimport type { DynamicFormTemplate, FeatureTemplate } from \"../model/FeatureTemplate\";\n\n/**\n * React hook for accessing the property form context within a custom form.\n *\n * Provides access to the {@link CustomFormContext} instance, which contains the current feature\n * being edited and methods to read and update its properties. This hook must be called from within\n * a component that is rendered inside a custom property form (see {@link DynamicFormTemplate}).\n *\n * The context also allows controlling the form's validity by setting the `isValid` property,\n * which determines whether the save button is enabled.\n *\n * @returns The current {@link CustomFormContext} instance.\n * @throws Error if called outside of a custom property form context (e.g., when no feature is being\n * edited).\n *\n * @example\n * ```tsx\n * import { useReactiveSnapshot, DISPATCH_SYNC } from \"@open-pioneer/reactivity\";\n *\n * function CustomForm() {\n * const context = useCustomFormContext();\n * const name = useReactiveSnapshot(\n * () => (context.properties.get(\"name\") as string) ?? \"\",\n * [context],\n * DISPATCH_SYNC\n * );\n *\n * useEffect(() => {\n * context.isValid = name.length >= 1;\n * }, [context, name]);\n *\n * return <Input value={name} onChange={(e) => context.properties.set(\"name\", e.target.value)} />;\n * }\n * ```\n *\n * @group Editor\n */\nexport const useCustomFormContext: () => CustomFormContext = useCustomFormContextImpl;\n\n/**\n * Context object providing access to feature properties and editing state during form editing.\n *\n * The context manages the state of a feature being edited, including its properties, validation\n * status, and associated metadata. It provides reactive property management through a\n * {@link ReactiveMap}, allowing components to automatically re-render when properties change.\n *\n * Access this context in custom forms using the {@link useCustomFormContext} hook.\n *\n * @group Editor\n */\nexport interface CustomFormContext {\n /**\n * The OpenLayers feature being edited.\n *\n * Provides direct access to the feature object, which includes its geometry and properties.\n */\n readonly feature: Feature;\n\n /**\n * Reactive map of feature properties.\n *\n * Provides reactive access to all feature properties (excluding geometry). Use `get()` to read\n * property values and `set()` to update them. Components can use {@link useReactiveSnapshot}\n * to automatically re-render when values change.\n *\n * @example\n * ```ts\n * const name = context.properties.get(\"name\");\n * context.properties.set(\"name\", \"New Name\");\n * ```\n */\n readonly properties: ReactiveMap<string, unknown>;\n\n /**\n * Returns all feature properties as a plain JavaScript object.\n *\n * Converts the reactive properties map to a standard object with string keys and unknown\n * values. Useful when you need to pass properties to functions that expect plain objects.\n *\n * Note that a new object is created on every change.\n * Prefer to use fine grained accesses to {@link properties} if performance matters.\n *\n * @returns A plain object containing all feature properties (excluding geometry).\n */\n readonly getPropertiesAsObject: () => Record<string, unknown>;\n\n /**\n * The current editing step containing the feature and associated metadata.\n *\n * Provides access to the complete editing step, which can be either a {@link CreationStep}\n * or {@link UpdateStep}.\n */\n readonly editingStep: ModificationStep;\n\n /**\n * The current editing mode.\n *\n * Returns `\"create\"` when creating a new feature, or `\"update\"` when editing an existing\n * feature. Use this to conditionally render different UI or apply different logic based on the\n * editing mode.\n */\n readonly mode: Mode;\n\n /**\n * The feature template used to create the feature, if in creation mode.\n *\n * Returns the {@link FeatureTemplate} when creating a new feature (`mode === \"create\"`), or\n * `undefined` when editing an existing feature (`mode === \"update\"`).\n */\n readonly template: FeatureTemplate | undefined;\n\n /**\n * The layer containing the feature being edited, if in update mode.\n *\n * Returns the {@link Layer} when editing an existing feature (`mode === \"update\"`), or\n * `undefined` when creating a new feature (`mode === \"create\"`) or if the layer is not\n * available.\n */\n readonly layer: Layer | undefined;\n\n /**\n * Whether the form is currently valid.\n *\n * Controls the enabled state of the save button in the property editor. Set this to `true`\n * when the form passes validation, or `false` when there are validation errors. For\n * declarative forms, this is managed automatically based on field validation rules.\n */\n isValid: boolean;\n}\n\n/**\n * The editing mode for a feature.\n *\n * - `\"create\"`: Creating a new feature\n * - `\"update\"`: Editing an existing feature\n *\n * @group Editor\n */\nexport type Mode = \"create\" | \"update\";\n"],"names":["useCustomFormContextImpl"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"context.js","sources":["context.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveMap } from \"@conterra/reactivity-core\";\nimport type { Layer } from \"@open-pioneer/map\";\n// oxlint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport type { Feature } from \"ol\";\nimport { useCustomFormContext as useCustomFormContextImpl } from \"../../implementation/context/usePropertyFormContext\";\n// oxlint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { CreationStep, ModificationStep, UpdateStep } from \"../model/EditingStep\";\n// oxlint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { DynamicFormTemplate, FeatureTemplate } from \"../model/FeatureTemplate\";\n\n/**\n * React hook for accessing the property form context within a custom form.\n *\n * Provides access to the {@link CustomFormContext} instance, which contains the current feature\n * being edited and methods to read and update its properties. This hook must be called from within\n * a component that is rendered inside a custom property form (see {@link DynamicFormTemplate}).\n *\n * The context also allows controlling the form's validity by setting the `isValid` property,\n * which determines whether the save button is enabled.\n *\n * @returns The current {@link CustomFormContext} instance.\n * @throws Error if called outside of a custom property form context (e.g., when no feature is being\n * edited).\n *\n * @example\n * ```tsx\n * import { useReactiveSnapshot, DISPATCH_SYNC } from \"@open-pioneer/reactivity\";\n *\n * function CustomForm() {\n * const context = useCustomFormContext();\n * const name = useReactiveSnapshot(\n * () => (context.properties.get(\"name\") as string) ?? \"\",\n * [context],\n * DISPATCH_SYNC\n * );\n *\n * useEffect(() => {\n * context.isValid = name.length >= 1;\n * }, [context, name]);\n *\n * return <Input value={name} onChange={(e) => context.properties.set(\"name\", e.target.value)} />;\n * }\n * ```\n *\n * @group Editor\n */\nexport const useCustomFormContext: () => CustomFormContext = useCustomFormContextImpl;\n\n/**\n * Context object providing access to feature properties and editing state during form editing.\n *\n * The context manages the state of a feature being edited, including its properties, validation\n * status, and associated metadata. It provides reactive property management through a\n * {@link ReactiveMap}, allowing components to automatically re-render when properties change.\n *\n * Access this context in custom forms using the {@link useCustomFormContext} hook.\n *\n * @group Editor\n */\nexport interface CustomFormContext {\n /**\n * The OpenLayers feature being edited.\n *\n * Provides direct access to the feature object, which includes its geometry and properties.\n */\n readonly feature: Feature;\n\n /**\n * Reactive map of feature properties.\n *\n * Provides reactive access to all feature properties (excluding geometry). Use `get()` to read\n * property values and `set()` to update them. Components can use {@link useReactiveSnapshot}\n * to automatically re-render when values change.\n *\n * @example\n * ```ts\n * const name = context.properties.get(\"name\");\n * context.properties.set(\"name\", \"New Name\");\n * ```\n */\n readonly properties: ReactiveMap<string, unknown>;\n\n /**\n * Returns all feature properties as a plain JavaScript object.\n *\n * Converts the reactive properties map to a standard object with string keys and unknown\n * values. Useful when you need to pass properties to functions that expect plain objects.\n *\n * Note that a new object is created on every change.\n * Prefer to use fine grained accesses to {@link properties} if performance matters.\n *\n * @returns A plain object containing all feature properties (excluding geometry).\n */\n readonly getPropertiesAsObject: () => Record<string, unknown>;\n\n /**\n * The current editing step containing the feature and associated metadata.\n *\n * Provides access to the complete editing step, which can be either a {@link CreationStep}\n * or {@link UpdateStep}.\n */\n readonly editingStep: ModificationStep;\n\n /**\n * The current editing mode.\n *\n * Returns `\"create\"` when creating a new feature, or `\"update\"` when editing an existing\n * feature. Use this to conditionally render different UI or apply different logic based on the\n * editing mode.\n */\n readonly mode: Mode;\n\n /**\n * The feature template used to create the feature, if in creation mode.\n *\n * Returns the {@link FeatureTemplate} when creating a new feature (`mode === \"create\"`), or\n * `undefined` when editing an existing feature (`mode === \"update\"`).\n */\n readonly template: FeatureTemplate | undefined;\n\n /**\n * The layer containing the feature being edited, if in update mode.\n *\n * Returns the {@link Layer} when editing an existing feature (`mode === \"update\"`), or\n * `undefined` when creating a new feature (`mode === \"create\"`) or if the layer is not\n * available.\n */\n readonly layer: Layer | undefined;\n\n /**\n * Whether the form is currently valid.\n *\n * Controls the enabled state of the save button in the property editor. Set this to `true`\n * when the form passes validation, or `false` when there are validation errors. For\n * declarative forms, this is managed automatically based on field validation rules.\n */\n isValid: boolean;\n}\n\n/**\n * The editing mode for a feature.\n *\n * - `\"create\"`: Creating a new feature\n * - `\"update\"`: Editing an existing feature\n *\n * @group Editor\n */\nexport type Mode = \"create\" | \"update\";\n"],"names":["useCustomFormContextImpl"],"mappings":";;AAkDO,MAAM,oBAAA,GAAgDA;;;;"}
|
package/api/editor/editor.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Layer, MapModelProps } from "@open-pioneer/map";
|
|
2
|
+
import { CommonComponentProps } from "@open-pioneer/react-utils";
|
|
2
3
|
import Feature from "ol/Feature";
|
|
3
4
|
import { FC } from "react";
|
|
4
|
-
import type { FeatureWriter } from "../model/FeatureWriter";
|
|
5
5
|
import type { EditingStep } from "../model/EditingStep";
|
|
6
6
|
import type { FeatureTemplate, FormTemplate } from "../model/FeatureTemplate";
|
|
7
|
+
import type { FeatureWriter } from "../model/FeatureWriter";
|
|
7
8
|
import type { InteractionOptions } from "../model/InteractionOptions";
|
|
8
|
-
import { CommonComponentProps } from "@open-pioneer/react-utils";
|
|
9
9
|
/**
|
|
10
10
|
* React component that provides a complete editing interface for creating and modifying map
|
|
11
11
|
* features.
|
package/api/editor/editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.js","sources":["editor.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport type { Layer, MapModelProps } from \"@open-pioneer/map\";\nimport Feature from \"ol/Feature\";\nimport { FC } from \"react\";\nimport { FeatureEditor as FeatureEditorImpl } from \"../../implementation/FeatureEditor\";\nimport type {
|
|
1
|
+
{"version":3,"file":"editor.js","sources":["editor.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Layer, MapModelProps } from \"@open-pioneer/map\";\nimport { CommonComponentProps } from \"@open-pioneer/react-utils\";\nimport Feature from \"ol/Feature\";\nimport { FC } from \"react\";\nimport { FeatureEditor as FeatureEditorImpl } from \"../../implementation/FeatureEditor\";\nimport type { EditingStep } from \"../model/EditingStep\";\nimport type { FeatureTemplate, FormTemplate } from \"../model/FeatureTemplate\";\nimport type { FeatureWriter } from \"../model/FeatureWriter\";\nimport type { InteractionOptions } from \"../model/InteractionOptions\";\n\n/**\n * React component that provides a complete editing interface for creating and modifying map\n * features.\n *\n * The Editor component manages the entire editing workflow, including feature creation, selection,\n * modification, and deletion. It renders different UI states based on the current editing step:\n * - An action selector for choosing feature templates and initiating drawing, or selecting\n * existing features.\n * - A property editor for modifying feature attributes and geometry.\n *\n * @example\n * ```tsx\n * <Editor\n * map={mapModel}\n * templates={featureTemplates}\n * storage={{\n * addFeature: async (feature) => { ... },\n * updateFeature: async (feature) => { ... },\n * deleteFeature: async (feature) => { ... }\n * }}\n * selectableLayers={[myLayer]}\n * />\n * ```\n *\n * @group Editor\n * @expandType EditorProps\n */\nexport const FeatureEditor: FC<FeatureEditorProps> = FeatureEditorImpl;\n\n/**\n * Props for the {@link FeatureEditor} component.\n *\n * @group Editor\n */\nexport interface FeatureEditorProps\n extends CommonComponentProps, MapModelProps, InteractionOptions {\n /**\n * Feature templates defining the types of features that can be created or edited.\n *\n * Each template specifies the geometry type, drawing options, and form configuration\n * for a specific feature type.\n */\n readonly templates: FeatureTemplate[];\n\n /**\n * Responsible for persisting changes to your data source.\n */\n readonly writer: FeatureWriter;\n\n /**\n * Optional function to provide custom form templates for features.\n *\n * When specified, this function is called to determine which form template to use\n * when editing an existing feature. If not provided, the first feature template\n * matching the feature's layer ID will be used.\n *\n * @returns The form template to use for editing the feature's properties, or `undefined` if no\n * template is available.\n */\n readonly resolveFormTemplate?: (context: FormTemplateContext) => FormTemplate | undefined;\n\n /**\n * Layers from which features can be selected for editing.\n *\n * When not specified, the layer IDs from the feature templates are used to determine\n * which layers are selectable. Only specify layers that contain features you want to\n * allow users to edit.\n */\n readonly selectableLayers?: Layer[];\n\n /**\n * Layers to which drawn geometries will snap.\n *\n * Enables snapping to features in these layers during drawing and modification operations.\n * Defaults to {@link selectableLayers} if not specified.\n *\n * @default selectableLayers\n */\n readonly snappableLayers?: Layer[];\n\n /**\n * Whether to show the action bar with undo/redo/finish/reset controls during drawing.\n *\n * When `false`, the action bar is hidden. Only applies to templates with geometry types\n * that support these actions (e.g., `Polygon`, `LineString`).\n *\n * @default true\n */\n readonly showActionBar?: boolean;\n\n /**\n * Duration in milliseconds to display success notifications.\n *\n * Controls how long success messages (e.g., \"Feature saved\") are shown to the user.\n * By default, notifiers will never disappear.\n *\n * Use `false` to hide the notification altogether.\n */\n readonly successNotifierDisplayDuration?: number | false;\n\n /**\n * Duration in milliseconds to display failure notifications.\n *\n * Controls how long error messages are shown to the user.\n * By default, notifiers will never disappear.\n *\n * Use `false` to hide the notification altogether.\n */\n readonly failureNotifierDisplayDuration?: number | false;\n\n /**\n * Optional callback invoked when the editing step changes.\n *\n * Called whenever the editing workflow transitions between steps (e.g., from drawing to\n * attribute editing, or from attribute editing back to the initial state).\n *\n * Use this to track or respond to changes in the editing workflow state.\n */\n readonly onEditingStepChange?: (newEditingStep: EditingStep) => void;\n}\n\n/** @group Editor */\nexport interface FormTemplateContext {\n /** The OpenLayers feature being edited. */\n feature: Feature;\n\n /** The layer containing the feature, or `undefined` if not available. */\n layer: Layer | undefined;\n}\n"],"names":["FeatureEditorImpl"],"mappings":";;AAwCO,MAAM,aAAA,GAAwCA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HighlightOptions } from "@open-pioneer/map";
|
|
2
2
|
import type { Options as OlDrawOptions } from "ol/interaction/Draw";
|
|
3
|
-
import type { Options as OlSelectOptions } from "ol/interaction/Select";
|
|
4
3
|
import type { Options as OlModifyOptions } from "ol/interaction/Modify";
|
|
4
|
+
import type { Options as OlSelectOptions } from "ol/interaction/Select";
|
|
5
5
|
import type { Options as OlSnapOptions } from "ol/interaction/Snap";
|
|
6
6
|
/**
|
|
7
7
|
* Configuration options for map interactions during feature editing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureEditor.js","sources":["FeatureEditor.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box } from \"@chakra-ui/react\";\nimport { useMapModelValue } from \"@open-pioneer/map\";\nimport { useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport type { Type as GeometryType } from \"ol/geom/Geometry\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { type ReactElement, type ReactNode, useMemo } from \"react\";\nimport type { FeatureEditorProps } from \"../api/editor/editor\";\nimport { ActionSelector } from \"./components/action-selector/ActionSelector\";\nimport { PropertyEditor } from \"./components/property-editor/PropertyEditor\";\nimport { useEditingStep, useOnActionChange, useSnappingSources } from \"./editor/editorHooks\";\nimport { useEditingCallbacks } from \"./editor/useEditingCallbacks\";\nimport { TooltipMessages } from \"./geometry-editing/controller/EditingController\";\nimport { useGeometryEditing } from \"./geometry-editing/useGeometryEditing\";\n\nexport function FeatureEditor(props: FeatureEditorProps): ReactElement {\n const {\n map,\n templates,\n writer,\n resolveFormTemplate,\n selectableLayers,\n snappableLayers = selectableLayers,\n showActionBar = true,\n successNotifierDisplayDuration,\n failureNotifierDisplayDuration,\n onEditingStepChange,\n ...interactionOptions\n } = props;\n const { containerProps } = useCommonComponentProps(\"editor\", props);\n const mapModel = useMapModelValue(props);\n const intl = useIntl();\n\n const [editingStep, setEditingStep] = useEditingStep(onEditingStepChange);\n const snappingSources = useSnappingSources(mapModel, snappableLayers, templates);\n const onActionChange = useOnActionChange(mapModel, selectableLayers, templates, setEditingStep);\n\n const tooltipMessages = useMemo((): TooltipMessages => {\n return {\n getDrawingMessages() {\n return new Map<GeometryType, ReactNode>([\n [\"Point\", intl.formatRichMessage({ id: \"tooltips.drawingMessagePoint\" })],\n [\n \"LineString\",\n intl.formatRichMessage({ id: \"tooltips.drawingMessageLineString\" })\n ],\n [\"Polygon\", intl.formatRichMessage({ id: \"tooltips.drawingMessagePolygon\" })],\n [\"Circle\", intl.formatRichMessage({ id: \"tooltips.drawingMessageCircle\" })]\n ]);\n },\n getSelectionMessage() {\n return intl.formatRichMessage({ id: \"tooltips.selectionMessage\" });\n },\n getModificationMessages() {\n return new Map<string, ReactNode>([\n [\"Point\", intl.formatRichMessage({ id: \"tooltips.modificationMessagePoint\" })],\n [\"default\", intl.formatRichMessage({ id: \"tooltips.modificationMessage\" })]\n ]);\n }\n };\n }, [intl]);\n\n const drawingState = useGeometryEditing({\n map,\n editingStep,\n setEditingStep,\n snappingSources,\n tooltipMessages,\n ...interactionOptions\n });\n\n const editingCallbacks = useEditingCallbacks(\n mapModel,\n editingStep,\n writer,\n setEditingStep,\n successNotifierDisplayDuration,\n failureNotifierDisplayDuration\n );\n\n let content: ReactNode;\n switch (editingStep.id) {\n case \"initial\":\n case \"drawing\":\n case \"selection\":\n content = (\n <ActionSelector\n templates={templates}\n showActionBar={showActionBar}\n onActionChange={onActionChange}\n drawingState={drawingState}\n />\n );\n break;\n case \"creation\":\n case \"update\":\n content = (\n <PropertyEditor\n editingStep={editingStep}\n callbacks={editingCallbacks}\n templates={templates}\n resolveFormTemplate={resolveFormTemplate}\n />\n );\n break;\n }\n\n return (\n <Box {...containerProps} h=\"full\">\n {content}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FeatureEditor.js","sources":["FeatureEditor.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Box } from \"@chakra-ui/react\";\nimport { useMapModelValue } from \"@open-pioneer/map\";\nimport { useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport type { Type as GeometryType } from \"ol/geom/Geometry\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { type ReactElement, type ReactNode, useMemo } from \"react\";\nimport type { FeatureEditorProps } from \"../api/editor/editor\";\nimport { ActionSelector } from \"./components/action-selector/ActionSelector\";\nimport { PropertyEditor } from \"./components/property-editor/PropertyEditor\";\nimport { useEditingStep, useOnActionChange, useSnappingSources } from \"./editor/editorHooks\";\nimport { useEditingCallbacks } from \"./editor/useEditingCallbacks\";\nimport { TooltipMessages } from \"./geometry-editing/controller/EditingController\";\nimport { useGeometryEditing } from \"./geometry-editing/useGeometryEditing\";\n\nexport function FeatureEditor(props: FeatureEditorProps): ReactElement {\n const {\n map,\n templates,\n writer,\n resolveFormTemplate,\n selectableLayers,\n snappableLayers = selectableLayers,\n showActionBar = true,\n successNotifierDisplayDuration,\n failureNotifierDisplayDuration,\n onEditingStepChange,\n ...interactionOptions\n } = props;\n const { containerProps } = useCommonComponentProps(\"editor\", props);\n const mapModel = useMapModelValue(props);\n const intl = useIntl();\n\n const [editingStep, setEditingStep] = useEditingStep(onEditingStepChange);\n const snappingSources = useSnappingSources(mapModel, snappableLayers, templates);\n const onActionChange = useOnActionChange(mapModel, selectableLayers, templates, setEditingStep);\n\n const tooltipMessages = useMemo((): TooltipMessages => {\n return {\n getDrawingMessages() {\n return new Map<GeometryType, ReactNode>([\n [\"Point\", intl.formatRichMessage({ id: \"tooltips.drawingMessagePoint\" })],\n [\n \"LineString\",\n intl.formatRichMessage({ id: \"tooltips.drawingMessageLineString\" })\n ],\n [\"Polygon\", intl.formatRichMessage({ id: \"tooltips.drawingMessagePolygon\" })],\n [\"Circle\", intl.formatRichMessage({ id: \"tooltips.drawingMessageCircle\" })]\n ]);\n },\n getSelectionMessage() {\n return intl.formatRichMessage({ id: \"tooltips.selectionMessage\" });\n },\n getModificationMessages() {\n return new Map<string, ReactNode>([\n [\"Point\", intl.formatRichMessage({ id: \"tooltips.modificationMessagePoint\" })],\n [\"default\", intl.formatRichMessage({ id: \"tooltips.modificationMessage\" })]\n ]);\n }\n };\n }, [intl]);\n\n const drawingState = useGeometryEditing({\n map,\n editingStep,\n setEditingStep,\n snappingSources,\n tooltipMessages,\n ...interactionOptions\n });\n\n const editingCallbacks = useEditingCallbacks(\n mapModel,\n editingStep,\n writer,\n setEditingStep,\n successNotifierDisplayDuration,\n failureNotifierDisplayDuration\n );\n\n let content: ReactNode;\n switch (editingStep.id) {\n case \"initial\":\n case \"drawing\":\n case \"selection\":\n content = (\n <ActionSelector\n templates={templates}\n showActionBar={showActionBar}\n onActionChange={onActionChange}\n drawingState={drawingState}\n />\n );\n break;\n case \"creation\":\n case \"update\":\n content = (\n <PropertyEditor\n editingStep={editingStep}\n callbacks={editingCallbacks}\n templates={templates}\n resolveFormTemplate={resolveFormTemplate}\n />\n );\n break;\n }\n\n return (\n <Box {...containerProps} h=\"full\">\n {content}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAiBO,SAAS,cAAc,KAAA,EAAyC;AACnE,EAAA,MAAM;AAAA,IACF,GAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,mBAAA;AAAA,IACA,gBAAA;AAAA,IACA,eAAA,GAAkB,gB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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionSelector.js","sources":["ActionSelector.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, Flex } from \"@chakra-ui/react\";\nimport { TitledSection, useEvent } from \"@open-pioneer/react-utils\";\nimport type { Type as GeometryType } from \"ol/geom/Geometry\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useMemo, useState, type ReactElement } from \"react\";\nimport type { FeatureTemplate } from \"../../../api/model/FeatureTemplate\";\nimport { DrawingState } from \"../../geometry-editing/useGeometryEditing\";\nimport { DrawingControls } from \"./DrawingControls\";\nimport { SelectButton } from \"./SelectButton\";\nimport { TemplateSelector } from \"./TemplateSelector\";\n\nexport interface ActionSelectorProps {\n readonly templates: FeatureTemplate[];\n readonly showActionBar: boolean;\n readonly drawingState: DrawingState;\n readonly onActionChange: (newAction: Action | undefined) => void;\n}\n\nexport interface CreateAction {\n readonly mode: \"create\";\n readonly template: FeatureTemplate;\n}\n\nexport interface UpdateAction {\n readonly mode: \"update\";\n}\n\nexport type Action = CreateAction | UpdateAction;\n\nexport function ActionSelector({\n templates,\n showActionBar,\n drawingState,\n onActionChange\n}: ActionSelectorProps): ReactElement {\n const [selectButtonIsActive, setSelectButtonActive] = useState(false);\n const [selectedTemplate, setSelectedTemplate] = useState<FeatureTemplate>();\n\n const onButtonClick = useEvent(() => {\n setSelectButtonActive((active) => !active);\n setSelectedTemplate(undefined);\n onActionChange(!selectButtonIsActive ? { mode: \"update\" } : undefined);\n });\n\n const onTemplateClick = useEvent((template: FeatureTemplate) => {\n setSelectedTemplate((current) => (current !== template ? template : undefined));\n setSelectButtonActive(false);\n onActionChange(selectedTemplate !== template ? { mode: \"create\", template } : undefined);\n });\n\n const { formatMessage } = useIntl();\n\n const [editFeatureHeading, createFeatureHeading] = useMemo(\n () => [\n formatMessage({ id: \"actionSelector.editFeatureHeading\" }),\n formatMessage({ id: \"actionSelector.createFeatureHeading\" })\n ],\n [formatMessage]\n );\n\n return (\n <Flex\n className=\"editor__action-selector\"\n direction=\"column\"\n height=\"full\"\n rowGap={3}\n align=\"stretch\"\n overflowY=\"auto\"\n >\n <TitledSection title={editFeatureHeading} sectionHeadingProps={{ size: \"sm\" }}>\n <SelectButton isActive={selectButtonIsActive} onClick={onButtonClick} />\n </TitledSection>\n\n <TitledSection title={createFeatureHeading} sectionHeadingProps={{ size: \"sm\", mt: 3 }}>\n <Box flex={1} overflowY=\"auto\" mb={2}>\n <TemplateSelector\n templates={templates}\n selectedTemplate={selectedTemplate}\n onClick={onTemplateClick}\n />\n </Box>\n {showActionBar && shouldShowActionBar(selectedTemplate) && (\n <DrawingControls drawingState={drawingState} />\n )}\n </TitledSection>\n </Flex>\n );\n}\n\nfunction shouldShowActionBar(template: FeatureTemplate | undefined): boolean {\n return template != null && ACTION_GEOMETRY_TYPES.has(template.geometryType);\n}\n\nconst ACTION_GEOMETRY_TYPES = new Set<GeometryType>([\"Polygon\", \"LineString\"]);\n"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ActionSelector.js","sources":["ActionSelector.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Box, Flex } from \"@chakra-ui/react\";\nimport { TitledSection, useEvent } from \"@open-pioneer/react-utils\";\nimport type { Type as GeometryType } from \"ol/geom/Geometry\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useMemo, useState, type ReactElement } from \"react\";\nimport type { FeatureTemplate } from \"../../../api/model/FeatureTemplate\";\nimport { DrawingState } from \"../../geometry-editing/useGeometryEditing\";\nimport { DrawingControls } from \"./DrawingControls\";\nimport { SelectButton } from \"./SelectButton\";\nimport { TemplateSelector } from \"./TemplateSelector\";\n\nexport interface ActionSelectorProps {\n readonly templates: FeatureTemplate[];\n readonly showActionBar: boolean;\n readonly drawingState: DrawingState;\n readonly onActionChange: (newAction: Action | undefined) => void;\n}\n\nexport interface CreateAction {\n readonly mode: \"create\";\n readonly template: FeatureTemplate;\n}\n\nexport interface UpdateAction {\n readonly mode: \"update\";\n}\n\nexport type Action = CreateAction | UpdateAction;\n\nexport function ActionSelector({\n templates,\n showActionBar,\n drawingState,\n onActionChange\n}: ActionSelectorProps): ReactElement {\n const [selectButtonIsActive, setSelectButtonActive] = useState(false);\n const [selectedTemplate, setSelectedTemplate] = useState<FeatureTemplate>();\n\n const onButtonClick = useEvent(() => {\n setSelectButtonActive((active) => !active);\n setSelectedTemplate(undefined);\n onActionChange(!selectButtonIsActive ? { mode: \"update\" } : undefined);\n });\n\n const onTemplateClick = useEvent((template: FeatureTemplate) => {\n setSelectedTemplate((current) => (current !== template ? template : undefined));\n setSelectButtonActive(false);\n onActionChange(selectedTemplate !== template ? { mode: \"create\", template } : undefined);\n });\n\n const { formatMessage } = useIntl();\n\n const [editFeatureHeading, createFeatureHeading] = useMemo(\n () => [\n formatMessage({ id: \"actionSelector.editFeatureHeading\" }),\n formatMessage({ id: \"actionSelector.createFeatureHeading\" })\n ],\n [formatMessage]\n );\n\n return (\n <Flex\n className=\"editor__action-selector\"\n direction=\"column\"\n height=\"full\"\n rowGap={3}\n align=\"stretch\"\n overflowY=\"auto\"\n >\n <TitledSection title={editFeatureHeading} sectionHeadingProps={{ size: \"sm\" }}>\n <SelectButton isActive={selectButtonIsActive} onClick={onButtonClick} />\n </TitledSection>\n\n <TitledSection title={createFeatureHeading} sectionHeadingProps={{ size: \"sm\", mt: 3 }}>\n <Box flex={1} overflowY=\"auto\" mb={2}>\n <TemplateSelector\n templates={templates}\n selectedTemplate={selectedTemplate}\n onClick={onTemplateClick}\n />\n </Box>\n {showActionBar && shouldShowActionBar(selectedTemplate) && (\n <DrawingControls drawingState={drawingState} />\n )}\n </TitledSection>\n </Flex>\n );\n}\n\nfunction shouldShowActionBar(template: FeatureTemplate | undefined): boolean {\n return template != null && ACTION_GEOMETRY_TYPES.has(template.geometryType);\n}\n\nconst ACTION_GEOMETRY_TYPES = new Set<GeometryType>([\"Polygon\", \"LineString\"]);\n"],"names":[],"mappings":";;;;;;;;;AAgCO,SAAS,cAAA,CAAe;AAAA,EAC3B,SAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA;AACJ,CAAA,EAAsC;AAClC,EAAA,MAAM,CAAC,oBAAA,EAAsB,qBAAqB,CAAA,GAAI,SAAS,KAAK,CAAA;AACpE,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,QAAA,EAA0B;AAE1E,EAAA,MAAM,aAAA,GAAgB,SAAS,MAAM;AACjC,IAAA,qBAAA,CAAsB,CAAC,MAAA,KAAW,CAAC,MAAM,CAAA;AACzC,IAAA,mBAAA,CAAoB,MAAS,CAAA;AAC7B,IAAA,cAAA,CAAe,CAAC,oBAAA,GAAuB,EAAE,IAAA,EAAM,QAAA,KAAa,MAAS,CAAA;AAAA,EACzE,CAAC,CAAA;AAED,EAAA,MAAM,eAAA,GAAkB,QAAA,CAAS,CAAC,QAAA,KAA8B;AAC5D,IAAA,mBAAA,CAAoB,CAAC,OAAA,KAAa,OAAA,KAAY,QAAA,GAAW,WAAW,MAAU,CAAA;AAC9E,IAAA,qBAAA,CAAsB,KAAK,CAAA;AAC3B,IAAA,cAAA,CAAe,qBAAqB,QAAA,GAAW,EAAE,MAAM,QAAA,EAAU,QAAA,KAAa,MAAS,CAAA;AAAA,EAC3F,CAAC,CAAA;AAED,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,OAAA,EAAQ;AAElC,EAAA,MAAM,CAAC,kBAAA,EAAoB,oBAAoB,CAAA,GAAI,OAAA;AAAA,IAC/C,MAAM;AAAA,MACF,aAAA,CAAc,EAAE,EAAA,EAAI,mCAAA,EAAqC,CAAA;AAAA,MACzD,aAAA,CAAc,EAAE,EAAA,EAAI,qCAAA,EAAuC;AAAA,KAC/D;AAAA,I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AC,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawingControls.js","sources":["DrawingControls.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { HStack, IconButton } from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useMemo, type ReactElement } from \"react\";\nimport { LuCheck, LuRedo, LuUndo, LuX } from \"react-icons/lu\";\nimport { type DrawingState } from \"../../geometry-editing/useGeometryEditing\";\n\nexport interface DrawingControlsProps {\n readonly drawingState: DrawingState;\n}\n\nexport function DrawingControls({ drawingState }: DrawingControlsProps): ReactElement {\n const capabilities = useReactiveSnapshot(\n () => ({\n canUndo: drawingState.canUndo,\n canRedo: drawingState.canRedo,\n canFinish: drawingState.canFinish,\n canReset: drawingState.canReset\n }),\n [drawingState]\n );\n\n const actions = useMemo(\n () => ({\n undo: () => drawingState.undo(),\n redo: () => drawingState.redo(),\n finish: () => drawingState.finish(),\n reset: () => drawingState.reset()\n }),\n [drawingState]\n );\n\n const { formatMessage } = useIntl();\n\n const tooltips = useMemo(\n () => ({\n finishButton: formatMessage({ id: \"actionSelector.finishButtonTooltip\" }),\n resetButton: formatMessage({ id: \"actionSelector.resetButtonTooltip\" }),\n undoButton: formatMessage({ id: \"actionSelector.undoButtonTooltip\" }),\n redoButton: formatMessage({ id: \"actionSelector.redoButtonTooltip\" })\n }),\n [formatMessage]\n );\n\n return (\n <HStack className=\"editor__drawing-controls\" justify=\"right\" gap={3} mb={\"4px\"}>\n <Tooltip content={tooltips.finishButton}>\n <IconButton\n aria-label={tooltips.finishButton}\n disabled={!capabilities.canFinish}\n onClick={actions.finish}\n >\n <LuCheck size={25} />\n </IconButton>\n </Tooltip>\n\n <Tooltip content={tooltips.resetButton}>\n <IconButton\n aria-label={tooltips.resetButton}\n disabled={!capabilities.canReset}\n onClick={actions.reset}\n >\n <LuX size={25} />\n </IconButton>\n </Tooltip>\n\n <Tooltip content={tooltips.undoButton}>\n <IconButton\n aria-label={tooltips.undoButton}\n disabled={!capabilities.canUndo}\n onClick={actions.undo}\n >\n <LuUndo size={25} />\n </IconButton>\n </Tooltip>\n\n <Tooltip content={tooltips.redoButton}>\n <IconButton\n aria-label={tooltips.redoButton}\n disabled={!capabilities.canRedo}\n onClick={actions.redo}\n >\n <LuRedo size={25} />\n </IconButton>\n </Tooltip>\n </HStack>\n );\n}\n"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"DrawingControls.js","sources":["DrawingControls.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { HStack, IconButton } from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useMemo, type ReactElement } from \"react\";\nimport { LuCheck, LuRedo, LuUndo, LuX } from \"react-icons/lu\";\nimport { type DrawingState } from \"../../geometry-editing/useGeometryEditing\";\n\nexport interface DrawingControlsProps {\n readonly drawingState: DrawingState;\n}\n\nexport function DrawingControls({ drawingState }: DrawingControlsProps): ReactElement {\n const capabilities = useReactiveSnapshot(\n () => ({\n canUndo: drawingState.canUndo,\n canRedo: drawingState.canRedo,\n canFinish: drawingState.canFinish,\n canReset: drawingState.canReset\n }),\n [drawingState]\n );\n\n const actions = useMemo(\n () => ({\n undo: () => drawingState.undo(),\n redo: () => drawingState.redo(),\n finish: () => drawingState.finish(),\n reset: () => drawingState.reset()\n }),\n [drawingState]\n );\n\n const { formatMessage } = useIntl();\n\n const tooltips = useMemo(\n () => ({\n finishButton: formatMessage({ id: \"actionSelector.finishButtonTooltip\" }),\n resetButton: formatMessage({ id: \"actionSelector.resetButtonTooltip\" }),\n undoButton: formatMessage({ id: \"actionSelector.undoButtonTooltip\" }),\n redoButton: formatMessage({ id: \"actionSelector.redoButtonTooltip\" })\n }),\n [formatMessage]\n );\n\n return (\n <HStack className=\"editor__drawing-controls\" justify=\"right\" gap={3} mb={\"4px\"}>\n <Tooltip content={tooltips.finishButton}>\n <IconButton\n aria-label={tooltips.finishButton}\n disabled={!capabilities.canFinish}\n onClick={actions.finish}\n >\n <LuCheck size={25} />\n </IconButton>\n </Tooltip>\n\n <Tooltip content={tooltips.resetButton}>\n <IconButton\n aria-label={tooltips.resetButton}\n disabled={!capabilities.canReset}\n onClick={actions.reset}\n >\n <LuX size={25} />\n </IconButton>\n </Tooltip>\n\n <Tooltip content={tooltips.undoButton}>\n <IconButton\n aria-label={tooltips.undoButton}\n disabled={!capabilities.canUndo}\n onClick={actions.undo}\n >\n <LuUndo size={25} />\n </IconButton>\n </Tooltip>\n\n <Tooltip content={tooltips.redoButton}>\n <IconButton\n aria-label={tooltips.redoButton}\n disabled={!capabilities.canRedo}\n onClick={actions.redo}\n >\n <LuRedo size={25} />\n </IconButton>\n </Tooltip>\n </HStack>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAeO,SAAS,eAAA,CAAgB,EAAE,YAAA,EAAa,EAAuC;AAClF,EAAA,MAAM,YAAA,GAAe,mBAAA;AAAA,IACjB,OAAO;AAAA,MACH,SAAS,YAAA,CAAa,OAAA;AAAA,MACtB,SAAS,YAAA,CAAa,OAAA;AAAA,MACtB,WAAW,YAAA,CAAa,SAAA;AAAA,MACxB,UAAU,YAAA,CAAa;AAAA,KAC3B,CAAA;AAAA,IACA,CAAC,YAAY;AAAA,GACjB;AAEA,EAAA,MAAM,OAAA,GAAU,OAAA;AAAA,IACZ,OAAO;AAAA,MACH,IAAA,EAAM,MAAM,YAAA,CAAa,IAAA,EAAK;AAAA,MAC9B,IAAA,EAAM,MAAM,YAAA,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,MAAA;AAAA,QACG,cAAY,QAAA,CAAS,WAAA;AAAA,QACrB,QAAA,EAAU,CAAC,YAAA,CAAa,QAAA;AAAA,QACxB,SAAS,OAAA,CAAQ,KAAA;AAAA,QAEjB,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA,KACnB,EACJ,CAAA;AAAA,oBAEA,GAAA,CAAC,OAAA,EAAA,EAAQ,OAAA,EAAS,QAAA,CAAS,UAAA,EACvB,QAAA,kBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACG,cAAY,QAAA,CAAS,UAAA;AAAA,QACrB,QAAA,EAAU,CAAC,YAAA,CAAa,OAAA;AAAA,QACxB,SAAS,OAAA,CAAQ,IAAA;AAAA,QAEjB,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA,KACtB,EACJ,CAAA;AAAA,oBAEA,GAAA,CAAC,OAAA,EAAA,EAAQ,OAAA,EAAS,QAAA,CAAS,UAAA,EACvB,QAAA,kBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACG,cAAY,QAAA,CAAS,UAAA;AAAA,QACrB,QAAA,EAAU,CAAC,YAAA,CAAa,OAAA;AAAA,QACxB,SAAS,OAAA,CAAQ,IAAA;AAAA,QAEjB,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,IAAA,EAAM,EAAA,EAAI;AAAA;AAAA,KACtB,EACJ;AAAA,GAAA,EACJ,CAAA;AAER;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectButton.js","sources":["SelectButton.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Button, Toggle } from \"@chakra-ui/react\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport {
|
|
1
|
+
{"version":3,"file":"SelectButton.js","sources":["SelectButton.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Button, Toggle } from \"@chakra-ui/react\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport type { ReactElement } from \"react\";\nimport { LuMousePointerClick } from \"react-icons/lu\";\n\ninterface SelectButtonProps {\n readonly isActive: boolean;\n readonly onClick: () => void;\n}\n\nexport function SelectButton({ isActive, onClick }: SelectButtonProps): ReactElement {\n const { formatMessage } = useIntl();\n\n return (\n <Toggle.Root pressed={isActive} asChild>\n <Button\n className=\"editor__action-selector-select-button\"\n variant=\"outline\"\n _hover={{ bg: isActive ? \"colorPalette.700\" : \"colorPalette.subtle\" }}\n _pressed={{ bg: \"colorPalette.800\", color: \"colorPalette.contrast\" }}\n // Margin for focus outline\n marginX=\"4px\"\n onClick={onClick}\n >\n <LuMousePointerClick aria-hidden=\"true\" />\n {isActive\n ? formatMessage({ id: \"actionSelector.selectButtonActiveTitle\" })\n : formatMessage({ id: \"actionSelector.selectButtonTitle\" })}\n </Button>\n </Toggle.Root>\n );\n}\n"],"names":[],"mappings":";;;;;AAaO,SAAS,YAAA,CAAa,EAAE,QAAA,EAAU,OAAA,EAAQ,EAAoC;AACjF,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,OAAA,EAAQ;AAElC,EAAA,2BACK,MAAA,CAAO,IAAA,EAAP,EAAY,OAAA,EAAS,QAAA,EAAU,SAAO,IAAA,EACnC,QAAA,kBAAA,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACG,SAAA,EAAU,uCAAA;AAAA,MACV,OAAA,EAAQ,SAAA;AAAA,MACR,MAAA,EAAQ,EAAE,EAAA,EAAI,QAAA,GAAW,qBAAqB,qBAAA,EAAsB;AAAA,MACpE,QAAA,EAAU,EAAE,EAAA,EAAI,kBAAA,EAAoB,OAAO,uBAAA,EAAwB;AAAA,MAEnE,OAAA,EAAQ,KAAA;AAAA,MACR,OAAA;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,mBAAA,EAAA,EAAoB,eAAY,MAAA,EAAO,CAAA;AAAA,QACvC,QAAA,GACK,aAAA,CAAc,EAAE,EAAA,EAAI,wCAAA,EAA0C,CAAA,GAC9D,aAAA,CAAc,EAAE,EAAA,EAAI,kCAAA,EAAoC;AAAA;AAAA;AAAA,GAClE,EACJ,CAAA;AAER;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateItem.js","sources":["TemplateItem.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { HStack, Span, Table, Text } from \"@chakra-ui/react\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useId, type KeyboardEvent, type ReactElement, type ReactNode } from \"react\";\nimport { PiCircleBold, PiDotOutlineBold, PiLineSegmentsFill, PiPolygonFill } from \"react-icons/pi\";\nimport type { FeatureTemplate } from \"../../../api/model/FeatureTemplate\";\n\ninterface TemplateItemProps {\n readonly template: FeatureTemplate;\n readonly isSelected: boolean;\n readonly onClick: (featureTemplate: FeatureTemplate) => void;\n}\n\ninterface TemplateIconProps {\n readonly template: FeatureTemplate;\n}\n\nexport function TemplateItem({ template, isSelected, onClick }: TemplateItemProps): ReactElement {\n const templateNameId = useId();\n const onRowClick = useEvent(() => onClick(template));\n const onRowKeyDown = useEvent((event: KeyboardEvent<HTMLTableRowElement>) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n onClick(template);\n }\n });\n\n return (\n <Table.Row\n height=\"45px\"\n cursor=\"pointer\"\n tabIndex={0}\n aria-selected={isSelected}\n aria-labelledby={templateNameId}\n role={\"option\"}\n bg={isSelected ? \"colorPalette.800\" : \"bg\"}\n color={isSelected ? \"colorPalette.contrast\" : \"fg\"}\n _hover={{ bg: isSelected ? \"colorPalette.700\" : \"colorPalette.subtle\" }}\n _focusVisible={{\n outline: \"2px solid\",\n outlineColor: \"colorPalette.focusRing\",\n outlineOffset: \"-2px\"\n }}\n userSelect=\"none\"\n onClick={onRowClick}\n onKeyDown={onRowKeyDown}\n >\n <Table.Cell role=\"presentation\">\n <HStack className=\"editor__template-selector-item\" gap=\"4\">\n <Span aria-hidden=\"true\">\n <TemplateIcon template={template} />\n </Span>\n <Text id={templateNameId}>{template.name}</Text>\n </HStack>\n </Table.Cell>\n </Table.Row>\n );\n}\n\n// Render the icon provided for the template, or a default one if it is 'undefined'. Do not render\n// anything if the icon is 'null'.\nfunction TemplateIcon({ template }: TemplateIconProps): ReactNode | undefined {\n if (template.icon !== undefined) {\n return template.icon;\n }\n\n switch (template.geometryType) {\n case \"Polygon\":\n return <PiPolygonFill size={20} />;\n case \"Circle\":\n return <PiCircleBold size={20} />;\n case \"LineString\":\n return <PiLineSegmentsFill size={20} />;\n case \"Point\":\n return <PiDotOutlineBold size={20} />;\n default:\n return undefined;\n }\n}\n"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"TemplateItem.js","sources":["TemplateItem.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { HStack, Span, Table, Text } from \"@chakra-ui/react\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useId, type KeyboardEvent, type ReactElement, type ReactNode } from \"react\";\nimport { PiCircleBold, PiDotOutlineBold, PiLineSegmentsFill, PiPolygonFill } from \"react-icons/pi\";\nimport type { FeatureTemplate } from \"../../../api/model/FeatureTemplate\";\n\ninterface TemplateItemProps {\n readonly template: FeatureTemplate;\n readonly isSelected: boolean;\n readonly onClick: (featureTemplate: FeatureTemplate) => void;\n}\n\ninterface TemplateIconProps {\n readonly template: FeatureTemplate;\n}\n\nexport function TemplateItem({ template, isSelected, onClick }: TemplateItemProps): ReactElement {\n const templateNameId = useId();\n const onRowClick = useEvent(() => onClick(template));\n const onRowKeyDown = useEvent((event: KeyboardEvent<HTMLTableRowElement>) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n onClick(template);\n }\n });\n\n return (\n <Table.Row\n height=\"45px\"\n cursor=\"pointer\"\n tabIndex={0}\n aria-selected={isSelected}\n aria-labelledby={templateNameId}\n role={\"option\"}\n bg={isSelected ? \"colorPalette.800\" : \"bg\"}\n color={isSelected ? \"colorPalette.contrast\" : \"fg\"}\n _hover={{ bg: isSelected ? \"colorPalette.700\" : \"colorPalette.subtle\" }}\n _focusVisible={{\n outline: \"2px solid\",\n outlineColor: \"colorPalette.focusRing\",\n outlineOffset: \"-2px\"\n }}\n userSelect=\"none\"\n onClick={onRowClick}\n onKeyDown={onRowKeyDown}\n >\n <Table.Cell role=\"presentation\">\n <HStack className=\"editor__template-selector-item\" gap=\"4\">\n <Span aria-hidden=\"true\">\n <TemplateIcon template={template} />\n </Span>\n <Text id={templateNameId}>{template.name}</Text>\n </HStack>\n </Table.Cell>\n </Table.Row>\n );\n}\n\n// Render the icon provided for the template, or a default one if it is 'undefined'. Do not render\n// anything if the icon is 'null'.\nfunction TemplateIcon({ template }: TemplateIconProps): ReactNode | undefined {\n if (template.icon !== undefined) {\n return template.icon;\n }\n\n switch (template.geometryType) {\n case \"Polygon\":\n return <PiPolygonFill size={20} />;\n case \"Circle\":\n return <PiCircleBold size={20} />;\n case \"LineString\":\n return <PiLineSegmentsFill size={20} />;\n case \"Point\":\n return <PiDotOutlineBold size={20} />;\n default:\n return undefined;\n }\n}\n"],"names":[],"mappings":";;;;;;AAmBO,SAAS,YAAA,CAAa,EAAE,QAAA,EAAU,UAAA,EAAY,SAAQ,EAAoC;AAC7F,EAAA,MAAM,iBAAiB,KAAA,EAAM;AAC7B,EAAA,MAAM,UAAA,GAAa,QAAA,CAAS,MAAM,OAAA,CAAQ,QAAQ,CAAC,CAAA;AACnD,EAA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AAK,EAAA,EAAI,cAAA,EAAiB,mBAAS,IAAA,EAAK;AAAA,OAAA,EAC7C,CAAA,EACJ;AAAA;AAAA,GACJ;AAER;AAIA,SAAS,YAAA,CAAa,EAAE,QAAA,EAAS,EAA6C;AAC1E,EAAA,IAAI,QAAA,CAAS,SAAS,MAAA,EAAW;AAC7B,IAAA,OAAO,QAAA,CAAS,IAAA;AAAA,EACpB;AAEA,EAAA,QAAQ,SAAS,YAAA;AAAc,IAC3B,KAAK,SAAA;AACD,MAAA,uBAAO,GAAA,CAAC,aAAA,EAAA,EAAc,IAAA,EAAM,EAAA,EAAI,CAAA;AAAA,IACpC,KAAK,QAAA;AACD,MAAA,uBAAO,GAAA,CAAC,YAAA,EAAA,EAAa,IAAA,EAAM,EAAA,EAAI,CAAA;AAAA,IACnC,KAAK,YAAA;AACD,MAAA,uBAAO,GAAA,CAAC,kBAAA,EAAA,EAAmB,IAAA,EAAM,EAAA,EAAI,CAAA;AAAA,IACzC,KAAK,OAAA;AACD,MAAA,uBAAO,GAAA,CAAC,gBAAA,EAAA,EAAiB,IAAA,EAAM,EAAA,EAAI,CAAA;AAAA,IACvC;AACI,MAAA,OAAO,MAAA;AAAA;AAEnB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateSelector.js","sources":["TemplateSelector.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Table } from \"@chakra-ui/react\";\nimport type { ReactElement } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"TemplateSelector.js","sources":["TemplateSelector.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Table } from \"@chakra-ui/react\";\nimport type { ReactElement } from \"react\";\nimport type { FeatureTemplate } from \"../../../api/model/FeatureTemplate\";\nimport { TemplateItem } from \"./TemplateItem\";\n\ninterface TemplateSelectorProps {\n readonly templates: FeatureTemplate[];\n readonly selectedTemplate: FeatureTemplate | undefined;\n readonly onClick: (featureTemplate: FeatureTemplate) => void;\n}\n\nexport function TemplateSelector({\n templates,\n selectedTemplate,\n onClick\n}: TemplateSelectorProps): ReactElement {\n return (\n <Table.Root\n role=\"presentation\" // Note: the body/rows implement a listbox pattern\n className=\"editor__template-selector\"\n variant=\"line\"\n size=\"sm\"\n >\n <Table.Body role={\"listbox\"}>\n {templates.map((template, index) => (\n <TemplateItem\n // oxlint-disable-next-line react/no-array-index-key\n key={index}\n template={template}\n isSelected={selectedTemplate === template}\n onClick={onClick}\n />\n ))}\n </Table.Body>\n </Table.Root>\n );\n}\n"],"names":[],"mappings":";;;;AAcO,SAAS,gBAAA,CAAiB;AAAA,EAC7B,SAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACJ,CAAA,EAAwC;AACpC,EAAA,uBACI,GAAA;AAAA,IAAC,KAAA,CAAM,IAAA;AAAA,IAAN;AAAA,MACG,IAAA,EAAK,cAAA;AAAA,MACL,SAAA,EAAU,2BAAA;AAAA,MACV,OAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAK,IAAA;AAAA,MAEL,QAAA,kBAAA,GAAA,CAAC,KAAA,CAAM,IAAA,EAAN,EAAW,IAAA,EAAM,WACb,QAAA,EAAA,SAAA,CAAU,GAAA,CAAI,CAAC,QAAA,EAAU,KAAA,qBACtB,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UAGG,QAAA;AAAA,UACA,YAAY,gBAAA,KAAqB,QAAA;AAAA,UACjC;AAAA,SAAA;AAAA,QAHK;AAAA,OAKZ,CAAA,EACL;AAAA;AAAA,GACJ;AAER;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { parseColor, ColorPicker, Portal, HStack } from '@chakra-ui/react';
|
|
3
3
|
import { useEvent } from '@open-pioneer/react-utils';
|
|
4
|
-
import { LuCheck } from 'react-icons/lu';
|
|
5
4
|
import { useMemo } from 'react';
|
|
5
|
+
import { LuCheck } from 'react-icons/lu';
|
|
6
6
|
|
|
7
7
|
function ColorPickerControl({
|
|
8
8
|
hexColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerControl.js","sources":["ColorPickerControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n ColorPicker,\n HStack,\n Portal,\n parseColor,\n type ColorPickerValueChangeDetails\n} from \"@chakra-ui/react\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport {
|
|
1
|
+
{"version":3,"file":"ColorPickerControl.js","sources":["ColorPickerControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ColorPicker,\n HStack,\n Portal,\n parseColor,\n type ColorPickerValueChangeDetails\n} from \"@chakra-ui/react\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useMemo, type ReactElement } from \"react\";\nimport { LuCheck } from \"react-icons/lu\";\nimport type { ColorPickerConfig } from \"../../../api/fields/standardFieldConfigs\";\n\ninterface ColorPickerControlProps {\n readonly hexColor: string | undefined;\n readonly field: ColorPickerConfig;\n readonly onChange: (newHexColor: string) => void;\n}\n\ninterface SwatchGroupProps {\n readonly swatchColors: string[] | undefined;\n}\n\nexport function ColorPickerControl({\n hexColor,\n field,\n onChange\n}: ColorPickerControlProps): ReactElement {\n const defaultValue = useMemo(() => parseColor(hexColor ?? \"black\"), [hexColor]);\n\n const onValueChange = useEvent((details: ColorPickerValueChangeDetails) => {\n onChange(details.value.toString(\"hexa\"));\n });\n\n return (\n <ColorPicker.Root defaultValue={defaultValue} onValueChange={onValueChange}>\n <ColorPicker.Control>\n <ColorPicker.Input />\n <ColorPicker.Trigger />\n </ColorPicker.Control>\n <Portal>\n <ColorPicker.Positioner>\n <ColorPicker.Content>\n <ColorPicker.Area />\n <HStack>\n <ColorPicker.EyeDropper size=\"xs\" variant=\"outline\" />\n <ColorPicker.Sliders />\n </HStack>\n <SwatchGroup swatchColors={field.swatchColors} />\n </ColorPicker.Content>\n </ColorPicker.Positioner>\n </Portal>\n </ColorPicker.Root>\n );\n}\n\nfunction SwatchGroup({ swatchColors }: SwatchGroupProps): ReactElement | undefined {\n if (swatchColors != null && swatchColors.length >= 1) {\n return (\n <ColorPicker.SwatchGroup>\n {swatchColors.map((color) => (\n <ColorPicker.SwatchTrigger key={color} value={color}>\n <ColorPicker.Swatch boxSize={4.5} value={color}>\n <ColorPicker.SwatchIndicator>\n <LuCheck />\n </ColorPicker.SwatchIndicator>\n </ColorPicker.Swatch>\n </ColorPicker.SwatchTrigger>\n ))}\n </ColorPicker.SwatchGroup>\n );\n } else {\n return undefined;\n }\n}\n"],"names":[],"mappings":";;;;;;AAyBO,SAAS,kBAAA,CAAmB;AAAA,EAC/B,QAAA;AAAA,EACA,KAAA;AAAA,EACA;AACJ,CAAA,EAA0C;AACtC,EAAA,MAAM,YAAA,GAAe,QAAQ,MAAM,UAAA,CAAW,YAAY,OAAO,CAAA,EAAG,CAAC,QAAQ,CAAC,CAAA;AAE9E,EAAA,MAAM,aAAA,GAAgB,QAAA,CAAS,CAAC,OAAA,KAA2C;AACvE,IAAA,QAAA,CAAS,OAAA,CAAQ,KAAA,CAAM,QAAA,CAAS,MAAM,CAAC,CAAA;AAAA,EAC3C,CAAC,CAAA;AAED,EAAA,uBACI,IAAA,CAAC,WAAA,CAAY,IAAA,EAAZ,EAAiB,cAA4B,aAAA,EAC1C,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,WAAA,CAAY,SAAZ,EACG,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,WAAA,CAAY,OAAZ,EAAkB,CAAA;AAAA,sBACnB,GAAA,CA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;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBoxControl.js","sources":["ComboBoxControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Combobox, Portal } from \"@chakra-ui/react\";\nimport type { ReactElement } from \"react\";\nimport type { ComboBoxConfig } from \"../../../api/fields/optionFieldConfigs\";\nimport { useOptionProps, type OptionControlProps } from \"./option-hooks\";\n\nexport function ComboBoxControl(props: OptionControlProps<ComboBoxConfig>): ReactElement {\n const {\n selectedValue,\n collection,\n placeholder,\n showClearTrigger,\n onInputValueChange,\n onValueChange\n } = useOptionProps(props);\n\n return (\n <Combobox.Root\n value={selectedValue}\n collection={collection}\n onInputValueChange={onInputValueChange}\n onValueChange={onValueChange}\n >\n <Combobox.Control>\n <Combobox.Input placeholder={placeholder} />\n <Combobox.IndicatorGroup>\n {showClearTrigger && <Combobox.ClearTrigger />}\n <Combobox.Trigger />\n </Combobox.IndicatorGroup>\n </Combobox.Control>\n <Portal>\n <Combobox.Positioner>\n <Combobox.Content>\n {collection.items.map((option) => (\n <Combobox.Item key={option.value} item={option}>\n {option.label}\n <Combobox.ItemIndicator />\n </Combobox.Item>\n ))}\n </Combobox.Content>\n </Combobox.Positioner>\n </Portal>\n </Combobox.Root>\n );\n}\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ComboBoxControl.js","sources":["ComboBoxControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Combobox, Portal } from \"@chakra-ui/react\";\nimport type { ReactElement } from \"react\";\nimport type { ComboBoxConfig } from \"../../../api/fields/optionFieldConfigs\";\nimport { useOptionProps, type OptionControlProps } from \"./option-hooks\";\n\nexport function ComboBoxControl(props: OptionControlProps<ComboBoxConfig>): ReactElement {\n const {\n selectedValue,\n collection,\n placeholder,\n showClearTrigger,\n onInputValueChange,\n onValueChange\n } = useOptionProps(props);\n\n return (\n <Combobox.Root\n value={selectedValue}\n collection={collection}\n onInputValueChange={onInputValueChange}\n onValueChange={onValueChange}\n >\n <Combobox.Control>\n <Combobox.Input placeholder={placeholder} />\n <Combobox.IndicatorGroup>\n {showClearTrigger && <Combobox.ClearTrigger />}\n <Combobox.Trigger />\n </Combobox.IndicatorGroup>\n </Combobox.Control>\n <Portal>\n <Combobox.Positioner>\n <Combobox.Content>\n {collection.items.map((option) => (\n <Combobox.Item key={option.value} item={option}>\n {option.label}\n <Combobox.ItemIndicator />\n </Combobox.Item>\n ))}\n </Combobox.Content>\n </Combobox.Positioner>\n </Portal>\n </Combobox.Root>\n );\n}\n"],"names":[],"mappings":";;;;AAQO,SAAS,gBAAgB,KAAA,EAAyD;AACrF,EAAA,MAAM;AAAA,IACF,aAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA,gBAAA;AAAA,IACA,kBAAA;AAAA,IACA;AAAA,GACJ,GAAI,eAAe,KAAK,CAAA;AAExB,EAAA,uBACI,IAAA;AAAA,IAAC,QAAA,CAAS,IAAA;AAAA,IAAT;AAAA,MACG,KAAA,EAAO,aAAA;AAAA,MACP,UAAA;AAAA,MACA,kBAAA;AAAA,MACA,aAAA;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,IAAA,CAAC,QAAA,CAAS,SAAT,EACG,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,QAAA,CAAS,KAAA,EAAT,EAAe,WAAA,EAA0B,CAAA;AAAA,0BAC1C,IAAA,CAAC,QAAA,CAAS,cAAA,EAAT,EACI,QAAA,EAAA;AAAA,YAAA,gBAAA,oBAAoB,GAAA,CAAC,QAAA,CAAS,YAAA,EAAT,EAAsB,CAAA;AAAA,4BAC5C,GAAA,CAAC,QAAA,CAAS,OAAA,EAAT,EAAiB;AAAA,WAAA,EACtB;AAAA,SAAA,EACJ,CAAA;AAAA,wBACA,GAAA,CAAC,UACG,QAAA,kBAAA,GAAA,CAAC,QAAA,CAAS,YAAT,EACG,QAAA,kBAAA,GAAA,CAAC,SAAS,OAAA,EAAT,EACI,qBAAW,KAAA,CAAM,GAAA,CAAI,CAAC,MAAA,qBACnB,IAAA,CAAC,SAAS,IAAA,EAAT,EAAiC,MAAM,MAAA,EACnC,QAAA,EAAA;AAAA,UAAA,MAAA,CAAO,KAAA;AAAA,0BACR,GAAA,CAAC,QAAA,CAAS,aAAA,EAAT,EAAuB;AAAA,SAAA,EAAA,EAFR,MAAA,CAAO,KAG3B,CACH,CAAA,EACL,GACJ,CAAA,EACJ;AAAA;AAAA;AAAA,GACJ;AAER;;;;"}
|
|
@@ -2,12 +2,12 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { Input, Textarea, Switch, Checkbox } from '@chakra-ui/react';
|
|
3
3
|
import { useEvent } from '@open-pioneer/react-utils';
|
|
4
4
|
import { useReactiveSnapshot, DISPATCH_SYNC } from '@open-pioneer/reactivity';
|
|
5
|
+
import { usePropertyFormContext } from '../../context/usePropertyFormContext.js';
|
|
5
6
|
import { ColorPickerControl } from './ColorPickerControl.js';
|
|
6
7
|
import { ComboBoxControl } from './ComboBoxControl.js';
|
|
7
8
|
import { NumberFieldControl } from './NumberFieldControl.js';
|
|
8
9
|
import { RadioGroupControl } from './RadioGroupControl.js';
|
|
9
10
|
import { SelectControl } from './SelectControl.js';
|
|
10
|
-
import { usePropertyFormContext } from '../../context/usePropertyFormContext.js';
|
|
11
11
|
|
|
12
12
|
function DefaultControl({ field }) {
|
|
13
13
|
const { properties } = usePropertyFormContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultControl.js","sources":["DefaultControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Checkbox,\n Input,\n Switch,\n Textarea,\n type CheckboxCheckedChangeDetails\n} from \"@chakra-ui/react\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot, DISPATCH_SYNC } from \"@open-pioneer/reactivity\";\nimport type { ChangeEvent, ReactNode } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"DefaultControl.js","sources":["DefaultControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n Checkbox,\n Input,\n Switch,\n Textarea,\n type CheckboxCheckedChangeDetails\n} from \"@chakra-ui/react\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot, DISPATCH_SYNC } from \"@open-pioneer/reactivity\";\nimport type { ChangeEvent, ReactNode } from \"react\";\nimport type { FieldConfig } from \"../../../api/fields/FieldConfig\";\nimport { usePropertyFormContext } from \"../../context/usePropertyFormContext\";\nimport { ColorPickerControl } from \"./ColorPickerControl\";\nimport { ComboBoxControl } from \"./ComboBoxControl\";\nimport { NumberFieldControl } from \"./NumberFieldControl\";\nimport { RadioGroupControl } from \"./RadioGroupControl\";\nimport { SelectControl } from \"./SelectControl\";\n\nexport interface DefaultControlProps {\n readonly field: FieldConfig;\n}\n\ntype InputElement = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;\n\nexport function DefaultControl({ field }: DefaultControlProps): ReactNode {\n const { properties } = usePropertyFormContext();\n\n const value = useReactiveSnapshot(\n () => properties.get(field.propertyName),\n [field.propertyName, properties],\n DISPATCH_SYNC\n );\n\n const onInputChange = useEvent((event: ChangeEvent<InputElement>) => {\n if (event.target.value !== \"\") {\n if (field.type === \"select\") {\n properties.set(field.propertyName, parseFloat(event.target.value));\n } else {\n properties.set(field.propertyName, event.target.value);\n }\n } else {\n properties.set(field.propertyName, undefined);\n }\n });\n\n const onChange = useEvent((value: unknown) => {\n properties.set(field.propertyName, value);\n });\n\n const onCheckBoxChange = useEvent((details: CheckboxCheckedChangeDetails) => {\n properties.set(field.propertyName, details.checked === true);\n });\n\n switch (field.type) {\n case \"check-box\":\n return (\n <Checkbox.Root\n checked={!!value}\n onCheckedChange={onCheckBoxChange}\n ml={\"3px\"} // for focus ring\n >\n <Checkbox.HiddenInput />\n <Checkbox.Control />\n <Checkbox.Label>{field.checkBoxLabel ?? field.label}</Checkbox.Label>\n </Checkbox.Root>\n );\n\n case \"combo-box\":\n return (\n <ComboBoxControl\n value={value as string | number | undefined}\n field={field}\n onChange={onChange}\n />\n );\n\n case \"custom\":\n return field.render(value, onChange);\n\n case \"color-picker\":\n return (\n <ColorPickerControl\n hexColor={value?.toString()}\n field={field}\n onChange={onChange}\n />\n );\n\n case \"date-picker\":\n return (\n <Input\n type={field.includeTime ? \"datetime-local\" : \"date\"}\n value={value?.toString() ?? \"\"}\n onChange={onInputChange}\n />\n );\n\n case \"number-field\":\n return (\n <NumberFieldControl\n value={value as number | undefined}\n field={field}\n onChange={onChange}\n />\n );\n\n case \"radio-group\":\n return (\n <RadioGroupControl\n value={value as string | number | undefined}\n field={field}\n onChange={onChange}\n />\n );\n\n case \"select\":\n return (\n <SelectControl\n value={value as string | number | undefined}\n field={field}\n onChange={onChange}\n />\n );\n\n case \"switch\":\n return (\n <Switch.Root\n checked={!!value}\n onCheckedChange={onCheckBoxChange}\n ml={\"3px\"} // for focus ring\n >\n <Switch.HiddenInput />\n <Switch.Control>\n <Switch.Thumb />\n </Switch.Control>\n <Switch.Label>{field.switchLabel ?? field.label}</Switch.Label>\n </Switch.Root>\n );\n\n case \"text-area\":\n return (\n <Textarea\n placeholder={field.placeholder ?? field.label}\n value={value?.toString()}\n onChange={onInputChange}\n />\n );\n\n case \"text-field\":\n return (\n <Input\n type=\"text\"\n placeholder={field.placeholder ?? field.label}\n value={value?.toString() ?? \"\"}\n onChange={onInputChange}\n />\n );\n }\n}\n"],"names":["value"],"mappings":";;;;;;;;;;;AA2BO,SAAS,cAAA,CAAe,EAAE,KAAA,EAAM,EAA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|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberFieldControl.js","sources":["NumberFieldControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { NumberInput, type NumberInputValueChangeDetails } from \"@chakra-ui/react\";\nimport { type FormatNumberOptions } from \"@formatjs/intl\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useCallback, useEffect, useRef, useState, type ReactElement } from \"react\";\nimport type { NumberFieldConfig } from \"../../../api/fields/standardFieldConfigs\";\n\ninterface NumberFieldControlProps {\n readonly value: number | undefined;\n readonly field: NumberFieldConfig;\n readonly onChange: (newNumber: number | undefined) => void;\n}\n\n// This component allows its value to be specified as a number. The value is still stored as a\n// string internally to allow non-numeric characters (such as '-', '.', or 'e') to be entered.\nexport function NumberFieldControl({\n value,\n field,\n onChange\n}: NumberFieldControlProps): ReactElement {\n const formatNumber = useFormatNumber(field.formatOptions);\n const [stringValue, setStringValue] = useState(() => formatNumber(value));\n const setNumericValue = useNumericState(value, field.formatOptions, setStringValue);\n\n const onValueChange = useEvent(({ value, valueAsNumber }: NumberInputValueChangeDetails) => {\n setStringValue(value);\n if (!isNaN(valueAsNumber)) {\n setNumericValue(valueAsNumber);\n onChange?.(valueAsNumber);\n } else if (value === \"\") {\n setNumericValue(undefined);\n onChange?.(undefined);\n }\n });\n\n const element = useRef<HTMLInputElement>(null);\n\n return (\n <NumberInput.Root\n value={stringValue ?? \"\"}\n min={field.min}\n max={field.max}\n step={field.step}\n formatOptions={field.formatOptions}\n onValueChange={onValueChange}\n clampValueOnBlur={false}\n >\n <NumberInput.Input ref={element} placeholder={field.placeholder ?? field.label} />\n {field.showSteppers && <NumberInput.Control />}\n </NumberInput.Root>\n );\n}\n\n// Additionally store the state as a number to be able to react to outside changes of 'value'.\nfunction useNumericState(\n value: number | undefined,\n formatOptions: FormatNumberOptions | undefined,\n setStringValue: (newValue: string | undefined) => void\n) {\n const [numericValue, setNumericValue] = useState(value);\n const formatNumber = useFormatNumber(formatOptions);\n\n useEffect(() => {\n if (value !== numericValue) {\n const stringValue = formatNumber(value);\n setStringValue(stringValue);\n setNumericValue(value);\n }\n }, [formatNumber, numericValue, setStringValue, value]);\n\n return setNumericValue;\n}\n\nfunction useFormatNumber(formatOptions: FormatNumberOptions | undefined) {\n const { formatNumber } = useIntl();\n\n return useCallback(\n (number: number | undefined) => {\n if (number != null) {\n return formatNumber(number, { maximumFractionDigits: 20, ...formatOptions });\n } else {\n return undefined;\n }\n },\n [formatNumber, formatOptions]\n );\n}\n"],"names":["value"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"NumberFieldControl.js","sources":["NumberFieldControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { NumberInput, type NumberInputValueChangeDetails } from \"@chakra-ui/react\";\nimport { type FormatNumberOptions } from \"@formatjs/intl\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useCallback, useEffect, useRef, useState, type ReactElement } from \"react\";\nimport type { NumberFieldConfig } from \"../../../api/fields/standardFieldConfigs\";\n\ninterface NumberFieldControlProps {\n readonly value: number | undefined;\n readonly field: NumberFieldConfig;\n readonly onChange: (newNumber: number | undefined) => void;\n}\n\n// This component allows its value to be specified as a number. The value is still stored as a\n// string internally to allow non-numeric characters (such as '-', '.', or 'e') to be entered.\nexport function NumberFieldControl({\n value,\n field,\n onChange\n}: NumberFieldControlProps): ReactElement {\n const formatNumber = useFormatNumber(field.formatOptions);\n const [stringValue, setStringValue] = useState(() => formatNumber(value));\n const setNumericValue = useNumericState(value, field.formatOptions, setStringValue);\n\n const onValueChange = useEvent(({ value, valueAsNumber }: NumberInputValueChangeDetails) => {\n setStringValue(value);\n if (!isNaN(valueAsNumber)) {\n setNumericValue(valueAsNumber);\n onChange?.(valueAsNumber);\n } else if (value === \"\") {\n setNumericValue(undefined);\n onChange?.(undefined);\n }\n });\n\n const element = useRef<HTMLInputElement>(null);\n\n return (\n <NumberInput.Root\n value={stringValue ?? \"\"}\n min={field.min}\n max={field.max}\n step={field.step}\n formatOptions={field.formatOptions}\n onValueChange={onValueChange}\n clampValueOnBlur={false}\n >\n <NumberInput.Input ref={element} placeholder={field.placeholder ?? field.label} />\n {field.showSteppers && <NumberInput.Control />}\n </NumberInput.Root>\n );\n}\n\n// Additionally store the state as a number to be able to react to outside changes of 'value'.\nfunction useNumericState(\n value: number | undefined,\n formatOptions: FormatNumberOptions | undefined,\n setStringValue: (newValue: string | undefined) => void\n) {\n const [numericValue, setNumericValue] = useState(value);\n const formatNumber = useFormatNumber(formatOptions);\n\n useEffect(() => {\n if (value !== numericValue) {\n const stringValue = formatNumber(value);\n setStringValue(stringValue);\n setNumericValue(value);\n }\n }, [formatNumber, numericValue, setStringValue, value]);\n\n return setNumericValue;\n}\n\nfunction useFormatNumber(formatOptions: FormatNumberOptions | undefined) {\n const { formatNumber } = useIntl();\n\n return useCallback(\n (number: number | undefined) => {\n if (number != null) {\n return formatNumber(number, { maximumFractionDigits: 20, ...formatOptions });\n } else {\n return undefined;\n }\n },\n [formatNumber, formatOptions]\n );\n}\n"],"names":["value"],"mappings":";;;;;;AAkBO,SAAS,kBAAA,CAAmB;AAAA,EAC/B,KAAA;AAAA,EACA,KAAA;AAAA,EACA;AACJ,CAAA,EAA0C;AACtC,EAAA,MAAM,YAAA,GAAe,eAAA,CAAgB,KAAA,CAAM,aAAa,CAAA;AACxD,EAAA,MAAM,CAAC,aAAa,cAAc,CAAA,GAAI,SAAS,MAAM,YAAA,CAAa,KAAK,CAAC,CAAA;AACxE,EAAA,MAAM,eAAA,GAAkB,eAAA,CAAgB,KAAA,EAAO,KAAA,CAAM,eAAe,cAAc,CAAA;AAElF,EAAA,MAAM,gBAAgB,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AAA,EAAc;AACxB,MAAA,MAAM,WAAA,GAAc,aAAa,KAAK,CAAA;AACtC,MAAA,cAAA,CAAe,WAAW,CAAA;AAC1B,MAAA,eAAA,CAAgB,KAAK,CAAA;AAAA,IACzB;AAAA,EACJ,GAAG,CAAC,YAAA,EAAc,YAAA,EAAc,cAAA,EAAgB,KAAK,CAAC,CAAA;AAEtD,EAAA,OAAO,eAAA;AACX;AAEA,SAAS,gBAAgB,aAAA,EAAgD;AACrE,EAAA,MAAM,EAAE,YAAA,EAAa,GAAI,OAAA,EAAQ;AAEjC,EAAA,OAAO,WAAA;AAAA,IACH,CAAC,MAAA,KAA+B;AAC5B,MAAA,IAAI,UAAU,IAAA,EAAM;AAChB,QAAA,OAAO,aAAa,MAAA,EAAQ,EAAE,uBAAuB,EAAA,EAAI,GAAG,eAAe,CAAA;AAAA,MAC/E,CAAA,MAAO;AACH,QAAA,OAAO,MAAA;AAAA,MACX;AAAA,IACJ,CAAA;AAAA,IACA,CAAC,cAAc,aAAa;AAAA,GAChC;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroupControl.js","sources":["RadioGroupControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { VStack } from \"@chakra-ui/react\";\nimport { Radio, RadioGroup } from \"@open-pioneer/chakra-snippets/radio\";\nimport type { ReactElement } from \"react\";\nimport type { RadioGroupConfig } from \"../../../api/fields/optionFieldConfigs\";\nimport { useOnValueChange, type OptionControlProps } from \"./option-hooks\";\n\nexport function RadioGroupControl({\n value,\n field,\n onChange\n}: OptionControlProps<RadioGroupConfig>): ReactElement {\n const selectedValue = value?.toString();\n const onValueChange = useOnValueChange(field.valueType, onChange);\n\n return (\n <RadioGroup\n value={selectedValue}\n orientation=\"vertical\"\n onValueChange={onValueChange}\n ml={\"3px\"} // for focus ring\n >\n <VStack align=\"start\" gap={2}>\n {field.options.map((option) => (\n <Radio key={option.value} value={option.value.toString()}>\n {option.label}\n </Radio>\n ))}\n </VStack>\n </RadioGroup>\n );\n}\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"RadioGroupControl.js","sources":["RadioGroupControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { VStack } from \"@chakra-ui/react\";\nimport { Radio, RadioGroup } from \"@open-pioneer/chakra-snippets/radio\";\nimport type { ReactElement } from \"react\";\nimport type { RadioGroupConfig } from \"../../../api/fields/optionFieldConfigs\";\nimport { useOnValueChange, type OptionControlProps } from \"./option-hooks\";\n\nexport function RadioGroupControl({\n value,\n field,\n onChange\n}: OptionControlProps<RadioGroupConfig>): ReactElement {\n const selectedValue = value?.toString();\n const onValueChange = useOnValueChange(field.valueType, onChange);\n\n return (\n <RadioGroup\n value={selectedValue}\n orientation=\"vertical\"\n onValueChange={onValueChange}\n ml={\"3px\"} // for focus ring\n >\n <VStack align=\"start\" gap={2}>\n {field.options.map((option) => (\n <Radio key={option.value} value={option.value.toString()}>\n {option.label}\n </Radio>\n ))}\n </VStack>\n </RadioGroup>\n );\n}\n"],"names":[],"mappings":";;;;;AASO,SAAS,iBAAA,CAAkB;AAAA,EAC9B,KAAA;AAAA,EACA,KAAA;AAAA,EACA;AACJ,CAAA,EAAuD;AACnD,EAAA,MAAM,aAAA,GAAgB,OAAO,QAAA,EAAS;AACtC,EAAA,MAAM,aAAA,GAAgB,gBAAA,CAAiB,KAAA,CAAM,SAAA,EAAW,QAAQ,CAAA;AAEhE,EAAA,uBACI,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACG,KAAA,EAAO,aAAA;AAAA,MACP,WAAA,EAAY,UAAA;AAAA,MACZ,aAAA;AAAA,MACA,EAAA,EAAI,KAAA;AAAA,MAEJ,QAAA,kBAAA,GAAA,CAAC,UAAO,KAAA,EAAM,OAAA,EAAQ,KAAK,CAAA,EACtB,QAAA,EAAA,KAAA,CAAM,OAAA,CAAQ,GAAA,CAAI,CAAC,MAAA,yBACf,KAAA,EAAA,EAAyB,KAAA,EAAO,MAAA,CAAO,KAAA,CAAM,QAAA,EAAS,EAClD,iBAAO,KAAA,EAAA,EADA,MAAA,CAAO,KAEnB,CACH,CAAA,EACL;AAAA;AAAA,GACJ;AAER;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectControl.js","sources":["SelectControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Select, Portal } from \"@chakra-ui/react\";\nimport type { ReactElement } from \"react\";\nimport type { SelectConfig } from \"../../../api/fields/optionFieldConfigs\";\nimport { useOptionProps, type OptionControlProps } from \"./option-hooks\";\n\nexport function SelectControl(props: OptionControlProps<SelectConfig>): ReactElement {\n const { selectedValue, collection, placeholder, showClearTrigger, onValueChange } =\n useOptionProps(props);\n\n return (\n <Select.Root value={selectedValue} collection={collection} onValueChange={onValueChange}>\n <Select.HiddenSelect />\n <Select.Control>\n <Select.Trigger>\n <Select.ValueText placeholder={placeholder} />\n </Select.Trigger>\n <Select.IndicatorGroup>\n {showClearTrigger && <Select.ClearTrigger />}\n <Select.Indicator />\n </Select.IndicatorGroup>\n </Select.Control>\n <Portal>\n <Select.Positioner>\n <Select.Content>\n {collection.items.map((option) => (\n <Select.Item key={option.value} item={option.value}>\n {option.label}\n <Select.ItemIndicator />\n </Select.Item>\n ))}\n </Select.Content>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n );\n}\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"SelectControl.js","sources":["SelectControl.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Select, Portal } from \"@chakra-ui/react\";\nimport type { ReactElement } from \"react\";\nimport type { SelectConfig } from \"../../../api/fields/optionFieldConfigs\";\nimport { useOptionProps, type OptionControlProps } from \"./option-hooks\";\n\nexport function SelectControl(props: OptionControlProps<SelectConfig>): ReactElement {\n const { selectedValue, collection, placeholder, showClearTrigger, onValueChange } =\n useOptionProps(props);\n\n return (\n <Select.Root value={selectedValue} collection={collection} onValueChange={onValueChange}>\n <Select.HiddenSelect />\n <Select.Control>\n <Select.Trigger>\n <Select.ValueText placeholder={placeholder} />\n </Select.Trigger>\n <Select.IndicatorGroup>\n {showClearTrigger && <Select.ClearTrigger />}\n <Select.Indicator />\n </Select.IndicatorGroup>\n </Select.Control>\n <Portal>\n <Select.Positioner>\n <Select.Content>\n {collection.items.map((option) => (\n <Select.Item key={option.value} item={option.value}>\n {option.label}\n <Select.ItemIndicator />\n </Select.Item>\n ))}\n </Select.Content>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n );\n}\n"],"names":[],"mappings":";;;;AAQO,SAAS,cAAc,KAAA,EAAuD;AACjF,EAAA,MAAM,EAAE,eAAe,UAAA,EAAY,WAAA,EAAa,kBAAkB,aAAA,EAAc,GAC5E,eAAe,KAAK,CAAA;AAExB,EAAA,4BACK,MAAA,CAAO,IAAA,EAAP,EAAY,KAAA,EAAO,aAAA,EAAe,YAAwB,aAAA,EACvD,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,CAAO,cAAP,EAAoB,CAAA;AAAA,oBACrB,IAAA,CAAC,MAAA,CAAO,OAAA,EAAP,EACG,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,MAAA,CAAO,SAAP,EACG,QAAA,kBAAA,GAAA,CAAC,OAAO,SAAA,EAAP,EAAiB,aAA0B,CAAA,EAChD,CAAA;AAAA,sBACA,IAAA,CAAC,MAAA,CAAO,cAAA,EAAP,EACI,QAAA,EAAA;AAAA,QAAA,gBAAA,oBAAoB,GAAA,CAAC,MAAA,CAAO,YAAA,EAAP,EAAoB,CAAA;AAAA,wBAC1C,GAAA,CAAC,MAAA,CAAO,SAAA,EAAP,EAAiB;AAAA,OAAA,EACtB;AAAA,KAAA,EACJ,CAAA;AAAA,oBACA,GAAA,CAAC,UACG,QAAA,kBAAA,GAAA,CAAC,MAAA,CAAO,YAAP,EACG,QAAA,kBAAA,GAAA,CAAC,OAAO,OAAA,EAAP,EACI,qBAAW,KAAA,CAAM,GAAA,CAAI,CAAC,MAAA,qBACnB,IAAA,CAAC,OAAO,IAAA,EAAP,EAA+B,IAAA,EAAM,MAAA,CAAO,KAAA,EACxC,QAAA,EAAA;AAAA,MAAA,MAAA,CAAO,KAAA;AAAA,sBACR,GAAA,CAAC,MAAA,CAAO,aAAA,EAAP,EAAqB;AAAA,KAAA,EAAA,EAFR,MAAA,CAAO,KAGzB,CACH,CAAA,EACL,GACJ,CAAA,EACJ;AAAA,GAAA,EACJ,CAAA;AAER;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-hooks.js","sources":["option-hooks.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n useListCollection,\n useFilter,\n type ComboboxInputValueChangeDetails,\n type ComboboxValueChangeDetails,\n type SelectValueChangeDetails,\n type RadioGroupValueChangeDetails\n} from \"@chakra-ui/react\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useMemo } from \"react\";\nimport type { SelectConfig, ComboBoxConfig } from \"../../../api/fields/optionFieldConfigs\";\n\nexport interface OptionControlProps<T = SelectConfig | ComboBoxConfig> {\n readonly value: string | number | undefined;\n readonly field: T;\n readonly onChange: (value: unknown) => void;\n}\n\ntype ValueChangeDetails =\n SelectValueChangeDetails
|
|
1
|
+
{"version":3,"file":"option-hooks.js","sources":["option-hooks.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n useListCollection,\n useFilter,\n type ComboboxInputValueChangeDetails,\n type ComboboxValueChangeDetails,\n type SelectValueChangeDetails,\n type RadioGroupValueChangeDetails\n} from \"@chakra-ui/react\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useMemo } from \"react\";\nimport type { SelectConfig, ComboBoxConfig } from \"../../../api/fields/optionFieldConfigs\";\n\nexport interface OptionControlProps<T = SelectConfig | ComboBoxConfig> {\n readonly value: string | number | undefined;\n readonly field: T;\n readonly onChange: (value: unknown) => void;\n}\n\ntype ValueChangeDetails =\n | SelectValueChangeDetails\n | ComboboxValueChangeDetails\n | RadioGroupValueChangeDetails;\n\nexport function useOptionProps({ value, field, onChange }: OptionControlProps) {\n const selectedValue = useMemo(() => (value != undefined ? [value.toString()] : []), [value]);\n const { collection, onInputValueChange } = useCollection(field);\n const onValueChange = useOnValueChange(field.valueType, onChange);\n\n return {\n selectedValue,\n collection,\n placeholder: field.placeholder ?? field.label,\n showClearTrigger: field.showClearTrigger ?? !(field.isRequired ?? false),\n onInputValueChange,\n onValueChange\n };\n}\n\nexport function useOnValueChange(\n valueType: \"string\" | \"number\",\n onChange: (value: unknown) => void\n) {\n return useEvent((details: ValueChangeDetails) => {\n const newValue = details.value?.[0];\n if (valueType === \"number\") {\n onChange(newValue !== undefined ? parseFloat(newValue) : undefined);\n } else {\n onChange(newValue);\n }\n });\n}\n\nfunction useCollection(field: SelectConfig | ComboBoxConfig) {\n const initialItems = useMemo(() => {\n return field.options.map(({ label, value }) => ({ label, value: value.toString() }));\n }, [field.options]);\n\n const { contains } = useFilter({ sensitivity: \"base\" });\n const { collection, filter } = useListCollection({ initialItems, filter: contains });\n\n const onInputValueChange = useEvent((details: ComboboxInputValueChangeDetails) => {\n filter(details.inputValue);\n });\n\n return { collection, onInputValueChange };\n}\n"],"names":[],"mappings":";;;;AA0BO,SAAS,cAAA,CAAe,EAAE,KAAA,EAAO,KAAA,EAAO,UAAS,EAAuB;AAC3E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CAAA;AAElB,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,UAAU,EAAE,WAAA,EAAa,QAAQ,CAAA;AACtD,EAAA,MAAM,EAAE,YAAY,MAAA,EAAO,GAAI,kBAAkB,EAAE,YAAA,EAAc,MAAA,EAAQ,QAAA,EAAU,CAAA;AAEnF,EAAA,MAAM,kBAAA,GAAqB,QAAA,CAAS,CAAC,OAAA,KAA6C;AAC9E,IAAA,MAAA,CAAO,QAAQ,UAAU,CAAA;AAAA,EAC7B,CAAC,CAAA;AAED,EAAA,OAAO,EAAE,YAAY,kBAAA,EAAmB;AAC5C;;;;"}
|
|
@@ -3,8 +3,8 @@ import { Flex, Button, Spacer } from '@chakra-ui/react';
|
|
|
3
3
|
import { Tooltip } from '@open-pioneer/chakra-snippets/tooltip';
|
|
4
4
|
import { useEvent } from '@open-pioneer/react-utils';
|
|
5
5
|
import { useIntl } from '../../../_virtual/hooks.js';
|
|
6
|
-
import { LuTrash2 } from 'react-icons/lu';
|
|
7
6
|
import { useState, useMemo } from 'react';
|
|
7
|
+
import { LuTrash2 } from 'react-icons/lu';
|
|
8
8
|
|
|
9
9
|
function ButtonRow({
|
|
10
10
|
canSave,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonRow.js","sources":["ButtonRow.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Flex, Button, Spacer } from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport {
|
|
1
|
+
{"version":3,"file":"ButtonRow.js","sources":["ButtonRow.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Flex, Button, Spacer } from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useMemo, useState, type ReactElement } from \"react\";\nimport { LuTrash2 } from \"react-icons/lu\";\n\ninterface ButtonRowProps {\n readonly canSave: boolean;\n readonly showDeleteButton: boolean;\n\n readonly onSave: () => Promise<void>;\n readonly onDelete: () => void;\n readonly onCancel: () => void;\n}\n\nexport function ButtonRow({\n canSave,\n showDeleteButton,\n onSave,\n onDelete,\n onCancel\n}: ButtonRowProps): ReactElement {\n const [isSaving, setSaving] = useState(false);\n\n const onSaveClick = useEvent(async () => {\n try {\n setSaving(true);\n await onSave();\n } finally {\n setSaving(false);\n }\n });\n\n const { formatMessage } = useIntl();\n\n const { saveButtonTitle, cancelButtonTitle, deleteButtonTooltip } = useMemo(\n () => ({\n saveButtonTitle: formatMessage({ id: \"propertyEditor.saveButtonTitle\" }),\n cancelButtonTitle: formatMessage({ id: \"propertyEditor.cancelButtonTitle\" }),\n deleteButtonTooltip: formatMessage({ id: \"propertyEditor.deleteButtonTooltip\" })\n }),\n [formatMessage]\n );\n\n return (\n <Flex\n className=\"editor__property-editor-buttons\"\n flexDirection=\"row\"\n columnGap={2}\n // Margins for focus ring:\n marginX={\"4px\"}\n marginBottom={\"4px\"}\n >\n {showDeleteButton && (\n <Tooltip content={deleteButtonTooltip}>\n <Button\n width={65}\n variant=\"outline\"\n colorPalette=\"red\"\n aria-label={deleteButtonTooltip}\n disabled={isSaving}\n onClick={onDelete}\n >\n <LuTrash2 strokeWidth={1.5} />\n </Button>\n </Tooltip>\n )}\n <Spacer />\n <Button\n width={120}\n disabled={!canSave}\n loading={isSaving}\n loadingText={saveButtonTitle}\n onClick={onSaveClick}\n >\n {saveButtonTitle}\n </Button>\n <Button width={120} variant=\"outline\" disabled={isSaving} onClick={onCancel}>\n {cancelButtonTitle}\n </Button>\n </Flex>\n );\n}\n"],"names":[],"mappings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,OAAA,EAAQ,SAAA;AAAA,YACR,YAAA,EAAa,KAAA;AAAA,YACb,YAAA,EAAY,mBAAA;AAAA,YACZ,QAAA,EAAU,QAAA;AAAA,YACV,OAAA,EAAS,QAAA;AAAA,YAET,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,WAAA,EAAa,GAAA,EAAK;AAAA;AAAA,SAChC,EACJ,CAAA;AAAA,4BAEH,MAAA,EAAA,EAAO,CAAA;AAAA,wBACR,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACG,KAAA,EAAO,GAAA;AAAA,YACP,UAAU,CAAC,OAAA;AAAA,YACX,OAAA,EAAS,QAAA;AAAA,YACT,WAAA,EAAa,eAAA;AAAA,YACb,OAAA,EAAS,WAAA;AAAA,YAER,QAAA,EAAA;AAAA;AAAA,SACL;AAAA,wBACA,GAAA,CAAC,MAAA,EAAA,EAAO,KAAA,EAAO,GAAA,EAAK,OAAA,EAAQ,WAAU,QAAA,EAAU,QAAA,EAAU,OAAA,EAAS,QAAA,EAC9D,QAAA,EAAA,iBAAA,EACL;AAAA;AAAA;AAAA,GACJ;AAER;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CancelConfirmationDialog.js","sources":["CancelConfirmationDialog.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Button, Dialog } from \"@chakra-ui/react\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useCallback, useMemo, useRef, type ReactElement } from \"react\";\n\ninterface CancelConfirmationDialogProps {\n readonly isOpen: boolean;\n readonly onConfirmCancel: () => void;\n readonly onAbortCancel: () => void;\n}\n\nexport function CancelConfirmationDialog({\n isOpen,\n onConfirmCancel,\n onAbortCancel\n}: CancelConfirmationDialogProps): ReactElement {\n const cancelButtonRef = useRef<HTMLButtonElement>(null);\n const initialFocusEl = useCallback(() => cancelButtonRef.current, []);\n const { formatMessage } = useIntl();\n\n const { title, message, confirmCancelButtonTitle, abortCancelButtonTitle } = useMemo(\n () => ({\n title: formatMessage({ id: \"cancelConfirmationDialog.title\" }),\n message: formatMessage({ id: \"cancelConfirmationDialog.message\" }),\n confirmCancelButtonTitle: formatMessage({\n id: \"cancelConfirmationDialog.confirmCancelButtonTitle\"\n }),\n abortCancelButtonTitle: formatMessage({\n id: \"cancelConfirmationDialog.abortCancelButtonTitle\"\n })\n }),\n [formatMessage]\n );\n\n return (\n <Dialog.Root open={isOpen} initialFocusEl={initialFocusEl} role=\"alertdialog\">\n <Dialog.Backdrop />\n <Dialog.Positioner>\n <Dialog.Content>\n <Dialog.Header fontSize=\"large\" fontWeight=\"bold\">\n {title}\n </Dialog.Header>\n <Dialog.Body>{message}</Dialog.Body>\n <Dialog.Footer>\n <Button\n bg=\"red.solid\"\n color=\"red.contrast\"\n _hover={{ bg: \"red.solid/90\" }}\n loadingText={confirmCancelButtonTitle}\n onClick={onConfirmCancel}\n >\n {confirmCancelButtonTitle}\n </Button>\n <Button variant=\"outline\" ref={cancelButtonRef} onClick={onAbortCancel}>\n {abortCancelButtonTitle}\n </Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Positioner>\n </Dialog.Root>\n );\n}\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"CancelConfirmationDialog.js","sources":["CancelConfirmationDialog.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Button, Dialog } from \"@chakra-ui/react\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useCallback, useMemo, useRef, type ReactElement } from \"react\";\n\ninterface CancelConfirmationDialogProps {\n readonly isOpen: boolean;\n readonly onConfirmCancel: () => void;\n readonly onAbortCancel: () => void;\n}\n\nexport function CancelConfirmationDialog({\n isOpen,\n onConfirmCancel,\n onAbortCancel\n}: CancelConfirmationDialogProps): ReactElement {\n const cancelButtonRef = useRef<HTMLButtonElement>(null);\n const initialFocusEl = useCallback(() => cancelButtonRef.current, []);\n const { formatMessage } = useIntl();\n\n const { title, message, confirmCancelButtonTitle, abortCancelButtonTitle } = useMemo(\n () => ({\n title: formatMessage({ id: \"cancelConfirmationDialog.title\" }),\n message: formatMessage({ id: \"cancelConfirmationDialog.message\" }),\n confirmCancelButtonTitle: formatMessage({\n id: \"cancelConfirmationDialog.confirmCancelButtonTitle\"\n }),\n abortCancelButtonTitle: formatMessage({\n id: \"cancelConfirmationDialog.abortCancelButtonTitle\"\n })\n }),\n [formatMessage]\n );\n\n return (\n <Dialog.Root open={isOpen} initialFocusEl={initialFocusEl} role=\"alertdialog\">\n <Dialog.Backdrop />\n <Dialog.Positioner>\n <Dialog.Content>\n <Dialog.Header fontSize=\"large\" fontWeight=\"bold\">\n {title}\n </Dialog.Header>\n <Dialog.Body>{message}</Dialog.Body>\n <Dialog.Footer>\n <Button\n bg=\"red.solid\"\n color=\"red.contrast\"\n _hover={{ bg: \"red.solid/90\" }}\n loadingText={confirmCancelButtonTitle}\n onClick={onConfirmCancel}\n >\n {confirmCancelButtonTitle}\n </Button>\n <Button variant=\"outline\" ref={cancelButtonRef} onClick={onAbortCancel}>\n {abortCancelButtonTitle}\n </Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Positioner>\n </Dialog.Root>\n );\n}\n"],"names":[],"mappings":";;;;;AAaO,SAAS,wBAAA,CAAyB;AAAA,EACrC,MAAA;AAAA,EACA,eAAA;AAAA,EACA;AACJ,CAAA,EAAgD;AAC5C,EAAA,MAAM,eAAA,GAAkB,OAA0B,IAAI,CAAA;AACtD,EAAA,MAAM,iBAAiB,WAAA,CAAY,MAAM,eAAA,CAAgB,OAAA,EAAS,EAAE,CAAA;AACpE,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,OAAA,EAAQ;AAElC,EAAA,MAAM,EAAE,KAAA,EAAO,OAAA,EAAS,wBAAA,E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U,KAAK,eAAA,EAAiB,OAAA,EAAS,eACpD,QAAA,EAAA,sBAAA,EACL;AAAA,OAAA,EACJ;AAAA,KAAA,EACJ,CAAA,EACJ;AAAA,GAAA,EACJ,CAAA;AAER;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteConfirmationDialog.js","sources":["DeleteConfirmationDialog.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Button, Dialog } from \"@chakra-ui/react\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useCallback, useMemo, useRef, useState, type ReactElement } from \"react\";\n\ninterface DeleteConfirmationDialogProps {\n readonly isOpen: boolean;\n readonly onDelete: () => Promise<void>;\n readonly onCancel: () => void;\n}\n\nexport function DeleteConfirmationDialog({\n isOpen,\n onDelete,\n onCancel\n}: DeleteConfirmationDialogProps): ReactElement {\n const [isDeleting, setDeleting] = useState(false);\n const cancelButtonRef = useRef<HTMLButtonElement>(null);\n const initialFocusEl = useCallback(() => cancelButtonRef.current, []);\n const { formatMessage } = useIntl();\n\n const onDeleteClick = useEvent(async () => {\n try {\n setDeleting(true);\n await onDelete();\n } finally {\n setDeleting(false);\n }\n });\n\n const { title, message, deleteButtonTitle, cancelButtonTitle } = useMemo(\n () => ({\n title: formatMessage({ id: \"deleteConfirmationDialog.title\" }),\n message: formatMessage({ id: \"deleteConfirmationDialog.message\" }),\n deleteButtonTitle: formatMessage({ id: \"deleteConfirmationDialog.deleteButtonTitle\" }),\n cancelButtonTitle: formatMessage({ id: \"deleteConfirmationDialog.cancelButtonTitle\" })\n }),\n [formatMessage]\n );\n\n return (\n <Dialog.Root open={isOpen} initialFocusEl={initialFocusEl} role=\"alertdialog\">\n <Dialog.Backdrop />\n <Dialog.Positioner>\n <Dialog.Content>\n <Dialog.Header fontSize=\"large\" fontWeight=\"bold\">\n {title}\n </Dialog.Header>\n <Dialog.Body>{message}</Dialog.Body>\n <Dialog.Footer>\n <Button\n bg=\"red.solid\"\n color=\"red.contrast\"\n _hover={{ bg: \"red.solid/90\" }}\n loading={isDeleting}\n loadingText={deleteButtonTitle}\n onClick={onDeleteClick}\n >\n {deleteButtonTitle}\n </Button>\n <Button variant=\"outline\" ref={cancelButtonRef} onClick={onCancel}>\n {cancelButtonTitle}\n </Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Positioner>\n </Dialog.Root>\n );\n}\n"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"DeleteConfirmationDialog.js","sources":["DeleteConfirmationDialog.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Button, Dialog } from \"@chakra-ui/react\";\nimport { useEvent } from \"@open-pioneer/react-utils\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { useCallback, useMemo, useRef, useState, type ReactElement } from \"react\";\n\ninterface DeleteConfirmationDialogProps {\n readonly isOpen: boolean;\n readonly onDelete: () => Promise<void>;\n readonly onCancel: () => void;\n}\n\nexport function DeleteConfirmationDialog({\n isOpen,\n onDelete,\n onCancel\n}: DeleteConfirmationDialogProps): ReactElement {\n const [isDeleting, setDeleting] = useState(false);\n const cancelButtonRef = useRef<HTMLButtonElement>(null);\n const initialFocusEl = useCallback(() => cancelButtonRef.current, []);\n const { formatMessage } = useIntl();\n\n const onDeleteClick = useEvent(async () => {\n try {\n setDeleting(true);\n await onDelete();\n } finally {\n setDeleting(false);\n }\n });\n\n const { title, message, deleteButtonTitle, cancelButtonTitle } = useMemo(\n () => ({\n title: formatMessage({ id: \"deleteConfirmationDialog.title\" }),\n message: formatMessage({ id: \"deleteConfirmationDialog.message\" }),\n deleteButtonTitle: formatMessage({ id: \"deleteConfirmationDialog.deleteButtonTitle\" }),\n cancelButtonTitle: formatMessage({ id: \"deleteConfirmationDialog.cancelButtonTitle\" })\n }),\n [formatMessage]\n );\n\n return (\n <Dialog.Root open={isOpen} initialFocusEl={initialFocusEl} role=\"alertdialog\">\n <Dialog.Backdrop />\n <Dialog.Positioner>\n <Dialog.Content>\n <Dialog.Header fontSize=\"large\" fontWeight=\"bold\">\n {title}\n </Dialog.Header>\n <Dialog.Body>{message}</Dialog.Body>\n <Dialog.Footer>\n <Button\n bg=\"red.solid\"\n color=\"red.contrast\"\n _hover={{ bg: \"red.solid/90\" }}\n loading={isDeleting}\n loadingText={deleteButtonTitle}\n onClick={onDeleteClick}\n >\n {deleteButtonTitle}\n </Button>\n <Button variant=\"outline\" ref={cancelButtonRef} onClick={onCancel}>\n {cancelButtonTitle}\n </Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Positioner>\n </Dialog.Root>\n );\n}\n"],"names":[],"mappings":";;;;;;AAcO,SAAS,wBAAA,CAAyB;AAAA,EACrC,MAAA;AAAA,EACA,QAAA;AAAA,EACA;AACJ,CAAA,EAAgD;AAC5C,EAAA,MAAM,CAAC,UAAA,EAAY,WAAW,CAAA,GAAI,SAAS,KAAK,CAAA;AAChD,EAAA,MAAM,eAAA,GAAkB,OAA0B,IAAI,CAAA;AACtD,EAAA,MAAM,iBAAiB,WAAA,CAAY,MAAM,eAAA,CAAgB,OAAA,EAAS,EAAE,CAAA;AACpE,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,OAAA,EAAQ;AAElC,EAAA,MAAM,aAAA,GAAgB,SAAS,YAAY;AACvC,IAAA,IAAI;AACA,MAAA,WAAA,CAAY,IAAI,CAAA;AAChB,MAAA,MAAM,QAAA,EAAS;AAAA,IACnB,CAAA,SAAE;AACE,MAAA,WAAA,CAAY,KAAK,CAAA;AAAA,IACrB;AAAA,EACJ,CAAC,CAAA;AAED,EAAA,MAAM,EAAE,KAAA,EAAO,OAAA,EAAS,iBAAA,EAAmB,mBAAkB,GAAI,OAAA;AAAA,IAC7D,OAAO;A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