@namroodinc/liquid-editorial 0.6.3 → 0.6.5
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 +74 -2
- package/UPGRADING.md +128 -0
- package/dist/chunks/{Avatar-C1q2AUD-.js → Avatar-BtblwihO.js} +2 -2
- package/dist/chunks/{Avatar-C1q2AUD-.js.map → Avatar-BtblwihO.js.map} +1 -1
- package/dist/chunks/{Avatar-BTKqaJLP.cjs → Avatar-C9ublbzK.cjs} +2 -2
- package/dist/chunks/{Avatar-BTKqaJLP.cjs.map → Avatar-C9ublbzK.cjs.map} +1 -1
- package/dist/chunks/{Board-Ct1t69ot.cjs → Board-CUt4j2-8.cjs} +2 -2
- package/dist/chunks/{Board-Ct1t69ot.cjs.map → Board-CUt4j2-8.cjs.map} +1 -1
- package/dist/chunks/{Board-BYPzybjf.js → Board-z688-51u.js} +2 -2
- package/dist/chunks/{Board-BYPzybjf.js.map → Board-z688-51u.js.map} +1 -1
- package/dist/chunks/ColourField-BqhYB4ZE.cjs +2 -0
- package/dist/chunks/ColourField-BqhYB4ZE.cjs.map +1 -0
- package/dist/chunks/{ColourField-Do0rHk-Y.js → ColourField-DXGpNP08.js} +7 -3
- package/dist/chunks/ColourField-DXGpNP08.js.map +1 -0
- package/dist/chunks/DatePicker-01sor8iD.cjs +2 -0
- package/dist/chunks/DatePicker-01sor8iD.cjs.map +1 -0
- package/dist/chunks/{DatePicker-B8L-oodC.js → DatePicker-DJAqXUDJ.js} +3 -3
- package/dist/chunks/DatePicker-DJAqXUDJ.js.map +1 -0
- package/dist/chunks/{FormEditor-a3kHVLQB.cjs → FormEditor-BbsvbufQ.cjs} +2 -2
- package/dist/chunks/{FormEditor-a3kHVLQB.cjs.map → FormEditor-BbsvbufQ.cjs.map} +1 -1
- package/dist/chunks/{FormEditor-CwQN8tRw.js → FormEditor-C5XtP-N7.js} +3 -3
- package/dist/chunks/{FormEditor-CwQN8tRw.js.map → FormEditor-C5XtP-N7.js.map} +1 -1
- package/dist/chunks/{Icon-D7GrTtqc.cjs → Icon-WOhlu6Rp.cjs} +2 -2
- package/dist/chunks/Icon-WOhlu6Rp.cjs.map +1 -0
- package/dist/chunks/{Icon-BZjGAu8D.js → Icon-spaFBU4S.js} +34 -33
- package/dist/chunks/Icon-spaFBU4S.js.map +1 -0
- package/dist/chunks/Message-CaX8Y1Xb.js +74 -0
- package/dist/chunks/Message-CaX8Y1Xb.js.map +1 -0
- package/dist/chunks/Message-DU31JAb3.cjs +2 -0
- package/dist/chunks/Message-DU31JAb3.cjs.map +1 -0
- package/dist/chunks/{useTooltip-D6cJji8v.js → useTooltip-C5gvEoYk.js} +2 -1
- package/dist/chunks/{useTooltip-D6cJji8v.js.map → useTooltip-C5gvEoYk.js.map} +1 -1
- package/dist/chunks/{useTooltip-CCf79zE9.cjs → useTooltip-bTE_a2Xn.cjs} +2 -2
- package/dist/chunks/{useTooltip-CCf79zE9.cjs.map → useTooltip-bTE_a2Xn.cjs.map} +1 -1
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.js +1 -1
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.js +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Banner/index.cjs +2 -0
- package/dist/components/Banner/index.cjs.map +1 -0
- package/dist/components/Banner/index.d.cts +6 -0
- package/dist/components/Banner/index.d.cts.map +1 -0
- package/dist/components/Banner/index.d.ts +6 -0
- package/dist/components/Banner/index.d.ts.map +1 -0
- package/dist/components/Banner/index.js +18 -0
- package/dist/components/Banner/index.js.map +1 -0
- package/dist/components/Banner/style.css +6 -0
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.js +5 -1
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.d.cts +6 -0
- package/dist/components/EditLayout/index.d.cts.map +1 -1
- package/dist/components/EditLayout/index.d.ts +6 -0
- package/dist/components/EditLayout/index.d.ts.map +1 -1
- package/dist/components/EditLayout/index.js +104 -97
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/EditLayout/style.css +8 -1
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/Icon/icons.d.cts +1 -0
- package/dist/components/Icon/icons.d.cts.map +1 -1
- package/dist/components/Icon/icons.d.ts +1 -0
- package/dist/components/Icon/icons.d.ts.map +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.js +5 -1
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Popover/style.css +2 -1
- package/dist/components/Popover/useTooltip.d.cts.map +1 -1
- package/dist/components/Popover/useTooltip.d.ts.map +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.js +2 -2
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.cjs.map +1 -1
- package/dist/components/Table/index.js +2 -2
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.cjs.map +1 -1
- package/dist/components/Toast/index.d.cts.map +1 -1
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/index.js +35 -60
- package/dist/components/Toast/index.js.map +1 -1
- package/dist/components/Toast/style.css +5 -50
- package/dist/components/TopNav/index.cjs +1 -1
- package/dist/components/TopNav/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -15
- package/dist/internal/Message.d.cts +23 -0
- package/dist/internal/Message.d.cts.map +1 -0
- package/dist/internal/Message.d.ts +23 -0
- package/dist/internal/Message.d.ts.map +1 -0
- package/dist/message.css +122 -0
- package/dist/styles.css +2 -0
- package/dist/tokens.css +36 -12
- package/package.json +1 -1
- package/dist/chunks/ColourField-DDGuWWNH.cjs +0 -2
- package/dist/chunks/ColourField-DDGuWWNH.cjs.map +0 -1
- package/dist/chunks/ColourField-Do0rHk-Y.js.map +0 -1
- package/dist/chunks/DatePicker-B8L-oodC.js.map +0 -1
- package/dist/chunks/DatePicker-hjpY6Sti.cjs +0 -2
- package/dist/chunks/DatePicker-hjpY6Sti.cjs.map +0 -1
- package/dist/chunks/Icon-BZjGAu8D.js.map +0 -1
- package/dist/chunks/Icon-D7GrTtqc.cjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./colour-BmtxDlWF.cjs"),t=require("../components/Button/index.cjs"),n=require("../components/Field/index.cjs"),r=require("../components/TextField/index.cjs"),i=require("./RichTextEditor-Ddk7qaqg.cjs"),a=require("../components/Container/index.cjs"),o=require("../components/EntryPicker/index.cjs"),s=require("../components/NumberField/index.cjs"),c=require("../components/Select/index.cjs"),l=require("../components/Switch/index.cjs"),u=require("./ColourField-DDGuWWNH.cjs"),d=require("./Slider-k8weRl34.cjs"),f=require("./DatePicker-hjpY6Sti.cjs"),p=require("../components/TagsInput/index.cjs"),m=require("../components/Choice/index.cjs"),h=require("../components/SelectionCard/index.cjs");let g=require("react"),_=require("react/jsx-runtime");var v=[`wide`,`full`],y=[`sm`,`md`,`lg`],b=new Set([`shortText`,`longText`,`richText`,`number`,`boolean`,`dateTime`,`asset`,`reference`,`select`,`slider`,`rangeSlider`,`colour`,`radioGroup`,`checkboxGroup`,`tags`,`date`,`divider`]);function x(e){let t=new Set;for(let n of e.fields){if(!n.id?.trim()||t.has(n.id))throw Error(`Form field IDs must be nonempty and unique.`);if(!b.has(n.type))throw Error(`Unsupported form field type: ${n.type}`);(n.type===`select`||n.type===`radioGroup`||n.type===`checkboxGroup`)&&w(n),(n.type===`slider`||n.type===`rangeSlider`)&&C(n),n.type!==`divider`&&S(n),t.add(n.id)}}function S(e){if(e.width!==void 0&&!y.includes(e.width))throw Error(`Field ${e.id} needs a width of sm, md or lg.`);if(e.type===`richText`&&e.expandedWidth!==void 0&&!v.includes(e.expandedWidth))throw Error(`Rich text field ${e.id} needs an expandedWidth of wide or full.`)}function C(e){let{min:t,max:n,step:r}=d.a(e);if(![t,n,r].every(Number.isFinite)||t>=n||r<=0)throw Error(`Slider field ${e.id} needs finite min < max and a positive step.`);if(e.type===`rangeSlider`&&r>d.i(n,-t))throw Error(`Range slider ${e.id} needs room for at least one step.`)}function w(e){if(!Array.isArray(e.options)){let t=e.type===`select`?`Select`:`Choice`;throw Error(`${t} field ${e.id} needs an options array.`)}if(e.type===`select`)return;let t=e.options.map(e=>e.value);if(t.some(e=>typeof e!=`string`||!e.trim())||new Set(t).size!==t.length)throw Error(`Choice field ${e.id} needs nonempty, unique option values.`)}var T={asset:{key:`assetId`,itemLabel:`asset`,itemsLabel:`assets`},reference:{key:`entryId`,itemLabel:`entry`,itemsLabel:`entries`}};function E(e){return e.type===`asset`||e.type===`reference`?e.picker?.label??e.label:e.label}function D(e){let t=T[e.type],{addLabel:n=`Choose ${E(e)}`,emptyLabel:r,itemLabel:i=t.itemLabel,itemsLabel:a=t.itemsLabel,max:o,isReorderable:s}=e.picker??{};return{addLabel:n,emptyLabel:r,itemLabel:i,itemsLabel:a,max:o,isReorderable:s}}function O(e,t){let{key:n}=T[e.type];return(Array.isArray(t)?t:t===void 0?[]:[t]).flatMap(e=>A(e,n)?[e[n]]:[])}function k(e){if(typeof e!=`string`)return;let t=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(?:Z|\+00:00)$/.exec(e);if(!t)return;let n=`${t[1]}:${t[2]??`00`}.${(t[3]??``).padEnd(3,`0`)}Z`,r=new Date(n);if(Number.isFinite(r.getTime())&&r.toISOString()===n)return n}function A(e,t){return!!e&&typeof e==`object`&&t in e&&typeof e[t]==`string`&&e[t].trim().length>0}function j(e){return!!e.text?.trim()||e.type===`horizontalRule`||!!e.content?.some(j)}function M(e){return`${E(e)} is required.`}function N(e,t){if(typeof t!=`string`)return`Enter text.`;if(e.required&&!t.trim())return M(e);if((e.type===`shortText`||e.type===`longText`)&&e.maxLength!==void 0&&t.length>e.maxLength)return`Enter no more than ${e.maxLength} characters.`}function P(e,t){let n=i.n(t);if(n)return n;if(e.required&&!j(t))return M(e)}function F(e,t){if(typeof t!=`string`)return`Choose an available option.`;if(t===``)return e.required?M(e):void 0;if((e.type===`select`||e.type===`radioGroup`)&&e.options.length>0&&!e.options.some(e=>e.value===t))return`Choose an available option.`}function I(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function L(e,t){if(!Array.isArray(t)||!t.every(e=>typeof e==`string`&&e.trim())||new Set(t).size!==t.length)return`Enter a list of unique, nonempty text values.`;if(e.required&&!t.length)return M(e);if(e.type===`tags`&&e.max!==void 0&&t.length>e.max)return`Enter no more than ${e.max} tags.`;if(e.type===`checkboxGroup`&&e.options.length&&t.some(t=>!e.options.some(e=>e.value===t)))return`Choose available options.`}function R(e,t){if(typeof t!=`number`||!Number.isFinite(t))return`Enter a finite number.`;let{min:n,max:r}=e.type===`slider`||e.type===`rangeSlider`?d.a(e):e.type===`number`?e:{};if(n!==void 0&&t<n)return`Enter a number of at least ${n}.`;if(r!==void 0&&t>r)return`Enter a number no greater than ${r}.`}function z(e,t){if(typeof t!=`string`)return`Enter a valid calendar date (YYYY-MM-DD).`;if(!t)return e.required?M(e):void 0;if(!f.a(t))return`Enter a valid calendar date (YYYY-MM-DD).`;if(e.type===`date`){if(e.min&&t<e.min)return`Choose a date on or after ${e.min}.`;if(e.max&&t>e.max)return`Choose a date on or before ${e.max}.`}}function B(e,t){return typeof e==`number`&&Number.isFinite(e)?d.r(e,t):void 0}function V(e,t){let n=e,r=B(n?.min,t),i=B(n?.max,t);if(r===void 0&&i===void 0)return;let[a,o]=[r??t.min,i??t.max].sort((e,t)=>e-t);return{min:a,max:o}}function H(e,t){if(!t||typeof t!=`object`||Array.isArray(t))return`Enter a range.`;let n=t,r=n.min,i=n.max,a=R(e,r)??R(e,i);if(a)return a;if(r>i)return`The start must not be greater than the end.`;if(e.type===`rangeSlider`&&d.i(i,-r)<d.a(e).step)return`Keep the range endpoints at least one step apart.`}function U(t,n){return typeof n==`string`?n.trim()?e.i(n)?void 0:`Enter a valid colour.`:t.required?M(t):void 0:`Enter a valid colour.`}function W(e,t){if(e.type!==`asset`&&e.type!==`reference`)return;let{key:n,itemLabel:r,itemsLabel:i}=T[e.type];if(!e.multiple)return A(t,n)?void 0:`Choose an ${r}.`;if(!Array.isArray(t)||!t.every(e=>A(e,n)))return`Choose a list of ${i}.`;if(e.required&&t.length===0)return M(e);let a=e.picker?.max;if(a!==void 0&&t.length>a)return`Choose no more than ${a} ${D(e).itemsLabel}.`}var G={shortText:N,longText:N,richText:P,number:R,slider:R,rangeSlider:H,date:z,colour:U,radioGroup:F,checkboxGroup:L,tags:L,boolean:(e,t)=>typeof t==`boolean`?void 0:`Choose a boolean value.`,dateTime:(e,t)=>k(t)?void 0:`Enter a valid UTC date and time.`,select:F,asset:W,reference:W};function K(e,t){return t===void 0?e.required?M(e):void 0:G[e.type](e,t)}function q(e,t){return x(e),Object.fromEntries(e.fields.flatMap(e=>{if(e.type===`divider`)return[];let n=K(e,Object.hasOwn(t,e.id)?t[e.id]:void 0);return n?[[e.id,n]]:[]}))}function J({field:e,option:t,name:n,checked:r,isDisabled:i,invalid:a,onChange:o}){let s={name:n,value:t.value,checked:r,disabled:i||t.isDisabled,"aria-invalid":a,onChange:()=>{!i&&!t.isDisabled&&o()}};if(e.appearance===`card`){let n=e.type===`radioGroup`?h.RadioCard:h.CheckboxCard;return(0,_.jsx)(n,{...s,title:t.label,description:t.description})}let c=e.type===`radioGroup`?m.Radio:m.Checkbox;return(0,_.jsx)(c,{...s,children:(0,_.jsxs)(`span`,{children:[t.label,t.description&&(0,_.jsx)(`span`,{className:`ds-form-editor__option-description`,children:t.description})]})})}function Y({field:e,stored:n,isDisabled:r,required:i,accessibility:a,onChange:o}){let s=e.type===`checkboxGroup`,c=s?I(n):typeof n==`string`&&n?[n]:[],l=e.appearance===`card`?h.SelectionCardGroup:m.ChoiceGroup;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(l,{...a,label:e.label,columns:e.columns??(e.appearance===`card`?2:1),children:e.options.map(t=>(0,_.jsx)(J,{field:e,option:t,name:a.id,checked:c.includes(t.value),isDisabled:r,invalid:a[`aria-invalid`],onChange:()=>{o(s?c.includes(t.value)?c.filter(e=>e!==t.value):[...c,t.value]:t.value)}},t.value))}),!s&&!i&&c.length>0&&(0,_.jsxs)(t.Button,{variant:`simple`,size:`sm`,isDisabled:r,onClick:()=>o(void 0),children:[`Clear `,e.label]})]})}function X({field:e,stored:t,isDisabled:n,accessibility:r,onChange:i}){let a=d.a(e),o=B(t,a);return(0,_.jsx)(d.n,{...r,...a,prefix:e.prefix,suffix:e.suffix,hasValueLabel:e.hasValueLabel,valueText:o===void 0?e.placeholder??`Not set`:void 0,autoFocus:e.autoFocus,isDisabled:n,value:o??a.min,onValueChange:i,onValueCommit:e=>{o===void 0&&i(e)}})}function Z({field:e,stored:t,isDisabled:n,accessibility:r,onChange:i}){let a=d.a(e),o=V(t,a);return(0,_.jsx)(d.t,{...r,...a,prefix:e.prefix,suffix:e.suffix,hasValueLabel:e.hasValueLabel,minLabel:`${e.label} minimum`,maxLabel:`${e.label} maximum`,isDisabled:n,valueText:o===void 0?e.placeholder??`Not set`:void 0,hasFill:o!==void 0,value:o??{min:a.min,max:a.max},onValueChange:i,onValueCommit:e=>{o===void 0&&i(e)}})}function Q({field:t,stored:n,isDisabled:r,required:i,accessibility:a,onChange:o}){let s={stored:n,isDisabled:r,required:i,accessibility:a,onChange:o};switch(t.type){case`radioGroup`:case`checkboxGroup`:return(0,_.jsx)(Y,{field:t,...s});case`rangeSlider`:return(0,_.jsx)(Z,{field:t,...s});case`slider`:return(0,_.jsx)(X,{field:t,...s});case`colour`:return(0,_.jsx)(u.t,{...a,required:i,placeholder:t.placeholder,presets:t.presets,showPresets:t.showPresets,picker:t.picker,placement:t.placement,readOnly:t.readOnly,autoFocus:t.autoFocus,isDisabled:r,value:typeof n==`string`?n:``,onInput:t=>{let n=t.currentTarget.value;n.trim()&&!e.i(n)&&o(n)},onValueChange:e=>o(e===``?void 0:e)});case`tags`:return(0,_.jsx)(p.TagsInput,{...a,required:i,placeholder:t.placeholder,max:t.max,isDisabled:r,value:I(n),onValueChange:o});case`date`:return(0,_.jsx)(f.n,{...a,placeholder:t.placeholder,min:t.min,max:t.max,placement:t.placement,isDisabled:r,isClearable:!0,clearLabel:`Clear ${t.label}`,value:typeof n==`string`?n:``,onValueChange:e=>o(e===``?void 0:e)})}}function $(e,t){if(e.type===`asset`){let n=t.map(e=>({assetId:e}));return e.multiple?n:n[0]}let n=t.map(e=>({entryId:e}));return e.multiple?n:n[0]}function ee({field:e,stored:t,isDisabled:n,required:r,accessibility:i,onChange:a}){return(0,_.jsx)(s.NumberField,{...i,required:r,isDisabled:n,placeholder:e.placeholder,min:e.min,max:e.max,step:e.step??`any`,hasSteppers:e.hasSteppers??!1,prefix:e.prefix,suffix:e.suffix,autoFocus:e.autoFocus,decreaseLabel:`Decrease ${e.label}`,increaseLabel:`Increase ${e.label}`,value:typeof t==`number`&&Number.isFinite(t)?t:``,onValueChange:e=>{(e===``||Number.isFinite(e))&&a(e===``?void 0:e)}})}function te({field:e,stored:t,isDisabled:n,required:r,accessibility:i,onChange:a}){let o=!r&&!e.options.some(e=>e.value===``);return(0,_.jsx)(c.Select,{...i,"aria-required":r||void 0,isDisabled:n,isInvalid:i[`aria-invalid`],options:o?[{value:``,label:e.placeholder??`None`},...e.options]:e.options,placeholder:e.placeholder,autoFocus:e.autoFocus,value:typeof t==`string`?t:``,onValueChange:e=>a(e===``?void 0:e)})}function ne({field:e,selected:t,items:n,isDisabled:r,accessibility:i,onChange:a}){return(0,_.jsx)(o.EntryPicker,{...i,items:n,value:t,...D(e),mode:e.multiple?`multiple`:`single`,isDisabled:r,onValueChange:t=>a($(e,t))})}function re({field:e,stored:t,selected:n,items:a,isDisabled:o,accessibility:{required:s,...c},onChange:u}){let d={stored:t,isDisabled:o,required:s,accessibility:c,onChange:u};switch(e.type){case`shortText`:return(0,_.jsx)(r.TextField,{...c,required:s,disabled:o,placeholder:e.placeholder,type:e.inputType,maxLength:e.maxLength,readOnly:e.readOnly,autoFocus:e.autoFocus,value:typeof t==`string`?t:``,onChange:e=>u(e.target.value)});case`longText`:return(0,_.jsx)(r.TextArea,{...c,required:s,disabled:o,placeholder:e.placeholder,rows:e.rows,maxLength:e.maxLength,readOnly:e.readOnly,autoFocus:e.autoFocus,value:typeof t==`string`?t:``,onChange:e=>u(e.target.value)});case`number`:return(0,_.jsx)(ee,{field:e,...d});case`boolean`:return(0,_.jsx)(l.Switch,{...c,isDisabled:o,autoFocus:e.autoFocus,isSelected:t===!0,onSelectedChange:u});case`dateTime`:return(0,_.jsx)(r.TextField,{...c,required:s,disabled:o,type:`datetime-local`,step:`0.001`,autoFocus:e.autoFocus,value:k(t)?.slice(0,-1)??``,onChange:e=>u(k(`${e.target.value}Z`))});case`richText`:return(0,_.jsx)(i.t,{...c,expandedWidth:e.expandedWidth,label:e.label,isRequired:s,isDisabled:o,placeholder:e.placeholder,format:`json`,value:t===void 0?i.r:t,onChange:u});case`select`:return(0,_.jsx)(te,{field:e,...d});case`asset`:case`reference`:return(0,_.jsx)(ne,{field:e,items:a,selected:n??[],...d});default:return(0,_.jsx)(Q,{field:e,...d})}}function ie({field:e,stored:t,items:r,isDisabled:i,error:o,isErrorVisible:s,onChange:c}){let l=(0,g.useMemo)(()=>o===void 0&&s?K(e,t):void 0,[o,s,e,t]),u=(0,g.useMemo)(()=>e.type===`asset`||e.type===`reference`?O(e,t):void 0,[e,t]);return(0,_.jsx)(a.Container,{width:e.width,padded:!1,center:!1,className:`ds-form-editor__field`,children:(0,_.jsx)(n.Field,{label:e.type===`dateTime`?`${e.label} (UTC)`:E(e),hint:e.hint,error:o??l,isRequired:e.required,count:u?.length??(e.type===`checkboxGroup`?I(t).length:void 0),isGroup:u!==void 0||ae.has(e.type),children:n=>(0,_.jsx)(re,{field:e,stored:t,selected:u,items:r,isDisabled:i,accessibility:n,onChange:c})})})}var ae=new Set([`radioGroup`,`checkboxGroup`,`rangeSlider`]),oe=new Set([`slider`,`rangeSlider`,`date`,`colour`]);function se({schema:e,value:t,defaultValue:n={},onValueChange:r,pickerItems:i={},errors:a={},isDisabled:o=!1,showAllErrors:s=!1,columns:c=1,minColumnWidth:l=`16rem`,className:u,style:d,...f}){let[p,m]=(0,g.useState)(n),[h,v]=(0,g.useState)(()=>new Set),y=t??p;(0,g.useMemo)(()=>x(e),[e]);let b=(e,n)=>{let i={...y};n===void 0?delete i[e]:i[e]=n,t===void 0&&m(i),v(t=>new Set(t).add(e)),r?.(i,{fieldId:e})},S=c===`auto`?{"--form-editor-min-column":l}:{"--form-editor-columns":c,"--form-editor-min-column":l};return(0,_.jsx)(`div`,{className:[`ds-form-editor`,c===`auto`&&`ds-form-editor--auto`,u].filter(Boolean).join(` `),style:{...S,...d},...f,children:e.fields.map(e=>{if(e.type===`divider`)return(0,_.jsx)(`hr`,{className:`ds-form-editor__divider`},e.id);let t=Object.hasOwn(y,e.id)?y[e.id]:void 0,n=o||!!e.isDisabled,r=n||`readOnly`in e&&!!e.readOnly,c=typeof t==`string`?t.trim()!==``:t!==void 0,l=s||h.has(e.id)||c&&oe.has(e.type)||e.type===`number`&&typeof t==`number`;return(0,_.jsx)(ie,{field:e,stored:t,items:i[e.id]??[],isDisabled:n,error:a[e.id],isErrorVisible:l,onChange:t=>{r||b(e.id,t)}},e.id)})})}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return se}});
|
|
2
|
-
//# sourceMappingURL=FormEditor-
|
|
1
|
+
const e=require("./colour-BmtxDlWF.cjs"),t=require("../components/Button/index.cjs"),n=require("../components/Field/index.cjs"),r=require("../components/TextField/index.cjs"),i=require("./RichTextEditor-Ddk7qaqg.cjs"),a=require("../components/Container/index.cjs"),o=require("../components/EntryPicker/index.cjs"),s=require("../components/NumberField/index.cjs"),c=require("../components/Select/index.cjs"),l=require("../components/Switch/index.cjs"),u=require("./ColourField-BqhYB4ZE.cjs"),d=require("./Slider-k8weRl34.cjs"),f=require("./DatePicker-01sor8iD.cjs"),p=require("../components/TagsInput/index.cjs"),m=require("../components/Choice/index.cjs"),h=require("../components/SelectionCard/index.cjs");let g=require("react"),_=require("react/jsx-runtime");var v=[`wide`,`full`],y=[`sm`,`md`,`lg`],b=new Set([`shortText`,`longText`,`richText`,`number`,`boolean`,`dateTime`,`asset`,`reference`,`select`,`slider`,`rangeSlider`,`colour`,`radioGroup`,`checkboxGroup`,`tags`,`date`,`divider`]);function x(e){let t=new Set;for(let n of e.fields){if(!n.id?.trim()||t.has(n.id))throw Error(`Form field IDs must be nonempty and unique.`);if(!b.has(n.type))throw Error(`Unsupported form field type: ${n.type}`);(n.type===`select`||n.type===`radioGroup`||n.type===`checkboxGroup`)&&w(n),(n.type===`slider`||n.type===`rangeSlider`)&&C(n),n.type!==`divider`&&S(n),t.add(n.id)}}function S(e){if(e.width!==void 0&&!y.includes(e.width))throw Error(`Field ${e.id} needs a width of sm, md or lg.`);if(e.type===`richText`&&e.expandedWidth!==void 0&&!v.includes(e.expandedWidth))throw Error(`Rich text field ${e.id} needs an expandedWidth of wide or full.`)}function C(e){let{min:t,max:n,step:r}=d.a(e);if(![t,n,r].every(Number.isFinite)||t>=n||r<=0)throw Error(`Slider field ${e.id} needs finite min < max and a positive step.`);if(e.type===`rangeSlider`&&r>d.i(n,-t))throw Error(`Range slider ${e.id} needs room for at least one step.`)}function w(e){if(!Array.isArray(e.options)){let t=e.type===`select`?`Select`:`Choice`;throw Error(`${t} field ${e.id} needs an options array.`)}if(e.type===`select`)return;let t=e.options.map(e=>e.value);if(t.some(e=>typeof e!=`string`||!e.trim())||new Set(t).size!==t.length)throw Error(`Choice field ${e.id} needs nonempty, unique option values.`)}var T={asset:{key:`assetId`,itemLabel:`asset`,itemsLabel:`assets`},reference:{key:`entryId`,itemLabel:`entry`,itemsLabel:`entries`}};function E(e){return e.type===`asset`||e.type===`reference`?e.picker?.label??e.label:e.label}function D(e){let t=T[e.type],{addLabel:n=`Choose ${E(e)}`,emptyLabel:r,itemLabel:i=t.itemLabel,itemsLabel:a=t.itemsLabel,max:o,isReorderable:s}=e.picker??{};return{addLabel:n,emptyLabel:r,itemLabel:i,itemsLabel:a,max:o,isReorderable:s}}function O(e,t){let{key:n}=T[e.type];return(Array.isArray(t)?t:t===void 0?[]:[t]).flatMap(e=>A(e,n)?[e[n]]:[])}function k(e){if(typeof e!=`string`)return;let t=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(?:Z|\+00:00)$/.exec(e);if(!t)return;let n=`${t[1]}:${t[2]??`00`}.${(t[3]??``).padEnd(3,`0`)}Z`,r=new Date(n);if(Number.isFinite(r.getTime())&&r.toISOString()===n)return n}function A(e,t){return!!e&&typeof e==`object`&&t in e&&typeof e[t]==`string`&&e[t].trim().length>0}function j(e){return!!e.text?.trim()||e.type===`horizontalRule`||!!e.content?.some(j)}function M(e){return`${E(e)} is required.`}function N(e,t){if(typeof t!=`string`)return`Enter text.`;if(e.required&&!t.trim())return M(e);if((e.type===`shortText`||e.type===`longText`)&&e.maxLength!==void 0&&t.length>e.maxLength)return`Enter no more than ${e.maxLength} characters.`}function P(e,t){let n=i.n(t);if(n)return n;if(e.required&&!j(t))return M(e)}function F(e,t){if(typeof t!=`string`)return`Choose an available option.`;if(t===``)return e.required?M(e):void 0;if((e.type===`select`||e.type===`radioGroup`)&&e.options.length>0&&!e.options.some(e=>e.value===t))return`Choose an available option.`}function I(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function L(e,t){if(!Array.isArray(t)||!t.every(e=>typeof e==`string`&&e.trim())||new Set(t).size!==t.length)return`Enter a list of unique, nonempty text values.`;if(e.required&&!t.length)return M(e);if(e.type===`tags`&&e.max!==void 0&&t.length>e.max)return`Enter no more than ${e.max} tags.`;if(e.type===`checkboxGroup`&&e.options.length&&t.some(t=>!e.options.some(e=>e.value===t)))return`Choose available options.`}function R(e,t){if(typeof t!=`number`||!Number.isFinite(t))return`Enter a finite number.`;let{min:n,max:r}=e.type===`slider`||e.type===`rangeSlider`?d.a(e):e.type===`number`?e:{};if(n!==void 0&&t<n)return`Enter a number of at least ${n}.`;if(r!==void 0&&t>r)return`Enter a number no greater than ${r}.`}function z(e,t){if(typeof t!=`string`)return`Enter a valid calendar date (YYYY-MM-DD).`;if(!t)return e.required?M(e):void 0;if(!f.a(t))return`Enter a valid calendar date (YYYY-MM-DD).`;if(e.type===`date`){if(e.min&&t<e.min)return`Choose a date on or after ${e.min}.`;if(e.max&&t>e.max)return`Choose a date on or before ${e.max}.`}}function B(e,t){return typeof e==`number`&&Number.isFinite(e)?d.r(e,t):void 0}function V(e,t){let n=e,r=B(n?.min,t),i=B(n?.max,t);if(r===void 0&&i===void 0)return;let[a,o]=[r??t.min,i??t.max].sort((e,t)=>e-t);return{min:a,max:o}}function H(e,t){if(!t||typeof t!=`object`||Array.isArray(t))return`Enter a range.`;let n=t,r=n.min,i=n.max,a=R(e,r)??R(e,i);if(a)return a;if(r>i)return`The start must not be greater than the end.`;if(e.type===`rangeSlider`&&d.i(i,-r)<d.a(e).step)return`Keep the range endpoints at least one step apart.`}function U(t,n){return typeof n==`string`?n.trim()?e.i(n)?void 0:`Enter a valid colour.`:t.required?M(t):void 0:`Enter a valid colour.`}function W(e,t){if(e.type!==`asset`&&e.type!==`reference`)return;let{key:n,itemLabel:r,itemsLabel:i}=T[e.type];if(!e.multiple)return A(t,n)?void 0:`Choose an ${r}.`;if(!Array.isArray(t)||!t.every(e=>A(e,n)))return`Choose a list of ${i}.`;if(e.required&&t.length===0)return M(e);let a=e.picker?.max;if(a!==void 0&&t.length>a)return`Choose no more than ${a} ${D(e).itemsLabel}.`}var G={shortText:N,longText:N,richText:P,number:R,slider:R,rangeSlider:H,date:z,colour:U,radioGroup:F,checkboxGroup:L,tags:L,boolean:(e,t)=>typeof t==`boolean`?void 0:`Choose a boolean value.`,dateTime:(e,t)=>k(t)?void 0:`Enter a valid UTC date and time.`,select:F,asset:W,reference:W};function K(e,t){return t===void 0?e.required?M(e):void 0:G[e.type](e,t)}function q(e,t){return x(e),Object.fromEntries(e.fields.flatMap(e=>{if(e.type===`divider`)return[];let n=K(e,Object.hasOwn(t,e.id)?t[e.id]:void 0);return n?[[e.id,n]]:[]}))}function J({field:e,option:t,name:n,checked:r,isDisabled:i,invalid:a,onChange:o}){let s={name:n,value:t.value,checked:r,disabled:i||t.isDisabled,"aria-invalid":a,onChange:()=>{!i&&!t.isDisabled&&o()}};if(e.appearance===`card`){let n=e.type===`radioGroup`?h.RadioCard:h.CheckboxCard;return(0,_.jsx)(n,{...s,title:t.label,description:t.description})}let c=e.type===`radioGroup`?m.Radio:m.Checkbox;return(0,_.jsx)(c,{...s,children:(0,_.jsxs)(`span`,{children:[t.label,t.description&&(0,_.jsx)(`span`,{className:`ds-form-editor__option-description`,children:t.description})]})})}function Y({field:e,stored:n,isDisabled:r,required:i,accessibility:a,onChange:o}){let s=e.type===`checkboxGroup`,c=s?I(n):typeof n==`string`&&n?[n]:[],l=e.appearance===`card`?h.SelectionCardGroup:m.ChoiceGroup;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(l,{...a,label:e.label,columns:e.columns??(e.appearance===`card`?2:1),children:e.options.map(t=>(0,_.jsx)(J,{field:e,option:t,name:a.id,checked:c.includes(t.value),isDisabled:r,invalid:a[`aria-invalid`],onChange:()=>{o(s?c.includes(t.value)?c.filter(e=>e!==t.value):[...c,t.value]:t.value)}},t.value))}),!s&&!i&&c.length>0&&(0,_.jsxs)(t.Button,{variant:`simple`,size:`sm`,isDisabled:r,onClick:()=>o(void 0),children:[`Clear `,e.label]})]})}function X({field:e,stored:t,isDisabled:n,accessibility:r,onChange:i}){let a=d.a(e),o=B(t,a);return(0,_.jsx)(d.n,{...r,...a,prefix:e.prefix,suffix:e.suffix,hasValueLabel:e.hasValueLabel,valueText:o===void 0?e.placeholder??`Not set`:void 0,autoFocus:e.autoFocus,isDisabled:n,value:o??a.min,onValueChange:i,onValueCommit:e=>{o===void 0&&i(e)}})}function Z({field:e,stored:t,isDisabled:n,accessibility:r,onChange:i}){let a=d.a(e),o=V(t,a);return(0,_.jsx)(d.t,{...r,...a,prefix:e.prefix,suffix:e.suffix,hasValueLabel:e.hasValueLabel,minLabel:`${e.label} minimum`,maxLabel:`${e.label} maximum`,isDisabled:n,valueText:o===void 0?e.placeholder??`Not set`:void 0,hasFill:o!==void 0,value:o??{min:a.min,max:a.max},onValueChange:i,onValueCommit:e=>{o===void 0&&i(e)}})}function Q({field:t,stored:n,isDisabled:r,required:i,accessibility:a,onChange:o}){let s={stored:n,isDisabled:r,required:i,accessibility:a,onChange:o};switch(t.type){case`radioGroup`:case`checkboxGroup`:return(0,_.jsx)(Y,{field:t,...s});case`rangeSlider`:return(0,_.jsx)(Z,{field:t,...s});case`slider`:return(0,_.jsx)(X,{field:t,...s});case`colour`:return(0,_.jsx)(u.t,{...a,required:i,placeholder:t.placeholder,presets:t.presets,showPresets:t.showPresets,picker:t.picker,placement:t.placement,readOnly:t.readOnly,autoFocus:t.autoFocus,isDisabled:r,value:typeof n==`string`?n:``,onInput:t=>{let n=t.currentTarget.value;n.trim()&&!e.i(n)&&o(n)},onValueChange:e=>o(e===``?void 0:e)});case`tags`:return(0,_.jsx)(p.TagsInput,{...a,required:i,placeholder:t.placeholder,max:t.max,isDisabled:r,value:I(n),onValueChange:o});case`date`:return(0,_.jsx)(f.n,{...a,placeholder:t.placeholder,min:t.min,max:t.max,placement:t.placement,isDisabled:r,isClearable:!0,clearLabel:`Clear ${t.label}`,value:typeof n==`string`?n:``,onValueChange:e=>o(e===``?void 0:e)})}}function $(e,t){if(e.type===`asset`){let n=t.map(e=>({assetId:e}));return e.multiple?n:n[0]}let n=t.map(e=>({entryId:e}));return e.multiple?n:n[0]}function ee({field:e,stored:t,isDisabled:n,required:r,accessibility:i,onChange:a}){return(0,_.jsx)(s.NumberField,{...i,required:r,isDisabled:n,placeholder:e.placeholder,min:e.min,max:e.max,step:e.step??`any`,hasSteppers:e.hasSteppers??!1,prefix:e.prefix,suffix:e.suffix,autoFocus:e.autoFocus,decreaseLabel:`Decrease ${e.label}`,increaseLabel:`Increase ${e.label}`,value:typeof t==`number`&&Number.isFinite(t)?t:``,onValueChange:e=>{(e===``||Number.isFinite(e))&&a(e===``?void 0:e)}})}function te({field:e,stored:t,isDisabled:n,required:r,accessibility:i,onChange:a}){let o=!r&&!e.options.some(e=>e.value===``);return(0,_.jsx)(c.Select,{...i,"aria-required":r||void 0,isDisabled:n,isInvalid:i[`aria-invalid`],options:o?[{value:``,label:e.placeholder??`None`},...e.options]:e.options,placeholder:e.placeholder,autoFocus:e.autoFocus,value:typeof t==`string`?t:``,onValueChange:e=>a(e===``?void 0:e)})}function ne({field:e,selected:t,items:n,isDisabled:r,accessibility:i,onChange:a}){return(0,_.jsx)(o.EntryPicker,{...i,items:n,value:t,...D(e),mode:e.multiple?`multiple`:`single`,isDisabled:r,onValueChange:t=>a($(e,t))})}function re({field:e,stored:t,selected:n,items:a,isDisabled:o,accessibility:{required:s,...c},onChange:u}){let d={stored:t,isDisabled:o,required:s,accessibility:c,onChange:u};switch(e.type){case`shortText`:return(0,_.jsx)(r.TextField,{...c,required:s,disabled:o,placeholder:e.placeholder,type:e.inputType,maxLength:e.maxLength,readOnly:e.readOnly,autoFocus:e.autoFocus,value:typeof t==`string`?t:``,onChange:e=>u(e.target.value)});case`longText`:return(0,_.jsx)(r.TextArea,{...c,required:s,disabled:o,placeholder:e.placeholder,rows:e.rows,maxLength:e.maxLength,readOnly:e.readOnly,autoFocus:e.autoFocus,value:typeof t==`string`?t:``,onChange:e=>u(e.target.value)});case`number`:return(0,_.jsx)(ee,{field:e,...d});case`boolean`:return(0,_.jsx)(l.Switch,{...c,isDisabled:o,autoFocus:e.autoFocus,isSelected:t===!0,onSelectedChange:u});case`dateTime`:return(0,_.jsx)(r.TextField,{...c,required:s,disabled:o,type:`datetime-local`,step:`0.001`,autoFocus:e.autoFocus,value:k(t)?.slice(0,-1)??``,onChange:e=>u(k(`${e.target.value}Z`))});case`richText`:return(0,_.jsx)(i.t,{...c,expandedWidth:e.expandedWidth,label:e.label,isRequired:s,isDisabled:o,placeholder:e.placeholder,format:`json`,value:t===void 0?i.r:t,onChange:u});case`select`:return(0,_.jsx)(te,{field:e,...d});case`asset`:case`reference`:return(0,_.jsx)(ne,{field:e,items:a,selected:n??[],...d});default:return(0,_.jsx)(Q,{field:e,...d})}}function ie({field:e,stored:t,items:r,isDisabled:i,error:o,isErrorVisible:s,onChange:c}){let l=(0,g.useMemo)(()=>o===void 0&&s?K(e,t):void 0,[o,s,e,t]),u=(0,g.useMemo)(()=>e.type===`asset`||e.type===`reference`?O(e,t):void 0,[e,t]);return(0,_.jsx)(a.Container,{width:e.width,padded:!1,center:!1,className:`ds-form-editor__field`,children:(0,_.jsx)(n.Field,{label:e.type===`dateTime`?`${e.label} (UTC)`:E(e),hint:e.hint,error:o??l,isRequired:e.required,count:u?.length??(e.type===`checkboxGroup`?I(t).length:void 0),isGroup:u!==void 0||ae.has(e.type),children:n=>(0,_.jsx)(re,{field:e,stored:t,selected:u,items:r,isDisabled:i,accessibility:n,onChange:c})})})}var ae=new Set([`radioGroup`,`checkboxGroup`,`rangeSlider`]),oe=new Set([`slider`,`rangeSlider`,`date`,`colour`]);function se({schema:e,value:t,defaultValue:n={},onValueChange:r,pickerItems:i={},errors:a={},isDisabled:o=!1,showAllErrors:s=!1,columns:c=1,minColumnWidth:l=`16rem`,className:u,style:d,...f}){let[p,m]=(0,g.useState)(n),[h,v]=(0,g.useState)(()=>new Set),y=t??p;(0,g.useMemo)(()=>x(e),[e]);let b=(e,n)=>{let i={...y};n===void 0?delete i[e]:i[e]=n,t===void 0&&m(i),v(t=>new Set(t).add(e)),r?.(i,{fieldId:e})},S=c===`auto`?{"--form-editor-min-column":l}:{"--form-editor-columns":c,"--form-editor-min-column":l};return(0,_.jsx)(`div`,{className:[`ds-form-editor`,c===`auto`&&`ds-form-editor--auto`,u].filter(Boolean).join(` `),style:{...S,...d},...f,children:e.fields.map(e=>{if(e.type===`divider`)return(0,_.jsx)(`hr`,{className:`ds-form-editor__divider`},e.id);let t=Object.hasOwn(y,e.id)?y[e.id]:void 0,n=o||!!e.isDisabled,r=n||`readOnly`in e&&!!e.readOnly,c=typeof t==`string`?t.trim()!==``:t!==void 0,l=s||h.has(e.id)||c&&oe.has(e.type)||e.type===`number`&&typeof t==`number`;return(0,_.jsx)(ie,{field:e,stored:t,items:i[e.id]??[],isDisabled:n,error:a[e.id],isErrorVisible:l,onChange:t=>{r||b(e.id,t)}},e.id)})})}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return se}});
|
|
2
|
+
//# sourceMappingURL=FormEditor-BbsvbufQ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormEditor-a3kHVLQB.cjs","names":["sliderScale","preciseSum","documentError","isIsoDate","clampToScale","parseColour","RadioCard","CheckboxCard","Radio","Checkbox","SelectionCardGroup","ChoiceGroup","_Fragment","Button","sliderScale","Slider","RangeSlider","ColourField","parseColour","TagsInput","DateField","NumberField","Select","EntryPicker","TextField","TextArea","Switch","RichTextEditor","emptyDocument","useMemo","Container","Field","useState","require_colour","require_components_Button_index","require_components_Field_index","require_components_TextField_index","require_RichTextEditor","require_components_Container_index","require_components_EntryPicker_index","require_components_NumberField_index","require_components_Select_index","require_components_Switch_index","require_ColourField","require_Slider","require_DatePicker","require_components_TagsInput_index","require_components_Choice_index","require_components_SelectionCard_index","react","react_jsx_runtime","expandedWidths","fieldWidths","fieldTypes","assertModel","ids","field","model","assertChoices","assertSlider","assertMeasures","min","max","step","kind","values","option","value","linkCopy","fieldLabel","pickerCopy","defaults","selectedIds","isLink","link","key","parseUtcDateTime","match","canonical","date","hasRichText","node","requiredError","textError","richTextError","error","choiceError","stringList","item","listError","numberError","dateError","sliderValue","scale","rangeSliderValue","range","start","end","low","high","a","b","rangeError","colourError","linkError","itemLabel","itemsLabel","validators","fieldError","validateFormValues","Option","props","isDisabled","invalid","onChange","Card","Choice","ChoiceControl","multiple","selected","stored","Group","accessibility","required","SliderControl","shown","next","RangeSliderControl","AdditionalControl","raw","event","pickerValue","links","NumberControl","SelectControl","isClearable","PickerControl","FormControl","shared","FormEditorField","validation","isErrorVisible","groupTypes","loadedValidationTypes","FormEditor","rest","internal","setInternal","defaultValue","changed","setChanged","current","schema","commit","fieldId","previous","onValueChange","layout","columns","minColumnWidth","className","style","fieldDisabled","isLocked","isLoaded","showAllErrors","pickerItems","errors"],"sources":["../../src/components/RichTextEditor/expanded-width.ts","../../src/components/FormEditor/model.ts","../../src/components/FormEditor/choice-control.tsx","../../src/components/FormEditor/additional-control.tsx","../../src/components/FormEditor/control.tsx","../../src/components/FormEditor/index.tsx"],"sourcesContent":["/** Expanded writing measures: `wide` caps at the shared wide Modal width; `full` fills the viewport inside the scrim's gutters. */\nexport const expandedWidths = [\"wide\", \"full\"] as const;\n\nexport type RichTextEditorExpandedWidth = (typeof expandedWidths)[number];\n","import type { ReactNode } from \"react\";\nimport type { SelectOption } from \"../Select\";\nimport type { EntryPickerProps } from \"../EntryPicker\";\nimport type { JSONContent } from \"@tiptap/react\";\nimport { documentError } from \"../RichTextEditor/document\";\nimport type { RichTextDocument } from \"../RichTextEditor\";\nimport { expandedWidths, type RichTextEditorExpandedWidth } from \"../RichTextEditor/expanded-width\";\nimport { isIsoDate } from \"../DatePicker/date\";\nimport type { RangeSliderValue } from \"../Slider\";\nimport { clampToScale, preciseSum, sliderScale, type SliderScale } from \"../Slider/scale\";\nimport { parseColour } from \"../ColourField/colour\";\nimport type { PopoverPlacement } from \"../Popover\";\nimport type { ContainerWidth } from \"../Container\";\n\n/** The shared measures a field may cap at; checked against Container's scale. */\nconst fieldWidths = [\"sm\", \"md\", \"lg\"] as const satisfies readonly ContainerWidth[];\n\ninterface FormFieldBase {\n id: string;\n label: string;\n hint?: ReactNode;\n /** Maximum width of the whole field, using Container's measures and its `lg` default. */\n width?: (typeof fieldWidths)[number];\n placeholder?: string;\n required?: boolean;\n isDisabled?: boolean;\n}\n\ninterface SliderOptions {\n multiple?: never;\n min?: number;\n max?: number;\n step?: number;\n prefix?: string;\n suffix?: string;\n hasValueLabel?: boolean;\n}\n\ninterface ChoiceOptions {\n multiple?: never;\n autoFocus?: never;\n options: SelectOption[];\n appearance?: \"default\" | \"card\";\n /** Maximum options per row inside this group; independent of FormEditor columns. */\n columns?: 1 | 2 | 3;\n}\n\nexport type FormField = FormFieldBase &\n (\n | {\n type: \"shortText\";\n inputType?: \"text\" | \"email\";\n maxLength?: number;\n readOnly?: boolean;\n autoFocus?: boolean;\n multiple?: never;\n }\n | {\n type: \"longText\";\n rows?: number;\n maxLength?: number;\n readOnly?: boolean;\n autoFocus?: boolean;\n multiple?: never;\n }\n | { type: \"boolean\" | \"dateTime\"; autoFocus?: boolean; multiple?: never }\n | {\n type: \"richText\";\n expandedWidth?: RichTextEditorExpandedWidth;\n autoFocus?: never;\n multiple?: never;\n }\n | {\n type: \"number\";\n min?: number;\n max?: number;\n step?: number | \"any\";\n hasSteppers?: boolean;\n prefix?: string;\n suffix?: string;\n autoFocus?: boolean;\n multiple?: never;\n }\n | { type: \"select\"; options: SelectOption[]; autoFocus?: boolean; multiple?: never }\n | ({ type: \"slider\"; autoFocus?: boolean } & SliderOptions)\n | ({ type: \"rangeSlider\"; autoFocus?: never } & SliderOptions)\n | ({ type: \"radioGroup\" } & ChoiceOptions)\n | ({ type: \"checkboxGroup\" } & ChoiceOptions)\n | {\n type: \"colour\";\n multiple?: never;\n presets?: string[];\n showPresets?: boolean;\n picker?: \"custom\" | \"native\";\n placement?: PopoverPlacement;\n readOnly?: boolean;\n autoFocus?: boolean;\n }\n | { type: \"tags\"; max?: number; multiple?: never; autoFocus?: never }\n | {\n type: \"date\";\n min?: string;\n max?: string;\n placement?: PopoverPlacement;\n multiple?: never;\n autoFocus?: never;\n }\n | {\n type: \"asset\" | \"reference\";\n multiple?: boolean;\n autoFocus?: never;\n picker?: Pick<\n EntryPickerProps,\n \"label\" | \"addLabel\" | \"emptyLabel\" | \"itemLabel\" | \"itemsLabel\" | \"max\" | \"isReorderable\"\n >;\n }\n );\n\nexport type FieldOf<T extends FormField[\"type\"]> = Extract<FormField, { type: T }>;\n\n/** Layout only: no label, value, disabled state, or validation. */\nexport interface FormDivider {\n id: string;\n type: \"divider\";\n}\n\nexport type FormItem = FormField | FormDivider;\n\nexport interface FormSchema {\n fields: readonly FormItem[];\n}\n\nexport interface AssetValue {\n assetId: string;\n}\nexport interface ReferenceValue {\n entryId: string;\n}\nexport type FormFieldValue =\n | string\n | number\n | boolean\n | RichTextDocument\n | AssetValue\n | ReferenceValue\n | string[]\n | RangeSliderValue\n | AssetValue[]\n | ReferenceValue[];\nexport type FormValues = Record<string, FormFieldValue | undefined>;\nexport type FormErrors = Partial<Record<string, string>>;\n\nconst fieldTypes = new Set([\n \"shortText\",\n \"longText\",\n \"richText\",\n \"number\",\n \"boolean\",\n \"dateTime\",\n \"asset\",\n \"reference\",\n \"select\",\n \"slider\",\n \"rangeSlider\",\n \"colour\",\n \"radioGroup\",\n \"checkboxGroup\",\n \"tags\",\n \"date\",\n \"divider\",\n]);\n\nexport function assertModel(model: FormSchema) {\n const ids = new Set<string>();\n for (const field of model.fields) {\n if (!field.id?.trim() || ids.has(field.id)) {\n throw new Error(\"Form field IDs must be nonempty and unique.\");\n }\n if (!fieldTypes.has(field.type)) {\n throw new Error(`Unsupported form field type: ${field.type}`);\n }\n if (field.type === \"select\" || field.type === \"radioGroup\" || field.type === \"checkboxGroup\") {\n assertChoices(field);\n }\n if (field.type === \"slider\" || field.type === \"rangeSlider\") {\n assertSlider(field);\n }\n if (field.type !== \"divider\") {\n assertMeasures(field);\n }\n ids.add(field.id);\n }\n}\n\n/** Runtime schemas can carry any string; the types only cover typed schemas. */\nfunction assertMeasures(field: FormField) {\n if (field.width !== undefined && !fieldWidths.includes(field.width)) {\n throw new Error(`Field ${field.id} needs a width of sm, md or lg.`);\n }\n if (\n field.type === \"richText\" &&\n field.expandedWidth !== undefined &&\n !expandedWidths.includes(field.expandedWidth)\n ) {\n throw new Error(`Rich text field ${field.id} needs an expandedWidth of wide or full.`);\n }\n}\n\nfunction assertSlider(field: FieldOf<\"slider\" | \"rangeSlider\">) {\n const { min, max, step } = sliderScale(field);\n if (![min, max, step].every(Number.isFinite) || min >= max || step <= 0) {\n throw new Error(`Slider field ${field.id} needs finite min < max and a positive step.`);\n }\n if (field.type === \"rangeSlider\" && step > preciseSum(max, -min)) {\n throw new Error(`Range slider ${field.id} needs room for at least one step.`);\n }\n}\n\nfunction assertChoices(field: FieldOf<\"select\" | \"radioGroup\" | \"checkboxGroup\">) {\n if (!Array.isArray(field.options)) {\n const kind = field.type === \"select\" ? \"Select\" : \"Choice\";\n throw new Error(`${kind} field ${field.id} needs an options array.`);\n }\n if (field.type === \"select\") {\n return;\n }\n const values = field.options.map((option) => option.value);\n if (\n values.some((value) => typeof value !== \"string\" || !value.trim()) ||\n new Set(values).size !== values.length\n ) {\n throw new Error(`Choice field ${field.id} needs nonempty, unique option values.`);\n }\n}\n\nconst linkCopy = {\n asset: { key: \"assetId\", itemLabel: \"asset\", itemsLabel: \"assets\" },\n reference: { key: \"entryId\", itemLabel: \"entry\", itemsLabel: \"entries\" },\n} as const;\n\n/** The field's visible and accessible name. A picker's `label` overrides it. */\nexport function fieldLabel(field: FormField): string {\n return field.type === \"asset\" || field.type === \"reference\"\n ? (field.picker?.label ?? field.label)\n : field.label;\n}\n\n/** Picker action and item copy, with asset or entry wording for any option left out or undefined. */\nexport function pickerCopy(field: FieldOf<\"asset\" | \"reference\">) {\n const defaults = linkCopy[field.type];\n const {\n addLabel = `Choose ${fieldLabel(field)}`,\n emptyLabel,\n itemLabel = defaults.itemLabel,\n itemsLabel = defaults.itemsLabel,\n max,\n isReorderable,\n } = field.picker ?? {};\n return { addLabel, emptyLabel, itemLabel, itemsLabel, max, isReorderable };\n}\n\n/** The picked IDs, in stored order, skipping anything that isn't a link. */\nexport function selectedIds(field: FieldOf<\"asset\" | \"reference\">, value: unknown): string[] {\n const { key } = linkCopy[field.type];\n const links = Array.isArray(value) ? value : value === undefined ? [] : [value];\n return links.flatMap((link) =>\n isLink(link, key) ? [(link as Record<string, string>)[key]] : [],\n );\n}\n\n/** Accept UTC ISO strings without rolling invalid dates into the next month. */\nexport function parseUtcDateTime(value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return;\n }\n const match = /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2})(?::(\\d{2})(?:\\.(\\d{1,3}))?)?(?:Z|\\+00:00)$/.exec(\n value,\n );\n if (!match) {\n return;\n }\n const canonical = `${match[1]}:${match[2] ?? \"00\"}.${(match[3] ?? \"\").padEnd(3, \"0\")}Z`;\n const date = new Date(canonical);\n if (Number.isFinite(date.getTime()) && date.toISOString() === canonical) {\n return canonical;\n }\n}\n\nfunction isLink(value: unknown, key: \"assetId\" | \"entryId\"): boolean {\n return (\n !!value &&\n typeof value === \"object\" &&\n key in value &&\n typeof (value as Record<string, unknown>)[key] === \"string\" &&\n (value as Record<string, string>)[key].trim().length > 0\n );\n}\n\nfunction hasRichText(node: JSONContent): boolean {\n return !!node.text?.trim() || node.type === \"horizontalRule\" || !!node.content?.some(hasRichText);\n}\n\nfunction requiredError(field: FormField): string {\n return `${fieldLabel(field)} is required.`;\n}\n\nfunction textError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter text.\";\n }\n if (field.required && !value.trim()) {\n return requiredError(field);\n }\n if (\n (field.type === \"shortText\" || field.type === \"longText\") &&\n field.maxLength !== undefined &&\n value.length > field.maxLength\n ) {\n return `Enter no more than ${field.maxLength} characters.`;\n }\n}\n\nfunction richTextError(field: FormField, value: unknown): string | undefined {\n const error = documentError(value);\n if (error) {\n return error;\n }\n if (field.required && !hasRichText(value as RichTextDocument)) {\n return requiredError(field);\n }\n}\n\nfunction choiceError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Choose an available option.\";\n }\n if (value === \"\") {\n return field.required ? requiredError(field) : undefined;\n }\n // An empty list means the choices are still loading, so a stored value stays valid until they arrive.\n if (\n (field.type === \"select\" || field.type === \"radioGroup\") &&\n field.options.length > 0 &&\n !field.options.some((option) => option.value === value)\n ) {\n return \"Choose an available option.\";\n }\n}\n\nexport function stringList(value: unknown): string[] {\n return Array.isArray(value)\n ? value.filter((item): item is string => typeof item === \"string\")\n : [];\n}\n\nfunction listError(field: FormField, value: unknown): string | undefined {\n if (\n !Array.isArray(value) ||\n !value.every((item) => typeof item === \"string\" && item.trim()) ||\n new Set(value).size !== value.length\n ) {\n return \"Enter a list of unique, nonempty text values.\";\n }\n if (field.required && !value.length) {\n return requiredError(field);\n }\n if (field.type === \"tags\" && field.max !== undefined && value.length > field.max) {\n return `Enter no more than ${field.max} tags.`;\n }\n if (\n field.type === \"checkboxGroup\" &&\n field.options.length &&\n value.some((item) => !field.options.some((option) => option.value === item))\n ) {\n return \"Choose available options.\";\n }\n}\n\nfunction numberError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n return \"Enter a finite number.\";\n }\n const { min, max }: { min?: number; max?: number } =\n field.type === \"slider\" || field.type === \"rangeSlider\"\n ? sliderScale(field)\n : field.type === \"number\"\n ? field\n : {};\n if (min !== undefined && value < min) {\n return `Enter a number of at least ${min}.`;\n }\n if (max !== undefined && value > max) {\n return `Enter a number no greater than ${max}.`;\n }\n}\n\nfunction dateError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter a valid calendar date (YYYY-MM-DD).\";\n }\n if (!value) {\n return field.required ? requiredError(field) : undefined;\n }\n if (!isIsoDate(value)) {\n return \"Enter a valid calendar date (YYYY-MM-DD).\";\n }\n if (field.type !== \"date\") {\n return;\n }\n if (field.min && value < field.min) {\n return `Choose a date on or after ${field.min}.`;\n }\n if (field.max && value > field.max) {\n return `Choose a date on or before ${field.max}.`;\n }\n}\n\n/**\n * Display positions for loaded values: out-of-scale numbers clamp and reversed\n * endpoints swap, without overwriting the stored data that validation reports.\n * A value that is not a finite number has no position, so the control is unset.\n */\nexport function sliderValue(value: unknown, scale: SliderScale): number | undefined {\n return typeof value === \"number\" && Number.isFinite(value)\n ? clampToScale(value, scale)\n : undefined;\n}\n\n/** A range with neither endpoint usable is unset; one usable endpoint pairs with the scale's end. */\nexport function rangeSliderValue(value: unknown, scale: SliderScale): RangeSliderValue | undefined {\n const range = value as Partial<Record<\"min\" | \"max\", unknown>> | null;\n const start = sliderValue(range?.min, scale);\n const end = sliderValue(range?.max, scale);\n if (start === undefined && end === undefined) {\n return undefined;\n }\n const [low, high] = [start ?? scale.min, end ?? scale.max].sort((a, b) => a - b);\n return { min: low, max: high };\n}\n\nfunction rangeError(field: FormField, value: unknown): string | undefined {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return \"Enter a range.\";\n }\n const range = value as Record<string, unknown>;\n const start = range.min;\n const end = range.max;\n const error = numberError(field, start) ?? numberError(field, end);\n if (error) {\n return error;\n }\n if ((start as number) > (end as number)) {\n return \"The start must not be greater than the end.\";\n }\n if (\n field.type === \"rangeSlider\" &&\n preciseSum(end as number, -(start as number)) < sliderScale(field).step\n ) {\n return \"Keep the range endpoints at least one step apart.\";\n }\n}\n\nfunction colourError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter a valid colour.\";\n }\n if (!value.trim()) {\n return field.required ? requiredError(field) : undefined;\n }\n return parseColour(value) ? undefined : \"Enter a valid colour.\";\n}\n\nfunction linkError(field: FormField, value: unknown): string | undefined {\n if (field.type !== \"asset\" && field.type !== \"reference\") {\n return;\n }\n const { key, itemLabel, itemsLabel } = linkCopy[field.type];\n if (!field.multiple) {\n return isLink(value, key) ? undefined : `Choose an ${itemLabel}.`;\n }\n if (!Array.isArray(value) || !value.every((item) => isLink(item, key))) {\n return `Choose a list of ${itemsLabel}.`;\n }\n if (field.required && value.length === 0) {\n return requiredError(field);\n }\n const max = field.picker?.max;\n if (max !== undefined && value.length > max) {\n return `Choose no more than ${max} ${pickerCopy(field).itemsLabel}.`;\n }\n}\n\nconst validators: Record<\n FormField[\"type\"],\n (field: FormField, value: unknown) => string | undefined\n> = {\n shortText: textError,\n longText: textError,\n richText: richTextError,\n number: numberError,\n slider: numberError,\n rangeSlider: rangeError,\n date: dateError,\n colour: colourError,\n radioGroup: choiceError,\n checkboxGroup: listError,\n tags: listError,\n boolean: (_field, value) => (typeof value === \"boolean\" ? undefined : \"Choose a boolean value.\"),\n dateTime: (_field, value) =>\n parseUtcDateTime(value) ? undefined : \"Enter a valid UTC date and time.\",\n select: choiceError,\n asset: linkError,\n reference: linkError,\n};\n\nexport function fieldError(field: FormField, value: unknown): string | undefined {\n if (value === undefined) {\n return field.required ? requiredError(field) : undefined;\n }\n return validators[field.type](field, value);\n}\n\n/** Validate data loaded from JSON as well as values emitted by FormEditor. */\nexport function validateFormValues(model: FormSchema, values: Record<string, unknown>): FormErrors {\n assertModel(model);\n return Object.fromEntries(\n model.fields.flatMap((field): [string, string][] => {\n if (field.type === \"divider\") {\n return [];\n }\n const error = fieldError(\n field,\n Object.hasOwn(values, field.id) ? values[field.id] : undefined,\n );\n return error ? [[field.id, error]] : [];\n }),\n );\n}\n","import { Button } from \"../Button\";\nimport { Checkbox, ChoiceGroup, Radio } from \"../Choice\";\nimport { CheckboxCard, RadioCard, SelectionCardGroup } from \"../SelectionCard\";\nimport type { SelectOption } from \"../Select\";\nimport type { ControlProps } from \"./control\";\nimport { stringList, type FieldOf } from \"./model\";\n\ntype ChoiceField = FieldOf<\"radioGroup\" | \"checkboxGroup\">;\n\nfunction Option({\n field,\n option,\n name,\n checked,\n isDisabled,\n invalid,\n onChange,\n}: {\n field: ChoiceField;\n option: SelectOption;\n name: string;\n checked: boolean;\n isDisabled: boolean;\n invalid: true | undefined;\n onChange: () => void;\n}) {\n const props = {\n name,\n value: option.value,\n checked,\n disabled: isDisabled || option.isDisabled,\n \"aria-invalid\": invalid,\n onChange: () => {\n if (!isDisabled && !option.isDisabled) {\n onChange();\n }\n },\n };\n if (field.appearance === \"card\") {\n const Card = field.type === \"radioGroup\" ? RadioCard : CheckboxCard;\n return (\n <Card\n {...props}\n title={option.label}\n description={option.description}\n />\n );\n }\n const Choice = field.type === \"radioGroup\" ? Radio : Checkbox;\n return (\n <Choice {...props}>\n <span>\n {option.label}\n {option.description && (\n <span className=\"ds-form-editor__option-description\">{option.description}</span>\n )}\n </span>\n </Choice>\n );\n}\n\nexport function ChoiceControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<ChoiceField>) {\n const multiple = field.type === \"checkboxGroup\";\n // Option values are nonempty, so a stored \"\" selects nothing.\n const selected = multiple\n ? stringList(stored)\n : typeof stored === \"string\" && stored\n ? [stored]\n : [];\n const Group = field.appearance === \"card\" ? SelectionCardGroup : ChoiceGroup;\n return (\n <>\n <Group\n {...accessibility}\n label={field.label}\n columns={field.columns ?? (field.appearance === \"card\" ? 2 : 1)}\n >\n {field.options.map((option) => (\n <Option\n key={option.value}\n field={field}\n option={option}\n name={accessibility.id}\n checked={selected.includes(option.value)}\n isDisabled={isDisabled}\n invalid={accessibility[\"aria-invalid\"]}\n onChange={() => {\n if (multiple) {\n onChange(\n selected.includes(option.value)\n ? selected.filter((value) => value !== option.value)\n : [...selected, option.value],\n );\n } else {\n onChange(option.value);\n }\n }}\n />\n ))}\n </Group>\n {!multiple && !required && selected.length > 0 && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isDisabled={isDisabled}\n onClick={() => onChange(undefined)}\n >\n Clear {field.label}\n </Button>\n )}\n </>\n );\n}\n","import { ColourField } from \"../ColourField\";\nimport { parseColour } from \"../ColourField/colour\";\nimport { DateField } from \"../DatePicker\";\nimport { RangeSlider, Slider } from \"../Slider\";\nimport { sliderScale } from \"../Slider/scale\";\nimport { TagsInput } from \"../TagsInput\";\nimport { ChoiceControl } from \"./choice-control\";\nimport type { ControlProps } from \"./control\";\nimport { rangeSliderValue, sliderValue, stringList, type FieldOf } from \"./model\";\n\ntype AdditionalField = FieldOf<\n \"slider\" | \"rangeSlider\" | \"date\" | \"colour\" | \"tags\" | \"radioGroup\" | \"checkboxGroup\"\n>;\n\nfunction SliderControl({\n field,\n stored,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"slider\">>) {\n const scale = sliderScale(field);\n const shown = sliderValue(stored, scale);\n return (\n <Slider\n {...accessibility}\n {...scale}\n prefix={field.prefix}\n suffix={field.suffix}\n hasValueLabel={field.hasValueLabel}\n valueText={shown === undefined ? (field.placeholder ?? \"Not set\") : undefined}\n autoFocus={field.autoFocus}\n isDisabled={isDisabled}\n value={shown ?? scale.min}\n onValueChange={onChange}\n // An unset thumb rests at the minimum, where a click or a key toward it fires\n // no change event. Committing stores the position the slider shows.\n onValueCommit={(next) => {\n if (shown === undefined) {\n onChange(next);\n }\n }}\n />\n );\n}\n\nfunction RangeSliderControl({\n field,\n stored,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"rangeSlider\">>) {\n const scale = sliderScale(field);\n const shown = rangeSliderValue(stored, scale);\n return (\n <RangeSlider\n {...accessibility}\n {...scale}\n prefix={field.prefix}\n suffix={field.suffix}\n hasValueLabel={field.hasValueLabel}\n minLabel={`${field.label} minimum`}\n maxLabel={`${field.label} maximum`}\n isDisabled={isDisabled}\n // Unset thumbs rest at both ends without a fill, so nothing looks chosen; a click\n // or key that leaves them there stores the full range they show.\n valueText={shown === undefined ? (field.placeholder ?? \"Not set\") : undefined}\n hasFill={shown !== undefined}\n value={shown ?? { min: scale.min, max: scale.max }}\n onValueChange={onChange}\n onValueCommit={(next) => {\n if (shown === undefined) {\n onChange(next);\n }\n }}\n />\n );\n}\n\nexport function AdditionalControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<AdditionalField>) {\n const props = { stored, isDisabled, required, accessibility, onChange };\n switch (field.type) {\n case \"radioGroup\":\n case \"checkboxGroup\":\n return (\n <ChoiceControl\n field={field}\n {...props}\n />\n );\n case \"rangeSlider\":\n return (\n <RangeSliderControl\n field={field}\n {...props}\n />\n );\n case \"slider\":\n return (\n <SliderControl\n field={field}\n {...props}\n />\n );\n case \"colour\":\n return (\n <ColourField\n {...accessibility}\n required={required}\n placeholder={field.placeholder}\n presets={field.presets}\n showPresets={field.showPresets}\n picker={field.picker}\n placement={field.placement}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n isDisabled={isDisabled}\n value={typeof stored === \"string\" ? stored : \"\"}\n onInput={(event) => {\n const raw = event.currentTarget.value;\n if (raw.trim() && !parseColour(raw)) {\n onChange(raw);\n }\n }}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n case \"tags\":\n return (\n <TagsInput\n {...accessibility}\n required={required}\n placeholder={field.placeholder}\n max={field.max}\n isDisabled={isDisabled}\n value={stringList(stored)}\n onValueChange={onChange}\n />\n );\n case \"date\":\n return (\n <DateField\n {...accessibility}\n placeholder={field.placeholder}\n min={field.min}\n max={field.max}\n placement={field.placement}\n isDisabled={isDisabled}\n isClearable\n clearLabel={`Clear ${field.label}`}\n value={typeof stored === \"string\" ? stored : \"\"}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n }\n}\n","import { EntryPicker, type EntryItem } from \"../EntryPicker\";\nimport type { FieldRenderProps } from \"../Field\";\nimport { NumberField } from \"../NumberField\";\nimport { RichTextEditor, type RichTextDocument } from \"../RichTextEditor\";\nimport { emptyDocument } from \"../RichTextEditor/document\";\nimport { Select } from \"../Select\";\nimport { Switch } from \"../Switch\";\nimport { TextArea, TextField } from \"../TextField\";\nimport { AdditionalControl } from \"./additional-control\";\nimport {\n parseUtcDateTime,\n pickerCopy,\n type FieldOf,\n type FormField,\n type FormFieldValue,\n} from \"./model\";\n\nfunction pickerValue(\n field: FieldOf<\"asset\" | \"reference\">,\n ids: string[],\n): FormFieldValue | undefined {\n if (field.type === \"asset\") {\n const links = ids.map((assetId) => ({ assetId }));\n return field.multiple ? links : links[0];\n }\n const links = ids.map((entryId) => ({ entryId }));\n return field.multiple ? links : links[0];\n}\n\ntype Accessibility = FieldRenderProps;\n\nexport interface ControlProps<F extends FormField> {\n field: F;\n stored: FormFieldValue | undefined;\n isDisabled: boolean;\n required: boolean | undefined;\n accessibility: Omit<Accessibility, \"required\">;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\nfunction NumberControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"number\">>) {\n return (\n <NumberField\n {...accessibility}\n required={required}\n isDisabled={isDisabled}\n placeholder={field.placeholder}\n min={field.min}\n max={field.max}\n step={field.step ?? \"any\"}\n hasSteppers={field.hasSteppers ?? false}\n prefix={field.prefix}\n suffix={field.suffix}\n autoFocus={field.autoFocus}\n decreaseLabel={`Decrease ${field.label}`}\n increaseLabel={`Increase ${field.label}`}\n value={typeof stored === \"number\" && Number.isFinite(stored) ? stored : \"\"}\n onValueChange={(next) => {\n if (next === \"\" || Number.isFinite(next)) {\n onChange(next === \"\" ? undefined : next);\n }\n }}\n />\n );\n}\n\nfunction SelectControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"select\">>) {\n // Optional selects lead with an empty choice; picking it removes the key.\n const isClearable = !required && !field.options.some((option) => option.value === \"\");\n return (\n <Select\n {...accessibility}\n aria-required={required || undefined}\n isDisabled={isDisabled}\n isInvalid={accessibility[\"aria-invalid\"]}\n options={\n isClearable\n ? [{ value: \"\", label: field.placeholder ?? \"None\" }, ...field.options]\n : field.options\n }\n placeholder={field.placeholder}\n autoFocus={field.autoFocus}\n value={typeof stored === \"string\" ? stored : \"\"}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n}\n\nfunction PickerControl({\n field,\n selected,\n items,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"asset\" | \"reference\">> & { items: EntryItem[]; selected: string[] }) {\n return (\n <EntryPicker\n {...accessibility}\n items={items}\n value={selected}\n {...pickerCopy(field)}\n mode={field.multiple ? \"multiple\" : \"single\"}\n isDisabled={isDisabled}\n onValueChange={(ids) => onChange(pickerValue(field, ids))}\n />\n );\n}\n\ninterface FormControlProps {\n field: FormField;\n stored: FormFieldValue | undefined;\n /** Picker fields' stored IDs, derived once by the owning field. */\n selected: string[] | undefined;\n items: EntryItem[];\n isDisabled: boolean;\n accessibility: Accessibility;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\nexport function FormControl({\n field,\n stored,\n selected,\n items,\n isDisabled,\n accessibility: { required, ...accessibility },\n onChange,\n}: FormControlProps) {\n const shared = { stored, isDisabled, required, accessibility, onChange };\n switch (field.type) {\n case \"shortText\":\n return (\n <TextField\n {...accessibility}\n required={required}\n disabled={isDisabled}\n placeholder={field.placeholder}\n type={field.inputType}\n maxLength={field.maxLength}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n value={typeof stored === \"string\" ? stored : \"\"}\n onChange={(event) => onChange(event.target.value)}\n />\n );\n case \"longText\":\n return (\n <TextArea\n {...accessibility}\n required={required}\n disabled={isDisabled}\n placeholder={field.placeholder}\n rows={field.rows}\n maxLength={field.maxLength}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n value={typeof stored === \"string\" ? stored : \"\"}\n onChange={(event) => onChange(event.target.value)}\n />\n );\n case \"number\":\n return (\n <NumberControl\n field={field}\n {...shared}\n />\n );\n case \"boolean\":\n return (\n <Switch\n {...accessibility}\n isDisabled={isDisabled}\n autoFocus={field.autoFocus}\n isSelected={stored === true}\n onSelectedChange={onChange}\n />\n );\n case \"dateTime\":\n return (\n <TextField\n {...accessibility}\n required={required}\n disabled={isDisabled}\n type=\"datetime-local\"\n step=\"0.001\"\n autoFocus={field.autoFocus}\n value={parseUtcDateTime(stored)?.slice(0, -1) ?? \"\"}\n onChange={(event) => onChange(parseUtcDateTime(`${event.target.value}Z`))}\n />\n );\n case \"richText\":\n return (\n <RichTextEditor\n {...accessibility}\n expandedWidth={field.expandedWidth}\n label={field.label}\n isRequired={required}\n isDisabled={isDisabled}\n placeholder={field.placeholder}\n format=\"json\"\n value={stored === undefined ? emptyDocument : (stored as RichTextDocument)}\n onChange={onChange}\n />\n );\n case \"select\":\n return (\n <SelectControl\n field={field}\n {...shared}\n />\n );\n case \"asset\":\n case \"reference\":\n return (\n <PickerControl\n field={field}\n items={items}\n selected={selected ?? []}\n {...shared}\n />\n );\n default:\n return (\n <AdditionalControl\n field={field}\n {...shared}\n />\n );\n }\n}\n","import { useMemo, useState, type CSSProperties, type HTMLAttributes } from \"react\";\nimport { Container } from \"../Container\";\nimport type { EntryItem } from \"../EntryPicker\";\nimport { Field } from \"../Field\";\nimport type { GridColumns } from \"../Grid\";\nimport { FormControl } from \"./control\";\nimport {\n assertModel,\n fieldError,\n fieldLabel,\n selectedIds,\n stringList,\n type FormField,\n type FormSchema,\n type FormErrors,\n type FormFieldValue,\n type FormValues,\n} from \"./model\";\nimport \"./style.css\";\n\nexport { validateFormValues } from \"./model\";\nexport type {\n AssetValue,\n FormField,\n FormDivider,\n FormItem,\n FormSchema,\n FormErrors,\n FormFieldValue,\n FormValues,\n ReferenceValue,\n} from \"./model\";\n\nexport interface FormChange {\n fieldId: string;\n}\n\nexport interface FormEditorProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"defaultValue\" | \"onChange\"\n> {\n schema: FormSchema;\n value?: FormValues;\n defaultValue?: FormValues;\n onValueChange?: (values: FormValues, change: FormChange) => void;\n /** Available assets or entries, keyed by field ID. Loading belongs to the app. */\n pickerItems?: Record<string, EntryItem[]>;\n /** App-provided messages take precedence over built-in validation. */\n errors?: FormErrors;\n isDisabled?: boolean;\n showAllErrors?: boolean;\n /** Columns at the widest. The form drops one whenever a field would be narrower than `minColumnWidth`. */\n columns?: GridColumns;\n /** Narrowest a field may get before the form drops a column. */\n minColumnWidth?: string;\n}\n\ninterface FormEditorFieldProps {\n field: FormField;\n stored: FormFieldValue | undefined;\n items: EntryItem[];\n isDisabled: boolean;\n error: string | undefined;\n isErrorVisible: boolean;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\n/** Validates only when its message can show, and only when its own field or value changes. */\nfunction FormEditorField({\n field,\n stored,\n items,\n isDisabled,\n error,\n isErrorVisible,\n onChange,\n}: FormEditorFieldProps) {\n const validation = useMemo(\n () => (error === undefined && isErrorVisible ? fieldError(field, stored) : undefined),\n [error, isErrorVisible, field, stored],\n );\n const selected = useMemo(\n () =>\n field.type === \"asset\" || field.type === \"reference\" ? selectedIds(field, stored) : undefined,\n [field, stored],\n );\n return (\n <Container\n width={field.width}\n padded={false}\n center={false}\n className=\"ds-form-editor__field\"\n >\n <Field\n label={field.type === \"dateTime\" ? `${field.label} (UTC)` : fieldLabel(field)}\n hint={field.hint}\n error={error ?? validation}\n isRequired={field.required}\n count={\n selected?.length ??\n (field.type === \"checkboxGroup\" ? stringList(stored).length : undefined)\n }\n isGroup={selected !== undefined || groupTypes.has(field.type)}\n >\n {(accessibility) => (\n <FormControl\n field={field}\n stored={stored}\n selected={selected}\n items={items}\n isDisabled={isDisabled}\n accessibility={accessibility}\n onChange={onChange}\n />\n )}\n </Field>\n </Container>\n );\n}\n\nconst groupTypes = new Set([\"radioGroup\", \"checkboxGroup\", \"rangeSlider\"]);\nconst loadedValidationTypes = new Set([\"slider\", \"rangeSlider\", \"date\", \"colour\"]);\n\n/** Ordered form controls. Loading, submission, and persistence belong to the app. */\nexport function FormEditor({\n schema,\n value,\n defaultValue = {},\n onValueChange,\n pickerItems = {},\n errors = {},\n isDisabled = false,\n showAllErrors = false,\n columns = 1,\n minColumnWidth = \"16rem\",\n className,\n style,\n ...rest\n}: FormEditorProps) {\n const [internal, setInternal] = useState<FormValues>(defaultValue);\n const [changed, setChanged] = useState<Set<string>>(() => new Set());\n const current = value ?? internal;\n useMemo(() => assertModel(schema), [schema]);\n\n const commit = (fieldId: string, next: FormFieldValue | undefined) => {\n const values = { ...current };\n if (next === undefined) {\n delete values[fieldId];\n } else {\n values[fieldId] = next;\n }\n if (value === undefined) {\n setInternal(values);\n }\n setChanged((previous) => new Set(previous).add(fieldId));\n onValueChange?.(values, { fieldId });\n };\n\n const layout =\n columns === \"auto\"\n ? { \"--form-editor-min-column\": minColumnWidth }\n : { \"--form-editor-columns\": columns, \"--form-editor-min-column\": minColumnWidth };\n\n return (\n <div\n className={[\"ds-form-editor\", columns === \"auto\" && \"ds-form-editor--auto\", className]\n .filter(Boolean)\n .join(\" \")}\n style={{ ...layout, ...style } as CSSProperties}\n {...rest}\n >\n {schema.fields.map((field) => {\n if (field.type === \"divider\") {\n return (\n <hr\n key={field.id}\n className=\"ds-form-editor__divider\"\n />\n );\n }\n const stored = Object.hasOwn(current, field.id) ? current[field.id] : undefined;\n const fieldDisabled = isDisabled || Boolean(field.isDisabled);\n const isLocked = fieldDisabled || (\"readOnly\" in field && Boolean(field.readOnly));\n // Explain loaded invalid values alongside the controls' invalid styling. Blank\n // strings are empty, so their required message waits like any other field's.\n const isLoaded = typeof stored === \"string\" ? stored.trim() !== \"\" : stored !== undefined;\n const isErrorVisible =\n showAllErrors ||\n changed.has(field.id) ||\n (isLoaded && loadedValidationTypes.has(field.type)) ||\n (field.type === \"number\" && typeof stored === \"number\");\n return (\n <FormEditorField\n key={field.id}\n field={field}\n stored={stored}\n items={pickerItems[field.id] ?? []}\n isDisabled={fieldDisabled}\n error={errors[field.id]}\n isErrorVisible={isErrorVisible}\n onChange={(next) => {\n if (!isLocked) {\n commit(field.id, next);\n }\n }}\n />\n );\n })}\n </div>\n );\n}\n"],"mappings":"A,yvBACA,IAAamD,EAAiB,CAAC,OAAQ,MAAM,ECcvCC,EAAc,CAAC,KAAM,KAAM,IAAI,EAyI/BC,EAAa,IAAI,IAAI,CACzB,YACA,WACA,WACA,SACA,UACA,WACA,QACA,YACA,SACA,SACA,cACA,SACA,aACA,gBACA,OACA,OACA,SACF,CAAC,EAED,SAAgBC,EAAY,EAAmB,CAC7C,IAAMC,EAAM,IAAI,IAChB,IAAK,IAAMC,KAASC,EAAM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,CAAE,wBAAyBD,EAAS,2BAA4BC,CAAe,EAErF,OACE,EAAA7G,EAAA,IAAA,CAAC,MAAD,CACE,UAAW,CAAC,iBAAkB4G,IAAY,QAAU,uBAAwBE,CAAS,CAAC,CACnF,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,EACX,MAAO,CAAE,GAAGH,EAAQ,GAAGI,CAAM,EAC7B,GAAIhB,EAEH,SAAAO,EAAO,OAAO,IAAK,GAAU,CAC5B,GAAIhG,EAAM,OAAS,UACjB,OACE,EAAAN,EAAA,IAAA,CAAC,KAAD,CAEE,UAAU,yBACX,EAFMM,EAAM,EAEZ,EAGL,IAAMgE,EAAS,OAAO,OAAO+B,EAAS/F,EAAM,EAAE,EAAI+F,EAAQ/F,EAAM,IAAM,IAAA,GAChE0G,EAAgBlD,GAAc,EAAQxD,EAAM,WAC5C2G,EAAWD,GAAkB,aAAc1G,GAAS,EAAQA,EAAM,SAGlE4G,EAAW,OAAO5C,GAAW,SAAWA,EAAO,KAAK,IAAM,GAAKA,IAAW,IAAA,GAC1EqB,EACJwB,GACAhB,EAAQ,IAAI7F,EAAM,EAAE,GACnB4G,GAAYrB,GAAsB,IAAIvF,EAAM,IAAI,GAChDA,EAAM,OAAS,UAAY,OAAOgE,GAAW,SAChD,OACE,EAAAtE,EAAA,IAAA,CAACyF,GAAD,CAES,QACC,SACR,MAAO2B,EAAY9G,EAAM,KAAO,CAAC,EACjC,WAAY0G,EACZ,MAAOK,EAAO/G,EAAM,IACJ,iBAChB,SAAW,GAAS,CACb2G,GACHV,EAAOjG,EAAM,GAAIsE,CAAI,CAEzB,CACD,EAZMtE,EAAM,EAYZ,CAEL,CAAC,CACE,CAAA,CAET,C"}
|
|
1
|
+
{"version":3,"file":"FormEditor-BbsvbufQ.cjs","names":["sliderScale","preciseSum","documentError","isIsoDate","clampToScale","parseColour","RadioCard","CheckboxCard","Radio","Checkbox","SelectionCardGroup","ChoiceGroup","_Fragment","Button","sliderScale","Slider","RangeSlider","ColourField","parseColour","TagsInput","DateField","NumberField","Select","EntryPicker","TextField","TextArea","Switch","RichTextEditor","emptyDocument","useMemo","Container","Field","useState","require_colour","require_components_Button_index","require_components_Field_index","require_components_TextField_index","require_RichTextEditor","require_components_Container_index","require_components_EntryPicker_index","require_components_NumberField_index","require_components_Select_index","require_components_Switch_index","require_ColourField","require_Slider","require_DatePicker","require_components_TagsInput_index","require_components_Choice_index","require_components_SelectionCard_index","react","react_jsx_runtime","expandedWidths","fieldWidths","fieldTypes","assertModel","ids","field","model","assertChoices","assertSlider","assertMeasures","min","max","step","kind","values","option","value","linkCopy","fieldLabel","pickerCopy","defaults","selectedIds","isLink","link","key","parseUtcDateTime","match","canonical","date","hasRichText","node","requiredError","textError","richTextError","error","choiceError","stringList","item","listError","numberError","dateError","sliderValue","scale","rangeSliderValue","range","start","end","low","high","a","b","rangeError","colourError","linkError","itemLabel","itemsLabel","validators","fieldError","validateFormValues","Option","props","isDisabled","invalid","onChange","Card","Choice","ChoiceControl","multiple","selected","stored","Group","accessibility","required","SliderControl","shown","next","RangeSliderControl","AdditionalControl","raw","event","pickerValue","links","NumberControl","SelectControl","isClearable","PickerControl","FormControl","shared","FormEditorField","validation","isErrorVisible","groupTypes","loadedValidationTypes","FormEditor","rest","internal","setInternal","defaultValue","changed","setChanged","current","schema","commit","fieldId","previous","onValueChange","layout","columns","minColumnWidth","className","style","fieldDisabled","isLocked","isLoaded","showAllErrors","pickerItems","errors"],"sources":["../../src/components/RichTextEditor/expanded-width.ts","../../src/components/FormEditor/model.ts","../../src/components/FormEditor/choice-control.tsx","../../src/components/FormEditor/additional-control.tsx","../../src/components/FormEditor/control.tsx","../../src/components/FormEditor/index.tsx"],"sourcesContent":["/** Expanded writing measures: `wide` caps at the shared wide Modal width; `full` fills the viewport inside the scrim's gutters. */\nexport const expandedWidths = [\"wide\", \"full\"] as const;\n\nexport type RichTextEditorExpandedWidth = (typeof expandedWidths)[number];\n","import type { ReactNode } from \"react\";\nimport type { SelectOption } from \"../Select\";\nimport type { EntryPickerProps } from \"../EntryPicker\";\nimport type { JSONContent } from \"@tiptap/react\";\nimport { documentError } from \"../RichTextEditor/document\";\nimport type { RichTextDocument } from \"../RichTextEditor\";\nimport { expandedWidths, type RichTextEditorExpandedWidth } from \"../RichTextEditor/expanded-width\";\nimport { isIsoDate } from \"../DatePicker/date\";\nimport type { RangeSliderValue } from \"../Slider\";\nimport { clampToScale, preciseSum, sliderScale, type SliderScale } from \"../Slider/scale\";\nimport { parseColour } from \"../ColourField/colour\";\nimport type { PopoverPlacement } from \"../Popover\";\nimport type { ContainerWidth } from \"../Container\";\n\n/** The shared measures a field may cap at; checked against Container's scale. */\nconst fieldWidths = [\"sm\", \"md\", \"lg\"] as const satisfies readonly ContainerWidth[];\n\ninterface FormFieldBase {\n id: string;\n label: string;\n hint?: ReactNode;\n /** Maximum width of the whole field, using Container's measures and its `lg` default. */\n width?: (typeof fieldWidths)[number];\n placeholder?: string;\n required?: boolean;\n isDisabled?: boolean;\n}\n\ninterface SliderOptions {\n multiple?: never;\n min?: number;\n max?: number;\n step?: number;\n prefix?: string;\n suffix?: string;\n hasValueLabel?: boolean;\n}\n\ninterface ChoiceOptions {\n multiple?: never;\n autoFocus?: never;\n options: SelectOption[];\n appearance?: \"default\" | \"card\";\n /** Maximum options per row inside this group; independent of FormEditor columns. */\n columns?: 1 | 2 | 3;\n}\n\nexport type FormField = FormFieldBase &\n (\n | {\n type: \"shortText\";\n inputType?: \"text\" | \"email\";\n maxLength?: number;\n readOnly?: boolean;\n autoFocus?: boolean;\n multiple?: never;\n }\n | {\n type: \"longText\";\n rows?: number;\n maxLength?: number;\n readOnly?: boolean;\n autoFocus?: boolean;\n multiple?: never;\n }\n | { type: \"boolean\" | \"dateTime\"; autoFocus?: boolean; multiple?: never }\n | {\n type: \"richText\";\n expandedWidth?: RichTextEditorExpandedWidth;\n autoFocus?: never;\n multiple?: never;\n }\n | {\n type: \"number\";\n min?: number;\n max?: number;\n step?: number | \"any\";\n hasSteppers?: boolean;\n prefix?: string;\n suffix?: string;\n autoFocus?: boolean;\n multiple?: never;\n }\n | { type: \"select\"; options: SelectOption[]; autoFocus?: boolean; multiple?: never }\n | ({ type: \"slider\"; autoFocus?: boolean } & SliderOptions)\n | ({ type: \"rangeSlider\"; autoFocus?: never } & SliderOptions)\n | ({ type: \"radioGroup\" } & ChoiceOptions)\n | ({ type: \"checkboxGroup\" } & ChoiceOptions)\n | {\n type: \"colour\";\n multiple?: never;\n presets?: string[];\n showPresets?: boolean;\n picker?: \"custom\" | \"native\";\n placement?: PopoverPlacement;\n readOnly?: boolean;\n autoFocus?: boolean;\n }\n | { type: \"tags\"; max?: number; multiple?: never; autoFocus?: never }\n | {\n type: \"date\";\n min?: string;\n max?: string;\n placement?: PopoverPlacement;\n multiple?: never;\n autoFocus?: never;\n }\n | {\n type: \"asset\" | \"reference\";\n multiple?: boolean;\n autoFocus?: never;\n picker?: Pick<\n EntryPickerProps,\n \"label\" | \"addLabel\" | \"emptyLabel\" | \"itemLabel\" | \"itemsLabel\" | \"max\" | \"isReorderable\"\n >;\n }\n );\n\nexport type FieldOf<T extends FormField[\"type\"]> = Extract<FormField, { type: T }>;\n\n/** Layout only: no label, value, disabled state, or validation. */\nexport interface FormDivider {\n id: string;\n type: \"divider\";\n}\n\nexport type FormItem = FormField | FormDivider;\n\nexport interface FormSchema {\n fields: readonly FormItem[];\n}\n\nexport interface AssetValue {\n assetId: string;\n}\nexport interface ReferenceValue {\n entryId: string;\n}\nexport type FormFieldValue =\n | string\n | number\n | boolean\n | RichTextDocument\n | AssetValue\n | ReferenceValue\n | string[]\n | RangeSliderValue\n | AssetValue[]\n | ReferenceValue[];\nexport type FormValues = Record<string, FormFieldValue | undefined>;\nexport type FormErrors = Partial<Record<string, string>>;\n\nconst fieldTypes = new Set([\n \"shortText\",\n \"longText\",\n \"richText\",\n \"number\",\n \"boolean\",\n \"dateTime\",\n \"asset\",\n \"reference\",\n \"select\",\n \"slider\",\n \"rangeSlider\",\n \"colour\",\n \"radioGroup\",\n \"checkboxGroup\",\n \"tags\",\n \"date\",\n \"divider\",\n]);\n\nexport function assertModel(model: FormSchema) {\n const ids = new Set<string>();\n for (const field of model.fields) {\n if (!field.id?.trim() || ids.has(field.id)) {\n throw new Error(\"Form field IDs must be nonempty and unique.\");\n }\n if (!fieldTypes.has(field.type)) {\n throw new Error(`Unsupported form field type: ${field.type}`);\n }\n if (field.type === \"select\" || field.type === \"radioGroup\" || field.type === \"checkboxGroup\") {\n assertChoices(field);\n }\n if (field.type === \"slider\" || field.type === \"rangeSlider\") {\n assertSlider(field);\n }\n if (field.type !== \"divider\") {\n assertMeasures(field);\n }\n ids.add(field.id);\n }\n}\n\n/** Runtime schemas can carry any string; the types only cover typed schemas. */\nfunction assertMeasures(field: FormField) {\n if (field.width !== undefined && !fieldWidths.includes(field.width)) {\n throw new Error(`Field ${field.id} needs a width of sm, md or lg.`);\n }\n if (\n field.type === \"richText\" &&\n field.expandedWidth !== undefined &&\n !expandedWidths.includes(field.expandedWidth)\n ) {\n throw new Error(`Rich text field ${field.id} needs an expandedWidth of wide or full.`);\n }\n}\n\nfunction assertSlider(field: FieldOf<\"slider\" | \"rangeSlider\">) {\n const { min, max, step } = sliderScale(field);\n if (![min, max, step].every(Number.isFinite) || min >= max || step <= 0) {\n throw new Error(`Slider field ${field.id} needs finite min < max and a positive step.`);\n }\n if (field.type === \"rangeSlider\" && step > preciseSum(max, -min)) {\n throw new Error(`Range slider ${field.id} needs room for at least one step.`);\n }\n}\n\nfunction assertChoices(field: FieldOf<\"select\" | \"radioGroup\" | \"checkboxGroup\">) {\n if (!Array.isArray(field.options)) {\n const kind = field.type === \"select\" ? \"Select\" : \"Choice\";\n throw new Error(`${kind} field ${field.id} needs an options array.`);\n }\n if (field.type === \"select\") {\n return;\n }\n const values = field.options.map((option) => option.value);\n if (\n values.some((value) => typeof value !== \"string\" || !value.trim()) ||\n new Set(values).size !== values.length\n ) {\n throw new Error(`Choice field ${field.id} needs nonempty, unique option values.`);\n }\n}\n\nconst linkCopy = {\n asset: { key: \"assetId\", itemLabel: \"asset\", itemsLabel: \"assets\" },\n reference: { key: \"entryId\", itemLabel: \"entry\", itemsLabel: \"entries\" },\n} as const;\n\n/** The field's visible and accessible name. A picker's `label` overrides it. */\nexport function fieldLabel(field: FormField): string {\n return field.type === \"asset\" || field.type === \"reference\"\n ? (field.picker?.label ?? field.label)\n : field.label;\n}\n\n/** Picker action and item copy, with asset or entry wording for any option left out or undefined. */\nexport function pickerCopy(field: FieldOf<\"asset\" | \"reference\">) {\n const defaults = linkCopy[field.type];\n const {\n addLabel = `Choose ${fieldLabel(field)}`,\n emptyLabel,\n itemLabel = defaults.itemLabel,\n itemsLabel = defaults.itemsLabel,\n max,\n isReorderable,\n } = field.picker ?? {};\n return { addLabel, emptyLabel, itemLabel, itemsLabel, max, isReorderable };\n}\n\n/** The picked IDs, in stored order, skipping anything that isn't a link. */\nexport function selectedIds(field: FieldOf<\"asset\" | \"reference\">, value: unknown): string[] {\n const { key } = linkCopy[field.type];\n const links = Array.isArray(value) ? value : value === undefined ? [] : [value];\n return links.flatMap((link) =>\n isLink(link, key) ? [(link as Record<string, string>)[key]] : [],\n );\n}\n\n/** Accept UTC ISO strings without rolling invalid dates into the next month. */\nexport function parseUtcDateTime(value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return;\n }\n const match = /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2})(?::(\\d{2})(?:\\.(\\d{1,3}))?)?(?:Z|\\+00:00)$/.exec(\n value,\n );\n if (!match) {\n return;\n }\n const canonical = `${match[1]}:${match[2] ?? \"00\"}.${(match[3] ?? \"\").padEnd(3, \"0\")}Z`;\n const date = new Date(canonical);\n if (Number.isFinite(date.getTime()) && date.toISOString() === canonical) {\n return canonical;\n }\n}\n\nfunction isLink(value: unknown, key: \"assetId\" | \"entryId\"): boolean {\n return (\n !!value &&\n typeof value === \"object\" &&\n key in value &&\n typeof (value as Record<string, unknown>)[key] === \"string\" &&\n (value as Record<string, string>)[key].trim().length > 0\n );\n}\n\nfunction hasRichText(node: JSONContent): boolean {\n return !!node.text?.trim() || node.type === \"horizontalRule\" || !!node.content?.some(hasRichText);\n}\n\nfunction requiredError(field: FormField): string {\n return `${fieldLabel(field)} is required.`;\n}\n\nfunction textError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter text.\";\n }\n if (field.required && !value.trim()) {\n return requiredError(field);\n }\n if (\n (field.type === \"shortText\" || field.type === \"longText\") &&\n field.maxLength !== undefined &&\n value.length > field.maxLength\n ) {\n return `Enter no more than ${field.maxLength} characters.`;\n }\n}\n\nfunction richTextError(field: FormField, value: unknown): string | undefined {\n const error = documentError(value);\n if (error) {\n return error;\n }\n if (field.required && !hasRichText(value as RichTextDocument)) {\n return requiredError(field);\n }\n}\n\nfunction choiceError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Choose an available option.\";\n }\n if (value === \"\") {\n return field.required ? requiredError(field) : undefined;\n }\n // An empty list means the choices are still loading, so a stored value stays valid until they arrive.\n if (\n (field.type === \"select\" || field.type === \"radioGroup\") &&\n field.options.length > 0 &&\n !field.options.some((option) => option.value === value)\n ) {\n return \"Choose an available option.\";\n }\n}\n\nexport function stringList(value: unknown): string[] {\n return Array.isArray(value)\n ? value.filter((item): item is string => typeof item === \"string\")\n : [];\n}\n\nfunction listError(field: FormField, value: unknown): string | undefined {\n if (\n !Array.isArray(value) ||\n !value.every((item) => typeof item === \"string\" && item.trim()) ||\n new Set(value).size !== value.length\n ) {\n return \"Enter a list of unique, nonempty text values.\";\n }\n if (field.required && !value.length) {\n return requiredError(field);\n }\n if (field.type === \"tags\" && field.max !== undefined && value.length > field.max) {\n return `Enter no more than ${field.max} tags.`;\n }\n if (\n field.type === \"checkboxGroup\" &&\n field.options.length &&\n value.some((item) => !field.options.some((option) => option.value === item))\n ) {\n return \"Choose available options.\";\n }\n}\n\nfunction numberError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n return \"Enter a finite number.\";\n }\n const { min, max }: { min?: number; max?: number } =\n field.type === \"slider\" || field.type === \"rangeSlider\"\n ? sliderScale(field)\n : field.type === \"number\"\n ? field\n : {};\n if (min !== undefined && value < min) {\n return `Enter a number of at least ${min}.`;\n }\n if (max !== undefined && value > max) {\n return `Enter a number no greater than ${max}.`;\n }\n}\n\nfunction dateError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter a valid calendar date (YYYY-MM-DD).\";\n }\n if (!value) {\n return field.required ? requiredError(field) : undefined;\n }\n if (!isIsoDate(value)) {\n return \"Enter a valid calendar date (YYYY-MM-DD).\";\n }\n if (field.type !== \"date\") {\n return;\n }\n if (field.min && value < field.min) {\n return `Choose a date on or after ${field.min}.`;\n }\n if (field.max && value > field.max) {\n return `Choose a date on or before ${field.max}.`;\n }\n}\n\n/**\n * Display positions for loaded values: out-of-scale numbers clamp and reversed\n * endpoints swap, without overwriting the stored data that validation reports.\n * A value that is not a finite number has no position, so the control is unset.\n */\nexport function sliderValue(value: unknown, scale: SliderScale): number | undefined {\n return typeof value === \"number\" && Number.isFinite(value)\n ? clampToScale(value, scale)\n : undefined;\n}\n\n/** A range with neither endpoint usable is unset; one usable endpoint pairs with the scale's end. */\nexport function rangeSliderValue(value: unknown, scale: SliderScale): RangeSliderValue | undefined {\n const range = value as Partial<Record<\"min\" | \"max\", unknown>> | null;\n const start = sliderValue(range?.min, scale);\n const end = sliderValue(range?.max, scale);\n if (start === undefined && end === undefined) {\n return undefined;\n }\n const [low, high] = [start ?? scale.min, end ?? scale.max].sort((a, b) => a - b);\n return { min: low, max: high };\n}\n\nfunction rangeError(field: FormField, value: unknown): string | undefined {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return \"Enter a range.\";\n }\n const range = value as Record<string, unknown>;\n const start = range.min;\n const end = range.max;\n const error = numberError(field, start) ?? numberError(field, end);\n if (error) {\n return error;\n }\n if ((start as number) > (end as number)) {\n return \"The start must not be greater than the end.\";\n }\n if (\n field.type === \"rangeSlider\" &&\n preciseSum(end as number, -(start as number)) < sliderScale(field).step\n ) {\n return \"Keep the range endpoints at least one step apart.\";\n }\n}\n\nfunction colourError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter a valid colour.\";\n }\n if (!value.trim()) {\n return field.required ? requiredError(field) : undefined;\n }\n return parseColour(value) ? undefined : \"Enter a valid colour.\";\n}\n\nfunction linkError(field: FormField, value: unknown): string | undefined {\n if (field.type !== \"asset\" && field.type !== \"reference\") {\n return;\n }\n const { key, itemLabel, itemsLabel } = linkCopy[field.type];\n if (!field.multiple) {\n return isLink(value, key) ? undefined : `Choose an ${itemLabel}.`;\n }\n if (!Array.isArray(value) || !value.every((item) => isLink(item, key))) {\n return `Choose a list of ${itemsLabel}.`;\n }\n if (field.required && value.length === 0) {\n return requiredError(field);\n }\n const max = field.picker?.max;\n if (max !== undefined && value.length > max) {\n return `Choose no more than ${max} ${pickerCopy(field).itemsLabel}.`;\n }\n}\n\nconst validators: Record<\n FormField[\"type\"],\n (field: FormField, value: unknown) => string | undefined\n> = {\n shortText: textError,\n longText: textError,\n richText: richTextError,\n number: numberError,\n slider: numberError,\n rangeSlider: rangeError,\n date: dateError,\n colour: colourError,\n radioGroup: choiceError,\n checkboxGroup: listError,\n tags: listError,\n boolean: (_field, value) => (typeof value === \"boolean\" ? undefined : \"Choose a boolean value.\"),\n dateTime: (_field, value) =>\n parseUtcDateTime(value) ? undefined : \"Enter a valid UTC date and time.\",\n select: choiceError,\n asset: linkError,\n reference: linkError,\n};\n\nexport function fieldError(field: FormField, value: unknown): string | undefined {\n if (value === undefined) {\n return field.required ? requiredError(field) : undefined;\n }\n return validators[field.type](field, value);\n}\n\n/** Validate data loaded from JSON as well as values emitted by FormEditor. */\nexport function validateFormValues(model: FormSchema, values: Record<string, unknown>): FormErrors {\n assertModel(model);\n return Object.fromEntries(\n model.fields.flatMap((field): [string, string][] => {\n if (field.type === \"divider\") {\n return [];\n }\n const error = fieldError(\n field,\n Object.hasOwn(values, field.id) ? values[field.id] : undefined,\n );\n return error ? [[field.id, error]] : [];\n }),\n );\n}\n","import { Button } from \"../Button\";\nimport { Checkbox, ChoiceGroup, Radio } from \"../Choice\";\nimport { CheckboxCard, RadioCard, SelectionCardGroup } from \"../SelectionCard\";\nimport type { SelectOption } from \"../Select\";\nimport type { ControlProps } from \"./control\";\nimport { stringList, type FieldOf } from \"./model\";\n\ntype ChoiceField = FieldOf<\"radioGroup\" | \"checkboxGroup\">;\n\nfunction Option({\n field,\n option,\n name,\n checked,\n isDisabled,\n invalid,\n onChange,\n}: {\n field: ChoiceField;\n option: SelectOption;\n name: string;\n checked: boolean;\n isDisabled: boolean;\n invalid: true | undefined;\n onChange: () => void;\n}) {\n const props = {\n name,\n value: option.value,\n checked,\n disabled: isDisabled || option.isDisabled,\n \"aria-invalid\": invalid,\n onChange: () => {\n if (!isDisabled && !option.isDisabled) {\n onChange();\n }\n },\n };\n if (field.appearance === \"card\") {\n const Card = field.type === \"radioGroup\" ? RadioCard : CheckboxCard;\n return (\n <Card\n {...props}\n title={option.label}\n description={option.description}\n />\n );\n }\n const Choice = field.type === \"radioGroup\" ? Radio : Checkbox;\n return (\n <Choice {...props}>\n <span>\n {option.label}\n {option.description && (\n <span className=\"ds-form-editor__option-description\">{option.description}</span>\n )}\n </span>\n </Choice>\n );\n}\n\nexport function ChoiceControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<ChoiceField>) {\n const multiple = field.type === \"checkboxGroup\";\n // Option values are nonempty, so a stored \"\" selects nothing.\n const selected = multiple\n ? stringList(stored)\n : typeof stored === \"string\" && stored\n ? [stored]\n : [];\n const Group = field.appearance === \"card\" ? SelectionCardGroup : ChoiceGroup;\n return (\n <>\n <Group\n {...accessibility}\n label={field.label}\n columns={field.columns ?? (field.appearance === \"card\" ? 2 : 1)}\n >\n {field.options.map((option) => (\n <Option\n key={option.value}\n field={field}\n option={option}\n name={accessibility.id}\n checked={selected.includes(option.value)}\n isDisabled={isDisabled}\n invalid={accessibility[\"aria-invalid\"]}\n onChange={() => {\n if (multiple) {\n onChange(\n selected.includes(option.value)\n ? selected.filter((value) => value !== option.value)\n : [...selected, option.value],\n );\n } else {\n onChange(option.value);\n }\n }}\n />\n ))}\n </Group>\n {!multiple && !required && selected.length > 0 && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isDisabled={isDisabled}\n onClick={() => onChange(undefined)}\n >\n Clear {field.label}\n </Button>\n )}\n </>\n );\n}\n","import { ColourField } from \"../ColourField\";\nimport { parseColour } from \"../ColourField/colour\";\nimport { DateField } from \"../DatePicker\";\nimport { RangeSlider, Slider } from \"../Slider\";\nimport { sliderScale } from \"../Slider/scale\";\nimport { TagsInput } from \"../TagsInput\";\nimport { ChoiceControl } from \"./choice-control\";\nimport type { ControlProps } from \"./control\";\nimport { rangeSliderValue, sliderValue, stringList, type FieldOf } from \"./model\";\n\ntype AdditionalField = FieldOf<\n \"slider\" | \"rangeSlider\" | \"date\" | \"colour\" | \"tags\" | \"radioGroup\" | \"checkboxGroup\"\n>;\n\nfunction SliderControl({\n field,\n stored,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"slider\">>) {\n const scale = sliderScale(field);\n const shown = sliderValue(stored, scale);\n return (\n <Slider\n {...accessibility}\n {...scale}\n prefix={field.prefix}\n suffix={field.suffix}\n hasValueLabel={field.hasValueLabel}\n valueText={shown === undefined ? (field.placeholder ?? \"Not set\") : undefined}\n autoFocus={field.autoFocus}\n isDisabled={isDisabled}\n value={shown ?? scale.min}\n onValueChange={onChange}\n // An unset thumb rests at the minimum, where a click or a key toward it fires\n // no change event. Committing stores the position the slider shows.\n onValueCommit={(next) => {\n if (shown === undefined) {\n onChange(next);\n }\n }}\n />\n );\n}\n\nfunction RangeSliderControl({\n field,\n stored,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"rangeSlider\">>) {\n const scale = sliderScale(field);\n const shown = rangeSliderValue(stored, scale);\n return (\n <RangeSlider\n {...accessibility}\n {...scale}\n prefix={field.prefix}\n suffix={field.suffix}\n hasValueLabel={field.hasValueLabel}\n minLabel={`${field.label} minimum`}\n maxLabel={`${field.label} maximum`}\n isDisabled={isDisabled}\n // Unset thumbs rest at both ends without a fill, so nothing looks chosen; a click\n // or key that leaves them there stores the full range they show.\n valueText={shown === undefined ? (field.placeholder ?? \"Not set\") : undefined}\n hasFill={shown !== undefined}\n value={shown ?? { min: scale.min, max: scale.max }}\n onValueChange={onChange}\n onValueCommit={(next) => {\n if (shown === undefined) {\n onChange(next);\n }\n }}\n />\n );\n}\n\nexport function AdditionalControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<AdditionalField>) {\n const props = { stored, isDisabled, required, accessibility, onChange };\n switch (field.type) {\n case \"radioGroup\":\n case \"checkboxGroup\":\n return (\n <ChoiceControl\n field={field}\n {...props}\n />\n );\n case \"rangeSlider\":\n return (\n <RangeSliderControl\n field={field}\n {...props}\n />\n );\n case \"slider\":\n return (\n <SliderControl\n field={field}\n {...props}\n />\n );\n case \"colour\":\n return (\n <ColourField\n {...accessibility}\n required={required}\n placeholder={field.placeholder}\n presets={field.presets}\n showPresets={field.showPresets}\n picker={field.picker}\n placement={field.placement}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n isDisabled={isDisabled}\n value={typeof stored === \"string\" ? stored : \"\"}\n onInput={(event) => {\n const raw = event.currentTarget.value;\n if (raw.trim() && !parseColour(raw)) {\n onChange(raw);\n }\n }}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n case \"tags\":\n return (\n <TagsInput\n {...accessibility}\n required={required}\n placeholder={field.placeholder}\n max={field.max}\n isDisabled={isDisabled}\n value={stringList(stored)}\n onValueChange={onChange}\n />\n );\n case \"date\":\n return (\n <DateField\n {...accessibility}\n placeholder={field.placeholder}\n min={field.min}\n max={field.max}\n placement={field.placement}\n isDisabled={isDisabled}\n isClearable\n clearLabel={`Clear ${field.label}`}\n value={typeof stored === \"string\" ? stored : \"\"}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n }\n}\n","import { EntryPicker, type EntryItem } from \"../EntryPicker\";\nimport type { FieldRenderProps } from \"../Field\";\nimport { NumberField } from \"../NumberField\";\nimport { RichTextEditor, type RichTextDocument } from \"../RichTextEditor\";\nimport { emptyDocument } from \"../RichTextEditor/document\";\nimport { Select } from \"../Select\";\nimport { Switch } from \"../Switch\";\nimport { TextArea, TextField } from \"../TextField\";\nimport { AdditionalControl } from \"./additional-control\";\nimport {\n parseUtcDateTime,\n pickerCopy,\n type FieldOf,\n type FormField,\n type FormFieldValue,\n} from \"./model\";\n\nfunction pickerValue(\n field: FieldOf<\"asset\" | \"reference\">,\n ids: string[],\n): FormFieldValue | undefined {\n if (field.type === \"asset\") {\n const links = ids.map((assetId) => ({ assetId }));\n return field.multiple ? links : links[0];\n }\n const links = ids.map((entryId) => ({ entryId }));\n return field.multiple ? links : links[0];\n}\n\ntype Accessibility = FieldRenderProps;\n\nexport interface ControlProps<F extends FormField> {\n field: F;\n stored: FormFieldValue | undefined;\n isDisabled: boolean;\n required: boolean | undefined;\n accessibility: Omit<Accessibility, \"required\">;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\nfunction NumberControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"number\">>) {\n return (\n <NumberField\n {...accessibility}\n required={required}\n isDisabled={isDisabled}\n placeholder={field.placeholder}\n min={field.min}\n max={field.max}\n step={field.step ?? \"any\"}\n hasSteppers={field.hasSteppers ?? false}\n prefix={field.prefix}\n suffix={field.suffix}\n autoFocus={field.autoFocus}\n decreaseLabel={`Decrease ${field.label}`}\n increaseLabel={`Increase ${field.label}`}\n value={typeof stored === \"number\" && Number.isFinite(stored) ? stored : \"\"}\n onValueChange={(next) => {\n if (next === \"\" || Number.isFinite(next)) {\n onChange(next === \"\" ? undefined : next);\n }\n }}\n />\n );\n}\n\nfunction SelectControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"select\">>) {\n // Optional selects lead with an empty choice; picking it removes the key.\n const isClearable = !required && !field.options.some((option) => option.value === \"\");\n return (\n <Select\n {...accessibility}\n aria-required={required || undefined}\n isDisabled={isDisabled}\n isInvalid={accessibility[\"aria-invalid\"]}\n options={\n isClearable\n ? [{ value: \"\", label: field.placeholder ?? \"None\" }, ...field.options]\n : field.options\n }\n placeholder={field.placeholder}\n autoFocus={field.autoFocus}\n value={typeof stored === \"string\" ? stored : \"\"}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n}\n\nfunction PickerControl({\n field,\n selected,\n items,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"asset\" | \"reference\">> & { items: EntryItem[]; selected: string[] }) {\n return (\n <EntryPicker\n {...accessibility}\n items={items}\n value={selected}\n {...pickerCopy(field)}\n mode={field.multiple ? \"multiple\" : \"single\"}\n isDisabled={isDisabled}\n onValueChange={(ids) => onChange(pickerValue(field, ids))}\n />\n );\n}\n\ninterface FormControlProps {\n field: FormField;\n stored: FormFieldValue | undefined;\n /** Picker fields' stored IDs, derived once by the owning field. */\n selected: string[] | undefined;\n items: EntryItem[];\n isDisabled: boolean;\n accessibility: Accessibility;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\nexport function FormControl({\n field,\n stored,\n selected,\n items,\n isDisabled,\n accessibility: { required, ...accessibility },\n onChange,\n}: FormControlProps) {\n const shared = { stored, isDisabled, required, accessibility, onChange };\n switch (field.type) {\n case \"shortText\":\n return (\n <TextField\n {...accessibility}\n required={required}\n disabled={isDisabled}\n placeholder={field.placeholder}\n type={field.inputType}\n maxLength={field.maxLength}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n value={typeof stored === \"string\" ? stored : \"\"}\n onChange={(event) => onChange(event.target.value)}\n />\n );\n case \"longText\":\n return (\n <TextArea\n {...accessibility}\n required={required}\n disabled={isDisabled}\n placeholder={field.placeholder}\n rows={field.rows}\n maxLength={field.maxLength}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n value={typeof stored === \"string\" ? stored : \"\"}\n onChange={(event) => onChange(event.target.value)}\n />\n );\n case \"number\":\n return (\n <NumberControl\n field={field}\n {...shared}\n />\n );\n case \"boolean\":\n return (\n <Switch\n {...accessibility}\n isDisabled={isDisabled}\n autoFocus={field.autoFocus}\n isSelected={stored === true}\n onSelectedChange={onChange}\n />\n );\n case \"dateTime\":\n return (\n <TextField\n {...accessibility}\n required={required}\n disabled={isDisabled}\n type=\"datetime-local\"\n step=\"0.001\"\n autoFocus={field.autoFocus}\n value={parseUtcDateTime(stored)?.slice(0, -1) ?? \"\"}\n onChange={(event) => onChange(parseUtcDateTime(`${event.target.value}Z`))}\n />\n );\n case \"richText\":\n return (\n <RichTextEditor\n {...accessibility}\n expandedWidth={field.expandedWidth}\n label={field.label}\n isRequired={required}\n isDisabled={isDisabled}\n placeholder={field.placeholder}\n format=\"json\"\n value={stored === undefined ? emptyDocument : (stored as RichTextDocument)}\n onChange={onChange}\n />\n );\n case \"select\":\n return (\n <SelectControl\n field={field}\n {...shared}\n />\n );\n case \"asset\":\n case \"reference\":\n return (\n <PickerControl\n field={field}\n items={items}\n selected={selected ?? []}\n {...shared}\n />\n );\n default:\n return (\n <AdditionalControl\n field={field}\n {...shared}\n />\n );\n }\n}\n","import { useMemo, useState, type CSSProperties, type HTMLAttributes } from \"react\";\nimport { Container } from \"../Container\";\nimport type { EntryItem } from \"../EntryPicker\";\nimport { Field } from \"../Field\";\nimport type { GridColumns } from \"../Grid\";\nimport { FormControl } from \"./control\";\nimport {\n assertModel,\n fieldError,\n fieldLabel,\n selectedIds,\n stringList,\n type FormField,\n type FormSchema,\n type FormErrors,\n type FormFieldValue,\n type FormValues,\n} from \"./model\";\nimport \"./style.css\";\n\nexport { validateFormValues } from \"./model\";\nexport type {\n AssetValue,\n FormField,\n FormDivider,\n FormItem,\n FormSchema,\n FormErrors,\n FormFieldValue,\n FormValues,\n ReferenceValue,\n} from \"./model\";\n\nexport interface FormChange {\n fieldId: string;\n}\n\nexport interface FormEditorProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"defaultValue\" | \"onChange\"\n> {\n schema: FormSchema;\n value?: FormValues;\n defaultValue?: FormValues;\n onValueChange?: (values: FormValues, change: FormChange) => void;\n /** Available assets or entries, keyed by field ID. Loading belongs to the app. */\n pickerItems?: Record<string, EntryItem[]>;\n /** App-provided messages take precedence over built-in validation. */\n errors?: FormErrors;\n isDisabled?: boolean;\n showAllErrors?: boolean;\n /** Columns at the widest. The form drops one whenever a field would be narrower than `minColumnWidth`. */\n columns?: GridColumns;\n /** Narrowest a field may get before the form drops a column. */\n minColumnWidth?: string;\n}\n\ninterface FormEditorFieldProps {\n field: FormField;\n stored: FormFieldValue | undefined;\n items: EntryItem[];\n isDisabled: boolean;\n error: string | undefined;\n isErrorVisible: boolean;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\n/** Validates only when its message can show, and only when its own field or value changes. */\nfunction FormEditorField({\n field,\n stored,\n items,\n isDisabled,\n error,\n isErrorVisible,\n onChange,\n}: FormEditorFieldProps) {\n const validation = useMemo(\n () => (error === undefined && isErrorVisible ? fieldError(field, stored) : undefined),\n [error, isErrorVisible, field, stored],\n );\n const selected = useMemo(\n () =>\n field.type === \"asset\" || field.type === \"reference\" ? selectedIds(field, stored) : undefined,\n [field, stored],\n );\n return (\n <Container\n width={field.width}\n padded={false}\n center={false}\n className=\"ds-form-editor__field\"\n >\n <Field\n label={field.type === \"dateTime\" ? `${field.label} (UTC)` : fieldLabel(field)}\n hint={field.hint}\n error={error ?? validation}\n isRequired={field.required}\n count={\n selected?.length ??\n (field.type === \"checkboxGroup\" ? stringList(stored).length : undefined)\n }\n isGroup={selected !== undefined || groupTypes.has(field.type)}\n >\n {(accessibility) => (\n <FormControl\n field={field}\n stored={stored}\n selected={selected}\n items={items}\n isDisabled={isDisabled}\n accessibility={accessibility}\n onChange={onChange}\n />\n )}\n </Field>\n </Container>\n );\n}\n\nconst groupTypes = new Set([\"radioGroup\", \"checkboxGroup\", \"rangeSlider\"]);\nconst loadedValidationTypes = new Set([\"slider\", \"rangeSlider\", \"date\", \"colour\"]);\n\n/** Ordered form controls. Loading, submission, and persistence belong to the app. */\nexport function FormEditor({\n schema,\n value,\n defaultValue = {},\n onValueChange,\n pickerItems = {},\n errors = {},\n isDisabled = false,\n showAllErrors = false,\n columns = 1,\n minColumnWidth = \"16rem\",\n className,\n style,\n ...rest\n}: FormEditorProps) {\n const [internal, setInternal] = useState<FormValues>(defaultValue);\n const [changed, setChanged] = useState<Set<string>>(() => new Set());\n const current = value ?? internal;\n useMemo(() => assertModel(schema), [schema]);\n\n const commit = (fieldId: string, next: FormFieldValue | undefined) => {\n const values = { ...current };\n if (next === undefined) {\n delete values[fieldId];\n } else {\n values[fieldId] = next;\n }\n if (value === undefined) {\n setInternal(values);\n }\n setChanged((previous) => new Set(previous).add(fieldId));\n onValueChange?.(values, { fieldId });\n };\n\n const layout =\n columns === \"auto\"\n ? { \"--form-editor-min-column\": minColumnWidth }\n : { \"--form-editor-columns\": columns, \"--form-editor-min-column\": minColumnWidth };\n\n return (\n <div\n className={[\"ds-form-editor\", columns === \"auto\" && \"ds-form-editor--auto\", className]\n .filter(Boolean)\n .join(\" \")}\n style={{ ...layout, ...style } as CSSProperties}\n {...rest}\n >\n {schema.fields.map((field) => {\n if (field.type === \"divider\") {\n return (\n <hr\n key={field.id}\n className=\"ds-form-editor__divider\"\n />\n );\n }\n const stored = Object.hasOwn(current, field.id) ? current[field.id] : undefined;\n const fieldDisabled = isDisabled || Boolean(field.isDisabled);\n const isLocked = fieldDisabled || (\"readOnly\" in field && Boolean(field.readOnly));\n // Explain loaded invalid values alongside the controls' invalid styling. Blank\n // strings are empty, so their required message waits like any other field's.\n const isLoaded = typeof stored === \"string\" ? stored.trim() !== \"\" : stored !== undefined;\n const isErrorVisible =\n showAllErrors ||\n changed.has(field.id) ||\n (isLoaded && loadedValidationTypes.has(field.type)) ||\n (field.type === \"number\" && typeof stored === \"number\");\n return (\n <FormEditorField\n key={field.id}\n field={field}\n stored={stored}\n items={pickerItems[field.id] ?? []}\n isDisabled={fieldDisabled}\n error={errors[field.id]}\n isErrorVisible={isErrorVisible}\n onChange={(next) => {\n if (!isLocked) {\n commit(field.id, next);\n }\n }}\n />\n );\n })}\n </div>\n );\n}\n"],"mappings":"A,yvBACA,IAAamD,EAAiB,CAAC,OAAQ,MAAM,ECcvCC,EAAc,CAAC,KAAM,KAAM,IAAI,EAyI/BC,EAAa,IAAI,IAAI,CACzB,YACA,WACA,WACA,SACA,UACA,WACA,QACA,YACA,SACA,SACA,cACA,SACA,aACA,gBACA,OACA,OACA,SACF,CAAC,EAED,SAAgBC,EAAY,EAAmB,CAC7C,IAAMC,EAAM,IAAI,IAChB,IAAK,IAAMC,KAASC,EAAM,OAAQ,CAChC,GAAI,CAACD,EAAM,IAAI,KAAK,GAAKD,EAAI,IAAIC,EAAM,EAAE,EACvC,MAAU,MAAM,6CAA6C,EAE/D,GAAI,CAACH,EAAW,IAAIG,EAAM,IAAI,EAC5B,MAAU,MAAM,gCAAgCA,EAAM,MAAM,GAE1DA,EAAM,OAAS,UAAYA,EAAM,OAAS,cAAgBA,EAAM,OAAS,kBAC3EE,EAAcF,CAAK,GAEjBA,EAAM,OAAS,UAAYA,EAAM,OAAS,gBAC5CG,EAAaH,CAAK,EAEhBA,EAAM,OAAS,WACjBI,EAAeJ,CAAK,EAEtBD,EAAI,IAAIC,EAAM,EAAE,CAClB,CACF,CAGA,SAASI,EAAe,EAAkB,CACxC,GAAIJ,EAAM,QAAU,IAAA,IAAa,CAACJ,EAAY,SAASI,EAAM,KAAK,EAChE,MAAU,MAAM,SAASA,EAAM,GAAG,gCAAgC,EAEpE,GACEA,EAAM,OAAS,YACf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AO5C,GAAW,SAAWA,EAAO,KAAK,IAAM,GAAKA,IAAW,IAAA,GAC1EqB,EACJwB,GACAhB,EAAQ,IAAI7F,EAAM,EAAE,GACnB4G,GAAYrB,GAAsB,IAAIvF,EAAM,IAAI,GAChDA,EAAM,OAAS,UAAY,OAAOgE,GAAW,SAChD,OACE,EAAAtE,EAAA,IAAA,CAACyF,GAAD,CAES,QACC,SACR,MAAO2B,EAAY9G,EAAM,KAAO,CAAC,EACjC,WAAY0G,EACZ,MAAOK,EAAO/G,EAAM,IACJ,iBAChB,SAAW,GAAS,CACb2G,GACHV,EAAOjG,EAAM,GAAIsE,CAAI,CAEzB,CACD,EAZMtE,EAAM,EAYZ,CAEL,CAAC,CACE,CAAA,CAET,C"}
|
|
@@ -8,9 +8,9 @@ import { NumberField as l } from "../components/NumberField/index.js";
|
|
|
8
8
|
import { Select as u } from "../components/Select/index.js";
|
|
9
9
|
import { Switch as d } from "../components/Switch/index.js";
|
|
10
10
|
import { i as f } from "./colour-CYEF4Q_n.js";
|
|
11
|
-
import { t as p } from "./ColourField-
|
|
11
|
+
import { t as p } from "./ColourField-DXGpNP08.js";
|
|
12
12
|
import { a as m, i as h, n as g, r as _, t as v } from "./Slider-vdMFLX-H.js";
|
|
13
|
-
import { a as y, n as ee } from "./DatePicker-
|
|
13
|
+
import { a as y, n as ee } from "./DatePicker-DJAqXUDJ.js";
|
|
14
14
|
import { TagsInput as te } from "../components/TagsInput/index.js";
|
|
15
15
|
import { Checkbox as b, ChoiceGroup as x, Radio as S } from "../components/Choice/index.js";
|
|
16
16
|
import { CheckboxCard as C, RadioCard as w, SelectionCardGroup as ne } from "../components/SelectionCard/index.js";
|
|
@@ -600,4 +600,4 @@ function Se({ schema: e, value: t, defaultValue: n = {}, onValueChange: r, picke
|
|
|
600
600
|
//#endregion
|
|
601
601
|
export { ce as n, Se as t };
|
|
602
602
|
|
|
603
|
-
//# sourceMappingURL=FormEditor-
|
|
603
|
+
//# sourceMappingURL=FormEditor-C5XtP-N7.js.map
|