diff --git a/.changeset/form-library-and-split.md b/.changeset/form-library-and-split.md new file mode 100644 index 00000000..1993471d --- /dev/null +++ b/.changeset/form-library-and-split.md @@ -0,0 +1,5 @@ +--- +"@openworkflowspec/diagram-editor": minor +--- + +Add react-hook-form and split node properties into separate read only and editable branches diff --git a/packages/open-workflow-diagram-editor/package.json b/packages/open-workflow-diagram-editor/package.json index f78d9e7b..4bfc10fd 100644 --- a/packages/open-workflow-diagram-editor/package.json +++ b/packages/open-workflow-diagram-editor/package.json @@ -51,6 +51,7 @@ "fast-equals": "catalog:", "js-yaml": "catalog:", "radix-ui": "catalog:", + "react-hook-form": "catalog:", "sonner": "catalog:", "use-sync-external-store": "catalog:" }, diff --git a/packages/open-workflow-diagram-editor/src/side-panel/EditableProperties.tsx b/packages/open-workflow-diagram-editor/src/side-panel/EditableProperties.tsx new file mode 100644 index 00000000..146c0bd0 --- /dev/null +++ b/packages/open-workflow-diagram-editor/src/side-panel/EditableProperties.tsx @@ -0,0 +1,29 @@ +/* + * Copyright 2021-Present The Open Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type { DetailField } from "@/core/taskDetails"; +import { ReadOnlyProperties } from "./ReadOnlyProperties"; + +/** + * Editable presentation of a task's properties. + * + * PLACEHOLDER. This change establishes the read-only/edit seam only, so the editable + * branch currently renders the same static rows as read-only mode until we implement + * + */ +export function EditableProperties({ fields }: { fields: DetailField[] }) { + return ; +} diff --git a/packages/open-workflow-diagram-editor/src/side-panel/FieldControls.tsx b/packages/open-workflow-diagram-editor/src/side-panel/FieldControls.tsx index e6df46da..e96d1af9 100644 --- a/packages/open-workflow-diagram-editor/src/side-panel/FieldControls.tsx +++ b/packages/open-workflow-diagram-editor/src/side-panel/FieldControls.tsx @@ -28,42 +28,44 @@ import { Switch } from "@/components/ui/switch"; import { Textarea } from "@/components/ui/textarea"; import { useI18n } from "@openworkflowspec/i18n"; +/** + * These controls are read only presentation of a field and are always disabled. + */ type ControlProps = { field: Extract; - isReadOnly: boolean; }; const ISO_8601_DURATION_REGEX = /^P(?=\d|T)(?:\d+Y)?(?:\d+M)?(?:\d+W)?(?:\d+D)?(?:T(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+(?:\.\d+)?S)?)?$/; -function LongStringControl({ field, isReadOnly }: ControlProps<"long-string">) { - return