react-luna-form 0.0.85 → 0.0.86
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/dist/client/cjs/index.js +1 -1
- package/dist/client/esm/index.js +1 -1
- package/dist/config/cjs/index.js +1 -1
- package/dist/config/esm/index.js +1 -1
- package/dist/schema/cjs/index.js +1 -1
- package/dist/schema/esm/index.js +1 -1
- package/dist/server/cjs/index.js +1 -1
- package/dist/server/esm/index.js +1 -1
- package/dist/types/luna-core/type.d.ts +30 -16
- package/dist/types/luna-core/util/build.d.ts +3 -1
- package/dist/types/luna-core/util/extract.d.ts +1 -0
- package/dist/types/luna-core/util/is-input.d.ts +13 -0
- package/dist/types/luna-core/util/schema.d.ts +5 -5
- package/dist/types/luna-react/src/client/component/field/field.d.ts +19 -0
- package/dist/types/luna-react/src/client/context/failed-submit-context.d.ts +3 -0
- package/dist/types/luna-react/src/client/context/reveal-context.d.ts +1 -0
- package/dist/types/luna-react/src/client/hook/use-disclosure.d.ts +1 -0
- package/dist/types/luna-react/src/client/hook/use-form-action.d.ts +2 -1
- package/dist/types/luna-react/src/client/hook/use-host-entry.d.ts +17 -0
- package/dist/types/luna-react/src/client/hook/use-input-core.d.ts +4 -6
- package/dist/types/luna-react/src/client/hook/use-input.d.ts +1 -1
- package/dist/types/luna-react/src/client/hook/use-schema.d.ts +4 -2
- package/dist/types/luna-react/src/client/hook/use-value.d.ts +2 -2
- package/dist/types/luna-react/src/client/lib/compose-list-value.d.ts +29 -2
- package/dist/types/luna-react/src/client/lib/error-store.d.ts +3 -0
- package/dist/types/luna-react/src/client/lib/host-value-store.d.ts +30 -0
- package/dist/types/luna-react/src/client/lib/list-store.d.ts +6 -2
- package/dist/types/luna-react/src/client/lib/source-store.d.ts +3 -0
- package/dist/types/luna-react/src/client/lib/state-store.d.ts +3 -0
- package/dist/types/luna-react/src/client/lib/store-helper.d.ts +8 -0
- package/dist/types/luna-react/src/client/lib/value-store.d.ts +3 -0
- package/dist/types/luna-react/src/component/collapsible.d.ts +2 -1
- package/dist/types/luna-react/src/component/form.d.ts +2 -0
- package/dist/types/luna-react/src/component/input/input-base.d.ts +1 -0
- package/dist/types/luna-react/src/type.d.ts +1 -0
- package/docs/events/change.md +21 -7
- package/docs/fields/custom-inputs.md +4 -0
- package/docs/fields/input.md +9 -3
- package/docs/fields/list.md +2 -0
- package/docs/fields/specialized-selectors.md +4 -0
- package/docs/forms/submit.md +7 -2
- package/docs/structure/sections.md +3 -1
- package/docs/validation/overview.md +10 -1
- package/package.json +5 -5
package/dist/server/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var he=Object.defineProperty;var Vr=Object.getOwnPropertyDescriptor;var Br=Object.getOwnPropertyNames;var Hr=Object.prototype.hasOwnProperty;var Gr=(e,t)=>{for(var n in t)he(e,n,{get:t[n],enumerable:!0})},Ur=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Br(t))!Hr.call(e,o)&&o!==n&&he(e,o,{get:()=>t[o],enumerable:!(r=Vr(t,o))||r.enumerable});return e};var $r=e=>Ur(he({},"__esModule",{value:!0}),e);var Go={};Gr(Go,{Fallback:()=>zr,Form:()=>be});module.exports=$r(Go);var Ze=require("react/jsx-runtime");function We(e){let t=typeof e.children=="function"?e.children({isPending:e.isPending}):e.children;return(0,Ze.jsx)("div",{"data-slot":"field-control",className:"w-full",children:t})}var Te=require("react/jsx-runtime");function L(e){return(0,Te.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`size-4 transition-transform duration-200 ${e.expanded?"rotate-90":""}`,children:(0,Te.jsx)("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})})}var Qe=require("react");var qe=require("react"),Je=(0,qe.createContext)(!1);var Ae=require("react/jsx-runtime");function V({children:e,visible:t}){return(0,Ae.jsx)(Qe.Activity,{mode:t?"visible":"hidden",children:(0,Ae.jsx)(Je,{value:!0,children:e})})}var J="input",je="input/date",et="input/email",tt="input/number",nt="input/time";var rt="textarea",ot="radio",it="checkbox",Fe="list",lt="select",at="select/active",st="select/day",ct="select/month",dt="select/timezone",ut="select/year";var ft="chips",mt="chips/day",gt="chips/month",B="column",pt="description",Ce="fields",yt="label",Se="value",Q="options",Ne="email",xt="number",bt="password",Rt="tel",H="text",ht="aria-errormessage",Tt="aria-invalid",At="data-invalid",Ft="data-readonly",Ct="aria",St="data",Nt="max",vt="maxLength",wt="min",It="minLength",E="$ref";var kt="type",Lt={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};var g=require("date-fns"),w=require("date-fns/locale");function f(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function y(e){return d(e)||typeof e=="number"||Yr(e)}function Et(e){return Array.isArray(e)&&e.every(y)}function d(e){return typeof e=="string"}function Yr(e){return typeof e=="boolean"}var Ot={en:w.enUS,"en-US":w.enUS,es:w.es,"es-ES":w.es,"es-MX":w.es},Xr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},Kr={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function Dt(e){if(e)return Ot[e]??Ot[e.split("-")[0]]}function j(e){if(typeof e=="number"&&!Number.isNaN(e))return e;if(d(e)&&e.trim()!==""){let t=Number(e);return Number.isNaN(t)?null:t}return null}function Pt(e,t,n){let r=Kr[t];if(r===void 0)return String(e);let o=e*r,i=(0,g.intervalToDuration)({start:0,end:o});return(0,g.formatDuration)(i,{locale:n})}function Mt(e){if(e instanceof Date)return(0,g.isValid)(e)?e:null;if(d(e)){let t=(0,g.parseISO)(e);if((0,g.isValid)(t))return t;let n=new Date(e);return(0,g.isValid)(n)?n:null}if(typeof e=="number"){let t=new Date(e);return(0,g.isValid)(t)?t:null}return null}var Wr={currency:(e,t,n)=>{let r=j(e);if(r===null)return String(e);let o=t[0]??"USD";return new Intl.NumberFormat(n.locale,{style:"currency",currency:o}).format(r)},percent:(e,t,n)=>{let r=j(e);return r===null?String(e):new Intl.NumberFormat(n.locale,{style:"percent"}).format(r)},number:(e,t,n)=>{let r=j(e);return r===null?String(e):new Intl.NumberFormat(n.locale).format(r)},date:(e,t,n)=>{let r=Mt(e);if(!r)return String(e);let o=t[0]??"short",i=Dt(n.locale);if(o==="relative")return(0,g.formatDistanceToNow)(r,{addSuffix:!0,locale:i});let l=Xr[o]??o;return(0,g.format)(r,l,{locale:i})},duration:(e,t,n)=>{let r=Dt(n.locale);if(typeof e=="number")return Pt(e,t[0]??"ms",r);if(d(e)){let i=j(e);if(i!==null)return Pt(i,t[0]??"ms",r)}let o=Mt(e);return o?(0,g.formatDistanceToNow)(o,{addSuffix:!0,locale:r}):String(e)}};function _t(e,t,n){let r=t.split(":").map(a=>a.trim()).filter(a=>a.length>0);if(r.length===0)return;let[o,...i]=r,l=Wr[o];if(l)return l(e,i,n)}function zt(e,t=Se){if(e!=null){if(Et(e)||y(e))return e;if(f(e)){let n=Zr(e,t);if(y(n))return n}}}function Zr(e,t){let n=x(e,t);if(y(n))return n}function x(e,t){if(!t||!f(e))return null;let n=t.split(".").filter(o=>o!=="");if(n.length===0)return null;let r=e;for(let o of n)if(f(r)&&o in r)r=r[o];else if(Array.isArray(r)){let i=Number(o);if(!Number.isInteger(i)||i<0||i>=r.length)return null;r=r[i]}else return null;return r}function Vt(e,t={description:pt,label:yt,value:Se}){return e.map(n=>{if(f(n)){let r=x(n,t.label),o=x(n,t.value);if(y(r)&&y(o)){let i=x(n,t.description);return{label:`${r}`,value:`${o}`,...y(i)&&{description:`${i}`}}}}return n})}function Bt(e=H){let t=e.lastIndexOf("/"),n=t===-1?e:e.slice(t+1);return n&&n!==J?n.trim().toLowerCase():H}var qr=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g,Jr=/{([^}]{1,200})}/,Qr=/{([^}]{1,200})}/g;function G(e,t={},n={}){if(d(e))return eo(e,t,n);if(Array.isArray(e))return e.map(r=>G(r,t,n));if(f(e)){let r={};for(let o in e)r[o]=G(e[o],t,n);return r}return e}function U(e,t={},n={}){return ve(e)?G(e,t,n):e}function ve(e){return d(e)?Jr.test(e):Array.isArray(e)?e.some(t=>ve(t)):f(e)?Object.values(e).some(t=>ve(t)):!1}function jr(e,t){return t.includes(".")?x(e,t):e[t]}function eo(e,t={},n={}){return e.replace(Qr,(r,o)=>{let i=String(o).split("|").map(p=>p.trim()),[l,...a]=i;if(!l)return r;let s=jr(t,l);if(a.length===0)return y(s)?String(s):r;if(s==null)return r;let u=s;for(let p of a){let q=_t(u,p,{locale:n.locale});if(q===void 0)return r;u=q}return String(u)})}function Ht(e,t){if(!d(e)||!e||e.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=qr.exec(e))!==null;){let[l,a,s]=n,u=n.index;o=!0,u>r&&i.push(e.substring(r,u));let p=t?t(u,s,a):l;i.push(p),r=u+l.length}return o?(r<e.length&&i.push(e.substring(r)),i):e}var Gt=e=>m(at)(e),Ut=e=>m(st)(e),$t=e=>m(ct)(e),Yt=e=>m(ut)(e),Xt=e=>m(dt)(e),Kt=e=>m(mt)(e),Wt=e=>m(gt)(e),Zt=m(je),we=m(nt),b=m(it),O=m(ft),I=m(ot),qt=m(J),C=m(lt),Jt=m(rt),Qt=m(H,Ne,bt,Rt),si=m(et,Ne),jt=m(tt,xt);function en(e){return I(e)||b(e)}function ee(e){return e.type===Fe}function D(e){return e.type===B}function te(e){return e.type!==B&&e.type!==Fe}function Ie(e){return C(e)||I(e)||O(e)}function $(e){return e!=null&&e!==""}function m(...e){return t=>{let n=d(t.type)?t.type:void 0;return n?e.some(r=>n===r||n?.startsWith(`${r}/`)):!1}}function tn(e,t={}){if(C(e)&&e.disabled){let n=e.name?t?.[e.name]:void 0;if(n&&f(n))return[n]}}function nn(e){return I(e)||b(e)?!0:e.advanced?.horizontal}function rn(e){return b(e)?e.advanced?.reverse!==!1:!1}function on(e,t){let n=e.readonly??!1;return t||n}function ke(e){if(to(e)){let t=e.source;if(Array.isArray(t)||f(t)&&!(E in t))return t}}function ln(e){return Array.isArray(ke(e))}function to(e){return I(e)||O(e)||C(e)&&!e.disabled}var T=require("date-fns"),no=/^\d+$/,cn=new Date(2e3,0,1),ro=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[],Le="default";function dn(e){if(!e)return Le;try{return Intl.getCanonicalLocales(e)[0]??Le}catch{return Le}}function Ee(e){let t=dn(e);return Array.from({length:12},(n,r)=>({value:(r+1).toString(),label:new Date(0,r).toLocaleString(t,{month:"long"})}))}function Oe(e){let t=dn(e);return Array.from({length:7},(n,r)=>({value:r.toString(),label:new Date(2e3,0,2+r).toLocaleString(t,{weekday:"long"})}))}function un(e,t){return t>=e?Array.from({length:t-e+1},(n,r)=>{let o=e+r;return{value:o.toString(),label:o.toString()}}):[]}function De(){return new Date().getFullYear()}function oo(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function io(e){let t=e.indexOf("/"),n=t===-1?e:e.slice(0,t);return Lt[n]??"Other"}function lo(e,t){return(e.find(r=>r.type==="timeZoneName")?.value??t).replace(/\s+(?:Standard|Daylight(?: Saving)?|Summer|Winter)\s+Time$/,"")}function an(e,t){let n=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t),r=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"long"}).formatToParts(t),i=(n.find(a=>a.type==="timeZoneName")?.value??"GMT+00:00").replace("GMT","UTC"),l=lo(r,e);return{offset:i,longName:l}}function sn(e){return e.slice(e.lastIndexOf("/")+1).replace(/_/g," ")}function fn(){let e=new Date,t=oo(),n=new Map,r=sn(t),{offset:o,longName:i}=an(t,e),l={value:t,label:`${r} - ${i} (${o})`};for(let s of ro()){if(s===t)continue;let u=sn(s),{offset:p,longName:q}=an(s,e),Xe={value:s,label:`${u} - ${q} (${p})`},Re=io(s);if(Re==="Other")continue;let Ke=n.get(Re);Ke?Ke.push(Xe):n.set(Re,[Xe])}for(let s of n.values())s.sort((u,p)=>u.label.localeCompare(p.label));let a=Array.from(n.entries()).sort(([s],[u])=>s.localeCompare(u)).map(([s,u])=>({label:s,items:u}));return[{label:"Suggested",items:[l]},...a]}function Pe(e,t){if(typeof e=="number")return e;let n=t??De(),r=e.trim().toLowerCase();if(r.startsWith("current")){let o=r.match(/^current([+-])(\d+)$/);if(o){let[,i,l]=o,a=parseInt(l,10);if(!isNaN(a))return i==="+"?n+a:n-a}return n}return no.test(r)?parseInt(r,10):n}function mn(e,t){if(!e)return"";try{let n=(0,T.parse)(e,t,cn);return(0,T.isValid)(n)?(0,T.format)(n,"yyyy-MM-dd"):""}catch{return""}}function gn(e,t){if(!e)return"";try{let n=(0,T.parse)(e,t,cn);return(0,T.isValid)(n)?(0,T.format)(n,"HH:mm:ss"):""}catch{return""}}function Me(e){return e.advanced?.format??"HH:mm"}function pn(e){return e.advanced?.format??"MMMM d, yyyy"}var ao={es:{"(Optional)":"(Opcional)","Add item":"A\xF1adir elemento","An unexpected error occurred submitting the form.":"Ocurri\xF3 un error inesperado al enviar el formulario.","Collapse {label} {index}":"Contraer {label} {index}","Expand {label} {index}":"Expandir {label} {index}","Please correct the errors and try again.":"Corrige los errores e int\xE9ntalo de nuevo.","Remove {label} item {index}":"Eliminar {label} {index}","There were validation errors submitting the form.":"Se encontraron errores de validaci\xF3n al enviar el formulario.","Unknown error":"Error desconocido",No:"No",Yes:"S\xED"}};function ne(e,t){return R(e,t)}function xn(e,t){let n=t?.[e??""],r=e?ao[so(e)]:void 0;return r?n?{...r,...n}:r:n}function so(e){return e.toLowerCase().split(/[-_]/)[0]}function R(e,t){return e?t?t[e]??e:e:""}function P(e,t){return e?R(e,t):void 0}function re(e,t){if(!t)return e;let n=!1,r=e.map(o=>{let i=co(o,t);return i!==o&&(n=!0),i});return n?r:e}function co(e,t){if(!f(e))return e;let n=yn(e.label,t),r=e.items;if(Array.isArray(r)){let i=re(r,t);return i===r&&n===e.label?e:{...e,...n!==void 0&&{label:n},items:i}}let o=yn(e.description,t);return n===e.label&&o===e.description?e:{...e,...n!==void 0&&{label:n},...o!==void 0&&{description:o}}}function yn(e,t){return d(e)?R(e,t):e}var oe=De();function uo(e,t){if(O(e))return fo(e,t?.lang)}function fo(e,t){if(Kt(e))return Oe(t);if(Wt(e))return Ee(t)}function mo(e,t){if(C(e))return go(e,t)}function go(e,t){let{lang:n,translations:r}=t??{};if(Ut(e))return Oe(n);if($t(e))return Ee(n);if(Yt(e)){let o=e.advanced?.length?.min??oe,i=e.advanced?.length?.max??oe+5;return un(Pe(o,oe),Pe(i,oe))}if(Xt(e))return fn();if(Gt(e))return re([{value:"true",label:"Yes"},{value:"false",label:"No"}],r)}function bn(e,t=!1,n){let r={disabled:t,id:e.name,name:e.name,placeholder:e.placeholder,required:e.required};return qt(e)?{...r,...po(e)}:C(e)?{...r,...Rn(mo(e,n))}:Jt(e)?{...r,...xo(e)}:O(e)?{...r,...yo(e,n)}:r}function po(e){let t=Bt(e.type),n={...e,type:t};return{...Ro(e),...hn(e),...bo(n),...Qt(n)?Tn(n):{},type:t}}function Rn(e){return e?{options:e}:{}}function yo(e,t){let n=Rn(uo(e,t)),r=e.advanced?.multiple??!0;return{...n,multiple:r}}function xo(e){return{...hn(e),...Tn(e)}}function hn(e){let t=e.advanced?.autocomplete;return t?{autoComplete:t}:{}}function bo(e){return jt(e)?ho(e):{}}function Ro(e){if(we(e)){let t=Me(e);return{step:t==="HH:mm:ss"||t==="hh:mm:ss a"?"1":"60"}}return{}}function Tn(e){return An(e,{min:It,max:vt})}function ho(e){return An(e,{min:wt,max:Nt})}function An(e,t){let n={},r=e.advanced?.length;return r&&(r.min!==void 0&&(n[t.min]=r.min),r.max!==void 0&&(n[t.max]=r.max)),n}function Fn(e,t){let n=ke(e);return n||tn(e,t)}function To(e,t){let n=f(t)&&e.name in t?t[e.name]:t,r=zt(n,e.advanced?.entity),o=$(r)?r:e.defaultValue;return we(e)&&$(o)?Ao(e,o):Zt(e)&&$(o)?No(e,o):o}function Ao(e,t){let n=Me(e);return d(t)?gn(t,n):t}function Fo(e,t,n){return Ie(e)&&Array.isArray(n)?{...t,[Q]:n}:t}function Co(e,t,n){if(e.required&&!$(n)&&C(e)&&e.advanced?.preselected!==!1&&Q in t){let r=t[Q];if(Array.isArray(r)&&r.length===1)return r[0]}return n}function So(e,t,n){if(Ie(e)&&Array.isArray(t)){let r=Vt(t,e.advanced?.options);return ln(e)?re(r,n):r}return t}function Cn(e,t,n,r,o){let i=To(e,r),l=Array.isArray(n)?So(e,n,o):n,a=Fo(e,t,l),s=Co(e,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function Sn(e,t){return b(e)?{defaultChecked:!!t}:{defaultValue:t}}function No(e,t){let n=pn(e);return d(t)?mn(t,n):t}var vo=/^#\/definition\//;function le(e=[],t){let n=ie(e,t);return Array.isArray(n)?n.filter(Io).sort((r,o)=>Nn(r)-Nn(o)):[]}function ie(e,t,n=new Map,r=new WeakSet){if(!wo(t)||!e||typeof e!="object")return e;if(n.has(e))return n.get(e);if(r.has(e))return e;if(r.add(e),Array.isArray(e))return e.map(i=>ie(i,t,n,r));if(E in e&&d(e[E])){let i=e[E].replace(vo,""),l=x(t,i);return l!==null?ie(l,t,n,r):e}let o={};for(let[i,l]of Object.entries(e))o[i]=ie(l,t,n,r);return r.delete(e),n.set(e,o),o}function vn(e){return Object.entries(e??{})}function Nn(e){return e.order??Number.MAX_VALUE}function wo(e){return e!==void 0&&f(e)&&Object.keys(e).length>0}function Io(e){return kt in e?!0:Array.isArray(e[Ce])?e[Ce].length>0:!0}function wn(e,t){let n={};for(let[r,o]of vn(t))n[`${e}-${r}`]=o;return n}function ko(e){return wn(Ct,e)}function Lo(e){return wn(St,e)}function In(e,t){let n=ko(e.advanced?.aria);return t&&t.length>0&&(n[Tt]="true",n[ht]=`${e.name}-error`),n}function kn(e){return Lo(e.advanced?.data)}var Ln={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},En={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function On(e,t=2){return Ln[e&&e in Ln?e:t]}function Dn(e){if(e&&e in En)return En[e]}function Eo(e){return{min:e.advanced?.length?.min??1,max:e.advanced?.length?.max??1/0}}function Oo(e,t){let n=t?x(t,e.name):null;return Do(e,Array.isArray(n)?n.length:0)}function Pn(e){return!Array.isArray(e.fields)||e.fields.length===0?!1:e.fields.length>1||e.fields[0].type===B}function Mn(e,t){let n=Oo(e,t);return Array.from({length:n},(r,o)=>o)}function _n(e){return e.advanced?.title??e.label??e.name}function Do(e,t){let{min:n,max:r}=Eo(e);return Math.min(Math.max(t,n),r)}function ae(e,t){let n={...e};for(let r of Object.keys(t??{})){let o=t?.[r];o!==void 0&&(n[r]=o)}return n}var zn=require("react/jsx-runtime");function A(e){return Ht(e,(t,n,r)=>(0,zn.jsx)("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${t}`))}var se=require("react"),h=require("react/jsx-runtime");function Vn(e){let{fields:t=[]}=e.section,[n,r]=(0,se.useState)(!1),o=(0,se.useCallback)(()=>r(i=>!i),[]);return(0,h.jsxs)("fieldset",{"data-slot":"field-set","data-advanced":"true","data-expanded":n,"data-empty":t.length===0,className:"flex flex-col",id:e.section.id?.toString(),children:[(0,h.jsx)("legend",{children:(0,h.jsxs)("button",{className:"flex cursor-pointer items-center gap-2 text-base font-medium text-zinc-600 dark:text-zinc-400",onClick:o,type:"button",children:[(0,h.jsx)(L,{expanded:n}),(0,h.jsx)("span",{children:A(e.title)})]})}),(0,h.jsx)(V,{visible:n,children:(0,h.jsxs)("div",{className:"mt-3 ml-1.5 flex flex-col gap-4 border-l-2 border-zinc-300 pl-4 dark:border-zinc-600","data-slot":"field-set-content",children:[e.description&&(0,h.jsx)("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:A(e.description)}),e.group]})})]})}var S=require("react/jsx-runtime");function Bn(e){let t=(0,S.jsxs)("div",{className:"flex flex-col",children:[e.title&&(0,S.jsx)("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:A(e.title)}),e.description&&(0,S.jsx)("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:A(e.description)})]});return e.step?(0,S.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,S.jsx)("div",{className:"bg-primary text-primary-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:(0,S.jsx)("span",{className:"text-sm font-bold",children:e.step})}),t]}):t}var Y=require("react/jsx-runtime");function ce(e){return(0,Y.jsxs)("fieldset",{className:"flex w-full min-w-0 flex-col data-[empty=false]:gap-6","data-empty":e.empty,"data-slot":"field-set",id:e.id,children:[(0,Y.jsx)(Bn,{description:e.description,step:e.step,title:e.title}),(0,Y.jsx)("div",{className:"w-full min-w-0",children:e.children})]})}var Hn=require("react/jsx-runtime");function N(e){return(0,Hn.jsx)("div",{"data-slot":"field-group","data-compact":e.compact,className:"flex w-full flex-col gap-8 data-[compact=true]:gap-3",children:e.children})}var de=require("react/jsx-runtime");function Gn(e){let{fields:t=[]}=e.section,n=e.advanced?.step?e.step:void 0,{compact:r}=ae(e.style,{compact:e.section.advanced?.compact}),o=(0,de.jsx)(N,{compact:r,children:e.children});if(!e.section.title&&!e.section.description)return o;let i=P(e.section.title,e.translations),l=P(e.section.description,e.translations);return e.section.advanced?.collapsible?(0,de.jsx)(Vn,{description:l,group:o,section:e.section,title:i}):(0,de.jsx)(ce,{description:l,empty:t.length===0,id:e.section.id?.toString(),step:n,title:i,children:o})}var _e=require("react/jsx-runtime");function Un(){return(0,_e.jsx)("div",{"data-slot":"field-separator",className:"relative -my-2 h-5 text-sm",children:(0,_e.jsx)("div",{className:"absolute inset-0 top-1/2 h-px w-full bg-zinc-200 dark:bg-zinc-800"})})}var Wn=require("jotai");var M=require("jotai"),$n=require("jotai-family"),ze=require("fast-equals");function Po(e,t){let{[t]:n,...r}=e;return r}function Mo(e){return(0,$n.atomFamily)(t=>(0,M.atom)(n=>n(e)[t]??void 0,(n,r,o)=>{let i=n(e);if(o!=null){let l=i[t];(0,ze.deepEqual)(l,o)||r(e,{...i,[t]:o})}else t in i&&r(e,Po(i,t))}))}function _o(e){return(0,M.atom)(null,(t,n)=>{let r=t(e);r&&Object.keys(r).length>0&&n(e,{})})}function zo(e){return(0,M.atom)(null,(t,n,r)=>{let i={...t(e)},l=!1;for(let a of r)a in i&&(delete i[a],l=!0);l&&n(e,i)})}function Vo(e){return(0,M.atom)(null,(t,n,r)=>{let o=t(e);(0,ze.deepEqual)(o,r)||n(e,r)})}function ue(e={}){let t=(0,M.atom)(e);return{atom:t,clearAll:_o(t),clear:zo(t),bulkReport:Vo(t),report:Mo(t)}}var Yn=ue(),Xn=Yn.atom,Kn=Yn.report;function Bo(e,t){return e.fields.every(n=>Zn(n,t))}function Zn(e,t){return t[e.name]?.hidden??e.hidden??!1}function Ho(e,t){return D(e)?Bo(e,t):Zn(e,t)}function qn(e){let t=(0,Wn.useAtomValue)(Xn);return e.container&&(t[e.container.name]?.hidden??e.container.hidden??!1)||e.fields.length===0||e.fields.every(r=>Ho(r,t))?null:e.children}var F=require("react/jsx-runtime");function Jn(e){let t=le(e.sections,e.definition);return(0,F.jsx)("div",{className:"h-full w-full",children:(0,F.jsx)("form",{noValidate:e.noValidate,action:e.action,children:(0,F.jsxs)(N,{children:[t.map((n,r)=>(0,F.jsxs)(qn,{fields:n.fields??[],children:[(0,F.jsx)(Gn,{advanced:e.advanced,section:n,step:r+1,style:e.config.style,translations:e.translations,children:e.children({disabled:e.readOnly,fields:n.fields})}),n.advanced?.separator&&(0,F.jsx)(Un,{})]},`key-${n.id}-${r}`)),e.control&&(0,F.jsx)(We,{isPending:e.isPending,children:e.control})]})})})}var jn=require("react/jsx-runtime");function Qn(e){return(0,jn.jsx)("p",{className:"-mt-2 text-xs leading-normal font-normal text-zinc-600 dark:text-zinc-400 [[data-slot=column]_&]:md:line-clamp-2",title:e.title,children:e.children})}var er=require("react"),_=require("react/jsx-runtime");function fe(e){let t={context:e.context,env:e.config?.env,value:e.value},r={locale:e.config?.env?.locale},[o,i]=(0,er.useState)(()=>f(e.text)&&"collapsed"in e.text?!e.text.collapsed:!0),l=()=>i(p=>!p),a=f(e.text)&&d(e.text.title)?A(R(U(e.text.title,t,r),e.translations)):void 0,s=R(U(d(e.text)?e.text:e.text?.message,t,r),e.translations),u=A(s);return u?(0,_.jsxs)("div",{className:"flex flex-col gap-2",children:[a&&(0,_.jsxs)("button",{className:"flex items-center gap-1 text-left text-xs font-medium text-zinc-700 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-zinc-100",onClick:l,type:"button",children:[a,(0,_.jsx)(L,{expanded:o})]}),o&&(0,_.jsx)(Qn,{title:s,children:u})]}):null}var Ve=require("jotai");var me=ue(),Al=me.atom,Fl=me.clearAll,Cl=me.clear,tr=me.report,Sl=(0,Ve.atom)({}),Nl=(0,Ve.atom)(null);var Be=require("jotai"),nr=require("react/jsx-runtime");function ge(e){let t=(0,Be.useAtomValue)(tr(e.field.name)),r=(0,Be.useAtomValue)(Kn(e.field.name))?.description??e.field.description;return(0,nr.jsx)(fe,{config:e.config,context:e.context,text:r,translations:e.translations,value:t})}var rr=require("tailwind-merge"),X=require("react/jsx-runtime");function or(e){let t=e.style?.showOptionalLabel??!0,n=I(e.field)||b(e.field);return(0,X.jsxs)("label",{"data-slot":"field-label","data-normal":n,className:(0,rr.twMerge)("flex w-fit items-center text-sm leading-snug font-medium select-none","data-[normal=true]:font-normal [[data-slot=column]_&]:md:w-full","group-data-[readonly=true]:cursor-not-allowed group-data-[readonly=true]:opacity-50"),htmlFor:e.field.name,title:d(e.children)?e.children:void 0,children:[(0,X.jsx)("span",{className:"[[data-slot=column]_&]:md:truncate",children:e.children}),t&&!e.field.required&&(0,X.jsx)("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:ne("(Optional)",e.translations)})]})}var K=require("react/jsx-runtime");function ir(e){let t={context:e.context,env:e.config?.env},n=e.config?.env?.locale,r=U(e.field.label,t,{locale:n});return(0,K.jsxs)("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[(0,K.jsx)(or,{field:e.field,style:e.config?.style,translations:e.translations,children:R(r,e.translations)}),e.horizontal===!0&&(0,K.jsx)(ge,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}var k=require("react/jsx-runtime");function lr(e){return(0,k.jsxs)(k.Fragment,{children:[e.field.name&&e.field.label&&(0,k.jsx)(ir,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&(0,k.jsx)(ge,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}function ar(e,t){return e?t(e):null}var He=require("react/jsx-runtime");function sr(e){let t=Fn(e.field,e.value),{commonPropsWithOptions:n,defaultValue:r}=Cn(e.field,e.commonProps,t,e.value,e.translations),o=Sn(e.field,r);return ar(e.config.inputs[e.field.type],i=>(0,He.jsx)(lr,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:(0,He.jsx)(i,{...e.ariaAttributes,...n,...e.dataAttributes,...o})}))}var Ge=require("react/jsx-runtime");function cr(e){return!e.errors||e.errors.length===0?null:(0,Ge.jsx)("ul",{className:"text-sm text-red-600 dark:text-red-500",id:e.name?`${e.name}-error`:void 0,children:e.errors?.map((t,n)=>(0,Ge.jsx)("li",{children:t},e.name?`${e.name}-error-${n}`:n))})}var dr=require("tailwind-merge"),ur=require("react/jsx-runtime");function pe(e){let t=e.errors&&e.errors.length>0;return(0,ur.jsx)("div",{"data-slot":"field","data-clickable":e.isClickable?"true":"false",...t&&{[At]:"true"},...e.disabled&&{[Ft]:"true"},"data-orientation":e.orientation,className:(0,dr.twMerge)("group flex w-full flex-col items-center data-[invalid=true]:text-red-600 data-[invalid=true]:dark:text-red-500","data-[clickable=true]:items-start",e.isCheckbox&&(e.isReversed?"flex-row-reverse!":"flex-row!"),"data-[clickable=true]:has-[>[data-slot=field-content]]:[&>:first-child]:mt-px",e.className),children:e.children})}var fr=require("tailwind-merge"),gr=require("react/jsx-runtime");function mr(e){return(0,gr.jsx)(pe,{...e,orientation:"vertical",className:(0,fr.twMerge)("gap-3 has-[>[data-slot=field-content]]:items-start",!e.isClickable&&"[&>*]:w-full"),children:e.children})}var pr=require("tailwind-merge"),xr=require("react/jsx-runtime");function yr(e){return(0,xr.jsx)(pe,{...e,orientation:"horizontal",className:(0,pr.twMerge)("gap-2 md:flex-row md:gap-4","[&>[data-slot=field-content]]:min-w-0 [&>[data-slot=field-content]]:flex-grow [&>[data-slot=field-content]]:self-start","[&_[role=checkbox]]:mt-[1.5px]",e.isClickable&&"md:flex-col",!e.isClickable&&["md:justify-between","[&>*:not([data-slot=field-content])]:w-full","[&>*:not([data-slot=field-content])]:md:w-1/2","[&>*:not([data-slot=field-content])]:xl:w-2/5"]),children:e.children})}var Ue=require("react/jsx-runtime");function br(e){let t=en(e.field),n=b(e.field),r=rn(e.field);return e.horizontal?(0,Ue.jsx)(yr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children}):(0,Ue.jsx)(mr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children})}function Rr(e){if(!e.field.type)return null;let t=bn(e.field,e.disabled,{lang:e.lang,translations:e.translations}),n=kn(e.field),r=In(e.field,e.errors),o={...e.field,disabled:t.disabled};return e.children({ariaAttributes:r,commonProps:t,dataAttributes:n,field:o,horizontal:e.horizontal})}var hr=require("tailwind-merge"),z=require("react/jsx-runtime");function Tr(e){let t=e.field.advanced?.cols,n=e.field.name?e.errors?.[e.field.name]:void 0,{horizontal:r=!1}=ae(e.style,{horizontal:nn(e.field)}),o=on(e.field,e.disabled);return(0,z.jsxs)("div",{className:(0,hr.twMerge)("flex flex-col gap-3",Dn(t)),children:[(0,z.jsx)(br,{disabled:o,errors:n,field:e.field,horizontal:r,children:(0,z.jsx)(Rr,{disabled:o,errors:n,field:e.field,horizontal:r,lang:e.lang,translations:e.translations,children:e.children})}),(0,z.jsx)(cr,{errors:n,name:e.field.name})]})}var ye=require("tailwind-merge"),Ar=require("react"),c=require("react/jsx-runtime");function Fr(e){let t=e.isMultiField||e.collapsed!=null,[n,r]=(0,Ar.useState)(t?!e.collapsed:!0);function o(){e.canRemove&&e.onRemove&&e.onRemove(e.index)}function i(){r(p=>!p)}let l=p=>G(ne(p,e.translations),{index:e.index+1,label:e.label}),a=e.canRemove&&e.onRemove!=null&&(0,c.jsx)("button",{"aria-label":l("Remove {label} item {index}"),className:(0,ye.twMerge)("flex size-6 items-center justify-center rounded text-xl leading-none text-zinc-400","transition-colors duration-150","hover:text-red-500","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500 dark:hover:text-red-400"),onClick:o,type:"button",children:(0,c.jsx)("span",{"aria-hidden":"true",className:"leading-none",children:"\xD7"})}),s=(0,c.jsxs)("div",{className:"flex min-w-0 flex-col font-medium text-zinc-700 dark:text-zinc-400",children:[(0,c.jsx)("span",{className:"text-base",children:e.previewLabel??(0,c.jsxs)(c.Fragment,{children:[e.label," ",e.index+1]})}),!n&&e.previewTags&&(0,c.jsx)("div",{className:"flex items-center gap-2 overflow-hidden text-xs font-normal text-ellipsis whitespace-nowrap text-zinc-500 dark:text-zinc-500",children:e.previewTags})]}),u=(0,c.jsxs)("div",{className:(0,ye.twMerge)("flex items-center justify-between gap-2",e.isMultiField&&n&&"mb-3"),children:[t?(0,c.jsxs)("div",{className:"flex min-w-0 grow items-center gap-2",children:[(0,c.jsxs)("button",{"aria-expanded":n,"aria-label":l(n?"Collapse {label} {index}":"Expand {label} {index}"),className:(0,ye.twMerge)("group flex grow items-center gap-2 rounded p-1 text-left text-zinc-400","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500"),onClick:i,type:"button",children:[(0,c.jsx)(L,{expanded:n}),s]}),!n&&e.previewBadge&&(0,c.jsx)("div",{className:"ml-auto shrink-0",children:e.previewBadge})]}):s,a]});return e.isMultiField?(0,c.jsxs)("div",{"data-slot":"list-item-card",className:"box-border w-full min-w-0 rounded-lg border border-zinc-100 p-4 dark:border-zinc-900",children:[u,(0,c.jsx)(V,{visible:n,children:(0,c.jsx)(N,{children:e.children})})]}):t?(0,c.jsxs)("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[u,(0,c.jsx)(V,{visible:n,children:(0,c.jsx)(N,{children:e.children})})]}):(0,c.jsxs)("div",{className:"box-border flex w-full min-w-0 items-start gap-2",children:[(0,c.jsx)("div",{className:"flex min-w-0 grow flex-col",children:(0,c.jsx)(N,{children:e.children})}),a&&(0,c.jsx)("div",{className:"shrink-0",children:a})]})}var Sr=require("react/jsx-runtime");function Cr(e){let t=R(_n(e.field),e.translations),n=Pn(e.field);return Mn(e.field,e.value).map(r=>(0,Sr.jsx)(Fr,{collapsed:e.field.advanced?.collapsed,index:r,isMultiField:n,label:t,translations:e.translations,children:e.children(r)},r))}var vr=require("react/jsx-runtime");function Nr(e){let t=Array.isArray(e.field.fields)&&e.field.fields.length===0,n=P(e.field.label,e.translations),r=P(e.field.description,e.translations);return(0,vr.jsx)(ce,{description:r,empty:t,id:e.field.name,title:n,children:e.children})}var $e=require("react/jsx-runtime");function wr({children:e,field:t,lang:n,translations:r,value:o}){return(0,$e.jsx)(Nr,{field:t,translations:r,children:(0,$e.jsx)(Cr,{field:t,lang:n,translations:r,value:o,children:e})})}var Ir=require("tailwind-merge");var W=require("react/jsx-runtime");function kr(e){let t=On(e.column?.advanced?.cols);return(0,W.jsxs)("div",{className:"flex w-full flex-col gap-4",children:[(0,W.jsx)("div",{"data-slot":"column",className:(0,Ir.twMerge)("grid grid-cols-1 gap-3 sm:gap-4",t),children:e.children}),e.column?.description&&(0,W.jsx)(fe,{config:e.config,context:e.context,text:e.column.description,translations:e.translations})]})}var Or=require("react");var Er=require("react/jsx-runtime");function Lr(e){let t=Array.isArray(e.field.fields)?e.field.fields.map(n=>te(n)||ee(n)?{...n,name:`${e.field.name}.${e.index}.${n.name}`}:D(n)?{...n,fields:n.fields.map(r=>({...r,name:`${e.field.name}.${e.index}.${r.name}`}))}:n):[];return(0,Er.jsx)(Z,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,fields:t,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})}var v=require("react/jsx-runtime");function Z(e){let{field:t,list:n}=e.components;return le(e.fields).map((r,o)=>(0,v.jsxs)(Or.Fragment,{children:[D(r)&&(0,v.jsx)(kr,{column:r,config:e.config,context:e.context,translations:e.translations,children:(0,v.jsx)(Z,{...e,fields:r.fields})}),te(r)&&(0,v.jsx)(t,{disabled:e.disabled,field:r,lang:e.lang,style:e.style,translations:e.translations,children:e.children}),ee(r)&&(0,v.jsx)(n,{field:r,lang:e.lang,onValueChange:e.onValueChange,translations:e.translations,value:e.value,children:i=>(0,v.jsx)(Lr,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,field:r,index:i,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})})]},o))}var Pr=require("react/jsx-runtime");function Dr(e){return n=>(0,Pr.jsx)(Z,{...n,components:e})}var Mr=Dr({field:Tr,list:wr});var xe=require("react/jsx-runtime");function be(e){let t=xn(e.lang,e.translations);return(0,xe.jsx)(Jn,{advanced:e.advanced,config:e.config,control:e.children,definition:e.definition,readOnly:e.readOnly,sections:e.sections,translations:t,children:({disabled:n,fields:r})=>(0,xe.jsx)(Mr,{config:e.config,context:e.context,disabled:n,fields:r,lang:e.lang,style:e.config.style,translations:t,value:e.value,children:o=>(0,xe.jsx)(sr,{...o,config:e.config,context:e.context,translations:t,value:e.value})})})}var _r=require("react");var Ye=require("react/jsx-runtime");function zr(e){return(0,Ye.jsx)(_r.Suspense,{fallback:(0,Ye.jsx)(be,{config:e.config,sections:e.sections,readOnly:!0}),children:e.children})}
|
|
1
|
+
"use strict";var Se=Object.defineProperty;var Xr=Object.getOwnPropertyDescriptor;var Kr=Object.getOwnPropertyNames;var Wr=Object.prototype.hasOwnProperty;var Zr=(e,t)=>{for(var n in t)Se(e,n,{get:t[n],enumerable:!0})},qr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kr(t))!Wr.call(e,o)&&o!==n&&Se(e,o,{get:()=>t[o],enumerable:!(r=Xr(t,o))||r.enumerable});return e};var Jr=e=>qr(Se({},"__esModule",{value:!0}),e);var jo={};Zr(jo,{Fallback:()=>Yr,Form:()=>Fe});module.exports=Jr(jo);var tt=require("react/jsx-runtime");function et(e){let t=typeof e.children=="function"?e.children({isPending:e.isPending}):e.children;return(0,tt.jsx)("div",{"data-slot":"field-control",className:"w-full",children:t})}var Ne=require("react/jsx-runtime");function L(e){return(0,Ne.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`size-4 transition-transform duration-200 ${e.expanded?"rotate-90":""}`,children:(0,Ne.jsx)("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})})}var nt=require("react"),rt=(0,nt.createContext)(!1);var ot=require("react"),B=(0,ot.createContext)(()=>{});var re=require("react"),ne=require("react/jsx-runtime");function H({children:e,onReveal:t,visible:n}){let r=(0,re.use)(B),o=(0,re.useCallback)(()=>{t?.(),r()},[t,r]);return(0,ne.jsx)("div",{"data-slot":"collapsible-content",hidden:!n,children:(0,ne.jsx)(B,{value:o,children:(0,ne.jsx)(rt,{value:!0,children:e})})})}var oe="input",it="input/date",lt="input/email",at="input/number",st="input/time";var ct="textarea",dt="radio",ut="checkbox",we="list",ft="select",mt="select/active",gt="select/day",pt="select/month",yt="select/timezone",xt="select/year";var bt="chips",Rt="chips/day",ht="chips/month",G="column",Tt="description",Ie="fields",At="label",ke="value",ie="options",Ee="email",vt="number",Ft="password",Ct="tel",U="text",St="aria-errormessage",Nt="aria-invalid",wt="data-invalid",It="data-readonly",kt="aria",Et="data",Lt="max",Ot="maxLength",Dt="min",Pt="minLength",O="$ref";var Mt="type",_t={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};var g=require("date-fns"),w=require("date-fns/locale");function u(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function y(e){return d(e)||typeof e=="number"||Qr(e)}function Vt(e){return Array.isArray(e)&&e.every(y)}function d(e){return typeof e=="string"}function Qr(e){return typeof e=="boolean"}var zt={en:w.enUS,"en-US":w.enUS,es:w.es,"es-ES":w.es,"es-MX":w.es},jr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},eo={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function Bt(e){if(e)return zt[e]??zt[e.split("-")[0]]}function le(e){if(typeof e=="number"&&!Number.isNaN(e))return e;if(d(e)&&e.trim()!==""){let t=Number(e);return Number.isNaN(t)?null:t}return null}function Ht(e,t,n){let r=eo[t];if(r===void 0)return String(e);let o=e*r,i=(0,g.intervalToDuration)({start:0,end:o});return(0,g.formatDuration)(i,{locale:n})}function Gt(e){if(e instanceof Date)return(0,g.isValid)(e)?e:null;if(d(e)){let t=(0,g.parseISO)(e);if((0,g.isValid)(t))return t;let n=new Date(e);return(0,g.isValid)(n)?n:null}if(typeof e=="number"){let t=new Date(e);return(0,g.isValid)(t)?t:null}return null}var to={currency:(e,t,n)=>{let r=le(e);if(r===null)return String(e);let o=t[0]??"USD";return new Intl.NumberFormat(n.locale,{style:"currency",currency:o}).format(r)},percent:(e,t,n)=>{let r=le(e);return r===null?String(e):new Intl.NumberFormat(n.locale,{style:"percent"}).format(r)},number:(e,t,n)=>{let r=le(e);return r===null?String(e):new Intl.NumberFormat(n.locale).format(r)},date:(e,t,n)=>{let r=Gt(e);if(!r)return String(e);let o=t[0]??"short",i=Bt(n.locale);if(o==="relative")return(0,g.formatDistanceToNow)(r,{addSuffix:!0,locale:i});let l=jr[o]??o;return(0,g.format)(r,l,{locale:i})},duration:(e,t,n)=>{let r=Bt(n.locale);if(typeof e=="number")return Ht(e,t[0]??"ms",r);if(d(e)){let i=le(e);if(i!==null)return Ht(i,t[0]??"ms",r)}let o=Gt(e);return o?(0,g.formatDistanceToNow)(o,{addSuffix:!0,locale:r}):String(e)}};function Ut(e,t,n){let r=t.split(":").map(a=>a.trim()).filter(a=>a.length>0);if(r.length===0)return;let[o,...i]=r,l=to[o];if(l)return l(e,i,n)}function no(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function $t(e,t=ke){if(e!=null){if(Vt(e)||y(e))return e;if(u(e)){let n=ro(e,t);if(y(n))return n}}}function ro(e,t){let n=x(e,t);if(y(n))return n}function x(e,t){if(!t||!u(e))return null;let n=t.split(".").filter(o=>o!=="");if(n.length===0)return null;let r=e;for(let o of n)if(u(r)&&no(r,o))r=r[o];else if(Array.isArray(r)){let i=Number(o);if(!Number.isInteger(i)||i<0||i>=r.length)return null;r=r[i]}else return null;return r}function Yt(e,t={description:Tt,label:At,value:ke}){return e.map(n=>{if(u(n)){let r=x(n,t.label),o=x(n,t.value);if(y(r)&&y(o)){let i=x(n,t.description);return{label:`${r}`,value:`${o}`,...y(i)&&{description:`${i}`}}}}return n})}function Xt(e=U){let t=e.lastIndexOf("/"),n=t===-1?e:e.slice(t+1);return n&&n!==oe?n.trim().toLowerCase():U}var oo=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g,io=/{([^}]{1,200})}/,lo=/{([^}]{1,200})}/g;function $(e,t={},n={}){if(d(e))return so(e,t,n);if(Array.isArray(e))return e.map(r=>$(r,t,n));if(u(e)){let r={};for(let o in e)r[o]=$(e[o],t,n);return r}return e}function Y(e,t={},n={}){return Le(e)?$(e,t,n):e}function Le(e){return d(e)?io.test(e):Array.isArray(e)?e.some(t=>Le(t)):u(e)?Object.values(e).some(t=>Le(t)):!1}function ao(e,t){return t.includes(".")?x(e,t):e[t]}function so(e,t={},n={}){return e.replace(lo,(r,o)=>{let i=String(o).split("|").map(p=>p.trim()),[l,...a]=i;if(!l)return r;let s=ao(t,l);if(a.length===0)return y(s)?String(s):r;if(s==null)return r;let f=s;for(let p of a){let te=Ut(f,p,{locale:n.locale});if(te===void 0)return r;f=te}return String(f)})}function Kt(e,t){if(!d(e)||!e||e.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=oo.exec(e))!==null;){let[l,a,s]=n,f=n.index;o=!0,f>r&&i.push(e.substring(r,f));let p=t?t(f,s,a):l;i.push(p),r=f+l.length}return o?(r<e.length&&i.push(e.substring(r)),i):e}var Wt=e=>m(mt)(e),Zt=e=>m(gt)(e),qt=e=>m(pt)(e),Jt=e=>m(xt)(e),Qt=e=>m(yt)(e),jt=e=>m(Rt)(e),en=e=>m(ht)(e),tn=m(it),Oe=m(st),b=m(ut),D=m(bt),I=m(dt),nn=m(oe),F=m(ft),rn=m(ct),on=m(U,Ee,Ft,Ct),Ti=m(lt,Ee),De=m(at,vt);function ln(e){return I(e)||b(e)}function ae(e){return e.type===we}function P(e){return e.type===G}function se(e){return e.type!==G&&e.type!==we}function Pe(e){return F(e)||I(e)||D(e)}function X(e){return e!=null&&e!==""}function m(...e){return t=>{let n=d(t.type)?t.type:void 0;return n?e.some(r=>n===r||n?.startsWith(`${r}/`)):!1}}function an(e,t={}){if(F(e)&&e.disabled){let n=e.name?t?.[e.name]:void 0;if(n&&u(n))return[n]}}function sn(e){return I(e)||b(e)?!0:e.advanced?.horizontal}function cn(e){return b(e)?e.advanced?.reverse!==!1:!1}function dn(e,t){let n=e.readonly??!1;return t||n}function un(e,t){return!!e.readonly&&!t&&!e.disabled}function fn(e){let t=e.advanced?.step;if(typeof t=="number"&&Number.isFinite(t)&&t>0)return t}function Me(e){if(co(e)){let t=e.source;if(Array.isArray(t)||u(t)&&!(O in t))return t}}function mn(e){return Array.isArray(Me(e))}function co(e){return I(e)||D(e)||F(e)&&!e.disabled}var T=require("date-fns"),uo=/^\d+$/,yn=new Date(2e3,0,1),fo=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[],_e="default";function xn(e){if(!e)return _e;try{return Intl.getCanonicalLocales(e)[0]??_e}catch{return _e}}function Ve(e){let t=xn(e);return Array.from({length:12},(n,r)=>({value:(r+1).toString(),label:new Date(0,r).toLocaleString(t,{month:"long"})}))}function ze(e){let t=xn(e);return Array.from({length:7},(n,r)=>({value:r.toString(),label:new Date(2e3,0,2+r).toLocaleString(t,{weekday:"long"})}))}function bn(e,t){return t>=e?Array.from({length:t-e+1},(n,r)=>{let o=e+r;return{value:o.toString(),label:o.toString()}}):[]}function Be(){return new Date().getFullYear()}function mo(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function go(e){let t=e.indexOf("/"),n=t===-1?e:e.slice(0,t);return _t[n]??"Other"}function po(e,t){return(e.find(r=>r.type==="timeZoneName")?.value??t).replace(/\s+(?:Standard|Daylight(?: Saving)?|Summer|Winter)\s+Time$/,"")}function gn(e,t){let n=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t),r=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"long"}).formatToParts(t),i=(n.find(a=>a.type==="timeZoneName")?.value??"GMT+00:00").replace("GMT","UTC"),l=po(r,e);return{offset:i,longName:l}}function pn(e){return e.slice(e.lastIndexOf("/")+1).replace(/_/g," ")}function Rn(){let e=new Date,t=mo(),n=new Map,r=pn(t),{offset:o,longName:i}=gn(t,e),l={value:t,label:`${r} - ${i} (${o})`};for(let s of fo()){if(s===t)continue;let f=pn(s),{offset:p,longName:te}=gn(s,e),Qe={value:s,label:`${f} - ${te} (${p})`},Ce=go(s);if(Ce==="Other")continue;let je=n.get(Ce);je?je.push(Qe):n.set(Ce,[Qe])}for(let s of n.values())s.sort((f,p)=>f.label.localeCompare(p.label));let a=Array.from(n.entries()).sort(([s],[f])=>s.localeCompare(f)).map(([s,f])=>({label:s,items:f}));return[{label:"Suggested",items:[l]},...a]}function He(e,t){if(typeof e=="number")return e;let n=t??Be(),r=e.trim().toLowerCase();if(r.startsWith("current")){let o=r.match(/^current([+-])(\d+)$/);if(o){let[,i,l]=o,a=parseInt(l,10);if(!isNaN(a))return i==="+"?n+a:n-a}return n}return uo.test(r)?parseInt(r,10):n}function hn(e,t){if(!e)return"";try{let n=(0,T.parse)(e,t,yn);return(0,T.isValid)(n)?(0,T.format)(n,"yyyy-MM-dd"):""}catch{return""}}function Tn(e,t){if(!e)return"";try{let n=(0,T.parse)(e,t,yn);return(0,T.isValid)(n)?(0,T.format)(n,"HH:mm:ss"):""}catch{return""}}function Ge(e){return e.advanced?.format??"HH:mm"}function An(e){return e.advanced?.format??"MMMM d, yyyy"}var yo={es:{"(Optional)":"(Opcional)","Add item":"A\xF1adir elemento","An unexpected error occurred submitting the form.":"Ocurri\xF3 un error inesperado al enviar el formulario.","Collapse {label} {index}":"Contraer {label} {index}","Expand {label} {index}":"Expandir {label} {index}","Please correct the errors and try again.":"Corrige los errores e int\xE9ntalo de nuevo.","Remove {label} item {index}":"Eliminar {label} {index}","There were validation errors submitting the form.":"Se encontraron errores de validaci\xF3n al enviar el formulario.","Unknown error":"Error desconocido",No:"No",Yes:"S\xED"}};function ce(e,t){return R(e,t)}function Fn(e,t){let n=t?.[e??""],r=e?yo[xo(e)]:void 0;return r?n?{...r,...n}:r:n}function xo(e){return e.toLowerCase().split(/[-_]/)[0]}function R(e,t){return e?t?t[e]??e:e:""}function M(e,t){return e?R(e,t):void 0}function de(e,t){if(!t)return e;let n=!1,r=e.map(o=>{let i=bo(o,t);return i!==o&&(n=!0),i});return n?r:e}function bo(e,t){if(!u(e))return e;let n=vn(e.label,t),r=e.items;if(Array.isArray(r)){let i=de(r,t);return i===r&&n===e.label?e:{...e,...n!==void 0&&{label:n},items:i}}let o=vn(e.description,t);return n===e.label&&o===e.description?e:{...e,...n!==void 0&&{label:n},...o!==void 0&&{description:o}}}function vn(e,t){return d(e)?R(e,t):e}var ue=Be();function Ro(e,t){if(D(e))return ho(e,t?.lang)}function ho(e,t){if(jt(e))return ze(t);if(en(e))return Ve(t)}function To(e,t){if(F(e))return Ao(e,t)}function Ao(e,t){let{lang:n,translations:r}=t??{};if(Zt(e))return ze(n);if(qt(e))return Ve(n);if(Jt(e)){let o=e.advanced?.length?.min??ue,i=e.advanced?.length?.max??ue+5;return bn(He(o,ue),He(i,ue))}if(Qt(e))return Rn();if(Wt(e))return de([{value:"true",label:"Yes"},{value:"false",label:"No"}],r)}function Cn(e,t=!1,n){let r={disabled:t,id:e.name,name:e.name,placeholder:e.placeholder,required:e.required};return nn(e)?{...r,...vo(e)}:F(e)?{...r,...Sn(To(e,n))}:rn(e)?{...r,...So(e)}:D(e)?{...r,...Co(e,n)}:r}function vo(e){let t=Xt(e.type),n={...e,type:t};return{...wo(e),...Nn(e),...No(n),...Fo(n),...on(n)?wn(n):{},type:t}}function Fo(e){let t=fn(e);return De(e)&&t!==void 0?{step:t}:{}}function Sn(e){return e?{options:e}:{}}function Co(e,t){let n=Sn(Ro(e,t)),r=e.advanced?.multiple??!0;return{...n,multiple:r}}function So(e){return{...Nn(e),...wn(e)}}function Nn(e){let t=e.advanced?.autocomplete;return t?{autoComplete:t}:{}}function No(e){return De(e)?Io(e):{}}function wo(e){if(Oe(e)){let t=Ge(e);return{step:t==="HH:mm:ss"||t==="hh:mm:ss a"?"1":"60"}}return{}}function wn(e){return In(e,{min:Pt,max:Ot})}function Io(e){return In(e,{min:Dt,max:Lt})}function In(e,t){let n={},r=e.advanced?.length;return r&&(r.min!==void 0&&(n[t.min]=r.min),r.max!==void 0&&(n[t.max]=r.max)),n}function kn(e,t){let n=Me(e);return n||an(e,t)}function ko(e,t){let n=u(t)&&e.name in t?t[e.name]:t,r=$t(n,e.advanced?.entity),o=X(r)?r:e.defaultValue;return Oe(e)&&X(o)?Eo(e,o):tn(e)&&X(o)?Po(e,o):o}function Eo(e,t){let n=Ge(e);return d(t)?Tn(t,n):t}function Lo(e,t,n){return Pe(e)&&Array.isArray(n)?{...t,[ie]:n}:t}function Oo(e,t,n){if(e.required&&!X(n)&&F(e)&&e.advanced?.preselected!==!1&&ie in t){let r=t[ie];if(Array.isArray(r)&&r.length===1)return r[0]}return n}function Do(e,t,n){if(Pe(e)&&Array.isArray(t)){let r=Yt(t,e.advanced?.options);return mn(e)?de(r,n):r}return t}function En(e,t,n,r,o){let i=ko(e,r),l=Array.isArray(n)?Do(e,n,o):n,a=Lo(e,t,l),s=Oo(e,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function Ln(e,t){return b(e)?{defaultChecked:!!t}:{defaultValue:t}}function Po(e,t){let n=An(e);return d(t)?hn(t,n):t}var Mo=/^#\/definition\//;function me(e=[],t){let n=fe(e,t);return Array.isArray(n)?n.filter(Vo).sort((r,o)=>On(r)-On(o)):[]}function fe(e,t,n=new Map,r=new WeakSet){if(!_o(t)||!e||typeof e!="object")return e;if(n.has(e))return n.get(e);if(r.has(e))return e;if(r.add(e),Array.isArray(e))return e.map(i=>fe(i,t,n,r));if(O in e&&d(e[O])){let i=e[O].replace(Mo,""),l=x(t,i);return l!==null?fe(l,t,n,r):e}let o={};for(let[i,l]of Object.entries(e))o[i]=fe(l,t,n,r);return r.delete(e),n.set(e,o),o}function Dn(e){return Object.entries(e??{})}function On(e){return e.order??Number.MAX_VALUE}function _o(e){return e!==void 0&&u(e)&&Object.keys(e).length>0}function Vo(e){return Mt in e?!0:Array.isArray(e[Ie])?e[Ie].length>0:!0}function Pn(e,t){let n={};for(let[r,o]of Dn(t))n[`${e}-${r}`]=o;return n}function zo(e){return Pn(kt,e)}function Bo(e){return Pn(Et,e)}function Mn(e,t){let n=zo(e.advanced?.aria);return t&&t.length>0&&(n[Nt]="true",n[St]=`${e.name}-error`),n}function _n(e){return Bo(e.advanced?.data)}var Vn={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},zn={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function Bn(e,t=2){return Vn[e&&e in Vn?e:t]}function Hn(e){if(e&&e in zn)return zn[e]}function Ho(e){return{min:e.advanced?.length?.min??1,max:e.advanced?.length?.max??1/0}}function Go(e,t){let n=t?x(t,e.name):null;return Uo(e,Array.isArray(n)?n.length:0)}function Gn(e){return!Array.isArray(e.fields)||e.fields.length===0?!1:e.fields.length>1||e.fields[0].type===G}function Un(e,t){let n=Go(e,t);return Array.from({length:n},(r,o)=>o)}function $n(e){return e.advanced?.title??e.label??e.name}function Uo(e,t){let{min:n,max:r}=Ho(e);return Math.min(Math.max(t,n),r)}function ge(e,t){let n={...e};for(let r of Object.keys(t??{})){let o=t?.[r];o!==void 0&&(n[r]=o)}return n}var Yn=require("react/jsx-runtime");function A(e){return Kt(e,(t,n,r)=>(0,Yn.jsx)("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${t}`))}var K=require("react");function _(e=!1){let[t,n]=(0,K.useState)(e),r=(0,K.useCallback)(()=>n(i=>!i),[]),o=(0,K.useCallback)(()=>n(!0),[]);return[t,r,o]}var h=require("react/jsx-runtime");function Xn(e){let{fields:t=[]}=e.section,[n,r,o]=_();return(0,h.jsxs)("fieldset",{"data-slot":"field-set","data-advanced":"true","data-expanded":n,"data-empty":t.length===0,className:"flex flex-col",id:e.section.id?.toString(),children:[(0,h.jsx)("legend",{children:(0,h.jsxs)("button",{className:"flex cursor-pointer items-center gap-2 text-base font-medium text-zinc-600 dark:text-zinc-400",onClick:r,type:"button",children:[(0,h.jsx)(L,{expanded:n}),(0,h.jsx)("span",{children:A(e.title)})]})}),(0,h.jsx)(H,{onReveal:o,visible:n,children:(0,h.jsxs)("div",{className:"mt-3 ml-1.5 flex flex-col gap-4 border-l-2 border-zinc-300 pl-4 dark:border-zinc-600","data-slot":"field-set-content",children:[e.description&&(0,h.jsx)("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:A(e.description)}),e.group]})})]})}var C=require("react/jsx-runtime");function Kn(e){let t=(0,C.jsxs)("div",{className:"flex flex-col",children:[e.title&&(0,C.jsx)("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:A(e.title)}),e.description&&(0,C.jsx)("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:A(e.description)})]});return e.step?(0,C.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,C.jsx)("div",{className:"bg-primary text-primary-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:(0,C.jsx)("span",{className:"text-sm font-bold",children:e.step})}),t]}):t}var W=require("react/jsx-runtime");function pe(e){return(0,W.jsxs)("fieldset",{className:"flex w-full min-w-0 flex-col data-[empty=false]:gap-6","data-empty":e.empty,"data-slot":"field-set",id:e.id,children:[(0,W.jsx)(Kn,{description:e.description,step:e.step,title:e.title}),(0,W.jsx)("div",{className:"w-full min-w-0",children:e.children})]})}var Wn=require("react/jsx-runtime");function S(e){return(0,Wn.jsx)("div",{"data-slot":"field-group","data-compact":e.compact,className:"flex w-full flex-col gap-8 data-[compact=true]:gap-3",children:e.children})}var ye=require("react/jsx-runtime");function Zn(e){let{fields:t=[]}=e.section,n=e.advanced?.step?e.step:void 0,{compact:r}=ge(e.style,{compact:e.section.advanced?.compact}),o=(0,ye.jsx)(S,{compact:r,children:e.children});if(!e.section.title&&!e.section.description)return o;let i=M(e.section.title,e.translations),l=M(e.section.description,e.translations);return e.section.advanced?.collapsible?(0,ye.jsx)(Xn,{description:l,group:o,section:e.section,title:i}):(0,ye.jsx)(pe,{description:l,empty:t.length===0,id:e.section.id?.toString(),step:n,title:i,children:o})}var Ue=require("react/jsx-runtime");function qn(){return(0,Ue.jsx)("div",{"data-slot":"field-separator",className:"relative -my-2 h-5 text-sm",children:(0,Ue.jsx)("div",{className:"absolute inset-0 top-1/2 h-px w-full bg-zinc-200 dark:bg-zinc-800"})})}var er=require("jotai");var k=require("jotai"),Jn=require("jotai-family"),$e=require("fast-equals");function $o(e,t){let{[t]:n,...r}=e;return r}function Yo(e){return(0,Jn.atomFamily)(t=>(0,k.atom)(n=>n(e)[t]??void 0,(n,r,o)=>{let i=n(e);if(o!=null){let l=i[t];(0,$e.deepEqual)(l,o)||r(e,{...i,[t]:o})}else t in i&&r(e,$o(i,t))}))}function Xo(e){return(0,k.atom)(null,(t,n)=>{let r=t(e);r&&Object.keys(r).length>0&&n(e,{})})}function Ko(e){return(0,k.atom)(null,(t,n,r)=>{let i={...t(e)},l=!1;for(let a of r)a in i&&(delete i[a],l=!0);l&&n(e,i)})}function Wo(e){return(0,k.atom)(null,(t,n,r)=>{for(let o of r)e.remove(o)})}function Zo(e){return(0,k.atom)(null,(t,n,r)=>{let o=t(e);(0,$e.deepEqual)(o,r)||n(e,r)})}function xe(e={}){let t=(0,k.atom)(e),n=Yo(t);return{atom:t,clearAll:Xo(t),clear:Ko(t),bulkReport:Zo(t),release:Wo(n),report:n}}var Ye=xe(),Qn=Ye.atom,Rl=Ye.release,jn=Ye.report;function qo(e,t){return e.fields.every(n=>tr(n,t))}function tr(e,t){return t[e.name]?.hidden??e.hidden??!1}function Jo(e,t){return P(e)?qo(e,t):tr(e,t)}function nr(e){let t=(0,er.useAtomValue)(Qn);return e.container&&(t[e.container.name]?.hidden??e.container.hidden??!1)||e.fields.length===0||e.fields.every(r=>Jo(r,t))?null:e.children}var v=require("react/jsx-runtime");function rr(e){let t=me(e.sections,e.definition);return(0,v.jsx)("div",{className:"h-full w-full",children:(0,v.jsx)("form",{noValidate:e.noValidate,action:e.action,onSubmit:e.onSubmit,children:(0,v.jsxs)(S,{children:[t.map((n,r)=>(0,v.jsxs)(nr,{fields:n.fields??[],children:[(0,v.jsx)(Zn,{advanced:e.advanced,section:n,step:r+1,style:e.config.style,translations:e.translations,children:e.children({disabled:e.readOnly,fields:n.fields})}),n.advanced?.separator&&(0,v.jsx)(qn,{})]},`key-${n.id}-${r}`)),e.control&&(0,v.jsx)(et,{isPending:e.isPending,children:e.control})]})})})}var ir=require("react/jsx-runtime");function or(e){return(0,ir.jsx)("p",{className:"-mt-2 text-xs leading-normal font-normal text-zinc-600 dark:text-zinc-400 [[data-slot=column]_&]:md:line-clamp-2",title:e.title,children:e.children})}var V=require("react/jsx-runtime");function be(e){let t={context:e.context,env:e.config?.env,value:e.value},r={locale:e.config?.env?.locale},[o,i]=_(()=>u(e.text)&&"collapsed"in e.text?!e.text.collapsed:!0),l=u(e.text)&&d(e.text.title)?A(R(Y(e.text.title,t,r),e.translations)):void 0,a=R(Y(d(e.text)?e.text:e.text?.message,t,r),e.translations),s=A(a);return s?(0,V.jsxs)("div",{className:"flex flex-col gap-2",children:[l&&(0,V.jsxs)("button",{className:"flex items-center gap-1 text-left text-xs font-medium text-zinc-700 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-zinc-100",onClick:i,type:"button",children:[l,(0,V.jsx)(L,{expanded:o})]}),o&&(0,V.jsx)(or,{title:a,children:s})]}):null}var Xe=require("jotai");var Z=xe(),zl=Z.atom,Bl=Z.clearAll,Hl=Z.clear,Gl=Z.release,lr=Z.report,Ul=(0,Xe.atom)({}),$l=(0,Xe.atom)(null);var Ke=require("jotai"),ar=require("react/jsx-runtime");function Re(e){let t=(0,Ke.useAtomValue)(lr(e.field.name)),r=(0,Ke.useAtomValue)(jn(e.field.name))?.description??e.field.description;return(0,ar.jsx)(be,{config:e.config,context:e.context,text:r,translations:e.translations,value:t})}var sr=require("tailwind-merge"),q=require("react/jsx-runtime");function cr(e){let t=e.style?.showOptionalLabel??!0,n=I(e.field)||b(e.field);return(0,q.jsxs)("label",{"data-slot":"field-label","data-normal":n,className:(0,sr.twMerge)("flex w-fit items-center text-sm leading-snug font-medium select-none","data-[normal=true]:font-normal [[data-slot=column]_&]:md:w-full","group-data-[readonly=true]:cursor-not-allowed group-data-[readonly=true]:opacity-50"),htmlFor:e.field.name,title:d(e.children)?e.children:void 0,children:[(0,q.jsx)("span",{className:"[[data-slot=column]_&]:md:truncate",children:e.children}),t&&!e.field.required&&(0,q.jsx)("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:ce("(Optional)",e.translations)})]})}var J=require("react/jsx-runtime");function dr(e){let t={context:e.context,env:e.config?.env},n=e.config?.env?.locale,r=Y(e.field.label,t,{locale:n});return(0,J.jsxs)("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[(0,J.jsx)(cr,{field:e.field,style:e.config?.style,translations:e.translations,children:R(r,e.translations)}),e.horizontal===!0&&(0,J.jsx)(Re,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}var E=require("react/jsx-runtime");function ur(e){return(0,E.jsxs)(E.Fragment,{children:[e.field.name&&e.field.label&&(0,E.jsx)(dr,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&(0,E.jsx)(Re,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}function fr(e,t){return e?t(e):null}var We=require("react/jsx-runtime");function mr(e){let t=kn(e.field,e.value),{commonPropsWithOptions:n,defaultValue:r}=En(e.field,e.commonProps,t,e.value,e.translations),o=Ln(e.field,r);return fr(e.config.inputs[e.field.type],i=>(0,We.jsx)(ur,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:(0,We.jsx)(i,{...e.ariaAttributes,...n,...e.dataAttributes,...o})}))}var gr=require("react"),pr=(0,gr.createContext)(null);var Q=require("react"),he=require("react/jsx-runtime");function yr(e){return!e.errors||e.errors.length===0?null:(0,he.jsx)(Qo,{errors:e.errors,name:e.name})}function Qo(e){let t=(0,Q.use)(B),n=(0,Q.use)(pr);return(0,Q.useEffect)(()=>{n&&t()},[n,t]),(0,he.jsx)("ul",{className:"text-sm text-red-600 dark:text-red-500",id:e.name?`${e.name}-error`:void 0,children:e.errors.map((r,o)=>(0,he.jsx)("li",{children:r},e.name?`${e.name}-error-${o}`:o))})}var xr=require("tailwind-merge"),br=require("react/jsx-runtime");function Te(e){let t=e.errors&&e.errors.length>0;return(0,br.jsx)("div",{"data-slot":"field","data-clickable":e.isClickable?"true":"false",...t&&{[wt]:"true"},...e.disabled&&{[It]:"true"},"data-orientation":e.orientation,className:(0,xr.twMerge)("group flex w-full flex-col items-center data-[invalid=true]:text-red-600 data-[invalid=true]:dark:text-red-500","data-[clickable=true]:items-start",e.isCheckbox&&(e.isReversed?"flex-row-reverse!":"flex-row!"),"data-[clickable=true]:has-[>[data-slot=field-content]]:[&>:first-child]:mt-px",e.className),children:e.children})}var Rr=require("tailwind-merge"),Tr=require("react/jsx-runtime");function hr(e){return(0,Tr.jsx)(Te,{...e,orientation:"vertical",className:(0,Rr.twMerge)("gap-3 has-[>[data-slot=field-content]]:items-start",!e.isClickable&&"[&>*]:w-full"),children:e.children})}var Ar=require("tailwind-merge"),Fr=require("react/jsx-runtime");function vr(e){return(0,Fr.jsx)(Te,{...e,orientation:"horizontal",className:(0,Ar.twMerge)("gap-2 md:flex-row md:gap-4","[&>[data-slot=field-content]]:min-w-0 [&>[data-slot=field-content]]:flex-grow [&>[data-slot=field-content]]:self-start","[&_[role=checkbox]]:mt-[1.5px]",e.isClickable&&"md:flex-col",!e.isClickable&&["md:justify-between","[&>*:not([data-slot=field-content])]:w-full","[&>*:not([data-slot=field-content])]:md:w-1/2","[&>*:not([data-slot=field-content])]:xl:w-2/5"]),children:e.children})}var Ze=require("react/jsx-runtime");function Cr(e){let t=ln(e.field),n=b(e.field),r=cn(e.field);return e.horizontal?(0,Ze.jsx)(vr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children}):(0,Ze.jsx)(hr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children})}function Sr(e){if(!e.field.type)return null;let t=Cn(e.field,e.disabled,{lang:e.lang,translations:e.translations}),n=_n(e.field),r=Mn(e.field,e.errors),o=!!e.field.disabled===t.disabled?e.field:{...e.field,disabled:t.disabled};return e.children({ariaAttributes:r,commonProps:t,dataAttributes:n,field:o,horizontal:e.horizontal,readOnly:e.readOnly})}var Nr=require("tailwind-merge"),z=require("react/jsx-runtime");function wr(e){let t=e.field.advanced?.cols,n=e.field.name?e.errors?.[e.field.name]:void 0,{horizontal:r=!1}=ge(e.style,{horizontal:sn(e.field)}),o=dn(e.field,e.disabled),i=un(e.field,e.disabled);return(0,z.jsxs)("div",{className:(0,Nr.twMerge)("flex flex-col gap-3",Hn(t)),children:[(0,z.jsx)(Cr,{disabled:o,errors:n,field:e.field,horizontal:r,children:(0,z.jsx)(Sr,{disabled:o,errors:n,field:e.field,horizontal:r,lang:e.lang,readOnly:i,translations:e.translations,children:e.children})}),(0,z.jsx)(yr,{errors:n,name:e.field.name})]})}var Ae=require("tailwind-merge");var c=require("react/jsx-runtime");function Ir(e){let t=e.isMultiField||e.collapsed!=null,[n,r,o]=_(t?!e.collapsed:!0);function i(){e.canRemove&&e.onRemove&&e.onRemove(e.index)}let l=p=>$(ce(p,e.translations),{index:e.index+1,label:e.label}),a=e.canRemove&&e.onRemove!=null&&(0,c.jsx)("button",{"aria-label":l("Remove {label} item {index}"),className:(0,Ae.twMerge)("flex size-6 items-center justify-center rounded text-xl leading-none text-zinc-400","transition-colors duration-150","hover:text-red-500","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500 dark:hover:text-red-400"),onClick:i,type:"button",children:(0,c.jsx)("span",{"aria-hidden":"true",className:"leading-none",children:"\xD7"})}),s=(0,c.jsxs)("div",{className:"flex min-w-0 flex-col font-medium text-zinc-700 dark:text-zinc-400",children:[(0,c.jsx)("span",{className:"text-base",children:e.previewLabel??(0,c.jsxs)(c.Fragment,{children:[e.label," ",e.index+1]})}),!n&&e.previewTags&&(0,c.jsx)("div",{className:"flex items-center gap-2 overflow-hidden text-xs font-normal text-ellipsis whitespace-nowrap text-zinc-500 dark:text-zinc-500",children:e.previewTags})]}),f=(0,c.jsxs)("div",{className:(0,Ae.twMerge)("flex items-center justify-between gap-2",e.isMultiField&&n&&"mb-3"),children:[t?(0,c.jsxs)("div",{className:"flex min-w-0 grow items-center gap-2",children:[(0,c.jsxs)("button",{"aria-expanded":n,"aria-label":l(n?"Collapse {label} {index}":"Expand {label} {index}"),className:(0,Ae.twMerge)("group flex grow items-center gap-2 rounded p-1 text-left text-zinc-400","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500"),onClick:r,type:"button",children:[(0,c.jsx)(L,{expanded:n}),s]}),!n&&e.previewBadge&&(0,c.jsx)("div",{className:"ml-auto shrink-0",children:e.previewBadge})]}):s,a]});return e.isMultiField?(0,c.jsxs)("div",{"data-slot":"list-item-card",className:"box-border w-full min-w-0 rounded-lg border border-zinc-100 p-4 dark:border-zinc-900",children:[f,(0,c.jsx)(H,{onReveal:o,visible:n,children:(0,c.jsx)(S,{children:e.children})})]}):t?(0,c.jsxs)("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[f,(0,c.jsx)(H,{onReveal:o,visible:n,children:(0,c.jsx)(S,{children:e.children})})]}):(0,c.jsxs)("div",{className:"box-border flex w-full min-w-0 items-start gap-2",children:[(0,c.jsx)("div",{className:"flex min-w-0 grow flex-col",children:(0,c.jsx)(S,{children:e.children})}),a&&(0,c.jsx)("div",{className:"shrink-0",children:a})]})}var Er=require("react/jsx-runtime");function kr(e){let t=R($n(e.field),e.translations),n=Gn(e.field);return Un(e.field,e.value).map(r=>(0,Er.jsx)(Ir,{collapsed:e.field.advanced?.collapsed,index:r,isMultiField:n,label:t,translations:e.translations,children:e.children(r)},r))}var Or=require("react/jsx-runtime");function Lr(e){let t=Array.isArray(e.field.fields)&&e.field.fields.length===0,n=M(e.field.label,e.translations),r=M(e.field.description,e.translations);return(0,Or.jsx)(pe,{description:r,empty:t,id:e.field.name,title:n,children:e.children})}var qe=require("react/jsx-runtime");function Dr({children:e,field:t,lang:n,translations:r,value:o}){return(0,qe.jsx)(Lr,{field:t,translations:r,children:(0,qe.jsx)(kr,{field:t,lang:n,translations:r,value:o,children:e})})}var Pr=require("tailwind-merge");var j=require("react/jsx-runtime");function Mr(e){let t=Bn(e.column?.advanced?.cols);return(0,j.jsxs)("div",{className:"flex w-full flex-col gap-4",children:[(0,j.jsx)("div",{"data-slot":"column",className:(0,Pr.twMerge)("grid grid-cols-1 gap-3 sm:gap-4",t),children:e.children}),e.column?.description&&(0,j.jsx)(be,{config:e.config,context:e.context,text:e.column.description,translations:e.translations})]})}var Br=require("react");var _r=require("react"),zr=require("react/jsx-runtime");function Vr(e){let{fields:t,name:n}=e.field,{index:r}=e,o=(0,_r.useMemo)(()=>Array.isArray(t)?t.map(i=>se(i)||ae(i)?{...i,name:`${n}.${r}.${i.name}`}:P(i)?{...i,fields:i.fields.map(l=>({...l,name:`${n}.${r}.${l.name}`}))}:i):[],[r,n,t]);return(0,zr.jsx)(ee,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,fields:o,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})}var N=require("react/jsx-runtime");function ee(e){let{field:t,list:n}=e.components;return me(e.fields).map((r,o)=>(0,N.jsxs)(Br.Fragment,{children:[P(r)&&(0,N.jsx)(Mr,{column:r,config:e.config,context:e.context,translations:e.translations,children:(0,N.jsx)(ee,{...e,fields:r.fields})}),se(r)&&(0,N.jsx)(t,{disabled:e.disabled,field:r,lang:e.lang,style:e.style,translations:e.translations,children:e.children}),ae(r)&&(0,N.jsx)(n,{field:r,lang:e.lang,onValueChange:e.onValueChange,translations:e.translations,value:e.value,children:i=>(0,N.jsx)(Vr,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,field:r,index:i,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})})]},o))}var Gr=require("react/jsx-runtime");function Hr(e){return n=>(0,Gr.jsx)(ee,{...n,components:e})}var Ur=Hr({field:wr,list:Dr});var ve=require("react/jsx-runtime");function Fe(e){let t=Fn(e.lang,e.translations);return(0,ve.jsx)(rr,{advanced:e.advanced,config:e.config,control:e.children,definition:e.definition,readOnly:e.readOnly,sections:e.sections,translations:t,children:({disabled:n,fields:r})=>(0,ve.jsx)(Ur,{config:e.config,context:e.context,disabled:n,fields:r,lang:e.lang,style:e.config.style,translations:t,value:e.value,children:o=>(0,ve.jsx)(mr,{...o,config:e.config,context:e.context,translations:t,value:e.value})})})}var $r=require("react");var Je=require("react/jsx-runtime");function Yr(e){return(0,Je.jsx)($r.Suspense,{fallback:(0,Je.jsx)(Fe,{config:e.config,sections:e.sections,readOnly:!0}),children:e.children})}
|
package/dist/server/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as Rr}from"react/jsx-runtime";function ke(e){let t=typeof e.children=="function"?e.children({isPending:e.isPending}):e.children;return Rr("div",{"data-slot":"field-control",className:"w-full",children:t})}import{jsx as Le}from"react/jsx-runtime";function C(e){return Le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`size-4 transition-transform duration-200 ${e.expanded?"rotate-90":""}`,children:Le("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})})}import{Activity as Tr}from"react";import{createContext as hr}from"react";var Ee=hr(!1);import{jsx as Oe}from"react/jsx-runtime";function I({children:e,visible:t}){return Oe(Tr,{mode:t?"visible":"hidden",children:Oe(Ee,{value:!0,children:e})})}var H="input",De="input/date",Pe="input/email",Me="input/number",_e="input/time";var ze="textarea",Ve="radio",Be="checkbox",ae="list",He="select",Ge="select/active",Ue="select/day",$e="select/month",Ye="select/timezone",Xe="select/year";var Ke="chips",We="chips/day",Ze="chips/month",k="column",qe="description",se="fields",Je="label",ce="value",G="options",de="email",Qe="number",je="password",et="tel",L="text",tt="aria-errormessage",nt="aria-invalid",rt="data-invalid",ot="data-readonly",it="aria",lt="data",at="max",st="maxLength",ct="min",dt="minLength",S="$ref";var ut="type",ft={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};import{format as Fr,formatDistanceToNow as gt,formatDuration as Cr,intervalToDuration as Sr,isValid as U,parseISO as Nr}from"date-fns";import{enUS as pt,es as ue}from"date-fns/locale";function u(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function p(e){return c(e)||typeof e=="number"||Ar(e)}function mt(e){return Array.isArray(e)&&e.every(p)}function c(e){return typeof e=="string"}function Ar(e){return typeof e=="boolean"}var yt={en:pt,"en-US":pt,es:ue,"es-ES":ue,"es-MX":ue},vr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},wr={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function xt(e){if(e)return yt[e]??yt[e.split("-")[0]]}function $(e){if(typeof e=="number"&&!Number.isNaN(e))return e;if(c(e)&&e.trim()!==""){let t=Number(e);return Number.isNaN(t)?null:t}return null}function bt(e,t,n){let r=wr[t];if(r===void 0)return String(e);let o=e*r,i=Sr({start:0,end:o});return Cr(i,{locale:n})}function Rt(e){if(e instanceof Date)return U(e)?e:null;if(c(e)){let t=Nr(e);if(U(t))return t;let n=new Date(e);return U(n)?n:null}if(typeof e=="number"){let t=new Date(e);return U(t)?t:null}return null}var Ir={currency:(e,t,n)=>{let r=$(e);if(r===null)return String(e);let o=t[0]??"USD";return new Intl.NumberFormat(n.locale,{style:"currency",currency:o}).format(r)},percent:(e,t,n)=>{let r=$(e);return r===null?String(e):new Intl.NumberFormat(n.locale,{style:"percent"}).format(r)},number:(e,t,n)=>{let r=$(e);return r===null?String(e):new Intl.NumberFormat(n.locale).format(r)},date:(e,t,n)=>{let r=Rt(e);if(!r)return String(e);let o=t[0]??"short",i=xt(n.locale);if(o==="relative")return gt(r,{addSuffix:!0,locale:i});let l=vr[o]??o;return Fr(r,l,{locale:i})},duration:(e,t,n)=>{let r=xt(n.locale);if(typeof e=="number")return bt(e,t[0]??"ms",r);if(c(e)){let i=$(e);if(i!==null)return bt(i,t[0]??"ms",r)}let o=Rt(e);return o?gt(o,{addSuffix:!0,locale:r}):String(e)}};function ht(e,t,n){let r=t.split(":").map(a=>a.trim()).filter(a=>a.length>0);if(r.length===0)return;let[o,...i]=r,l=Ir[o];if(l)return l(e,i,n)}function Tt(e,t=ce){if(e!=null){if(mt(e)||p(e))return e;if(u(e)){let n=kr(e,t);if(p(n))return n}}}function kr(e,t){let n=y(e,t);if(p(n))return n}function y(e,t){if(!t||!u(e))return null;let n=t.split(".").filter(o=>o!=="");if(n.length===0)return null;let r=e;for(let o of n)if(u(r)&&o in r)r=r[o];else if(Array.isArray(r)){let i=Number(o);if(!Number.isInteger(i)||i<0||i>=r.length)return null;r=r[i]}else return null;return r}function At(e,t={description:qe,label:Je,value:ce}){return e.map(n=>{if(u(n)){let r=y(n,t.label),o=y(n,t.value);if(p(r)&&p(o)){let i=y(n,t.description);return{label:`${r}`,value:`${o}`,...p(i)&&{description:`${i}`}}}}return n})}function Ft(e=L){let t=e.lastIndexOf("/"),n=t===-1?e:e.slice(t+1);return n&&n!==H?n.trim().toLowerCase():L}var Lr=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g,Er=/{([^}]{1,200})}/,Or=/{([^}]{1,200})}/g;function E(e,t={},n={}){if(c(e))return Pr(e,t,n);if(Array.isArray(e))return e.map(r=>E(r,t,n));if(u(e)){let r={};for(let o in e)r[o]=E(e[o],t,n);return r}return e}function O(e,t={},n={}){return fe(e)?E(e,t,n):e}function fe(e){return c(e)?Er.test(e):Array.isArray(e)?e.some(t=>fe(t)):u(e)?Object.values(e).some(t=>fe(t)):!1}function Dr(e,t){return t.includes(".")?y(e,t):e[t]}function Pr(e,t={},n={}){return e.replace(Or,(r,o)=>{let i=String(o).split("|").map(m=>m.trim()),[l,...a]=i;if(!l)return r;let s=Dr(t,l);if(a.length===0)return p(s)?String(s):r;if(s==null)return r;let d=s;for(let m of a){let B=ht(d,m,{locale:n.locale});if(B===void 0)return r;d=B}return String(d)})}function Ct(e,t){if(!c(e)||!e||e.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=Lr.exec(e))!==null;){let[l,a,s]=n,d=n.index;o=!0,d>r&&i.push(e.substring(r,d));let m=t?t(d,s,a):l;i.push(m),r=d+l.length}return o?(r<e.length&&i.push(e.substring(r)),i):e}var St=e=>f(Ge)(e),Nt=e=>f(Ue)(e),vt=e=>f($e)(e),wt=e=>f(Xe)(e),It=e=>f(Ye)(e),kt=e=>f(We)(e),Lt=e=>f(Ze)(e),Et=f(De),me=f(_e),x=f(Be),N=f(Ke),F=f(Ve),Ot=f(H),h=f(He),Dt=f(ze),Pt=f(L,de,je,et),Ii=f(Pe,de),Mt=f(Me,Qe);function _t(e){return F(e)||x(e)}function Y(e){return e.type===ae}function v(e){return e.type===k}function X(e){return e.type!==k&&e.type!==ae}function ge(e){return h(e)||F(e)||N(e)}function D(e){return e!=null&&e!==""}function f(...e){return t=>{let n=c(t.type)?t.type:void 0;return n?e.some(r=>n===r||n?.startsWith(`${r}/`)):!1}}function zt(e,t={}){if(h(e)&&e.disabled){let n=e.name?t?.[e.name]:void 0;if(n&&u(n))return[n]}}function Vt(e){return F(e)||x(e)?!0:e.advanced?.horizontal}function Bt(e){return x(e)?e.advanced?.reverse!==!1:!1}function Ht(e,t){let n=e.readonly??!1;return t||n}function pe(e){if(Mr(e)){let t=e.source;if(Array.isArray(t)||u(t)&&!(S in t))return t}}function Gt(e){return Array.isArray(pe(e))}function Mr(e){return F(e)||N(e)||h(e)&&!e.disabled}import{isValid as Yt,parse as Xt,format as Kt}from"date-fns";var _r=/^\d+$/,Wt=new Date(2e3,0,1),zr=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[],ye="default";function Zt(e){if(!e)return ye;try{return Intl.getCanonicalLocales(e)[0]??ye}catch{return ye}}function xe(e){let t=Zt(e);return Array.from({length:12},(n,r)=>({value:(r+1).toString(),label:new Date(0,r).toLocaleString(t,{month:"long"})}))}function be(e){let t=Zt(e);return Array.from({length:7},(n,r)=>({value:r.toString(),label:new Date(2e3,0,2+r).toLocaleString(t,{weekday:"long"})}))}function qt(e,t){return t>=e?Array.from({length:t-e+1},(n,r)=>{let o=e+r;return{value:o.toString(),label:o.toString()}}):[]}function Re(){return new Date().getFullYear()}function Vr(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function Br(e){let t=e.indexOf("/"),n=t===-1?e:e.slice(0,t);return ft[n]??"Other"}function Hr(e,t){return(e.find(r=>r.type==="timeZoneName")?.value??t).replace(/\s+(?:Standard|Daylight(?: Saving)?|Summer|Winter)\s+Time$/,"")}function Ut(e,t){let n=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t),r=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"long"}).formatToParts(t),i=(n.find(a=>a.type==="timeZoneName")?.value??"GMT+00:00").replace("GMT","UTC"),l=Hr(r,e);return{offset:i,longName:l}}function $t(e){return e.slice(e.lastIndexOf("/")+1).replace(/_/g," ")}function Jt(){let e=new Date,t=Vr(),n=new Map,r=$t(t),{offset:o,longName:i}=Ut(t,e),l={value:t,label:`${r} - ${i} (${o})`};for(let s of zr()){if(s===t)continue;let d=$t(s),{offset:m,longName:B}=Ut(s,e),we={value:s,label:`${d} - ${B} (${m})`},le=Br(s);if(le==="Other")continue;let Ie=n.get(le);Ie?Ie.push(we):n.set(le,[we])}for(let s of n.values())s.sort((d,m)=>d.label.localeCompare(m.label));let a=Array.from(n.entries()).sort(([s],[d])=>s.localeCompare(d)).map(([s,d])=>({label:s,items:d}));return[{label:"Suggested",items:[l]},...a]}function he(e,t){if(typeof e=="number")return e;let n=t??Re(),r=e.trim().toLowerCase();if(r.startsWith("current")){let o=r.match(/^current([+-])(\d+)$/);if(o){let[,i,l]=o,a=parseInt(l,10);if(!isNaN(a))return i==="+"?n+a:n-a}return n}return _r.test(r)?parseInt(r,10):n}function Qt(e,t){if(!e)return"";try{let n=Xt(e,t,Wt);return Yt(n)?Kt(n,"yyyy-MM-dd"):""}catch{return""}}function jt(e,t){if(!e)return"";try{let n=Xt(e,t,Wt);return Yt(n)?Kt(n,"HH:mm:ss"):""}catch{return""}}function Te(e){return e.advanced?.format??"HH:mm"}function en(e){return e.advanced?.format??"MMMM d, yyyy"}var Gr={es:{"(Optional)":"(Opcional)","Add item":"A\xF1adir elemento","An unexpected error occurred submitting the form.":"Ocurri\xF3 un error inesperado al enviar el formulario.","Collapse {label} {index}":"Contraer {label} {index}","Expand {label} {index}":"Expandir {label} {index}","Please correct the errors and try again.":"Corrige los errores e int\xE9ntalo de nuevo.","Remove {label} item {index}":"Eliminar {label} {index}","There were validation errors submitting the form.":"Se encontraron errores de validaci\xF3n al enviar el formulario.","Unknown error":"Error desconocido",No:"No",Yes:"S\xED"}};function K(e,t){return b(e,t)}function nn(e,t){let n=t?.[e??""],r=e?Gr[Ur(e)]:void 0;return r?n?{...r,...n}:r:n}function Ur(e){return e.toLowerCase().split(/[-_]/)[0]}function b(e,t){return e?t?t[e]??e:e:""}function w(e,t){return e?b(e,t):void 0}function W(e,t){if(!t)return e;let n=!1,r=e.map(o=>{let i=$r(o,t);return i!==o&&(n=!0),i});return n?r:e}function $r(e,t){if(!u(e))return e;let n=tn(e.label,t),r=e.items;if(Array.isArray(r)){let i=W(r,t);return i===r&&n===e.label?e:{...e,...n!==void 0&&{label:n},items:i}}let o=tn(e.description,t);return n===e.label&&o===e.description?e:{...e,...n!==void 0&&{label:n},...o!==void 0&&{description:o}}}function tn(e,t){return c(e)?b(e,t):e}var Z=Re();function Yr(e,t){if(N(e))return Xr(e,t?.lang)}function Xr(e,t){if(kt(e))return be(t);if(Lt(e))return xe(t)}function Kr(e,t){if(h(e))return Wr(e,t)}function Wr(e,t){let{lang:n,translations:r}=t??{};if(Nt(e))return be(n);if(vt(e))return xe(n);if(wt(e)){let o=e.advanced?.length?.min??Z,i=e.advanced?.length?.max??Z+5;return qt(he(o,Z),he(i,Z))}if(It(e))return Jt();if(St(e))return W([{value:"true",label:"Yes"},{value:"false",label:"No"}],r)}function rn(e,t=!1,n){let r={disabled:t,id:e.name,name:e.name,placeholder:e.placeholder,required:e.required};return Ot(e)?{...r,...Zr(e)}:h(e)?{...r,...on(Kr(e,n))}:Dt(e)?{...r,...Jr(e)}:N(e)?{...r,...qr(e,n)}:r}function Zr(e){let t=Ft(e.type),n={...e,type:t};return{...jr(e),...ln(e),...Qr(n),...Pt(n)?an(n):{},type:t}}function on(e){return e?{options:e}:{}}function qr(e,t){let n=on(Yr(e,t)),r=e.advanced?.multiple??!0;return{...n,multiple:r}}function Jr(e){return{...ln(e),...an(e)}}function ln(e){let t=e.advanced?.autocomplete;return t?{autoComplete:t}:{}}function Qr(e){return Mt(e)?eo(e):{}}function jr(e){if(me(e)){let t=Te(e);return{step:t==="HH:mm:ss"||t==="hh:mm:ss a"?"1":"60"}}return{}}function an(e){return sn(e,{min:dt,max:st})}function eo(e){return sn(e,{min:ct,max:at})}function sn(e,t){let n={},r=e.advanced?.length;return r&&(r.min!==void 0&&(n[t.min]=r.min),r.max!==void 0&&(n[t.max]=r.max)),n}function cn(e,t){let n=pe(e);return n||zt(e,t)}function to(e,t){let n=u(t)&&e.name in t?t[e.name]:t,r=Tt(n,e.advanced?.entity),o=D(r)?r:e.defaultValue;return me(e)&&D(o)?no(e,o):Et(e)&&D(o)?lo(e,o):o}function no(e,t){let n=Te(e);return c(t)?jt(t,n):t}function ro(e,t,n){return ge(e)&&Array.isArray(n)?{...t,[G]:n}:t}function oo(e,t,n){if(e.required&&!D(n)&&h(e)&&e.advanced?.preselected!==!1&&G in t){let r=t[G];if(Array.isArray(r)&&r.length===1)return r[0]}return n}function io(e,t,n){if(ge(e)&&Array.isArray(t)){let r=At(t,e.advanced?.options);return Gt(e)?W(r,n):r}return t}function dn(e,t,n,r,o){let i=to(e,r),l=Array.isArray(n)?io(e,n,o):n,a=ro(e,t,l),s=oo(e,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function un(e,t){return x(e)?{defaultChecked:!!t}:{defaultValue:t}}function lo(e,t){let n=en(e);return c(t)?Qt(t,n):t}var ao=/^#\/definition\//;function J(e=[],t){let n=q(e,t);return Array.isArray(n)?n.filter(co).sort((r,o)=>fn(r)-fn(o)):[]}function q(e,t,n=new Map,r=new WeakSet){if(!so(t)||!e||typeof e!="object")return e;if(n.has(e))return n.get(e);if(r.has(e))return e;if(r.add(e),Array.isArray(e))return e.map(i=>q(i,t,n,r));if(S in e&&c(e[S])){let i=e[S].replace(ao,""),l=y(t,i);return l!==null?q(l,t,n,r):e}let o={};for(let[i,l]of Object.entries(e))o[i]=q(l,t,n,r);return r.delete(e),n.set(e,o),o}function mn(e){return Object.entries(e??{})}function fn(e){return e.order??Number.MAX_VALUE}function so(e){return e!==void 0&&u(e)&&Object.keys(e).length>0}function co(e){return ut in e?!0:Array.isArray(e[se])?e[se].length>0:!0}function gn(e,t){let n={};for(let[r,o]of mn(t))n[`${e}-${r}`]=o;return n}function uo(e){return gn(it,e)}function fo(e){return gn(lt,e)}function pn(e,t){let n=uo(e.advanced?.aria);return t&&t.length>0&&(n[nt]="true",n[tt]=`${e.name}-error`),n}function yn(e){return fo(e.advanced?.data)}var xn={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},bn={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function Rn(e,t=2){return xn[e&&e in xn?e:t]}function hn(e){if(e&&e in bn)return bn[e]}function mo(e){return{min:e.advanced?.length?.min??1,max:e.advanced?.length?.max??1/0}}function go(e,t){let n=t?y(t,e.name):null;return po(e,Array.isArray(n)?n.length:0)}function Tn(e){return!Array.isArray(e.fields)||e.fields.length===0?!1:e.fields.length>1||e.fields[0].type===k}function An(e,t){let n=go(e,t);return Array.from({length:n},(r,o)=>o)}function Fn(e){return e.advanced?.title??e.label??e.name}function po(e,t){let{min:n,max:r}=mo(e);return Math.min(Math.max(t,n),r)}function Q(e,t){let n={...e};for(let r of Object.keys(t??{})){let o=t?.[r];o!==void 0&&(n[r]=o)}return n}import{jsx as yo}from"react/jsx-runtime";function R(e){return Ct(e,(t,n,r)=>yo("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${t}`))}import{useCallback as xo,useState as bo}from"react";import{jsx as P,jsxs as Ae}from"react/jsx-runtime";function Cn(e){let{fields:t=[]}=e.section,[n,r]=bo(!1),o=xo(()=>r(i=>!i),[]);return Ae("fieldset",{"data-slot":"field-set","data-advanced":"true","data-expanded":n,"data-empty":t.length===0,className:"flex flex-col",id:e.section.id?.toString(),children:[P("legend",{children:Ae("button",{className:"flex cursor-pointer items-center gap-2 text-base font-medium text-zinc-600 dark:text-zinc-400",onClick:o,type:"button",children:[P(C,{expanded:n}),P("span",{children:R(e.title)})]})}),P(I,{visible:n,children:Ae("div",{className:"mt-3 ml-1.5 flex flex-col gap-4 border-l-2 border-zinc-300 pl-4 dark:border-zinc-600","data-slot":"field-set-content",children:[e.description&&P("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:R(e.description)}),e.group]})})]})}import{jsx as j,jsxs as Sn}from"react/jsx-runtime";function Nn(e){let t=Sn("div",{className:"flex flex-col",children:[e.title&&j("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:R(e.title)}),e.description&&j("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:R(e.description)})]});return e.step?Sn("div",{className:"flex flex-row items-start gap-4",children:[j("div",{className:"bg-primary text-primary-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:j("span",{className:"text-sm font-bold",children:e.step})}),t]}):t}import{jsx as vn,jsxs as Ro}from"react/jsx-runtime";function ee(e){return Ro("fieldset",{className:"flex w-full min-w-0 flex-col data-[empty=false]:gap-6","data-empty":e.empty,"data-slot":"field-set",id:e.id,children:[vn(Nn,{description:e.description,step:e.step,title:e.title}),vn("div",{className:"w-full min-w-0",children:e.children})]})}import{jsx as ho}from"react/jsx-runtime";function T(e){return ho("div",{"data-slot":"field-group","data-compact":e.compact,className:"flex w-full flex-col gap-8 data-[compact=true]:gap-3",children:e.children})}import{jsx as Fe}from"react/jsx-runtime";function wn(e){let{fields:t=[]}=e.section,n=e.advanced?.step?e.step:void 0,{compact:r}=Q(e.style,{compact:e.section.advanced?.compact}),o=Fe(T,{compact:r,children:e.children});if(!e.section.title&&!e.section.description)return o;let i=w(e.section.title,e.translations),l=w(e.section.description,e.translations);return e.section.advanced?.collapsible?Fe(Cn,{description:l,group:o,section:e.section,title:i}):Fe(ee,{description:l,empty:t.length===0,id:e.section.id?.toString(),step:n,title:i,children:o})}import{jsx as In}from"react/jsx-runtime";function kn(){return In("div",{"data-slot":"field-separator",className:"relative -my-2 h-5 text-sm",children:In("div",{className:"absolute inset-0 top-1/2 h-px w-full bg-zinc-200 dark:bg-zinc-800"})})}import{useAtomValue as vo}from"jotai";import{atom as M}from"jotai";import{atomFamily as To}from"jotai-family";import{deepEqual as Ln}from"fast-equals";function Ao(e,t){let{[t]:n,...r}=e;return r}function Fo(e){return To(t=>M(n=>n(e)[t]??void 0,(n,r,o)=>{let i=n(e);if(o!=null){let l=i[t];Ln(l,o)||r(e,{...i,[t]:o})}else t in i&&r(e,Ao(i,t))}))}function Co(e){return M(null,(t,n)=>{let r=t(e);r&&Object.keys(r).length>0&&n(e,{})})}function So(e){return M(null,(t,n,r)=>{let i={...t(e)},l=!1;for(let a of r)a in i&&(delete i[a],l=!0);l&&n(e,i)})}function No(e){return M(null,(t,n,r)=>{let o=t(e);Ln(o,r)||n(e,r)})}function te(e={}){let t=M(e);return{atom:t,clearAll:Co(t),clear:So(t),bulkReport:No(t),report:Fo(t)}}var En=te(),On=En.atom,Dn=En.report;function wo(e,t){return e.fields.every(n=>Pn(n,t))}function Pn(e,t){return t[e.name]?.hidden??e.hidden??!1}function Io(e,t){return v(e)?wo(e,t):Pn(e,t)}function Mn(e){let t=vo(On);return e.container&&(t[e.container.name]?.hidden??e.container.hidden??!1)||e.fields.length===0||e.fields.every(r=>Io(r,t))?null:e.children}import{jsx as _,jsxs as _n}from"react/jsx-runtime";function zn(e){let t=J(e.sections,e.definition);return _("div",{className:"h-full w-full",children:_("form",{noValidate:e.noValidate,action:e.action,children:_n(T,{children:[t.map((n,r)=>_n(Mn,{fields:n.fields??[],children:[_(wn,{advanced:e.advanced,section:n,step:r+1,style:e.config.style,translations:e.translations,children:e.children({disabled:e.readOnly,fields:n.fields})}),n.advanced?.separator&&_(kn,{})]},`key-${n.id}-${r}`)),e.control&&_(ke,{isPending:e.isPending,children:e.control})]})})})}import{jsx as ko}from"react/jsx-runtime";function Vn(e){return ko("p",{className:"-mt-2 text-xs leading-normal font-normal text-zinc-600 dark:text-zinc-400 [[data-slot=column]_&]:md:line-clamp-2",title:e.title,children:e.children})}import{useState as Lo}from"react";import{jsx as Bn,jsxs as Hn}from"react/jsx-runtime";function ne(e){let t={context:e.context,env:e.config?.env,value:e.value},r={locale:e.config?.env?.locale},[o,i]=Lo(()=>u(e.text)&&"collapsed"in e.text?!e.text.collapsed:!0),l=()=>i(m=>!m),a=u(e.text)&&c(e.text.title)?R(b(O(e.text.title,t,r),e.translations)):void 0,s=b(O(c(e.text)?e.text:e.text?.message,t,r),e.translations),d=R(s);return d?Hn("div",{className:"flex flex-col gap-2",children:[a&&Hn("button",{className:"flex items-center gap-1 text-left text-xs font-medium text-zinc-700 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-zinc-100",onClick:l,type:"button",children:[a,Bn(C,{expanded:o})]}),o&&Bn(Vn,{title:s,children:d})]}):null}import{atom as Gn}from"jotai";var re=te(),aa=re.atom,sa=re.clearAll,ca=re.clear,Un=re.report,da=Gn({}),ua=Gn(null);import{useAtomValue as $n}from"jotai";import{jsx as Eo}from"react/jsx-runtime";function oe(e){let t=$n(Un(e.field.name)),r=$n(Dn(e.field.name))?.description??e.field.description;return Eo(ne,{config:e.config,context:e.context,text:r,translations:e.translations,value:t})}import{twMerge as Oo}from"tailwind-merge";import{jsx as Yn,jsxs as Do}from"react/jsx-runtime";function Xn(e){let t=e.style?.showOptionalLabel??!0,n=F(e.field)||x(e.field);return Do("label",{"data-slot":"field-label","data-normal":n,className:Oo("flex w-fit items-center text-sm leading-snug font-medium select-none","data-[normal=true]:font-normal [[data-slot=column]_&]:md:w-full","group-data-[readonly=true]:cursor-not-allowed group-data-[readonly=true]:opacity-50"),htmlFor:e.field.name,title:c(e.children)?e.children:void 0,children:[Yn("span",{className:"[[data-slot=column]_&]:md:truncate",children:e.children}),t&&!e.field.required&&Yn("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:K("(Optional)",e.translations)})]})}import{jsx as Kn,jsxs as Po}from"react/jsx-runtime";function Wn(e){let t={context:e.context,env:e.config?.env},n=e.config?.env?.locale,r=O(e.field.label,t,{locale:n});return Po("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[Kn(Xn,{field:e.field,style:e.config?.style,translations:e.translations,children:b(r,e.translations)}),e.horizontal===!0&&Kn(oe,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}import{Fragment as Mo,jsx as Zn,jsxs as _o}from"react/jsx-runtime";function qn(e){return _o(Mo,{children:[e.field.name&&e.field.label&&Zn(Wn,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&Zn(oe,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}function Jn(e,t){return e?t(e):null}import{jsx as Qn}from"react/jsx-runtime";function jn(e){let t=cn(e.field,e.value),{commonPropsWithOptions:n,defaultValue:r}=dn(e.field,e.commonProps,t,e.value,e.translations),o=un(e.field,r);return Jn(e.config.inputs[e.field.type],i=>Qn(qn,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:Qn(i,{...e.ariaAttributes,...n,...e.dataAttributes,...o})}))}import{jsx as er}from"react/jsx-runtime";function tr(e){return!e.errors||e.errors.length===0?null:er("ul",{className:"text-sm text-red-600 dark:text-red-500",id:e.name?`${e.name}-error`:void 0,children:e.errors?.map((t,n)=>er("li",{children:t},e.name?`${e.name}-error-${n}`:n))})}import{twMerge as zo}from"tailwind-merge";import{jsx as Vo}from"react/jsx-runtime";function ie(e){let t=e.errors&&e.errors.length>0;return Vo("div",{"data-slot":"field","data-clickable":e.isClickable?"true":"false",...t&&{[rt]:"true"},...e.disabled&&{[ot]:"true"},"data-orientation":e.orientation,className:zo("group flex w-full flex-col items-center data-[invalid=true]:text-red-600 data-[invalid=true]:dark:text-red-500","data-[clickable=true]:items-start",e.isCheckbox&&(e.isReversed?"flex-row-reverse!":"flex-row!"),"data-[clickable=true]:has-[>[data-slot=field-content]]:[&>:first-child]:mt-px",e.className),children:e.children})}import{twMerge as Bo}from"tailwind-merge";import{jsx as Ho}from"react/jsx-runtime";function nr(e){return Ho(ie,{...e,orientation:"vertical",className:Bo("gap-3 has-[>[data-slot=field-content]]:items-start",!e.isClickable&&"[&>*]:w-full"),children:e.children})}import{twMerge as Go}from"tailwind-merge";import{jsx as Uo}from"react/jsx-runtime";function rr(e){return Uo(ie,{...e,orientation:"horizontal",className:Go("gap-2 md:flex-row md:gap-4","[&>[data-slot=field-content]]:min-w-0 [&>[data-slot=field-content]]:flex-grow [&>[data-slot=field-content]]:self-start","[&_[role=checkbox]]:mt-[1.5px]",e.isClickable&&"md:flex-col",!e.isClickable&&["md:justify-between","[&>*:not([data-slot=field-content])]:w-full","[&>*:not([data-slot=field-content])]:md:w-1/2","[&>*:not([data-slot=field-content])]:xl:w-2/5"]),children:e.children})}import{jsx as or}from"react/jsx-runtime";function ir(e){let t=_t(e.field),n=x(e.field),r=Bt(e.field);return e.horizontal?or(rr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children}):or(nr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children})}function lr(e){if(!e.field.type)return null;let t=rn(e.field,e.disabled,{lang:e.lang,translations:e.translations}),n=yn(e.field),r=pn(e.field,e.errors),o={...e.field,disabled:t.disabled};return e.children({ariaAttributes:r,commonProps:t,dataAttributes:n,field:o,horizontal:e.horizontal})}import{twMerge as $o}from"tailwind-merge";import{jsx as Ce,jsxs as Yo}from"react/jsx-runtime";function ar(e){let t=e.field.advanced?.cols,n=e.field.name?e.errors?.[e.field.name]:void 0,{horizontal:r=!1}=Q(e.style,{horizontal:Vt(e.field)}),o=Ht(e.field,e.disabled);return Yo("div",{className:$o("flex flex-col gap-3",hn(t)),children:[Ce(ir,{disabled:o,errors:n,field:e.field,horizontal:r,children:Ce(lr,{disabled:o,errors:n,field:e.field,horizontal:r,lang:e.lang,translations:e.translations,children:e.children})}),Ce(tr,{errors:n,name:e.field.name})]})}import{twMerge as Se}from"tailwind-merge";import{useState as Xo}from"react";import{Fragment as Ko,jsx as g,jsxs as A}from"react/jsx-runtime";function sr(e){let t=e.isMultiField||e.collapsed!=null,[n,r]=Xo(t?!e.collapsed:!0);function o(){e.canRemove&&e.onRemove&&e.onRemove(e.index)}function i(){r(m=>!m)}let l=m=>E(K(m,e.translations),{index:e.index+1,label:e.label}),a=e.canRemove&&e.onRemove!=null&&g("button",{"aria-label":l("Remove {label} item {index}"),className:Se("flex size-6 items-center justify-center rounded text-xl leading-none text-zinc-400","transition-colors duration-150","hover:text-red-500","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500 dark:hover:text-red-400"),onClick:o,type:"button",children:g("span",{"aria-hidden":"true",className:"leading-none",children:"\xD7"})}),s=A("div",{className:"flex min-w-0 flex-col font-medium text-zinc-700 dark:text-zinc-400",children:[g("span",{className:"text-base",children:e.previewLabel??A(Ko,{children:[e.label," ",e.index+1]})}),!n&&e.previewTags&&g("div",{className:"flex items-center gap-2 overflow-hidden text-xs font-normal text-ellipsis whitespace-nowrap text-zinc-500 dark:text-zinc-500",children:e.previewTags})]}),d=A("div",{className:Se("flex items-center justify-between gap-2",e.isMultiField&&n&&"mb-3"),children:[t?A("div",{className:"flex min-w-0 grow items-center gap-2",children:[A("button",{"aria-expanded":n,"aria-label":l(n?"Collapse {label} {index}":"Expand {label} {index}"),className:Se("group flex grow items-center gap-2 rounded p-1 text-left text-zinc-400","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500"),onClick:i,type:"button",children:[g(C,{expanded:n}),s]}),!n&&e.previewBadge&&g("div",{className:"ml-auto shrink-0",children:e.previewBadge})]}):s,a]});return e.isMultiField?A("div",{"data-slot":"list-item-card",className:"box-border w-full min-w-0 rounded-lg border border-zinc-100 p-4 dark:border-zinc-900",children:[d,g(I,{visible:n,children:g(T,{children:e.children})})]}):t?A("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[d,g(I,{visible:n,children:g(T,{children:e.children})})]}):A("div",{className:"box-border flex w-full min-w-0 items-start gap-2",children:[g("div",{className:"flex min-w-0 grow flex-col",children:g(T,{children:e.children})}),a&&g("div",{className:"shrink-0",children:a})]})}import{jsx as Wo}from"react/jsx-runtime";function cr(e){let t=b(Fn(e.field),e.translations),n=Tn(e.field);return An(e.field,e.value).map(r=>Wo(sr,{collapsed:e.field.advanced?.collapsed,index:r,isMultiField:n,label:t,translations:e.translations,children:e.children(r)},r))}import{jsx as Zo}from"react/jsx-runtime";function dr(e){let t=Array.isArray(e.field.fields)&&e.field.fields.length===0,n=w(e.field.label,e.translations),r=w(e.field.description,e.translations);return Zo(ee,{description:r,empty:t,id:e.field.name,title:n,children:e.children})}import{jsx as ur}from"react/jsx-runtime";function fr({children:e,field:t,lang:n,translations:r,value:o}){return ur(dr,{field:t,translations:r,children:ur(cr,{field:t,lang:n,translations:r,value:o,children:e})})}import{twMerge as qo}from"tailwind-merge";import{jsx as mr,jsxs as Jo}from"react/jsx-runtime";function gr(e){let t=Rn(e.column?.advanced?.cols);return Jo("div",{className:"flex w-full flex-col gap-4",children:[mr("div",{"data-slot":"column",className:qo("grid grid-cols-1 gap-3 sm:gap-4",t),children:e.children}),e.column?.description&&mr(ne,{config:e.config,context:e.context,text:e.column.description,translations:e.translations})]})}import{Fragment as jo}from"react";import{jsx as Qo}from"react/jsx-runtime";function pr(e){let t=Array.isArray(e.field.fields)?e.field.fields.map(n=>X(n)||Y(n)?{...n,name:`${e.field.name}.${e.index}.${n.name}`}:v(n)?{...n,fields:n.fields.map(r=>({...r,name:`${e.field.name}.${e.index}.${r.name}`}))}:n):[];return Qo(z,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,fields:t,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})}import{jsx as V,jsxs as ei}from"react/jsx-runtime";function z(e){let{field:t,list:n}=e.components;return J(e.fields).map((r,o)=>ei(jo,{children:[v(r)&&V(gr,{column:r,config:e.config,context:e.context,translations:e.translations,children:V(z,{...e,fields:r.fields})}),X(r)&&V(t,{disabled:e.disabled,field:r,lang:e.lang,style:e.style,translations:e.translations,children:e.children}),Y(r)&&V(n,{field:r,lang:e.lang,onValueChange:e.onValueChange,translations:e.translations,value:e.value,children:i=>V(pr,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,field:r,index:i,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})})]},o))}import{jsx as ti}from"react/jsx-runtime";function yr(e){return n=>ti(z,{...n,components:e})}var xr=yr({field:ar,list:fr});import{jsx as Ne}from"react/jsx-runtime";function ve(e){let t=nn(e.lang,e.translations);return Ne(zn,{advanced:e.advanced,config:e.config,control:e.children,definition:e.definition,readOnly:e.readOnly,sections:e.sections,translations:t,children:({disabled:n,fields:r})=>Ne(xr,{config:e.config,context:e.context,disabled:n,fields:r,lang:e.lang,style:e.config.style,translations:t,value:e.value,children:o=>Ne(jn,{...o,config:e.config,context:e.context,translations:t,value:e.value})})})}import{Suspense as ni}from"react";import{jsx as br}from"react/jsx-runtime";function ri(e){return br(ni,{fallback:br(ve,{config:e.config,sections:e.sections,readOnly:!0}),children:e.children})}export{ri as Fallback,ve as Form};
|
|
1
|
+
import{jsx as Sr}from"react/jsx-runtime";function Me(e){let t=typeof e.children=="function"?e.children({isPending:e.isPending}):e.children;return Sr("div",{"data-slot":"field-control",className:"w-full",children:t})}import{jsx as _e}from"react/jsx-runtime";function F(e){return _e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`size-4 transition-transform duration-200 ${e.expanded?"rotate-90":""}`,children:_e("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})})}import{createContext as Nr}from"react";var Ve=Nr(!1);import{createContext as wr}from"react";var E=wr(()=>{});import{use as Ir,useCallback as kr}from"react";import{jsx as ce}from"react/jsx-runtime";function L({children:e,onReveal:t,visible:n}){let r=Ir(E),o=kr(()=>{t?.(),r()},[t,r]);return ce("div",{"data-slot":"collapsible-content",hidden:!n,children:ce(E,{value:o,children:ce(Ve,{value:!0,children:e})})})}var $="input",ze="input/date",Be="input/email",He="input/number",Ge="input/time";var Ue="textarea",$e="radio",Ye="checkbox",de="list",Xe="select",Ke="select/active",We="select/day",Ze="select/month",qe="select/timezone",Je="select/year";var Qe="chips",je="chips/day",et="chips/month",O="column",tt="description",ue="fields",nt="label",fe="value",Y="options",me="email",rt="number",ot="password",it="tel",D="text",lt="aria-errormessage",at="aria-invalid",st="data-invalid",ct="data-readonly",dt="aria",ut="data",ft="max",mt="maxLength",gt="min",pt="minLength",C="$ref";var yt="type",xt={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};import{format as Lr,formatDistanceToNow as Rt,formatDuration as Or,intervalToDuration as Dr,isValid as X,parseISO as Pr}from"date-fns";import{enUS as ht,es as ge}from"date-fns/locale";function d(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function p(e){return c(e)||typeof e=="number"||Er(e)}function bt(e){return Array.isArray(e)&&e.every(p)}function c(e){return typeof e=="string"}function Er(e){return typeof e=="boolean"}var Tt={en:ht,"en-US":ht,es:ge,"es-ES":ge,"es-MX":ge},Mr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},_r={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function At(e){if(e)return Tt[e]??Tt[e.split("-")[0]]}function K(e){if(typeof e=="number"&&!Number.isNaN(e))return e;if(c(e)&&e.trim()!==""){let t=Number(e);return Number.isNaN(t)?null:t}return null}function vt(e,t,n){let r=_r[t];if(r===void 0)return String(e);let o=e*r,i=Dr({start:0,end:o});return Or(i,{locale:n})}function Ft(e){if(e instanceof Date)return X(e)?e:null;if(c(e)){let t=Pr(e);if(X(t))return t;let n=new Date(e);return X(n)?n:null}if(typeof e=="number"){let t=new Date(e);return X(t)?t:null}return null}var Vr={currency:(e,t,n)=>{let r=K(e);if(r===null)return String(e);let o=t[0]??"USD";return new Intl.NumberFormat(n.locale,{style:"currency",currency:o}).format(r)},percent:(e,t,n)=>{let r=K(e);return r===null?String(e):new Intl.NumberFormat(n.locale,{style:"percent"}).format(r)},number:(e,t,n)=>{let r=K(e);return r===null?String(e):new Intl.NumberFormat(n.locale).format(r)},date:(e,t,n)=>{let r=Ft(e);if(!r)return String(e);let o=t[0]??"short",i=At(n.locale);if(o==="relative")return Rt(r,{addSuffix:!0,locale:i});let l=Mr[o]??o;return Lr(r,l,{locale:i})},duration:(e,t,n)=>{let r=At(n.locale);if(typeof e=="number")return vt(e,t[0]??"ms",r);if(c(e)){let i=K(e);if(i!==null)return vt(i,t[0]??"ms",r)}let o=Ft(e);return o?Rt(o,{addSuffix:!0,locale:r}):String(e)}};function Ct(e,t,n){let r=t.split(":").map(a=>a.trim()).filter(a=>a.length>0);if(r.length===0)return;let[o,...i]=r,l=Vr[o];if(l)return l(e,i,n)}function zr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function St(e,t=fe){if(e!=null){if(bt(e)||p(e))return e;if(d(e)){let n=Br(e,t);if(p(n))return n}}}function Br(e,t){let n=y(e,t);if(p(n))return n}function y(e,t){if(!t||!d(e))return null;let n=t.split(".").filter(o=>o!=="");if(n.length===0)return null;let r=e;for(let o of n)if(d(r)&&zr(r,o))r=r[o];else if(Array.isArray(r)){let i=Number(o);if(!Number.isInteger(i)||i<0||i>=r.length)return null;r=r[i]}else return null;return r}function Nt(e,t={description:tt,label:nt,value:fe}){return e.map(n=>{if(d(n)){let r=y(n,t.label),o=y(n,t.value);if(p(r)&&p(o)){let i=y(n,t.description);return{label:`${r}`,value:`${o}`,...p(i)&&{description:`${i}`}}}}return n})}function wt(e=D){let t=e.lastIndexOf("/"),n=t===-1?e:e.slice(t+1);return n&&n!==$?n.trim().toLowerCase():D}var Hr=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g,Gr=/{([^}]{1,200})}/,Ur=/{([^}]{1,200})}/g;function P(e,t={},n={}){if(c(e))return Yr(e,t,n);if(Array.isArray(e))return e.map(r=>P(r,t,n));if(d(e)){let r={};for(let o in e)r[o]=P(e[o],t,n);return r}return e}function M(e,t={},n={}){return pe(e)?P(e,t,n):e}function pe(e){return c(e)?Gr.test(e):Array.isArray(e)?e.some(t=>pe(t)):d(e)?Object.values(e).some(t=>pe(t)):!1}function $r(e,t){return t.includes(".")?y(e,t):e[t]}function Yr(e,t={},n={}){return e.replace(Ur,(r,o)=>{let i=String(o).split("|").map(g=>g.trim()),[l,...a]=i;if(!l)return r;let s=$r(t,l);if(a.length===0)return p(s)?String(s):r;if(s==null)return r;let u=s;for(let g of a){let U=Ct(u,g,{locale:n.locale});if(U===void 0)return r;u=U}return String(u)})}function It(e,t){if(!c(e)||!e||e.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=Hr.exec(e))!==null;){let[l,a,s]=n,u=n.index;o=!0,u>r&&i.push(e.substring(r,u));let g=t?t(u,s,a):l;i.push(g),r=u+l.length}return o?(r<e.length&&i.push(e.substring(r)),i):e}var kt=e=>f(Ke)(e),Et=e=>f(We)(e),Lt=e=>f(Ze)(e),Ot=e=>f(Je)(e),Dt=e=>f(qe)(e),Pt=e=>f(je)(e),Mt=e=>f(et)(e),_t=f(ze),ye=f(Ge),x=f(Ye),S=f(Qe),v=f($e),Vt=f($),h=f(Xe),zt=f(Ue),Bt=f(D,me,ot,it),Yi=f(Be,me),xe=f(He,rt);function Ht(e){return v(e)||x(e)}function W(e){return e.type===de}function N(e){return e.type===O}function Z(e){return e.type!==O&&e.type!==de}function be(e){return h(e)||v(e)||S(e)}function _(e){return e!=null&&e!==""}function f(...e){return t=>{let n=c(t.type)?t.type:void 0;return n?e.some(r=>n===r||n?.startsWith(`${r}/`)):!1}}function Gt(e,t={}){if(h(e)&&e.disabled){let n=e.name?t?.[e.name]:void 0;if(n&&d(n))return[n]}}function Ut(e){return v(e)||x(e)?!0:e.advanced?.horizontal}function $t(e){return x(e)?e.advanced?.reverse!==!1:!1}function Yt(e,t){let n=e.readonly??!1;return t||n}function Xt(e,t){return!!e.readonly&&!t&&!e.disabled}function Kt(e){let t=e.advanced?.step;if(typeof t=="number"&&Number.isFinite(t)&&t>0)return t}function Re(e){if(Xr(e)){let t=e.source;if(Array.isArray(t)||d(t)&&!(C in t))return t}}function Wt(e){return Array.isArray(Re(e))}function Xr(e){return v(e)||S(e)||h(e)&&!e.disabled}import{isValid as Jt,parse as Qt,format as jt}from"date-fns";var Kr=/^\d+$/,en=new Date(2e3,0,1),Wr=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[],he="default";function tn(e){if(!e)return he;try{return Intl.getCanonicalLocales(e)[0]??he}catch{return he}}function Te(e){let t=tn(e);return Array.from({length:12},(n,r)=>({value:(r+1).toString(),label:new Date(0,r).toLocaleString(t,{month:"long"})}))}function Ae(e){let t=tn(e);return Array.from({length:7},(n,r)=>({value:r.toString(),label:new Date(2e3,0,2+r).toLocaleString(t,{weekday:"long"})}))}function nn(e,t){return t>=e?Array.from({length:t-e+1},(n,r)=>{let o=e+r;return{value:o.toString(),label:o.toString()}}):[]}function ve(){return new Date().getFullYear()}function Zr(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function qr(e){let t=e.indexOf("/"),n=t===-1?e:e.slice(0,t);return xt[n]??"Other"}function Jr(e,t){return(e.find(r=>r.type==="timeZoneName")?.value??t).replace(/\s+(?:Standard|Daylight(?: Saving)?|Summer|Winter)\s+Time$/,"")}function Zt(e,t){let n=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t),r=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"long"}).formatToParts(t),i=(n.find(a=>a.type==="timeZoneName")?.value??"GMT+00:00").replace("GMT","UTC"),l=Jr(r,e);return{offset:i,longName:l}}function qt(e){return e.slice(e.lastIndexOf("/")+1).replace(/_/g," ")}function rn(){let e=new Date,t=Zr(),n=new Map,r=qt(t),{offset:o,longName:i}=Zt(t,e),l={value:t,label:`${r} - ${i} (${o})`};for(let s of Wr()){if(s===t)continue;let u=qt(s),{offset:g,longName:U}=Zt(s,e),De={value:s,label:`${u} - ${U} (${g})`},se=qr(s);if(se==="Other")continue;let Pe=n.get(se);Pe?Pe.push(De):n.set(se,[De])}for(let s of n.values())s.sort((u,g)=>u.label.localeCompare(g.label));let a=Array.from(n.entries()).sort(([s],[u])=>s.localeCompare(u)).map(([s,u])=>({label:s,items:u}));return[{label:"Suggested",items:[l]},...a]}function Fe(e,t){if(typeof e=="number")return e;let n=t??ve(),r=e.trim().toLowerCase();if(r.startsWith("current")){let o=r.match(/^current([+-])(\d+)$/);if(o){let[,i,l]=o,a=parseInt(l,10);if(!isNaN(a))return i==="+"?n+a:n-a}return n}return Kr.test(r)?parseInt(r,10):n}function on(e,t){if(!e)return"";try{let n=Qt(e,t,en);return Jt(n)?jt(n,"yyyy-MM-dd"):""}catch{return""}}function ln(e,t){if(!e)return"";try{let n=Qt(e,t,en);return Jt(n)?jt(n,"HH:mm:ss"):""}catch{return""}}function Ce(e){return e.advanced?.format??"HH:mm"}function an(e){return e.advanced?.format??"MMMM d, yyyy"}var Qr={es:{"(Optional)":"(Opcional)","Add item":"A\xF1adir elemento","An unexpected error occurred submitting the form.":"Ocurri\xF3 un error inesperado al enviar el formulario.","Collapse {label} {index}":"Contraer {label} {index}","Expand {label} {index}":"Expandir {label} {index}","Please correct the errors and try again.":"Corrige los errores e int\xE9ntalo de nuevo.","Remove {label} item {index}":"Eliminar {label} {index}","There were validation errors submitting the form.":"Se encontraron errores de validaci\xF3n al enviar el formulario.","Unknown error":"Error desconocido",No:"No",Yes:"S\xED"}};function q(e,t){return b(e,t)}function cn(e,t){let n=t?.[e??""],r=e?Qr[jr(e)]:void 0;return r?n?{...r,...n}:r:n}function jr(e){return e.toLowerCase().split(/[-_]/)[0]}function b(e,t){return e?t?t[e]??e:e:""}function w(e,t){return e?b(e,t):void 0}function J(e,t){if(!t)return e;let n=!1,r=e.map(o=>{let i=eo(o,t);return i!==o&&(n=!0),i});return n?r:e}function eo(e,t){if(!d(e))return e;let n=sn(e.label,t),r=e.items;if(Array.isArray(r)){let i=J(r,t);return i===r&&n===e.label?e:{...e,...n!==void 0&&{label:n},items:i}}let o=sn(e.description,t);return n===e.label&&o===e.description?e:{...e,...n!==void 0&&{label:n},...o!==void 0&&{description:o}}}function sn(e,t){return c(e)?b(e,t):e}var Q=ve();function to(e,t){if(S(e))return no(e,t?.lang)}function no(e,t){if(Pt(e))return Ae(t);if(Mt(e))return Te(t)}function ro(e,t){if(h(e))return oo(e,t)}function oo(e,t){let{lang:n,translations:r}=t??{};if(Et(e))return Ae(n);if(Lt(e))return Te(n);if(Ot(e)){let o=e.advanced?.length?.min??Q,i=e.advanced?.length?.max??Q+5;return nn(Fe(o,Q),Fe(i,Q))}if(Dt(e))return rn();if(kt(e))return J([{value:"true",label:"Yes"},{value:"false",label:"No"}],r)}function dn(e,t=!1,n){let r={disabled:t,id:e.name,name:e.name,placeholder:e.placeholder,required:e.required};return Vt(e)?{...r,...io(e)}:h(e)?{...r,...un(ro(e,n))}:zt(e)?{...r,...so(e)}:S(e)?{...r,...ao(e,n)}:r}function io(e){let t=wt(e.type),n={...e,type:t};return{...uo(e),...fn(e),...co(n),...lo(n),...Bt(n)?mn(n):{},type:t}}function lo(e){let t=Kt(e);return xe(e)&&t!==void 0?{step:t}:{}}function un(e){return e?{options:e}:{}}function ao(e,t){let n=un(to(e,t)),r=e.advanced?.multiple??!0;return{...n,multiple:r}}function so(e){return{...fn(e),...mn(e)}}function fn(e){let t=e.advanced?.autocomplete;return t?{autoComplete:t}:{}}function co(e){return xe(e)?fo(e):{}}function uo(e){if(ye(e)){let t=Ce(e);return{step:t==="HH:mm:ss"||t==="hh:mm:ss a"?"1":"60"}}return{}}function mn(e){return gn(e,{min:pt,max:mt})}function fo(e){return gn(e,{min:gt,max:ft})}function gn(e,t){let n={},r=e.advanced?.length;return r&&(r.min!==void 0&&(n[t.min]=r.min),r.max!==void 0&&(n[t.max]=r.max)),n}function pn(e,t){let n=Re(e);return n||Gt(e,t)}function mo(e,t){let n=d(t)&&e.name in t?t[e.name]:t,r=St(n,e.advanced?.entity),o=_(r)?r:e.defaultValue;return ye(e)&&_(o)?go(e,o):_t(e)&&_(o)?bo(e,o):o}function go(e,t){let n=Ce(e);return c(t)?ln(t,n):t}function po(e,t,n){return be(e)&&Array.isArray(n)?{...t,[Y]:n}:t}function yo(e,t,n){if(e.required&&!_(n)&&h(e)&&e.advanced?.preselected!==!1&&Y in t){let r=t[Y];if(Array.isArray(r)&&r.length===1)return r[0]}return n}function xo(e,t,n){if(be(e)&&Array.isArray(t)){let r=Nt(t,e.advanced?.options);return Wt(e)?J(r,n):r}return t}function yn(e,t,n,r,o){let i=mo(e,r),l=Array.isArray(n)?xo(e,n,o):n,a=po(e,t,l),s=yo(e,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function xn(e,t){return x(e)?{defaultChecked:!!t}:{defaultValue:t}}function bo(e,t){let n=an(e);return c(t)?on(t,n):t}var Ro=/^#\/definition\//;function ee(e=[],t){let n=j(e,t);return Array.isArray(n)?n.filter(To).sort((r,o)=>bn(r)-bn(o)):[]}function j(e,t,n=new Map,r=new WeakSet){if(!ho(t)||!e||typeof e!="object")return e;if(n.has(e))return n.get(e);if(r.has(e))return e;if(r.add(e),Array.isArray(e))return e.map(i=>j(i,t,n,r));if(C in e&&c(e[C])){let i=e[C].replace(Ro,""),l=y(t,i);return l!==null?j(l,t,n,r):e}let o={};for(let[i,l]of Object.entries(e))o[i]=j(l,t,n,r);return r.delete(e),n.set(e,o),o}function Rn(e){return Object.entries(e??{})}function bn(e){return e.order??Number.MAX_VALUE}function ho(e){return e!==void 0&&d(e)&&Object.keys(e).length>0}function To(e){return yt in e?!0:Array.isArray(e[ue])?e[ue].length>0:!0}function hn(e,t){let n={};for(let[r,o]of Rn(t))n[`${e}-${r}`]=o;return n}function Ao(e){return hn(dt,e)}function vo(e){return hn(ut,e)}function Tn(e,t){let n=Ao(e.advanced?.aria);return t&&t.length>0&&(n[at]="true",n[lt]=`${e.name}-error`),n}function An(e){return vo(e.advanced?.data)}var vn={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},Fn={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function Cn(e,t=2){return vn[e&&e in vn?e:t]}function Sn(e){if(e&&e in Fn)return Fn[e]}function Fo(e){return{min:e.advanced?.length?.min??1,max:e.advanced?.length?.max??1/0}}function Co(e,t){let n=t?y(t,e.name):null;return So(e,Array.isArray(n)?n.length:0)}function Nn(e){return!Array.isArray(e.fields)||e.fields.length===0?!1:e.fields.length>1||e.fields[0].type===O}function wn(e,t){let n=Co(e,t);return Array.from({length:n},(r,o)=>o)}function In(e){return e.advanced?.title??e.label??e.name}function So(e,t){let{min:n,max:r}=Fo(e);return Math.min(Math.max(t,n),r)}function te(e,t){let n={...e};for(let r of Object.keys(t??{})){let o=t?.[r];o!==void 0&&(n[r]=o)}return n}import{jsx as No}from"react/jsx-runtime";function R(e){return It(e,(t,n,r)=>No("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${t}`))}import{useCallback as kn,useState as wo}from"react";function I(e=!1){let[t,n]=wo(e),r=kn(()=>n(i=>!i),[]),o=kn(()=>n(!0),[]);return[t,r,o]}import{jsx as V,jsxs as Se}from"react/jsx-runtime";function En(e){let{fields:t=[]}=e.section,[n,r,o]=I();return Se("fieldset",{"data-slot":"field-set","data-advanced":"true","data-expanded":n,"data-empty":t.length===0,className:"flex flex-col",id:e.section.id?.toString(),children:[V("legend",{children:Se("button",{className:"flex cursor-pointer items-center gap-2 text-base font-medium text-zinc-600 dark:text-zinc-400",onClick:r,type:"button",children:[V(F,{expanded:n}),V("span",{children:R(e.title)})]})}),V(L,{onReveal:o,visible:n,children:Se("div",{className:"mt-3 ml-1.5 flex flex-col gap-4 border-l-2 border-zinc-300 pl-4 dark:border-zinc-600","data-slot":"field-set-content",children:[e.description&&V("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:R(e.description)}),e.group]})})]})}import{jsx as ne,jsxs as Ln}from"react/jsx-runtime";function On(e){let t=Ln("div",{className:"flex flex-col",children:[e.title&&ne("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:R(e.title)}),e.description&&ne("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:R(e.description)})]});return e.step?Ln("div",{className:"flex flex-row items-start gap-4",children:[ne("div",{className:"bg-primary text-primary-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:ne("span",{className:"text-sm font-bold",children:e.step})}),t]}):t}import{jsx as Dn,jsxs as Io}from"react/jsx-runtime";function re(e){return Io("fieldset",{className:"flex w-full min-w-0 flex-col data-[empty=false]:gap-6","data-empty":e.empty,"data-slot":"field-set",id:e.id,children:[Dn(On,{description:e.description,step:e.step,title:e.title}),Dn("div",{className:"w-full min-w-0",children:e.children})]})}import{jsx as ko}from"react/jsx-runtime";function T(e){return ko("div",{"data-slot":"field-group","data-compact":e.compact,className:"flex w-full flex-col gap-8 data-[compact=true]:gap-3",children:e.children})}import{jsx as Ne}from"react/jsx-runtime";function Pn(e){let{fields:t=[]}=e.section,n=e.advanced?.step?e.step:void 0,{compact:r}=te(e.style,{compact:e.section.advanced?.compact}),o=Ne(T,{compact:r,children:e.children});if(!e.section.title&&!e.section.description)return o;let i=w(e.section.title,e.translations),l=w(e.section.description,e.translations);return e.section.advanced?.collapsible?Ne(En,{description:l,group:o,section:e.section,title:i}):Ne(re,{description:l,empty:t.length===0,id:e.section.id?.toString(),step:n,title:i,children:o})}import{jsx as Mn}from"react/jsx-runtime";function _n(){return Mn("div",{"data-slot":"field-separator",className:"relative -my-2 h-5 text-sm",children:Mn("div",{className:"absolute inset-0 top-1/2 h-px w-full bg-zinc-200 dark:bg-zinc-800"})})}import{useAtomValue as Vo}from"jotai";import{atom as k}from"jotai";import{atomFamily as Eo}from"jotai-family";import{deepEqual as Vn}from"fast-equals";function Lo(e,t){let{[t]:n,...r}=e;return r}function Oo(e){return Eo(t=>k(n=>n(e)[t]??void 0,(n,r,o)=>{let i=n(e);if(o!=null){let l=i[t];Vn(l,o)||r(e,{...i,[t]:o})}else t in i&&r(e,Lo(i,t))}))}function Do(e){return k(null,(t,n)=>{let r=t(e);r&&Object.keys(r).length>0&&n(e,{})})}function Po(e){return k(null,(t,n,r)=>{let i={...t(e)},l=!1;for(let a of r)a in i&&(delete i[a],l=!0);l&&n(e,i)})}function Mo(e){return k(null,(t,n,r)=>{for(let o of r)e.remove(o)})}function _o(e){return k(null,(t,n,r)=>{let o=t(e);Vn(o,r)||n(e,r)})}function oe(e={}){let t=k(e),n=Oo(t);return{atom:t,clearAll:Do(t),clear:Po(t),bulkReport:_o(t),release:Mo(n),report:n}}var we=oe(),zn=we.atom,ta=we.release,Bn=we.report;function zo(e,t){return e.fields.every(n=>Hn(n,t))}function Hn(e,t){return t[e.name]?.hidden??e.hidden??!1}function Bo(e,t){return N(e)?zo(e,t):Hn(e,t)}function Gn(e){let t=Vo(zn);return e.container&&(t[e.container.name]?.hidden??e.container.hidden??!1)||e.fields.length===0||e.fields.every(r=>Bo(r,t))?null:e.children}import{jsx as z,jsxs as Un}from"react/jsx-runtime";function $n(e){let t=ee(e.sections,e.definition);return z("div",{className:"h-full w-full",children:z("form",{noValidate:e.noValidate,action:e.action,onSubmit:e.onSubmit,children:Un(T,{children:[t.map((n,r)=>Un(Gn,{fields:n.fields??[],children:[z(Pn,{advanced:e.advanced,section:n,step:r+1,style:e.config.style,translations:e.translations,children:e.children({disabled:e.readOnly,fields:n.fields})}),n.advanced?.separator&&z(_n,{})]},`key-${n.id}-${r}`)),e.control&&z(Me,{isPending:e.isPending,children:e.control})]})})})}import{jsx as Ho}from"react/jsx-runtime";function Yn(e){return Ho("p",{className:"-mt-2 text-xs leading-normal font-normal text-zinc-600 dark:text-zinc-400 [[data-slot=column]_&]:md:line-clamp-2",title:e.title,children:e.children})}import{jsx as Xn,jsxs as Kn}from"react/jsx-runtime";function ie(e){let t={context:e.context,env:e.config?.env,value:e.value},r={locale:e.config?.env?.locale},[o,i]=I(()=>d(e.text)&&"collapsed"in e.text?!e.text.collapsed:!0),l=d(e.text)&&c(e.text.title)?R(b(M(e.text.title,t,r),e.translations)):void 0,a=b(M(c(e.text)?e.text:e.text?.message,t,r),e.translations),s=R(a);return s?Kn("div",{className:"flex flex-col gap-2",children:[l&&Kn("button",{className:"flex items-center gap-1 text-left text-xs font-medium text-zinc-700 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-zinc-100",onClick:i,type:"button",children:[l,Xn(F,{expanded:o})]}),o&&Xn(Yn,{title:a,children:s})]}):null}import{atom as Wn}from"jotai";var B=oe(),Sa=B.atom,Na=B.clearAll,wa=B.clear,Ia=B.release,Zn=B.report,ka=Wn({}),Ea=Wn(null);import{useAtomValue as qn}from"jotai";import{jsx as Go}from"react/jsx-runtime";function le(e){let t=qn(Zn(e.field.name)),r=qn(Bn(e.field.name))?.description??e.field.description;return Go(ie,{config:e.config,context:e.context,text:r,translations:e.translations,value:t})}import{twMerge as Uo}from"tailwind-merge";import{jsx as Jn,jsxs as $o}from"react/jsx-runtime";function Qn(e){let t=e.style?.showOptionalLabel??!0,n=v(e.field)||x(e.field);return $o("label",{"data-slot":"field-label","data-normal":n,className:Uo("flex w-fit items-center text-sm leading-snug font-medium select-none","data-[normal=true]:font-normal [[data-slot=column]_&]:md:w-full","group-data-[readonly=true]:cursor-not-allowed group-data-[readonly=true]:opacity-50"),htmlFor:e.field.name,title:c(e.children)?e.children:void 0,children:[Jn("span",{className:"[[data-slot=column]_&]:md:truncate",children:e.children}),t&&!e.field.required&&Jn("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:q("(Optional)",e.translations)})]})}import{jsx as jn,jsxs as Yo}from"react/jsx-runtime";function er(e){let t={context:e.context,env:e.config?.env},n=e.config?.env?.locale,r=M(e.field.label,t,{locale:n});return Yo("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[jn(Qn,{field:e.field,style:e.config?.style,translations:e.translations,children:b(r,e.translations)}),e.horizontal===!0&&jn(le,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}import{Fragment as Xo,jsx as tr,jsxs as Ko}from"react/jsx-runtime";function nr(e){return Ko(Xo,{children:[e.field.name&&e.field.label&&tr(er,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&tr(le,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}function rr(e,t){return e?t(e):null}import{jsx as or}from"react/jsx-runtime";function ir(e){let t=pn(e.field,e.value),{commonPropsWithOptions:n,defaultValue:r}=yn(e.field,e.commonProps,t,e.value,e.translations),o=xn(e.field,r);return rr(e.config.inputs[e.field.type],i=>or(nr,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:or(i,{...e.ariaAttributes,...n,...e.dataAttributes,...o})}))}import{createContext as Wo}from"react";var lr=Wo(null);import{use as ar,useEffect as Zo}from"react";import{jsx as Ie}from"react/jsx-runtime";function sr(e){return!e.errors||e.errors.length===0?null:Ie(qo,{errors:e.errors,name:e.name})}function qo(e){let t=ar(E),n=ar(lr);return Zo(()=>{n&&t()},[n,t]),Ie("ul",{className:"text-sm text-red-600 dark:text-red-500",id:e.name?`${e.name}-error`:void 0,children:e.errors.map((r,o)=>Ie("li",{children:r},e.name?`${e.name}-error-${o}`:o))})}import{twMerge as Jo}from"tailwind-merge";import{jsx as Qo}from"react/jsx-runtime";function ae(e){let t=e.errors&&e.errors.length>0;return Qo("div",{"data-slot":"field","data-clickable":e.isClickable?"true":"false",...t&&{[st]:"true"},...e.disabled&&{[ct]:"true"},"data-orientation":e.orientation,className:Jo("group flex w-full flex-col items-center data-[invalid=true]:text-red-600 data-[invalid=true]:dark:text-red-500","data-[clickable=true]:items-start",e.isCheckbox&&(e.isReversed?"flex-row-reverse!":"flex-row!"),"data-[clickable=true]:has-[>[data-slot=field-content]]:[&>:first-child]:mt-px",e.className),children:e.children})}import{twMerge as jo}from"tailwind-merge";import{jsx as ei}from"react/jsx-runtime";function cr(e){return ei(ae,{...e,orientation:"vertical",className:jo("gap-3 has-[>[data-slot=field-content]]:items-start",!e.isClickable&&"[&>*]:w-full"),children:e.children})}import{twMerge as ti}from"tailwind-merge";import{jsx as ni}from"react/jsx-runtime";function dr(e){return ni(ae,{...e,orientation:"horizontal",className:ti("gap-2 md:flex-row md:gap-4","[&>[data-slot=field-content]]:min-w-0 [&>[data-slot=field-content]]:flex-grow [&>[data-slot=field-content]]:self-start","[&_[role=checkbox]]:mt-[1.5px]",e.isClickable&&"md:flex-col",!e.isClickable&&["md:justify-between","[&>*:not([data-slot=field-content])]:w-full","[&>*:not([data-slot=field-content])]:md:w-1/2","[&>*:not([data-slot=field-content])]:xl:w-2/5"]),children:e.children})}import{jsx as ur}from"react/jsx-runtime";function fr(e){let t=Ht(e.field),n=x(e.field),r=$t(e.field);return e.horizontal?ur(dr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children}):ur(cr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children})}function mr(e){if(!e.field.type)return null;let t=dn(e.field,e.disabled,{lang:e.lang,translations:e.translations}),n=An(e.field),r=Tn(e.field,e.errors),o=!!e.field.disabled===t.disabled?e.field:{...e.field,disabled:t.disabled};return e.children({ariaAttributes:r,commonProps:t,dataAttributes:n,field:o,horizontal:e.horizontal,readOnly:e.readOnly})}import{twMerge as ri}from"tailwind-merge";import{jsx as ke,jsxs as oi}from"react/jsx-runtime";function gr(e){let t=e.field.advanced?.cols,n=e.field.name?e.errors?.[e.field.name]:void 0,{horizontal:r=!1}=te(e.style,{horizontal:Ut(e.field)}),o=Yt(e.field,e.disabled),i=Xt(e.field,e.disabled);return oi("div",{className:ri("flex flex-col gap-3",Sn(t)),children:[ke(fr,{disabled:o,errors:n,field:e.field,horizontal:r,children:ke(mr,{disabled:o,errors:n,field:e.field,horizontal:r,lang:e.lang,readOnly:i,translations:e.translations,children:e.children})}),ke(sr,{errors:n,name:e.field.name})]})}import{twMerge as Ee}from"tailwind-merge";import{Fragment as ii,jsx as m,jsxs as A}from"react/jsx-runtime";function pr(e){let t=e.isMultiField||e.collapsed!=null,[n,r,o]=I(t?!e.collapsed:!0);function i(){e.canRemove&&e.onRemove&&e.onRemove(e.index)}let l=g=>P(q(g,e.translations),{index:e.index+1,label:e.label}),a=e.canRemove&&e.onRemove!=null&&m("button",{"aria-label":l("Remove {label} item {index}"),className:Ee("flex size-6 items-center justify-center rounded text-xl leading-none text-zinc-400","transition-colors duration-150","hover:text-red-500","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500 dark:hover:text-red-400"),onClick:i,type:"button",children:m("span",{"aria-hidden":"true",className:"leading-none",children:"\xD7"})}),s=A("div",{className:"flex min-w-0 flex-col font-medium text-zinc-700 dark:text-zinc-400",children:[m("span",{className:"text-base",children:e.previewLabel??A(ii,{children:[e.label," ",e.index+1]})}),!n&&e.previewTags&&m("div",{className:"flex items-center gap-2 overflow-hidden text-xs font-normal text-ellipsis whitespace-nowrap text-zinc-500 dark:text-zinc-500",children:e.previewTags})]}),u=A("div",{className:Ee("flex items-center justify-between gap-2",e.isMultiField&&n&&"mb-3"),children:[t?A("div",{className:"flex min-w-0 grow items-center gap-2",children:[A("button",{"aria-expanded":n,"aria-label":l(n?"Collapse {label} {index}":"Expand {label} {index}"),className:Ee("group flex grow items-center gap-2 rounded p-1 text-left text-zinc-400","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500"),onClick:r,type:"button",children:[m(F,{expanded:n}),s]}),!n&&e.previewBadge&&m("div",{className:"ml-auto shrink-0",children:e.previewBadge})]}):s,a]});return e.isMultiField?A("div",{"data-slot":"list-item-card",className:"box-border w-full min-w-0 rounded-lg border border-zinc-100 p-4 dark:border-zinc-900",children:[u,m(L,{onReveal:o,visible:n,children:m(T,{children:e.children})})]}):t?A("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[u,m(L,{onReveal:o,visible:n,children:m(T,{children:e.children})})]}):A("div",{className:"box-border flex w-full min-w-0 items-start gap-2",children:[m("div",{className:"flex min-w-0 grow flex-col",children:m(T,{children:e.children})}),a&&m("div",{className:"shrink-0",children:a})]})}import{jsx as li}from"react/jsx-runtime";function yr(e){let t=b(In(e.field),e.translations),n=Nn(e.field);return wn(e.field,e.value).map(r=>li(pr,{collapsed:e.field.advanced?.collapsed,index:r,isMultiField:n,label:t,translations:e.translations,children:e.children(r)},r))}import{jsx as ai}from"react/jsx-runtime";function xr(e){let t=Array.isArray(e.field.fields)&&e.field.fields.length===0,n=w(e.field.label,e.translations),r=w(e.field.description,e.translations);return ai(re,{description:r,empty:t,id:e.field.name,title:n,children:e.children})}import{jsx as br}from"react/jsx-runtime";function Rr({children:e,field:t,lang:n,translations:r,value:o}){return br(xr,{field:t,translations:r,children:br(yr,{field:t,lang:n,translations:r,value:o,children:e})})}import{twMerge as si}from"tailwind-merge";import{jsx as hr,jsxs as ci}from"react/jsx-runtime";function Tr(e){let t=Cn(e.column?.advanced?.cols);return ci("div",{className:"flex w-full flex-col gap-4",children:[hr("div",{"data-slot":"column",className:si("grid grid-cols-1 gap-3 sm:gap-4",t),children:e.children}),e.column?.description&&hr(ie,{config:e.config,context:e.context,text:e.column.description,translations:e.translations})]})}import{Fragment as fi}from"react";import{useMemo as di}from"react";import{jsx as ui}from"react/jsx-runtime";function Ar(e){let{fields:t,name:n}=e.field,{index:r}=e,o=di(()=>Array.isArray(t)?t.map(i=>Z(i)||W(i)?{...i,name:`${n}.${r}.${i.name}`}:N(i)?{...i,fields:i.fields.map(l=>({...l,name:`${n}.${r}.${l.name}`}))}:i):[],[r,n,t]);return ui(H,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,fields:o,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})}import{jsx as G,jsxs as mi}from"react/jsx-runtime";function H(e){let{field:t,list:n}=e.components;return ee(e.fields).map((r,o)=>mi(fi,{children:[N(r)&&G(Tr,{column:r,config:e.config,context:e.context,translations:e.translations,children:G(H,{...e,fields:r.fields})}),Z(r)&&G(t,{disabled:e.disabled,field:r,lang:e.lang,style:e.style,translations:e.translations,children:e.children}),W(r)&&G(n,{field:r,lang:e.lang,onValueChange:e.onValueChange,translations:e.translations,value:e.value,children:i=>G(Ar,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,field:r,index:i,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})})]},o))}import{jsx as gi}from"react/jsx-runtime";function vr(e){return n=>gi(H,{...n,components:e})}var Fr=vr({field:gr,list:Rr});import{jsx as Le}from"react/jsx-runtime";function Oe(e){let t=cn(e.lang,e.translations);return Le($n,{advanced:e.advanced,config:e.config,control:e.children,definition:e.definition,readOnly:e.readOnly,sections:e.sections,translations:t,children:({disabled:n,fields:r})=>Le(Fr,{config:e.config,context:e.context,disabled:n,fields:r,lang:e.lang,style:e.config.style,translations:t,value:e.value,children:o=>Le(ir,{...o,config:e.config,context:e.context,translations:t,value:e.value})})})}import{Suspense as pi}from"react";import{jsx as Cr}from"react/jsx-runtime";function yi(e){return Cr(pi,{fallback:Cr(Oe,{config:e.config,sections:e.sections,readOnly:!0}),children:e.children})}export{yi as Fallback,Oe as Form};
|
|
@@ -31,22 +31,6 @@ type Orderable = {
|
|
|
31
31
|
};
|
|
32
32
|
type Hideable = {
|
|
33
33
|
hidden?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Whether hiding this field leaves its value behind instead of taking it.
|
|
36
|
-
*
|
|
37
|
-
* Hiding a field normally clears what it held, and says so, because on a
|
|
38
|
-
* controlled form a value the host still carries comes back the moment the
|
|
39
|
-
* field is shown again -- so a clear nobody was told about undoes itself.
|
|
40
|
-
* That is the right default: a field nobody can see is usually a field whose
|
|
41
|
-
* data no longer applies.
|
|
42
|
-
*
|
|
43
|
-
* It is the wrong default for a field that is put away rather than dropped --
|
|
44
|
-
* two views of the same thing, where hiding one is a change of scenery and
|
|
45
|
-
* not a change of mind. Declared on the FIELD and not on the rule that hides
|
|
46
|
-
* it: a field either survives being put away or it does not, and which of
|
|
47
|
-
* several rules happened to hide it this time says nothing about that.
|
|
48
|
-
*/
|
|
49
|
-
keepValue?: boolean;
|
|
50
34
|
};
|
|
51
35
|
export type Sections = Section[];
|
|
52
36
|
export type Multiple = readonly (string | number | boolean)[];
|
|
@@ -66,6 +50,13 @@ export type List = {
|
|
|
66
50
|
title?: string;
|
|
67
51
|
action?: string;
|
|
68
52
|
collapsed?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Whether hiding this list leaves the values behind instead of taking
|
|
55
|
+
* them. See `Field`'s, which this one is a statement about: a list holds
|
|
56
|
+
* nothing under its own name, so declaring it here covers every value its
|
|
57
|
+
* rows hold.
|
|
58
|
+
*/
|
|
59
|
+
keepValue?: boolean;
|
|
69
60
|
length?: Length<number>;
|
|
70
61
|
preview?: {
|
|
71
62
|
label?: PreviewItem;
|
|
@@ -191,6 +182,7 @@ export type Validation = {
|
|
|
191
182
|
requiredWhen?: WhenRule | Array<WhenRule>;
|
|
192
183
|
pattern?: PatternRule;
|
|
193
184
|
rules?: Array<AssertRule>;
|
|
185
|
+
step?: string;
|
|
194
186
|
};
|
|
195
187
|
export type Field = CommonProps & {
|
|
196
188
|
advanced?: {
|
|
@@ -200,6 +192,27 @@ export type Field = CommonProps & {
|
|
|
200
192
|
data?: DataAttributes;
|
|
201
193
|
entity?: string;
|
|
202
194
|
horizontal?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Whether hiding this field leaves its value behind instead of taking it.
|
|
197
|
+
*
|
|
198
|
+
* Hiding a field normally clears what it held, and says so, because on a
|
|
199
|
+
* controlled form a value the host still carries comes back the moment the
|
|
200
|
+
* field is shown again -- so a clear nobody was told about undoes itself.
|
|
201
|
+
* That is the right default: a field nobody can see is usually a field
|
|
202
|
+
* whose data no longer applies.
|
|
203
|
+
*
|
|
204
|
+
* It is the wrong default for a field that is put away rather than dropped
|
|
205
|
+
* -- two views of the same thing, where hiding one is a change of scenery
|
|
206
|
+
* and not a change of mind. Declared on the FIELD and not on the rule that
|
|
207
|
+
* hides it: a field either survives being put away or it does not, and
|
|
208
|
+
* which of several rules happened to hide it this time says nothing about
|
|
209
|
+
* that.
|
|
210
|
+
*
|
|
211
|
+
* Alongside `transient`, which also decides what ends up stored, rather
|
|
212
|
+
* than beside `hidden`: the two read as a pair, but `hidden` is what the
|
|
213
|
+
* form does and this is what the field is.
|
|
214
|
+
*/
|
|
215
|
+
keepValue?: boolean;
|
|
203
216
|
reverse?: boolean;
|
|
204
217
|
/**
|
|
205
218
|
* Marks a field that fires its change events and keeps nothing of its own:
|
|
@@ -244,6 +257,7 @@ export type Transform = 'lowercase' | 'uppercase' | 'remove-space' | 'remove-acc
|
|
|
244
257
|
export type Input = Field & {
|
|
245
258
|
advanced?: {
|
|
246
259
|
length?: Length<number>;
|
|
260
|
+
step?: number;
|
|
247
261
|
transform?: Transform | Transform[];
|
|
248
262
|
};
|
|
249
263
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { Field, Nullable } from '../type';
|
|
1
|
+
import type { Field, Input, Nullable } from '../type';
|
|
2
2
|
export declare function buildOptions(field: Field, values?: Nullable<Record<string, unknown>>): Record<string, unknown>[] | undefined;
|
|
3
3
|
export declare function buildOrientation(field: Field): boolean | undefined;
|
|
4
4
|
export declare function buildReverse(field: Field): boolean;
|
|
5
5
|
export declare function buildDisabled(field: Field, disabled?: boolean): boolean;
|
|
6
|
+
export declare function buildReadOnly(field: Field, disabled?: boolean): boolean;
|
|
7
|
+
export declare function buildNumberStep(input: Input): number | undefined;
|
|
6
8
|
export declare function buildSource(field: Field): import("..").DataSource | unknown[] | undefined;
|
|
7
9
|
export declare function isArraySource(field: Field): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Nullable, Option, Value } from '../type';
|
|
2
|
+
export declare function hasOwn(value: object, key: string): boolean;
|
|
2
3
|
export declare function getEntity<T>(selected: Value, collection?: Nullable<T[]>, entity?: string): NonNullable<T> | {
|
|
3
4
|
value: import("..").Multiple;
|
|
4
5
|
} | {
|
|
@@ -23,4 +23,17 @@ export declare function isColumn(slot: Field | Column | List): slot is Column;
|
|
|
23
23
|
export declare function isField(slot: Field | Column | List): slot is Field;
|
|
24
24
|
export declare function isOptions(field: Field): field is Select;
|
|
25
25
|
export declare function isTextable(field: Field): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether hiding this slot leaves its value behind instead of taking it.
|
|
28
|
+
*
|
|
29
|
+
* Four places ask the question -- the two clears, the list that hands the
|
|
30
|
+
* answer to its leaves, and the registry a list publishes itself into -- and
|
|
31
|
+
* they used to ask it by reaching for the key themselves. One of them reaching
|
|
32
|
+
* a level too high is a `false` that typechecks and quietly drops the user's
|
|
33
|
+
* data, so the reach lives here once instead.
|
|
34
|
+
*
|
|
35
|
+
* `Field | List` and not `Column`: those are the two the runtime reads it off,
|
|
36
|
+
* and a signature wider than the implementation is a promise nothing keeps.
|
|
37
|
+
*/
|
|
38
|
+
export declare function keepsValue(slot: Field | List): boolean;
|
|
26
39
|
export declare function isValidValue<T>(value?: Nullable<T>): boolean;
|
|
@@ -3,11 +3,11 @@ import type { CustomValidation, Definition, Field, Input, Schemas, Sections, Zod
|
|
|
3
3
|
export declare function buildSchema(schemas: Schemas, fields?: Field[], translations?: Record<string, string>): ZodSchema;
|
|
4
4
|
export declare function flatten(error: z.ZodError<Record<string, unknown>>): Record<string, string[]>;
|
|
5
5
|
export declare function getSchema(input: Input, translations?: Record<string, string>): z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6
|
-
export declare function getEmail(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodPipe<z.ZodString, z.ZodEmail>, unknown> | z.ZodNullable<z.ZodUnion<[z.ZodPipe<z.ZodString, z.ZodEmail>, z.ZodLiteral<"">]
|
|
7
|
-
export declare function getText(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodCoercedString<unknown>, unknown> | z.ZodNullable<z.ZodCoercedString<unknown
|
|
8
|
-
export declare function getNumber(input: Input, translations?: Record<string, string>): z.ZodNullable<z.
|
|
9
|
-
export declare function getYearSchema(input: Input, translations?: Record<string, string>): z.ZodNullable<z.
|
|
10
|
-
export declare function getMonthSchema(input: Input, translations?: Record<string, string>): z.
|
|
6
|
+
export declare function getEmail(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodPipe<z.ZodString, z.ZodEmail>, unknown> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodPipe<z.ZodString, z.ZodEmail>, z.ZodLiteral<"">]>>>;
|
|
7
|
+
export declare function getText(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodCoercedString<unknown>, unknown> | z.ZodOptional<z.ZodNullable<z.ZodCoercedString<unknown>>>;
|
|
8
|
+
export declare function getNumber(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodOptional<z.ZodNullable<z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>>, unknown> | z.ZodPreprocess<z.ZodPipe<z.ZodUnknown, z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>, unknown>;
|
|
9
|
+
export declare function getYearSchema(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodOptional<z.ZodNullable<z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>>, unknown> | z.ZodPreprocess<z.ZodPipe<z.ZodUnknown, z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>, unknown>;
|
|
10
|
+
export declare function getMonthSchema(input: Input, translations?: Record<string, string>): z.ZodPreprocess<z.ZodOptional<z.ZodNullable<z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>>, unknown> | z.ZodPreprocess<z.ZodPipe<z.ZodUnknown, z.ZodType<number, unknown, z.core.$ZodTypeInternals<number, unknown>>>, unknown>;
|
|
11
11
|
export declare function applyCustomValidation(schema: ZodSchema, fields?: Field[], translations?: Record<string, string>): ZodSchema;
|
|
12
12
|
export declare function validateCustom(value: unknown, rules: CustomValidation | Array<CustomValidation>, getValue: (name: string) => unknown, translations?: Record<string, string>): string[];
|
|
13
13
|
export declare function buildFormSchema(sections: Sections, translations?: Record<string, string>, definition?: Definition): z.ZodType;
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A field renders when something it can see has changed, and not because a
|
|
3
|
+
* field elsewhere in the form did.
|
|
4
|
+
*
|
|
5
|
+
* The default comparison, on purpose. An earlier attempt wrote its own, and
|
|
6
|
+
* that is a list of props kept in step by hand: the day someone adds one and
|
|
7
|
+
* forgets this file, the field silently stops updating, and nothing -- not the
|
|
8
|
+
* compiler, which does not ask a comparator to be exhaustive -- says so. The
|
|
9
|
+
* failure is wrong data on screen, which is exactly how that attempt was found
|
|
10
|
+
* out.
|
|
11
|
+
*
|
|
12
|
+
* What makes the default enough is that every prop reaching this component is
|
|
13
|
+
* steady across a keystroke. The value the host holds no longer travels as a
|
|
14
|
+
* prop, so `children` is a stable callback rather than a closure rebuilt
|
|
15
|
+
* whenever that value moved; a field reads its own entry from the store, and
|
|
16
|
+
* the one thing that has to be read while rendering comes through a context
|
|
17
|
+
* whose identity never changes. `errors` is the one prop that moves, and it
|
|
18
|
+
* moves for the field it belongs to.
|
|
19
|
+
*/
|
|
1
20
|
export declare const Field: (props: Readonly<Readonly<Readonly<{
|
|
2
21
|
children: import("../../../type").Children;
|
|
3
22
|
disabled?: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RevealContext: import("react").Context<() => void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDisclosure(initialOpen?: boolean | (() => boolean)): readonly [boolean, () => void, () => void];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FormEvent } from 'react';
|
|
1
2
|
import { type Field, type FormStateError, type Nullable, type Schemas, type ZodSchema } from '../../../../luna-core/index';
|
|
2
3
|
export type FormState<T> = {
|
|
3
4
|
data: Nullable<T>;
|
|
@@ -10,4 +11,4 @@ export type FormActionOptions<T> = {
|
|
|
10
11
|
translations?: Record<string, string>;
|
|
11
12
|
validation?: boolean;
|
|
12
13
|
};
|
|
13
|
-
export declare function useFormState<T, F = Record<string, unknown>>(getSchema: () => readonly [Schemas, Field[]], action?: (formData: F, schema?: ZodSchema) => Promise<FormState<T>>, options?: FormActionOptions<T>): readonly [(payload: FormData) => void, FormState<T>, boolean];
|
|
14
|
+
export declare function useFormState<T, F = Record<string, unknown>>(getSchema: () => readonly [Schemas, Field[]], action?: (formData: F, schema?: ZodSchema) => Promise<FormState<T>>, options?: FormActionOptions<T>): readonly [(payload: FormData) => void, FormState<T>, boolean, (event: FormEvent<HTMLFormElement>) => void];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type HostEntry } from '../lib/host-value-store';
|
|
2
|
+
/**
|
|
3
|
+
* What the host says about one field. Re-renders this field when its own entry
|
|
4
|
+
* changes, and only then.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useHostEntry(name: string): HostEntry;
|
|
7
|
+
/**
|
|
8
|
+
* The same answer, read at the moment it is asked rather than at the moment the
|
|
9
|
+
* component rendered.
|
|
10
|
+
*
|
|
11
|
+
* For a reader that decides once and marks itself done. The store is written
|
|
12
|
+
* from the form's effect, and a parent's effects run after its children's, so a
|
|
13
|
+
* child asking during its own effect is always one commit behind. Asking from
|
|
14
|
+
* the microtask that follows the commit is not: every effect in that commit has
|
|
15
|
+
* run by then, the form's write included.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useHostEntryReader(name: string): () => HostEntry;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AriaAttributes, type CommonProps, type DataAttributes, type DataSource, type Field, type
|
|
1
|
+
import { type AriaAttributes, type CommonProps, type DataAttributes, type DataSource, type Field, type Schema, type Value } from '../../../../luna-core/index';
|
|
2
2
|
import type { Config, InputChange } from '../../type';
|
|
3
3
|
export type InputCoreProps = Readonly<{
|
|
4
4
|
ariaAttributes?: AriaAttributes;
|
|
@@ -7,20 +7,19 @@ export type InputCoreProps = Readonly<{
|
|
|
7
7
|
context?: Record<string, unknown>;
|
|
8
8
|
dataAttributes?: DataAttributes;
|
|
9
9
|
field: Field;
|
|
10
|
-
|
|
10
|
+
getField: (name: string) => Field | undefined;
|
|
11
11
|
horizontal?: boolean;
|
|
12
|
-
|
|
12
|
+
onRegister: (name: string, schema: Schema, field: Field) => void;
|
|
13
13
|
onUnmount: (name: string, options?: {
|
|
14
14
|
keepValue?: boolean;
|
|
15
15
|
}) => void;
|
|
16
16
|
onValueChange?: (input: InputChange) => void;
|
|
17
|
+
readOnly?: boolean;
|
|
17
18
|
translations?: Record<string, string>;
|
|
18
|
-
value?: Nullable<Record<string, unknown>>;
|
|
19
19
|
}>;
|
|
20
20
|
export declare function useInputCore(props: InputCoreProps, deps: Readonly<{
|
|
21
21
|
setSource: (target: string, source?: DataSource) => void;
|
|
22
22
|
setValue: (value: unknown) => void;
|
|
23
|
-
shouldSkipOnChange: () => boolean;
|
|
24
23
|
value: unknown;
|
|
25
24
|
}>): {
|
|
26
25
|
readonly applyChangeEventsRef: import("react").RefObject<((selected: unknown) => void) | null>;
|
|
@@ -36,7 +35,6 @@ export declare function useInputCore(props: InputCoreProps, deps: Readonly<{
|
|
|
36
35
|
readonly onBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
37
36
|
readonly onValueChangeRef: import("react").RefObject<((value: Value) => void) | null>;
|
|
38
37
|
readonly setTimeoutRef: (callback: () => void, delay: number) => void;
|
|
39
|
-
readonly shouldSkipOnChange: () => boolean;
|
|
40
38
|
readonly validated: (value: Value) => void;
|
|
41
39
|
readonly valueRef: import("react").RefObject<unknown>;
|
|
42
40
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Field, Schema } from '../../../../luna-core/index';
|
|
2
|
-
export declare function useInput(field: Field,
|
|
2
|
+
export declare function useInput(field: Field, onRegister: (name: string, schema: Schema, field: Field) => void, onUnmount: (name: string, options?: {
|
|
3
3
|
keepValue?: boolean;
|
|
4
4
|
}) => void, translations?: Record<string, string>): import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
|