react-luna-form 0.0.42 → 0.0.43

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.
Files changed (27) hide show
  1. package/dist/client/cjs/index.js +1 -1
  2. package/dist/client/esm/index.js +1 -1
  3. package/dist/server/cjs/index.js +1 -1
  4. package/dist/server/esm/index.js +1 -1
  5. package/dist/types/luna-react/src/client/component/input-base.d.ts +2 -4
  6. package/dist/types/luna-react/src/client/component/input-strategies.d.ts +15 -19
  7. package/dist/types/luna-react/src/client/hook/use-input-core.d.ts +3 -6
  8. package/dist/types/luna-react/src/client/hook/use-write-only-source.d.ts +1 -3
  9. package/package.json +4 -13
  10. package/dist/timezone/cjs/index.js +0 -1
  11. package/dist/timezone/esm/chunk-6YOSEW3U.js +0 -1
  12. package/dist/timezone/esm/chunk-AJTG6FUX.js +0 -1
  13. package/dist/timezone/esm/chunk-EFQWCKYQ.js +0 -818
  14. package/dist/timezone/esm/chunk-JRS2SJNX.js +0 -818
  15. package/dist/timezone/esm/index.js +0 -1
  16. package/dist/timezone/esm/input-timezone-3TSHVJH7.js +0 -766
  17. package/dist/timezone/esm/input-timezone-D6UUK3LG.js +0 -1
  18. package/dist/timezone/esm/input-timezone-E45Y56W6.js +0 -766
  19. package/dist/timezone/esm/input-timezone-K27DM6BM.js +0 -1
  20. package/dist/timezone/esm/timezone-data-G5A3C2I7.js +0 -1
  21. package/dist/timezone/esm/timezone-data-LPD7JMNB.js +0 -412
  22. package/dist/timezone/esm/timezone-data-STGETEL3.js +0 -1
  23. package/dist/timezone/esm/timezone-data-XTIMFTET.js +0 -412
  24. package/dist/types/luna-react/src/client/component/input-registry.d.ts +0 -8
  25. package/dist/types/luna-react/src/client/component/input-timezone.d.ts +0 -2
  26. package/dist/types/luna-react/src/client/hook/use-timezone-options.d.ts +0 -7
  27. package/dist/types/luna-react/src/timezone/index.d.ts +0 -3
@@ -1 +0,0 @@
1
- import{a as U,b as w,c as W,d as Q,e as X,f as Y,g as Z,i as j,j as ee,k as te,l as ne,m as C,n as re,o as oe,p as h,q as ie,r as ae,s as le,u as ue}from"./chunk-AJTG6FUX.js";import{jsx as ze}from"react/jsx-runtime";function ce(e){return ze("p",{className:"-mt-2 text-xs leading-normal font-normal text-slate-600 dark:text-slate-400",children:e.children})}import{jsx as Me}from"react/jsx-runtime";function se(e){return W(e,(t,r,n)=>Me("a",{className:"underline",href:r,rel:"noopener noreferrer",target:"_blank",children:n},`${r}-${t}`))}import{jsx as Le}from"react/jsx-runtime";function N(e){let t={context:e.context,env:e.config?.env},r=h(w(e.text,t),e.translations),n=se(r);return n?Le(ce,{children:n}):null}import{twMerge as Be}from"tailwind-merge";import{jsx as Ge,jsxs as He}from"react/jsx-runtime";function fe(e){let t=e.style?.showOptionalLabel??!0,r=ee(e.field)||j(e.field);return He("label",{"data-slot":"field-label","data-normal":r,className:Be("flex w-fit items-center gap-2 text-sm leading-snug font-medium select-none","data-[normal=true]:font-normal","group-data-[readonly=true]:cursor-not-allowed group-data-[readonly=true]:opacity-50"),htmlFor:e.field.name,children:[e.children,t&&!e.field.required&&Ge("span",{className:"text-sm text-slate-600 dark:text-slate-400",children:h("(Optional)",e.translations)})]})}import{jsx as de,jsxs as qe}from"react/jsx-runtime";function me(e){let t={context:e.context,env:e.config?.env},r=w(e.field.label,t);return qe("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[de(fe,{field:e.field,style:e.config?.style,translations:e.translations,children:h(r,e.translations)}),e.horizontal===!0&&de(N,{config:e.config,context:e.context,text:e.field.description,translations:e.translations})]})}import{Fragment as Ue,jsx as ge,jsxs as Ke}from"react/jsx-runtime";function pe(e){return Ke(Ue,{children:[e.field.name&&e.field.label&&ge(me,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&ge(N,{config:e.config,context:e.context,text:e.field.description,translations:e.translations})]})}function Re(e,t){return e?t(e):null}import{useCallback as ct,useEffect as st,useRef as ft}from"react";import{atom as x}from"jotai";import{atomFamily as he}from"jotai-family";import{deepEqual as K}from"fast-equals";function O(e,t){let{[t]:r,...n}=e;return n}function _e(e){return he(t=>x(r=>r(e)[t]??void 0,(r,n,i)=>{let o=r(e);if(i!=null){let a=o[t];K(a,i)||n(e,{...o,[t]:i})}else t in o&&n(e,O(o,t))}))}function $e(e){return x(null,(t,r)=>{let n=t(e);n&&Object.keys(n).length>0&&r(e,{})})}function Je(e){return x(null,(t,r,n)=>{let o={...t(e)},a=!1;for(let l of n)l in o&&(delete o[l],a=!0);a&&r(e,o)})}function We(e){return x(null,(t,r,n)=>{let i=t(e);K(i,n)||r(e,n)})}function ye(e,t={}){let{merge:r,validateTarget:n}=t;return he(i=>x(o=>{let a=o(e)[i];if(a&&r)return r(Object.values(a))},(o,a,l,u)=>{if(n&&!n(l))return;let c=o(e),s={...c[l]??{}};if(u!=null){let m=s[i];(!m||!K(m,u))&&(s[i]=u,a(e,{...c,[l]:s}))}else i in s&&(delete s[i],Object.keys(s).length===0?a(e,O(c,l)):a(e,{...c,[l]:s}))}))}function xe(e){return x(null,(t,r,n)=>{let o={...t(e)},a=!1;for(let l of n)l in o&&(delete o[l],a=!0);for(let l in o){let u={...o[l]},c=!1;for(let s of n)s in u&&(delete u[s],c=!0,a=!0);c&&(Object.keys(u).length===0?delete o[l]:o[l]=u)}a&&r(e,o)})}function I(e={}){let t=x(e);return{atom:t,clearAll:$e(t),clear:Je(t),bulkReport:We(t),report:_e(t)}}var ve=I(),Se=ve.atom,Qt=ve.report;var _=I(),Zt=_.clear,jt=_.bulkReport,Te=_.report;var D=I(),Ce=D.atom,nn=D.clearAll,rn=D.clear,z=D.report;import{useCallback as Ae,useRef as M,useTransition as et}from"react";import{useEffect as Qe,useEffectEvent as Ie,useMemo as Xe}from"react";function ke(e,t,r,n){let{name:i}=e,o=Xe(()=>ie(e,n),[e,n]),a=Ie(u=>{u&&t(u,o,e)}),l=Ie(u=>{u&&r(u)});return Qe(()=>(a(i),()=>{l(i)}),[i]),o}import{useSetAtom as $,useStore as tt}from"jotai";import{useCallback as Ye,useEffect as Ze,useRef as je}from"react";function be(){let e=je(null);return Ze(()=>()=>{e.current&&clearTimeout(e.current)},[]),Ye((r,n)=>{e.current&&(clearTimeout(e.current),e.current=null),e.current=setTimeout(r,n)},[])}function Ee(e,t){let r=tt(),n=e.field.advanced?.entity,i=be(),[,o]=et(),{setValue:a,shouldSkipOnChange:l,value:u,setSource:c}=t,s=M(u);s.current=u;let m=M(e.translations);m.current=e.translations;let k=te(e.field),v=$(Ce),L=$(Se),y=$(Te(e.field.name)),b=ke(e.field,e.onMount,e.onUnmount,e.translations),B=h(e.commonProps.placeholder,e.translations),F={...e.commonProps,placeholder:B},A=M(null);A.current=d=>{if(a(d),e.onValueChange){let p=e.dataAttributes??{};e.onValueChange({data:Object.keys(p).length>0?p:void 0,name:e.field.name,type:e.field.type,value:d})}};let E=M(null);E.current=d=>{let p=e.field.event?.change;p&&Q(p,({sources:R,states:T,values:V})=>{o(()=>{X(d,R,(f,g)=>c(f,g)),Y(d,T,(f,g)=>{L(P=>g?f.reduce((H,q)=>({...H,[q]:g}),P):f.reduce((H,q)=>O(H,q),P))}),Z(d,V,(f,g)=>{v(P=>({...P,[f]:g}))})})})};let S=Ae(d=>{let R=b.safeParse(d).error?.issues.map(f=>f.message)??[],T=e.field.validation?.custom,V=T?ae(d,T,f=>r.get(z(f)),m.current):[];y([...R,...V])},[e.field.validation?.custom,b,y,r]),G=Ae(d=>{if(!k){let p=d.target.value;e.config.validation.blur&&S(p)}},[k,e.config.validation.blur,S]);return{applyChangeEventsRef:E,commonProps:F,entity:n,hasClickable:k,onBlur:G,onValueChangeRef:A,setTimeoutRef:i,shouldSkipOnChange:l,validated:S,valueRef:s}}import{deepEqual as nt}from"fast-equals";import{useAtom as rt}from"jotai";import{useCallback as ot,useEffect as it,useRef as at,useEffectEvent as lt}from"react";function Ve(e,t){let{name:r}=e,n=at(!1),[i,o]=rt(z(r)),a=lt(u=>{let c=ut(r,u);C(c)&&(nt(i,c)||(n.current=!0),o(c))});it(()=>{t&&a(t)},[t]);let l=ot(()=>n.current?(n.current=!1,!0):!1,[]);return{setValue:o,shouldSkipOnChange:l,value:i}}function ut(e,t){if(e in t)return t[e];if(!e.includes("."))return;let r=e.split("."),n=t;for(let i of r){if(n==null)return;if(Array.isArray(n)){let o=Number(i);n=Number.isInteger(o)?n[o]:void 0}else if(typeof n=="object")n=n[i];else return}return n}import{jsx as Fe}from"react/jsx-runtime";function Pe(e){let{useSource:t,useExtraProps:r,getValue:n,shouldSkipChange:i,dispatchChange:o,buildInitialSelected:a,isInitialReady:l}=e.strategies,{setValue:u,shouldSkipOnChange:c,value:s}=Ve(e.field,e.value),{data:m,setSource:k}=t(e.field,e.config,s),{applyChangeEventsRef:v,commonProps:L,entity:y,hasClickable:b,onBlur:B,onValueChangeRef:F,setTimeoutRef:A,validated:E,valueRef:S}=Ee(e,{setValue:u,shouldSkipOnChange:c,value:s,setSource:k}),G=r?.(e.field),d=ft(!1),{commonPropsWithOptions:p,defaultValue:R}=re(e.field,L,m,s),T=oe(e.field,R);st(()=>{if(d.current||!e.value)return;if(!e.field.event?.change){d.current=!0;return}if(!C(R)||!l(e.field,R,m))return;d.current=!0;let f=a(R,m,y);v.current?.(f)},[v,a,m,R,y,l,e.field,e.value]);let V=ct(f=>{let g=n(f,e.field);i({shouldSkipOnChange:c,hasClickable:b,inputValue:g,valueRef:S})||(F.current?.(g),e.config.validation.change&&E(g),e.field.event?.change&&o({applyChangeEventsRef:v,data:m,entity:y,inputValue:g,setTimeoutRef:A}))},[v,m,o,y,n,b,F,e.config.validation.change,e.field,A,i,c,E,S]);return Re(e.config.inputs[e.field.type],f=>Fe(pe,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:Fe(f,{...p,...e.ariaAttributes,...e.dataAttributes,...G,...T,onBlur:B,onChange:V})}))}import{jsx as dt}from"react/jsx-runtime";function we(e){return function(r){return dt(Pe,{...r,strategies:e})}}import{atom as mt}from"jotai";var gt=e=>{let t=le(e);if(t)return t},pt=e=>e.trim()!=="",Ne=mt({}),Oe=ye(Ne,{merge:gt,validateTarget:pt}),Hn=xe(Ne);import{useEffect as Rt,useState as ht}from"react";import{useSetAtom as yt}from"jotai";var J=null;function De(e){let t=yt(Oe(e.name)),[r,n]=ht(J);return Rt(()=>{if(J)return;let i=!1;return ue().then(o=>{J=o,i||n(o)}),()=>{i=!0}},[]),{data:r,setSource:t}}var xt=we({useSource:De,getValue:e=>e.target.value,shouldSkipChange:({shouldSkipOnChange:e,hasClickable:t})=>!t&&e(),dispatchChange:({applyChangeEventsRef:e,data:t,entity:r,inputValue:n})=>{e.current?.(U(n,t,r))},buildInitialSelected:(e,t,r)=>U(String(e),t,r),isInitialReady:(e,t,r)=>(!ne(e)||!!r&&r.length>0)&&C(t)}),Yn=xt;export{Yn as default};