react-luna-form 0.0.74 → 0.0.76
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 +5 -5
- package/dist/types/luna-core/type.d.ts +4 -0
- package/dist/types/luna-core/util/translate.d.ts +5 -0
- package/dist/types/luna-react/src/client/component/field/field.d.ts +1 -0
- package/dist/types/luna-react/src/client/lib/value-store.d.ts +12 -0
- package/dist/types/luna-react/src/component/field/field-list-item.d.ts +1 -0
- package/dist/types/luna-react/src/component/field/field.d.ts +1 -0
- package/dist/types/luna-react/src/component/input/input-base.d.ts +1 -0
- package/dist/types/luna-react/src/component/list.d.ts +2 -1
- package/package.json +2 -2
package/dist/server/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as gr}from"react/jsx-runtime";function Ie(e){let t=typeof e.children=="function"?e.children({isPending:e.isPending}):e.children;return gr("div",{"data-slot":"field-control",className:"w-full",children:t})}import{jsx as we}from"react/jsx-runtime";function S(e){return we("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:we("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 xr}from"react";import{createContext as pr}from"react";var ke=pr(!1);import{jsx as Ee}from"react/jsx-runtime";function w({children:e,visible:t}){return Ee(xr,{mode:t?"visible":"hidden",children:Ee(ke,{value:!0,children:e})})}var z="input",Le="input/date",Oe="input/email",De="input/number";var Pe="input/time";var Me="textarea",_e="radio",Ve="checkbox",re="list";var ze="select",$e="select/active",He="select/day",Ge="select/month",Be="select/timezone",Ue="select/year";var Ye="chips",Xe="chips/day",Ke="chips/month",k="column",Ze="description",oe="fields",We="label",ie="value",$="options",le="email",qe="number",Je="password",Qe="tel",E="text",je="aria-errormessage",et="aria-invalid",tt="data-invalid",nt="data-readonly",rt="aria",ot="data",it="max",lt="maxLength",at="min",st="minLength",A="$ref";var ct="type",dt={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};import{format as br,formatDistanceToNow as ut,formatDuration as Tr,intervalToDuration as hr,isValid as H,parseISO as Rr}from"date-fns";import{enUS as ft,es as ae}from"date-fns/locale";function u(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function x(e){return c(e)||typeof e=="number"||yr(e)}function c(e){return typeof e=="string"}function yr(e){return typeof e=="boolean"}var mt={en:ft,"en-US":ft,es:ae,"es-ES":ae,"es-MX":ae},Fr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},Cr={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function gt(e){if(e)return mt[e]??mt[e.split("-")[0]]}function G(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 pt(e,t,n){let r=Cr[t];if(r===void 0)return String(e);let o=e*r,i=hr({start:0,end:o});return Tr(i,{locale:n})}function xt(e){if(e instanceof Date)return H(e)?e:null;if(c(e)){let t=Rr(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 Sr={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=xt(e);if(!r)return String(e);let o=t[0]??"short",i=gt(n.locale);if(o==="relative")return ut(r,{addSuffix:!0,locale:i});let l=Fr[o]??o;return br(r,l,{locale:i})},duration:(e,t,n)=>{let r=gt(n.locale);if(typeof e=="number")return pt(e,t[0]??"ms",r);if(c(e)){let i=G(e);if(i!==null)return pt(i,t[0]??"ms",r)}let o=xt(e);return o?ut(o,{addSuffix:!0,locale:r}):String(e)}};function yt(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=Sr[o];if(l)return l(e,i,n)}function bt(e,t=ie){if(e!=null){if(Array.isArray(e)&&e.every(x)||x(e))return e;if(u(e)){let n=Ar(e,t);if(x(n))return n}}}function Ar(e,t){let n=y(e,t);if(x(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 Tt(e,t={description:Ze,label:We,value:ie}){return e.map(n=>{if(u(n)){let r=y(n,t.label),o=y(n,t.value);if(x(r)&&x(o)){let i=y(n,t.description);return{label:`${r}`,value:`${o}`,...x(i)&&{description:`${i}`}}}}return n})}function ht(e=E){let t=e.lastIndexOf("/"),n=t===-1?e:e.slice(t+1);return n&&n!==z?n.trim().toLowerCase():E}var Nr=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g;function se(e,t={},n={}){if(c(e))return vr(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 c(e)?/{([^}]{1,200})}/.test(e):Array.isArray(e)?e.some(t=>ce(t)):u(e)?Object.values(e).some(t=>ce(t)):!1}function vr(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(".")?y(t,l):t[l];if(a.length===0)return x(s)?String(s):r;if(s==null)return r;let d=s;for(let g of a){let V=yt(d,g,{locale:n.locale});if(V===void 0)return r;d=V}return String(d)})}function Rt(e,t){if(!c(e)||!e||e.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=Nr.exec(e))!==null;){let[l,a,s]=n,d=n.index;o=!0,d>r&&i.push(e.substring(r,d));let g=t?t(d,s,a):l;i.push(g),r=d+l.length}return o?(r<e.length&&i.push(e.substring(r)),i):e}var Ft=e=>f($e)(e),Ct=e=>f(He)(e),St=e=>f(Ge)(e),At=e=>f(Ue)(e),Nt=e=>f(Be)(e),vt=e=>f(Xe)(e),It=e=>f(Ke)(e),wt=f(Le),de=f(Pe),b=f(Ve),N=f(Ye),C=f(_e),kt=f(z),h=f(ze),Et=f(Me),Lt=f(E,le,Je,Qe),yi=f(Oe,le),Ot=f(De,qe);function Dt(e){return C(e)||b(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)||C(e)||N(e)}function I(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 Pt(e,t={}){if(h(e)&&e.disabled){let n=e.name?t?.[e.name]:void 0;if(n&&u(n))return[n]}}function Mt(e){return C(e)||b(e)?!0:e.advanced?.horizontal??!1}function _t(e){return b(e)?e.advanced?.reverse!==!1:!1}function Vt(e,t){let n=e.readonly??!1;return t||n}function fe(e){if(Ir(e)){let t=e.source;if(Array.isArray(t)||u(t)&&!(A in t))return t}}function zt(e){return Array.isArray(fe(e))}function Ir(e){return C(e)||N(e)||h(e)&&!e.disabled}import{isValid as Gt,parse as Bt,format as Ut}from"date-fns";var wr=/^\d+$/,Yt=new Date(2e3,0,1),kr=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[],me="default";function Xt(e){if(!e)return me;try{return Intl.getCanonicalLocales(e)[0]??me}catch{return me}}function ge(e){let t=Xt(e);return Array.from({length:12},(n,r)=>({value:(r+1).toString(),label:new Date(0,r).toLocaleString(t,{month:"long"})}))}function pe(e){let t=Xt(e);return Array.from({length:7},(n,r)=>({value:r.toString(),label:new Date(2e3,0,2+r).toLocaleString(t,{weekday:"long"})}))}function Kt(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 xe(){return new Date().getFullYear()}function Er(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function Lr(e){let t=e.indexOf("/"),n=t===-1?e:e.slice(0,t);return dt[n]??"Other"}function Or(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=Or(r,e);return{offset:i,longName:l}}function Ht(e){return e.slice(e.lastIndexOf("/")+1).replace(/_/g," ")}function Zt(){let e=new Date,t=Er(),n=new Map,r=Ht(t),{offset:o,longName:i}=$t(t,e),l={value:t,label:`${r} - ${i} (${o})`};for(let s of kr()){if(s===t)continue;let d=Ht(s),{offset:g,longName:V}=$t(s,e),Ne={value:s,label:`${d} - ${V} (${g})`},ne=Lr(s);if(ne==="Other")continue;let ve=n.get(ne);ve?ve.push(Ne):n.set(ne,[Ne])}for(let s of n.values())s.sort((d,g)=>d.label.localeCompare(g.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 ye(e,t){if(typeof e=="number")return e;let n=t??xe(),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 wr.test(r)?parseInt(r,10):n}function Wt(e,t){if(!e)return"";try{let n=Bt(e,t,Yt);return Gt(n)?Ut(n,"yyyy-MM-dd"):""}catch{return""}}function qt(e,t){if(!e)return"";try{let n=Bt(e,t,Yt);return Gt(n)?Ut(n,"HH:mm:ss"):""}catch{return""}}function be(e){return e.advanced?.format??"HH:mm"}function Jt(e){return e.advanced?.format??"MMMM d, yyyy"}function p(e,t){return e?t?t[e]??e:e:""}function Te(e,t){if(!t)return e;let n=!1,r=e.map(o=>{let i=Dr(o,t);return i!==o&&(n=!0),i});return n?r:e}function Dr(e,t){if(!u(e))return e;let n=Qt(e.label,t),r=e.items;if(Array.isArray(r)){let i=Te(r,t);return i===r&&n===e.label?e:{...e,...n!==void 0&&{label:n},items:i}}let o=Qt(e.description,t);return n===e.label&&o===e.description?e:{...e,...n!==void 0&&{label:n},...o!==void 0&&{description:o}}}function Qt(e,t){return c(e)?p(e,t):e}var Y=xe();function Pr(e,t){if(N(e))return Mr(e,t)}function Mr(e,t){if(vt(e))return pe(t);if(It(e))return ge(t)}function _r(e,t){if(h(e))return Vr(e,t)}function Vr(e,t){if(Ct(e))return pe(t);if(St(e))return ge(t);if(At(e)){let n=e.advanced?.length?.min??Y,r=e.advanced?.length?.max??Y+5;return Kt(ye(n,Y),ye(r,Y))}if(Nt(e))return Zt();if(Ft(e))return[{value:"true",label:"Yes"},{value:"false",label:"No"}]}function jt(e,t=!1,n){let r={disabled:t,id:e.name,name:e.name,placeholder:e.placeholder,required:e.required};return kt(e)?{...r,...zr(e)}:h(e)?{...r,...en(e,n,_r)}:Et(e)?{...r,...Hr(e)}:N(e)?{...r,...$r(e,n)}:r}function zr(e){let t=ht(e.type),n={...e,type:t};return{...Br(e),...tn(e),...Gr(n),...Lt(n)?nn(n):{},type:t}}function en(e,t,n){let r=n(e,t);return r?{options:r}:{}}function $r(e,t){let n=en(e,t,Pr),r=e.advanced?.multiple??!0;return{...n,multiple:r}}function Hr(e){return{...tn(e),...nn(e)}}function tn(e){let t=e.advanced?.autocomplete;return t?{autoComplete:t}:{}}function Gr(e){return Ot(e)?Ur(e):{}}function Br(e){if(de(e)){let t=be(e);return{step:t==="HH:mm:ss"||t==="hh:mm:ss a"?"1":"60"}}return{}}function nn(e){return rn(e,{min:st,max:lt})}function Ur(e){return rn(e,{min:at,max:it})}function rn(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 on(e,t){let n=fe(e);return n||Pt(e,t)}function Yr(e,t){let n=u(t)&&e.name in t?t[e.name]:t,r=bt(n,e.advanced?.entity),o=I(r)?r:e.defaultValue;return de(e)&&I(o)?Xr(e,o):wt(e)&&I(o)?qr(e,o):o}function Xr(e,t){let n=be(e);return c(t)?qt(t,n):t}function Kr(e,t,n){return ue(e)&&Array.isArray(n)?{...t,[$]:n}:t}function Zr(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 Wr(e,t,n){if(ue(e)&&Array.isArray(t)){let r=Tt(t,e.advanced?.options);return zt(e)?Te(r,n):r}return t}function ln(e,t,n,r,o){let i=Yr(e,r),l=Array.isArray(n)?Wr(e,n,o):n,a=Kr(e,t,l),s=Zr(e,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function an(e,t){return b(e)?{defaultChecked:I(t)}:{defaultValue:t}}function qr(e,t){let n=Jt(e);return c(t)?Wt(t,n):t}var Jr=/^#\/definition\//;function K(e=[],t){let n=X(e,t);return Array.isArray(n)?n.filter(jr).sort((r,o)=>sn(r)-sn(o)):[]}function X(e,t,n=new Map,r=new WeakSet){if(!Qr(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(A in e&&c(e[A])){let i=e[A].replace(Jr,""),l=y(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 cn(e){return Object.entries(e??{})}function sn(e){return e.order??Number.MAX_VALUE}function Qr(e){return e!==void 0&&u(e)&&Object.keys(e).length>0}function jr(e){return ct in e?!0:Array.isArray(e[oe])?e[oe].length>0:!0}function dn(e,t){let n={};for(let[r,o]of cn(t))n[`${e}-${r}`]=o;return n}function eo(e){return dn(rt,e)}function to(e){return dn(ot,e)}function un(e,t){let n=eo(e.advanced?.aria);return t&&t.length>0&&(n[et]="true",n[je]=`${e.name}-error`),n}function fn(e){return to(e.advanced?.data)}var mn={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},gn={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function pn(e,t=2){return mn[e&&e in mn?e:t]}function xn(e){if(e&&e in gn)return gn[e]}function no(e,t){let n=e.advanced?.length?.min??1;if(t){let r=y(t,e.name);if(Array.isArray(r))return Math.max(r.length,n)}return Math.max(n,0)}function yn(e){return!Array.isArray(e.fields)||e.fields.length===0?!1:e.fields.length>1||e.fields[0].type===k}function bn(e,t){let n=no(e,t);return Array.from({length:n},(r,o)=>o)}function Tn(e){return e.advanced?.title??e.label??e.name}function Z(e,t){return{...e,...t}}import{jsx as ro}from"react/jsx-runtime";function T(e){return Rt(e,(t,n,r)=>ro("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${t}`))}import{useCallback as oo,useState as io}from"react";import{jsx as O,jsxs as he}from"react/jsx-runtime";function hn(e){let{fields:t=[]}=e.section,[n,r]=io(!1),o=oo(()=>r(i=>!i),[]);return he("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:[O("legend",{children:he("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:[O(S,{expanded:n}),O("span",{children:T(e.title)})]})}),O(w,{visible:n,children:he("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&&O("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:T(e.description)}),e.group]})})]})}import{jsx as W,jsxs as Rn}from"react/jsx-runtime";function Fn(e){let t=Rn("div",{className:"flex flex-col",children:[e.title&&W("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:T(e.title)}),e.description&&W("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:T(e.description)})]});return e.step?Rn("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 Cn,jsxs as lo}from"react/jsx-runtime";function q(e){return lo("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:[Cn(Fn,{description:e.description,step:e.step,title:e.title}),Cn("div",{className:"w-full min-w-0",children:e.children})]})}import{jsx as ao}from"react/jsx-runtime";function R(e){return ao("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 Re}from"react/jsx-runtime";function Sn(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=Re(R,{compact:r,children:e.children});if(!e.section.title&&!e.section.description)return o;let i=e.section.title?p(e.section.title,e.translations):void 0,l=e.section.description?p(e.section.description,e.translations):void 0;return e.section.advanced?.collapsible?Re(hn,{description:l,group:o,section:e.section,title:i}):Re(q,{description:l,empty:t.length===0,id:e.section.id?.toString(),step:n,title:i,children:o})}import{jsx as An}from"react/jsx-runtime";function Nn(){return An("div",{"data-slot":"field-separator",className:"relative -my-2 h-5 text-sm",children:An("div",{className:"absolute inset-0 top-1/2 h-px w-full bg-zinc-200 dark:bg-zinc-800"})})}import{useAtomValue as po}from"jotai";import{atom as D}from"jotai";import{atomFamily as so}from"jotai-family";import{deepEqual as vn}from"fast-equals";function co(e,t){let{[t]:n,...r}=e;return r}function uo(e){return so(t=>D(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,co(i,t))}))}function fo(e){return D(null,(t,n)=>{let r=t(e);r&&Object.keys(r).length>0&&n(e,{})})}function mo(e){return D(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 go(e){return D(null,(t,n,r)=>{let o=t(e);vn(o,r)||n(e,r)})}function J(e={}){let t=D(e);return{atom:t,clearAll:fo(t),clear:mo(t),bulkReport:go(t),report:uo(t)}}var In=J(),wn=In.atom,kn=In.report;function xo(e,t){return e.fields.every(n=>En(n,t))}function En(e,t){return t[e.name]?.hidden??e.hidden??!1}function yo(e,t){return v(e)?xo(e,t):En(e,t)}function Ln(e){let t=po(wn);return e.container&&(t[e.container.name]?.hidden??e.container.hidden??!1)||e.fields.length===0||e.fields.every(r=>yo(r,t))?null:e.children}import{jsx as P,jsxs as On}from"react/jsx-runtime";function Dn(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:On(R,{children:[t.map((n,r)=>On(Ln,{fields:n.fields??[],children:[P(Sn,{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&&P(Nn,{})]},`key-${n.id}-${r}`)),e.control&&P(Ie,{isPending:e.isPending,children:e.control})]})})})}import{jsx as bo}from"react/jsx-runtime";function Pn(e){return bo("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 To}from"react";import{jsx as Mn,jsxs as _n}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]=To(()=>u(e.text)&&"collapsed"in e.text?!e.text.collapsed:!0),l=()=>i(g=>!g),a=u(e.text)&&c(e.text.title)?T(p(L(e.text.title,t,r),e.translations)):void 0,s=p(L(c(e.text)?e.text:e.text?.message,t,r),e.translations),d=T(s);return d?_n("div",{className:"flex flex-col gap-2",children:[a&&_n("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,Mn(S,{expanded:o})]}),o&&Mn(Pn,{title:s,children:d})]}):null}var j=J(),Zl=j.atom,Wl=j.clearAll,ql=j.clear,Vn=j.report;import{useAtomValue as zn}from"jotai";import{jsx as ho}from"react/jsx-runtime";function ee(e){let t=zn(Vn(e.field.name)),r=zn(kn(e.field.name))?.description??e.field.description;return ho(Q,{config:e.config,context:e.context,text:r,translations:e.translations,value:t})}import{twMerge as Ro}from"tailwind-merge";import{jsx as $n,jsxs as Fo}from"react/jsx-runtime";function Hn(e){let t=e.style?.showOptionalLabel??!0,n=C(e.field)||b(e.field);return Fo("label",{"data-slot":"field-label","data-normal":n,className:Ro("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:[$n("span",{className:"[[data-slot=column]_&]:md:truncate",children:e.children}),t&&!e.field.required&&$n("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:p("(Optional)",e.translations)})]})}import{jsx as Gn,jsxs as Co}from"react/jsx-runtime";function Bn(e){let t={context:e.context,env:e.config?.env},n=L(e.field.label,t);return Co("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[Gn(Hn,{field:e.field,style:e.config?.style,translations:e.translations,children:p(n,e.translations)}),e.horizontal===!0&&Gn(ee,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}import{Fragment as So,jsx as Un,jsxs as Ao}from"react/jsx-runtime";function Yn(e){return Ao(So,{children:[e.field.name&&e.field.label&&Un(Bn,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&Un(ee,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}function Xn(e,t){return e?t(e):null}import{jsx as Kn}from"react/jsx-runtime";function Zn(e){let t=on(e.field,e.value),{commonPropsWithOptions:n,defaultValue:r}=ln(e.field,e.commonProps,t,e.value,e.translations),o=an(e.field,r);return Xn(e.config.inputs[e.field.type],i=>Kn(Yn,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:Kn(i,{...e.ariaAttributes,...n,...e.dataAttributes,...o})}))}import{jsx as Wn}from"react/jsx-runtime";function qn(e){return!e.errors||e.errors.length===0?null:Wn("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)=>Wn("li",{children:t},e.name?`${e.name}-error-${n}`:n))})}import{twMerge as No}from"tailwind-merge";import{jsx as vo}from"react/jsx-runtime";function te(e){let t=e.errors&&e.errors.length>0;return vo("div",{"data-slot":"field","data-clickable":e.isClickable?"true":"false",...t&&{[tt]:"true"},...e.disabled&&{[nt]:"true"},"data-orientation":e.orientation,className:No("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 Io}from"tailwind-merge";import{jsx as wo}from"react/jsx-runtime";function Jn(e){return wo(te,{...e,orientation:"vertical",className:Io("gap-3 has-[>[data-slot=field-content]]:items-start",!e.isClickable&&"[&>*]:w-full"),children:e.children})}import{twMerge as ko}from"tailwind-merge";import{jsx as Eo}from"react/jsx-runtime";function Qn(e){return Eo(te,{...e,orientation:"horizontal",className:ko("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 jn}from"react/jsx-runtime";function er(e){let t=Dt(e.field),n=b(e.field),r=_t(e.field);return e.horizontal?jn(Qn,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children}):jn(Jn,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children})}function tr(e){if(!e.field.type)return null;let t=jt(e.field,e.disabled,e.lang),n=fn(e.field),r=un(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 Lo}from"tailwind-merge";import{jsx as Fe,jsxs as Oo}from"react/jsx-runtime";function nr(e){let t=e.field.advanced?.cols,n=e.field.name?e.errors?.[e.field.name]:void 0,{horizontal:r}=Z(e.style,{horizontal:Mt(e.field)}),o=Vt(e.field,e.disabled);return Oo("div",{className:Lo("flex flex-col gap-3",xn(t)),children:[Fe(er,{disabled:o,errors:n,field:e.field,horizontal:r,children:Fe(tr,{disabled:o,errors:n,field:e.field,horizontal:r,lang:e.lang,children:e.children})}),Fe(qn,{errors:n,name:e.field.name})]})}import{twMerge as Ce}from"tailwind-merge";import{useState as Do}from"react";import{Fragment as Po,jsx as m,jsxs as F}from"react/jsx-runtime";function rr(e){let t=e.isMultiField||e.collapsed!=null,[n,r]=Do(t?!e.collapsed:!0);function o(){e.canRemove&&e.onRemove&&e.onRemove(e.index)}function i(){r(d=>!d)}let l=e.canRemove&&e.onRemove!=null&&m("button",{"aria-label":`Remove ${e.label} item ${e.index+1}`,className:Ce("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=F("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??F(Po,{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=F("div",{className:Ce("flex items-center justify-between gap-2",e.isMultiField&&n&&"mb-3"),children:[t?F("div",{className:"flex min-w-0 grow items-center gap-2",children:[F("button",{"aria-expanded":n,"aria-label":`${n?"Collapse":"Expand"} ${e.label} ${e.index+1}`,className:Ce("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(S,{expanded:n}),a]}),!n&&e.previewBadge&&m("div",{className:"ml-auto shrink-0",children:e.previewBadge})]}):a,l]});return e.isMultiField?F("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(R,{children:e.children})})]}):t?F("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[s,m(w,{visible:n,children:m(R,{children:e.children})})]}):F("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(R,{children:e.children})}),l&&m("div",{className:"shrink-0",children:l})]})}import{jsx as Mo}from"react/jsx-runtime";function or(e){let t=Tn(e.field),n=yn(e.field);return bn(e.field,e.value).map(r=>Mo(rr,{collapsed:e.field.advanced?.collapsed,index:r,isMultiField:n,label:t,children:e.children(r)},r))}import{jsx as _o}from"react/jsx-runtime";function ir(e){let t=Array.isArray(e.field.fields)&&e.field.fields.length===0;return _o(q,{description:e.field.description,empty:t,id:e.field.name,title:e.field.label,children:e.children})}import{jsx as lr}from"react/jsx-runtime";function ar({children:e,field:t,lang:n,translations:r,value:o}){return lr(ir,{field:t,children:lr(or,{field:t,lang:n,translations:r,value:o,children:e})})}import{twMerge as Vo}from"tailwind-merge";import{jsx as sr,jsxs as zo}from"react/jsx-runtime";function cr(e){let t=pn(e.column?.advanced?.cols);return zo("div",{className:"flex w-full flex-col gap-4",children:[sr("div",{"data-slot":"column",className:Vo("grid grid-cols-1 gap-3 sm:gap-4",t),children:e.children}),e.column?.description&&sr(Q,{config:e.config,context:e.context,text:e.column.description,translations:e.translations})]})}import{Fragment as Ho}from"react";import{jsx as $o}from"react/jsx-runtime";function dr(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 $o(M,{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 _,jsxs as Go}from"react/jsx-runtime";function M(e){let{field:t,list:n}=e.components;return K(e.fields).map((r,o)=>Go(Ho,{children:[v(r)&&_(cr,{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,lang:e.lang,style:e.style,children:e.children}),B(r)&&_(n,{field:r,lang:e.lang,onValueChange:e.onValueChange,translations:e.translations,value:e.value,children:i=>_(dr,{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 Bo}from"react/jsx-runtime";function ur(e){return n=>Bo(M,{...n,components:e})}var fr=ur({field:nr,list:ar});import{jsx as Se}from"react/jsx-runtime";function Ae(e){let t=e.translations?.[e.lang??""];return Se(Dn,{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})=>Se(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=>Se(Zn,{...o,config:e.config,context:e.context,translations:t,value:e.value})})})}import{Suspense as Uo}from"react";import{jsx as mr}from"react/jsx-runtime";function Yo(e){return mr(Uo,{fallback:mr(Ae,{config:e.config,sections:e.sections,readOnly:!0}),children:e.children})}export{Yo as Fallback,Ae as Form};
|
|
1
|
+
import{jsx as br}from"react/jsx-runtime";function kt(t){let e=typeof t.children=="function"?t.children({isPending:t.isPending}):t.children;return br("div",{"data-slot":"field-control",className:"w-full",children:e})}import{jsx as Et}from"react/jsx-runtime";function A(t){return Et("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:Et("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 Rr}from"react";import{createContext as Tr}from"react";var Lt=Tr(!1);import{jsx as Ot}from"react/jsx-runtime";function k({children:t,visible:e}){return Ot(Rr,{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",E="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",N="$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 Cr,formatDistanceToNow as me,formatDuration as Fr,intervalToDuration as Ar,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"||hr(t)}function c(t){return typeof t=="string"}function hr(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"},vr={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=vr[e];if(r===void 0)return String(t);let o=t*r,i=Ar({start:0,end:o});return Fr(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 Ir={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 Cr(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=Ir[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=wr(t,e);if(p(n))return n}}}function wr(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 kr=/\[([^\]]{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=kr.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 Ae=t=>f(Ht)(t),Ne=t=>f(Gt)(t),Se=t=>f($t)(t),ve=t=>f(Kt)(t),Ie=t=>f(Yt)(t),we=t=>f(Zt)(t),ke=t=>f(Wt)(t),Ee=f(Dt),mt=f(_t),y=f(Bt),S=f(Xt),F=f(Vt),Le=f(U),R=f(Ut),Oe=f(zt),De=f(L,dt,jt,te),Fi=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===E}function K(t){return t.type!==E&&t.type!==at}function gt(t){return R(t)||F(t)||S(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(Lr(t)){let e=t.source;if(Array.isArray(e)||u(e)&&!(N in e))return e}}function Ue(t){return Array.isArray(pt(t))}function Lr(t){return F(t)||S(t)||R(t)&&!t.disabled}import{isValid as $e,parse as Ye,format as Ke}from"date-fns";var Or=/^\d+$/,Xe=new Date(2e3,0,1),Dr=()=>"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 Pr(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function Mr(t){let e=t.indexOf("/"),n=e===-1?t:t.slice(0,e);return fe[n]??"Other"}function _r(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=_r(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=Pr(),n=new Map,r=Ge(e),{offset:o,longName:i}=He(e,t),l={value:e,label:`${r} - ${i} (${o})`};for(let s of Dr()){if(s===e)continue;let d=Ge(s),{offset:m,longName:B}=He(s,t),It={value:s,label:`${d} - ${B} (${m})`},lt=Mr(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 Or.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 zr={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?zr[Vr(t)]:void 0;return r?n?{...r,...n}:r:n}function Vr(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=Br(o,e);return i!==o&&(n=!0),i});return n?r:t}function Br(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 Ur(t,e){if(S(t))return Hr(t,e?.lang)}function Hr(t,e){if(we(t))return bt(e);if(ke(t))return yt(e)}function Gr(t,e){if(R(t))return $r(t,e)}function $r(t,e){let{lang:n,translations:r}=e??{};if(Ne(t))return bt(n);if(Se(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(Ae(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,...Yr(t)}:R(t)?{...r,...rn(Gr(t,n))}:Oe(t)?{...r,...Xr(t)}:S(t)?{...r,...Kr(t,n)}:r}function Yr(t){let e=Ce(t.type),n={...t,type:e};return{...Wr(t),...on(t),...Zr(n),...De(n)?ln(n):{},type:e}}function rn(t){return t?{options:t}:{}}function Kr(t,e){let n=rn(Ur(t,e)),r=t.advanced?.multiple??!0;return{...n,multiple:r}}function Xr(t){return{...on(t),...ln(t)}}function on(t){let e=t.advanced?.autocomplete;return e?{autoComplete:e}:{}}function Zr(t){return Pe(t)?qr(t):{}}function Wr(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 qr(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 Jr(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)?Qr(t,o):Ee(t)&&I(o)?no(t,o):o}function Qr(t,e){let n=ht(t);return c(e)?Qe(e,n):e}function jr(t,e,n){return gt(t)&&Array.isArray(n)?{...e,[H]:n}:e}function to(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 eo(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=Jr(t,r),l=Array.isArray(n)?eo(t,n,o):n,a=jr(t,e,l),s=to(t,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function dn(t,e){return y(t)?{defaultChecked:I(e)}:{defaultValue:e}}function no(t,e){let n=je(t);return c(e)?Je(e,n):e}var ro=/^#\/definition\//;function J(t=[],e){let n=q(t,e);return Array.isArray(n)?n.filter(io).sort((r,o)=>un(r)-un(o)):[]}function q(t,e,n=new Map,r=new WeakSet){if(!oo(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(N in t&&c(t[N])){let i=t[N].replace(ro,""),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 oo(t){return t!==void 0&&u(t)&&Object.keys(t).length>0}function io(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 lo(t){return mn(ie,t)}function ao(t){return mn(le,t)}function gn(t,e){let n=lo(t.advanced?.aria);return e&&e.length>0&&(n[ne]="true",n[ee]=`${t.name}-error`),n}function pn(t){return ao(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 so(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===E}function hn(t,e){let n=so(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 co}from"react/jsx-runtime";function T(t){return Fe(t,(e,n,r)=>co("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${e}`))}import{useCallback as uo,useState as fo}from"react";import{jsx as P,jsxs as Ct}from"react/jsx-runtime";function Fn(t){let{fields:e=[]}=t.section,[n,r]=fo(!1),o=uo(()=>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(A,{expanded:n}),P("span",{children:T(t.title)})]})}),P(k,{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 An}from"react/jsx-runtime";function Nn(t){let e=An("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?An("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 Sn,jsxs as mo}from"react/jsx-runtime";function tt(t){return mo("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:[Sn(Nn,{description:t.description,step:t.step,title:t.title}),Sn("div",{className:"w-full min-w-0",children:t.children})]})}import{jsx as go}from"react/jsx-runtime";function h(t){return go("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 ho}from"jotai";import{atom as M}from"jotai";import{atomFamily as po}from"jotai-family";import{deepEqual as kn}from"fast-equals";function xo(t,e){let{[e]:n,...r}=t;return r}function yo(t){return po(e=>M(n=>n(t)[e]??void 0,(n,r,o)=>{let i=n(t);if(o!=null){let l=i[e];kn(l,o)||r(t,{...i,[e]:o})}else e in i&&r(t,xo(i,e))}))}function bo(t){return M(null,(e,n)=>{let r=e(t);r&&Object.keys(r).length>0&&n(t,{})})}function To(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 Ro(t){return M(null,(e,n,r)=>{let o=e(t);kn(o,r)||n(t,r)})}function et(t={}){let e=M(t);return{atom:e,clearAll:bo(e),clear:To(e),bulkReport:Ro(e),report:yo(e)}}var En=et(),Ln=En.atom,On=En.report;function Co(t,e){return t.fields.every(n=>Dn(n,e))}function Dn(t,e){return e[t.name]?.hidden??t.hidden??!1}function Fo(t,e){return v(t)?Co(t,e):Dn(t,e)}function Pn(t){let e=ho(Ln);return t.container&&(e[t.container.name]?.hidden??t.container.hidden??!1)||t.fields.length===0||t.fields.every(r=>Fo(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&&_(kt,{isPending:t.isPending,children:t.control})]})})})}import{jsx as Ao}from"react/jsx-runtime";function zn(t){return Ao("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(A,{expanded:o})]}),o&&Vn(zn,{title:s,children:d})]}):null}import{atom as Un}from"jotai";var rt=et(),ea=rt.atom,na=rt.clearAll,ra=rt.clear,Hn=rt.report,oa=Un({}),ia=Un(null);import{useAtomValue as Gn}from"jotai";import{jsx as So}from"react/jsx-runtime";function ot(t){let e=Gn(Hn(t.field.name)),r=Gn(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 vo}from"tailwind-merge";import{jsx as $n,jsxs as Io}from"react/jsx-runtime";function Yn(t){let e=t.style?.showOptionalLabel??!0,n=F(t.field)||y(t.field);return Io("label",{"data-slot":"field-label","data-normal":n,className:vo("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:[$n("span",{className:"[[data-slot=column]_&]:md:truncate",children:t.children}),e&&!t.field.required&&$n("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:X("(Optional)",t.translations)})]})}import{jsx as Kn,jsxs as wo}from"react/jsx-runtime";function Xn(t){let e={context:t.context,env:t.config?.env},n=D(t.field.label,e);return wo("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[Kn(Yn,{field:t.field,style:t.config?.style,translations:t.translations,children:b(n,t.translations)}),t.horizontal===!0&&Kn(ot,{config:t.config,context:t.context,field:t.field,translations:t.translations})]})}import{Fragment as ko,jsx as Zn,jsxs as Eo}from"react/jsx-runtime";function Wn(t){return Eo(ko,{children:[t.field.name&&t.field.label&&Zn(Xn,{config:t.config,context:t.context,field:t.field,horizontal:t.horizontal,translations:t.translations}),t.children,t.horizontal===!1&&Zn(ot,{config:t.config,context:t.context,field:t.field,translations:t.translations})]})}function qn(t,e){return t?e(t):null}import{jsx as Jn}from"react/jsx-runtime";function Qn(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 qn(t.config.inputs[t.field.type],i=>Jn(Wn,{config:t.config,context:t.context,field:t.field,horizontal:t.horizontal,translations:t.translations,children:Jn(i,{...t.ariaAttributes,...n,...t.dataAttributes,...o})}))}import{jsx as jn}from"react/jsx-runtime";function tr(t){return!t.errors||t.errors.length===0?null:jn("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)=>jn("li",{children:e},t.name?`${t.name}-error-${n}`:n))})}import{twMerge as Lo}from"tailwind-merge";import{jsx as Oo}from"react/jsx-runtime";function it(t){let e=t.errors&&t.errors.length>0;return Oo("div",{"data-slot":"field","data-clickable":t.isClickable?"true":"false",...e&&{[re]:"true"},...t.disabled&&{[oe]:"true"},"data-orientation":t.orientation,className:Lo("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 Do}from"tailwind-merge";import{jsx as Po}from"react/jsx-runtime";function er(t){return Po(it,{...t,orientation:"vertical",className:Do("gap-3 has-[>[data-slot=field-content]]:items-start",!t.isClickable&&"[&>*]:w-full"),children:t.children})}import{twMerge as Mo}from"tailwind-merge";import{jsx as _o}from"react/jsx-runtime";function nr(t){return _o(it,{...t,orientation:"horizontal",className:Mo("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 rr}from"react/jsx-runtime";function or(t){let e=Me(t.field),n=y(t.field),r=Ve(t.field);return t.horizontal?rr(nr,{disabled:t.disabled,errors:t.errors,isCheckbox:n,isReversed:r,isClickable:e,children:t.children}):rr(er,{disabled:t.disabled,errors:t.errors,isCheckbox:n,isReversed:r,isClickable:e,children:t.children})}function ir(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 zo}from"tailwind-merge";import{jsx as At,jsxs as Vo}from"react/jsx-runtime";function lr(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 Vo("div",{className:zo("flex flex-col gap-3",Tn(e)),children:[At(or,{disabled:o,errors:n,field:t.field,horizontal:r,children:At(ir,{disabled:o,errors:n,field:t.field,horizontal:r,lang:t.lang,translations:t.translations,children:t.children})}),At(tr,{errors:n,name:t.field.name})]})}import{twMerge as Nt}from"tailwind-merge";import{useState as Bo}from"react";import{Fragment as Uo,jsx as g,jsxs as C}from"react/jsx-runtime";function ar(t){let e=t.isMultiField||t.collapsed!=null,[n,r]=Bo(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:Nt("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(Uo,{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:Nt("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:Nt("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(A,{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(k,{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(k,{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 Ho}from"react/jsx-runtime";function sr(t){let e=b(Cn(t.field),t.translations),n=Rn(t.field);return hn(t.field,t.value).map(r=>Ho(ar,{collapsed:t.field.advanced?.collapsed,index:r,isMultiField:n,label:e,translations:t.translations,children:t.children(r)},r))}import{jsx as Go}from"react/jsx-runtime";function cr(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 Go(tt,{description:r,empty:e,id:t.field.name,title:n,children:t.children})}import{jsx as dr}from"react/jsx-runtime";function ur({children:t,field:e,lang:n,translations:r,value:o}){return dr(cr,{field:e,translations:r,children:dr(sr,{field:e,lang:n,translations:r,value:o,children:t})})}import{twMerge as $o}from"tailwind-merge";import{jsx as fr,jsxs as Yo}from"react/jsx-runtime";function mr(t){let e=bn(t.column?.advanced?.cols);return Yo("div",{className:"flex w-full flex-col gap-4",children:[fr("div",{"data-slot":"column",className:$o("grid grid-cols-1 gap-3 sm:gap-4",e),children:t.children}),t.column?.description&&fr(nt,{config:t.config,context:t.context,text:t.column.description,translations:t.translations})]})}import{Fragment as Xo}from"react";import{jsx as Ko}from"react/jsx-runtime";function gr(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 Ko(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 Zo}from"react/jsx-runtime";function z(t){let{field:e,list:n}=t.components;return J(t.fields).map((r,o)=>Zo(Xo,{children:[v(r)&&V(mr,{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(gr,{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 Wo}from"react/jsx-runtime";function pr(t){return n=>Wo(z,{...n,components:t})}var xr=pr({field:lr,list:ur});import{jsx as St}from"react/jsx-runtime";function vt(t){let e=en(t.lang,t.translations);return St(_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})=>St(xr,{config:t.config,context:t.context,disabled:n,fields:r,lang:t.lang,style:t.config.style,translations:e,value:t.value,children:o=>St(Qn,{...o,config:t.config,context:t.context,translations:e,value:t.value})})})}import{Suspense as qo}from"react";import{jsx as yr}from"react/jsx-runtime";function Jo(t){return yr(qo,{fallback:yr(vt,{config:t.config,sections:t.sections,readOnly:!0}),children:t.children})}export{Jo 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,
|
|
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 | {
|
|
@@ -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,
|
|
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;
|
|
@@ -1,2 +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;
|
|
2
7
|
export declare function translateOptions<T>(options: T[], dictionary?: Record<string, string>): T[];
|
|
@@ -5,4 +5,5 @@ export declare const Field: (props: Readonly<Readonly<Readonly<{
|
|
|
5
5
|
field: import('../../../../../luna-core/index').Field;
|
|
6
6
|
lang?: string;
|
|
7
7
|
style?: import('../../../../../luna-core/index').Style;
|
|
8
|
+
translations?: Record<string, string>;
|
|
8
9
|
}>>>) => import("react").JSX.Element | null;
|
|
@@ -8,3 +8,15 @@ export declare const clearInputValueAtom: import("jotai").WritableAtom<null, [na
|
|
|
8
8
|
init: null;
|
|
9
9
|
};
|
|
10
10
|
export declare const reportValueAtom: import("jotai-family").AtomFamily<string, import("jotai").WritableAtom<{} | undefined, [newValue: unknown], void>>;
|
|
11
|
+
export declare const appliedAutoFillAtom: import("jotai").PrimitiveAtom<Record<string, unknown>> & {
|
|
12
|
+
init: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
export declare const pendingAutoFillAtom: import("jotai").PrimitiveAtom<{
|
|
15
|
+
target: string;
|
|
16
|
+
value: unknown;
|
|
17
|
+
} | null> & {
|
|
18
|
+
init: {
|
|
19
|
+
target: string;
|
|
20
|
+
value: unknown;
|
|
21
|
+
} | null;
|
|
22
|
+
};
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-luna-form",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
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",
|
|
@@ -34,7 +34,7 @@
|
|
|
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.76"
|
|
38
38
|
},
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"repository": {
|