@famalabs/web-ui 1.0.0-beta.26 → 1.0.0-beta.28
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/forms/AiEditingContext.d.ts +22 -6
- package/dist/components/forms/AiEditingContext.js +1 -1
- package/dist/components/forms/AiUtils.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/FormattingToolbar.d.ts +0 -1
- package/dist/components/forms/RichTextEditor/FormattingToolbar.js +1 -1
- package/dist/components/forms/RichTextEditor/RichTextEditor.d.ts +3 -0
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +1 -1
- package/dist/components/forms/SelectField.js +1 -1
- package/dist/components/forms/TimeField.js +1 -1
- package/dist/components/tables/CardsTable/CardsTable.d.ts +6 -0
- package/dist/components/tables/CardsTable/CardsTable.js +1 -0
- package/dist/components/tables/CardsTable/CardsTableBody.js +1 -0
- package/dist/components/tables/CardsTable/CardsTableFooter.js +1 -0
- package/dist/components/tables/{CardsGrid/DynamicCardsTypes.d.ts → CardsTable/CardsTableTypes.d.ts} +11 -20
- package/dist/components/tables/RealtimeTable/RealTimeTableBody.js +1 -1
- package/dist/components/tables/RealtimeTable/RealtimeTable.js +1 -1
- package/dist/components/tables/RealtimeTable/RealtimeTableTypes.d.ts +28 -11
- package/dist/components/tables/StaticTable/StaticFiltersUlts.js +1 -0
- package/dist/components/tables/StaticTable/StaticTable.d.ts +6 -0
- package/dist/components/tables/StaticTable/StaticTable.js +1 -0
- package/dist/components/tables/StaticTable/StaticTableBody.js +1 -0
- package/dist/components/tables/StaticTable/StaticTableFooter.js +1 -0
- package/dist/components/tables/StaticTable/StaticTableTypes.d.ts +15 -0
- package/dist/components/tables/TableComponents/TableActionHeader.js +1 -1
- package/dist/components/tables/TableComponents/TableCommonBody.js +1 -1
- package/dist/components/tables/TableComponents/TableFilterComponents.js +1 -1
- package/dist/components/tables/TableComponents/TableFilterHeader.js +1 -1
- package/dist/components/tables/TableComponents/TableFunctions.d.ts +5 -3
- package/dist/components/tables/TableComponents/TableFunctions.js +1 -1
- package/dist/components/tables/TableComponents/TableTypes.d.ts +21 -30
- package/dist/components/theme/ThemeLoader/Loader.d.ts +1 -2
- package/dist/components/theme/ThemeLoader/Loader.js +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/components/tables/CardsGrid/CardsBodyCreator.js +0 -1
- package/dist/components/tables/CardsGrid/DynamcCardsFooter.js +0 -1
- package/dist/components/tables/CardsGrid/DynamicCardsTable.d.ts +0 -6
- package/dist/components/tables/CardsGrid/DynamicCardsTable.js +0 -1
- package/dist/components/tables/LegacyTable/LegacyTable.d.ts +0 -6
- package/dist/components/tables/LegacyTable/LegacyTable.js +0 -1
- package/dist/components/tables/LegacyTable/LegacyTableFooter.js +0 -1
- package/dist/components/tables/TableComponents/TableTypes.js +0 -1
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
interface
|
|
5
|
-
fieldName: string;
|
|
6
|
-
text?: string;
|
|
4
|
+
interface AiEditOptions {
|
|
7
5
|
cps?: number;
|
|
8
6
|
markDirty?: boolean;
|
|
9
7
|
clearDirtyFirst?: boolean;
|
|
8
|
+
mode?: 'linear' | 'chunked';
|
|
9
|
+
}
|
|
10
|
+
interface RunAiEditOptions {
|
|
11
|
+
fieldName: string;
|
|
12
|
+
value?: string;
|
|
10
13
|
onStart?: () => void | Promise<void>;
|
|
14
|
+
onComplete?: () => void | Promise<void>;
|
|
15
|
+
onCancel?: () => void | Promise<void>;
|
|
16
|
+
options?: AiEditOptions;
|
|
11
17
|
}
|
|
12
18
|
interface AiEditingContextType {
|
|
13
|
-
aiEditingField: string |
|
|
19
|
+
aiEditingField: string | undefined;
|
|
14
20
|
aiDirtyFields: Set<string>;
|
|
15
|
-
setAiEditingField: (fieldName: string |
|
|
21
|
+
setAiEditingField: (fieldName: string | undefined) => void;
|
|
16
22
|
markAiDirty: (fieldName: string) => void;
|
|
17
23
|
clearAiDirty: (fieldName: string) => void;
|
|
18
24
|
runAiEdits: (options: RunAiEditOptions[]) => Promise<void>;
|
|
@@ -23,6 +29,16 @@ declare const AiEditingProvider: ({ cps, children, }: {
|
|
|
23
29
|
cps?: number;
|
|
24
30
|
children: ReactNode;
|
|
25
31
|
}) => react_jsx_runtime.JSX.Element;
|
|
26
|
-
declare const useAiEditing: () => AiEditingContextType
|
|
32
|
+
declare const useAiEditing: () => AiEditingContextType | {
|
|
33
|
+
aiEditingField: null;
|
|
34
|
+
setAiEditingField: () => null;
|
|
35
|
+
aiDirtyFields: Set<string>;
|
|
36
|
+
markAiDirty: () => null;
|
|
37
|
+
clearAiDirty: () => null;
|
|
38
|
+
typewriterSpeed: number;
|
|
39
|
+
runAiEdits: () => Promise<undefined>;
|
|
40
|
+
cancelAiEdits: () => null;
|
|
41
|
+
};
|
|
27
42
|
|
|
28
43
|
export { AiEditingProvider, useAiEditing };
|
|
44
|
+
export type { RunAiEditOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import t from"@mui/material/GlobalStyles";import r,{createContext as
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t from"@mui/material/GlobalStyles";import r,{createContext as i,startTransition as n}from"react";import{jsxs as o,jsx as a}from"react/jsx-runtime";const c=(e,t)=>{const r=Math.max(0,e.value?.length??0)/Math.max(1,e.options?.cps??Math.max(1,t))*1e3;return Math.max(0,Math.round(r))},l=e=>new Promise(t=>{setTimeout(t,Math.max(0,e))}),s=i(void 0),m=i=>{const m=e(15),{cps:u,children:d}=i,f=void 0===u?90:u;let p;m[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,m[0]=p):p=m[0];const[y,h]=r.useState(p),[S,w]=r.useState(void 0),[b,g]=r.useState(1);let k;m[1]===Symbol.for("react.memo_cache_sentinel")?(k=e=>{h(t=>new Set(t).add(e))},m[1]=k):k=m[1];const v=k;let A;m[2]===Symbol.for("react.memo_cache_sentinel")?(A=e=>{h(t=>{const r=new Set(t);return r.delete(e),r})},m[2]=A):A=m[2];const _=A,x=r.useRef(0);let D;if(m[3]!==f){const e=async e=>{for(const t of e){const e=x.current,r=c(t,f),i=r/1e3;if(!1!==t.options?.clearDirtyFirst&&n(()=>{_(t.fieldName)}),w(t.fieldName),g(i),await(t.onStart?.()),await l(r),e!==x.current)return void await(t.onCancel?.());w(void 0),!1!==t.options?.markDirty&&v(t.fieldName),await(t.onComplete?.())}};D=t=>(x.current=x.current+1,w(void 0),t?.length?e(t):Promise.resolve()),m[3]=f,m[4]=D}else D=m[4];const E=D;let F;m[5]===Symbol.for("react.memo_cache_sentinel")?(F=()=>{x.current=x.current+1,w(void 0),h(new Set)},m[5]=F):F=m[5];const P=F;let M,C,N;return m[6]!==y||m[7]!==S||m[8]!==E||m[9]!==b?(M={aiEditingField:S,setAiEditingField:w,aiDirtyFields:y,markAiDirty:v,clearAiDirty:_,typewriterSpeed:b,runAiEdits:E,cancelAiEdits:P},m[6]=y,m[7]=S,m[8]=E,m[9]=b,m[10]=M):M=m[10],m[11]===Symbol.for("react.memo_cache_sentinel")?(C=a(t,{styles:{"@keyframes aiGlowPulse":{"0%":{backgroundPosition:"0% 0%"},"100%":{backgroundPosition:"-300% 0%"}},"@keyframes aiTyping":{from:{clipPath:"inset(0 100% 0 0)"},to:{clipPath:"inset(0 0 0 0)"}},"@keyframes aiChunkIn":{from:{opacity:0,transform:"translateY(12px)"},to:{opacity:1,transform:"translateY(0)"}},"@media (prefers-reduced-motion: reduce)":{".bn-ai-effect .bn-block-group .bn-block-outer":{animation:"none !important",opacity:1,transform:"none"}}}}),m[11]=C):C=m[11],m[12]!==d||m[13]!==M?(N=o(s.Provider,{value:M,children:[C,d]}),m[12]=d,m[13]=M,m[14]=N):N=m[14],N},u=()=>{const t=e(2),i=r.useContext(s);let n;return t[0]!==i?(n=i??{aiEditingField:null,setAiEditingField:y,aiDirtyFields:new Set,markAiDirty:h,clearAiDirty:S,typewriterSpeed:1,runAiEdits:w,cancelAiEdits:b},t[0]=i,t[1]=n):n=t[1],n},d=e=>{const{aiEditingField:t}=u();return!!e&&t===e},f=t=>{const r=e(3),{aiDirtyFields:i}=u();if(!t)return!1;let n;return r[0]!==i||r[1]!==t?(n=i.has(t),r[0]=i,r[1]=t,r[2]=n):n=r[2],n},p=()=>{const{typewriterSpeed:e}=u();return e};function y(){return null}function h(){return null}function S(){return null}async function w(){}function b(){return null}export{m as AiEditingProvider,u as useAiEditing,f as useIsAiDirty,d as useIsAiEditing,p as useTypewriterSpeed};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import{Box as e,InputAdornment as o,Stack as i}from"@mui/material";import{SparklesIcon as t}from"lucide-react";import"react";import{useIsAiEditing as n,useIsAiDirty as a}from"./AiEditingContext.js";import{jsx as l,jsxs as s}from"react/jsx-runtime";const d="rgba(0,122,255,0.8)",b="rgba(0,122,255,0.5) !important",p="linear-gradient(90deg, rgba(0,122,255,0), rgba(0,122,255,0.8), rgba(0,122,255,0.15), rgba(0,122,255,0.9), rgba(0,122,255,0))",c=({animate:r=!1,dirty:e=!1,duration:o})=>r?{"& .MuiOutlinedInput-root":{pointerEvents:"none",userSelect:"none",position:"relative",bgcolor:"background.paper","&::before":{content:'""',position:"absolute",inset:"-2px",borderRadius:"inherit",background:p,backgroundSize:"300% 100%",animation:"aiGlowPulse 4.5s linear infinite",filter:"blur(8px)",zIndex:-1},"& .MuiInputBase-input":{color:d,animation:`aiTyping ${o||0}s ease-out forwards`,clipPath:"inset(0 100% 0 0)"},"& .MuiAutocomplete-input":{},"& fieldset":{border:"2px solid",borderColor:b},"&:hover fieldset":{borderColor:b},"& textarea":{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}}}:e?{"& .MuiOutlinedInput-root":{"& .MuiInputBase-input":{color:d},"& fieldset":{border:"2px solid",borderColor:b,transition:"border-color 0.3s ease",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3)"},"&:hover fieldset":{borderColor:b}}}:{},u=({animate:r=!1,dirty:e=!1,duration:o})=>r?{pointerEvents:"none",userSelect:"none",position:"relative",bgcolor:"background.paper","&::before":{content:'""',position:"absolute",inset:"-2px",borderRadius:"inherit",background:p,backgroundSize:"300% 100%",animation:"aiGlowPulse 4.5s linear infinite",filter:"blur(8px)",zIndex:-1},"& .MuiInputBase-input":{color:d,animation:`aiTyping ${o||0}s ease-out forwards`},"& fieldset":{border:"2px solid",borderColor:b},"&:hover fieldset":{borderColor:b},"&.Mui-focused fieldset":{borderColor:b},"& textarea":{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}}:e?{"& .MuiInputBase-input":{transition:"border-color 0.3s ease",color:d},"& fieldset":{border:`2px solid ${b}`,transition:"border-color 0.3s ease",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3)"},"&:hover fieldset":{borderColor:b},"&.Mui-focused fieldset":{borderColor:b}}:{},f=Object.fromEntries(Array.from({length:20},(r,e)=>[`.bn-ai-effect .bn-block-group .bn-block-outer:nth-of-type(${e+1})`,{animationDelay:`calc(${e} * var(--bn-ai-delay-step, 0.1s))`}])),m=(r,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 ${b}`,borderRadius:8},".bn-ai-dirty .bn-editor":{backgroundColor:"transparent",color:d}},i=r.duration||0,t=Math.max(.03,Math.min(.15,i/12)),n=Math.max(.18,Math.min(.45,i/3.5)),a={".bn-ai-effect":{position:"relative",border:"2px solid",borderColor:b,"--bn-ai-delay-step":`${t}s`},".bn-ai-effect::before":{content:'""',position:"absolute",inset:"-2px",borderRadius:"inherit",background:p,backgroundSize:"300% 100%",animation:"aiGlowPulse 4.5s linear infinite",filter:"blur(8px)",zIndex:-1},".bn-ai-effect .bn-editor":{backgroundColor:"transparent",color:d},".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"},...r.dirty?o:{},...r.animate?{...a,...f}:{},...e}},x=b=>{const p=r(11),{name:c,label:u,size:f,required:m}=b,x=n(c),g=a(c);if(!g)return u;let h,w,y;return p[0]!==g||p[1]!==m?(h=m&&g&&l(e,{component:"span",className:"MuiFormLabel-asterisk","aria-hidden":"true",sx:{color:d},children:" *"}),p[0]=g,p[1]=m,p[2]=h):h=p[2],p[3]!==x||p[4]!==g||p[5]!==f?(w=g&&!x&&l(o,{position:"end",sx:{color:d},children:l(t,{size:f||12})}),p[3]=x,p[4]=g,p[5]=f,p[6]=w):w=p[6],p[7]!==u||p[8]!==h||p[9]!==w?(y=s(i,{direction:"row",alignItems:"center",children:[u,h,w]}),p[7]=u,p[8]=h,p[9]=w,p[10]=y):y=p[10],y};export{b as AI_BORDER_COLOR,d as AI_COLOR,p as AI_GRADIENT,x as AiLabelWrapper,c as aiEffectStyle,u as aiSelectSxEffect,m as richTextGlobalStyles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import r from"@mui/material/Autocomplete";import o from"@mui/material/FormLabel";import l from"@mui/material/TextField";import{Controller as i}from"react-hook-form";import{useIsAiEditing as t,useIsAiDirty as a,useTypewriterSpeed as d}from"./AiEditingContext.js";import{aiEffectStyle as n,AI_COLOR as s,AiLabelWrapper as m}from"./AiUtils.js";import{jsx as u,jsxs as p,Fragment as c}from"react/jsx-runtime";function f(f){const b=e(38),x=f;let h,g,v,q,A,F,y,B,C,L;b[0]!==x?(({name:A,control:g,defaultValue:v,rules:y,shouldUnregister:B,legend:C,label:q,textFieldProps:L,onChange:F,...h}=x),b[0]=x,b[1]=h,b[2]=g,b[3]=v,b[4]=q,b[5]=A,b[6]=F,b[7]=y,b[8]=B,b[9]=C,b[10]=L):(h=b[1],g=b[2],v=b[3],q=b[4],A=b[5],F=b[6],y=b[7],B=b[8],C=b[9],L=b[10]);const j=void 0===C||C,k=t(A),P=a(A),U=d();let M,T,V;b[11]!==U||b[12]!==k||b[13]!==P?(M=n({animate:k,dirty:P,duration:U}),b[11]=U,b[12]=k,b[13]=P,b[14]=M):M=b[14],b[15]!==L?(T=Array.isArray(L?.sx)?L.sx:L?.sx?[L.sx]:[],b[15]=L,b[16]=T):T=b[16],b[17]!==M||b[18]!==T?(V=[M,...T],b[17]=M,b[18]=T,b[19]=V):V=b[19];const W=V;let E,I;return b[20]!==h||b[21]!==k||b[22]!==P||b[23]!==q||b[24]!==j||b[25]!==A||b[26]!==F||b[27]!==L||b[28]!==W?(E=e=>{const{field:i,fieldState:t}=e,{error:a}=t,d=Boolean(h.multiple),n=h.value??(d?[]:i.value||null);return p(c,{children:[j&&q&&u(o,{component:"legend",required:!P&&L?.required,sx:{display:"flex",color:k||P?s:void 0,"& .MuiFormLabel-asterisk":{color:k||P?s:"error.main"}},children:u(m,{name:A,label:q,required:L?.required})}),u(r,{...h,value:n,onChange:(e,r,o,l)=>{F?F(e,r,o,l):i.onChange(r)},fullWidth:h.fullWidth,onBlur:i.onBlur,disabled:i.disabled,renderInput:e=>u(l,{...e,label:j?"":u(m,{name:A,label:q,required:L?.required}),error:Boolean(a),helperText:a?.message,...L,slotProps:{inputLabel:{required:!P&&void 0,sx:{color:P||k?s:void 0,"& .MuiFormLabel-asterisk":{color:P||k?s:void 0}}},...L?.slotProps},sx:W})})]})},b[20]=h,b[21]=k,b[22]=P,b[23]=q,b[24]=j,b[25]=A,b[26]=F,b[27]=L,b[28]=W,b[29]=E):E=b[29],b[30]!==h.disabled||b[31]!==g||b[32]!==v||b[33]!==A||b[34]!==y||b[35]!==B||b[36]!==E?(I=u(i,{name:A,control:g,defaultValue:v,disabled:h.disabled,rules:y,shouldUnregister:B,render:E}),b[30]=h.disabled,b[31]=g,b[32]=v,b[33]=A,b[34]=y,b[35]=B,b[36]=E,b[37]=I):I=b[37],I}export{f as AutocompleteField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import r from"@mui/material/
|
|
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 +1 @@
|
|
|
1
|
-
import{c as r}from"react/compiler-runtime";import e from"@mui/material/FormLabel";import
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import e from"@mui/material/FormLabel";import l from"@mui/material/TextField";import{Controller as o}from"react-hook-form";import{useIsAiEditing as i,useIsAiDirty as t,useTypewriterSpeed as a}from"./AiEditingContext.js";import{AI_COLOR as n,AiLabelWrapper as s,aiEffectStyle as d}from"./AiUtils.js";import{jsx as u,jsxs as m,Fragment as p}from"react/jsx-runtime";function b(b){const c=r(12),{name:f,control:h,defaultValue:x,rules:g,shouldUnregister:v,legend:y,...A}=b,q=void 0===y||y,L=i(f),P=t(f),k=a(),C=A.slotProps?.inputLabel?.sx,B=[...Array.isArray(C)?C:[C],{color:L||P?n:void 0}],F=A.sx;let j;c[0]!==k||c[1]!==L||c[2]!==P?(j=d({animate:L,dirty:P,duration:k}),c[0]=k,c[1]=L,c[2]=P,c[3]=j):j=c[3];const M=[j,...Array.isArray(F)?F:[F]],U=r=>{const{field:o,fieldState:i}=r,{error:t}=i,a="number"===A.type;return m(p,{children:[q&&A.label&&u(e,{required:!P&&A.required,sx:{display:"flex",color:L||P?n:void 0,flexWrap:"nowrap","& .MuiFormLabel-asterisk":{color:L||P?n:"error.main"}},children:u(s,{name:f,label:A.label,required:A.required})}),u(l,{variant:"outlined",fullWidth:!0,...A,label:q?"":u(s,{name:f,label:A.label,required:A.required}),slotProps:{...A.slotProps,inputLabel:{...A.slotProps?.inputLabel,required:!P&&void 0,shrink:L||A.slotProps?.inputLabel?.shrink,sx:[{display:"flex"},...Array.isArray(B)?B:[B],{"& .MuiFormLabel-asterisk":{color:L||P?n:void 0}}]},htmlInput:{...A.slotProps?.htmlInput||{},...a&&{inputMode:"numeric",pattern:"[0-9]*"}}},...o,error:Boolean(t),helperText:t?.message,disabled:o.disabled,value:o.value??null,onBlur:r=>{o.onBlur(),A.onBlur?.(r)},onChange:r=>{if(A.onChange?.(r),a){const e=r.target.value;o.onChange(""===e?void 0:Number(e))}else o.onChange(r)},sx:M})]})};let I;return c[4]!==h||c[5]!==x||c[6]!==f||c[7]!==g||c[8]!==v||c[9]!==U||c[10]!==A.disabled?(I=u(o,{name:f,control:h,defaultValue:x,disabled:A.disabled,rules:g,shouldUnregister:v,render:U}),c[4]=h,c[5]=x,c[6]=f,c[7]=g,c[8]=v,c[9]=U,c[10]=A.disabled,c[11]=I):I=c[11],I}export{b as InputField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t}from"react/compiler-runtime";import"@blocknote/core/fonts/inter.css";import"@blocknote/mantine/style.css";import{useExtensionState as e,blockTypeSelectItems as n,BlockTypeSelect as o,BasicTextStyleButton as i,TextAlignButton as r,ColorStyleButton as l,NestBlockButton as c,UnnestBlockButton as a,CreateLinkButton as s,useComponentsContext as u,useBlockNoteEditor as b,useExtension as d,FormattingToolbarController as m,FormattingToolbar as _}from"@blocknote/react";import{AIExtension as g,useAIDictionary as f,AIMenu as h,getDefaultAIMenuItems as k}from"@blocknote/xl-ai";import{SparklesIcon as p}from"lucide-react";import y,{useLayoutEffect as A}from"react";import{rewriteContent as S,correctGrammar as T,translateContent as x,rewriteInformal as B,rewriteFormal as v,rewriteConcise as M}from"./AiMenuItems.js";import{jsx as I,jsxs as z,Fragment as G}from"react/jsx-runtime";const H=u=>{const b=t(28),{editor:d,staticToolbar:f,selectToolbar:h,availableButtons:k,customButtons:p}=u,y=void 0===f||f,A=void 0!==h&&h;let S;b[0]!==d?(S={editor:d},b[0]=d,b[1]=S):S=b[1];const T=e(g,S),x="closed"!==T?.aiMenuState,B="closed"===T?.aiMenuState,v=k?.heading??"full",M=k?.bold??!0,H=k?.italic??!0,j=k?.underline??!0,E=k?.strike??!0,C=k?.code??!1,N=k?.textAlign??!0,R=k?.color??!0,W=k?.nestBlock??!1,q=k?.unnestBlock??!1,D=k?.link??!0,F=k?.ai??!1;let J;if(b[2]!==p||b[3]!==d.dictionary||b[4]!==N||b[5]!==R||b[6]!==W||b[7]!==q||b[8]!==D||b[9]!==F||b[10]!==v||b[11]!==M||b[12]!==H||b[13]!==j||b[14]!==E||b[15]!==C){const t={heading:v,bold:M,italic:H,underline:j,strike:E,code:C,textAlign:N,color:R,nestBlock:W,link:D,ai:F},e=n(d.dictionary),u=[I(o,{items:"full"===t.heading?e:e.slice(Array.isArray(t.heading)?t.heading[0]:0,Array.isArray(t.heading)?t.heading[1]:!0===t.heading?e.length:0)},"select_button"),I(w,{},"ai_button"),I(i,{basicTextStyle:"bold"},"bold_button"),I(i,{basicTextStyle:"italic"},"italic_button"),I(i,{basicTextStyle:"underline"},"underline_button"),I(i,{basicTextStyle:"strike"},"strike_button"),I(i,{basicTextStyle:"code"},"code_button"),I(r,{textAlignment:"left"},"align_left_button"),I(r,{textAlignment:"center"},"align_center_butto"),I(r,{textAlignment:"right"},"align_right_button"),I(l,{},"color_button"),I(c,{},"nest_button"),I(a,{},"unnest_button"),I(s,{},"link_button")].filter(e=>{switch(e.key){case"select_button":return t.heading;case"bold_button":return t.bold;case"italic_button":return t.italic;case"underline_button":return t.underline;case"strike_button":return t.strike;case"code_button":return t.code;case"align_left_button":case"align_center_butto":case"align_right_button":return t.textAlign;case"color_button":return t.color;case"nest_button":case"unnest_button":return t.nestBlock;case"link_button":return t.link;case"ai_button":return t.ai;default:return!0}});t:{if(!p||0===p.length){J=u;break t}const t=[...u];p.forEach(e=>{const{button:n,position:o}=e;let i=void 0===o?0:o;(!i||i>t.length)&&(i=t.length),i<0&&(i=0),i>=t.length?t.push(n):t.splice(i,0,n)}),J=t}b[2]=p,b[3]=d.dictionary,b[4]=N,b[5]=R,b[6]=W,b[7]=q,b[8]=D,b[9]=F,b[10]=v,b[11]=M,b[12]=H,b[13]=j,b[14]=E,b[15]=C,b[16]=J}else J=b[16];const K=J;let O,P,Q;return b[17]!==B||b[18]!==K||b[19]!==A?(O=A&&B&&I(m,{formattingToolbar:()=>I(_,{children:K})}),b[17]=B,b[18]=K,b[19]=A,b[20]=O):O=b[20],b[21]!==x||b[22]!==K||b[23]!==y?(P=y&&I(_,{children:I(L,{frozen:x,children:K})}),b[21]=x,b[22]=K,b[23]=y,b[24]=P):P=b[24],b[25]!==O||b[26]!==P?(Q=z(G,{children:[O,P]}),b[25]=O,b[26]=P,b[27]=Q):Q=b[27],Q},L=e=>{const n=t(11),{frozen:o,children:i}=e,[r,l]=y.useState(""),c=y.useRef(null);let a,s,u,b;if(n[0]!==o?(a=()=>{!o&&c.current&&c.current.innerHTML&&l(c.current.innerHTML)},n[0]=o,n[1]=a):a=n[1],n[2]!==i||n[3]!==o?(s=[o,i],n[2]=i,n[3]=o,n[4]=s):s=n[4],A(a,s),o&&r){let t,e;return n[5]===Symbol.for("react.memo_cache_sentinel")?(t={display:"contents",pointerEvents:"none",opacity:.5},n[5]=t):t=n[5],n[6]!==r?(e=I("div",{"aria-hidden":!0,style:t,dangerouslySetInnerHTML:{__html:r}}),n[6]=r,n[7]=e):e=n[7],e}return n[8]===Symbol.for("react.memo_cache_sentinel")?(u={display:"contents"},n[8]=u):u=n[8],n[9]!==i?(b=I("div",{ref:c,style:u,children:i}),n[9]=i,n[10]=b):b=n[10],b};function j(){const e=t(1);let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=I(h,{items:E}),e[0]=n):n=e[0],n}function E(t,e){return"user-input"===e?t.getSelection()?[S(t),T(t),x(),B(t),v(t),M(t)]:[S(t,!1),T(t,!1),x(),B(t,!1),v(t,!1),M(t,!1)]:k(t,e)}const w=()=>{const e=t(8),n=f(),o=u(),i=b(),r=d(g);if(!r||!o)return null;let l;e[0]!==r||e[1]!==i?(l=()=>{const t=i.getSelection();if(t?.blocks?.length)
|
|
1
|
+
import{c as t}from"react/compiler-runtime";import"@blocknote/core/fonts/inter.css";import"@blocknote/mantine/style.css";import{useExtensionState as e,blockTypeSelectItems as n,BlockTypeSelect as o,BasicTextStyleButton as i,TextAlignButton as r,ColorStyleButton as l,NestBlockButton as c,UnnestBlockButton as a,CreateLinkButton as s,useComponentsContext as u,useBlockNoteEditor as b,useExtension as d,FormattingToolbarController as m,FormattingToolbar as _}from"@blocknote/react";import{AIExtension as g,useAIDictionary as f,AIMenu as h,getDefaultAIMenuItems as k}from"@blocknote/xl-ai";import{SparklesIcon as p}from"lucide-react";import y,{useLayoutEffect as A}from"react";import{rewriteContent as S,correctGrammar as T,translateContent as x,rewriteInformal as B,rewriteFormal as v,rewriteConcise as M}from"./AiMenuItems.js";import{jsx as I,jsxs as z,Fragment as G}from"react/jsx-runtime";const H=u=>{const b=t(28),{editor:d,staticToolbar:f,selectToolbar:h,availableButtons:k,customButtons:p}=u,y=void 0===f||f,A=void 0!==h&&h;let S;b[0]!==d?(S={editor:d},b[0]=d,b[1]=S):S=b[1];const T=e(g,S),x="closed"!==T?.aiMenuState,B="closed"===T?.aiMenuState,v=k?.heading??"full",M=k?.bold??!0,H=k?.italic??!0,j=k?.underline??!0,E=k?.strike??!0,C=k?.code??!1,N=k?.textAlign??!0,R=k?.color??!0,W=k?.nestBlock??!1,q=k?.unnestBlock??!1,D=k?.link??!0,F=k?.ai??!1;let J;if(b[2]!==p||b[3]!==d.dictionary||b[4]!==N||b[5]!==R||b[6]!==W||b[7]!==q||b[8]!==D||b[9]!==F||b[10]!==v||b[11]!==M||b[12]!==H||b[13]!==j||b[14]!==E||b[15]!==C){const t={heading:v,bold:M,italic:H,underline:j,strike:E,code:C,textAlign:N,color:R,nestBlock:W,link:D,ai:F},e=n(d.dictionary),u=[I(o,{items:"full"===t.heading?e:e.slice(Array.isArray(t.heading)?t.heading[0]:0,Array.isArray(t.heading)?t.heading[1]:!0===t.heading?e.length:0)},"select_button"),I(w,{},"ai_button"),I(i,{basicTextStyle:"bold"},"bold_button"),I(i,{basicTextStyle:"italic"},"italic_button"),I(i,{basicTextStyle:"underline"},"underline_button"),I(i,{basicTextStyle:"strike"},"strike_button"),I(i,{basicTextStyle:"code"},"code_button"),I(r,{textAlignment:"left"},"align_left_button"),I(r,{textAlignment:"center"},"align_center_butto"),I(r,{textAlignment:"right"},"align_right_button"),I(l,{},"color_button"),I(c,{},"nest_button"),I(a,{},"unnest_button"),I(s,{},"link_button")].filter(e=>{switch(e.key){case"select_button":return t.heading;case"bold_button":return t.bold;case"italic_button":return t.italic;case"underline_button":return t.underline;case"strike_button":return t.strike;case"code_button":return t.code;case"align_left_button":case"align_center_butto":case"align_right_button":return t.textAlign;case"color_button":return t.color;case"nest_button":case"unnest_button":return t.nestBlock;case"link_button":return t.link;case"ai_button":return t.ai;default:return!0}});t:{if(!p||0===p.length){J=u;break t}const t=[...u];p.forEach(e=>{const{button:n,position:o}=e;let i=void 0===o?0:o;(!i||i>t.length)&&(i=t.length),i<0&&(i=0),i>=t.length?t.push(n):t.splice(i,0,n)}),J=t}b[2]=p,b[3]=d.dictionary,b[4]=N,b[5]=R,b[6]=W,b[7]=q,b[8]=D,b[9]=F,b[10]=v,b[11]=M,b[12]=H,b[13]=j,b[14]=E,b[15]=C,b[16]=J}else J=b[16];const K=J;let O,P,Q;return b[17]!==B||b[18]!==K||b[19]!==A?(O=A&&B&&I(m,{formattingToolbar:()=>I(_,{children:K})}),b[17]=B,b[18]=K,b[19]=A,b[20]=O):O=b[20],b[21]!==x||b[22]!==K||b[23]!==y?(P=y&&I(_,{children:I(L,{frozen:x,children:K})}),b[21]=x,b[22]=K,b[23]=y,b[24]=P):P=b[24],b[25]!==O||b[26]!==P?(Q=z(G,{children:[O,P]}),b[25]=O,b[26]=P,b[27]=Q):Q=b[27],Q},L=e=>{const n=t(11),{frozen:o,children:i}=e,[r,l]=y.useState(""),c=y.useRef(null);let a,s,u,b;if(n[0]!==o?(a=()=>{!o&&c.current&&c.current.innerHTML&&l(c.current.innerHTML)},n[0]=o,n[1]=a):a=n[1],n[2]!==i||n[3]!==o?(s=[o,i],n[2]=i,n[3]=o,n[4]=s):s=n[4],A(a,s),o&&r){let t,e;return n[5]===Symbol.for("react.memo_cache_sentinel")?(t={display:"contents",pointerEvents:"none",opacity:.5},n[5]=t):t=n[5],n[6]!==r?(e=I("div",{"aria-hidden":!0,style:t,dangerouslySetInnerHTML:{__html:r}}),n[6]=r,n[7]=e):e=n[7],e}return n[8]===Symbol.for("react.memo_cache_sentinel")?(u={display:"contents"},n[8]=u):u=n[8],n[9]!==i?(b=I("div",{ref:c,style:u,children:i}),n[9]=i,n[10]=b):b=n[10],b};function j(){const e=t(1);let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=I(h,{items:E}),e[0]=n):n=e[0],n}function E(t,e){return"user-input"===e?t.getSelection()?[S(t),T(t),x(),B(t),v(t),M(t)]:[S(t,!1),T(t,!1),x(),B(t,!1),v(t,!1),M(t,!1)]:k(t,e)}const w=()=>{const e=t(8),n=f(),o=u(),i=b(),r=d(g);if(!r||!o)return null;let l;e[0]!==r||e[1]!==i?(l=()=>{const t=i.getSelection();if(t?.blocks?.length){const e=t.blocks[t.blocks.length-1]?.id;if(e)return void r.openAIMenuAtBlock(e)}const e=i.document[i.document.length-1];e&&r.openAIMenuAtBlock(e.id)},e[0]=r,e[1]=i,e[2]=l):l=e[2];const c=l;let a,s;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=I(p,{size:18,strokeWidth:1.75}),e[3]=a):a=e[3],e[4]!==o.Generic.Toolbar.Button||e[5]!==n.formatting_toolbar.ai.tooltip||e[6]!==c?(s=I(o.Generic.Toolbar.Button,{className:"bn-button",label:n.formatting_toolbar.ai.tooltip,mainTooltip:n.formatting_toolbar.ai.tooltip,icon:a,onClick:c}),e[4]=o.Generic.Toolbar.Button,e[5]=n.formatting_toolbar.ai.tooltip,e[6]=c,e[7]=s):s=e[7],s};export{j as CustomAIMenu,H as CustomFormattingToolbar};
|
|
@@ -15,6 +15,9 @@ interface ToolbarOptions {
|
|
|
15
15
|
submitButton?: ButtonProps & {
|
|
16
16
|
label?: string;
|
|
17
17
|
};
|
|
18
|
+
cancelButton?: ButtonProps & {
|
|
19
|
+
label?: string;
|
|
20
|
+
};
|
|
18
21
|
}
|
|
19
22
|
interface RichTextEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'onBlur'> {
|
|
20
23
|
ref?: React.Ref<HTMLDivElement | null>;
|
|
@@ -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/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,E,I,V,$,q,G,N,O,W,R,_,D,U,J,Y,K,Q,X;L[0]!==z?(({ref:N,id:H,name:V,label:I,placeholder:G,mode:W,initialValue:E,readonly:R,disabled:_,error:D,errorMessage:A,trailingBlock:U,onChange:q,onBlur:$,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]=E,L[5]=I,L[6]=V,L[7]=$,L[8]=q,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],E=L[4],I=L[5],V=L[6],$=L[7],q=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(V),Ct=B(V),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,Et;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?(Et={trailingBlock:rt,dictionary:Pt,extensions:Ht},L[36]=Pt,L[37]=Ht,L[38]=rt,L[39]=Et):Et=L[39];const It=n(Et),[Vt,$t]=h.useState(nt||!1),[qt,Gt]=h.useState(H?E: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:Vt?"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=Vt?"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&&Vt&&!tt&&!et,re="collapse"!==yt&&!tt&&!et;let ae;L[59]!==It||L[60]!==Z?(ae=()=>{if(It)try{switch(Z){case"html":return It.blocksToHTMLLossy(It.document);case"full_html":return It.blocksToFullHTML(It.document);case"json":return JSON.stringify(It.document,null,2);case"markdown":return It.blocksToMarkdownLossy(It.document);default:return}}catch(t){const e=t;return void console.error("Error generating output:",e)}},L[59]=It,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]!==qt?(ie=()=>{if(tt||et)return;const t=ne();return H&&"string"==typeof t&&qt!==t&&Gt(t),t},L[62]=et,L[63]=ne,L[64]=H,L[65]=tt,L[66]=qt,L[67]=ie):ie=L[67];const le=ie;let se;L[68]!==le||L[69]!==q?(se=()=>{const t=le();t&&q?.(t)},L[68]=le,L[69]=q,L[70]=se):se=L[70];const ce=se;let de;L[71]!==le||L[72]!==Vt||L[73]!==$?(de=t=>{t.stopPropagation();const e=document.querySelector(".bn-container, .bn-formatting-toolbar");if(e&&t.relatedTarget instanceof Node&&e.contains(t.relatedTarget))return;Vt&&$t(!1);const o=le();o&&$?.(o)},L[71]=le,L[72]=Vt,L[73]=$,L[74]=de):de=L[74];const pe=de;let me;L[75]!==It||L[76]!==E||L[77]!==Z?(me=()=>{if(It&&E&&"html"===Z)if("string"==typeof E)try{const t=It.tryParseHTMLToBlocks(E);It.replaceBlocks(It.document,t)}catch(t){const e=t;console.error(e)}else console.error('Value must be a string when mode is "html"')},L[75]=It,L[76]=E,L[77]=Z,L[78]=me):me=L[78];const ue=x(me);let be;L[79]!==It||L[80]!==E||L[81]!==Z?(be=()=>{if(It&&E&&"full_html"===Z)if("string"==typeof E)try{const t=It.tryParseHTMLToBlocks(E);It.replaceBlocks(It.document,t)}catch(t){const e=t;console.error(e)}else console.error('Value must be a string when mode is "html"')},L[79]=It,L[80]=E,L[81]=Z,L[82]=be):be=L[82];const fe=x(be);let ge;L[83]!==It||L[84]!==E||L[85]!==Z?(ge=()=>{if(It&&E&&"json"===Z)if(Array.isArray(E)&&E.length>0)try{It.replaceBlocks(It.document,E)}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]=It,L[84]=E,L[85]=Z,L[86]=ge):ge=L[86];const ye=x(ge);let he;L[87]!==It||L[88]!==E||L[89]!==Z?(he=()=>{if(It&&E&&"markdown"===Z)if("string"==typeof E)try{const t=It.tryParseMarkdownToBlocks(E);It.replaceBlocks(It.document,t)}catch(t){const e=t;console.error(e)}else console.error('Value must be a string when mode is "markdown"')},L[87]=It,L[88]=E,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]!==It||L[93]!==ne||L[94]!==E||L[95]!==fe||L[96]!==ue||L[97]!==ye||L[98]!==xe||L[99]!==Z||L[100]!==G?(ke=()=>{if(It){if(!E&&et){const t=It.tryParseHTMLToBlocks(`<p>${G}</p>`);return void It.replaceBlocks(It.document,t)}if("string"==typeof E){if(ne()===E)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]=It,L[93]=ne,L[94]=E,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]!==It||L[104]!==ne||L[105]!==E||L[106]!==Z||L[107]!==G?(ve=[It,E,Z,et,G,ne],L[102]=et,L[103]=It,L[104]=ne,L[105]=E,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]!==I||L[114]!==at?(we=I&&F(p,{required:at,sx:{mb:1,color:Tt?T.color:"textSecondary","& .MuiFormLabel-asterisk":{color:Ct||Tt?T.color:"error.main"}},children:I}),L[111]=Ct,L[112]=Tt,L[113]=I,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]!==It||L[122]!==Zt||L[123]!==Dt||L[124]!==pe||L[125]!==ce||L[126]!==H||L[127]!==oe||L[128]!==Vt||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]!==qt?(Te=It&&S(u,{ref:N,size:12,container:!0,component:"div",children:[S(o,{title:G,editor:It,slashMenu:vt,sideMenu:kt,editable:!tt&&!et,theme:Dt,formattingToolbar:!1,...O,className:Lt,onChange:ce,onBlurCapture:pe,onFocusCapture:()=>{tt||et||Vt||$t(!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:It,staticToolbar:!0,selectToolbar:xt,availableButtons:{...bt,ai:Boolean(P&&!1!==bt?.ai)},customButtons:wt})}),re&&F(M,{editor:It,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:qt??"",required:at,style:{display:"none"}})]}),L[116]=P,L[117]=bt,L[118]=Lt,L[119]=wt,L[120]=et,L[121]=It,L[122]=Zt,L[123]=Dt,L[124]=pe,L[125]=ce,L[126]=H,L[127]=oe,L[128]=Vt,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]=qt,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};
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import"@blocknote/core/fonts/inter.css";import{it as t}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 l,AIMenuController as i}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 m from"@mui/material/FormLabel";import p from"@mui/material/GlobalStyles";import u from"@mui/material/Grid";import{useTheme as b,alpha as f}from"@mui/material/styles";import y from"@mui/material/Typography";import{DefaultChatTransport as g}from"ai";import k,{useEffectEvent as h,useEffect as x}from"react";import{useIsAiDirty as v,useIsAiEditing as B,useTypewriterSpeed as T}from"../AiEditingContext.js";import{richTextGlobalStyles as w,AI_COLOR as C,AiLabelWrapper as M}from"../AiUtils.js";import{CustomAIMenu as j,CustomFormattingToolbar as F}from"./FormattingToolbar.js";import{jsxs as S,jsx as L}from"react/jsx-runtime";const z=z=>{const P=e(153);let A,H,q,E,I,V,N,O,G,_,U,J,R,W,$,D,K,Q,X,Y,Z;P[0]!==z?(({ref:_,id:q,name:V,label:I,placeholder:G,mode:J,initialValue:E,readonly:R,disabled:W,error:$,errorMessage:H,trailingBlock:D,onChange:O,onBlur:N,required:K,focus:Q,aiApi:A,theme:Z,backgroundPreset:X,toolbarOptions:Y,...U}=z),P[0]=z,P[1]=A,P[2]=H,P[3]=q,P[4]=E,P[5]=I,P[6]=V,P[7]=N,P[8]=O,P[9]=G,P[10]=_,P[11]=U,P[12]=J,P[13]=R,P[14]=W,P[15]=$,P[16]=D,P[17]=K,P[18]=Q,P[19]=X,P[20]=Y,P[21]=Z):(A=P[1],H=P[2],q=P[3],E=P[4],I=P[5],V=P[6],N=P[7],O=P[8],G=P[9],_=P[10],U=P[11],J=P[12],R=P[13],W=P[14],$=P[15],D=P[16],K=P[17],Q=P[18],X=P[19],Y=P[20],Z=P[21]);const ee=void 0===J?"html":J,te=void 0!==R&&R,oe=void 0!==W&&W,re=void 0!==$&&$,ae=void 0!==D&&D,ne=void 0!==K&&K,le=void 0!==Q&&Q,ie=void 0===X?"paper":X;let se;P[22]!==Y?(se=void 0===Y?{}:Y,P[22]=Y,P[23]=se):se=P[23];const ce=se,{style:de,stickyToolbar:me,selectMenu:pe,sideMenu:ue,slashMenu:be,availableButtons:fe,customButtons:ye,submitButton:ge,cancelButton:ke}=ce,he=void 0===de?"collapse":de,xe=void 0===me||me,ve=void 0!==pe&&pe,Be=void 0!==ue&&ue,Te=void 0!==be&&be;let we;P[24]!==ye?(we=void 0===ye?[]:ye,P[24]=ye,P[25]=we):we=P[25];const Ce=we,Me=v(V),je=B(V),Fe=T(),Se=U?.className,Le=Me?"bn-ai-dirty":"",ze=je?"bn-ai-effect":"";let Pe;P[26]!==Se||P[27]!==Le||P[28]!==ze?(Pe=[Se,Le,ze].filter(Boolean),P[26]=Se,P[27]=Le,P[28]=ze,P[29]=Pe):Pe=P[29];const Ae=Pe.join(" ");let He,qe,Ee,Ie;P[30]!==G?(He={...t,ai:s,placeholders:{...t.placeholders,default:G}},P[30]=G,P[31]=He):He=P[31],P[32]!==A?(qe=l({transport:new g({api:A})}),P[32]=A,P[33]=qe):qe=P[33],P[34]!==qe?(Ee=[qe],P[34]=qe,P[35]=Ee):Ee=P[35],P[36]!==He||P[37]!==Ee||P[38]!==ae?(Ie={trailingBlock:ae,dictionary:He,extensions:Ee},P[36]=He,P[37]=Ee,P[38]=ae,P[39]=Ie):Ie=P[39];const Ve=n(Ie),[Ne,Oe]=k.useState(le||!1),[Ge,_e]=k.useState(q?E:void 0),Ue=b(),Je=Z??Ue.palette.mode,Re="default"===ie?Ue.palette.background.default:Ue.palette.background.paper,We=re?Ue.palette.error.main:Ne?"transparent":"silver";let $e;P[40]!==ie||P[41]!==Je||P[42]!==oe||P[43]!==Ue?($e=((e="light",t,o,n=!1)=>{const l="default"===t?o.palette.background.default:o.palette.background.paper,i="default"===t?o.palette.background.paper:o.palette.background.default;return"light"===e?{...r,colors:{...r.colors,editor:{text:n?o.palette.text.disabled:o.palette.text.primary,background:l},menu:{text:o.palette.text.primary,background:i},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:l},menu:{text:o.palette.text.primary,background:i},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}}}})(Je,ie,Ue,oe),P[40]=ie,P[41]=Je,P[42]=oe,P[43]=Ue,P[44]=$e):$e=P[44];const De=$e,Ke="static"===he?120:void 0,Qe=Me?"rgba(0,122,255,0.3)":We,Xe=Ne?"0 0 0 2px "+Ue.palette.primary.main:void 0,Ye=oe?"none":"auto",Ze=oe?"none":"auto";let et;P[45]!==Re||P[46]!==Ke||P[47]!==Qe||P[48]!==Xe||P[49]!==Ye||P[50]!==Ze?(et={backgroundColor:Re,paddingTop:10,width:"100%",minHeight:Ke,borderWidth:1,borderStyle:"solid",borderColor:Qe,borderRadius:16,boxShadow:Xe,pointerEvents:Ye,userSelect:Ze},P[45]=Re,P[46]=Ke,P[47]=Qe,P[48]=Xe,P[49]=Ye,P[50]=Ze,P[51]=et):et=P[51];const tt=et;let ot;P[52]!==Fe||P[53]!==oe||P[54]!==je||P[55]!==Me||P[56]!==Ue.palette.primary.main||P[57]!==Ue.palette.text.primary?(ot=w({animate:je,dirty:Me,duration:Fe},{".bn-editor ::selection":{backgroundColor:f(Ue.palette.primary.main,.24),color:Ue.palette.text.primary},".bn-editor *::selection":{backgroundColor:f(Ue.palette.primary.main,.24),color:Ue.palette.text.primary},...oe?{".bn-inline-content":{userSelect:oe?"none":"auto",pointerEvents:oe?"none":"auto",color:oe?"gray":"inherit"}}:{}}),P[52]=Fe,P[53]=oe,P[54]=je,P[55]=Me,P[56]=Ue.palette.primary.main,P[57]=Ue.palette.text.primary,P[58]=ot):ot=P[58];const rt=ot,at="collapse"===he&&Ne&&!te&&!oe,nt="collapse"!==he&&!te&&!oe;let lt;P[59]!==Ve||P[60]!==ee?(lt=()=>{if(Ve)try{switch(ee){case"html":return Ve.blocksToHTMLLossy(Ve.document);case"full_html":return Ve.blocksToFullHTML(Ve.document);case"json":return JSON.stringify(Ve.document,null,2);case"markdown":return Ve.blocksToMarkdownLossy(Ve.document);default:return}}catch(e){const t=e;return void console.error("Error generating output:",t)}},P[59]=Ve,P[60]=ee,P[61]=lt):lt=P[61];const it=lt;let st;P[62]!==oe||P[63]!==it||P[64]!==q||P[65]!==te||P[66]!==Ge?(st=()=>{if(te||oe)return;const e=it();return q&&"string"==typeof e&&Ge!==e&&_e(e),e},P[62]=oe,P[63]=it,P[64]=q,P[65]=te,P[66]=Ge,P[67]=st):st=P[67];const ct=st;let dt;P[68]!==ct||P[69]!==O?(dt=()=>{const e=ct();e&&O?.(e)},P[68]=ct,P[69]=O,P[70]=dt):dt=P[70];const mt=dt;let pt;P[71]!==ct||P[72]!==Ne||P[73]!==N?(pt=e=>{e.stopPropagation();const t=document.querySelector(".bn-container, .bn-formatting-toolbar");if(t&&e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))return;Ne&&Oe(!1);const o=ct();o&&N?.(o)},P[71]=ct,P[72]=Ne,P[73]=N,P[74]=pt):pt=P[74];const ut=pt;let bt;P[75]!==Ve||P[76]!==E||P[77]!==ee?(bt=()=>{if(Ve&&E&&"html"===ee)if("string"==typeof E)try{const e=Ve.tryParseHTMLToBlocks(E);Ve.replaceBlocks(Ve.document,e)}catch(e){const t=e;console.error(t)}else console.error('Value must be a string when mode is "html"')},P[75]=Ve,P[76]=E,P[77]=ee,P[78]=bt):bt=P[78];const ft=h(bt);let yt;P[79]!==Ve||P[80]!==E||P[81]!==ee?(yt=()=>{if(Ve&&E&&"full_html"===ee)if("string"==typeof E)try{const e=Ve.tryParseHTMLToBlocks(E);Ve.replaceBlocks(Ve.document,e)}catch(e){const t=e;console.error(t)}else console.error('Value must be a string when mode is "html"')},P[79]=Ve,P[80]=E,P[81]=ee,P[82]=yt):yt=P[82];const gt=h(yt);let kt;P[83]!==Ve||P[84]!==E||P[85]!==ee?(kt=()=>{if(Ve&&E&&"json"===ee)if(Array.isArray(E)&&E.length>0)try{Ve.replaceBlocks(Ve.document,E)}catch(e){const t=e;console.error(t)}else console.error('Value must be an array of PartialBlock objects when mode is "json"')},P[83]=Ve,P[84]=E,P[85]=ee,P[86]=kt):kt=P[86];const ht=h(kt);let xt;P[87]!==Ve||P[88]!==E||P[89]!==ee?(xt=()=>{if(Ve&&E&&"markdown"===ee)if("string"==typeof E)try{const e=Ve.tryParseMarkdownToBlocks(E);Ve.replaceBlocks(Ve.document,e)}catch(e){const t=e;console.error(t)}else console.error('Value must be a string when mode is "markdown"')},P[87]=Ve,P[88]=E,P[89]=ee,P[90]=xt):xt=P[90];const vt=h(xt);let Bt,Tt,wt,Ct,Mt,jt,Ft;return P[91]!==oe||P[92]!==Ve||P[93]!==it||P[94]!==E||P[95]!==gt||P[96]!==ft||P[97]!==ht||P[98]!==vt||P[99]!==ee||P[100]!==G?(Bt=()=>{if(Ve){if(!E&&oe){const e=Ve.tryParseHTMLToBlocks(`<p>${G}</p>`);return void Ve.replaceBlocks(Ve.document,e)}if("string"==typeof E){if(it()===E)return}e:switch(ee){case"html":ft();break e;case"full_html":gt();break e;case"json":ht();break e;case"markdown":vt()}}},P[91]=oe,P[92]=Ve,P[93]=it,P[94]=E,P[95]=gt,P[96]=ft,P[97]=ht,P[98]=vt,P[99]=ee,P[100]=G,P[101]=Bt):Bt=P[101],P[102]!==oe||P[103]!==Ve||P[104]!==it||P[105]!==E||P[106]!==ee||P[107]!==G?(Tt=[Ve,E,ee,oe,G,it],P[102]=oe,P[103]=Ve,P[104]=it,P[105]=E,P[106]=ee,P[107]=G,P[108]=Tt):Tt=P[108],x(Bt,Tt),P[109]!==rt?(wt=L(p,{styles:rt}),P[109]=rt,P[110]=wt):wt=P[110],P[111]!==je||P[112]!==Me||P[113]!==I||P[114]!==V||P[115]!==ne?(Ct=I&&L(m,{required:!Me&&ne,sx:{mb:1,color:Me?C:"textSecondary","& .MuiFormLabel-asterisk":{color:je||Me?C:"error.main"}},children:L(M,{name:V,label:I,required:ne})}),P[111]=je,P[112]=Me,P[113]=I,P[114]=V,P[115]=ne,P[116]=Ct):Ct=P[116],P[117]!==A||P[118]!==fe||P[119]!==ke||P[120]!==Ae||P[121]!==Ce||P[122]!==oe||P[123]!==Ve||P[124]!==tt||P[125]!==De||P[126]!==ut||P[127]!==mt||P[128]!==q||P[129]!==at||P[130]!==Ne||P[131]!==nt||P[132]!==G||P[133]!==te||P[134]!==_||P[135]!==ne||P[136]!==U||P[137]!==ve||P[138]!==Be||P[139]!==Te||P[140]!==xe||P[141]!==ge||P[142]!==he||P[143]!==Ge?(Mt=Ve&&S(u,{ref:_,size:12,container:!0,component:"div",children:[S(o,{title:G,editor:Ve,slashMenu:Te,sideMenu:Be,editable:!te&&!oe,theme:De,formattingToolbar:!1,...U,className:Ae,onChange:mt,onBlurCapture:ut,onFocusCapture:()=>{te||oe||Ne||Oe(!0)},style:tt,children:[A&&L(i,{aiMenu:j,floatingUIOptions:{useFloatingOptions:{strategy:"fixed"}}}),S(u,{container:!0,size:12,sx:{position:xe?"sticky":"relative",bottom:xe?0:void 0,zIndex:xe?2:void 0,backgroundColor:xe?"transparent":void 0,pointerEvents:oe?"none":"auto",userSelect:oe?"none":"auto"},children:[S(u,{flexGrow:1,children:["collapse"===he&&L(d,{in:at,children:L(F,{editor:Ve,staticToolbar:!0,selectToolbar:ve,availableButtons:{...fe,ai:Boolean(A&&!1!==fe?.ai)},customButtons:Ce})}),nt&&L(F,{editor:Ve,staticToolbar:"hidden"!==he,selectToolbar:ve,availableButtons:{...fe,ai:Boolean(A&&!1!==fe?.ai)},customButtons:Ce})]}),ke&&L(u,{container:!0,justifyContent:"flex-start",alignItems:"flex-end",m:"10px",mb:"12px",children:L(c,{type:ke.type??"button",size:"small",color:ke.color??"secondary",...ke,children:ke.label||"Cancel"})}),ge&&L(u,{container:!0,justifyContent:"flex-end",alignItems:"flex-end",m:"10px",mb:"12px",children:L(c,{type:ge.type??"button",size:"small",color:ge.color??"primary",...ge,children:ge.label||"Custom Action"})})]})]}),q&&L("input",{type:"hidden",name:q,value:Ge??"",required:ne,style:{display:"none"}})]}),P[117]=A,P[118]=fe,P[119]=ke,P[120]=Ae,P[121]=Ce,P[122]=oe,P[123]=Ve,P[124]=tt,P[125]=De,P[126]=ut,P[127]=mt,P[128]=q,P[129]=at,P[130]=Ne,P[131]=nt,P[132]=G,P[133]=te,P[134]=_,P[135]=ne,P[136]=U,P[137]=ve,P[138]=Be,P[139]=Te,P[140]=xe,P[141]=ge,P[142]=he,P[143]=Ge,P[144]=Mt):Mt=P[144],P[145]!==re||P[146]!==H?(jt=re&&H&&L(u,{size:12,children:L(y,{variant:"caption",color:"error",style:{marginInline:"14px",marginTop:"3px",marginBottom:-1},children:H})}),P[145]=re,P[146]=H,P[147]=jt):jt=P[147],P[148]!==wt||P[149]!==Ct||P[150]!==Mt||P[151]!==jt?(Ft=S(u,{container:!0,size:12,children:[wt,Ct,Mt,jt]}),P[148]=wt,P[149]=Ct,P[150]=Mt,P[151]=jt,P[152]=Ft):Ft=P[152],Ft};export{z as RichTextEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import r from"@mui/material/FormControl";import l from"@mui/material/FormLabel";import i from"@mui/material/InputLabel";import o from"@mui/material/Select";import"react";import{Controller as a}from"react-hook-form";import{useIsAiEditing as t,useIsAiDirty as d,useTypewriterSpeed as m}from"./AiEditingContext.js";import{aiSelectSxEffect as n,AI_COLOR as u,AiLabelWrapper as s}from"./AiUtils.js";import{jsx as b,jsxs as c,Fragment as f}from"react/jsx-runtime";function p(p){const h=e(20),{name:x,control:q,defaultValue:v,rules:g,shouldUnregister:y,legend:A,children:F,...L}=p,j=void 0===A||A,k=t(x),U=d(x),z=m();let C;h[0]!==z||h[1]!==k||h[2]!==U?(C=n({animate:k,dirty:U,duration:z}),h[0]=z,h[1]=k,h[2]=U,h[3]=C):C=h[3];const I=[C,...Array.isArray(L.sx)?L.sx:L.sx?[L.sx]:[]];let M,S;return h[4]!==F||h[5]!==k||h[6]!==U||h[7]!==j||h[8]!==x||h[9]!==L||h[10]!==I?(M=e=>{const{field:a,fieldState:t}=e,{error:d}=t;return c(f,{children:[j&&L.label&&b(l,{required:!U&&L.required,sx:{display:"flex",color:U||k?u:void 0,"& .MuiFormLabel-asterisk":{color:k||U?u:"error.main"}},children:b(s,{name:x,label:L.label,required:L.required})}),c(r,{fullWidth:L.fullWidth??!0,size:L.size,required:L.required,children:[!j&&L.label&&b(i,{id:`${x}-label`,required:!U&&void 0,sx:{color:U||k?u:void 0,"& .MuiFormLabel-asterisk":{color:U||k?u:void 0}},children:b(s,{name:x,label:L.label,required:L.required})}),b(o,{labelId:`${x}-label`,variant:"outlined",...L,label:j?"":b(s,{name:x,label:L.label}),error:Boolean(d),...a,disabled:a.disabled,value:a.value??null,sx:I,children:F})]})]})},h[4]=F,h[5]=k,h[6]=U,h[7]=j,h[8]=x,h[9]=L,h[10]=I,h[11]=M):M=h[11],h[12]!==q||h[13]!==v||h[14]!==x||h[15]!==g||h[16]!==L.disabled||h[17]!==y||h[18]!==M?(S=b(a,{name:x,control:q,defaultValue:v,disabled:L.disabled,rules:g,shouldUnregister:y,render:M}),h[12]=q,h[13]=v,h[14]=x,h[15]=g,h[16]=L.disabled,h[17]=y,h[18]=M,h[19]=S):S=h[19],S}export{p as SelectField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import r from"@mui/material/FormLabel";import{TimePicker as o}from"@mui/x-date-pickers";import t from"dayjs";import{ClockIcon as i}from"lucide-react";import l from"react";import{useWatch as s,Controller as n}from"react-hook-form";import{useIsAiEditing as a,useIsAiDirty as d,useTypewriterSpeed as m}from"./AiEditingContext.js";import{aiEffectStyle as u,AI_COLOR as c,AiLabelWrapper as p}from"./AiUtils.js";import{jsx as f,jsxs as b,Fragment as x}from"react/jsx-runtime";function v(v){const y=e(20),{name:g,control:h,defaultValue:P,rules:F,shouldUnregister:A,legend:H,required:k,fullWidth:q,stringOnEmpty:V,...B}=v,j=void 0===H||H,z=void 0!==k&&k,L=void 0===q||q,S=void 0!==V&&V?"":null,C="string"==typeof B.format?B.format:"HH:mm",M=a(g),U=d(g),D=m(),E=e=>{if("string"!=typeof e||""===e.trim())return null;const r=t(e,C,!0);if(r.isValid())return r;const o=t(e,["HH","HH:mm","HH:mm:ss"],!0);return o.isValid()?o:null},I=B.slotProps?.textField?.sx,O=[u({animate:M,dirty:U,duration:D}),...Array.isArray(I)?I:I?[I]:[]],W=M?"none":void 0,T=U?c:void 0;let w;y[0]!==W||y[1]!==T?(w={display:W,color:T},y[0]=W,y[1]=T,y[2]=w):w=y[2];const G=[...Array.isArray(I)?I:I?[I]:[],w];let J;y[3]!==h||y[4]!==g?(J={control:h,name:g},y[3]=h,y[4]=g,y[5]=J):J=y[5];const K=s(J),[N,Q]=l.useState(K);let R;y[6]!==K||y[7]!==E?(R=()=>E(K),y[6]=K,y[7]=E,y[8]=R):R=y[8];const[X,Y]=l.useState(R);let Z;K!==N&&(Q(K),Y(E(K))),y[9]!==S||y[10]!==C?(Z=(e,r,o)=>{if(!e||!e.isValid())return r(S),o(),void Y(null);r(t(e).format(C)),o(),Y(e)},y[9]=S,y[10]=C,y[11]=Z):Z=y[11];const $=Z,_=e=>{const{field:t,fieldState:l}=e,{error:s}=l;return b(x,{children:[j&&B.label&&f(r,{required:!U&&z,sx:{display:"flex",color:U||M?c:void 0,"& .MuiFormLabel-asterisk":{color:M||U?c:"error.main"}},children:f(p,{name:g,label:B.label,required:z})}),f(o,{format:C,ampm:!1,...B,...t,ref:t.ref,formatDensity:"dense",value:X,onChange:e=>{e&&e.isValid()?Y(e):Y(null)},enableAccessibleFieldDOMStructure:!1,onAccept:e=>$(e,t.onChange,t.onBlur),slots:{...B.slots,openPickerIcon:i},slotProps:{openPickerIcon:{color:U?c:void 0,size:"small"===B.slotProps?.textField?.size?18:22},openPickerButton:{size:B.slotProps?.textField?.size,sx:G},...B.slotProps,textField:{required:z,fullWidth:L,label:j?"":f(p,{name:g,label:B.label,required:z}),error:Boolean(s),helperText:s?.message,onBlur:t.onBlur,slotProps:{inputLabel:{required:!U&&void 0,sx:{color:U||M?c:void 0,"& .MuiFormLabel-asterisk":{color:U||M?c:void 0}}}},...B.slotProps?.textField,sx:O}}})]})};let ee;return y[12]!==h||y[13]!==B.disabled||y[14]!==P||y[15]!==g||y[16]!==F||y[17]!==A||y[18]!==_?(ee=f(n,{name:g,control:h,defaultValue:P,disabled:B.disabled,rules:F,shouldUnregister:A,render:_}),y[12]=h,y[13]=B.disabled,y[14]=P,y[15]=g,y[16]=F,y[17]=A,y[18]=_,y[19]=ee):ee=y[19],ee}export{v as TimeField};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t from"@mui/material/Grid";import i from"@mui/material/Table";import r from"@mui/material/ToggleButton";import o from"@mui/material/ToggleButtonGroup";import n from"@mui/material/Typography";import{Grid2x2Icon as a,Rows2Icon as l}from"lucide-react";import s,{useState as c,useEffectEvent as m,useEffect as d}from"react";import{TableFilterHeader as p}from"../TableComponents/TableFilterHeader.js";import{parseFiltersQuery as u,buildFiltersQuery as f,buildRequestFilters as g}from"../TableComponents/TableFunctions.js";import{localizedTableStrings as h}from"../TableComponents/TableLocales.js";import{CardsTableBody as v}from"./CardsTableBody.js";import{CardsTableFooter as y}from"./CardsTableFooter.js";import{jsx as b,jsxs as T,Fragment as x}from"react/jsx-runtime";function w(w){const F=e(110),{tableInfo:I,fetchInfo:j,filtersQuery:z,cardInfo:D,tableLocale:_,localeStr:B}=w,{tableTitle:V,tableName:L,tableData:O,filters:q,expectedItemCount:E,tableVariant:R,gridSizings:G,defaultShowFilters:M,standardOptions:H,infiniteOptions:N}=I,Q=void 0===L?"":L,W=void 0===R?"standard":R;let k;F[0]!==G?(k=void 0===G?{xs:1,sm:1,md:2,lg:3,xl:4}:G,F[0]=G,F[1]=k):k=F[1];const A=k;let J;F[2]!==H?(J=void 0===H?{customPageItemCount:6,customSelectPages:[6,12,24]}:H,F[2]=H,F[3]=J):J=F[3];const K=J;let U;F[4]!==N?(U=void 0===N?{loadingType:"loadMore",itemsPerPage:6,viewType:"cards",switcherPosition:"right",onViewTypeChange:S}:N,F[4]=N,F[5]=U):U=F[5];const X=U,{fetchData:Y,isDataLoading:Z,areColumnsLoading:$}=j,ee=void 0===z?"":z,te=void 0===_?"en":_,{customPageItemCount:ie,customSelectPages:re}=K,oe=void 0===ie?6:ie;let ne;F[6]!==re?(ne=void 0===re?[6,12,24]:re,F[6]=re,F[7]=ne):ne=F[7];const ae=ne,{loadingType:le,itemsPerPage:se,viewType:ce,onViewTypeChange:me,switcherPosition:de}=X,pe=void 0===se?6:se,ue=h[te];let fe;F[8]!==B||F[9]!==ue?(fe={...ue,...B},F[8]=B,F[9]=ue,F[10]=fe):fe=F[10];const ge=fe,[he,ve]=c("dual"===ce?"cards":ce),[ye,be]=c(0),Te="standard"===W?oe:pe,[xe,we]=c(Te??5),Pe=s.useRef(ee);let Ce;F[11]!==q||F[12]!==ee||F[13]!==Q?(Ce=u(Q,ee,q),F[11]=q,F[12]=ee,F[13]=Q,F[14]=Ce):Ce=F[14];const Se=Ce,[Fe,Ie]=c(!1);let je;F[15]===Symbol.for("react.memo_cache_sentinel")?(je={prev:!1,next:!1},F[15]=je):je=F[15];const[ze,De]=c(je);let _e;F[16]!==Se||F[17]!==Y||F[18]!==le||F[19]!==xe||F[20]!==Q||F[21]!==W?(_e=async e=>{Ie(!0);const t=f(Q,Se),i=g(Se),r=xe,{next:o,prev:n}=await Y({filters:{query:t,active:Se,filterDto:i},limit:r,direction:e});Pe.current=t,De({next:o,prev:n}),Ie(!1),"right"===e?be(C):"left"===e?be(P):"reset"===e&&be(0)},F[16]=Se,F[17]=Y,F[18]=le,F[19]=xe,F[20]=Q,F[21]=W,F[22]=_e):_e=F[22];const Be=_e;let Ve;F[23]!==Be?(Ve=()=>Be("reset"),F[23]=Be,F[24]=Ve):Ve=F[24];const Le=m(Ve);let Oe,qe,Ee;F[25]!==Le?(Oe=()=>{Le()},F[25]=Le,F[26]=Oe):Oe=F[26],F[27]===Symbol.for("react.memo_cache_sentinel")?(qe=[],F[27]=qe):qe=F[27],d(Oe,qe),F[28]!==Y||F[29]!==le||F[30]!==xe||F[31]!==Q||F[32]!==W?(Ee=async e=>{Ie(!0);const t=f(Q,e),i=g(e),r=xe,{next:o,prev:n}=await Y({filters:{query:t,active:e,filterDto:i},limit:r,direction:"reset"});Pe.current=t,be(0),De({next:o,prev:n}),Ie(!1)},F[28]=Y,F[29]=le,F[30]=xe,F[31]=Q,F[32]=W,F[33]=Ee):Ee=F[33];const Re=Ee;let Ge;F[34]!==Se||F[35]!==Fe||F[36]!==ee||F[37]!==Re||F[38]!==Q?(Ge=()=>{if(Fe||!ee)return;f(Q,Se)!==Pe.current&&Re(Se)},F[34]=Se,F[35]=Fe,F[36]=ee,F[37]=Re,F[38]=Q,F[39]=Ge):Ge=F[39];const Me=m(Ge);let He,Ne,Qe;F[40]!==Me?(He=()=>{Me()},F[40]=Me,F[41]=He):He=F[41],F[42]!==ee?(Ne=[ee],F[42]=ee,F[43]=Ne):Ne=F[43],d(He,Ne),F[44]!==Se||F[45]!==Y||F[46]!==Q?(Qe=e=>{const t=parseInt(e.target.value,10);we(t),be(0);const i=f(Q,Se),r=g(Se);Y({filters:{query:i,active:Se,filterDto:r},limit:t,direction:"reset"}).then(e=>{const{next:t,prev:i}=e;De({next:t,prev:i})})},F[44]=Se,F[45]=Y,F[46]=Q,F[47]=Qe):Qe=F[47];const We=Qe;let ke;F[48]!==me?(ke=(e,t)=>{t&&(ve(t),me?.(t))},F[48]=me,F[49]=ke):ke=F[49];const Ae=ke,Je=Boolean(Z||$),Ke=!Je&&0===O.length;let Ue;F[50]===Symbol.for("react.memo_cache_sentinel")?(Ue={width:"100%",justifyContent:"space-between",alignItems:"center",my:2},F[50]=Ue):Ue=F[50];const Xe="left"===de?"row-reverse":"row",Ye="left"===de?"left":"space-between";let Ze,$e,et,tt,it,rt,ot,nt;F[51]!==V?(Ze=V&&b(t,{children:"string"==typeof V?b(n,{variant:"h6",component:"div",children:V}):V}),F[51]=V,F[52]=Ze):Ze=F[52],F[53]!==Be?($e=()=>Be("reset"),F[53]=Be,F[54]=$e):$e=F[54],F[55]!==Se||F[56]!==ge.filters||F[57]!==M||F[58]!==q||F[59]!==Re||F[60]!==Je||F[61]!==$e?(et=b(p,{columns:q,activeFilters:Se,onFiltersChange:Re,isFetching:Je,defaultShowFilters:M,handleFetchData:$e,showRefreshButton:!1,localeStr:ge.filters}),F[55]=Se,F[56]=ge.filters,F[57]=M,F[58]=q,F[59]=Re,F[60]=Je,F[61]=$e,F[62]=et):et=F[62],F[63]!==Ae||F[64]!==he||F[65]!==ce?(tt="dual"===ce&&b(t,{children:T(o,{exclusive:!0,value:he,onChange:Ae,"aria-label":"list view",size:"small",sx:{alignSelf:"center"},children:[b(r,{value:"cards",size:"small",color:"primary",sx:{p:"5px"},children:b(a,{size:18})}),b(r,{value:"list",size:"small",color:"primary",sx:{p:"5px"},children:b(l,{size:18})})]})}),F[63]=Ae,F[64]=he,F[65]=ce,F[66]=tt):tt=F[66],F[67]!==Xe||F[68]!==Ye||F[69]!==Ze||F[70]!==et||F[71]!==tt?(it=b(t,{id:"cards-table-header",container:!0,sx:Ue,children:T(t,{container:!0,size:12,direction:Xe,justifyContent:Ye,alignItems:"center",spacing:2,children:[Ze,et,tt]})}),F[67]=Xe,F[68]=Ye,F[69]=Ze,F[70]=et,F[71]=tt,F[72]=it):it=F[72],F[73]===Symbol.for("react.memo_cache_sentinel")?(rt={width:"100%",minWidth:150},F[73]=rt):rt=F[73],F[74]!==oe||F[75]!==ae?(ot={customPageItemCount:oe,customSelectPages:ae},F[74]=oe,F[75]=ae,F[76]=ot):ot=F[76],F[77]!==A||F[78]!==pe||F[79]!==le||F[80]!==he?(nt={loadingType:le,gridSizings:A,itemsPerPage:pe,viewType:he},F[77]=A,F[78]=pe,F[79]=le,F[80]=he,F[81]=nt):nt=F[81];const at="standard"===W?0:ye;let lt,st,ct,mt;return F[82]!==D||F[83]!==Je||F[84]!==Ke||F[85]!==xe||F[86]!==ot||F[87]!==nt||F[88]!==at||F[89]!==O||F[90]!==W?(lt=b(v,{tableVariant:W,tableData:O,cardInfo:D,standardOptions:ot,infiniteOptions:nt,page:at,rowsPerPage:xe,isFetching:Je,isTableEmpty:Ke}),F[82]=D,F[83]=Je,F[84]=Ke,F[85]=xe,F[86]=ot,F[87]=nt,F[88]=at,F[89]=O,F[90]=W,F[91]=lt):lt=F[91],F[92]!==ye||F[93]!==ae||F[94]!==E||F[95]!==We||F[96]!==Be||F[97]!==Je||F[98]!==Ke||F[99]!==le||F[100]!==ze||F[101]!==xe||F[102]!==W?(st=b(y,{tableVariant:W,currentPage:ye,expectedItemCount:E,fetchEvent:Be,nextFetch:ze,handleChangeRowsPerPage:We,isFetching:Je,isTableEmpty:Ke,loadingType:le,rowsPerPage:xe,customSelectPages:ae}),F[92]=ye,F[93]=ae,F[94]=E,F[95]=We,F[96]=Be,F[97]=Je,F[98]=Ke,F[99]=le,F[100]=ze,F[101]=xe,F[102]=W,F[103]=st):st=F[103],F[104]!==lt||F[105]!==st?(ct=T(i,{component:"div",sx:rt,children:[lt,st]}),F[104]=lt,F[105]=st,F[106]=ct):ct=F[106],F[107]!==it||F[108]!==ct?(mt=T(x,{children:[it,ct]}),F[107]=it,F[108]=ct,F[109]=mt):mt=F[109],mt}function P(e){return Math.max(e-1,0)}function C(e){return e+1}function S(){return null}export{w as CardsTable};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t from"@mui/material/Box";import r from"@mui/material/Card";import"@mui/material/CardActionArea";import i from"@mui/material/CardContent";import a from"@mui/material/CardMedia";import n from"@mui/material/Grid";import o from"@mui/material/Skeleton";import m from"@mui/material/Typography";import s,{useRef as l,useEffect as c}from"react";import{jsx as d,jsxs as p,Fragment as f}from"react/jsx-runtime";function u(){const t=e(4);let n,s,l,c;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n={minWidth:150,minHeight:300},s=d(a,{component:o,variant:"rectangular",height:210}),t[0]=n,t[1]=s):(n=t[0],s=t[1]),t[2]===Symbol.for("react.memo_cache_sentinel")?(l=d(m,{gutterBottom:!0,variant:"h5",component:"div",children:d(o,{variant:"text",width:"30%"})}),t[2]=l):l=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(c=p(r,{sx:n,children:[s,p(i,{children:[l,d(m,{variant:"body2",color:"text.secondary",children:d(o,{variant:"text",width:"70%"})})]})]}),t[3]=c):c=t[3],c}function h(r){const i=e(59),{tableVariant:a,tableData:o,cardInfo:m,infiniteOptions:h,page:x,rowsPerPage:g,isFetching:y,isTableEmpty:S}=r,b=l(!1),[v,I]=s.useState(y);let w,$;i[0]!==y?(w=()=>{let e;if(y){const t=b.current?200:0;e=setTimeout(()=>I(!0),t)}else e=setTimeout(()=>{b.current=!0,I(!1)},0);return()=>clearTimeout(e)},$=[y],i[0]=y,i[1]=w,i[2]=$):(w=i[1],$=i[2]),c(w,$);const{CardItem:_,ListItem:C,SkeletonItem:T,SkeletonListItem:k}=m;let A,P,z,D,B,L,j;if(i[3]!==_||i[4]!==T||i[5]!==h||i[6]!==S||i[7]!==x||i[8]!==g||i[9]!==v||i[10]!==o||i[11]!==a){const{gridSizings:e,viewType:r,itemsPerPage:m}=h||{};P=m;const s=void 0===e?{xs:1,sm:1,md:2,lg:3,xl:4}:e;let l;L=void 0===r?"cards":r,i[18]!==x||i[19]!==g||i[20]!==o?(l=g>0?o.slice(x*g,x*g+g):o,i[18]=x,i[19]=g,i[20]=o,i[21]=l):l=i[21];const c=l;z=v?"standard"===a?g-c.length:P??0:0;const p=`repeat(${s.xs}, minmax(0, 1fr))`,f=`repeat(${s.sm}, minmax(0, 1fr))`,y=`repeat(${s.md}, minmax(0, 1fr))`,b=`repeat(${s.lg}, minmax(0, 1fr))`,I=`repeat(${s.xl}, minmax(0, 1fr))`;let w,$;i[22]!==y||i[23]!==b||i[24]!==I||i[25]!==p||i[26]!==f?(w={xs:p,sm:f,md:y,lg:b,xl:I},i[22]=y,i[23]=b,i[24]=I,i[25]=p,i[26]=f,i[27]=w):w=i[27],A=w,i[28]!==_||i[29]!==c||i[30]!==S||i[31]!==v?(D=!v&&!S&&_&&c.map((e,r)=>d(t,{sx:{animation:"fadeIn 0.25s ease-in-out forwards",animationDelay:.05*r+"s",opacity:0},children:d(_,{...e})},String(e.id))),i[28]=_,i[29]=c,i[30]=S,i[31]=v,i[32]=D):D=i[32],i[33]!==T?($=(e,t)=>d(n,{size:12,sx:{animation:"fadeIn 0.25s ease-in-out forwards",opacity:0},children:d(T||u,{})},`grid-skeleton-${t}`),i[33]=T,i[34]=$):$=i[34],B=Array.from({length:v?g:z},$),i[3]=_,i[4]=T,i[5]=h,i[6]=S,i[7]=x,i[8]=g,i[9]=v,i[10]=o,i[11]=a,i[12]=A,i[13]=P,i[14]=z,i[15]=D,i[16]=B,i[17]=L}else A=i[12],P=i[13],z=i[14],D=i[15],B=i[16],L=i[17];i[35]!==D||i[36]!==B?(j=p(f,{children:[D,B]}),i[35]=D,i[36]=B,i[37]=j):j=i[37];const E=j;let F;i[38]!==_||i[39]!==C||i[40]!==T||i[41]!==k||i[42]!==S||i[43]!==P||i[44]!==z||i[45]!==o||i[46]!==L?(F=()=>{const e="cards"===L?_:C,r="cards"===L?T:k;return p(f,{children:[!S&&e&&o.map((r,i)=>d(t,{sx:{animation:"fadeIn 0.25s ease-in-out forwards",animationDelay:i%(P||20)*.03+"s",opacity:0},children:d(e,{...r})},String(r.id))),Array.from({length:z},(e,t)=>d(n,{size:12,sx:{animation:"fadeIn 0.25s ease-in-out forwards",opacity:0},children:d(r||u,{})},`grid-skeleton-${t}`))]})},i[38]=_,i[39]=C,i[40]=T,i[41]=k,i[42]=S,i[43]=P,i[44]=z,i[45]=o,i[46]=L,i[47]=F):F=i[47];const G=F,H=`cards-table-body-${a}`,M="cards"===L?A:"1fr";let O,V,W,q;return i[48]===Symbol.for("react.memo_cache_sentinel")?(O={"0%":{opacity:0},"100%":{opacity:1}},i[48]=O):O=i[48],i[49]!==M?(V={display:"grid",gridTemplateColumns:M,gap:"32px 32px","@keyframes fadeIn":O},i[49]=M,i[50]=V):V=i[50],i[51]!==G||i[52]!==E||i[53]!==a?(W="standard"===a?E:G(),i[51]=G,i[52]=E,i[53]=a,i[54]=W):W=i[54],i[55]!==W||i[56]!==H||i[57]!==V?(q=d(t,{id:H,component:"div",sx:V,children:W}),i[55]=W,i[56]=H,i[57]=V,i[58]=q):q=i[58],q}export{h as CardsTableBody,u as DefaultSkeletonCard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t from"@mui/material/Box";import n from"@mui/material/Button";import i from"@mui/material/Grid";import r from"@mui/material/IconButton";import{useTheme as a}from"@mui/material/styles";import o from"@mui/material/TableFooter";import c from"@mui/material/TablePagination";import l from"@mui/material/TableRow";import{ChevronRightIcon as m,ChevronLeftIcon as s}from"lucide-react";import{jsx as h,jsxs as u,Fragment as g}from"react/jsx-runtime";function p(n){const i=e(18),{nextFetch:o,handleDataFetch:c,isFetching:l,count:p,page:d,rowsPerPage:f}=n,P=a(),F=p<=f,x=0===d||!1===o.prev;let b;i[0]!==p||i[1]!==f?(b=Number.isFinite(p)&&Number.isFinite(f)&&f>0?Math.ceil(p/f):0,i[0]=p,i[1]=f,i[2]=b):b=i[2];const y=d>=b-1||!1===o.next;let w;i[3]!==c||i[4]!==x?(w=async()=>{x||await c("left")},i[3]=c,i[4]=x,i[5]=w):w=i[5];const C=w;let T;i[6]!==c||i[7]!==y?(T=async()=>{y||await c("right")},i[6]=c,i[7]=y,i[8]=T):T=i[8];const S=T;let v,E;return i[9]===Symbol.for("react.memo_cache_sentinel")?(v={flexShrink:0,ml:2,mr:1},i[9]=v):v=i[9],i[10]!==C||i[11]!==S||i[12]!==l||i[13]!==x||i[14]!==y||i[15]!==F||i[16]!==P?(E=h(t,{component:"div",sx:v,children:F?h("span",{}):u(g,{children:[h(r,{onClick:C,disabled:x||l,"aria-label":"previous-page",children:"rtl"===P.direction?h(m,{size:20}):h(s,{size:20})}),h(r,{onClick:S,disabled:y||l,"aria-label":"next-page",children:"rtl"===P.direction?h(s,{size:20}):h(m,{size:20})})]})}),i[10]=C,i[11]=S,i[12]=l,i[13]=x,i[14]=y,i[15]=F,i[16]=P,i[17]=E):E=i[17],E}const d=t=>{const n=e(14),{expectedItemCount:i,rowsPerPage:r,customSelectPages:a,currentPage:m,isFetching:s,nextFetch:u,handleFetchData:g,handleChangeRowsPerPage:d}=t;let f;n[0]!==g||n[1]!==s||n[2]!==u?(f=e=>h(p,{...e,handleDataFetch:g,nextFetch:u,isFetching:s}),n[0]=g,n[1]=s,n[2]=u,n[3]=f):f=n[3];const P=f;let x,b,y;return n[4]!==a?(x=a??[6,12],n[4]=a,n[5]=x):x=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(b={paddingY:"1rem !important",borderBottom:"none"},n[6]=b):b=n[6],n[7]!==P||n[8]!==m||n[9]!==i||n[10]!==d||n[11]!==r||n[12]!==x?(y=h(o,{children:h(l,{children:h(c,{count:i,rowsPerPage:r,rowsPerPageOptions:x,page:m,onPageChange:F,onRowsPerPageChange:d,ActionsComponent:P,sx:b})})}),n[7]=P,n[8]=m,n[9]=i,n[10]=d,n[11]=r,n[12]=x,n[13]=y):y=n[13],y},f=t=>{const r=e(5),{fetchEvent:a,nextFetch:o,isFetching:c,isTableEmpty:l,loadingType:m}=t;if(!o.next||c||l||"infiniteScroll"===m)return null;let s;r[0]!==a?(s=async()=>{await a("right")},r[0]=a,r[1]=s):s=r[1];const u=s;let g,p;return r[2]===Symbol.for("react.memo_cache_sentinel")?(g={justifyContent:"center",alignItems:"center",my:4},r[2]=g):g=r[2],r[3]!==u?(p=h(i,{container:!0,sx:g,children:h(n,{variant:"contained",color:"primary",onClick:u,children:"Carica altri"})}),r[3]=u,r[4]=p):p=r[4],p};function P(t){const n=e(15),{tableVariant:i,fetchEvent:r,nextFetch:a,loadingType:o,expectedItemCount:c,rowsPerPage:l,customSelectPages:m,currentPage:s,isFetching:u,isTableEmpty:g,handleChangeRowsPerPage:p}=t;if(g)return null;if("infinite"===i){let e;return n[0]!==r||n[1]!==u||n[2]!==g||n[3]!==o||n[4]!==a?(e=h(f,{nextFetch:a,isFetching:u,isTableEmpty:g,fetchEvent:r,loadingType:o}),n[0]=r,n[1]=u,n[2]=g,n[3]=o,n[4]=a,n[5]=e):e=n[5],e}{let e;return n[6]!==s||n[7]!==m||n[8]!==c||n[9]!==r||n[10]!==p||n[11]!==u||n[12]!==a||n[13]!==l?(e=h(d,{expectedItemCount:c,rowsPerPage:l,customSelectPages:m,currentPage:s,isFetching:u,nextFetch:a,handleFetchData:r,handleChangeRowsPerPage:p}),n[6]=s,n[7]=m,n[8]=c,n[9]=r,n[10]=p,n[11]=u,n[12]=a,n[13]=l,n[14]=e):e=n[14],e}}function F(){return null}export{P as CardsTableFooter};
|
package/dist/components/tables/{CardsGrid/DynamicCardsTypes.d.ts → CardsTable/CardsTableTypes.d.ts}
RENAMED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { FetchInfoProps } from '../RealtimeTable/RealtimeTableTypes.js';
|
|
3
|
+
export { FetchDataResponse } from '../RealtimeTable/RealtimeTableTypes.js';
|
|
4
|
+
import { DynamicColumns, i18nStrings } from '../TableComponents/TableTypes.js';
|
|
3
5
|
|
|
4
6
|
type CardFilters<T> = Omit<DynamicColumns<T>, 'Cell' | 'ColumnCell' | 'Tooltip' | 'maxWidth' | 'visible'>;
|
|
5
7
|
type InfiniteViewType = 'list' | 'cards' | 'dual';
|
|
6
|
-
interface
|
|
8
|
+
interface CardsTableInfo<T extends Record<string, unknown>> {
|
|
7
9
|
tableTitle?: React.ReactNode | string;
|
|
8
10
|
tableName?: string;
|
|
9
11
|
tableData: Array<T>;
|
|
10
12
|
setTableData?: Dispatch<SetStateAction<T[]>>;
|
|
11
|
-
|
|
13
|
+
filters: CardFilters<T>[];
|
|
12
14
|
expectedItemCount: number;
|
|
13
15
|
tableVariant: 'standard' | 'infinite';
|
|
14
16
|
gridSizings?: {
|
|
@@ -18,7 +20,6 @@ interface DynamicCardInfo<T extends Record<string, any>> {
|
|
|
18
20
|
lg: number;
|
|
19
21
|
xl: number;
|
|
20
22
|
};
|
|
21
|
-
filterMode?: 'single' | 'multiple';
|
|
22
23
|
defaultShowFilters?: boolean;
|
|
23
24
|
showEmptyTable?: boolean;
|
|
24
25
|
standardOptions?: {
|
|
@@ -33,29 +34,19 @@ interface DynamicCardInfo<T extends Record<string, any>> {
|
|
|
33
34
|
switcherPosition?: 'left' | 'right';
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
interface CardItemInfo<T extends Record<string,
|
|
37
|
+
interface CardItemInfo<T extends Record<string, unknown>> {
|
|
37
38
|
CardItem: (item: T) => React.ReactNode;
|
|
38
39
|
ListItem?: (item: T) => React.ReactNode;
|
|
39
40
|
SkeletonItem?: () => React.ReactNode;
|
|
40
41
|
SkeletonListItem?: () => React.ReactNode;
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* @param tableInfo - The information about the table.
|
|
46
|
-
* @param fetchInfo - The information about the fetching of the data.
|
|
47
|
-
* @param cardInfo - The information about the cards to be displayed.
|
|
48
|
-
* @param queryInfo - The information about the query.
|
|
49
|
-
* @param tableLocale - The locale of the table.
|
|
50
|
-
* @param localeStr - The localized strings.
|
|
51
|
-
*/
|
|
52
|
-
interface DynamicCardsProps<T extends Record<string, any>> {
|
|
53
|
-
tableInfo: DynamicCardInfo<T>;
|
|
54
|
-
fetchInfo: FetchInfoProps;
|
|
43
|
+
interface CardsTableProps<T extends Record<string, unknown>> {
|
|
44
|
+
tableInfo: CardsTableInfo<T>;
|
|
45
|
+
fetchInfo: FetchInfoProps<T>;
|
|
55
46
|
cardInfo: CardItemInfo<T>;
|
|
56
|
-
|
|
47
|
+
filtersQuery?: string;
|
|
57
48
|
tableLocale?: 'en' | 'it';
|
|
58
49
|
localeStr?: i18nStrings;
|
|
59
50
|
}
|
|
60
51
|
|
|
61
|
-
export type { CardFilters, CardItemInfo,
|
|
52
|
+
export type { CardFilters, CardItemInfo, CardsTableInfo, CardsTableProps, InfiniteViewType };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"react/compiler-runtime";import t from"@mui/material/
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t from"@mui/material/Table";import o from"@mui/material/TableBody";import i from"@mui/material/TableContainer";import n,{useEffect as l}from"react";import{TableCommonHeaderProps as c,EmtpyTableBody as a,SkeletonRows as r,TableDataRows as s,TableContextMenu as d,BlankTableRow as m}from"../TableComponents/TableCommonBody.js";import{jsx as u,jsxs as b}from"react/jsx-runtime";function h(h){const v=e(76),{tableData:g,activeFilters:f,onFiltersChange:p,visibleColumns:C,tableActions:A,tableActionsActive:w,quickSelectedRows:S,setQuickSelectedRows:T,rowsPerPage:x,isFetching:y,onRowClick:k,autoSizeHeight:R,emptyTablePlaceholder:P,isTableEmpty:F,hideFooter:M,variant:L,localeStr:q}=h,[B,_]=n.useState(!1);let H,Q,X;v[0]!==y?(H=()=>{let e;if(y)return e=setTimeout(()=>{_(!0)},200),()=>clearTimeout(e);e=setTimeout(()=>{_(!1)},0)},Q=[y],v[0]=y,v[1]=H,v[2]=Q):(H=v[1],Q=v[2]),l(H,Q),v[3]!==A?(X=A||{},v[3]=A,v[4]=X):X=v[4];const{quickActions:Y,contextMenuActions:j}=X;let D;v[5]!==Y?(D=Y||{},v[5]=Y,v[6]=D):D=v[6];const{actionList:W,onAction:z}=D;let E;v[7]!==W?(E=void 0===W?[]:W,v[7]=W,v[8]=E):E=v[8];const I=E;let N;v[9]!==j?(N=j||{},v[9]=j,v[10]=N):N=v[10];const{actionList:G,onAction:J}=N;let K;v[11]!==G?(K=void 0===G?[]:G,v[11]=G,v[12]=K):K=v[12];const O=K,[U,V]=n.useState(void 0),[Z,$]=n.useState(null);let ee;v[13]!==I||v[14]!==Z||v[15]!==O||v[16]!==w||v[17]!==g?(ee=e=>{if(w)return;if(0===I.length&&0===O.length)return;e.preventDefault();const t=e.currentTarget.getAttribute("id");if(t){const e=g.find(e=>String(e.id)===t);V(e)}else V(void 0);$(null===Z?{mouseX:e.clientX+2,mouseY:e.clientY-6}:null);const o=document.getSelection();if(o&&o.rangeCount>0){const e=o.getRangeAt(0);setTimeout(()=>{o.addRange(e)})}},v[13]=I,v[14]=Z,v[15]=O,v[16]=w,v[17]=g,v[18]=ee):ee=v[18];const te=ee;let oe;v[19]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>{$(null),V(void 0)},v[19]=oe):oe=v[19];const ie=oe;let ne;v[20]!==x||v[21]!==g?(ne=x>0?g.slice(0,x):g,v[20]=x,v[21]=g,v[22]=ne):ne=v[22];const le=ne,ce=R?5-le.length||0:x-le.length;let ae;v[23]!==S?(ae=e=>S.some(t=>t.id===e.id),v[23]=S,v[24]=ae):ae=v[24];const re=ae;let se;v[25]!==U?.id?(se=e=>U?.id===e.id,v[25]=U?.id,v[26]=se):se=v[26];const de=se;let me;v[27]!==T?(me=e=>{T(t=>t.some(t=>t.id===e.id)?t.filter(t=>t.id!==e.id):[...t,e])},v[27]=T,v[28]=me):me=v[28];const ue=me,be=F?"div":n.Fragment,he=F?"visible":"auto";let ve,ge,fe,pe,Ce,Ae,we,Se;return v[29]!==he?(ve={bgcolor:"background.paper",tableLayout:"fixed",width:"100%",overflowY:he,scrollbarWidth:"thin",scrollbarColor:"silver transparent"},v[29]=he,v[30]=ve):ve=v[30],v[31]===Symbol.for("react.memo_cache_sentinel")?(ge={overflowX:"auto",minWidth:150,"@keyframes fadeIn":{"0%":{opacity:0},"100%":{opacity:1}}},v[31]=ge):ge=v[31],v[32]!==F?(fe=F?{role:"table",style:{display:"table",width:"100%"}}:{},v[32]=F,v[33]=fe):fe=v[33],v[34]!==f||v[35]!==le||v[36]!==q||v[37]!==p||v[38]!==S||v[39]!==T||v[40]!==w||v[41]!==C?(pe=u(c,{currentPageRows:le,visibleColumns:C,quickActions:w,quickSelectedRows:S,setQuickSelectedRows:T,activeFilters:f,onFiltersChange:p,localeStr:q}),v[34]=f,v[35]=le,v[36]=q,v[37]=p,v[38]=S,v[39]=T,v[40]=w,v[41]=C,v[42]=pe):pe=v[42],v[43]!==be||v[44]!==fe||v[45]!==pe?(Ce=u(be,{...fe,children:pe}),v[43]=be,v[44]=fe,v[45]=pe,v[46]=Ce):Ce=v[46],v[47]!==I||v[48]!==f||v[49]!==ce||v[50]!==Z||v[51]!==O||v[52]!==le||v[53]!==P||v[54]!==ue||v[55]!==te||v[56]!==M||v[57]!==de||v[58]!==re||v[59]!==F||v[60]!==z||v[61]!==J||v[62]!==k||v[63]!==x||v[64]!==U||v[65]!==B||v[66]!==w||v[67]!==L||v[68]!==C?(Ae=F?u(a,{rowsPerPage:x,emptyTablePlaceholder:P,hideFooter:M}):b(o,{component:"div",children:[B?u(r,{rowsPerPage:x,tableActionsActive:w,visibleColumns:C,variant:L}):u(s,{currentPageRows:le,visibleColumns:C,tableActionsActive:w,variant:L,isQuickSelected:re,isContextSelected:de,onRowClick:k,handleCheckBoxSelect:ue,handleContextMenu:te}),u(d,{contextMenu:Z,selectedContextRow:U,contextMenuActionList:O,actionHeaderList:I,onContextMenuAction:J,onActionHeader:z,activeFilters:f,tableActionsActive:w,handleCloseContextMenu:ie}),!B&&ce>0&&u(m,{blankRows:ce})]}),v[47]=I,v[48]=f,v[49]=ce,v[50]=Z,v[51]=O,v[52]=le,v[53]=P,v[54]=ue,v[55]=te,v[56]=M,v[57]=de,v[58]=re,v[59]=F,v[60]=z,v[61]=J,v[62]=k,v[63]=x,v[64]=U,v[65]=B,v[66]=w,v[67]=L,v[68]=C,v[69]=Ae):Ae=v[69],v[70]!==Ce||v[71]!==Ae?(we=b(t,{component:"div",sx:ge,children:[Ce,Ae]}),v[70]=Ce,v[71]=Ae,v[72]=we):we=v[72],v[73]!==ve||v[74]!==we?(Se=u(i,{className:"RealTimeTable-Body",sx:ve,children:we}),v[73]=ve,v[74]=we,v[75]=Se):Se=v[75],Se}export{h as RealTimeTableBody};
|