@famalabs/web-ui 1.0.0-beta.30 → 1.0.0-beta.31

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.
@@ -1 +1 @@
1
- import{c as e}from"react/compiler-runtime";import r from"@mui/material/FormLabel";import{DateTimePicker as o}from"@mui/x-date-pickers/DateTimePicker";import i from"dayjs";import{CalendarFoldIcon as t}from"lucide-react";import l from"react";import{useWatch as s,Controller as a}from"react-hook-form";import{useIsAiEditing as n,useIsAiDirty as d,useTypewriterSpeed as m}from"./AiEditingContext.js";import{aiEffectStyle as u,AI_COLOR as c,AiLabelWrapper as f}from"./AiUtils.js";import{jsx as p,jsxs as x,Fragment as b}from"react/jsx-runtime";function y(y){const v=e(16),{name:h,control:P,defaultValue:D,rules:g,shouldUnregister:A,legend:F,fullWidth:k,required:S,stringOnEmpty:q,...B}=y,V=void 0===F||F,M=void 0===k||k,j=void 0!==S&&S,z=void 0!==q&&q?"":null,L=n(h),Y=d(h),C=m(),I=B.minDate??i("1900-01-01"),O=B.maxDate??i("2099-12-31"),U=e=>(!I||e.isAfter(I)||e.isSame(I,"day"))&&(!O||e.isBefore(O)||e.isSame(O,"day"));let E;v[0]!==P||v[1]!==h?(E={control:P,name:h},v[0]=P,v[1]=h,v[2]=E):E=v[2];const H=s(E),[T,W]=l.useState(H),[w,G]=l.useState(()=>{if(H){const e=i(H);return e.isValid()&&U(e)?e:null}return null});if(H!==T)if(W(H),H){const e=i(H);G(e.isValid()&&U(e)?e:null)}else G(null);let J;v[3]!==z||v[4]!==G?(J=(e,r,o)=>{if(!e||!e.isValid())return r(z),o(),void G(null);r(e.toDate().toISOString()),o(),G(e)},v[3]=z,v[4]=G,v[5]=J):J=v[5];const K=J,N=B.slotProps?.textField?.sx,Q=[u({animate:L,dirty:Y,duration:C}),...Array.isArray(N)?N:N?[N]:[]],R=L?"none":void 0;let X;v[6]!==R?(X={display:R},v[6]=R,v[7]=X):X=v[7];const Z=[...Array.isArray(N)?N:N?[N]:[],X],$=e=>{const{field:i,fieldState:l}=e,{error:s}=l;return x(b,{children:[V&&B.label&&p(r,{required:!Y&&j,sx:{display:"flex",color:Y||L?c:void 0,"& .MuiFormLabel-asterisk":{color:L||Y?c:"error.main"}},children:p(f,{name:h,label:B.label,required:j})}),p(o,{views:["year","month","day"],format:"DD/MM/YYYY HH:mm",...B,...i,ref:i.ref,formatDensity:"dense",value:w,onChange:e=>{e&&e.isValid()&&U(e)?G(e):G(null)},minDate:I,maxDate:O,enableAccessibleFieldDOMStructure:!1,onAccept:e=>K(e,i.onChange,i.onBlur),slots:{...B.slots,openPickerIcon:t},slotProps:{openPickerIcon:{color:Y?c:void 0,size:"small"===B.slotProps?.textField?.size?18:22},openPickerButton:{size:B.slotProps?.textField?.size,sx:Z},...B.slotProps,textField:{required:j,fullWidth:M,label:V?"":p(f,{name:h,label:B.label,required:j}),error:Boolean(s),helperText:s?.message,onBlur:i.onBlur,slotProps:{inputLabel:{required:!Y&&void 0,sx:{display:"flex",color:Y||L?c:void 0,"& .MuiFormLabel-asterisk":{color:Y||L?c:void 0}}}},...B.slotProps?.textField,sx:Q}}})]})};let _;return v[8]!==P||v[9]!==B.disabled||v[10]!==D||v[11]!==h||v[12]!==g||v[13]!==A||v[14]!==$?(_=p(a,{name:h,control:P,defaultValue:D,disabled:B.disabled,rules:g,shouldUnregister:A,render:$}),v[8]=P,v[9]=B.disabled,v[10]=D,v[11]=h,v[12]=g,v[13]=A,v[14]=$,v[15]=_):_=v[15],_}export{y as DateField};
1
+ import{c as e}from"react/compiler-runtime";import r from"@mui/material/FormLabel";import{DateTimePicker as o}from"@mui/x-date-pickers/DateTimePicker";import t from"dayjs";import{CalendarFoldIcon as l}from"lucide-react";import i from"react";import{useWatch as n,Controller as s}from"react-hook-form";import{useIsAiEditing as a,useIsAiDirty as d,useTypewriterSpeed as u}from"./AiEditingContext.js";import{aiEffectStyle as m,AI_COLOR as c,AiLabelWrapper as p}from"./AiUtils.js";import{jsx as f,jsxs as x,Fragment as b}from"react/jsx-runtime";function v(v){const y=e(18),{name:h,control:P,defaultValue:D,rules:g,shouldUnregister:F,legend:k,fullWidth:A,required:q,stringOnEmpty:S,...V}=v,B=void 0===k||k,C=void 0===A||A,M=void 0!==q&&q,O=void 0!==S&&S?"":null,j=a(h),z=d(h),L=u(),Y=V.minDate??t("1900-01-01"),I=V.maxDate??t("2099-12-31");let U;y[0]!==P||y[1]!==h?(U={control:P,name:h},y[0]=P,y[1]=h,y[2]=U):U=y[2];const E=n(U),H=i.useRef(!1),[T,W]=i.useState(E);let w;y[3]!==E?(w=()=>{if(E){const e=t(E);return e.isValid()?e:null}return null},y[3]=E,y[4]=w):w=y[4];const[R,G]=i.useState(w);if(E!==T)if(W(E),E){const e=t(E);G(e.isValid()?e:null)}else G(null);let J;y[5]!==O||y[6]!==G?(J=(e,r,o)=>{if(!e||!e.isValid())return r(O),o(),void G(null);r(e.toDate().toISOString()),o(),G(e)},y[5]=O,y[6]=G,y[7]=J):J=y[7];const K=J,N=V.slotProps?.textField?.sx,Q=[m({animate:j,dirty:z,duration:L}),...Array.isArray(N)?N:N?[N]:[]],X=j?"none":void 0;let Z;y[8]!==X?(Z={display:X},y[8]=X,y[9]=Z):Z=y[9];const $=[...Array.isArray(N)?N:N?[N]:[],Z],_=e=>{const{field:t,fieldState:i}=e,{error:n}=i;return x(b,{children:[B&&V.label&&f(r,{required:!z&&M,sx:{display:"flex",color:z||j?c:void 0,"& .MuiFormLabel-asterisk":{color:j||z?c:"error.main"}},children:f(p,{name:h,label:V.label,required:M})}),f(o,{views:["year","month","day"],format:"DD/MM/YYYY HH:mm",...V,...t,ref:t.ref,formatDensity:"dense",value:R,onOpen:()=>{H.current=!0,V.onOpen?.()},onClose:()=>{H.current=!1,V.onClose?.()},onChange:e=>{H.current&&(e&&e.isValid()?G(e):G(null))},minDate:Y,maxDate:I,enableAccessibleFieldDOMStructure:!1,onAccept:e=>K(e,t.onChange,t.onBlur),slots:{...V.slots,openPickerIcon:l},slotProps:{openPickerIcon:{color:z?c:void 0,size:"small"===V.slotProps?.textField?.size?18:22},openPickerButton:{size:V.slotProps?.textField?.size,sx:$},...V.slotProps,textField:{required:M,fullWidth:C,label:B?"":f(p,{name:h,label:V.label,required:M}),error:Boolean(n),helperText:n?.message,onBlur:t.onBlur,slotProps:{inputLabel:{required:!z&&void 0,sx:{display:"flex",color:z||j?c:void 0,"& .MuiFormLabel-asterisk":{color:z||j?c:void 0}}}},...V.slotProps?.textField,sx:Q}}})]})};let ee;return y[10]!==P||y[11]!==V.disabled||y[12]!==D||y[13]!==h||y[14]!==g||y[15]!==F||y[16]!==_?(ee=f(s,{name:h,control:P,defaultValue:D,disabled:V.disabled,rules:g,shouldUnregister:F,render:_}),y[10]=P,y[11]=V.disabled,y[12]=D,y[13]=h,y[14]=g,y[15]=F,y[16]=_,y[17]=ee):ee=y[17],ee}export{v as DateField};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@famalabs/web-ui",
3
- "version": "1.0.0-beta.30",
3
+ "version": "1.0.0-beta.31",
4
4
  "author": " Fama Labs <info@famalabs.com>",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",