react-luna-form 0.0.73 → 0.0.75
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/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/helper/input.d.ts +7 -7
- package/dist/types/luna-core/type.d.ts +4 -0
- package/dist/types/luna-core/util/build.d.ts +1 -0
- package/dist/types/luna-core/util/date.d.ts +2 -2
- package/dist/types/luna-core/util/translate.d.ts +6 -0
- package/dist/types/luna-react/src/client/component/field/field-list-preview-item.d.ts +2 -1
- package/dist/types/luna-react/src/client/component/field/field-preview.d.ts +2 -1
- package/dist/types/luna-react/src/client/component/field/field.d.ts +2 -0
- package/dist/types/luna-react/src/client/component/guard/list-guard.d.ts +1 -1
- package/dist/types/luna-react/src/client/component/input-strategies.d.ts +1 -0
- package/dist/types/luna-react/src/client/component/slot/slot.d.ts +1 -0
- package/dist/types/luna-react/src/client/hook/use-data-source.d.ts +1 -1
- package/dist/types/luna-react/src/component/field/field-list-item.d.ts +1 -0
- package/dist/types/luna-react/src/component/field/field-list.d.ts +1 -0
- package/dist/types/luna-react/src/component/field/field-set-advanced.d.ts +3 -1
- package/dist/types/luna-react/src/component/field/field-set.d.ts +1 -0
- package/dist/types/luna-react/src/component/field/field.d.ts +2 -0
- package/dist/types/luna-react/src/component/form.d.ts +1 -0
- package/dist/types/luna-react/src/component/input/input-base.d.ts +2 -0
- package/dist/types/luna-react/src/component/list.d.ts +2 -1
- package/dist/types/luna-react/src/component/slot/list-slot.d.ts +1 -1
- package/dist/types/luna-react/src/component/slot/slot-base.d.ts +1 -0
- package/dist/types/luna-react/src/component/slot/slot-create.d.ts +1 -0
- package/dist/types/luna-react/src/component/slot/slot-list.d.ts +1 -0
- package/dist/types/luna-react/src/component/slot/slot.d.ts +1 -0
- package/package.json +4 -4
package/dist/server/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as cr}from"react/jsx-runtime";function Se(e){let t=typeof e.children=="function"?e.children({isPending:e.isPending}):e.children;return cr("div",{"data-slot":"field-control",className:"w-full",children:t})}import{jsx as Ae}from"react/jsx-runtime";function N(e){return Ae("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:Ae("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 ur}from"react";import{createContext as dr}from"react";var ve=dr(!1);import{jsx as Ie}from"react/jsx-runtime";function w({children:e,visible:t}){return Ie(ur,{mode:t?"visible":"hidden",children:Ie(ve,{value:!0,children:e})})}var z="input",we="input/date",ke="input/email",Ee="input/number";var Le="input/time";var De="textarea",Oe="radio",Pe="checkbox",re="list";var Me="select",_e="select/active",Ve="select/day",ze="select/month",$e="select/timezone",He="select/year";var Ge="chips",Be="chips/day",Ue="chips/month",k="column",Ye="description",oe="fields",Xe="label",ie="value",$="options",le="email",Ke="number",Ze="password",We="tel",E="text",qe="aria-errormessage",Je="aria-invalid",Qe="data-invalid",je="data-readonly",et="aria",tt="data",nt="max",rt="maxLength",ot="min",it="minLength",S="$ref";var lt="type",at={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};import{format as mr,formatDistanceToNow as st,formatDuration as gr,intervalToDuration as pr,isValid as H,parseISO as xr}from"date-fns";import{enUS as ct,es as ae}from"date-fns/locale";function u(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function p(e){return d(e)||typeof e=="number"||fr(e)}function d(e){return typeof e=="string"}function fr(e){return typeof e=="boolean"}var dt={en:ct,"en-US":ct,es:ae,"es-ES":ae,"es-MX":ae},yr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},br={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function ut(e){if(e)return dt[e]??dt[e.split("-")[0]]}function G(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 ft(e,t,n){let r=br[t];if(r===void 0)return String(e);let o=e*r,i=pr({start:0,end:o});return gr(i,{locale:n})}function mt(e){if(e instanceof Date)return H(e)?e:null;if(d(e)){let t=xr(e);if(H(t))return t;let n=new Date(e);return H(n)?n:null}if(typeof e=="number"){let t=new Date(e);return H(t)?t:null}return null}var hr={currency:(e,t,n)=>{let r=G(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=G(e);return r===null?String(e):new Intl.NumberFormat(n.locale,{style:"percent"}).format(r)},number:(e,t,n)=>{let r=G(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=ut(n.locale);if(o==="relative")return st(r,{addSuffix:!0,locale:i});let l=yr[o]??o;return mr(r,l,{locale:i})},duration:(e,t,n)=>{let r=ut(n.locale);if(typeof e=="number")return ft(e,t[0]??"ms",r);if(d(e)){let i=G(e);if(i!==null)return ft(i,t[0]??"ms",r)}let o=mt(e);return o?st(o,{addSuffix:!0,locale:r}):String(e)}};function gt(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=hr[o];if(l)return l(e,i,n)}function pt(e,t=ie){if(e!=null){if(Array.isArray(e)&&e.every(p)||p(e))return e;if(u(e)){let n=Tr(e,t);if(p(n))return n}}}function Tr(e,t){let n=x(e,t);if(p(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)&&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 xt(e,t={description:Ye,label:Xe,value:ie}){return e.map(n=>{if(u(n)){let r=x(n,t.label),o=x(n,t.value);if(p(r)&&p(o)){let i=x(n,t.description);return{label:`${r}`,value:`${o}`,...p(i)&&{description:`${i}`}}}}return n})}function yt(e=E){let t=e.lastIndexOf("/"),n=t===-1?e:e.slice(t+1);return n&&n!==z?n.trim().toLowerCase():E}var Rr=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g;function se(e,t={},n={}){if(d(e))return Fr(e,t,n);if(Array.isArray(e))return e.map(r=>se(r,t,n));if(u(e)){let r={};for(let o in e)r[o]=se(e[o],t,n);return r}return e}function L(e,t={},n={}){return ce(e)?se(e,t,n):e}function ce(e){return d(e)?/{([^}]{1,200})}/.test(e):Array.isArray(e)?e.some(t=>ce(t)):u(e)?Object.values(e).some(t=>ce(t)):!1}function Fr(e,t={},n={}){return e.replace(/{([^}]{1,200})}/g,(r,o)=>{let i=String(o).split("|").map(g=>g.trim()),[l,...a]=i;if(!l)return r;let s=l.includes(".")?x(t,l):t[l];if(a.length===0)return p(s)?String(s):r;if(s==null)return r;let c=s;for(let g of a){let V=gt(c,g,{locale:n.locale});if(V===void 0)return r;c=V}return String(c)})}function bt(e,t){if(!d(e)||!e||e.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=Rr.exec(e))!==null;){let[l,a,s]=n,c=n.index;o=!0,c>r&&i.push(e.substring(r,c));let g=t?t(c,s,a):l;i.push(g),r=c+l.length}return o?(r<e.length&&i.push(e.substring(r)),i):e}var ht=e=>f(_e)(e),Tt=e=>f(Ve)(e),Rt=e=>f(ze)(e),Ft=e=>f(He)(e),Ct=e=>f($e)(e),Nt=e=>f(Be)(e),St=e=>f(Ue)(e),At=f(we),de=f(Le),y=f(Pe),A=f(Ge),F=f(Oe),vt=f(z),h=f(Me),It=f(De),wt=f(E,le,Ze,We),ui=f(ke,le),kt=f(Ee,Ke);function Et(e){return F(e)||y(e)}function B(e){return e.type===re}function v(e){return e.type===k}function U(e){return e.type!==k&&e.type!==re}function ue(e){return h(e)||F(e)||A(e)}function I(e){return e!=null&&e!==""}function f(...e){return t=>{let n=d(t.type)?t.type:void 0;return n?e.some(r=>n===r||n?.startsWith(`${r}/`)):!1}}function Lt(e,t={}){if(h(e)&&e.disabled){let n=e.name?t?.[e.name]:void 0;if(n&&u(n))return[n]}}function Dt(e){return F(e)||y(e)?!0:e.advanced?.horizontal??!1}function Ot(e){return y(e)?e.advanced?.reverse!==!1:!1}function Pt(e,t){let n=e.readonly??!1;return t||n}function Mt(e){if(Cr(e)){let t=e.source;if(Array.isArray(t)||u(t)&&!(S in t))return t}}function Cr(e){return F(e)||A(e)||h(e)&&!e.disabled}import{isValid as zt,parse as $t,format as Ht}from"date-fns";var Nr=/^\d+$/,Gt=new Date(2e3,0,1),Sr=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[];function fe(){return Array.from({length:12},(e,t)=>({value:(t+1).toString(),label:new Date(0,t).toLocaleString("default",{month:"long"})}))}function me(){return Array.from({length:7},(e,t)=>({value:t.toString(),label:new Date(2e3,0,2+t).toLocaleString("default",{weekday:"long"})}))}function Bt(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 ge(){return new Date().getFullYear()}function Ar(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function vr(e){let t=e.indexOf("/"),n=t===-1?e:e.slice(0,t);return at[n]??"Other"}function Ir(e,t){return(e.find(r=>r.type==="timeZoneName")?.value??t).replace(/\s+(?:Standard|Daylight(?: Saving)?|Summer|Winter)\s+Time$/,"")}function _t(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=Ir(r,e);return{offset:i,longName:l}}function Vt(e){return e.slice(e.lastIndexOf("/")+1).replace(/_/g," ")}function Ut(){let e=new Date,t=Ar(),n=new Map,r=Vt(t),{offset:o,longName:i}=_t(t,e),l={value:t,label:`${r} - ${i} (${o})`};for(let s of Sr()){if(s===t)continue;let c=Vt(s),{offset:g,longName:V}=_t(s,e),Ce={value:s,label:`${c} - ${V} (${g})`},ne=vr(s);if(ne==="Other")continue;let Ne=n.get(ne);Ne?Ne.push(Ce):n.set(ne,[Ce])}for(let s of n.values())s.sort((c,g)=>c.label.localeCompare(g.label));let a=Array.from(n.entries()).sort(([s],[c])=>s.localeCompare(c)).map(([s,c])=>({label:s,items:c}));return[{label:"Suggested",items:[l]},...a]}function pe(e,t){if(typeof e=="number")return e;let n=t??ge(),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 Nr.test(r)?parseInt(r,10):n}function Yt(e,t){if(!e)return"";try{let n=$t(e,t,Gt);return zt(n)?Ht(n,"yyyy-MM-dd"):""}catch{return""}}function Xt(e,t){if(!e)return"";try{let n=$t(e,t,Gt);return zt(n)?Ht(n,"HH:mm:ss"):""}catch{return""}}function xe(e){return e.advanced?.format??"HH:mm"}function Kt(e){return e.advanced?.format??"MMMM d, yyyy"}var Y=ge();function wr(e){if(A(e))return kr(e)}function kr(e){if(Nt(e))return me();if(St(e))return fe()}function Er(e){if(h(e))return Lr(e)}function Lr(e){if(Tt(e))return me();if(Rt(e))return fe();if(Ft(e)){let t=e.advanced?.length?.min??Y,n=e.advanced?.length?.max??Y+5;return Bt(pe(t,Y),pe(n,Y))}if(Ct(e))return Ut();if(ht(e))return[{value:"true",label:"Yes"},{value:"false",label:"No"}]}function Zt(e,t=!1){let n={disabled:t,id:e.name,name:e.name,placeholder:e.placeholder,required:e.required};return vt(e)?{...n,...Dr(e)}:h(e)?{...n,...Wt(e,Er)}:It(e)?{...n,...Pr(e)}:A(e)?{...n,...Or(e)}:n}function Dr(e){let t=yt(e.type),n={...e,type:t};return{..._r(e),...qt(e),...Mr(n),...wt(n)?Jt(n):{},type:t}}function Wt(e,t){let n=t(e);return n?{options:n}:{}}function Or(e){let t=Wt(e,wr),n=e.advanced?.multiple??!0;return{...t,multiple:n}}function Pr(e){return{...qt(e),...Jt(e)}}function qt(e){let t=e.advanced?.autocomplete;return t?{autoComplete:t}:{}}function Mr(e){return kt(e)?Vr(e):{}}function _r(e){if(de(e)){let t=xe(e);return{step:t==="HH:mm:ss"||t==="hh:mm:ss a"?"1":"60"}}return{}}function Jt(e){return Qt(e,{min:it,max:rt})}function Vr(e){return Qt(e,{min:ot,max:nt})}function Qt(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 jt(e,t){let n=Mt(e);return n||Lt(e,t)}function zr(e,t){let n=u(t)&&e.name in t?t[e.name]:t,r=pt(n,e.advanced?.entity),o=I(r)?r:e.defaultValue;return de(e)&&I(o)?$r(e,o):At(e)&&I(o)?Ur(e,o):o}function $r(e,t){let n=xe(e);return d(t)?Xt(t,n):t}function Hr(e,t,n){return ue(e)&&Array.isArray(n)?{...t,[$]:n}:t}function Gr(e,t,n){if(e.required&&!I(n)&&h(e)&&e.advanced?.preselected!==!1&&$ in t){let r=t[$];if(Array.isArray(r)&&r.length===1)return r[0]}return n}function Br(e,t){return ue(e)&&Array.isArray(t)?xt(t,e.advanced?.options):t}function en(e,t,n,r){let o=zr(e,r),i=Array.isArray(n)?Br(e,n):n,l=Hr(e,t,i),a=Gr(e,l,o);return{commonPropsWithOptions:l,defaultValue:a}}function tn(e,t){return y(e)?{defaultChecked:I(t)}:{defaultValue:t}}function Ur(e,t){let n=Kt(e);return d(t)?Yt(t,n):t}var Yr=/^#\/definition\//;function K(e=[],t){let n=X(e,t);return Array.isArray(n)?n.filter(Kr).sort((r,o)=>nn(r)-nn(o)):[]}function X(e,t,n=new Map,r=new WeakSet){if(!Xr(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=>X(i,t,n,r));if(S in e&&d(e[S])){let i=e[S].replace(Yr,""),l=x(t,i);return l!==null?X(l,t,n,r):e}let o={};for(let[i,l]of Object.entries(e))o[i]=X(l,t,n,r);return r.delete(e),n.set(e,o),o}function rn(e){return Object.entries(e??{})}function nn(e){return e.order??Number.MAX_VALUE}function Xr(e){return e!==void 0&&u(e)&&Object.keys(e).length>0}function Kr(e){return lt in e?!0:Array.isArray(e[oe])?e[oe].length>0:!0}function on(e,t){let n={};for(let[r,o]of rn(t))n[`${e}-${r}`]=o;return n}function Zr(e){return on(et,e)}function Wr(e){return on(tt,e)}function ln(e,t){let n=Zr(e.advanced?.aria);return t&&t.length>0&&(n[Je]="true",n[qe]=`${e.name}-error`),n}function an(e){return Wr(e.advanced?.data)}var sn={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},cn={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function dn(e,t=2){return sn[e&&e in sn?e:t]}function un(e){if(e&&e in cn)return cn[e]}function qr(e,t){let n=e.advanced?.length?.min??1;if(t){let r=x(t,e.name);if(Array.isArray(r))return Math.max(r.length,n)}return Math.max(n,0)}function fn(e){return!Array.isArray(e.fields)||e.fields.length===0?!1:e.fields.length>1||e.fields[0].type===k}function mn(e,t){let n=qr(e,t);return Array.from({length:n},(r,o)=>o)}function gn(e){return e.advanced?.title??e.label??e.name}function C(e,t){return e?t?t[e]??e:e:""}function Z(e,t){return{...e,...t}}import{jsx as Jr}from"react/jsx-runtime";function b(e){return bt(e,(t,n,r)=>Jr("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${t}`))}import{useCallback as Qr,useState as jr}from"react";import{jsx as D,jsxs as ye}from"react/jsx-runtime";function pn(e){let{fields:t=[]}=e.section,[n,r]=jr(!1),o=Qr(()=>r(i=>!i),[]);return ye("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:[D("legend",{children:ye("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:[D(N,{expanded:n}),D("span",{children:b(e.section.title)})]})}),D(w,{visible:n,children:ye("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.section.description&&D("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:b(e.section.description)}),e.group]})})]})}import{jsx as W,jsxs as xn}from"react/jsx-runtime";function yn(e){let t=xn("div",{className:"flex flex-col",children:[e.title&&W("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:b(e.title)}),e.description&&W("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:b(e.description)})]});return e.step?xn("div",{className:"flex flex-row items-start gap-4",children:[W("div",{className:"bg-primary text-primary-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:W("span",{className:"text-sm font-bold",children:e.step})}),t]}):t}import{jsx as bn,jsxs as eo}from"react/jsx-runtime";function q(e){return eo("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:[bn(yn,{description:e.description,step:e.step,title:e.title}),bn("div",{className:"w-full min-w-0",children:e.children})]})}import{jsx as to}from"react/jsx-runtime";function T(e){return to("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 be}from"react/jsx-runtime";function hn(e){let{fields:t=[]}=e.section,n=e.advanced?.step?e.step:void 0,{compact:r}=Z(e.style,{compact:e.section.advanced?.compact}),o=be(T,{compact:r,children:e.children});return!e.section.title&&!e.section.description?o:e.section.advanced?.collapsible?be(pn,{section:e.section,group:o}):be(q,{description:e.section.description,empty:t.length===0,id:e.section.id?.toString(),step:n,title:e.section.title,children:o})}import{jsx as Tn}from"react/jsx-runtime";function Rn(){return Tn("div",{"data-slot":"field-separator",className:"relative -my-2 h-5 text-sm",children:Tn("div",{className:"absolute inset-0 top-1/2 h-px w-full bg-zinc-200 dark:bg-zinc-800"})})}import{useAtomValue as so}from"jotai";import{atom as O}from"jotai";import{atomFamily as no}from"jotai-family";import{deepEqual as Fn}from"fast-equals";function ro(e,t){let{[t]:n,...r}=e;return r}function oo(e){return no(t=>O(n=>n(e)[t]??void 0,(n,r,o)=>{let i=n(e);if(o!=null){let l=i[t];Fn(l,o)||r(e,{...i,[t]:o})}else t in i&&r(e,ro(i,t))}))}function io(e){return O(null,(t,n)=>{let r=t(e);r&&Object.keys(r).length>0&&n(e,{})})}function lo(e){return O(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 ao(e){return O(null,(t,n,r)=>{let o=t(e);Fn(o,r)||n(e,r)})}function J(e={}){let t=O(e);return{atom:t,clearAll:io(t),clear:lo(t),bulkReport:ao(t),report:oo(t)}}var Cn=J(),Nn=Cn.atom,Sn=Cn.report;function co(e,t){return e.fields.every(n=>An(n,t))}function An(e,t){return t[e.name]?.hidden??e.hidden??!1}function uo(e,t){return v(e)?co(e,t):An(e,t)}function vn(e){let t=so(Nn);return e.container&&(t[e.container.name]?.hidden??e.container.hidden??!1)||e.fields.length===0||e.fields.every(r=>uo(r,t))?null:e.children}import{jsx as P,jsxs as In}from"react/jsx-runtime";function wn(e){let t=K(e.sections,e.definition);return P("div",{className:"h-full w-full",children:P("form",{noValidate:e.noValidate,action:e.action,children:In(T,{children:[t.map((n,r)=>In(vn,{fields:n.fields??[],children:[P(hn,{advanced:e.advanced,section:n,step:r+1,style:e.config.style,children:e.children({disabled:e.readOnly,fields:n.fields})}),n.advanced?.separator&&P(Rn,{})]},`key-${n.id}-${r}`)),e.control&&P(Se,{isPending:e.isPending,children:e.control})]})})})}import{jsx as fo}from"react/jsx-runtime";function kn(e){return fo("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 mo}from"react";import{jsx as En,jsxs as Ln}from"react/jsx-runtime";function Q(e){let t={context:e.context,env:e.config?.env,value:e.value},r={locale:e.config?.env?.locale},[o,i]=mo(()=>u(e.text)&&"collapsed"in e.text?!e.text.collapsed:!0),l=()=>i(g=>!g),a=u(e.text)&&d(e.text.title)?b(C(L(e.text.title,t,r),e.translations)):void 0,s=C(L(d(e.text)?e.text:e.text?.message,t,r),e.translations),c=b(s);return c?Ln("div",{className:"flex flex-col gap-2",children:[a&&Ln("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,En(N,{expanded:o})]}),o&&En(kn,{title:s,children:c})]}):null}var j=J(),$l=j.atom,Hl=j.clearAll,Gl=j.clear,Dn=j.report;import{useAtomValue as On}from"jotai";import{jsx as go}from"react/jsx-runtime";function ee(e){let t=On(Dn(e.field.name)),r=On(Sn(e.field.name))?.description??e.field.description;return go(Q,{config:e.config,context:e.context,text:r,translations:e.translations,value:t})}import{twMerge as po}from"tailwind-merge";import{jsx as Pn,jsxs as xo}from"react/jsx-runtime";function Mn(e){let t=e.style?.showOptionalLabel??!0,n=F(e.field)||y(e.field);return xo("label",{"data-slot":"field-label","data-normal":n,className:po("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:[Pn("span",{className:"[[data-slot=column]_&]:md:truncate",children:e.children}),t&&!e.field.required&&Pn("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:C("(Optional)",e.translations)})]})}import{jsx as _n,jsxs as yo}from"react/jsx-runtime";function Vn(e){let t={context:e.context,env:e.config?.env},n=L(e.field.label,t);return yo("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[_n(Mn,{field:e.field,style:e.config?.style,translations:e.translations,children:C(n,e.translations)}),e.horizontal===!0&&_n(ee,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}import{Fragment as bo,jsx as zn,jsxs as ho}from"react/jsx-runtime";function $n(e){return ho(bo,{children:[e.field.name&&e.field.label&&zn(Vn,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&zn(ee,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}function Hn(e,t){return e?t(e):null}import{jsx as Gn}from"react/jsx-runtime";function Bn(e){let t=jt(e.field,e.value),{commonPropsWithOptions:n,defaultValue:r}=en(e.field,e.commonProps,t,e.value),o=tn(e.field,r);return Hn(e.config.inputs[e.field.type],i=>Gn($n,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:Gn(i,{...e.ariaAttributes,...n,...e.dataAttributes,...o})}))}import{jsx as Un}from"react/jsx-runtime";function Yn(e){return!e.errors||e.errors.length===0?null:Un("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)=>Un("li",{children:t},e.name?`${e.name}-error-${n}`:n))})}import{twMerge as To}from"tailwind-merge";import{jsx as Ro}from"react/jsx-runtime";function te(e){let t=e.errors&&e.errors.length>0;return Ro("div",{"data-slot":"field","data-clickable":e.isClickable?"true":"false",...t&&{[Qe]:"true"},...e.disabled&&{[je]:"true"},"data-orientation":e.orientation,className:To("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 Fo}from"tailwind-merge";import{jsx as Co}from"react/jsx-runtime";function Xn(e){return Co(te,{...e,orientation:"vertical",className:Fo("gap-3 has-[>[data-slot=field-content]]:items-start",!e.isClickable&&"[&>*]:w-full"),children:e.children})}import{twMerge as No}from"tailwind-merge";import{jsx as So}from"react/jsx-runtime";function Kn(e){return So(te,{...e,orientation:"horizontal",className:No("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 Zn}from"react/jsx-runtime";function Wn(e){let t=Et(e.field),n=y(e.field),r=Ot(e.field);return e.horizontal?Zn(Kn,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children}):Zn(Xn,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children})}function qn(e){if(!e.field.type)return null;let t=Zt(e.field,e.disabled),n=an(e.field),r=ln(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 Ao}from"tailwind-merge";import{jsx as he,jsxs as vo}from"react/jsx-runtime";function Jn(e){let t=e.field.advanced?.cols,n=e.field.name?e.errors?.[e.field.name]:void 0,{horizontal:r}=Z(e.style,{horizontal:Dt(e.field)}),o=Pt(e.field,e.disabled);return vo("div",{className:Ao("flex flex-col gap-3",un(t)),children:[he(Wn,{disabled:o,errors:n,field:e.field,horizontal:r,children:he(qn,{disabled:o,errors:n,field:e.field,horizontal:r,children:e.children})}),he(Yn,{errors:n,name:e.field.name})]})}import{twMerge as Te}from"tailwind-merge";import{useState as Io}from"react";import{Fragment as wo,jsx as m,jsxs as R}from"react/jsx-runtime";function Qn(e){let t=e.isMultiField||e.collapsed!=null,[n,r]=Io(t?!e.collapsed:!0);function o(){e.canRemove&&e.onRemove&&e.onRemove(e.index)}function i(){r(c=>!c)}let l=e.canRemove&&e.onRemove!=null&&m("button",{"aria-label":`Remove ${e.label} item ${e.index+1}`,className:Te("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:m("span",{"aria-hidden":"true",className:"leading-none",children:"\xD7"})}),a=R("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??R(wo,{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})]}),s=R("div",{className:Te("flex items-center justify-between gap-2",e.isMultiField&&n&&"mb-3"),children:[t?R("div",{className:"flex min-w-0 grow items-center gap-2",children:[R("button",{"aria-expanded":n,"aria-label":`${n?"Collapse":"Expand"} ${e.label} ${e.index+1}`,className:Te("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:[m(N,{expanded:n}),a]}),!n&&e.previewBadge&&m("div",{className:"ml-auto shrink-0",children:e.previewBadge})]}):a,l]});return e.isMultiField?R("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:[s,m(w,{visible:n,children:m(T,{children:e.children})})]}):t?R("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[s,m(w,{visible:n,children:m(T,{children:e.children})})]}):R("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})}),l&&m("div",{className:"shrink-0",children:l})]})}import{jsx as ko}from"react/jsx-runtime";function jn(e){let t=gn(e.field),n=fn(e.field);return mn(e.field,e.value).map(r=>ko(Qn,{collapsed:e.field.advanced?.collapsed,index:r,isMultiField:n,label:t,children:e.children(r)},r))}import{jsx as Eo}from"react/jsx-runtime";function er(e){let t=Array.isArray(e.field.fields)&&e.field.fields.length===0;return Eo(q,{description:e.field.description,empty:t,id:e.field.name,title:e.field.label,children:e.children})}import{jsx as tr}from"react/jsx-runtime";function nr({children:e,field:t,translations:n,value:r}){return tr(er,{field:t,children:tr(jn,{field:t,translations:n,value:r,children:e})})}import{twMerge as Lo}from"tailwind-merge";import{jsx as rr,jsxs as Do}from"react/jsx-runtime";function or(e){let t=dn(e.column?.advanced?.cols);return Do("div",{className:"flex w-full flex-col gap-4",children:[rr("div",{"data-slot":"column",className:Lo("grid grid-cols-1 gap-3 sm:gap-4",t),children:e.children}),e.column?.description&&rr(Q,{config:e.config,context:e.context,text:e.column.description,translations:e.translations})]})}import{Fragment as Po}from"react";import{jsx as Oo}from"react/jsx-runtime";function ir(e){let t=Array.isArray(e.field.fields)?e.field.fields.map(n=>U(n)||B(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 Oo(M,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,fields:t,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})}import{jsx as _,jsxs as Mo}from"react/jsx-runtime";function M(e){let{field:t,list:n}=e.components;return K(e.fields).map((r,o)=>Mo(Po,{children:[v(r)&&_(or,{column:r,config:e.config,context:e.context,translations:e.translations,children:_(M,{...e,fields:r.fields})}),U(r)&&_(t,{disabled:e.disabled,field:r,style:e.style,children:e.children}),B(r)&&_(n,{field:r,onValueChange:e.onValueChange,translations:e.translations,value:e.value,children:i=>_(ir,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,field:r,index:i,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})})]},o))}import{jsx as _o}from"react/jsx-runtime";function lr(e){return n=>_o(M,{...n,components:e})}var ar=lr({field:Jn,list:nr});import{jsx as Re}from"react/jsx-runtime";function Fe(e){let t=e.translations?.[e.lang??""];return Re(wn,{advanced:e.advanced,config:e.config,control:e.children,definition:e.definition,readOnly:e.readOnly,sections:e.sections,children:({disabled:n,fields:r})=>Re(ar,{config:e.config,context:e.context,disabled:n,fields:r,style:e.config.style,translations:t,value:e.value,children:o=>Re(Bn,{...o,config:e.config,context:e.context,translations:t,value:e.value})})})}import{Suspense as Vo}from"react";import{jsx as sr}from"react/jsx-runtime";function zo(e){return sr(Vo,{fallback:sr(Fe,{config:e.config,sections:e.sections,readOnly:!0}),children:e.children})}export{zo as Fallback,Fe as Form};
|
|
1
|
+
import{jsx as yr}from"react/jsx-runtime";function Et(t){let e=typeof t.children=="function"?t.children({isPending:t.isPending}):t.children;return yr("div",{"data-slot":"field-control",className:"w-full",children:e})}import{jsx as kt}from"react/jsx-runtime";function N(t){return kt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`size-4 transition-transform duration-200 ${t.expanded?"rotate-90":""}`,children:kt("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 br}from"react";var Lt=br(!1);import{jsx as Ot}from"react/jsx-runtime";function E({children:t,visible:e}){return Ot(Tr,{mode:e?"visible":"hidden",children:Ot(Lt,{value:!0,children:t})})}var U="input",Dt="input/date",Pt="input/email",Mt="input/number";var _t="input/time";var zt="textarea",Vt="radio",Bt="checkbox",at="list";var Ut="select",Ht="select/active",Gt="select/day",$t="select/month",Yt="select/timezone",Kt="select/year";var Xt="chips",Zt="chips/day",Wt="chips/month",k="column",qt="description",st="fields",Jt="label",ct="value",H="options",dt="email",Qt="number",jt="password",te="tel",L="text",ee="aria-errormessage",ne="aria-invalid",re="data-invalid",oe="data-readonly",ie="aria",le="data",ae="max",se="maxLength",ce="min",de="minLength",S="$ref";var ue="type",fe={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};import{format as hr,formatDistanceToNow as me,formatDuration as Cr,intervalToDuration as Fr,isValid as G,parseISO as Nr}from"date-fns";import{enUS as ge,es as ut}from"date-fns/locale";function u(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function p(t){return c(t)||typeof t=="number"||Rr(t)}function c(t){return typeof t=="string"}function Rr(t){return typeof t=="boolean"}var pe={en:ge,"en-US":ge,es:ut,"es-ES":ut,"es-MX":ut},Sr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},Ar={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function xe(t){if(t)return pe[t]??pe[t.split("-")[0]]}function $(t){if(typeof t=="number"&&!Number.isNaN(t))return t;if(c(t)&&t.trim()!==""){let e=Number(t);return Number.isNaN(e)?null:e}return null}function ye(t,e,n){let r=Ar[e];if(r===void 0)return String(t);let o=t*r,i=Fr({start:0,end:o});return Cr(i,{locale:n})}function be(t){if(t instanceof Date)return G(t)?t:null;if(c(t)){let e=Nr(t);if(G(e))return e;let n=new Date(t);return G(n)?n:null}if(typeof t=="number"){let e=new Date(t);return G(e)?e:null}return null}var vr={currency:(t,e,n)=>{let r=$(t);if(r===null)return String(t);let o=e[0]??"USD";return new Intl.NumberFormat(n.locale,{style:"currency",currency:o}).format(r)},percent:(t,e,n)=>{let r=$(t);return r===null?String(t):new Intl.NumberFormat(n.locale,{style:"percent"}).format(r)},number:(t,e,n)=>{let r=$(t);return r===null?String(t):new Intl.NumberFormat(n.locale).format(r)},date:(t,e,n)=>{let r=be(t);if(!r)return String(t);let o=e[0]??"short",i=xe(n.locale);if(o==="relative")return me(r,{addSuffix:!0,locale:i});let l=Sr[o]??o;return hr(r,l,{locale:i})},duration:(t,e,n)=>{let r=xe(n.locale);if(typeof t=="number")return ye(t,e[0]??"ms",r);if(c(t)){let i=$(t);if(i!==null)return ye(i,e[0]??"ms",r)}let o=be(t);return o?me(o,{addSuffix:!0,locale:r}):String(t)}};function Te(t,e,n){let r=e.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(t,i,n)}function Re(t,e=ct){if(t!=null){if(Array.isArray(t)&&t.every(p)||p(t))return t;if(u(t)){let n=Ir(t,e);if(p(n))return n}}}function Ir(t,e){let n=x(t,e);if(p(n))return n}function x(t,e){if(!e||!u(t))return null;let n=e.split(".").filter(o=>o!=="");if(n.length===0)return null;let r=t;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 he(t,e={description:qt,label:Jt,value:ct}){return t.map(n=>{if(u(n)){let r=x(n,e.label),o=x(n,e.value);if(p(r)&&p(o)){let i=x(n,e.description);return{label:`${r}`,value:`${o}`,...p(i)&&{description:`${i}`}}}}return n})}function Ce(t=L){let e=t.lastIndexOf("/"),n=e===-1?t:t.slice(e+1);return n&&n!==U?n.trim().toLowerCase():L}var wr=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g;function O(t,e={},n={}){if(c(t))return Er(t,e,n);if(Array.isArray(t))return t.map(r=>O(r,e,n));if(u(t)){let r={};for(let o in t)r[o]=O(t[o],e,n);return r}return t}function D(t,e={},n={}){return ft(t)?O(t,e,n):t}function ft(t){return c(t)?/{([^}]{1,200})}/.test(t):Array.isArray(t)?t.some(e=>ft(e)):u(t)?Object.values(t).some(e=>ft(e)):!1}function Er(t,e={},n={}){return t.replace(/{([^}]{1,200})}/g,(r,o)=>{let i=String(o).split("|").map(m=>m.trim()),[l,...a]=i;if(!l)return r;let s=l.includes(".")?x(e,l):e[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=Te(d,m,{locale:n.locale});if(B===void 0)return r;d=B}return String(d)})}function Fe(t,e){if(!c(t)||!t||t.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=wr.exec(t))!==null;){let[l,a,s]=n,d=n.index;o=!0,d>r&&i.push(t.substring(r,d));let m=e?e(d,s,a):l;i.push(m),r=d+l.length}return o?(r<t.length&&i.push(t.substring(r)),i):t}var Ne=t=>f(Ht)(t),Se=t=>f(Gt)(t),Ae=t=>f($t)(t),ve=t=>f(Kt)(t),Ie=t=>f(Yt)(t),we=t=>f(Zt)(t),Ee=t=>f(Wt)(t),ke=f(Dt),mt=f(_t),y=f(Bt),A=f(Xt),F=f(Vt),Le=f(U),R=f(Ut),Oe=f(zt),De=f(L,dt,jt,te),Ci=f(Pt,dt),Pe=f(Mt,Qt);function Me(t){return F(t)||y(t)}function Y(t){return t.type===at}function v(t){return t.type===k}function K(t){return t.type!==k&&t.type!==at}function gt(t){return R(t)||F(t)||A(t)}function I(t){return t!=null&&t!==""}function f(...t){return e=>{let n=c(e.type)?e.type:void 0;return n?t.some(r=>n===r||n?.startsWith(`${r}/`)):!1}}function _e(t,e={}){if(R(t)&&t.disabled){let n=t.name?e?.[t.name]:void 0;if(n&&u(n))return[n]}}function ze(t){return F(t)||y(t)?!0:t.advanced?.horizontal??!1}function Ve(t){return y(t)?t.advanced?.reverse!==!1:!1}function Be(t,e){let n=t.readonly??!1;return e||n}function pt(t){if(kr(t)){let e=t.source;if(Array.isArray(e)||u(e)&&!(S in e))return e}}function Ue(t){return Array.isArray(pt(t))}function kr(t){return F(t)||A(t)||R(t)&&!t.disabled}import{isValid as $e,parse as Ye,format as Ke}from"date-fns";var Lr=/^\d+$/,Xe=new Date(2e3,0,1),Or=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[],xt="default";function Ze(t){if(!t)return xt;try{return Intl.getCanonicalLocales(t)[0]??xt}catch{return xt}}function yt(t){let e=Ze(t);return Array.from({length:12},(n,r)=>({value:(r+1).toString(),label:new Date(0,r).toLocaleString(e,{month:"long"})}))}function bt(t){let e=Ze(t);return Array.from({length:7},(n,r)=>({value:r.toString(),label:new Date(2e3,0,2+r).toLocaleString(e,{weekday:"long"})}))}function We(t,e){return e>=t?Array.from({length:e-t+1},(n,r)=>{let o=t+r;return{value:o.toString(),label:o.toString()}}):[]}function Tt(){return new Date().getFullYear()}function Dr(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function Pr(t){let e=t.indexOf("/"),n=e===-1?t:t.slice(0,e);return fe[n]??"Other"}function Mr(t,e){return(t.find(r=>r.type==="timeZoneName")?.value??e).replace(/\s+(?:Standard|Daylight(?: Saving)?|Summer|Winter)\s+Time$/,"")}function He(t,e){let n=new Intl.DateTimeFormat("en",{timeZone:t,timeZoneName:"longOffset"}).formatToParts(e),r=new Intl.DateTimeFormat("en",{timeZone:t,timeZoneName:"long"}).formatToParts(e),i=(n.find(a=>a.type==="timeZoneName")?.value??"GMT+00:00").replace("GMT","UTC"),l=Mr(r,t);return{offset:i,longName:l}}function Ge(t){return t.slice(t.lastIndexOf("/")+1).replace(/_/g," ")}function qe(){let t=new Date,e=Dr(),n=new Map,r=Ge(e),{offset:o,longName:i}=He(e,t),l={value:e,label:`${r} - ${i} (${o})`};for(let s of Or()){if(s===e)continue;let d=Ge(s),{offset:m,longName:B}=He(s,t),It={value:s,label:`${d} - ${B} (${m})`},lt=Pr(s);if(lt==="Other")continue;let wt=n.get(lt);wt?wt.push(It):n.set(lt,[It])}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 Rt(t,e){if(typeof t=="number")return t;let n=e??Tt(),r=t.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 Lr.test(r)?parseInt(r,10):n}function Je(t,e){if(!t)return"";try{let n=Ye(t,e,Xe);return $e(n)?Ke(n,"yyyy-MM-dd"):""}catch{return""}}function Qe(t,e){if(!t)return"";try{let n=Ye(t,e,Xe);return $e(n)?Ke(n,"HH:mm:ss"):""}catch{return""}}function ht(t){return t.advanced?.format??"HH:mm"}function je(t){return t.advanced?.format??"MMMM d, yyyy"}var _r={es:{"(Optional)":"(Opcional)","Add item":"A\xF1adir elemento","Collapse {label} {index}":"Contraer {label} {index}","Expand {label} {index}":"Expandir {label} {index}","Remove {label} item {index}":"Eliminar {label} {index}","Unknown error":"Error desconocido",No:"No",Yes:"S\xED"}};function X(t,e){return b(t,e)}function en(t,e){let n=e?.[t??""],r=t?_r[zr(t)]:void 0;return r?n?{...r,...n}:r:n}function zr(t){return t.toLowerCase().split(/[-_]/)[0]}function b(t,e){return t?e?e[t]??t:t:""}function w(t,e){return t?b(t,e):void 0}function Z(t,e){if(!e)return t;let n=!1,r=t.map(o=>{let i=Vr(o,e);return i!==o&&(n=!0),i});return n?r:t}function Vr(t,e){if(!u(t))return t;let n=tn(t.label,e),r=t.items;if(Array.isArray(r)){let i=Z(r,e);return i===r&&n===t.label?t:{...t,...n!==void 0&&{label:n},items:i}}let o=tn(t.description,e);return n===t.label&&o===t.description?t:{...t,...n!==void 0&&{label:n},...o!==void 0&&{description:o}}}function tn(t,e){return c(t)?b(t,e):t}var W=Tt();function Br(t,e){if(A(t))return Ur(t,e?.lang)}function Ur(t,e){if(we(t))return bt(e);if(Ee(t))return yt(e)}function Hr(t,e){if(R(t))return Gr(t,e)}function Gr(t,e){let{lang:n,translations:r}=e??{};if(Se(t))return bt(n);if(Ae(t))return yt(n);if(ve(t)){let o=t.advanced?.length?.min??W,i=t.advanced?.length?.max??W+5;return We(Rt(o,W),Rt(i,W))}if(Ie(t))return qe();if(Ne(t))return Z([{value:"true",label:"Yes"},{value:"false",label:"No"}],r)}function nn(t,e=!1,n){let r={disabled:e,id:t.name,name:t.name,placeholder:t.placeholder,required:t.required};return Le(t)?{...r,...$r(t)}:R(t)?{...r,...rn(Hr(t,n))}:Oe(t)?{...r,...Kr(t)}:A(t)?{...r,...Yr(t,n)}:r}function $r(t){let e=Ce(t.type),n={...t,type:e};return{...Zr(t),...on(t),...Xr(n),...De(n)?ln(n):{},type:e}}function rn(t){return t?{options:t}:{}}function Yr(t,e){let n=rn(Br(t,e)),r=t.advanced?.multiple??!0;return{...n,multiple:r}}function Kr(t){return{...on(t),...ln(t)}}function on(t){let e=t.advanced?.autocomplete;return e?{autoComplete:e}:{}}function Xr(t){return Pe(t)?Wr(t):{}}function Zr(t){if(mt(t)){let e=ht(t);return{step:e==="HH:mm:ss"||e==="hh:mm:ss a"?"1":"60"}}return{}}function ln(t){return an(t,{min:de,max:se})}function Wr(t){return an(t,{min:ce,max:ae})}function an(t,e){let n={},r=t.advanced?.length;return r&&(r.min!==void 0&&(n[e.min]=r.min),r.max!==void 0&&(n[e.max]=r.max)),n}function sn(t,e){let n=pt(t);return n||_e(t,e)}function qr(t,e){let n=u(e)&&t.name in e?e[t.name]:e,r=Re(n,t.advanced?.entity),o=I(r)?r:t.defaultValue;return mt(t)&&I(o)?Jr(t,o):ke(t)&&I(o)?eo(t,o):o}function Jr(t,e){let n=ht(t);return c(e)?Qe(e,n):e}function Qr(t,e,n){return gt(t)&&Array.isArray(n)?{...e,[H]:n}:e}function jr(t,e,n){if(t.required&&!I(n)&&R(t)&&t.advanced?.preselected!==!1&&H in e){let r=e[H];if(Array.isArray(r)&&r.length===1)return r[0]}return n}function to(t,e,n){if(gt(t)&&Array.isArray(e)){let r=he(e,t.advanced?.options);return Ue(t)?Z(r,n):r}return e}function cn(t,e,n,r,o){let i=qr(t,r),l=Array.isArray(n)?to(t,n,o):n,a=Qr(t,e,l),s=jr(t,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function dn(t,e){return y(t)?{defaultChecked:I(e)}:{defaultValue:e}}function eo(t,e){let n=je(t);return c(e)?Je(e,n):e}var no=/^#\/definition\//;function J(t=[],e){let n=q(t,e);return Array.isArray(n)?n.filter(oo).sort((r,o)=>un(r)-un(o)):[]}function q(t,e,n=new Map,r=new WeakSet){if(!ro(e)||!t||typeof t!="object")return t;if(n.has(t))return n.get(t);if(r.has(t))return t;if(r.add(t),Array.isArray(t))return t.map(i=>q(i,e,n,r));if(S in t&&c(t[S])){let i=t[S].replace(no,""),l=x(e,i);return l!==null?q(l,e,n,r):t}let o={};for(let[i,l]of Object.entries(t))o[i]=q(l,e,n,r);return r.delete(t),n.set(t,o),o}function fn(t){return Object.entries(t??{})}function un(t){return t.order??Number.MAX_VALUE}function ro(t){return t!==void 0&&u(t)&&Object.keys(t).length>0}function oo(t){return ue in t?!0:Array.isArray(t[st])?t[st].length>0:!0}function mn(t,e){let n={};for(let[r,o]of fn(e))n[`${t}-${r}`]=o;return n}function io(t){return mn(ie,t)}function lo(t){return mn(le,t)}function gn(t,e){let n=io(t.advanced?.aria);return e&&e.length>0&&(n[ne]="true",n[ee]=`${t.name}-error`),n}function pn(t){return lo(t.advanced?.data)}var xn={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},yn={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function bn(t,e=2){return xn[t&&t in xn?t:e]}function Tn(t){if(t&&t in yn)return yn[t]}function ao(t,e){let n=t.advanced?.length?.min??1;if(e){let r=x(e,t.name);if(Array.isArray(r))return Math.max(r.length,n)}return Math.max(n,0)}function Rn(t){return!Array.isArray(t.fields)||t.fields.length===0?!1:t.fields.length>1||t.fields[0].type===k}function hn(t,e){let n=ao(t,e);return Array.from({length:n},(r,o)=>o)}function Cn(t){return t.advanced?.title??t.label??t.name}function Q(t,e){return{...t,...e}}import{jsx as so}from"react/jsx-runtime";function T(t){return Fe(t,(e,n,r)=>so("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${e}`))}import{useCallback as co,useState as uo}from"react";import{jsx as P,jsxs as Ct}from"react/jsx-runtime";function Fn(t){let{fields:e=[]}=t.section,[n,r]=uo(!1),o=co(()=>r(i=>!i),[]);return Ct("fieldset",{"data-slot":"field-set","data-advanced":"true","data-expanded":n,"data-empty":e.length===0,className:"flex flex-col",id:t.section.id?.toString(),children:[P("legend",{children:Ct("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(N,{expanded:n}),P("span",{children:T(t.title)})]})}),P(E,{visible:n,children:Ct("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:[t.description&&P("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:T(t.description)}),t.group]})})]})}import{jsx as j,jsxs as Nn}from"react/jsx-runtime";function Sn(t){let e=Nn("div",{className:"flex flex-col",children:[t.title&&j("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:T(t.title)}),t.description&&j("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:T(t.description)})]});return t.step?Nn("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:t.step})}),e]}):e}import{jsx as An,jsxs as fo}from"react/jsx-runtime";function tt(t){return fo("fieldset",{className:"flex w-full min-w-0 flex-col data-[empty=false]:gap-6","data-empty":t.empty,"data-slot":"field-set",id:t.id,children:[An(Sn,{description:t.description,step:t.step,title:t.title}),An("div",{className:"w-full min-w-0",children:t.children})]})}import{jsx as mo}from"react/jsx-runtime";function h(t){return mo("div",{"data-slot":"field-group","data-compact":t.compact,className:"flex w-full flex-col gap-8 data-[compact=true]:gap-3",children:t.children})}import{jsx as Ft}from"react/jsx-runtime";function vn(t){let{fields:e=[]}=t.section,n=t.advanced?.step?t.step:void 0,{compact:r}=Q(t.style,{compact:t.section.advanced?.compact}),o=Ft(h,{compact:r,children:t.children});if(!t.section.title&&!t.section.description)return o;let i=w(t.section.title,t.translations),l=w(t.section.description,t.translations);return t.section.advanced?.collapsible?Ft(Fn,{description:l,group:o,section:t.section,title:i}):Ft(tt,{description:l,empty:e.length===0,id:t.section.id?.toString(),step:n,title:i,children:o})}import{jsx as In}from"react/jsx-runtime";function wn(){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 Ro}from"jotai";import{atom as M}from"jotai";import{atomFamily as go}from"jotai-family";import{deepEqual as En}from"fast-equals";function po(t,e){let{[e]:n,...r}=t;return r}function xo(t){return go(e=>M(n=>n(t)[e]??void 0,(n,r,o)=>{let i=n(t);if(o!=null){let l=i[e];En(l,o)||r(t,{...i,[e]:o})}else e in i&&r(t,po(i,e))}))}function yo(t){return M(null,(e,n)=>{let r=e(t);r&&Object.keys(r).length>0&&n(t,{})})}function bo(t){return M(null,(e,n,r)=>{let i={...e(t)},l=!1;for(let a of r)a in i&&(delete i[a],l=!0);l&&n(t,i)})}function To(t){return M(null,(e,n,r)=>{let o=e(t);En(o,r)||n(t,r)})}function et(t={}){let e=M(t);return{atom:e,clearAll:yo(e),clear:bo(e),bulkReport:To(e),report:xo(e)}}var kn=et(),Ln=kn.atom,On=kn.report;function ho(t,e){return t.fields.every(n=>Dn(n,e))}function Dn(t,e){return e[t.name]?.hidden??t.hidden??!1}function Co(t,e){return v(t)?ho(t,e):Dn(t,e)}function Pn(t){let e=Ro(Ln);return t.container&&(e[t.container.name]?.hidden??t.container.hidden??!1)||t.fields.length===0||t.fields.every(r=>Co(r,e))?null:t.children}import{jsx as _,jsxs as Mn}from"react/jsx-runtime";function _n(t){let e=J(t.sections,t.definition);return _("div",{className:"h-full w-full",children:_("form",{noValidate:t.noValidate,action:t.action,children:Mn(h,{children:[e.map((n,r)=>Mn(Pn,{fields:n.fields??[],children:[_(vn,{advanced:t.advanced,section:n,step:r+1,style:t.config.style,translations:t.translations,children:t.children({disabled:t.readOnly,fields:n.fields})}),n.advanced?.separator&&_(wn,{})]},`key-${n.id}-${r}`)),t.control&&_(Et,{isPending:t.isPending,children:t.control})]})})})}import{jsx as Fo}from"react/jsx-runtime";function zn(t){return Fo("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:t.title,children:t.children})}import{useState as No}from"react";import{jsx as Vn,jsxs as Bn}from"react/jsx-runtime";function nt(t){let e={context:t.context,env:t.config?.env,value:t.value},r={locale:t.config?.env?.locale},[o,i]=No(()=>u(t.text)&&"collapsed"in t.text?!t.text.collapsed:!0),l=()=>i(m=>!m),a=u(t.text)&&c(t.text.title)?T(b(D(t.text.title,e,r),t.translations)):void 0,s=b(D(c(t.text)?t.text:t.text?.message,e,r),t.translations),d=T(s);return d?Bn("div",{className:"flex flex-col gap-2",children:[a&&Bn("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,Vn(N,{expanded:o})]}),o&&Vn(zn,{title:s,children:d})]}):null}var rt=et(),jl=rt.atom,ta=rt.clearAll,ea=rt.clear,Un=rt.report;import{useAtomValue as Hn}from"jotai";import{jsx as So}from"react/jsx-runtime";function ot(t){let e=Hn(Un(t.field.name)),r=Hn(On(t.field.name))?.description??t.field.description;return So(nt,{config:t.config,context:t.context,text:r,translations:t.translations,value:e})}import{twMerge as Ao}from"tailwind-merge";import{jsx as Gn,jsxs as vo}from"react/jsx-runtime";function $n(t){let e=t.style?.showOptionalLabel??!0,n=F(t.field)||y(t.field);return vo("label",{"data-slot":"field-label","data-normal":n,className:Ao("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:t.field.name,title:c(t.children)?t.children:void 0,children:[Gn("span",{className:"[[data-slot=column]_&]:md:truncate",children:t.children}),e&&!t.field.required&&Gn("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:X("(Optional)",t.translations)})]})}import{jsx as Yn,jsxs as Io}from"react/jsx-runtime";function Kn(t){let e={context:t.context,env:t.config?.env},n=D(t.field.label,e);return Io("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[Yn($n,{field:t.field,style:t.config?.style,translations:t.translations,children:b(n,t.translations)}),t.horizontal===!0&&Yn(ot,{config:t.config,context:t.context,field:t.field,translations:t.translations})]})}import{Fragment as wo,jsx as Xn,jsxs as Eo}from"react/jsx-runtime";function Zn(t){return Eo(wo,{children:[t.field.name&&t.field.label&&Xn(Kn,{config:t.config,context:t.context,field:t.field,horizontal:t.horizontal,translations:t.translations}),t.children,t.horizontal===!1&&Xn(ot,{config:t.config,context:t.context,field:t.field,translations:t.translations})]})}function Wn(t,e){return t?e(t):null}import{jsx as qn}from"react/jsx-runtime";function Jn(t){let e=sn(t.field,t.value),{commonPropsWithOptions:n,defaultValue:r}=cn(t.field,t.commonProps,e,t.value,t.translations),o=dn(t.field,r);return Wn(t.config.inputs[t.field.type],i=>qn(Zn,{config:t.config,context:t.context,field:t.field,horizontal:t.horizontal,translations:t.translations,children:qn(i,{...t.ariaAttributes,...n,...t.dataAttributes,...o})}))}import{jsx as Qn}from"react/jsx-runtime";function jn(t){return!t.errors||t.errors.length===0?null:Qn("ul",{className:"text-sm text-red-600 dark:text-red-500",id:t.name?`${t.name}-error`:void 0,children:t.errors?.map((e,n)=>Qn("li",{children:e},t.name?`${t.name}-error-${n}`:n))})}import{twMerge as ko}from"tailwind-merge";import{jsx as Lo}from"react/jsx-runtime";function it(t){let e=t.errors&&t.errors.length>0;return Lo("div",{"data-slot":"field","data-clickable":t.isClickable?"true":"false",...e&&{[re]:"true"},...t.disabled&&{[oe]:"true"},"data-orientation":t.orientation,className:ko("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",t.isCheckbox&&(t.isReversed?"flex-row-reverse!":"flex-row!"),"data-[clickable=true]:has-[>[data-slot=field-content]]:[&>:first-child]:mt-px",t.className),children:t.children})}import{twMerge as Oo}from"tailwind-merge";import{jsx as Do}from"react/jsx-runtime";function tr(t){return Do(it,{...t,orientation:"vertical",className:Oo("gap-3 has-[>[data-slot=field-content]]:items-start",!t.isClickable&&"[&>*]:w-full"),children:t.children})}import{twMerge as Po}from"tailwind-merge";import{jsx as Mo}from"react/jsx-runtime";function er(t){return Mo(it,{...t,orientation:"horizontal",className:Po("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]",t.isClickable&&"md:flex-col",!t.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:t.children})}import{jsx as nr}from"react/jsx-runtime";function rr(t){let e=Me(t.field),n=y(t.field),r=Ve(t.field);return t.horizontal?nr(er,{disabled:t.disabled,errors:t.errors,isCheckbox:n,isReversed:r,isClickable:e,children:t.children}):nr(tr,{disabled:t.disabled,errors:t.errors,isCheckbox:n,isReversed:r,isClickable:e,children:t.children})}function or(t){if(!t.field.type)return null;let e=nn(t.field,t.disabled,{lang:t.lang,translations:t.translations}),n=pn(t.field),r=gn(t.field,t.errors),o={...t.field,disabled:e.disabled};return t.children({ariaAttributes:r,commonProps:e,dataAttributes:n,field:o,horizontal:t.horizontal})}import{twMerge as _o}from"tailwind-merge";import{jsx as Nt,jsxs as zo}from"react/jsx-runtime";function ir(t){let e=t.field.advanced?.cols,n=t.field.name?t.errors?.[t.field.name]:void 0,{horizontal:r}=Q(t.style,{horizontal:ze(t.field)}),o=Be(t.field,t.disabled);return zo("div",{className:_o("flex flex-col gap-3",Tn(e)),children:[Nt(rr,{disabled:o,errors:n,field:t.field,horizontal:r,children:Nt(or,{disabled:o,errors:n,field:t.field,horizontal:r,lang:t.lang,translations:t.translations,children:t.children})}),Nt(jn,{errors:n,name:t.field.name})]})}import{twMerge as St}from"tailwind-merge";import{useState as Vo}from"react";import{Fragment as Bo,jsx as g,jsxs as C}from"react/jsx-runtime";function lr(t){let e=t.isMultiField||t.collapsed!=null,[n,r]=Vo(e?!t.collapsed:!0);function o(){t.canRemove&&t.onRemove&&t.onRemove(t.index)}function i(){r(m=>!m)}let l=m=>O(X(m,t.translations),{index:t.index+1,label:t.label}),a=t.canRemove&&t.onRemove!=null&&g("button",{"aria-label":l("Remove {label} item {index}"),className:St("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=C("div",{className:"flex min-w-0 flex-col font-medium text-zinc-700 dark:text-zinc-400",children:[g("span",{className:"text-base",children:t.previewLabel??C(Bo,{children:[t.label," ",t.index+1]})}),!n&&t.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:t.previewTags})]}),d=C("div",{className:St("flex items-center justify-between gap-2",t.isMultiField&&n&&"mb-3"),children:[e?C("div",{className:"flex min-w-0 grow items-center gap-2",children:[C("button",{"aria-expanded":n,"aria-label":l(n?"Collapse {label} {index}":"Expand {label} {index}"),className:St("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(N,{expanded:n}),s]}),!n&&t.previewBadge&&g("div",{className:"ml-auto shrink-0",children:t.previewBadge})]}):s,a]});return t.isMultiField?C("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(E,{visible:n,children:g(h,{children:t.children})})]}):e?C("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[d,g(E,{visible:n,children:g(h,{children:t.children})})]}):C("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(h,{children:t.children})}),a&&g("div",{className:"shrink-0",children:a})]})}import{jsx as Uo}from"react/jsx-runtime";function ar(t){let e=b(Cn(t.field),t.translations),n=Rn(t.field);return hn(t.field,t.value).map(r=>Uo(lr,{collapsed:t.field.advanced?.collapsed,index:r,isMultiField:n,label:e,translations:t.translations,children:t.children(r)},r))}import{jsx as Ho}from"react/jsx-runtime";function sr(t){let e=Array.isArray(t.field.fields)&&t.field.fields.length===0,n=w(t.field.label,t.translations),r=w(t.field.description,t.translations);return Ho(tt,{description:r,empty:e,id:t.field.name,title:n,children:t.children})}import{jsx as cr}from"react/jsx-runtime";function dr({children:t,field:e,lang:n,translations:r,value:o}){return cr(sr,{field:e,translations:r,children:cr(ar,{field:e,lang:n,translations:r,value:o,children:t})})}import{twMerge as Go}from"tailwind-merge";import{jsx as ur,jsxs as $o}from"react/jsx-runtime";function fr(t){let e=bn(t.column?.advanced?.cols);return $o("div",{className:"flex w-full flex-col gap-4",children:[ur("div",{"data-slot":"column",className:Go("grid grid-cols-1 gap-3 sm:gap-4",e),children:t.children}),t.column?.description&&ur(nt,{config:t.config,context:t.context,text:t.column.description,translations:t.translations})]})}import{Fragment as Ko}from"react";import{jsx as Yo}from"react/jsx-runtime";function mr(t){let e=Array.isArray(t.field.fields)?t.field.fields.map(n=>K(n)||Y(n)?{...n,name:`${t.field.name}.${t.index}.${n.name}`}:v(n)?{...n,fields:n.fields.map(r=>({...r,name:`${t.field.name}.${t.index}.${r.name}`}))}:n):[];return Yo(z,{components:t.components,config:t.config,context:t.context,disabled:t.disabled,fields:e,lang:t.lang,onValueChange:t.onValueChange,style:t.style,translations:t.translations,value:t.value,children:t.children})}import{jsx as V,jsxs as Xo}from"react/jsx-runtime";function z(t){let{field:e,list:n}=t.components;return J(t.fields).map((r,o)=>Xo(Ko,{children:[v(r)&&V(fr,{column:r,config:t.config,context:t.context,translations:t.translations,children:V(z,{...t,fields:r.fields})}),K(r)&&V(e,{disabled:t.disabled,field:r,lang:t.lang,style:t.style,translations:t.translations,children:t.children}),Y(r)&&V(n,{field:r,lang:t.lang,onValueChange:t.onValueChange,translations:t.translations,value:t.value,children:i=>V(mr,{components:t.components,config:t.config,context:t.context,disabled:t.disabled,field:r,index:i,lang:t.lang,onValueChange:t.onValueChange,style:t.style,translations:t.translations,value:t.value,children:t.children})})]},o))}import{jsx as Zo}from"react/jsx-runtime";function gr(t){return n=>Zo(z,{...n,components:t})}var pr=gr({field:ir,list:dr});import{jsx as At}from"react/jsx-runtime";function vt(t){let e=en(t.lang,t.translations);return At(_n,{advanced:t.advanced,config:t.config,control:t.children,definition:t.definition,readOnly:t.readOnly,sections:t.sections,translations:e,children:({disabled:n,fields:r})=>At(pr,{config:t.config,context:t.context,disabled:n,fields:r,lang:t.lang,style:t.config.style,translations:e,value:t.value,children:o=>At(Jn,{...o,config:t.config,context:t.context,translations:e,value:t.value})})})}import{Suspense as Wo}from"react";import{jsx as xr}from"react/jsx-runtime";function qo(t){return xr(Wo,{fallback:xr(vt,{config:t.config,sections:t.sections,readOnly:!0}),children:t.children})}export{qo as Fallback,vt as Form};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { CommonProps, DataSource, Field, Nullable, Option, Value, TimeFormat, DateFormat } from '../type';
|
|
2
|
-
export declare function buildOptionChips(field: Field): {
|
|
1
|
+
import type { CommonProps, DataSource, Field, Nullable, Option, Value, TimeFormat, DateFormat, Localization } from '../type';
|
|
2
|
+
export declare function buildOptionChips(field: Field, localization?: Localization): {
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
5
|
}[] | undefined;
|
|
6
|
-
export declare function buildOptionSelect(field: Field): {
|
|
6
|
+
export declare function buildOptionSelect(field: Field, localization?: Localization): {
|
|
7
7
|
value: string;
|
|
8
8
|
label: string;
|
|
9
9
|
}[] | import("..").TimezoneGroup[] | undefined;
|
|
10
|
-
export declare function buildCommon(field: Field, disabled?: boolean): CommonProps;
|
|
10
|
+
export declare function buildCommon(field: Field, disabled?: boolean, localization?: Localization): CommonProps;
|
|
11
11
|
export declare function resolveSource(field: Field, value?: Nullable<Record<string, unknown>>): DataSource | unknown[] | undefined;
|
|
12
12
|
export declare function getInputValue<K>(field: Field, value?: Nullable<K>): Value | undefined;
|
|
13
13
|
export declare function mergeOptionsProps(field: Field, commonProps: CommonProps, options?: Nullable<DataSource | unknown[]>): CommonProps | {
|
|
@@ -19,12 +19,12 @@ export declare function mergeOptionsProps(field: Field, commonProps: CommonProps
|
|
|
19
19
|
required?: boolean;
|
|
20
20
|
};
|
|
21
21
|
export declare function getPreselectedValue(field: Field, commonProps: CommonProps, value?: Value): any;
|
|
22
|
-
export declare function getOptions<T>(field: Field, data?: Nullable<T[]>): (T | {
|
|
22
|
+
export declare function getOptions<T>(field: Field, data?: Nullable<T[]>, translations?: Record<string, string>): (T | {
|
|
23
23
|
description?: string | undefined;
|
|
24
24
|
label: string;
|
|
25
25
|
value: string;
|
|
26
26
|
})[] | null | undefined;
|
|
27
|
-
export declare function prepareInputProps<T, K>(field: Field, commonProps: CommonProps, data?: Nullable<DataSource | T[]>, value?: Nullable<K>): {
|
|
27
|
+
export declare function prepareInputProps<T, K>(field: Field, commonProps: CommonProps, data?: Nullable<DataSource | T[]>, value?: Nullable<K>, translations?: Record<string, string>): {
|
|
28
28
|
commonPropsWithOptions: CommonProps | {
|
|
29
29
|
options: unknown[];
|
|
30
30
|
disabled?: boolean;
|
|
@@ -57,5 +57,5 @@ export declare function getFormatProps(dateFormat: Nullable<DateFormat>, timeFor
|
|
|
57
57
|
} | {
|
|
58
58
|
'data-format'?: undefined;
|
|
59
59
|
};
|
|
60
|
-
export declare function getPreviewOptions(field: Field): Array<Option | string> | undefined;
|
|
60
|
+
export declare function getPreviewOptions(field: Field, localization?: Localization): Array<Option | string> | undefined;
|
|
61
61
|
export declare function resolveOptionLabel(value: unknown, options: Array<Option | string>): string;
|
|
@@ -73,6 +73,10 @@ export type List = {
|
|
|
73
73
|
export type AnyField = Field | Input | Select | Chips | Date | Time;
|
|
74
74
|
export type Fields = Array<AnyField | Column | List>;
|
|
75
75
|
export type Base = Orderable & Hideable;
|
|
76
|
+
export type Localization = {
|
|
77
|
+
lang?: string;
|
|
78
|
+
translations?: Record<string, string>;
|
|
79
|
+
};
|
|
76
80
|
export type CommonProps = {
|
|
77
81
|
disabled?: boolean;
|
|
78
82
|
id?: string;
|
|
@@ -4,3 +4,4 @@ export declare function buildOrientation(field: Field): boolean;
|
|
|
4
4
|
export declare function buildReverse(field: Field): boolean;
|
|
5
5
|
export declare function buildDisabled(field: Field, disabled?: boolean): boolean;
|
|
6
6
|
export declare function buildSource(field: Field): import("..").DataSource | unknown[] | undefined;
|
|
7
|
+
export declare function isArraySource(field: Field): boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Date as DateField, DateFormat, Time, TimeFormat, TimezoneGroup } from '../type';
|
|
2
|
-
export declare function getMonth(): {
|
|
2
|
+
export declare function getMonth(locale?: string): {
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
5
|
}[];
|
|
6
|
-
export declare function getWeekDays(): {
|
|
6
|
+
export declare function getWeekDays(locale?: string): {
|
|
7
7
|
value: string;
|
|
8
8
|
label: string;
|
|
9
9
|
}[];
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
export declare const BUILT_IN_KEYS: readonly ["(Optional)", "Add item", "Collapse {label} {index}", "Expand {label} {index}", "Remove {label} item {index}", "Unknown error", "No", "Yes"];
|
|
2
|
+
export type BuiltInKey = (typeof BUILT_IN_KEYS)[number];
|
|
3
|
+
export declare function translateBuiltIn(key: BuiltInKey, dictionary?: Record<string, string>): string;
|
|
4
|
+
export declare function resolveDictionary(lang?: string, translations?: Record<string, Record<string, string>>): Record<string, string> | undefined;
|
|
1
5
|
export declare function translate(key?: string, dictionary?: Record<string, string>): string;
|
|
6
|
+
export declare function translateOptional(value?: string, dictionary?: Record<string, string>): string | undefined;
|
|
7
|
+
export declare function translateOptions<T>(options: T[], dictionary?: Record<string, string>): T[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { List, Nullable, PreviewItem } from '../../../../../luna-core/index';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
export declare function FieldListPreviewItem({ canRemove, children, field, index, isMultiField, itemKey, label, onRemove, previewBadge, previewLabel, previewTags, translations, value, }: {
|
|
3
|
+
export declare function FieldListPreviewItem({ canRemove, children, field, index, isMultiField, itemKey, label, lang, onRemove, previewBadge, previewLabel, previewTags, translations, value, }: {
|
|
4
4
|
canRemove: boolean;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
field: List;
|
|
@@ -8,6 +8,7 @@ export declare function FieldListPreviewItem({ canRemove, children, field, index
|
|
|
8
8
|
isMultiField: boolean;
|
|
9
9
|
itemKey: string | number;
|
|
10
10
|
label: string;
|
|
11
|
+
lang?: string;
|
|
11
12
|
onRemove: (index: number) => void;
|
|
12
13
|
previewBadge?: PreviewItem;
|
|
13
14
|
previewLabel?: PreviewItem;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Column, Field, PreviewItem } from '../../../../../luna-core/index';
|
|
2
|
-
export declare function FieldPreview({ className, fields, label, name, previews, translations, value, }: Readonly<{
|
|
2
|
+
export declare function FieldPreview({ className, fields, label, lang, name, previews, translations, value, }: Readonly<{
|
|
3
3
|
className?: string;
|
|
4
4
|
fields?: Array<Field | Column>;
|
|
5
5
|
label?: string;
|
|
6
|
+
lang?: string;
|
|
6
7
|
name: string;
|
|
7
8
|
previews: PreviewItem | PreviewItem[];
|
|
8
9
|
translations?: Record<string, string>;
|
|
@@ -3,5 +3,7 @@ export declare const Field: (props: Readonly<Readonly<Readonly<{
|
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
errors?: Record<string, string[]>;
|
|
5
5
|
field: import('../../../../../luna-core/index').Field;
|
|
6
|
+
lang?: string;
|
|
6
7
|
style?: import('../../../../../luna-core/index').Style;
|
|
8
|
+
translations?: Record<string, string>;
|
|
7
9
|
}>>>) => import("react").JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ListProps } from '../../../component/field/field-list';
|
|
2
|
-
export declare function ListGuard({ children, field, onValueChange, translations, value, }: ListProps): import("react").JSX.Element;
|
|
2
|
+
export declare function ListGuard({ children, field, lang, onValueChange, translations, value, }: ListProps): import("react").JSX.Element;
|
|
@@ -3,6 +3,7 @@ import type { DataSource, Field, Nullable } from '../../../../luna-core/index';
|
|
|
3
3
|
export type InputStrategies = Readonly<{
|
|
4
4
|
useSource: (field: Field, config: Config, value?: Nullable<Record<string, unknown>>) => {
|
|
5
5
|
data: Nullable<unknown[]>;
|
|
6
|
+
isStaticSource?: boolean;
|
|
6
7
|
setSource: (target: string, source?: DataSource) => void;
|
|
7
8
|
};
|
|
8
9
|
getValue: (event: React.ChangeEvent<HTMLInputElement>, field: Field) => string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Field, type Nullable } from '../../../../luna-core/index';
|
|
2
2
|
import type { Config } from '../../type';
|
|
3
|
-
export declare function useDataSource(field: Field, config: Config, value?: Nullable<Record<string, unknown>>): readonly [Nullable<unknown[]>, (target: string, value: import('../../../../luna-core/index').DataSource | undefined) => void];
|
|
3
|
+
export declare function useDataSource(field: Field, config: Config, value?: Nullable<Record<string, unknown>>): readonly [Nullable<unknown[]>, (target: string, value: import('../../../../luna-core/index').DataSource | undefined) => void, boolean];
|
|
@@ -5,6 +5,8 @@ export type FieldProps = Readonly<{
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
errors?: Record<string, string[]>;
|
|
7
7
|
field: Field;
|
|
8
|
+
lang?: string;
|
|
8
9
|
style?: Style;
|
|
10
|
+
translations?: Record<string, string>;
|
|
9
11
|
}>;
|
|
10
12
|
export declare function Field(props: FieldProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type List } from '../../../luna-core/index';
|
|
2
2
|
export declare function List(props: Readonly<{
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
field: List;
|
|
5
|
+
translations?: Record<string, string>;
|
|
5
6
|
}>): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ListProps } from '../field/field-list';
|
|
2
|
-
export declare function ListSlot({ children, field, translations, value }: ListProps): import("react").JSX.Element;
|
|
2
|
+
export declare function ListSlot({ children, field, lang, translations, value, }: ListProps): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-luna-form",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.75",
|
|
4
4
|
"description": "A React library for building forms based on JSON",
|
|
5
5
|
"main": "./dist/client/cjs/index.js",
|
|
6
6
|
"module": "./dist/client/esm/index.js",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"zod": "^4.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/react": "19.2.
|
|
33
|
-
"@types/react-dom": "19.2.
|
|
32
|
+
"@types/react": "19.2.18",
|
|
33
|
+
"@types/react-dom": "19.2.4",
|
|
34
34
|
"eslint-plugin-react": "7.37.5",
|
|
35
35
|
"eslint-plugin-react-hooks": "7.1.1",
|
|
36
36
|
"eslint-plugin-react-refresh": "0.5.3",
|
|
37
|
-
"@luna-form/core": "0.0.
|
|
37
|
+
"@luna-form/core": "0.0.75"
|
|
38
38
|
},
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"repository": {
|