@famalabs/web-ui 1.0.0-beta.22 → 1.0.0-beta.23
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/components/auth/AuthSuccess.d.ts +2 -2
- package/dist/components/auth/AuthSuccess.js +1 -1
- package/dist/components/auth/PasswordField.js +1 -1
- package/dist/components/common/MainDiv.d.ts +2 -1
- package/dist/components/common/MainDiv.js +1 -1
- package/dist/components/forms/AutocompleteField.js +1 -1
- package/dist/components/forms/DateField.js +1 -1
- package/dist/components/forms/InputField.js +1 -1
- package/dist/components/forms/RichTextEditor/RichTextEditor.d.ts +1 -0
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +1 -1
- package/dist/components/forms/RichTextField.d.ts +1 -0
- package/dist/components/forms/RichTextField.js +1 -1
- package/dist/components/forms/SelectField.js +1 -1
- package/dist/components/forms/TimeField.js +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
3
|
interface AuthSuccessProps {
|
|
4
4
|
error?: string;
|
|
5
5
|
success?: string;
|
|
6
6
|
title?: string;
|
|
7
7
|
}
|
|
8
|
-
declare const AuthSuccess:
|
|
8
|
+
declare const AuthSuccess: ({ error, title, success, }: AuthSuccessProps) => react_jsx_runtime.JSX.Element;
|
|
9
9
|
|
|
10
10
|
export { AuthSuccess };
|
|
11
11
|
export type { AuthSuccessProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r}from"react/compiler-runtime";import e from"@mui/material/Avatar";import o from"@mui/material/Box";import i from"@mui/material/Typography";import{LockKeyholeIcon as t}from"lucide-react";import
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import e from"@mui/material/Avatar";import o from"@mui/material/Box";import i from"@mui/material/Typography";import{LockKeyholeIcon as t}from"lucide-react";import{jsx as n,jsxs as c}from"react/jsx-runtime";const m=m=>{const p=r(17),{error:s,title:d,success:u}=m,f=void 0===d?"Operation Completed":d,h=void 0===u?"Operation completed successfully":u,g=s?"error":h?"success":"primary";let y,x,v,_,b,C,T,z;return p[0]===Symbol.for("react.memo_cache_sentinel")?(y={paddingTop:"40px",marginTop:a,display:"flex",flexDirection:"column",alignItems:"center"},p[0]=y):y=p[0],p[1]!==g?(x={margin:l,backgroundColor:r=>r.palette[g].main},p[1]=g,p[2]=x):x=p[2],p[3]===Symbol.for("react.memo_cache_sentinel")?(v=n(t,{size:20,color:"white"}),p[3]=v):v=p[3],p[4]!==x?(_=n(e,{sx:x,children:v}),p[4]=x,p[5]=_):_=p[5],p[6]!==f?(b=n(i,{component:"h1",variant:"h5",children:f}),p[6]=f,p[7]=b):b=p[7],p[8]!==s?(C=s&&n("p",{style:{color:"red"},children:"Credenziali non corrette, si prega di riprovare"}),p[8]=s,p[9]=C):C=p[9],p[10]!==h?(T=h&&n("p",{style:{color:"green"},children:h}),p[10]=h,p[11]=T):T=p[11],p[12]!==_||p[13]!==b||p[14]!==C||p[15]!==T?(z=c(o,{sx:y,children:[_,b,C,T]}),p[12]=_,p[13]=b,p[14]=C,p[15]=T,p[16]=z):z=p[16],z};function a(r){return r.spacing(8)}function l(r){return r.spacing(1)}export{m as AuthSuccess};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import t from"@mui/material/FormLabel";import r from"@mui/material/Grid";import o from"@mui/material/IconButton";import a from"@mui/material/InputAdornment";import{styled as
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t from"@mui/material/FormLabel";import r from"@mui/material/Grid";import o from"@mui/material/IconButton";import a from"@mui/material/InputAdornment";import{styled as i,useTheme as n}from"@mui/material/styles";import l from"@mui/material/TextField";import m,{tooltipClasses as s}from"@mui/material/Tooltip";import c from"@mui/material/Typography";import{CheckIcon as p,XIcon as d,EyeClosedIcon as u,EyeIcon as f}from"lucide-react";import h from"react";import{jsx as x,jsxs as g}from"react/jsx-runtime";const b=i(({className:e,...t})=>x(m,{...t,classes:{popper:e}}))(({theme:e})=>({[`& .${s.tooltip}`]:{backgroundColor:e.palette.background.paper,color:"rgba(0, 0, 0, 0.87)",boxShadow:e.shadows[1],fontSize:11}})),y=[{regex:/.{8,}/,label:"Almeno 8 caratteri"},{regex:/[a-z]/,label:"Almeno una lettera minuscola"},{regex:/[A-Z]/,label:"Almeno una lettera maiuscola"},{regex:/\d/,label:"Almeno un numero"}],v=/^(?=.*[a-z])(?=.*\d).{8,}$/,C=i=>{const m=e(56),{title:s,name:C,placeholder:w,variant:z,required:S,requiredText:_,margin:I,size:A,errorText:T,fullWidth:j,showRequirements:k,customIcons:W,sx:q}=i,E=void 0===s?"Password":s,R=void 0===C?"password":C,$=void 0===w?"Inserisci la password":w,O=void 0===z?"outlined":z,B=void 0===S||S,F=void 0===_?"Questo campo è obbligatorio":_,L=void 0===I?"dense":I,P=void 0===A?"medium":A,X=void 0===T?"La password non è conforme":T,D=void 0===j||j,G=void 0===k||k;let M;m[0]!==W?(M=void 0===W?{Eye:f,EyeOff:u,X:d,Check:p}:W,m[0]=W,m[1]=M):M=m[1];const N=M,{Eye:Q,EyeOff:Z,X:H,Check:J}=N,K=n(),[U,V]=h.useState(""),[Y,ee]=h.useState(!1),[te,re]=h.useState("");let oe;m[2]!==Y?(oe=()=>{ee(!Y)},m[2]=Y,m[3]=oe):oe=m[3];const ae=oe;let ie;m[4]!==J||m[5]!==H||m[6]!==K?(ie=e=>x(r,{container:!0,direction:"column",sx:{flexWrap:"nowrap",justifyContent:"center",alignItems:"flex-start",p:2,gap:1},children:y.map((t,o)=>g(r,{container:!0,sx:{flexWrap:"nowrap",justifyContent:"center",alignItems:"center",gap:.5},children:[x(r,{container:!0,sx:{justifyContent:"center",alignItems:"center"},children:t.regex.test(e)?x(J,{size:18,style:{color:K.palette.success.main}}):x(H,{size:18,style:{color:K.palette.error.main}})}),x(r,{container:!0,sx:{justifyContent:"center",alignItems:"center"},children:x(c,{variant:"caption",color:t.regex.test(e)?K.palette.success.main:K.palette.error.main,children:t.label})})]},o))}),m[4]=J,m[5]=H,m[6]=K,m[7]=ie):ie=m[7];const ne=ie,le=h.useRef(null);let me;m[8]!==U?(me=v.test(U),m[8]=U,m[9]=me):me=m[9];const se=me,ce=G&&U.length>0&&!se,pe=`${E}${B?"*":""}`;let de,ue;m[10]!==pe?(de=x(t,{children:pe}),m[10]=pe,m[11]=de):de=m[11],m[12]!==ne||m[13]!==U?(ue=ne(U),m[12]=ne,m[13]=U,m[14]=ue):ue=m[14];const fe=ce??!1;let he;m[15]===Symbol.for("react.memo_cache_sentinel")?(he=()=>le.current?.blur(),m[15]=he):he=m[15];const xe=Y?"text":"password",ge=!!te;let be,ye,ve,Ce,we,ze,Se,_e,Ie,Ae,Te;return m[16]===Symbol.for("react.memo_cache_sentinel")?(be=e=>V(e.target.value),m[16]=be):be=m[16],m[17]!==X||m[18]!==B||m[19]!==F?(ye=e=>{!e.target.value&&B?re(F):v.test(e.target.value)||re(X)},m[17]=X,m[18]=B,m[19]=F,m[20]=ye):ye=m[20],m[21]===Symbol.for("react.memo_cache_sentinel")?(ve=()=>re(""),m[21]=ve):ve=m[21],m[22]===Symbol.for("react.memo_cache_sentinel")?(Ce={borderRadius:"10px","& fieldset":{borderWidth:"2px"}},m[22]=Ce):Ce=m[22],m[23]!==q?(we={...q,"& .MuiOutlinedInput-root":Ce},m[23]=q,m[24]=we):we=m[24],m[25]===Symbol.for("react.memo_cache_sentinel")?(ze={mr:"-5px"},m[25]=ze):ze=m[25],m[26]!==Q||m[27]!==Z||m[28]!==Y||m[29]!==P?(Se=x(Y?Z:Q,{size:"small"===P?18:24}),m[26]=Q,m[27]=Z,m[28]=Y,m[29]=P,m[30]=Se):Se=m[30],m[31]!==ae||m[32]!==Se?(_e={input:{endAdornment:x(a,{position:"end",children:x(o,{onClick:ae,edge:"end",size:"small",focusRipple:!1,sx:ze,children:Se})})}},m[31]=ae,m[32]=Se,m[33]=_e):_e=m[33],m[34]!==D||m[35]!==L||m[36]!==R||m[37]!==U||m[38]!==te||m[39]!==$||m[40]!==B||m[41]!==P||m[42]!==xe||m[43]!==ge||m[44]!==ye||m[45]!==we||m[46]!==_e||m[47]!==O?(Ie=x(l,{ref:le,fullWidth:D,name:R,type:xe,placeholder:$,variant:O,required:B,margin:L,error:ge,helperText:te,value:U,size:P,autoComplete:"off",onChange:be,onBlur:ye,onChangeCapture:ve,sx:we,slotProps:_e}),m[34]=D,m[35]=L,m[36]=R,m[37]=U,m[38]=te,m[39]=$,m[40]=B,m[41]=P,m[42]=xe,m[43]=ge,m[44]=ye,m[45]=we,m[46]=_e,m[47]=O,m[48]=Ie):Ie=m[48],m[49]!==ue||m[50]!==fe||m[51]!==Ie?(Ae=x(b,{title:ue,placement:"bottom-start",open:fe,onClose:he,enterDelay:300,children:Ie}),m[49]=ue,m[50]=fe,m[51]=Ie,m[52]=Ae):Ae=m[52],m[53]!==de||m[54]!==Ae?(Te=g(r,{size:12,children:[de,Ae]}),m[53]=de,m[54]=Ae,m[55]=Te):Te=m[55],Te};export{C as PasswordField};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
interface IProps {
|
|
4
5
|
appbar?: boolean;
|
|
5
6
|
children: React.ReactNode;
|
|
6
7
|
}
|
|
7
|
-
declare const MainDiv:
|
|
8
|
+
declare const MainDiv: ({ children }: IProps) => react_jsx_runtime.JSX.Element;
|
|
8
9
|
|
|
9
10
|
export { MainDiv };
|
|
10
11
|
export type { IProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r}from"react/compiler-runtime";import
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import{styled as t}from"@mui/material/styles";import"react";import{jsx as e}from"react/jsx-runtime";const o=t("main")(({theme:r})=>({flex:1,height:"100%",overflow:"auto",backgroundColor:r.palette.background.default})),m=t=>{const m=r(2),{children:i}=t;let a;return m[0]!==i?(a=e(o,{children:i}),m[0]=i,m[1]=a):a=m[1],a};export{m as MainDiv};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r}from"react/compiler-runtime";import e from"@mui/material/Autocomplete";import o from"@mui/material/FormControl";import l from"@mui/material/FormLabel";import t from"@mui/material/InputAdornment";import i from"@mui/material/TextField";import{SparklesIcon as a}from"lucide-react";import{Controller as n}from"react-hook-form";import{useIsAiEditing as m,useIsAiDirty as s,useTypewriterSpeed as d}from"./AiEditingContext.js";import{aiEffectStyle as u,aiLabelStyle as c}from"./AiUtils.js";import{jsx as p,jsxs as f,Fragment as h}from"react/jsx-runtime";function x(x){const b=r(37),g=x;let A,v,C,F,y,B,j,T,U,k;b[0]!==g?(({name:y,control:v,defaultValue:C,rules:j,shouldUnregister:T,legend:U,label:F,textFieldProps:k,onChange:B,...A}=g),b[0]=g,b[1]=A,b[2]=v,b[3]=C,b[4]=F,b[5]=y,b[6]=B,b[7]=j,b[8]=T,b[9]=U,b[10]=k):(A=b[1],v=b[2],C=b[3],F=b[4],y=b[5],B=b[6],j=b[7],T=b[8],U=b[9],k=b[10]);const q=void 0===U||U,z=m(y),I=s(y),L=d();let V,W,E;b[11]!==L||b[12]!==z||b[13]!==I?(V=u({animate:z,dirty:I,duration:L}),b[11]=L,b[12]=z,b[13]=I,b[14]=V):V=b[14],b[15]!==k?(W=Array.isArray(k?.sx)?k.sx:k?.sx?[k.sx]:[],b[15]=k,b[16]=W):W=b[16],b[17]!==V||b[18]!==W?(E=[V,...W],b[17]=V,b[18]=W,b[19]=E):E=b[19];const M=E;let P,S;return b[20]!==A||b[21]!==z||b[22]!==I||b[23]!==F||b[24]!==q||b[25]!==B||b[26]!==k||b[27]!==M?(P=r=>{const{field:n,fieldState:m}=r,{error:s}=m,d=Boolean(A.multiple),u=A.value??(d?[]:n.value||null);return f(h,{children:[q&&p(l,{component:"legend",required:k?.required,sx:{color:I?c.color:void 0,"& .MuiFormLabel-asterisk":{color:z||I?c.color:"error.main"}},children:F}),p(o,{fullWidth:A.fullWidth,style:{marginTop:0},children:p(e,{...A,value:u,onChange:(r,e,o,l)=>{B?B(r,e,o,l):n.onChange(e)},onBlur:n.onBlur,disabled:n.disabled,renderInput:r=>f(h,{children:[p(i,{...r,label:q?"":F,error:Boolean(s),helperText:s?.message,...k,sx:M}),I&&!z&&p(t,{position:"end",sx:{position:"absolute",right:45,top:"55%",transform:"translateY(-50%)"},children:p(a,{size:"small"===k?.size?18:20,color:"rgba(0,122,255,0.8)"})})]})})})]})},b[20]=A,b[21]=z,b[22]=I,b[23]=F,b[24]=q,b[25]=B,b[26]=k,b[27]=M,b[28]=P):P=b[28],b[29]!==A.disabled||b[30]!==v||b[31]!==C||b[32]!==y||b[33]!==j||b[34]!==T||b[35]!==P?(S=p(n,{name:y,control:v,defaultValue:C,disabled:A.disabled,rules:j,shouldUnregister:T,render:P}),b[29]=A.disabled,b[30]=v,b[31]=C,b[32]=y,b[33]=j,b[34]=T,b[35]=P,b[36]=S):S=b[36],S}export{x as AutocompleteField};
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import e from"@mui/material/Autocomplete";import o from"@mui/material/FormControl";import l from"@mui/material/FormLabel";import t from"@mui/material/InputAdornment";import i from"@mui/material/TextField";import{SparklesIcon as a}from"lucide-react";import{Controller as n}from"react-hook-form";import{useIsAiEditing as m,useIsAiDirty as s,useTypewriterSpeed as d}from"./AiEditingContext.js";import{aiEffectStyle as u,aiLabelStyle as c}from"./AiUtils.js";import{jsx as p,jsxs as f,Fragment as h}from"react/jsx-runtime";function x(x){const b=r(37),g=x;let A,v,C,F,y,B,j,T,U,k;b[0]!==g?(({name:y,control:v,defaultValue:C,rules:j,shouldUnregister:T,legend:U,label:F,textFieldProps:k,onChange:B,...A}=g),b[0]=g,b[1]=A,b[2]=v,b[3]=C,b[4]=F,b[5]=y,b[6]=B,b[7]=j,b[8]=T,b[9]=U,b[10]=k):(A=b[1],v=b[2],C=b[3],F=b[4],y=b[5],B=b[6],j=b[7],T=b[8],U=b[9],k=b[10]);const q=void 0===U||U,z=m(y),I=s(y),L=d();let V,W,E;b[11]!==L||b[12]!==z||b[13]!==I?(V=u({animate:z,dirty:I,duration:L}),b[11]=L,b[12]=z,b[13]=I,b[14]=V):V=b[14],b[15]!==k?(W=Array.isArray(k?.sx)?k.sx:k?.sx?[k.sx]:[],b[15]=k,b[16]=W):W=b[16],b[17]!==V||b[18]!==W?(E=[V,...W],b[17]=V,b[18]=W,b[19]=E):E=b[19];const M=E;let P,S;return b[20]!==A||b[21]!==z||b[22]!==I||b[23]!==F||b[24]!==q||b[25]!==B||b[26]!==k||b[27]!==M?(P=r=>{const{field:n,fieldState:m}=r,{error:s}=m,d=Boolean(A.multiple),u=A.value??(d?[]:n.value||null);return f(h,{children:[q&&F&&p(l,{component:"legend",required:k?.required,sx:{color:I?c.color:void 0,"& .MuiFormLabel-asterisk":{color:z||I?c.color:"error.main"}},children:F}),p(o,{fullWidth:A.fullWidth,style:{marginTop:0},children:p(e,{...A,value:u,onChange:(r,e,o,l)=>{B?B(r,e,o,l):n.onChange(e)},onBlur:n.onBlur,disabled:n.disabled,renderInput:r=>f(h,{children:[p(i,{...r,label:q?"":F,error:Boolean(s),helperText:s?.message,...k,sx:M}),I&&!z&&p(t,{position:"end",sx:{position:"absolute",right:45,top:"55%",transform:"translateY(-50%)"},children:p(a,{size:"small"===k?.size?18:20,color:"rgba(0,122,255,0.8)"})})]})})})]})},b[20]=A,b[21]=z,b[22]=I,b[23]=F,b[24]=q,b[25]=B,b[26]=k,b[27]=M,b[28]=P):P=b[28],b[29]!==A.disabled||b[30]!==v||b[31]!==C||b[32]!==y||b[33]!==j||b[34]!==T||b[35]!==P?(S=p(n,{name:y,control:v,defaultValue:C,disabled:A.disabled,rules:j,shouldUnregister:T,render:P}),b[29]=A.disabled,b[30]=v,b[31]=C,b[32]=y,b[33]=j,b[34]=T,b[35]=P,b[36]=S):S=b[36],S}export{x as AutocompleteField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import r from"@mui/material/FormControl";import o from"@mui/material/FormLabel";import t from"@mui/material/InputAdornment";import{useTheme as i}from"@mui/material/styles";import{DateTimePicker as l}from"@mui/x-date-pickers/DateTimePicker";import s from"dayjs";import{CalendarFoldIcon as a,SparklesIcon as n}from"lucide-react";import m from"react";import{useWatch as d,Controller as u}from"react-hook-form";import{useIsAiEditing as c,useIsAiDirty as p,useTypewriterSpeed as f}from"./AiEditingContext.js";import{aiEffectStyle as x,aiLabelStyle as
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import r from"@mui/material/FormControl";import o from"@mui/material/FormLabel";import t from"@mui/material/InputAdornment";import{useTheme as i}from"@mui/material/styles";import{DateTimePicker as l}from"@mui/x-date-pickers/DateTimePicker";import s from"dayjs";import{CalendarFoldIcon as a,SparklesIcon as n}from"lucide-react";import m from"react";import{useWatch as d,Controller as u}from"react-hook-form";import{useIsAiEditing as c,useIsAiDirty as p,useTypewriterSpeed as f}from"./AiEditingContext.js";import{aiEffectStyle as x,aiLabelStyle as b}from"./AiUtils.js";import{jsx as h,jsxs as y,Fragment as g}from"react/jsx-runtime";function v(v){const P=e(16),{name:A,control:D,defaultValue:F,rules:k,shouldUnregister:S,legend:z,fullWidth:B,required:V,stringOnEmpty:j,...C}=v,I=void 0===z||z,M=void 0===B||B,Y=void 0!==V&&V,q=void 0!==j&&j,O=i(),U=q?"":null,E=c(A),H=p(A),L=f(),T=C.minDate??s("1900-01-01"),W=C.maxDate??s("2099-12-31"),w=e=>(!T||e.isAfter(T)||e.isSame(T,"day"))&&(!W||e.isBefore(W)||e.isSame(W,"day"));let G;P[0]!==D||P[1]!==A?(G={control:D,name:A},P[0]=D,P[1]=A,P[2]=G):G=P[2];const J=d(G),[K,N]=m.useState(()=>{if(J){const e=s(J);return e.isValid()&&w(e)?e:null}return null});if(J&&!K){const e=s(J);e.isValid()&&w(e)&&N(e)}let Q;P[3]!==U||P[4]!==N?(Q=(e,r,o)=>{if(!e||!e.isValid())return r(U),o(),void N(null);r(e.toDate().toISOString()),o(),N(e)},P[3]=U,P[4]=N,P[5]=Q):Q=P[5];const R=Q,X=C.slotProps?.textField?.sx,Z=[x({animate:E,dirty:H,duration:L}),...Array.isArray(X)?X:X?[X]:[]],$=E?"none":void 0;let _;P[6]!==$?(_={display:$},P[6]=$,P[7]=_):_=P[7];const ee=[...Array.isArray(X)?X:X?[X]:[],_],re=e=>{const{field:i,fieldState:s}=e,{error:m}=s;return y(r,{fullWidth:M,sx:{margin:"auto",position:"relative"},children:[I&&C.label&&h(o,{required:Y,sx:{color:H||E?b.color:void 0,"& .MuiFormLabel-asterisk":{color:E||H?b.color:"error.main"}},children:C.label}),y(g,{children:[h(l,{views:["year","month","day"],format:"DD/MM/YYYY HH:mm",...C,...i,ref:i.ref,formatDensity:"dense",value:K,onChange:e=>{e&&e.isValid()&&w(e)?N(e):N(null)},minDate:T,maxDate:W,enableAccessibleFieldDOMStructure:!1,onAccept:e=>R(e,i.onChange,i.onBlur),slots:{...C.slots,openPickerIcon:a},slotProps:{openPickerIcon:{color:O.palette.action.active,size:"small"===C.slotProps?.textField?.size?20:24},openPickerButton:{size:C.slotProps?.textField?.size,sx:ee},...C.slotProps,textField:{required:Y,label:I?"":C.label,error:Boolean(m),helperText:m?.message,onBlur:i.onBlur,...C.slotProps?.textField,sx:Z}}}),H&&!E&&h(t,{position:"end",sx:{position:"absolute",right:48,top:I?"59%":"38%"},children:h(n,{size:"small"===C.slotProps?.textField?.size?18:20,color:"rgba(0,122,255,0.8)"})})]})]})};let oe;return P[8]!==D||P[9]!==C.disabled||P[10]!==F||P[11]!==A||P[12]!==k||P[13]!==S||P[14]!==re?(oe=h(u,{name:A,control:D,defaultValue:F,disabled:C.disabled,rules:k,shouldUnregister:S,render:re}),P[8]=D,P[9]=C.disabled,P[10]=F,P[11]=A,P[12]=k,P[13]=S,P[14]=re,P[15]=oe):oe=P[15],oe}export{v as DateField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r}from"react/compiler-runtime";import e from"@mui/material/FormLabel";import o from"@mui/material/InputAdornment";import
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import e from"@mui/material/FormLabel";import o from"@mui/material/InputAdornment";import l from"@mui/material/TextField";import{SparklesIcon as t}from"lucide-react";import{Controller as i}from"react-hook-form";import{useIsAiEditing as n,useIsAiDirty as a,useTypewriterSpeed as s}from"./AiEditingContext.js";import{aiLabelStyle as m,aiEffectStyle as u}from"./AiUtils.js";import{jsx as d,jsxs as p,Fragment as c}from"react/jsx-runtime";function b(b){const f=r(12),{name:h,control:g,defaultValue:x,rules:v,shouldUnregister:A,legend:P,...y}=b,L=void 0===P||P,C=n(h),k=a(h),B=s(),j=y.slotProps?.inputLabel?.sx,F=[...Array.isArray(j)?j:[j],{color:C||k?m.color:void 0}],I=y.sx;let U;f[0]!==B||f[1]!==C||f[2]!==k?(U=u({animate:C,dirty:k,duration:B}),f[0]=B,f[1]=C,f[2]=k,f[3]=U):U=f[3];const q=[U,...Array.isArray(I)?I:[I]],z=r=>{const{field:i,fieldState:n}=r,{error:a}=n,s="number"===y.type;return p(c,{children:[L&&y.label&&d(e,{required:y.required,sx:{color:C||k?m.color:void 0,"& .MuiFormLabel-asterisk":{color:C||k?m.color:"error.main"}},children:y.label}),d(l,{variant:"outlined",fullWidth:!0,...y,label:L?"":y.label,error:Boolean(a),helperText:a?.message,slotProps:{...y.slotProps,inputLabel:{...y.slotProps?.inputLabel,shrink:C||y.slotProps?.inputLabel?.shrink,sx:F},input:{endAdornment:k&&!C&&d(o,{position:"end",children:d(t,{size:"small"===y?.size?18:20,color:"rgba(0,122,255,0.8)"})}),...y.slotProps?.input},htmlInput:{...y.slotProps?.htmlInput||{},...s&&{inputMode:"numeric",pattern:"[0-9]*"}}},...i,disabled:i.disabled,value:i.value??null,onBlur:r=>{i.onBlur(),y.onBlur?.(r)},onChange:r=>{if(y.onChange?.(r),s){const e=r.target.value;i.onChange(""===e?void 0:Number(e))}else i.onChange(r)},sx:q})]})};let M;return f[4]!==g||f[5]!==x||f[6]!==h||f[7]!==v||f[8]!==A||f[9]!==z||f[10]!==y.disabled?(M=d(i,{name:h,control:g,defaultValue:x,disabled:y.disabled,rules:v,shouldUnregister:A,render:z}),f[4]=g,f[5]=x,f[6]=h,f[7]=v,f[8]=A,f[9]=z,f[10]=y.disabled,f[11]=M):M=f[11],M}export{b as InputField};
|
|
@@ -31,6 +31,7 @@ interface RichTextEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
31
31
|
trailingBlock?: boolean;
|
|
32
32
|
onChange?: (text: string) => void;
|
|
33
33
|
onBlur?: (text: string) => void;
|
|
34
|
+
required?: boolean;
|
|
34
35
|
focus?: boolean;
|
|
35
36
|
aiApi?: string;
|
|
36
37
|
theme?: 'light' | 'dark';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t}from"react/compiler-runtime";import"@blocknote/core/fonts/inter.css";import{it as e}from"@blocknote/core/locales";import{BlockNoteView as o,lightDefaultTheme as r,darkDefaultTheme as a}from"@blocknote/mantine";import"@blocknote/mantine/style.css";import{useCreateBlockNote as n}from"@blocknote/react";import{AIExtension as i,AIMenuController as l}from"@blocknote/xl-ai";import{it as s}from"@blocknote/xl-ai/locales";import"@blocknote/xl-ai/style.css";import c from"@mui/material/Button";import d from"@mui/material/Collapse";import p from"@mui/material/GlobalStyles";import m from"@mui/material/Grid";import{useTheme as u,alpha as b}from"@mui/material/styles";import f from"@mui/material/Typography";import{DefaultChatTransport as g}from"ai";import y,{useEffectEvent as h,useEffect as x}from"react";import{useIsAiDirty as k,useIsAiEditing as v,useTypewriterSpeed as B}from"../AiEditingContext.js";import{aiLabelStyle as w}from"../AiUtils.js";import{CustomAIMenu as T,CustomFormattingToolbar as C}from"./FormattingToolbar.js";import{jsxs as M,jsx as S}from"react/jsx-runtime";const j={};for(let t=0;t<50;t++)j[`.bn-ai-effect .bn-block-group .bn-block-outer:nth-of-type(${t+1})`]={animationDelay:`calc(${t} * var(--bn-ai-delay-step, 0.1s))`};const z=z=>{const F=t(147);let P,L,A,H,I,V,$,E,G,N,O,W,R,_,D,U,q,J,Y,K;F[0]!==z?(({ref:N,id:A,name:V,label:I,placeholder:G,mode:W,initialValue:H,readonly:R,disabled:_,error:D,errorMessage:L,trailingBlock:U,onChange:E,onBlur:$,focus:q,aiApi:P,theme:K,backgroundPreset:J,toolbarOptions:Y,...O}=z),F[0]=z,F[1]=P,F[2]=L,F[3]=A,F[4]=H,F[5]=I,F[6]=V,F[7]=$,F[8]=E,F[9]=G,F[10]=N,F[11]=O,F[12]=W,F[13]=R,F[14]=_,F[15]=D,F[16]=U,F[17]=q,F[18]=J,F[19]=Y,F[20]=K):(P=F[1],L=F[2],A=F[3],H=F[4],I=F[5],V=F[6],$=F[7],E=F[8],G=F[9],N=F[10],O=F[11],W=F[12],R=F[13],_=F[14],D=F[15],U=F[16],q=F[17],J=F[18],Y=F[19],K=F[20]);const Q=void 0===W?"html":W,X=void 0!==R&&R,Z=void 0!==_&&_,tt=void 0!==D&&D,et=void 0!==U&&U,ot=void 0!==q&&q,rt=void 0===J?"paper":J;let at;F[21]!==Y?(at=void 0===Y?{}:Y,F[21]=Y,F[22]=at):at=F[22];const nt=at,{style:it,stickyToolbar:lt,selectMenu:st,sideMenu:ct,slashMenu:dt,availableButtons:pt,customButtons:mt,submitButton:ut}=nt,bt=void 0===it?"collapse":it,ft=void 0===lt||lt,gt=void 0!==st&&st,yt=void 0!==ct&&ct,ht=void 0!==dt&&dt;let xt;F[23]!==mt?(xt=void 0===mt?[]:mt,F[23]=mt,F[24]=xt):xt=F[24];const kt=xt,vt=k(V),Bt=v(V),wt=B(),Tt=O?.className,Ct=vt?"bn-ai-dirty":"",Mt=Bt?"bn-ai-effect":"";let St;F[25]!==Tt||F[26]!==Ct||F[27]!==Mt?(St=[Tt,Ct,Mt].filter(Boolean),F[25]=Tt,F[26]=Ct,F[27]=Mt,F[28]=St):St=F[28];const jt=St.join(" ");let zt,Ft,Pt,Lt;F[29]!==G?(zt={...e,ai:s,placeholders:{...e.placeholders,default:G}},F[29]=G,F[30]=zt):zt=F[30],F[31]!==P?(Ft=i({transport:new g({api:P})}),F[31]=P,F[32]=Ft):Ft=F[32],F[33]!==Ft?(Pt=[Ft],F[33]=Ft,F[34]=Pt):Pt=F[34],F[35]!==zt||F[36]!==Pt||F[37]!==et?(Lt={trailingBlock:et,dictionary:zt,extensions:Pt},F[35]=zt,F[36]=Pt,F[37]=et,F[38]=Lt):Lt=F[38];const At=n(Lt),[Ht,It]=y.useState(ot||!1),[Vt,$t]=y.useState(A?H:void 0),Et=u(),Gt=K??Et.palette.mode,Nt="default"===rt?Et.palette.background.default:Et.palette.background.paper,Ot=tt?Et.palette.error.main:Ht?"transparent":"silver";let Wt;F[39]!==rt||F[40]!==Gt||F[41]!==Z||F[42]!==Et?(Wt=((t="light",e,o,n=!1)=>{const i="default"===e?o.palette.background.default:o.palette.background.paper,l="default"===e?o.palette.background.paper:o.palette.background.default;return"light"===t?{...r,colors:{...r.colors,editor:{text:n?o.palette.text.disabled:o.palette.text.primary,background:i},menu:{text:o.palette.text.primary,background:l},selected:{text:"#FFFFFF",background:o.palette.primary.main},hovered:{text:o.palette.text.primary,background:o.palette.action.hover},tooltip:{text:o.palette.text.primary,background:o.palette.background.paper}}}:{...a,colors:{...a.colors,editor:{text:o.palette.text.primary,background:i},menu:{text:o.palette.text.primary,background:l},selected:{text:"#000000",background:o.palette.primary.main},hovered:{text:o.palette.text.primary,background:o.palette.action.hover},tooltip:{text:o.palette.text.primary,background:o.palette.background.paper},shadow:"0 4px 6px rgba(255, 255, 255, 0.21), 0 1px 3px rgba(255, 255, 255, 0.26)",border:o.palette.divider,disabled:{text:o.palette.text.disabled,background:o.palette.action.disabledBackground}}}})(Gt,rt,Et,Z),F[39]=rt,F[40]=Gt,F[41]=Z,F[42]=Et,F[43]=Wt):Wt=F[43];const Rt=Wt,_t="static"===bt?120:void 0,Dt=vt?"rgba(0,122,255,0.3)":Ot,Ut=Ht?"0 0 0 2px "+Et.palette.primary.main:void 0,qt=Z?"none":"auto",Jt=Z?"none":"auto";let Yt;F[44]!==Nt||F[45]!==_t||F[46]!==Dt||F[47]!==Ut||F[48]!==qt||F[49]!==Jt?(Yt={backgroundColor:Nt,paddingTop:10,width:"100%",minHeight:_t,borderWidth:1,borderStyle:"solid",borderColor:Dt,borderRadius:16,boxShadow:Ut,pointerEvents:qt,userSelect:Jt},F[44]=Nt,F[45]=_t,F[46]=Dt,F[47]=Ut,F[48]=qt,F[49]=Jt,F[50]=Yt):Yt=F[50];const Kt=Yt;let Qt;F[51]!==wt||F[52]!==Z||F[53]!==Bt||F[54]!==vt||F[55]!==Et.palette.primary.main||F[56]!==Et.palette.text.primary?(Qt=((t,e={})=>{const o={".bn-ai-dirty":{border:"2px solid",borderColor:"rgba(0,122,255,0.3)",transition:"border-color 0.3s ease",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3), inset 0 0 0 1px rgba(0,122,255,0.5)",borderRadius:8},".bn-ai-dirty .bn-editor":{backgroundColor:"transparent",color:w.color}},r=t.duration||0,a=Math.max(.03,Math.min(.15,r/12)),n=Math.max(.18,Math.min(.45,r/3.5)),i={".bn-ai-effect":{borderColor:"rgba(0,122,255,0.5)",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3)",animation:"aiGlowPulse 1.2s ease-in-out infinite","--bn-ai-delay-step":`${a}s`},".bn-ai-effect .bn-editor":{backgroundColor:"transparent",color:w.color},".bn-ai-effect .bn-block-group .bn-block-outer":{overflow:"hidden",opacity:0,transform:"translateY(8px)",willChange:"opacity, transform",animation:`aiChunkIn ${n}s cubic-bezier(0.22, 1, 0.36, 1) forwards`}};return{'.bn-mantine[data-mantine-color-scheme="dark"]':{"--mantine-color-scheme":"light"},".ProseMirror .bn-editor .bn-default-styles":{bakcgroundColor:"transparent"},".bn-editor":{backgroundColor:"transparent"},".bn-mantine .bn-select":{scrollbarColor:"silver transparent"},"bn-menu-dropdown":{scrollbarColor:"silver transparent",scrollbarWidth:"thin"},".bn-default-styles h1":{fontSize:"32px"},".bn-default-styles h2":{fontSize:"24px"},".bn-default-styles h3":{fontSize:"16px"},".bn-container":{display:"flex",flexDirection:"column",height:"100%",gap:"8px"},".bn-formatting-toolbar":{display:"flex !important",flexWrap:"wrap !important",margin:"10px",marginTop:"25px",boxShadow:"none !important",maxWidth:"100% !important",borderRadius:"24px !important",padding:"2px 12px !important"},...t.dirty?o:{},...t.animate?{...i,...j}:{},...e}})({animate:Bt,dirty:vt,duration:wt},{".bn-editor ::selection":{backgroundColor:b(Et.palette.primary.main,.24),color:Et.palette.text.primary},".bn-editor *::selection":{backgroundColor:b(Et.palette.primary.main,.24),color:Et.palette.text.primary},...Z?{".bn-inline-content":{userSelect:Z?"none":"auto",pointerEvents:Z?"none":"auto",color:Z?"gray":"inherit"}}:{}}),F[51]=wt,F[52]=Z,F[53]=Bt,F[54]=vt,F[55]=Et.palette.primary.main,F[56]=Et.palette.text.primary,F[57]=Qt):Qt=F[57];const Xt=Qt,Zt="collapse"===bt&&Ht&&!X&&!Z,te="collapse"!==bt&&!X&&!Z;let ee;F[58]!==At||F[59]!==Q?(ee=()=>{if(At)switch(Q){case"html":return At.blocksToHTMLLossy(At.document);case"full_html":return At.blocksToFullHTML(At.document);case"json":return JSON.stringify(At.document,null,2);case"markdown":return At.blocksToMarkdownLossy(At.document);default:return}},F[58]=At,F[59]=Q,F[60]=ee):ee=F[60];const oe=ee;let re;F[61]!==Z||F[62]!==oe||F[63]!==A||F[64]!==X||F[65]!==Vt?(re=()=>{if(X||Z)return;const t=oe();return A&&"string"==typeof t&&Vt!==t&&$t(t),t},F[61]=Z,F[62]=oe,F[63]=A,F[64]=X,F[65]=Vt,F[66]=re):re=F[66];const ae=re;let ne;F[67]!==ae||F[68]!==E?(ne=()=>{const t=ae();t&&E?.(t)},F[67]=ae,F[68]=E,F[69]=ne):ne=F[69];const ie=ne;let le;F[70]!==ae||F[71]!==Ht||F[72]!==$?(le=t=>{t.stopPropagation();const e=document.querySelector(".bn-container, .bn-formatting-toolbar");if(e&&t.relatedTarget instanceof Node&&e.contains(t.relatedTarget))return;Ht&&It(!1);const o=ae();o&&$?.(o)},F[70]=ae,F[71]=Ht,F[72]=$,F[73]=le):le=F[73];const se=le;let ce;F[74]!==At||F[75]!==H||F[76]!==Q?(ce=()=>{if(At&&H&&"html"===Q)if("string"==typeof H)try{const t=At.tryParseHTMLToBlocks(H);At.replaceBlocks(At.document,t)}catch(t){const e=t;console.error(e)}else console.error('Value must be a string when mode is "html"')},F[74]=At,F[75]=H,F[76]=Q,F[77]=ce):ce=F[77];const de=h(ce);let pe;F[78]!==At||F[79]!==H||F[80]!==Q?(pe=()=>{if(At&&H&&"full_html"===Q)if("string"==typeof H)try{const t=At.tryParseHTMLToBlocks(H);At.replaceBlocks(At.document,t)}catch(t){const e=t;console.error(e)}else console.error('Value must be a string when mode is "html"')},F[78]=At,F[79]=H,F[80]=Q,F[81]=pe):pe=F[81];const me=h(pe);let ue;F[82]!==At||F[83]!==H||F[84]!==Q?(ue=()=>{if(At&&H&&"json"===Q)if(Array.isArray(H)&&H.length>0)try{At.replaceBlocks(At.document,H)}catch(t){const e=t;console.error(e)}else console.error('Value must be an array of PartialBlock objects when mode is "json"')},F[82]=At,F[83]=H,F[84]=Q,F[85]=ue):ue=F[85];const be=h(ue);let fe;F[86]!==At||F[87]!==H||F[88]!==Q?(fe=()=>{if(At&&H&&"markdown"===Q)if("string"==typeof H)try{const t=At.tryParseMarkdownToBlocks(H);At.replaceBlocks(At.document,t)}catch(t){const e=t;console.error(e)}else console.error('Value must be a string when mode is "markdown"')},F[86]=At,F[87]=H,F[88]=Q,F[89]=fe):fe=F[89];const ge=h(fe);let ye,he,xe,ke,ve,Be,we;return F[90]!==Z||F[91]!==At||F[92]!==oe||F[93]!==H||F[94]!==me||F[95]!==de||F[96]!==be||F[97]!==ge||F[98]!==Q||F[99]!==G?(ye=()=>{if(At){if(!H&&Z){const t=At.tryParseHTMLToBlocks(`<p>${G}</p>`);return void At.replaceBlocks(At.document,t)}if("string"==typeof H){if(oe()===H)return}t:switch(Q){case"html":de();break t;case"full_html":me();break t;case"json":be();break t;case"markdown":ge()}}},F[90]=Z,F[91]=At,F[92]=oe,F[93]=H,F[94]=me,F[95]=de,F[96]=be,F[97]=ge,F[98]=Q,F[99]=G,F[100]=ye):ye=F[100],F[101]!==Z||F[102]!==At||F[103]!==oe||F[104]!==H||F[105]!==Q||F[106]!==G?(he=[At,H,Q,Z,G,oe],F[101]=Z,F[102]=At,F[103]=oe,F[104]=H,F[105]=Q,F[106]=G,F[107]=he):he=F[107],x(ye,he),F[108]!==Xt?(xe=S(p,{styles:Xt}),F[108]=Xt,F[109]=xe):xe=F[109],F[110]!==vt||F[111]!==I?(ke=I&&S(m,{size:12,children:S(f,{variant:"body1",color:vt?w.color:"textSecondary",mb:1,children:I})}),F[110]=vt,F[111]=I,F[112]=ke):ke=F[112],F[113]!==P||F[114]!==pt||F[115]!==jt||F[116]!==kt||F[117]!==Z||F[118]!==At||F[119]!==Kt||F[120]!==Rt||F[121]!==se||F[122]!==ie||F[123]!==A||F[124]!==Zt||F[125]!==Ht||F[126]!==te||F[127]!==G||F[128]!==X||F[129]!==N||F[130]!==O||F[131]!==gt||F[132]!==yt||F[133]!==ht||F[134]!==ft||F[135]!==ut||F[136]!==bt||F[137]!==Vt?(ve=At&&M(m,{ref:N,size:12,container:!0,component:"div",children:[M(o,{title:G,editor:At,slashMenu:ht,sideMenu:yt,editable:!X&&!Z,theme:Rt,formattingToolbar:!1,...O,className:jt,onChange:ie,onBlurCapture:se,onFocusCapture:()=>{X||Z||Ht||It(!0)},style:Kt,children:[P&&S(l,{aiMenu:T,floatingUIOptions:{useFloatingOptions:{strategy:"fixed"}}}),M(m,{container:!0,size:12,sx:{position:ft?"sticky":"relative",bottom:ft?0:void 0,zIndex:ft?2:void 0,backgroundColor:ft?"transparent":void 0,pointerEvents:Z?"none":"auto",userSelect:Z?"none":"auto"},children:[M(m,{flexGrow:1,children:["collapse"===bt&&S(d,{in:Zt,children:S(C,{editor:At,staticToolbar:!0,selectToolbar:gt,availableButtons:{...pt,ai:Boolean(P&&!1!==pt?.ai)},customButtons:kt})}),te&&S(C,{editor:At,staticToolbar:"hidden"!==bt,selectToolbar:gt,availableButtons:{...pt,ai:Boolean(P&&!1!==pt?.ai)},customButtons:kt})]}),ut&&S(m,{container:!0,justifyContent:"flex-end",alignItems:"flex-end",m:"10px",mb:"12px",children:S(c,{type:ut.type??"button",size:"small",color:ut.color??"primary",...ut,children:ut.label||"Custom Action"})})]})]}),A&&S("input",{type:"hidden",name:A,value:Vt??"",style:{display:"none"}})]}),F[113]=P,F[114]=pt,F[115]=jt,F[116]=kt,F[117]=Z,F[118]=At,F[119]=Kt,F[120]=Rt,F[121]=se,F[122]=ie,F[123]=A,F[124]=Zt,F[125]=Ht,F[126]=te,F[127]=G,F[128]=X,F[129]=N,F[130]=O,F[131]=gt,F[132]=yt,F[133]=ht,F[134]=ft,F[135]=ut,F[136]=bt,F[137]=Vt,F[138]=ve):ve=F[138],F[139]!==tt||F[140]!==L?(Be=tt&&L&&S(m,{size:12,children:S(f,{variant:"caption",color:"error",style:{marginInline:"14px",marginTop:"3px",marginBottom:-1},children:L})}),F[139]=tt,F[140]=L,F[141]=Be):Be=F[141],F[142]!==xe||F[143]!==ke||F[144]!==ve||F[145]!==Be?(we=M(m,{container:!0,size:12,children:[xe,ke,ve,Be]}),F[142]=xe,F[143]=ke,F[144]=ve,F[145]=Be,F[146]=we):we=F[146],we};export{z as RichTextEditor};
|
|
1
|
+
import{c as t}from"react/compiler-runtime";import"@blocknote/core/fonts/inter.css";import{it as e}from"@blocknote/core/locales";import{BlockNoteView as o,lightDefaultTheme as r,darkDefaultTheme as a}from"@blocknote/mantine";import"@blocknote/mantine/style.css";import{useCreateBlockNote as n}from"@blocknote/react";import{AIExtension as i,AIMenuController as l}from"@blocknote/xl-ai";import{it as s}from"@blocknote/xl-ai/locales";import"@blocknote/xl-ai/style.css";import c from"@mui/material/Button";import d from"@mui/material/Collapse";import p from"@mui/material/FormLabel";import m from"@mui/material/GlobalStyles";import u from"@mui/material/Grid";import{useTheme as b,alpha as f}from"@mui/material/styles";import g from"@mui/material/Typography";import{DefaultChatTransport as y}from"ai";import h,{useEffectEvent as x,useEffect as k}from"react";import{useIsAiDirty as v,useIsAiEditing as B,useTypewriterSpeed as w}from"../AiEditingContext.js";import{aiLabelStyle as T}from"../AiUtils.js";import{CustomAIMenu as C,CustomFormattingToolbar as M}from"./FormattingToolbar.js";import{jsxs as S,jsx as F}from"react/jsx-runtime";const j={};for(let t=0;t<50;t++)j[`.bn-ai-effect .bn-block-group .bn-block-outer:nth-of-type(${t+1})`]={animationDelay:`calc(${t} * var(--bn-ai-delay-step, 0.1s))`};const z=z=>{const L=t(151);let P,A,H,I,V,$,q,E,G,N,O,W,R,_,D,U,J,Y,K,Q,X;L[0]!==z?(({ref:N,id:H,name:$,label:V,placeholder:G,mode:W,initialValue:I,readonly:R,disabled:_,error:D,errorMessage:A,trailingBlock:U,onChange:E,onBlur:q,required:J,focus:Y,aiApi:P,theme:X,backgroundPreset:K,toolbarOptions:Q,...O}=z),L[0]=z,L[1]=P,L[2]=A,L[3]=H,L[4]=I,L[5]=V,L[6]=$,L[7]=q,L[8]=E,L[9]=G,L[10]=N,L[11]=O,L[12]=W,L[13]=R,L[14]=_,L[15]=D,L[16]=U,L[17]=J,L[18]=Y,L[19]=K,L[20]=Q,L[21]=X):(P=L[1],A=L[2],H=L[3],I=L[4],V=L[5],$=L[6],q=L[7],E=L[8],G=L[9],N=L[10],O=L[11],W=L[12],R=L[13],_=L[14],D=L[15],U=L[16],J=L[17],Y=L[18],K=L[19],Q=L[20],X=L[21]);const Z=void 0===W?"html":W,tt=void 0!==R&&R,et=void 0!==_&&_,ot=void 0!==D&&D,rt=void 0!==U&&U,at=void 0!==J&&J,nt=void 0!==Y&&Y,it=void 0===K?"paper":K;let lt;L[22]!==Q?(lt=void 0===Q?{}:Q,L[22]=Q,L[23]=lt):lt=L[23];const st=lt,{style:ct,stickyToolbar:dt,selectMenu:pt,sideMenu:mt,slashMenu:ut,availableButtons:bt,customButtons:ft,submitButton:gt}=st,yt=void 0===ct?"collapse":ct,ht=void 0===dt||dt,xt=void 0!==pt&&pt,kt=void 0!==mt&&mt,vt=void 0!==ut&&ut;let Bt;L[24]!==ft?(Bt=void 0===ft?[]:ft,L[24]=ft,L[25]=Bt):Bt=L[25];const wt=Bt,Tt=v($),Ct=B($),Mt=w(),St=O?.className,Ft=Tt?"bn-ai-dirty":"",jt=Ct?"bn-ai-effect":"";let zt;L[26]!==St||L[27]!==Ft||L[28]!==jt?(zt=[St,Ft,jt].filter(Boolean),L[26]=St,L[27]=Ft,L[28]=jt,L[29]=zt):zt=L[29];const Lt=zt.join(" ");let Pt,At,Ht,It;L[30]!==G?(Pt={...e,ai:s,placeholders:{...e.placeholders,default:G}},L[30]=G,L[31]=Pt):Pt=L[31],L[32]!==P?(At=i({transport:new y({api:P})}),L[32]=P,L[33]=At):At=L[33],L[34]!==At?(Ht=[At],L[34]=At,L[35]=Ht):Ht=L[35],L[36]!==Pt||L[37]!==Ht||L[38]!==rt?(It={trailingBlock:rt,dictionary:Pt,extensions:Ht},L[36]=Pt,L[37]=Ht,L[38]=rt,L[39]=It):It=L[39];const Vt=n(It),[$t,qt]=h.useState(nt||!1),[Et,Gt]=h.useState(H?I:void 0),Nt=b(),Ot=X??Nt.palette.mode,Wt="default"===it?Nt.palette.background.default:Nt.palette.background.paper,Rt=ot?Nt.palette.error.main:$t?"transparent":"silver";let _t;L[40]!==it||L[41]!==Ot||L[42]!==et||L[43]!==Nt?(_t=((t="light",e,o,n=!1)=>{const i="default"===e?o.palette.background.default:o.palette.background.paper,l="default"===e?o.palette.background.paper:o.palette.background.default;return"light"===t?{...r,colors:{...r.colors,editor:{text:n?o.palette.text.disabled:o.palette.text.primary,background:i},menu:{text:o.palette.text.primary,background:l},selected:{text:"#FFFFFF",background:o.palette.primary.main},hovered:{text:o.palette.text.primary,background:o.palette.action.hover},tooltip:{text:o.palette.text.primary,background:o.palette.background.paper}}}:{...a,colors:{...a.colors,editor:{text:o.palette.text.primary,background:i},menu:{text:o.palette.text.primary,background:l},selected:{text:"#000000",background:o.palette.primary.main},hovered:{text:o.palette.text.primary,background:o.palette.action.hover},tooltip:{text:o.palette.text.primary,background:o.palette.background.paper},shadow:"0 4px 6px rgba(255, 255, 255, 0.21), 0 1px 3px rgba(255, 255, 255, 0.26)",border:o.palette.divider,disabled:{text:o.palette.text.disabled,background:o.palette.action.disabledBackground}}}})(Ot,it,Nt,et),L[40]=it,L[41]=Ot,L[42]=et,L[43]=Nt,L[44]=_t):_t=L[44];const Dt=_t,Ut="static"===yt?120:void 0,Jt=Tt?"rgba(0,122,255,0.3)":Rt,Yt=$t?"0 0 0 2px "+Nt.palette.primary.main:void 0,Kt=et?"none":"auto",Qt=et?"none":"auto";let Xt;L[45]!==Wt||L[46]!==Ut||L[47]!==Jt||L[48]!==Yt||L[49]!==Kt||L[50]!==Qt?(Xt={backgroundColor:Wt,paddingTop:10,width:"100%",minHeight:Ut,borderWidth:1,borderStyle:"solid",borderColor:Jt,borderRadius:16,boxShadow:Yt,pointerEvents:Kt,userSelect:Qt},L[45]=Wt,L[46]=Ut,L[47]=Jt,L[48]=Yt,L[49]=Kt,L[50]=Qt,L[51]=Xt):Xt=L[51];const Zt=Xt;let te;L[52]!==Mt||L[53]!==et||L[54]!==Ct||L[55]!==Tt||L[56]!==Nt.palette.primary.main||L[57]!==Nt.palette.text.primary?(te=((t,e={})=>{const o={".bn-ai-dirty":{border:"2px solid",borderColor:"rgba(0,122,255,0.3)",transition:"border-color 0.3s ease",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3), inset 0 0 0 1px rgba(0,122,255,0.5)",borderRadius:8},".bn-ai-dirty .bn-editor":{backgroundColor:"transparent",color:T.color}},r=t.duration||0,a=Math.max(.03,Math.min(.15,r/12)),n=Math.max(.18,Math.min(.45,r/3.5)),i={".bn-ai-effect":{borderColor:"rgba(0,122,255,0.5)",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3)",animation:"aiGlowPulse 1.2s ease-in-out infinite","--bn-ai-delay-step":`${a}s`},".bn-ai-effect .bn-editor":{backgroundColor:"transparent",color:T.color},".bn-ai-effect .bn-block-group .bn-block-outer":{overflow:"hidden",opacity:0,transform:"translateY(8px)",willChange:"opacity, transform",animation:`aiChunkIn ${n}s cubic-bezier(0.22, 1, 0.36, 1) forwards`}};return{'.bn-mantine[data-mantine-color-scheme="dark"]':{"--mantine-color-scheme":"light"},".ProseMirror .bn-editor .bn-default-styles":{bakcgroundColor:"transparent"},".bn-editor":{backgroundColor:"transparent"},".bn-mantine .bn-select":{scrollbarColor:"silver transparent"},"bn-menu-dropdown":{scrollbarColor:"silver transparent",scrollbarWidth:"thin"},".bn-default-styles h1":{fontSize:"32px"},".bn-default-styles h2":{fontSize:"24px"},".bn-default-styles h3":{fontSize:"16px"},".bn-container":{display:"flex",flexDirection:"column",height:"100%",gap:"8px"},".bn-formatting-toolbar":{display:"flex !important",flexWrap:"wrap !important",margin:"10px",marginTop:"25px",boxShadow:"none !important",maxWidth:"100% !important",borderRadius:"24px !important",padding:"2px 12px !important"},...t.dirty?o:{},...t.animate?{...i,...j}:{},...e}})({animate:Ct,dirty:Tt,duration:Mt},{".bn-editor ::selection":{backgroundColor:f(Nt.palette.primary.main,.24),color:Nt.palette.text.primary},".bn-editor *::selection":{backgroundColor:f(Nt.palette.primary.main,.24),color:Nt.palette.text.primary},...et?{".bn-inline-content":{userSelect:et?"none":"auto",pointerEvents:et?"none":"auto",color:et?"gray":"inherit"}}:{}}),L[52]=Mt,L[53]=et,L[54]=Ct,L[55]=Tt,L[56]=Nt.palette.primary.main,L[57]=Nt.palette.text.primary,L[58]=te):te=L[58];const ee=te,oe="collapse"===yt&&$t&&!tt&&!et,re="collapse"!==yt&&!tt&&!et;let ae;L[59]!==Vt||L[60]!==Z?(ae=()=>{if(Vt)switch(Z){case"html":return Vt.blocksToHTMLLossy(Vt.document);case"full_html":return Vt.blocksToFullHTML(Vt.document);case"json":return JSON.stringify(Vt.document,null,2);case"markdown":return Vt.blocksToMarkdownLossy(Vt.document);default:return}},L[59]=Vt,L[60]=Z,L[61]=ae):ae=L[61];const ne=ae;let ie;L[62]!==et||L[63]!==ne||L[64]!==H||L[65]!==tt||L[66]!==Et?(ie=()=>{if(tt||et)return;const t=ne();return H&&"string"==typeof t&&Et!==t&&Gt(t),t},L[62]=et,L[63]=ne,L[64]=H,L[65]=tt,L[66]=Et,L[67]=ie):ie=L[67];const le=ie;let se;L[68]!==le||L[69]!==E?(se=()=>{const t=le();t&&E?.(t)},L[68]=le,L[69]=E,L[70]=se):se=L[70];const ce=se;let de;L[71]!==le||L[72]!==$t||L[73]!==q?(de=t=>{t.stopPropagation();const e=document.querySelector(".bn-container, .bn-formatting-toolbar");if(e&&t.relatedTarget instanceof Node&&e.contains(t.relatedTarget))return;$t&&qt(!1);const o=le();o&&q?.(o)},L[71]=le,L[72]=$t,L[73]=q,L[74]=de):de=L[74];const pe=de;let me;L[75]!==Vt||L[76]!==I||L[77]!==Z?(me=()=>{if(Vt&&I&&"html"===Z)if("string"==typeof I)try{const t=Vt.tryParseHTMLToBlocks(I);Vt.replaceBlocks(Vt.document,t)}catch(t){const e=t;console.error(e)}else console.error('Value must be a string when mode is "html"')},L[75]=Vt,L[76]=I,L[77]=Z,L[78]=me):me=L[78];const ue=x(me);let be;L[79]!==Vt||L[80]!==I||L[81]!==Z?(be=()=>{if(Vt&&I&&"full_html"===Z)if("string"==typeof I)try{const t=Vt.tryParseHTMLToBlocks(I);Vt.replaceBlocks(Vt.document,t)}catch(t){const e=t;console.error(e)}else console.error('Value must be a string when mode is "html"')},L[79]=Vt,L[80]=I,L[81]=Z,L[82]=be):be=L[82];const fe=x(be);let ge;L[83]!==Vt||L[84]!==I||L[85]!==Z?(ge=()=>{if(Vt&&I&&"json"===Z)if(Array.isArray(I)&&I.length>0)try{Vt.replaceBlocks(Vt.document,I)}catch(t){const e=t;console.error(e)}else console.error('Value must be an array of PartialBlock objects when mode is "json"')},L[83]=Vt,L[84]=I,L[85]=Z,L[86]=ge):ge=L[86];const ye=x(ge);let he;L[87]!==Vt||L[88]!==I||L[89]!==Z?(he=()=>{if(Vt&&I&&"markdown"===Z)if("string"==typeof I)try{const t=Vt.tryParseMarkdownToBlocks(I);Vt.replaceBlocks(Vt.document,t)}catch(t){const e=t;console.error(e)}else console.error('Value must be a string when mode is "markdown"')},L[87]=Vt,L[88]=I,L[89]=Z,L[90]=he):he=L[90];const xe=x(he);let ke,ve,Be,we,Te,Ce,Me;return L[91]!==et||L[92]!==Vt||L[93]!==ne||L[94]!==I||L[95]!==fe||L[96]!==ue||L[97]!==ye||L[98]!==xe||L[99]!==Z||L[100]!==G?(ke=()=>{if(Vt){if(!I&&et){const t=Vt.tryParseHTMLToBlocks(`<p>${G}</p>`);return void Vt.replaceBlocks(Vt.document,t)}if("string"==typeof I){if(ne()===I)return}t:switch(Z){case"html":ue();break t;case"full_html":fe();break t;case"json":ye();break t;case"markdown":xe()}}},L[91]=et,L[92]=Vt,L[93]=ne,L[94]=I,L[95]=fe,L[96]=ue,L[97]=ye,L[98]=xe,L[99]=Z,L[100]=G,L[101]=ke):ke=L[101],L[102]!==et||L[103]!==Vt||L[104]!==ne||L[105]!==I||L[106]!==Z||L[107]!==G?(ve=[Vt,I,Z,et,G,ne],L[102]=et,L[103]=Vt,L[104]=ne,L[105]=I,L[106]=Z,L[107]=G,L[108]=ve):ve=L[108],k(ke,ve),L[109]!==ee?(Be=F(m,{styles:ee}),L[109]=ee,L[110]=Be):Be=L[110],L[111]!==Ct||L[112]!==Tt||L[113]!==V||L[114]!==at?(we=V&&F(p,{required:at,sx:{mb:1,color:Tt?T.color:"textSecondary","& .MuiFormLabel-asterisk":{color:Ct||Tt?T.color:"error.main"}},children:V}),L[111]=Ct,L[112]=Tt,L[113]=V,L[114]=at,L[115]=we):we=L[115],L[116]!==P||L[117]!==bt||L[118]!==Lt||L[119]!==wt||L[120]!==et||L[121]!==Vt||L[122]!==Zt||L[123]!==Dt||L[124]!==pe||L[125]!==ce||L[126]!==H||L[127]!==oe||L[128]!==$t||L[129]!==re||L[130]!==G||L[131]!==tt||L[132]!==N||L[133]!==at||L[134]!==O||L[135]!==xt||L[136]!==kt||L[137]!==vt||L[138]!==ht||L[139]!==gt||L[140]!==yt||L[141]!==Et?(Te=Vt&&S(u,{ref:N,size:12,container:!0,component:"div",children:[S(o,{title:G,editor:Vt,slashMenu:vt,sideMenu:kt,editable:!tt&&!et,theme:Dt,formattingToolbar:!1,...O,className:Lt,onChange:ce,onBlurCapture:pe,onFocusCapture:()=>{tt||et||$t||qt(!0)},style:Zt,children:[P&&F(l,{aiMenu:C,floatingUIOptions:{useFloatingOptions:{strategy:"fixed"}}}),S(u,{container:!0,size:12,sx:{position:ht?"sticky":"relative",bottom:ht?0:void 0,zIndex:ht?2:void 0,backgroundColor:ht?"transparent":void 0,pointerEvents:et?"none":"auto",userSelect:et?"none":"auto"},children:[S(u,{flexGrow:1,children:["collapse"===yt&&F(d,{in:oe,children:F(M,{editor:Vt,staticToolbar:!0,selectToolbar:xt,availableButtons:{...bt,ai:Boolean(P&&!1!==bt?.ai)},customButtons:wt})}),re&&F(M,{editor:Vt,staticToolbar:"hidden"!==yt,selectToolbar:xt,availableButtons:{...bt,ai:Boolean(P&&!1!==bt?.ai)},customButtons:wt})]}),gt&&F(u,{container:!0,justifyContent:"flex-end",alignItems:"flex-end",m:"10px",mb:"12px",children:F(c,{type:gt.type??"button",size:"small",color:gt.color??"primary",...gt,children:gt.label||"Custom Action"})})]})]}),H&&F("input",{type:"hidden",name:H,value:Et??"",required:at,style:{display:"none"}})]}),L[116]=P,L[117]=bt,L[118]=Lt,L[119]=wt,L[120]=et,L[121]=Vt,L[122]=Zt,L[123]=Dt,L[124]=pe,L[125]=ce,L[126]=H,L[127]=oe,L[128]=$t,L[129]=re,L[130]=G,L[131]=tt,L[132]=N,L[133]=at,L[134]=O,L[135]=xt,L[136]=kt,L[137]=vt,L[138]=ht,L[139]=gt,L[140]=yt,L[141]=Et,L[142]=Te):Te=L[142],L[143]!==ot||L[144]!==A?(Ce=ot&&A&&F(u,{size:12,children:F(g,{variant:"caption",color:"error",style:{marginInline:"14px",marginTop:"3px",marginBottom:-1},children:A})}),L[143]=ot,L[144]=A,L[145]=Ce):Ce=L[145],L[146]!==Be||L[147]!==we||L[148]!==Te||L[149]!==Ce?(Me=S(u,{container:!0,size:12,children:[Be,we,Te,Ce]}),L[146]=Be,L[147]=we,L[148]=Te,L[149]=Ce,L[150]=Me):Me=L[150],Me};export{z as RichTextEditor};
|
|
@@ -7,6 +7,7 @@ interface RichTextFieldProps<T extends FieldValues> extends Omit<RichTextEditorP
|
|
|
7
7
|
control: Control<T>;
|
|
8
8
|
defaultValue?: FieldPathValue<T, Path<T>>;
|
|
9
9
|
rules?: Omit<RegisterOptions<T, Path<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
10
|
+
required?: boolean;
|
|
10
11
|
shouldUnregister?: boolean;
|
|
11
12
|
}
|
|
12
13
|
declare function RichTextField<T extends FieldValues>(props: RichTextFieldProps<T>): react_jsx_runtime.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import{useController as r}from"react-hook-form";import{RichTextEditor as o}from"./RichTextEditor/RichTextEditor.js";import{jsx as t}from"react/jsx-runtime";function l(l){const n=e(
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import{useController as r}from"react-hook-form";import{RichTextEditor as o}from"./RichTextEditor/RichTextEditor.js";import{jsx as t}from"react/jsx-runtime";function l(l){const n=e(30);let i,a,s,u,d,m,c,f;n[0]!==l?(({name:s,control:i,defaultValue:a,rules:m,shouldUnregister:c,required:u,...d}=l),n[0]=l,n[1]=i,n[2]=a,n[3]=s,n[4]=u,n[5]=d,n[6]=m,n[7]=c):(i=n[1],a=n[2],s=n[3],u=n[4],d=n[5],m=n[6],c=n[7]),n[8]!==i||n[9]!==a||n[10]!==s||n[11]!==d.disabled||n[12]!==m||n[13]!==c?(f={name:s,control:i,defaultValue:a,disabled:d.disabled,rules:m,shouldUnregister:c},n[8]=i,n[9]=a,n[10]=s,n[11]=d.disabled,n[12]=m,n[13]=c,n[14]=f):f=n[14];const{field:h,fieldState:g}=r(f);let p;n[15]!==h||n[16]!==d?(p=e=>{h.onChange(e),d.onChange?.(e)},n[15]=h,n[16]=d,n[17]=p):p=n[17];const b=p;let x;n[18]!==h||n[19]!==d?(x=e=>{h.onBlur(),d.onBlur?.(e)},n[18]=h,n[19]=d,n[20]=x):x=n[20];const B=x,C=h.value??a,V=Boolean(g.error),j=g.error?.message;let q;return n[21]!==B||n[22]!==b||n[23]!==s||n[24]!==u||n[25]!==d||n[26]!==C||n[27]!==V||n[28]!==j?(q=t(o,{...d,name:s,initialValue:C,onChange:b,onBlur:B,error:V,errorMessage:j,required:u}),n[21]=B,n[22]=b,n[23]=s,n[24]=u,n[25]=d,n[26]=C,n[27]=V,n[28]=j,n[29]=q):q=n[29],q}export{l as RichTextField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r}from"react/compiler-runtime";import e from"@mui/material/FormControl";import i from"@mui/material/FormLabel";import
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import e from"@mui/material/FormControl";import i from"@mui/material/FormLabel";import l from"@mui/material/InputAdornment";import o from"@mui/material/InputLabel";import t from"@mui/material/Select";import{SparklesIcon as a}from"lucide-react";import"react";import{Controller as m}from"react-hook-form";import{useIsAiEditing as d,useIsAiDirty as n,useTypewriterSpeed as s}from"./AiEditingContext.js";import{aiSelectSxEffect as u,aiLabelStyle as c}from"./AiUtils.js";import{jsx as b,jsxs as f,Fragment as p}from"react/jsx-runtime";function h(h){const x=r(20),{name:v,control:g,defaultValue:A,rules:q,shouldUnregister:j,legend:y,children:z,...F}=h,I=void 0===y||y,L=d(v),U=n(v),k=s();let C;x[0]!==k||x[1]!==L||x[2]!==U?(C=u({animate:L,dirty:U,duration:k}),x[0]=k,x[1]=L,x[2]=U,x[3]=C):C=x[3];const S=[C,...Array.isArray(F.sx)?F.sx:F.sx?[F.sx]:[]];let V,W;return x[4]!==z||x[5]!==L||x[6]!==U||x[7]!==I||x[8]!==v||x[9]!==F||x[10]!==S?(V=r=>{const{field:m,fieldState:d}=r,{error:n}=d;return f(p,{children:[I&&F.label&&b(i,{required:F.required,sx:{color:U||L?c.color:void 0,"& .MuiFormLabel-asterisk":{color:L||U?c.color:"error.main"}},children:F.label}),f(e,{fullWidth:F.fullWidth??!0,size:F.size,required:F.required,sx:{position:"relative"},children:[!I&&F.label&&b(o,{id:`${v}-label`,sx:{color:U||L?c.color:void 0},children:F.label}),b(t,{labelId:`${v}-label`,variant:"outlined",...F,label:I?"":F.label,error:Boolean(n),...m,disabled:m.disabled,value:m.value??null,sx:S,children:z}),U&&!L&&b(l,{position:"end",sx:{position:"absolute",right:45,top:"50%",transform:"translateY(-50%)"},children:b(a,{size:20,color:"rgba(0,122,255,0.8)"})})]})]})},x[4]=z,x[5]=L,x[6]=U,x[7]=I,x[8]=v,x[9]=F,x[10]=S,x[11]=V):V=x[11],x[12]!==g||x[13]!==A||x[14]!==v||x[15]!==q||x[16]!==F.disabled||x[17]!==j||x[18]!==V?(W=b(m,{name:v,control:g,defaultValue:A,disabled:F.disabled,rules:q,shouldUnregister:j,render:V}),x[12]=g,x[13]=A,x[14]=v,x[15]=q,x[16]=F.disabled,x[17]=j,x[18]=V,x[19]=W):W=x[19],W}export{h as SelectField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r}from"react/compiler-runtime";import e from"@mui/material/FormControl";import o from"@mui/material/FormLabel";import t from"@mui/material/InputAdornment";import{useTheme as i}from"@mui/material/styles";import{TimePicker as l}from"@mui/x-date-pickers";import s from"dayjs";import{ClockIcon as n,SparklesIcon as a}from"lucide-react";import m from"react";import{useWatch as d,Controller as u}from"react-hook-form";import{useIsAiEditing as c,useIsAiDirty as p,useTypewriterSpeed as f}from"./AiEditingContext.js";import{aiEffectStyle as x,aiLabelStyle as b}from"./AiUtils.js";import{jsx as g,jsxs as h}from"react/jsx-runtime";function y(y){const v=r(19),{name:A,control:F,defaultValue:P,rules:H,shouldUnregister:k,legend:V,required:z,fullWidth:B,stringOnEmpty:j,...C}=y,q=void 0===V||V,I=void 0!==z&&z,S=void 0===B||B,U=void 0!==j&&j,D=i(),E=U?"":null,L="string"==typeof C.format?C.format:"HH:mm",M=c(A),O=p(A),W=f(),T=r=>{if("string"!=typeof r||""===r.trim())return null;const e=s(r,L,!0);if(e.isValid())return e;const o=s(r,["HH","HH:mm","HH:mm:ss"],!0);return o.isValid()?o:null},w=C.slotProps?.textField?.sx,G=[x({animate:M,dirty:O,duration:W}),...Array.isArray(w)?w:w?[w]:[]],J=M?"none":void 0;let K;v[0]!==J?(K={display:J},v[0]=J,v[1]=K):K=v[1];const N=[...Array.isArray(w)?w:w?[w]:[],K];let Q;v[2]!==F||v[3]!==A?(Q={control:F,name:A},v[2]=F,v[3]=A,v[4]=Q):Q=v[4];const R=d(Q);let X;v[5]!==R||v[6]!==T?(X=()=>T(R),v[5]=R,v[6]=T,v[7]=X):X=v[7];const[Y,Z]=m.useState(X);if(!Y){const r=T(R);r&&Z(r)}let $;v[8]!==E||v[9]!==L?($=(r,e,o)=>{if(!r||!r.isValid())return e(E),o(),void Z(null);e(s(r).format(L)),o(),Z(r)},v[8]=E,v[9]=L,v[10]=$):$=v[10];const _=$,rr=r=>{const{field:i,fieldState:s}=r,{error:m}=s;return h(e,{fullWidth:S,sx:{margin:"auto",position:"relative"},children:[q&&g(o,{required:I,sx:{color:O?b.color:void 0,"& .MuiFormLabel-asterisk":{color:M||O?b.color:"error.main"}},children:C.label}),g(l,{format:L,ampm:!1,...C,...i,ref:i.ref,formatDensity:"dense",value:Y,onChange:r=>{r&&r.isValid()?Z(r):Z(null)},enableAccessibleFieldDOMStructure:!1,onAccept:r=>_(r,i.onChange,i.onBlur),slots:{...C.slots,openPickerIcon:n},slotProps:{openPickerIcon:{color:D.palette.action.active,size:"small"===C.slotProps?.textField?.size?20:24},openPickerButton:{size:C.slotProps?.textField?.size,sx:N},...C.slotProps,textField:{required:I,label:q?"":C.label,error:Boolean(m),helperText:m?.message,onBlur:i.onBlur,...C.slotProps?.textField,sx:G}}}),O&&!M&&g(t,{position:"end",sx:{position:"absolute",right:48,top:q?"57%":"38%"},children:g(a,{size:20,color:"rgba(0,122,255,0.8)"})})]})};let er;return v[11]!==F||v[12]!==C.disabled||v[13]!==P||v[14]!==A||v[15]!==H||v[16]!==k||v[17]!==rr?(er=g(u,{name:A,control:F,defaultValue:P,disabled:C.disabled,rules:H,shouldUnregister:k,render:rr}),v[11]=F,v[12]=C.disabled,v[13]=P,v[14]=A,v[15]=H,v[16]=k,v[17]=rr,v[18]=er):er=v[18],er}export{y as TimeField};
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import e from"@mui/material/FormControl";import o from"@mui/material/FormLabel";import t from"@mui/material/InputAdornment";import{useTheme as i}from"@mui/material/styles";import{TimePicker as l}from"@mui/x-date-pickers";import s from"dayjs";import{ClockIcon as n,SparklesIcon as a}from"lucide-react";import m from"react";import{useWatch as d,Controller as u}from"react-hook-form";import{useIsAiEditing as c,useIsAiDirty as p,useTypewriterSpeed as f}from"./AiEditingContext.js";import{aiEffectStyle as x,aiLabelStyle as b}from"./AiUtils.js";import{jsx as g,jsxs as h}from"react/jsx-runtime";function y(y){const v=r(19),{name:A,control:F,defaultValue:P,rules:H,shouldUnregister:k,legend:V,required:z,fullWidth:B,stringOnEmpty:j,...C}=y,q=void 0===V||V,I=void 0!==z&&z,S=void 0===B||B,U=void 0!==j&&j,D=i(),E=U?"":null,L="string"==typeof C.format?C.format:"HH:mm",M=c(A),O=p(A),W=f(),T=r=>{if("string"!=typeof r||""===r.trim())return null;const e=s(r,L,!0);if(e.isValid())return e;const o=s(r,["HH","HH:mm","HH:mm:ss"],!0);return o.isValid()?o:null},w=C.slotProps?.textField?.sx,G=[x({animate:M,dirty:O,duration:W}),...Array.isArray(w)?w:w?[w]:[]],J=M?"none":void 0;let K;v[0]!==J?(K={display:J},v[0]=J,v[1]=K):K=v[1];const N=[...Array.isArray(w)?w:w?[w]:[],K];let Q;v[2]!==F||v[3]!==A?(Q={control:F,name:A},v[2]=F,v[3]=A,v[4]=Q):Q=v[4];const R=d(Q);let X;v[5]!==R||v[6]!==T?(X=()=>T(R),v[5]=R,v[6]=T,v[7]=X):X=v[7];const[Y,Z]=m.useState(X);if(!Y){const r=T(R);r&&Z(r)}let $;v[8]!==E||v[9]!==L?($=(r,e,o)=>{if(!r||!r.isValid())return e(E),o(),void Z(null);e(s(r).format(L)),o(),Z(r)},v[8]=E,v[9]=L,v[10]=$):$=v[10];const _=$,rr=r=>{const{field:i,fieldState:s}=r,{error:m}=s;return h(e,{fullWidth:S,sx:{margin:"auto",position:"relative"},children:[q&&C.label&&g(o,{required:I,sx:{color:O?b.color:void 0,"& .MuiFormLabel-asterisk":{color:M||O?b.color:"error.main"}},children:C.label}),g(l,{format:L,ampm:!1,...C,...i,ref:i.ref,formatDensity:"dense",value:Y,onChange:r=>{r&&r.isValid()?Z(r):Z(null)},enableAccessibleFieldDOMStructure:!1,onAccept:r=>_(r,i.onChange,i.onBlur),slots:{...C.slots,openPickerIcon:n},slotProps:{openPickerIcon:{color:D.palette.action.active,size:"small"===C.slotProps?.textField?.size?20:24},openPickerButton:{size:C.slotProps?.textField?.size,sx:N},...C.slotProps,textField:{required:I,label:q?"":C.label,error:Boolean(m),helperText:m?.message,onBlur:i.onBlur,...C.slotProps?.textField,sx:G}}}),O&&!M&&g(t,{position:"end",sx:{position:"absolute",right:48,top:q?"57%":"38%"},children:g(a,{size:20,color:"rgba(0,122,255,0.8)"})})]})};let er;return v[11]!==F||v[12]!==C.disabled||v[13]!==P||v[14]!==A||v[15]!==H||v[16]!==k||v[17]!==rr?(er=g(u,{name:A,control:F,defaultValue:P,disabled:C.disabled,rules:H,shouldUnregister:k,render:rr}),v[11]=F,v[12]=C.disabled,v[13]=P,v[14]=A,v[15]=H,v[16]=k,v[17]=rr,v[18]=er):er=v[18],er}export{y as TimeField};
|