@namroodinc/liquid-editorial 0.15.0 → 0.16.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/README.md +283 -12
- package/UPGRADING.md +59 -0
- package/dist/chunks/EntryPicker-C7EBfpaw.cjs +2 -0
- package/dist/chunks/EntryPicker-C7EBfpaw.cjs.map +1 -0
- package/dist/chunks/{EntryPicker-BGWxiLJ_.js → EntryPicker-DBnDsgzi.js} +395 -395
- package/dist/chunks/EntryPicker-DBnDsgzi.js.map +1 -0
- package/dist/chunks/FormEditor-BG8bOXI8.js +35 -0
- package/dist/chunks/FormEditor-BG8bOXI8.js.map +1 -0
- package/dist/chunks/FormEditor-BJN0QuLI.cjs +2 -0
- package/dist/chunks/FormEditor-BJN0QuLI.cjs.map +1 -0
- package/dist/chunks/{NumberField-C90eJGny.js → NumberField-CVsK4l9P.js} +13 -13
- package/dist/chunks/{NumberField-C90eJGny.js.map → NumberField-CVsK4l9P.js.map} +1 -1
- package/dist/chunks/{NumberField-BrWFmPkW.cjs → NumberField-Ccjpa_1d.cjs} +2 -2
- package/dist/chunks/{NumberField-BrWFmPkW.cjs.map → NumberField-Ccjpa_1d.cjs.map} +1 -1
- package/dist/chunks/RichTextEditor-D4rNww9d.cjs +2 -0
- package/dist/chunks/RichTextEditor-D4rNww9d.cjs.map +1 -0
- package/dist/chunks/{RichTextEditor-CS2ED0HP.js → RichTextEditor-DSxiMLVd.js} +1147 -1017
- package/dist/chunks/RichTextEditor-DSxiMLVd.js.map +1 -0
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.cjs.map +1 -1
- package/dist/components/Choice/index.js +5 -5
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/FormEditor/README.md +150 -161
- package/dist/components/FormEditor/control.d.cts +4 -4
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts +4 -4
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/form.d.cts +3 -3
- package/dist/components/FormEditor/form.d.cts.map +1 -1
- package/dist/components/FormEditor/form.d.ts +3 -3
- package/dist/components/FormEditor/form.d.ts.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.js +2 -2
- package/dist/components/FormEditor/model.d.cts +2 -0
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +2 -0
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/FormEditor/rich-text-control.d.cts +1 -2
- package/dist/components/FormEditor/rich-text-control.d.cts.map +1 -1
- package/dist/components/FormEditor/rich-text-control.d.ts +1 -2
- package/dist/components/FormEditor/rich-text-control.d.ts.map +1 -1
- package/dist/components/ImageCropper/index.cjs +1 -1
- package/dist/components/ImageCropper/index.cjs.map +1 -1
- package/dist/components/ImageCropper/index.js +6 -6
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/RichTextEditor/block-plugins.d.cts +62 -0
- package/dist/components/RichTextEditor/block-plugins.d.cts.map +1 -0
- package/dist/components/RichTextEditor/block-plugins.d.ts +62 -0
- package/dist/components/RichTextEditor/block-plugins.d.ts.map +1 -0
- package/dist/components/RichTextEditor/content-block-view.d.cts +1 -1
- package/dist/components/RichTextEditor/content-block-view.d.cts.map +1 -1
- package/dist/components/RichTextEditor/content-block-view.d.ts +1 -1
- package/dist/components/RichTextEditor/content-block-view.d.ts.map +1 -1
- package/dist/components/RichTextEditor/content-block.d.cts +7 -21
- package/dist/components/RichTextEditor/content-block.d.cts.map +1 -1
- package/dist/components/RichTextEditor/content-block.d.ts +7 -21
- package/dist/components/RichTextEditor/content-block.d.ts.map +1 -1
- package/dist/components/RichTextEditor/document.d.cts +16 -3
- package/dist/components/RichTextEditor/document.d.cts.map +1 -1
- package/dist/components/RichTextEditor/document.d.ts +16 -3
- package/dist/components/RichTextEditor/document.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.d.cts +6 -4
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts +6 -4
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RichTextEditor/picker-block.d.cts +25 -0
- package/dist/components/RichTextEditor/picker-block.d.cts.map +1 -0
- package/dist/components/RichTextEditor/picker-block.d.ts +25 -0
- package/dist/components/RichTextEditor/picker-block.d.ts.map +1 -0
- package/dist/components/RichTextEditor/use-blocks.d.cts +19 -0
- package/dist/components/RichTextEditor/use-blocks.d.cts.map +1 -0
- package/dist/components/RichTextEditor/use-blocks.d.ts +19 -0
- package/dist/components/RichTextEditor/use-blocks.d.ts.map +1 -0
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.cjs.map +1 -1
- package/dist/components/SelectionCard/index.js +4 -4
- package/dist/components/SelectionCard/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -46
- package/dist/internal/useStableValue.d.cts +8 -0
- package/dist/internal/useStableValue.d.cts.map +1 -0
- package/dist/internal/useStableValue.d.ts +8 -0
- package/dist/internal/useStableValue.d.ts.map +1 -0
- package/dist/rich-text-blocks.cjs +2 -0
- package/dist/rich-text-blocks.cjs.map +1 -0
- package/dist/rich-text-blocks.d.cts +20 -0
- package/dist/rich-text-blocks.d.cts.map +1 -0
- package/dist/rich-text-blocks.d.ts +20 -0
- package/dist/rich-text-blocks.d.ts.map +1 -0
- package/dist/rich-text-blocks.js +36 -0
- package/dist/rich-text-blocks.js.map +1 -0
- package/package.json +14 -1
- package/dist/chunks/EntryPicker-BGWxiLJ_.js.map +0 -1
- package/dist/chunks/EntryPicker-wVjzdlAO.cjs +0 -2
- package/dist/chunks/EntryPicker-wVjzdlAO.cjs.map +0 -1
- package/dist/chunks/FormEditor-BHVJG23r.js +0 -30
- package/dist/chunks/FormEditor-BHVJG23r.js.map +0 -1
- package/dist/chunks/FormEditor-DjUz7qQo.cjs +0 -2
- package/dist/chunks/FormEditor-DjUz7qQo.cjs.map +0 -1
- package/dist/chunks/RichTextEditor-BgfeOrEe.cjs +0 -2
- package/dist/chunks/RichTextEditor-BgfeOrEe.cjs.map +0 -1
- package/dist/chunks/RichTextEditor-CS2ED0HP.js.map +0 -1
- package/dist/components/RichTextEditor/embed-context.d.cts +0 -41
- package/dist/components/RichTextEditor/embed-context.d.cts.map +0 -1
- package/dist/components/RichTextEditor/embed-context.d.ts +0 -41
- package/dist/components/RichTextEditor/embed-context.d.ts.map +0 -1
- package/dist/components/RichTextEditor/embed-types.d.cts +0 -29
- package/dist/components/RichTextEditor/embed-types.d.cts.map +0 -1
- package/dist/components/RichTextEditor/embed-types.d.ts +0 -29
- package/dist/components/RichTextEditor/embed-types.d.ts.map +0 -1
- package/dist/components/RichTextEditor/use-embeds.d.cts +0 -31
- package/dist/components/RichTextEditor/use-embeds.d.cts.map +0 -1
- package/dist/components/RichTextEditor/use-embeds.d.ts +0 -31
- package/dist/components/RichTextEditor/use-embeds.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),t=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs"),n=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),t=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs"),n=require("../../chunks/style-nulIa2_8.cjs"),r=require("../Grid/index.cjs");let i=require("react"),a=require("react/jsx-runtime");var o=e=>{e.preventDefault(),e.stopPropagation()};function s(e,{disabled:n,isFocusableWhenDisabled:r,name:i,required:a,...s}){let c=!!(n&&r);return t.t(()=>{let t=e.current;if(t&&c)return t.addEventListener(`click`,o),()=>t.removeEventListener(`click`,o)},[e,c]),c?{...s,"aria-disabled":!0,"data-disabled":``}:{...s,disabled:n,name:i,required:a}}var c=(0,i.forwardRef)(function({isIndeterminate:t=!1,className:n,children:r,...o},c){let l=(0,i.useRef)(null),u=s(l,o);return(0,i.useEffect)(()=>{l.current&&(l.current.indeterminate=t)},[t]),(0,a.jsxs)(`label`,{className:[`ds-choice`,n].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{type:`checkbox`,className:`ds-choice__control ds-indicator`,"data-kind":`checkbox`,ref:e.t(l,c),...u}),r&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:r})]})}),l=(0,i.forwardRef)(function({className:t,children:n,...r},o){let c=(0,i.useRef)(null),l=s(c,r);return(0,a.jsxs)(`label`,{className:[`ds-choice`,t].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{ref:e.t(c,o),type:`radio`,className:`ds-choice__control ds-indicator`,"data-kind":`radio`,...l}),n&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:n})]})});function u({label:e,columns:t=1,children:i,className:o,...s}){return(0,a.jsx)(n.t,{...s,label:e,className:[`ds-choice-group`,o].filter(Boolean).join(` `),children:t===1?(0,a.jsx)(r.Stack,{gap:`sm`,children:i}):(0,a.jsx)(r.Grid,{columns:t,gap:`sm`,className:`ds-choice-group__grid ds-field-group-grid`,style:{"--field-group-columns":t},children:i})})}exports.Checkbox=c,exports.ChoiceGroup=u,exports.Radio=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","useRef","mergeRefs","FieldGroup","Stack","Grid","require_mergeRefs","require_useIsomorphicLayoutEffect","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","useRef","mergeRefs","FieldGroup","Stack","Grid","require_mergeRefs","require_useIsomorphicLayoutEffect","require_style","require_components_Grid_index","react","react_jsx_runtime","refuse","event","useChoiceInput","rest","keepsFocus","disabled","isFocusableWhenDisabled","node","input","Checkbox","inner","inputProps","isIndeterminate","className","ref","children","Radio","ChoiceGroup","fieldProps","columns"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useIsomorphicLayoutEffect } from \"../../internal/useIsomorphicLayoutEffect\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\ntype ChoiceInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> & {\n /**\n * With `disabled`, keep the control focusable so it can be reached and\n * described: it is marked `aria-disabled` instead of native `disabled` and\n * keeps the disabled look. As with native `disabled`, presses change nothing\n * and run no click or change handlers, and the control is left out of form\n * submission and validation.\n */\n isFocusableWhenDisabled?: boolean;\n};\n\nconst refuse = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n};\n\n/**\n * The native input's props. A focusable disabled choice stops each press on\n * the input itself, before React or an ancestor sees it, and cancels it, so\n * the browser restores the checked and indeterminate states and nothing\n * reports a change. It renders without `name` and `required`, which keeps it\n * out of submission and validation as native `disabled` would; a radio then\n * also leaves its group's arrow-key order. `aria-disabled` set directly is\n * passed through without blocking.\n */\nfunction useChoiceInput(\n input: RefObject<HTMLInputElement | null>,\n { disabled, isFocusableWhenDisabled, name, required, ...rest }: ChoiceInputProps,\n) {\n const keepsFocus = Boolean(disabled && isFocusableWhenDisabled);\n useIsomorphicLayoutEffect(() => {\n const node = input.current;\n if (!node || !keepsFocus) {\n return;\n }\n node.addEventListener(\"click\", refuse);\n return () => node.removeEventListener(\"click\", refuse);\n }, [input, keepsFocus]);\n return keepsFocus\n ? { ...rest, \"aria-disabled\": true, \"data-disabled\": \"\" }\n : { ...rest, disabled, name, required };\n}\n\nexport interface CheckboxProps extends ChoiceInputProps {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n\n useEffect(() => {\n if (inner.current) {\n inner.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"checkbox\"\n ref={mergeRefs(inner, ref)}\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends ChoiceInputProps {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={mergeRefs(inner, ref)}\n type=\"radio\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"radio\"\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n className=\"ds-choice-group__grid ds-field-group-grid\"\n style={{ \"--field-group-columns\": columns } as CSSProperties}\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\n );\n}\n"],"mappings":"A,6TA0BA,IAAMY,EAAU,GAAiB,CAC/BC,EAAM,eAAe,EACrBA,EAAM,gBAAgB,CACxB,EAWA,SAASC,EACP,EACA,CAAE,WAAU,0BAAyB,OAAM,WAAU,GAAGC,GACxD,CACA,IAAMC,EAAa,GAAQC,GAAYC,GASvC,OARAX,EAAA,MAAgC,CAC9B,IAAMY,EAAOC,EAAM,QACnB,GAAKD,GAASH,EAId,OADAG,EAAK,iBAAiB,QAASP,CAAM,MACxBO,EAAK,oBAAoB,QAASP,CAAM,CACvD,EAAG,CAACQ,EAAOJ,CAAU,CAAC,EACfA,EACH,CAAE,GAAGD,EAAM,gBAAiB,GAAM,gBAAiB,EAAG,EACtD,CAAE,GAAGA,EAAM,WAAU,OAAM,UAAS,CAC1C,CASA,IAAaM,GAAA,EAAWrB,EAAAA,WAAAA,CAA4C,SAClE,CAAE,kBAAkB,GAAO,YAAW,WAAU,GAAGe,GACnD,EACA,CACA,IAAMO,GAAA,EAAQrB,EAAAA,OAAAA,CAAgC,IAAI,EAC5CsB,EAAaT,EAAeQ,EAAOP,CAAI,EAQ7C,OANA,EAAAL,EAAA,UAAA,KAAgB,CACVY,EAAM,UACR,EAAM,QAAQ,cAAgBE,EAElC,EAAG,CAACA,CAAe,CAAC,GAGlB,EAAAb,EAAA,KAAA,CAAC,QAAD,CAAO,UAAW,CAAC,YAAac,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAAnE,SAAA,EACE,EAAAd,EAAA,IAA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@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "../../chunks/mergeRefs-C6_5pADN.js";
|
|
2
2
|
import { t } from "../../chunks/useIsomorphicLayoutEffect-Bc9hxFMc.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { t as n } from "../../chunks/style-7Z_xRlQx.js";
|
|
4
|
+
import { Grid as r, Stack as i } from "../Grid/index.js";
|
|
5
5
|
import { forwardRef as a, useEffect as o, useRef as s } from "react";
|
|
6
6
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/Choice/index.tsx
|
|
@@ -58,14 +58,14 @@ var f = a(function({ isIndeterminate: t = !1, className: n, children: r, ...i },
|
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
60
|
function m({ label: e, columns: t = 1, children: a, className: o, ...s }) {
|
|
61
|
-
return /* @__PURE__ */ c(
|
|
61
|
+
return /* @__PURE__ */ c(n, {
|
|
62
62
|
...s,
|
|
63
63
|
label: e,
|
|
64
64
|
className: ["ds-choice-group", o].filter(Boolean).join(" "),
|
|
65
|
-
children: t === 1 ? /* @__PURE__ */ c(
|
|
65
|
+
children: t === 1 ? /* @__PURE__ */ c(i, {
|
|
66
66
|
gap: "sm",
|
|
67
67
|
children: a
|
|
68
|
-
}) : /* @__PURE__ */ c(
|
|
68
|
+
}) : /* @__PURE__ */ c(r, {
|
|
69
69
|
columns: t,
|
|
70
70
|
gap: "sm",
|
|
71
71
|
className: "ds-choice-group__grid ds-field-group-grid",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/EntryPicker-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/EntryPicker-C7EBfpaw.cjs");exports.EntryPicker=e.t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as EntryPicker } from "../../chunks/EntryPicker-
|
|
1
|
+
export { t as EntryPicker } from "../../chunks/EntryPicker-DBnDsgzi.js";
|
|
@@ -86,7 +86,7 @@ exports. Import the aggregate stylesheet with either entry point. The optional
|
|
|
86
86
|
| `value` | `FormValues` | Omit for uncontrolled state; controlled callers must echo changes. |
|
|
87
87
|
| `defaultValue` | `FormValues` | `{}`; initial uncontrolled values only. |
|
|
88
88
|
| `onValueChange` | `(values, { fieldId }) => void` | Reports the complete next values and the edited field ID. |
|
|
89
|
-
| `
|
|
89
|
+
| `blockPlugins` | `Record<string, readonly ContentBlockPlugin[]>` | Rich-text plug-ins keyed by field ID. Register the same definitions on the field schema. |
|
|
90
90
|
| `pickerItems` | `Record<string, EntryItem[]>` | `{}`; available assets/entries keyed by field ID. |
|
|
91
91
|
| `errors` | `FormErrors` | `{}`; app messages override built-in errors. Clear stale app errors explicitly. |
|
|
92
92
|
| `showAllErrors` | Boolean | `false`; reveal built-in required/format errors, usually after submission. |
|
|
@@ -161,7 +161,7 @@ are not automatically schema options.
|
|
|
161
161
|
| --- | --- | --- |
|
|
162
162
|
| `shortText` | `inputType: "text" \| "email"` (`text`), `maxLength`, `readOnly: false`, `autoFocus: false` | String; empty text remains `""`. |
|
|
163
163
|
| `longText` | `rows: 3`, `maxLength`, `readOnly: false`, `autoFocus: false` | String. |
|
|
164
|
-
| `richText` | `placeholder: "Write something…"`, `expandedWidth: "wide" \| "full"` (`wide`; any other runtime value throws), `tables: true` (false removes table insertion and rejects table nodes; a non-boolean runtime value throws); no autofocus | TipTap JSON document rooted at `doc`. |
|
|
164
|
+
| `richText` | `placeholder: "Write something…"`, `expandedWidth: "wide" \| "full"` (`wide`; any other runtime value throws), `tables: true` (false removes table insertion and rejects table nodes; a non-boolean runtime value throws), `blockDefinitions: ContentBlockDefinition[]` (none; the block types the field accepts, see [content block plug-ins](#rich-text-content-block-plug-ins); a non-array, duplicate or malformed runtime value throws with the field ID); no autofocus | TipTap JSON document rooted at `doc`. |
|
|
165
165
|
| `number` | `min`, `max`, `step: number \| "any"` (`"any"`), `hasSteppers: true`, `decreaseLabel` / `increaseLabel` (`"Decrease {label}"` / `"Increase {label}"`), `prefix`, `suffix` (strings), `autoFocus: false` | Finite number. |
|
|
166
166
|
| `boolean` | `autoFocus: false`; always a Switch | Boolean; `false` satisfies required. |
|
|
167
167
|
| `dateTime` | Native browser date-and-time input; `autoFocus: false`; label gets `(UTC)` | UTC ISO string ending in `Z`, including milliseconds. |
|
|
@@ -375,9 +375,9 @@ or `right`. An omitted or null value displays as left. HTML reads inline
|
|
|
375
375
|
`text-align` on `<td>` and `<th>`, so keep that property in HTML sanitizers.
|
|
376
376
|
Set the same left default in the delivery renderer.
|
|
377
377
|
|
|
378
|
-
Pasting or dropping a selection that contains
|
|
379
|
-
into a cell rejects the entire operation, including mixed
|
|
380
|
-
Previously saved
|
|
378
|
+
Pasting or dropping a selection that contains a Content Block of any
|
|
379
|
+
registered type into a cell rejects the entire operation, including mixed
|
|
380
|
+
selections with text. Previously saved blocks inside a cell still load.
|
|
381
381
|
|
|
382
382
|
Tables without stored widths save as a `<table>` with a `<tbody>` and no inline
|
|
383
383
|
sizing. A table with any stored column width saves with its sizing:
|
|
@@ -738,7 +738,7 @@ See the packaged UPGRADING.md for removed styling APIs.
|
|
|
738
738
|
each selected ID's copy from before a refresh until a fresh one arrives.
|
|
739
739
|
Translate clear events and Field bindings here. Rich text is the one adapter
|
|
740
740
|
`control.tsx` does not import: `rich-text-control.tsx` renders RichTextEditor,
|
|
741
|
-
forwarding `expandedWidth` and
|
|
741
|
+
forwarding `expandedWidth`, `tables` and registered content block plug-ins, and `index.tsx` supplies it through
|
|
742
742
|
`RichTextControlContext`. RichTextEditor's `tables.tsx` handles the quick
|
|
743
743
|
grid and renders the custom size form with `FormEditorCore` from `form.tsx`,
|
|
744
744
|
so the two components
|
|
@@ -815,163 +815,152 @@ Refused results keep a focusable `aria-disabled` checkbox, described by the
|
|
|
815
815
|
reason or, at the cap, by a full-selection note. Applications confirm
|
|
816
816
|
missing records and remove links when saving; FormEditor never drops selections.
|
|
817
817
|
|
|
818
|
-
## Rich-text
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
`
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
usage ring against. Insert selected commits the selected items as
|
|
837
|
-
consecutive content blocks in selection order, with one undo step. Closing the
|
|
838
|
-
dialog discards the pending selection. Replace still chooses one item, and New
|
|
839
|
-
creates and inserts one item when the selection is empty. While a creation is
|
|
840
|
-
pending (`isCreating`), rows can't be selected, so staging and creation never
|
|
841
|
-
compete for the same insertion. Embed sources ignore EntryPicker's `mode` and
|
|
842
|
-
`max`, including on a source spread from a field's picker source.
|
|
843
|
-
|
|
844
|
-
Give a source with `loadPage` a `resolveItem`. After a `refreshKey` change,
|
|
845
|
-
Insert selected waits for `resolveItem` to check each staged item, even when
|
|
846
|
-
refreshed search results already list it. The inserted content block uses the
|
|
847
|
-
confirmed copy from the current refresh immediately. The picker deselects items
|
|
848
|
-
that `resolveItem` returns as null, removed, unavailable or disabled, and any
|
|
849
|
-
that a results page at the current refresh shows as removed, unavailable,
|
|
850
|
-
disabled or otherwise restricted, since a page can refuse an item but only
|
|
851
|
-
`resolveItem` confirms one. It reports
|
|
852
|
-
the change in the footer and re-enables Insert selected for the rest.
|
|
853
|
-
If `resolveItem` rejects, the dialog shows
|
|
854
|
-
"Couldn't load selected entries" (or assets) with Try again, and Insert selected
|
|
855
|
-
stays disabled until a retry succeeds. Without `resolveItem`, a
|
|
856
|
-
staged item is checked again only if a refreshed page shows it; one that no
|
|
857
|
-
longer appears keeps its earlier copy and is inserted. Static `items` sources
|
|
858
|
-
deselect an item as soon as it leaves `items`.
|
|
859
|
-
|
|
860
|
-
Entry rows use the existing `EntryItem` contract with an additional `modelId`
|
|
861
|
-
containing a readable model API ID; `item.id` identifies the selected entry.
|
|
862
|
-
Asset rows need only the existing item contract. A row that can't become a block
|
|
863
|
-
is restricted in the dialog, as an application's own `isDisabled` row would be,
|
|
864
|
-
rather than ignoring the pick or producing an invalid block. The reasons are:
|
|
865
|
-
|
|
866
|
-
- a removed item (`tone: "removed"`): its `removedLabel`, or "Removed";
|
|
867
|
-
- an item with `isUnavailable`: "Unavailable", in insertion, replacement and
|
|
868
|
-
for an item committed after creation;
|
|
869
|
-
- an entry without `modelId`, or a blank ID: "Can't embed".
|
|
818
|
+
## Rich-text content block plug-ins
|
|
819
|
+
|
|
820
|
+
A rich-text field accepts `blockDefinitions`, an optional list of pure
|
|
821
|
+
`ContentBlockDefinition` values. Supply those same definition objects in
|
|
822
|
+
`blockPlugins[fieldId]` to give each type an editor preview and actions.
|
|
823
|
+
`validateFormValues` uses the field's definitions. A valid block satisfies a
|
|
824
|
+
required field. An unsupported or malformed block protects the field value and
|
|
825
|
+
displays an error. Register every block type that can appear in the field, even
|
|
826
|
+
when an author has no insert permission. Standalone `RichTextEditor.blockPlugins`
|
|
827
|
+
supplies both the definitions and runtime behavior. The package README's
|
|
828
|
+
[Rich-text content blocks](../../../README.md#rich-text-content-blocks) guide
|
|
829
|
+
builds a complete plug-in, with its dialog, preview and server validation.
|
|
830
|
+
|
|
831
|
+
Define plug-ins and their definitions once, outside render, or memoize them.
|
|
832
|
+
Blocks render again when their plug-in object changes, and checks run again
|
|
833
|
+
when a definition changes. `createPickerBlockPlugin` is the exception: call it
|
|
834
|
+
on every render with the current source, and blocks render again only when the
|
|
835
|
+
source's items, refresh key, resolver or item editor change.
|
|
870
836
|
|
|
871
837
|
```tsx
|
|
872
|
-
import
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
838
|
+
import { useMemo } from "react";
|
|
839
|
+
import {
|
|
840
|
+
FormEditor as BlockFormEditor,
|
|
841
|
+
type ContentBlockPlugin,
|
|
842
|
+
} from "@namroodinc/liquid-editorial";
|
|
843
|
+
import type { ContentBlockDefinition } from "@namroodinc/liquid-editorial/rich-text-blocks";
|
|
844
|
+
|
|
845
|
+
const mapDefinition: ContentBlockDefinition = {
|
|
846
|
+
type: "map",
|
|
847
|
+
validate: ({ latitude, longitude }) =>
|
|
848
|
+
typeof latitude === "number" &&
|
|
849
|
+
Math.abs(latitude) <= 90 &&
|
|
850
|
+
typeof longitude === "number" &&
|
|
851
|
+
Math.abs(longitude) <= 180,
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
export function StoryForm({
|
|
855
|
+
renderMapForm,
|
|
856
|
+
}: {
|
|
857
|
+
renderMapForm: ContentBlockPlugin["renderEditor"];
|
|
858
|
+
}) {
|
|
859
|
+
const map = useMemo(
|
|
860
|
+
() =>
|
|
861
|
+
({
|
|
862
|
+
definition: mapDefinition,
|
|
863
|
+
label: "Map",
|
|
864
|
+
icon: "globe",
|
|
865
|
+
insertLabel: "Insert map",
|
|
866
|
+
editLabel: "Edit map",
|
|
867
|
+
renderPreview: ({ latitude, longitude }, frame) =>
|
|
868
|
+
frame({ body: <p>{String(latitude)}, {String(longitude)}</p> }),
|
|
869
|
+
renderEditor: renderMapForm,
|
|
870
|
+
}) satisfies ContentBlockPlugin,
|
|
871
|
+
[renderMapForm],
|
|
872
|
+
);
|
|
873
|
+
|
|
874
|
+
return (
|
|
875
|
+
<BlockFormEditor
|
|
876
|
+
schema={{
|
|
877
|
+
fields: [
|
|
878
|
+
{ id: "body", type: "richText", label: "Body", blockDefinitions: [mapDefinition] },
|
|
879
|
+
],
|
|
880
|
+
}}
|
|
881
|
+
blockPlugins={{ body: [map] }}
|
|
882
|
+
/>
|
|
883
|
+
);
|
|
888
884
|
}
|
|
889
|
-
// <FormEditor schema={schema} embedSources={{ body: embeddedResources(...) }} ... />
|
|
890
885
|
```
|
|
891
886
|
|
|
892
|
-
`
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
`
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
the
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
The architecture remains `FormEditor → RichTextEditor → content block node views`,
|
|
973
|
-
with both ordinary pickers and editor dialogs using `usePickerSession` (search,
|
|
974
|
-
paging, selection rules, edit dismissal and the shared PickerDialog props),
|
|
975
|
-
PickerDialog, EntryRow and the selected-item reader. Remote embed batches that
|
|
976
|
-
have a resolver use search pages for the results and the selected-item reader
|
|
977
|
-
for rechecks. Applications supply data and resource editors.
|
|
887
|
+
`renderEditor` receives a `ContentBlockSession`. Render a dialog component
|
|
888
|
+
with its `data` as the initial value in edit or replace mode. After validating
|
|
889
|
+
the inputs, call `target.commit({ latitude, longitude })`, and call
|
|
890
|
+
`target.close()` on cancellation. `commit` returns a boolean and insertion can
|
|
891
|
+
also commit an array in one undo step. For previews that need hooks, return a
|
|
892
|
+
component from `renderPreview` and let that component call `frame` with the
|
|
893
|
+
title, body and optional status or resource edit action. The frame provides
|
|
894
|
+
selection, dragging, alignment and removal. Wrap the body in
|
|
895
|
+
`.ds-content-block__body` for the frame's padding and type size.
|
|
896
|
+
|
|
897
|
+
Plug-in blocks are atomic: writers edit their data only through the plug-in's
|
|
898
|
+
dialog. Tables aren't plug-ins, because writers edit their cells in place.
|
|
899
|
+
They are TableKit schema nodes that reuse the frame, title bar and actions
|
|
900
|
+
menu, and their type name, `table`, is reserved.
|
|
901
|
+
|
|
902
|
+
Block type names are unique lowercase identifiers beginning with a letter.
|
|
903
|
+
Use letters, digits and hyphens. The editor reserves `table`.
|
|
904
|
+
JSON stores `{ type: "contentBlock", attrs: { type: "map", align: "full",
|
|
905
|
+
data: { latitude: 51.5, longitude: -0.12 } } }`. Alignment is `left`, `full` or
|
|
906
|
+
`right`; an omitted `align` reads as `full`, and the editor always writes it.
|
|
907
|
+
The HTML node is a `div` with `data-content-block`,
|
|
908
|
+
`data-content-block-type`, `data-content-block-align` and the JSON string in
|
|
909
|
+
`data-content-block-data`. Only those attributes are read, so a block element's
|
|
910
|
+
own `type`, `align` or `data` attributes never change the stored block. Import `contentBlockRegistry` and `validContentBlock`
|
|
911
|
+
from the browser-independent `rich-text-blocks` entry point to validate the
|
|
912
|
+
same payload on the server. Applications define what to publish and how to
|
|
913
|
+
render it in delivery.
|
|
914
|
+
|
|
915
|
+
### Blocks that use a picker
|
|
916
|
+
|
|
917
|
+
Use `createPickerBlockPlugin` for blocks chosen from an EntryPicker. Supply
|
|
918
|
+
the definition, singular and plural labels, icon, picker source, `toData(item)`
|
|
919
|
+
and `itemId(data)`. The source can provide static `items`, remote `loadPage`,
|
|
920
|
+
`resolveItem`, `onEditItem` and `onCreate`. Resolve-only sources show existing
|
|
921
|
+
blocks. Applications define which items are eligible and which attributes to
|
|
922
|
+
store. Resolved previews stay in editor state.
|
|
923
|
+
|
|
924
|
+
Insertion from listed choices stages selections across queries and pages, then
|
|
925
|
+
commits them in order. Replacement chooses one item and keeps alignment.
|
|
926
|
+
Restricted, removed or unavailable items cannot be committed. Give remote
|
|
927
|
+
sources a resolver so a refresh can recheck staged items. A failed recheck
|
|
928
|
+
blocks insertion until retry succeeds. `onCreate` gets a picker target that
|
|
929
|
+
commits the created item after the application rechecks permissions and
|
|
930
|
+
availability. While creating, the picker suspends other selections. Use
|
|
931
|
+
`isCreating` and `isDialogHidden` to coordinate asynchronous drawers and
|
|
932
|
+
temporarily disable the parent form.
|
|
933
|
+
|
|
934
|
+
A target checks the live editor, registration and document position.
|
|
935
|
+
Insertion is anchored after the current top-level block and replacement follows
|
|
936
|
+
its original block through alignment changes. Deletion, a change to the
|
|
937
|
+
target's data or editor disposal invalidates the session. An ordinary
|
|
938
|
+
read-only transition closes the session. A plug-in can finish its own pending
|
|
939
|
+
creation while the application temporarily disables the form.
|
|
940
|
+
|
|
941
|
+
The editor refuses any change that would leave an unregistered or invalid
|
|
942
|
+
block in the document, whether it comes from a paste, a drop, a toolbar command
|
|
943
|
+
or an attribute update. The editor's own documents therefore always pass
|
|
944
|
+
validation. A document from elsewhere is checked when it arrives, and the whole
|
|
945
|
+
document is checked again when the definitions change. A document that no longer
|
|
946
|
+
passes protects the field until its plug-ins return.
|
|
947
|
+
|
|
948
|
+
The editor and FormEditor validate one generic node with the pure definition
|
|
949
|
+
registry. `index.tsx` owns validation and the change guard, `use-blocks.tsx`
|
|
950
|
+
owns the transaction and dialog target, `block-plugins.ts` owns the node views'
|
|
951
|
+
registration snapshot, `content-block-view.tsx` renders a plug-in block in the
|
|
952
|
+
shared frame, and `picker-block.tsx` adapts the optional picker workflow.
|
|
953
|
+
Applications register type-specific previews, data and editors.
|
|
954
|
+
|
|
955
|
+
Tables join the frame without the plug-in registry. `document.ts` adds
|
|
956
|
+
TableKit's `table`, `tableRow`, `tableHeader` and `tableCell` nodes to the
|
|
957
|
+
schema when `tables` is on, so validation reads them as schema content, not
|
|
958
|
+
payloads. `table-view.tsx` gives the table node a ProseMirror node view that
|
|
959
|
+
wraps it in `contentBlockFrameClass` and mounts `ContentBlockBar` from
|
|
960
|
+
`content-block-frame.tsx`, with the table's actions from `table-actions.ts`.
|
|
961
|
+
It reads the read-only state from the same `BlockContext`. The toolbar's
|
|
962
|
+
`TableControl` in `tables.tsx` inserts tables, separately from the plug-in
|
|
963
|
+
insert buttons. A new block with editable content follows that route: a schema
|
|
964
|
+
node and node view in the library, not a plug-in. `src/test/mapBlock.tsx` is
|
|
965
|
+
the plug-in route's reference: the README guide shows it, and a test keeps the
|
|
966
|
+
two in step.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ContentBlockPlugin } from "../RichTextEditor/index.cjs";
|
|
3
3
|
import { type EntryItem, type EntryPickerSource } from "../EntryPicker/index.cjs";
|
|
4
4
|
import type { FieldRenderProps } from "../Field/index.cjs";
|
|
5
5
|
import { type FieldOf, type FormField, type FormFieldValue } from "./model.cjs";
|
|
@@ -13,7 +13,7 @@ export interface ControlProps<F extends FormField> {
|
|
|
13
13
|
onChange: (value: FormFieldValue | undefined) => void;
|
|
14
14
|
}
|
|
15
15
|
export type RichTextControlProps = ControlProps<FieldOf<"richText">> & {
|
|
16
|
-
|
|
16
|
+
blockPlugins?: readonly ContentBlockPlugin[];
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* Renders the rich-text adapter, supplied by FormEditor's entry point. Controls
|
|
@@ -21,7 +21,7 @@ export type RichTextControlProps = ControlProps<FieldOf<"richText">> & {
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const RichTextControlContext: import("react").Context<((props: RichTextControlProps) => ReactNode) | null>;
|
|
23
23
|
interface FormControlProps {
|
|
24
|
-
|
|
24
|
+
blockPlugins?: readonly ContentBlockPlugin[];
|
|
25
25
|
field: FormField;
|
|
26
26
|
stored: FormFieldValue | undefined;
|
|
27
27
|
/** Picker fields' stored IDs, derived once by the owning field. */
|
|
@@ -32,6 +32,6 @@ interface FormControlProps {
|
|
|
32
32
|
accessibility: Accessibility;
|
|
33
33
|
onChange: (value: FormFieldValue | undefined) => void;
|
|
34
34
|
}
|
|
35
|
-
export declare function FormControl({
|
|
35
|
+
export declare function FormControl({ blockPlugins, field, stored, selected, items, source, isDisabled, accessibility: { required, ...accessibility }, onChange, }: FormControlProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
36
36
|
export {};
|
|
37
37
|
//# sourceMappingURL=control.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"control.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMjD,OAAO,EAKL,KAAK,OAAO,EACZ,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,EAAE,EAC7C,QAAQ,GACT,EAAE,gBAAgB,+TA+FlB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ContentBlockPlugin } from "../RichTextEditor/index.js";
|
|
3
3
|
import { type EntryItem, type EntryPickerSource } from "../EntryPicker/index.js";
|
|
4
4
|
import type { FieldRenderProps } from "../Field/index.js";
|
|
5
5
|
import { type FieldOf, type FormField, type FormFieldValue } from "./model.js";
|
|
@@ -13,7 +13,7 @@ export interface ControlProps<F extends FormField> {
|
|
|
13
13
|
onChange: (value: FormFieldValue | undefined) => void;
|
|
14
14
|
}
|
|
15
15
|
export type RichTextControlProps = ControlProps<FieldOf<"richText">> & {
|
|
16
|
-
|
|
16
|
+
blockPlugins?: readonly ContentBlockPlugin[];
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* Renders the rich-text adapter, supplied by FormEditor's entry point. Controls
|
|
@@ -21,7 +21,7 @@ export type RichTextControlProps = ControlProps<FieldOf<"richText">> & {
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const RichTextControlContext: import("react").Context<((props: RichTextControlProps) => ReactNode) | null>;
|
|
23
23
|
interface FormControlProps {
|
|
24
|
-
|
|
24
|
+
blockPlugins?: readonly ContentBlockPlugin[];
|
|
25
25
|
field: FormField;
|
|
26
26
|
stored: FormFieldValue | undefined;
|
|
27
27
|
/** Picker fields' stored IDs, derived once by the owning field. */
|
|
@@ -32,6 +32,6 @@ interface FormControlProps {
|
|
|
32
32
|
accessibility: Accessibility;
|
|
33
33
|
onChange: (value: FormFieldValue | undefined) => void;
|
|
34
34
|
}
|
|
35
|
-
export declare function FormControl({
|
|
35
|
+
export declare function FormControl({ blockPlugins, field, stored, selected, items, source, isDisabled, accessibility: { required, ...accessibility }, onChange, }: FormControlProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
36
36
|
export {};
|
|
37
37
|
//# sourceMappingURL=control.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../src/components/FormEditor/control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../src/components/FormEditor/control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMjD,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAcjB,KAAK,aAAa,GAAG,gBAAgB,CAAC;AAEtC,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,SAAS;IAC/C,KAAK,EAAE,CAAC,CAAC;IACT,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IAC/C,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;CACvD;AAED,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG;IACrE,YAAY,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAC9C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,mCACxB,oBAAoB,KAAK,SAAS,SACtC,CAAC;AA2FR,UAAU,gBAAgB;IACxB,YAAY,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC7C,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IACnC,mEAAmE;IACnE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC/B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;CACvD;AAED,wBAAgB,WAAW,CAAC,EAC1B,YAAY,EACZ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,KAAK,EACL,MAAM,EACN,UAAU,EACV,aAAa,EAAE,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,EAC7C,QAAQ,GACT,EAAE,gBAAgB,+TA+FlB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ContentBlockPlugin } from "../RichTextEditor/index.cjs";
|
|
3
3
|
import type { EntryItem, EntryPickerSource } from "../EntryPicker/index.cjs";
|
|
4
4
|
import type { GridColumns } from "../Grid/index.cjs";
|
|
5
5
|
import { type FormSchema, type FormErrors, type FormValues } from "./model.cjs";
|
|
@@ -14,7 +14,7 @@ export interface FormEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "d
|
|
|
14
14
|
/** Available assets or entries, keyed by field ID. Loading belongs to the app. */
|
|
15
15
|
pickerItems?: Record<string, EntryItem[]>;
|
|
16
16
|
pickerSources?: Record<string, EntryPickerSource>;
|
|
17
|
-
|
|
17
|
+
blockPlugins?: Record<string, readonly ContentBlockPlugin[]>;
|
|
18
18
|
/** App-provided messages take precedence over built-in validation. */
|
|
19
19
|
errors?: FormErrors;
|
|
20
20
|
isDisabled?: boolean;
|
|
@@ -29,5 +29,5 @@ export interface FormEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "d
|
|
|
29
29
|
* RichTextEditor through context. RichTextEditor's own dialogs render this, so
|
|
30
30
|
* the editor never imports the FormEditor that renders it.
|
|
31
31
|
*/
|
|
32
|
-
export declare function FormEditorCore({ schema, value, defaultValue, onValueChange, pickerItems, pickerSources,
|
|
32
|
+
export declare function FormEditorCore({ schema, value, defaultValue, onValueChange, pickerItems, pickerSources, blockPlugins, errors, isDisabled, showAllErrors, columns, minColumnWidth, className, style, ...rest }: FormEditorProps): import("react").JSX.Element;
|
|
33
33
|
//# sourceMappingURL=form.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACnF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"form.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eA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