From bcdeea050dd4edd28de0ffa9957c63af688b3e49 Mon Sep 17 00:00:00 2001 From: Lero Date: Thu, 15 Oct 2026 18:56:28 +0300 Subject: [PATCH] feat: the json form wears Payload's own group frame --- .../src/components/JsonFormClient.tsx | 108 ++++++++++-------- .../src/components/jsonForm.scss | 35 +++--- 2 files changed, 80 insertions(+), 63 deletions(-) diff --git a/packages/payload-plugin-json-form-builder/src/components/JsonFormClient.tsx b/packages/payload-plugin-json-form-builder/src/components/JsonFormClient.tsx index ed4f13ae..aa75dd6d 100644 --- a/packages/payload-plugin-json-form-builder/src/components/JsonFormClient.tsx +++ b/packages/payload-plugin-json-form-builder/src/components/JsonFormClient.tsx @@ -14,6 +14,7 @@ import { FieldLabel, GearIcon, ListViewIcon, + useCollapsible, useDrawerSlug, useField, useModal, @@ -46,6 +47,7 @@ export const JsonFormClient = ({ library, mayBuild, shares: offered, ...props }: const { setValue, showError, value } = useField({ path, validate }); const { openModal } = useModal(); const builderSlug = useDrawerSlug("json-builder"); + const { isWithinCollapsible } = useCollapsible(); const dropSlug = useDrawerSlug("json-form-drop"); const [dropping, setDropping] = useState(""); const build = () => openModal(builderSlug); @@ -67,27 +69,20 @@ export const JsonFormClient = ({ library, mayBuild, shares: offered, ...props }: return ( <> - {field.admin?.description ? ( -
- -
- ) : null} -
0 && "json-form--alarmed")}> -
-

+
0 && "json-form--alarmed" + )} + > +
+

-

+

json
- {mayBuild && !bare && ( - <> - - - - - - )} {mayBuild && !bare && (
)} + {mayBuild && !bare && ( + <> + + + + + + )}
{unfilled.length > 0 ? ( @@ -190,7 +193,7 @@ export const JsonFormClient = ({ library, mayBuild, shares: offered, ...props }: style={{ transform, transition, zIndex: isDragging ? 1 : undefined }} >
-
- - {broken - ? "invalid" - : unfilled.length - ? `${unfilled.length} ${unfilled.length === 1 ? "error" : "errors"}` - : "valid"} - - {`${kept} ${kept === 1 ? "section" : "sections"}`} - {asCode && locked ? ( - read only — the gear builds the sections - ) : null} -
+ {field.admin?.description ? ( +
+ +
+ ) : null} {mayBuild && ( .json-form__add-row.btn:not(:only-child) { +.json-form__body > .json-form__actions:not(:only-child) { margin-top: var(--spacing-field, var(--base)); } .json-form__menu { @@ -791,7 +796,7 @@ body.json-builder-open { .json-form__said { - margin-block-end: calc(var(--base) * 0.6); + margin-block-start: calc(var(--base) * 0.6); } .json-builder__row {