@famalabs/web-ui 1.0.0-beta.1
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/README.md +7 -0
- package/dist/components/auth/AuthSuccess.d.ts +11 -0
- package/dist/components/auth/AuthSuccess.js +1 -0
- package/dist/components/auth/PasswordField.d.ts +30 -0
- package/dist/components/auth/PasswordField.js +1 -0
- package/dist/components/common/MainDiv.d.ts +10 -0
- package/dist/components/common/MainDiv.js +1 -0
- package/dist/components/common/MenuItems.d.ts +19 -0
- package/dist/components/common/MenuItems.js +1 -0
- package/dist/components/forms/AiEditingContext.d.ts +20 -0
- package/dist/components/forms/AiEditingContext.js +1 -0
- package/dist/components/forms/AiUtils.js +1 -0
- package/dist/components/forms/AutocompleteField.d.ts +20 -0
- package/dist/components/forms/AutocompleteField.js +1 -0
- package/dist/components/forms/DateField.d.ts +18 -0
- package/dist/components/forms/DateField.js +1 -0
- package/dist/components/forms/InputField.d.ts +16 -0
- package/dist/components/forms/InputField.js +1 -0
- package/dist/components/forms/InputNumber.d.ts +21 -0
- package/dist/components/forms/InputNumber.js +1 -0
- package/dist/components/forms/InputString.d.ts +21 -0
- package/dist/components/forms/InputString.js +1 -0
- package/dist/components/forms/RichTextEditor/FormattingToolbar.d.ts +20 -0
- package/dist/components/forms/RichTextEditor/FormattingToolbar.js +1 -0
- package/dist/components/forms/RichTextEditor/RichTextEditor.d.ts +37 -0
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +1 -0
- package/dist/components/forms/RichTextField.d.ts +15 -0
- package/dist/components/forms/RichTextField.js +1 -0
- package/dist/components/forms/SelectField.d.ts +18 -0
- package/dist/components/forms/SelectField.js +1 -0
- package/dist/components/forms/TimeField.d.ts +18 -0
- package/dist/components/forms/TimeField.js +1 -0
- package/dist/components/forms/useFormState.d.ts +87 -0
- package/dist/components/forms/useFormState.js +1 -0
- package/dist/components/sidebar/SidebarFooter.d.ts +21 -0
- package/dist/components/sidebar/SidebarFooter.js +1 -0
- package/dist/components/sidebar/SidebarLayout.d.ts +42 -0
- package/dist/components/sidebar/SidebarLayout.js +1 -0
- package/dist/components/snackbar/Notifier/Notifier.d.ts +17 -0
- package/dist/components/snackbar/Notifier/Notifier.js +1 -0
- package/dist/components/tables/CardsGrid/CardsBodyCreator.js +1 -0
- package/dist/components/tables/CardsGrid/DynamcCardsFooter.js +1 -0
- package/dist/components/tables/CardsGrid/DynamicCardsTable.d.ts +6 -0
- package/dist/components/tables/CardsGrid/DynamicCardsTable.js +1 -0
- package/dist/components/tables/CardsGrid/DynamicCardsTypes.d.ts +61 -0
- package/dist/components/tables/LegacyTable/LegacyTable.d.ts +6 -0
- package/dist/components/tables/LegacyTable/LegacyTable.js +1 -0
- package/dist/components/tables/LegacyTable/LegacyTableFooter.js +1 -0
- package/dist/components/tables/RealtimeTable/RealTimeTableBody.js +1 -0
- package/dist/components/tables/RealtimeTable/RealTimeTableFooter.js +1 -0
- package/dist/components/tables/RealtimeTable/RealtimeTable.d.ts +6 -0
- package/dist/components/tables/RealtimeTable/RealtimeTable.js +1 -0
- package/dist/components/tables/RealtimeTable/RealtimeTableTypes.d.ts +20 -0
- package/dist/components/tables/TableCells/ActionCell.d.ts +15 -0
- package/dist/components/tables/TableCells/ActionCell.js +1 -0
- package/dist/components/tables/TableCells/AvatarCell.d.ts +8 -0
- package/dist/components/tables/TableCells/AvatarCell.js +1 -0
- package/dist/components/tables/TableCells/BooleanCell.d.ts +8 -0
- package/dist/components/tables/TableCells/BooleanCell.js +1 -0
- package/dist/components/tables/TableCells/DateCell.d.ts +7 -0
- package/dist/components/tables/TableCells/DateCell.js +1 -0
- package/dist/components/tables/TableCells/ImageCell.d.ts +7 -0
- package/dist/components/tables/TableCells/ImageCell.js +1 -0
- package/dist/components/tables/TableCells/LinkCell.d.ts +8 -0
- package/dist/components/tables/TableCells/LinkCell.js +1 -0
- package/dist/components/tables/TableCells/SelectCell.d.ts +13 -0
- package/dist/components/tables/TableCells/SelectCell.js +1 -0
- package/dist/components/tables/TableCells/StatusCell.d.ts +11 -0
- package/dist/components/tables/TableCells/StatusCell.js +1 -0
- package/dist/components/tables/TableComponents/TableActionHeader.js +1 -0
- package/dist/components/tables/TableComponents/TableCommonBody.js +1 -0
- package/dist/components/tables/TableComponents/TableFilterComponents.js +1 -0
- package/dist/components/tables/TableComponents/TableFilterHeader.js +1 -0
- package/dist/components/tables/TableComponents/TableLocales.js +1 -0
- package/dist/components/tables/TableComponents/TableTypes.d.ts +178 -0
- package/dist/components/theme/ThemeLoader/Loader.d.ts +13 -0
- package/dist/components/theme/ThemeLoader/Loader.js +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +1 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +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"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};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { LucideProps } from 'lucide-react';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
type CustomIcons = {
|
|
7
|
+
Eye: React.ComponentType<React.SVGProps<SVGSVGElement> & Omit<LucideProps, 'ref'>>;
|
|
8
|
+
EyeOff: React.ComponentType<React.SVGProps<SVGSVGElement> & Omit<LucideProps, 'ref'>>;
|
|
9
|
+
X: React.ComponentType<React.SVGProps<SVGSVGElement> & Omit<LucideProps, 'ref'>>;
|
|
10
|
+
Check: React.ComponentType<React.SVGProps<SVGSVGElement> & Omit<LucideProps, 'ref'>>;
|
|
11
|
+
};
|
|
12
|
+
interface PasswordFieldProps {
|
|
13
|
+
title: string;
|
|
14
|
+
name: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
variant?: 'standard' | 'outlined' | 'filled';
|
|
17
|
+
required?: boolean;
|
|
18
|
+
requiredText?: string;
|
|
19
|
+
margin?: 'none' | 'dense' | 'normal';
|
|
20
|
+
size?: 'small' | 'medium';
|
|
21
|
+
errorText?: string;
|
|
22
|
+
fullWidth?: boolean;
|
|
23
|
+
showRequirements?: boolean;
|
|
24
|
+
customIcons?: CustomIcons;
|
|
25
|
+
sx?: SxProps<Theme>;
|
|
26
|
+
}
|
|
27
|
+
declare const PasswordField: (props: PasswordFieldProps) => react_jsx_runtime.JSX.Element;
|
|
28
|
+
|
|
29
|
+
export { PasswordField };
|
|
30
|
+
export type { PasswordFieldProps };
|
|
@@ -0,0 +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 n,useTheme as i}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=n(({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=n=>{const m=e(57),{title:s,name:v,placeholder:C,variant:_,required:S,requiredText:w,margin:z,size:I,errorText:A,fullWidth:T,showRequirements:j,customIcons:k,sx:W}=n,q=void 0===s?"Password":s,E=void 0===v?"password":v,R=void 0===C?"Inserisci la password":C,$=void 0===_?"outlined":_,O=void 0===S||S,B=void 0===w?"Questo campo è obbligatorio":w,F=void 0===z?"dense":z,L=void 0===I?"medium":I,P=void 0===A?"La password non è conforme":A,X=void 0===T||T,D=void 0===j||j;let G;m[0]!==k?(G=void 0===k?{Eye:f,EyeOff:u,X:d,Check:p}:k,m[0]=k,m[1]=G):G=m[1];const M=G,{Eye:N,EyeOff:Q,X:Z,Check:H}=M,J=i();let K;m[2]===Symbol.for("react.memo_cache_sentinel")?(K=/^(?=.*[a-z])(?=.*\d).{8,}$/,m[2]=K):K=m[2];const U=K,[V,Y]=h.useState(""),[ee,te]=h.useState(!1),[re,oe]=h.useState("");let ae;m[3]!==ee?(ae=()=>{te(!ee)},m[3]=ee,m[4]=ae):ae=m[4];const ne=ae;let ie;m[5]!==H||m[6]!==Z||m[7]!==J?(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(H,{size:18,style:{color:J.palette.success.main}}):x(Z,{size:18,style:{color:J.palette.error.main}})}),x(r,{container:!0,sx:{justifyContent:"center",alignItems:"center"},children:x(c,{variant:"caption",color:t.regex.test(e)?J.palette.success.main:J.palette.error.main,children:t.label})})]},o))}),m[5]=H,m[6]=Z,m[7]=J,m[8]=ie):ie=m[8];const le=ie,me=h.useRef(null);let se;m[9]!==V?(se=U.test(V),m[9]=V,m[10]=se):se=m[10];const ce=se,pe=D&&V.length>0&&!ce,de=`${q}${O?"*":""}`;let ue,fe;m[11]!==de?(ue=x(t,{children:de}),m[11]=de,m[12]=ue):ue=m[12],m[13]!==le||m[14]!==V?(fe=le(V),m[13]=le,m[14]=V,m[15]=fe):fe=m[15];const he=pe??!1;let xe;m[16]===Symbol.for("react.memo_cache_sentinel")?(xe=()=>me.current?.blur(),m[16]=xe):xe=m[16];const ge=ee?"text":"password",be=!!re;let ye,ve,Ce,_e,Se,we,ze,Ie,Ae,Te,je;return m[17]===Symbol.for("react.memo_cache_sentinel")?(ye=e=>Y(e.target.value),m[17]=ye):ye=m[17],m[18]!==P||m[19]!==O||m[20]!==B?(ve=e=>{!e.target.value&&O?oe(B):U.test(e.target.value)||oe(P)},m[18]=P,m[19]=O,m[20]=B,m[21]=ve):ve=m[21],m[22]===Symbol.for("react.memo_cache_sentinel")?(Ce=()=>oe(""),m[22]=Ce):Ce=m[22],m[23]===Symbol.for("react.memo_cache_sentinel")?(_e={borderRadius:"10px","& fieldset":{borderWidth:"2px"}},m[23]=_e):_e=m[23],m[24]!==W?(Se={...W,"& .MuiOutlinedInput-root":_e},m[24]=W,m[25]=Se):Se=m[25],m[26]===Symbol.for("react.memo_cache_sentinel")?(we={mr:"-5px"},m[26]=we):we=m[26],m[27]!==N||m[28]!==Q||m[29]!==ee||m[30]!==L?(ze=x(ee?Q:N,{size:"small"===L?18:24}),m[27]=N,m[28]=Q,m[29]=ee,m[30]=L,m[31]=ze):ze=m[31],m[32]!==ne||m[33]!==ze?(Ie={input:{endAdornment:x(a,{position:"end",children:x(o,{onClick:ne,edge:"end",size:"small",focusRipple:!1,sx:we,children:ze})})}},m[32]=ne,m[33]=ze,m[34]=Ie):Ie=m[34],m[35]!==X||m[36]!==F||m[37]!==E||m[38]!==V||m[39]!==re||m[40]!==R||m[41]!==O||m[42]!==L||m[43]!==ge||m[44]!==be||m[45]!==ve||m[46]!==Se||m[47]!==Ie||m[48]!==$?(Ae=x(l,{ref:me,fullWidth:X,name:E,type:ge,placeholder:R,variant:$,required:O,margin:F,error:be,helperText:re,value:V,size:L,autoComplete:"off",onChange:ye,onBlur:ve,onChangeCapture:Ce,sx:Se,slotProps:Ie}),m[35]=X,m[36]=F,m[37]=E,m[38]=V,m[39]=re,m[40]=R,m[41]=O,m[42]=L,m[43]=ge,m[44]=be,m[45]=ve,m[46]=Se,m[47]=Ie,m[48]=$,m[49]=Ae):Ae=m[49],m[50]!==fe||m[51]!==he||m[52]!==Ae?(Te=x(b,{title:fe,placement:"bottom-start",open:he,onClose:xe,enterDelay:300,children:Ae}),m[50]=fe,m[51]=he,m[52]=Ae,m[53]=Te):Te=m[53],m[54]!==ue||m[55]!==Te?(je=g(r,{size:12,children:[ue,Te]}),m[54]=ue,m[55]=Te,m[56]=je):je=m[56],je};export{v as PasswordField};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import"react";import{styled as t}from"@mui/material/styles";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};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ListProps } from '@mui/material/List';
|
|
3
|
+
import { SidebarItem } from '../sidebar/SidebarLayout.js';
|
|
4
|
+
|
|
5
|
+
type ListType = 'body' | 'footer' | string;
|
|
6
|
+
interface MenuItemsProps {
|
|
7
|
+
displayItems: SidebarItem[];
|
|
8
|
+
onSelectItem: (itemID: ListType, title: string, link: string) => void;
|
|
9
|
+
onHoverItem?: (itemID: ListType, title: string, link: string) => Promise<void> | void;
|
|
10
|
+
selectedLink?: string;
|
|
11
|
+
listProps?: ListProps;
|
|
12
|
+
listType: ListType;
|
|
13
|
+
iconOnly?: boolean;
|
|
14
|
+
mobile?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare function MenuItems(props: MenuItemsProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { MenuItems };
|
|
19
|
+
export type { ListType, MenuItemsProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as t}from"react/compiler-runtime";import{useTheme as e}from"@mui/material/styles";import i from"@mui/material/Collapse";import n from"@mui/material/List";import o from"@mui/material/ListItem";import r from"@mui/material/ListItemButton";import l from"@mui/material/ListItemIcon";import m from"@mui/material/ListItemText";import a from"react";import{ChevronUpIcon as s,ChevronDownIcon as c}from"lucide-react";import{jsx as d,jsxs as p}from"react/jsx-runtime";function u(u){const k=t(30),{displayItems:y,listType:x,onSelectItem:I,onHoverItem:S,selectedLink:v,listProps:L,iconOnly:C,mobile:$}=u;let b;k[0]!==L?(b=void 0===L?{}:L,k[0]=L,k[1]=b):b=k[1];const E=b,_=void 0!==C&&C,j=void 0!==$&&$,w=e();let P;k[2]===Symbol.for("react.memo_cache_sentinel")?(P=new Set,k[2]=P):P=k[2];const[W,O]=a.useState(P);let T,z,B,F,H;k[3]!==v?(T=()=>{console.log("Selected Link Changed:",v)},z=[v],k[3]=v,k[4]=T,k[5]=z):(T=k[4],z=k[5]),a.useEffect(T,z),k[6]!==W?(B=()=>{console.log("Selected Expanded Changed:",W)},F=[W],k[6]=W,k[7]=B,k[8]=F):(B=k[7],F=k[8]),a.useEffect(B,F),k[9]===Symbol.for("react.memo_cache_sentinel")?(H=t=>{O(e=>{const i=new Set(e);return i.has(t)?i.delete(t):i.add(t),i})},k[9]=H):H=k[9];const M=H,Y=g;let q;k[10]!==y||k[11]!==v?(q=Y(y,v),k[10]=y,k[11]=v,k[12]=q):q=k[12];const A=q;let D,G,J,K;if(k[13]!==y||k[14]!==W||k[15]!==_||k[16]!==E||k[17]!==x||k[18]!==A||k[19]!==j||k[20]!==S||k[21]!==I||k[22]!==w){const t=(e,u,g)=>{const k=void 0!==g&&g,y="items"in e&&e.items&&e.items.length>0,v=`${e.title}-${u}`,L=_||W.has(v),C=A===e.link;return p(a.Fragment,{children:[d(o,{component:"div",disablePadding:!0,children:p(r,{onClick:()=>{y&&!_?M(v):I(x,e.title,e.link)},onMouseEnter:async()=>await(S?.(x,e.title,e.link)),sx:{...C&&{color:h},justifyContent:"center",paddingInline:_?0:"auto",paddingY:j?2:_?.8:.5,transition:`padding ${w.transitions.easing.sharp} ${w.transitions.duration.leavingScreen}ms`,px:"auto",pl:k&&!_?4:void 0},children:[d(l,{sx:{...C&&{color:f},minWidth:"32px",padding:0,justifyContent:"center"},children:e.icon}),!_&&d(m,{primary:e.title,sx:{paddingInline:1}}),!_&&y&&d(L?s:c,{size:18})]})}),y&&d(i,{in:L,timeout:"auto",unmountOnExit:!_,children:d(n,{...E,disablePadding:!0,sx:{my:_?0:1},children:e.items?.map((e,i)=>t(e,i,!0))})})]},v)};D=n,G=E,J=y?.map((e,i)=>t(e,i)),k[13]=y,k[14]=W,k[15]=_,k[16]=E,k[17]=x,k[18]=A,k[19]=j,k[20]=S,k[21]=I,k[22]=w,k[23]=D,k[24]=G,k[25]=J}else D=k[23],G=k[24],J=k[25];return k[26]!==D||k[27]!==G||k[28]!==J?(K=d(D,{...G,children:J}),k[26]=D,k[27]=G,k[28]=J,k[29]=K):K=k[29],K}function f(t){return t.palette.primary.main}function h(t){return t.palette.primary.main}function g(t,e){if(!t.length||!e)return"";let i="";for(const n of t)if((e===n.link||e.startsWith(`${n.link}/`))&&n.link.length>i.length&&(i=n.link),n.items)for(const t of n.items)(e===t.link||e.startsWith(`${t.link}/`))&&t.link.length>i.length&&(i=t.link);return i}export{u as MenuItems};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface AiEditingContextType {
|
|
5
|
+
aiEditingField: string | null;
|
|
6
|
+
setAiEditingField: (fieldName: string | null) => void;
|
|
7
|
+
aiDirtyFields: Set<string>;
|
|
8
|
+
markAiDirty: (fieldName: string) => void;
|
|
9
|
+
clearAiDirty: (fieldName: string) => void;
|
|
10
|
+
clearAllAiDirty: () => void;
|
|
11
|
+
typewriterSpeed: number;
|
|
12
|
+
setTypewriterSpeed: (speed: number) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const AiEditingProvider: ({ defaultEditSpeed, children, }: {
|
|
15
|
+
defaultEditSpeed?: number;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare const useAiEditing: () => AiEditingContextType;
|
|
19
|
+
|
|
20
|
+
export { AiEditingProvider, useAiEditing };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t,{createContext as r}from"react";import{jsx as i}from"react/jsx-runtime";const n=r(void 0),l=r=>{const l=e(11),{defaultEditSpeed:o,children:c}=r,u=void 0===o?1.2:o;let a;l[0]===Symbol.for("react.memo_cache_sentinel")?(a=new Set,l[0]=a):a=l[0];const[d,s]=t.useState(a),[m,y]=t.useState(null),[S,p]=t.useState(u);let f;l[1]===Symbol.for("react.memo_cache_sentinel")?(f=e=>{s(t=>new Set(t).add(e))},l[1]=f):f=l[1];const w=f;let A;l[2]===Symbol.for("react.memo_cache_sentinel")?(A=e=>{s(t=>{const r=new Set(t);return r.delete(e),r})},l[2]=A):A=l[2];const D=A;let F;l[3]===Symbol.for("react.memo_cache_sentinel")?(F=()=>{s(new Set)},l[3]=F):F=l[3];const _=F;let h,E;return l[4]!==d||l[5]!==m||l[6]!==S?(h={aiEditingField:m,setAiEditingField:y,aiDirtyFields:d,markAiDirty:w,clearAiDirty:D,clearAllAiDirty:_,typewriterSpeed:S,setTypewriterSpeed:p},l[4]=d,l[5]=m,l[6]=S,l[7]=h):h=l[7],l[8]!==c||l[9]!==h?(E=i(n.Provider,{value:h,children:c}),l[8]=c,l[9]=h,l[10]=E):E=l[10],E},o=()=>{const r=e(2),i=t.useContext(n);let l;return r[0]!==i?(l=i??{aiEditingField:null,setAiEditingField:d,aiDirtyFields:new Set,markAiDirty:s,clearAiDirty:m,clearAllAiDirty:y,typewriterSpeed:1.2,setTypewriterSpeed:S},r[0]=i,r[1]=l):l=r[1],l},c=e=>{const{aiEditingField:t}=o();return!!e&&t===e},u=t=>{const r=e(3),{aiDirtyFields:i}=o();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},a=()=>{const{typewriterSpeed:e}=o();return e};function d(){return null}function s(){return null}function m(){return null}function y(){return null}function S(){return null}export{l as AiEditingProvider,o as useAiEditing,u as useIsAiDirty,c as useIsAiEditing,a as useTypewriterSpeed};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=({animate:o=!1,dirty:r=!1,duration:e=1.2})=>o?{"& .MuiOutlinedInput-root":{pointerEvents:"none",userSelect:"none",transition:"border-color 0.3s ease",borderColor:"rgba(0,122,255,0.5)",boxShadow:"0 0 16px rgba(0, 122, 255, 0.5)","& .MuiInputBase-input":{color:"rgba(0,122,255,0.8)",animation:`typing ${e}s ease-out forwards`,clipPath:"inset(0 100% 0 0)"},"& .MuiAutocomplete-input":{},"& fieldset":{border:"2px solid",borderColor:"rgba(0,122,255,0.5)",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3)",animation:"glowPulse 1.2s ease-in-out infinite"},"&:hover fieldset":{borderColor:"rgba(0,122,255,0.5)"},"& textarea":{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},"@keyframes glowPulse":{"0%":{boxShadow:"0 0 6px rgba(0,122,255,0.3)"},"50%":{boxShadow:"0 0 12px rgba(0,122,255,0.6)"},"100%":{boxShadow:"0 0 6px rgba(0,122,255,0.3)"}},"@keyframes typing":{from:{clipPath:"inset(0 100% 0 0)"},to:{clipPath:"inset(0 0 0 0)"}}}}:r?{"& .MuiOutlinedInput-root":{"& .MuiInputBase-input":{color:"rgba(0,122,255,0.8)"},"& fieldset":{border:"2px solid",borderColor:"rgba(0,122,255,0.5)",transition:"border-color 0.3s ease",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3)"},"&:hover fieldset":{borderColor:"rgba(0,122,255,0.5)"}}}:{},r=({animate:o=!1,dirty:r=!1,duration:e=1.2})=>o?{pointerEvents:"none",userSelect:"none",transition:"border-color 0.3s ease",borderColor:"rgba(0,122,255,0.5)",boxShadow:"0 0 16px rgba(0, 122, 255, 0.5)","& .MuiInputBase-input":{color:"rgba(0,122,255,0.8)",animation:`typing ${e}s ease-out forwards`},"& fieldset":{border:"2px solid rgba(0,122,255,0.5)",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3)",animation:"glowPulse 1.2s ease-in-out infinite"},"&:hover fieldset":{borderColor:"rgba(0,122,255,0.5) !important"},"&.Mui-focused fieldset":{borderColor:"rgba(0,122,255,0.5) !important"},"& textarea":{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},"@keyframes glowPulse":{"0%":{boxShadow:"0 0 6px rgba(0,122,255,0.3)"},"50%":{boxShadow:"0 0 12px rgba(0,122,255,0.6)"},"100%":{boxShadow:"0 0 6px rgba(0,122,255,0.3)"}},"@keyframes typing":{from:{clipPath:"inset(0 100% 0 0)"},to:{clipPath:"inset(0 0 0 0)"}}}:r?{"& .MuiInputBase-input":{transition:"border-color 0.3s ease",color:"rgba(0,122,255,0.8)"},"& fieldset":{border:"2px solid rgba(0,122,255,0.5)",transition:"border-color 0.3s ease",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3)"},"&:hover fieldset":{borderColor:"rgba(0,122,255,0.5) !important"},"&.Mui-focused fieldset":{borderColor:"rgba(0,122,255,0.5) !important"}}:{},e={color:"rgba(0,122,255,0.8) !important"};export{o as aiEffectStyle,e as aiLabelStyle,r as aiSelectSxEffect};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { AutocompleteProps } from '@mui/material/Autocomplete';
|
|
3
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
+
import { FieldValues, Path, Control, FieldPathValue, RegisterOptions } from 'react-hook-form';
|
|
5
|
+
|
|
6
|
+
interface AutocompleteFieldProps<T extends FieldValues, Option, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false> extends Omit<AutocompleteProps<Option, Multiple, DisableClearable, FreeSolo>, 'renderInput' | 'onChange' | 'defaultValue'> {
|
|
7
|
+
name: Path<T>;
|
|
8
|
+
control: Control<T>;
|
|
9
|
+
defaultValue?: FieldPathValue<T, Path<T>>;
|
|
10
|
+
rules?: Omit<RegisterOptions<T, Path<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
11
|
+
shouldUnregister?: boolean;
|
|
12
|
+
legend?: boolean;
|
|
13
|
+
label?: string;
|
|
14
|
+
textFieldProps?: Omit<TextFieldProps, 'label' | 'error' | 'helperText'>;
|
|
15
|
+
onChange?: AutocompleteProps<Option, Multiple, DisableClearable, FreeSolo>['onChange'];
|
|
16
|
+
}
|
|
17
|
+
declare function AutocompleteField<T extends FieldValues, Option, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false>(props: AutocompleteFieldProps<T, Option, Multiple, DisableClearable, FreeSolo>): react_jsx_runtime.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { AutocompleteField };
|
|
20
|
+
export type { AutocompleteFieldProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import r from"@mui/material/Autocomplete";import o from"@mui/material/FormControl";import t from"@mui/material/FormLabel";import l from"@mui/material/InputAdornment";import i from"@mui/material/TextField";import{SparklesIcon as n}from"lucide-react";import{Controller as a}from"react-hook-form";import{useIsAiEditing as m,useIsAiDirty as s,useTypewriterSpeed as d}from"./AiEditingContext.js";import{aiEffectStyle as u,aiLabelStyle as p}from"./AiUtils.js";import{jsx as c,jsxs as f,Fragment as h}from"react/jsx-runtime";function x(x){const g=e(37),b=x;let A,v,C,y,B,F,j,T,U,z;g[0]!==b?(({name:B,control:v,defaultValue:C,rules:j,shouldUnregister:T,legend:U,label:y,textFieldProps:z,onChange:F,...A}=b),g[0]=b,g[1]=A,g[2]=v,g[3]=C,g[4]=y,g[5]=B,g[6]=F,g[7]=j,g[8]=T,g[9]=U,g[10]=z):(A=g[1],v=g[2],C=g[3],y=g[4],B=g[5],F=g[6],j=g[7],T=g[8],U=g[9],z=g[10]);const I=void 0===U||U,V=m(B),W=s(B),k=d();let E,L,P;g[11]!==k||g[12]!==V||g[13]!==W?(E=u({animate:V,dirty:W,duration:k}),g[11]=k,g[12]=V,g[13]=W,g[14]=E):E=g[14],g[15]!==z?(L=Array.isArray(z?.sx)?z.sx:z?.sx?[z.sx]:[],g[15]=z,g[16]=L):L=g[16],g[17]!==E||g[18]!==L?(P=[E,...L],g[17]=E,g[18]=L,g[19]=P):P=g[19];const S=P;let Y,q;return g[20]!==A||g[21]!==V||g[22]!==W||g[23]!==y||g[24]!==I||g[25]!==F||g[26]!==z||g[27]!==S?(Y=e=>{const{field:a,fieldState:m}=e,{error:s}=m,d=Boolean(A.multiple),u=A.value??(d?[]:a.value||null);return f(h,{children:[I&&c(t,{component:"legend",sx:{color:W?p.color:void 0},children:y}),c(o,{fullWidth:A.fullWidth,style:{marginTop:0},children:c(r,{...A,value:u,onChange:(e,r,o,t)=>{F?F(e,r,o,t):a.onChange(r)},onBlur:a.onBlur,disabled:a.disabled,renderInput:e=>f(h,{children:[c(i,{...e,label:I?"":y,error:Boolean(s),helperText:s?.message,...z,sx:S}),W&&!V&&c(l,{position:"end",sx:{position:"absolute",right:45,top:"55%",transform:"translateY(-50%)"},children:c(n,{size:"small"===z?.size?18:20,color:"rgba(0,122,255,0.8)"})})]})})})]})},g[20]=A,g[21]=V,g[22]=W,g[23]=y,g[24]=I,g[25]=F,g[26]=z,g[27]=S,g[28]=Y):Y=g[28],g[29]!==A.disabled||g[30]!==v||g[31]!==C||g[32]!==B||g[33]!==j||g[34]!==T||g[35]!==Y?(q=c(a,{name:B,control:v,defaultValue:C,disabled:A.disabled,rules:j,shouldUnregister:T,render:Y}),g[29]=A.disabled,g[30]=v,g[31]=C,g[32]=B,g[33]=j,g[34]=T,g[35]=Y,g[36]=q):q=g[36],q}export{x as AutocompleteField};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DateTimePickerProps } from '@mui/x-date-pickers/DateTimePicker';
|
|
3
|
+
import { FieldValues, Path, Control, FieldPathValue, RegisterOptions } from 'react-hook-form';
|
|
4
|
+
|
|
5
|
+
interface DateFieldProps<T extends FieldValues> extends Omit<DateTimePickerProps, 'name' | 'defaultValue' | 'variant' | 'error'> {
|
|
6
|
+
name: Path<T>;
|
|
7
|
+
control: Control<T>;
|
|
8
|
+
defaultValue?: FieldPathValue<T, Path<T>>;
|
|
9
|
+
rules?: Omit<RegisterOptions<T, Path<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
10
|
+
shouldUnregister?: boolean;
|
|
11
|
+
legend?: boolean;
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
stringOnEmpty?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare function DateField<T extends FieldValues>(props: DateFieldProps<T>): react_jsx_runtime.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { DateField };
|
|
18
|
+
export type { DateFieldProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t from"@mui/material/FormLabel";import{DateTimePicker as r}from"@mui/x-date-pickers/DateTimePicker";import o from"dayjs";import{CalendarFoldIcon as i,SparklesIcon as l}from"lucide-react";import s from"react";import{useWatch as a,Controller as n}from"react-hook-form";import{useIsAiEditing as m,useIsAiDirty as d,useTypewriterSpeed as u}from"./AiEditingContext.js";import{aiEffectStyle as c,aiLabelStyle as p}from"./AiUtils.js";import f from"@mui/material/FormControl";import x from"@mui/material/InputAdornment";import{useTheme as h}from"@mui/material/styles";import{jsx as y,jsxs as b,Fragment as g}from"react/jsx-runtime";function P(P){const v=e(16),{name:A,control:D,defaultValue:F,rules:S,shouldUnregister:k,legend:z,fullWidth:B,stringOnEmpty:V,...j}=P,C=void 0===z||z,I=void 0===B||B,Y=void 0!==V&&V,M=h(),O=Y?"":null,U=m(A),E=d(A),H=u(),T=j.minDate??o("1900-01-01"),W=j.maxDate??o("2099-12-31"),w=e=>(!T||e.isAfter(T)||e.isSame(T,"day"))&&(!W||e.isBefore(W)||e.isSame(W,"day"));let L;v[0]!==D||v[1]!==A?(L={control:D,name:A},v[0]=D,v[1]=A,v[2]=L):L=v[2];const q=a(L),[G,J]=s.useState(()=>{if(q){const e=o(q);return e.isValid()&&w(e)?e:null}return null});if(q&&!G){const e=o(q);e.isValid()&&w(e)&&J(e)}let K;v[3]!==O||v[4]!==J?(K=(e,t,r)=>{if(!e||!e.isValid())return t(O),r(),void J(null);t(e.toDate().toISOString()),r(),J(e)},v[3]=O,v[4]=J,v[5]=K):K=v[5];const N=K,Q=j.slotProps?.textField?.sx,R=[c({animate:U,dirty:E,duration:H}),...Array.isArray(Q)?Q:Q?[Q]:[]],X=U?"none":void 0;let Z;v[6]!==X?(Z={display:X},v[6]=X,v[7]=Z):Z=v[7];const $=[...Array.isArray(Q)?Q:Q?[Q]:[],Z],_=e=>{const{field:o,fieldState:s}=e,{error:a}=s;return b(f,{fullWidth:I,sx:{margin:"auto",position:"relative"},children:[C&&y(t,{sx:{color:E||U?p.color:void 0},children:j.label}),b(g,{children:[y(r,{views:["year","month","day"],format:"DD/MM/YYYY HH:mm",...j,...o,ref:o.ref,formatDensity:"dense",value:G,onChange:e=>{e&&e.isValid()&&w(e)?J(e):J(null)},minDate:T,maxDate:W,enableAccessibleFieldDOMStructure:!1,onAccept:e=>N(e,o.onChange,o.onBlur),slots:{...j.slots,openPickerIcon:i},slotProps:{openPickerIcon:{color:M.palette.action.active,size:"small"===j.slotProps?.textField?.size?20:24},openPickerButton:{size:j.slotProps?.textField?.size,sx:$},...j.slotProps,textField:{label:C?"":j.label,error:Boolean(a),helperText:a?.message,onBlur:o.onBlur,...j.slotProps?.textField,sx:R}}}),E&&!U&&y(x,{position:"end",sx:{position:"absolute",right:48,top:C?"59%":"38%"},children:y(l,{size:"small"===j.slotProps?.textField?.size?18:20,color:"rgba(0,122,255,0.8)"})})]})]})};let ee;return v[8]!==D||v[9]!==j.disabled||v[10]!==F||v[11]!==A||v[12]!==S||v[13]!==k||v[14]!==_?(ee=y(n,{name:A,control:D,defaultValue:F,disabled:j.disabled,rules:S,shouldUnregister:k,render:_}),v[8]=D,v[9]=j.disabled,v[10]=F,v[11]=A,v[12]=S,v[13]=k,v[14]=_,v[15]=ee):ee=v[15],ee}export{P as DateField};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { OutlinedTextFieldProps } from '@mui/material/TextField';
|
|
3
|
+
import { FieldValues, Path, Control, FieldPathValue, RegisterOptions } from 'react-hook-form';
|
|
4
|
+
|
|
5
|
+
interface InputFieldProps<T extends FieldValues> extends Omit<OutlinedTextFieldProps, 'name' | 'defaultValue' | 'variant' | 'error'> {
|
|
6
|
+
name: Path<T>;
|
|
7
|
+
control: Control<T>;
|
|
8
|
+
defaultValue?: FieldPathValue<T, Path<T>>;
|
|
9
|
+
rules?: Omit<RegisterOptions<T, Path<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
10
|
+
shouldUnregister?: boolean;
|
|
11
|
+
legend?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare function InputField<T extends FieldValues>(props: InputFieldProps<T>): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { InputField };
|
|
16
|
+
export type { InputFieldProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import e from"@mui/material/FormLabel";import o from"@mui/material/InputAdornment";import t from"@mui/material/TextField";import{SparklesIcon as l}from"lucide-react";import{useWatch as i,Controller as n}from"react-hook-form";import{useIsAiEditing as a,useIsAiDirty as s,useTypewriterSpeed as m}from"./AiEditingContext.js";import{aiLabelStyle as d,aiEffectStyle as u}from"./AiUtils.js";import{jsx as p,jsxs as c,Fragment as b}from"react/jsx-runtime";function f(f){const h=r(15),{name:g,control:x,defaultValue:A,rules:v,shouldUnregister:P,legend:y,...C}=f,L=void 0===y||y,B=a(g),j=s(g),k=m();let I;h[0]!==x||h[1]!==g?(I={control:x,name:g},h[0]=x,h[1]=g,h[2]=I):I=h[2];const U=i(I),z=C.slotProps?.inputLabel?.sx,F=[...Array.isArray(z)?z:[z],{color:B||j?d.color:void 0}],T=C.sx;let V;h[3]!==k||h[4]!==B||h[5]!==j?(V=u({animate:B,dirty:j,duration:k}),h[3]=k,h[4]=B,h[5]=j,h[6]=V):V=h[6];const E=[V,...Array.isArray(T)?T:[T]],M=r=>{const{field:i,fieldState:n}=r,{error:a}=n,s="number"===C.type;return c(b,{children:[L&&p(e,{sx:{color:B||j?d.color:void 0},children:C.label}),p(t,{variant:"outlined",fullWidth:!0,...C,label:L?"":C.label,error:Boolean(a),helperText:a?.message,slotProps:{...C.slotProps,inputLabel:{...C.slotProps?.inputLabel,shrink:B||C.slotProps?.inputLabel?.shrink,sx:F},input:{endAdornment:j&&!B&&p(o,{position:"end",children:p(l,{size:"small"===C?.size?18:20,color:"rgba(0,122,255,0.8)"})}),...C.slotProps?.input},htmlInput:{...C.slotProps?.htmlInput||{},...s&&{inputMode:"numeric",pattern:"[0-9]*"}}},...i,disabled:i.disabled,value:U??null,onBlur:r=>{i.onBlur(),C.onBlur?.(r)},onChange:r=>{if(C.onChange?.(r),s){const e=r.target.value;i.onChange(""===e?void 0:Number(e))}else i.onChange(r)},sx:E})]})};let N;return h[7]!==x||h[8]!==A||h[9]!==g||h[10]!==v||h[11]!==P||h[12]!==M||h[13]!==C.disabled?(N=p(n,{name:g,control:x,defaultValue:A,disabled:C.disabled,rules:v,shouldUnregister:P,render:M}),h[7]=x,h[8]=A,h[9]=g,h[10]=v,h[11]=P,h[12]=M,h[13]=C.disabled,h[14]=N):N=h[14],N}export{f as InputField};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FormNodeValidator } from './useFormState.js';
|
|
4
|
+
|
|
5
|
+
type NumberValidator = FormNodeValidator<number>;
|
|
6
|
+
interface InputNumberProps extends Omit<TextFieldProps, 'value' | 'onChange' | 'error' | 'helperText' | 'type'> {
|
|
7
|
+
nameid?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
value: number | null;
|
|
10
|
+
setValue: (value: number | null) => void;
|
|
11
|
+
setValid?: (valid: boolean) => void;
|
|
12
|
+
emptyMessage?: string;
|
|
13
|
+
defaultErrorMessage?: string;
|
|
14
|
+
validators?: NumberValidator[];
|
|
15
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
16
|
+
showError?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const InputNumber: React.FC<InputNumberProps>;
|
|
19
|
+
|
|
20
|
+
export { InputNumber };
|
|
21
|
+
export type { InputNumberProps, NumberValidator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t from"@mui/material/FormLabel";import r from"@mui/material/TextField";import l from"react";import{jsx as o,jsxs as i,Fragment as a}from"react/jsx-runtime";const n=[],u=u=>{const m=e(53);let d,s,f,c,v,p,g,h,b,x,E,y,q,B,F,M;m[0]!==u?(({nameid:s,title:F,value:M,setValue:p,setValid:v,emptyMessage:g,defaultErrorMessage:h,validators:b,variant:x,margin:E,fullWidth:y,label:d,required:q,onBlur:f,showError:B,...c}=u),m[0]=u,m[1]=d,m[2]=s,m[3]=f,m[4]=c,m[5]=v,m[6]=p,m[7]=g,m[8]=h,m[9]=b,m[10]=x,m[11]=E,m[12]=y,m[13]=q,m[14]=B,m[15]=F,m[16]=M):(d=m[1],s=m[2],f=m[3],c=m[4],v=m[5],p=m[6],g=m[7],h=m[8],b=m[9],x=m[10],E=m[11],y=m[12],q=m[13],B=m[14],F=m[15],M=m[16]);const S=void 0===g?"You cannot leave this field empty":g,T=void 0===h?"Invalid input":h,V=void 0===b?n:b,W=void 0===x?"outlined":x,j=void 0===E?"normal":E,w=void 0===y||y,C=void 0===q||q,I=void 0!==B&&B,[L,N]=l.useState(C?S:""),[Y,k]=l.useState(!1);let z,A,D;m[17]!==I?(A=()=>{I&&k(!0)},z=[I],m[17]=I,m[18]=z,m[19]=A):(z=m[18],A=m[19]),l.useEffect(A,z),m[20]!==T||m[21]!==S||m[22]!==C||m[23]!==V?(D=e=>{if(C&&null===e)return N(S),!1;for(const t of V)if(!t.f(e))return N(t.message??T),!1;return N(""),!0},m[20]=T,m[21]=S,m[22]=C,m[23]=V,m[24]=D):D=m[24];const G=D;let H,J,K;m[25]!==v||m[26]!==G||m[27]!==M?(H=()=>{v?v(G(M)):G(M)},J=[M,G,v],m[25]=v,m[26]=G,m[27]=M,m[28]=H,m[29]=J):(H=m[28],J=m[29]),l.useEffect(H,J),m[30]!==s||m[31]!==F?(K=F&&o(t,{component:"legend",children:F??s}),m[30]=s,m[31]=F,m[32]=K):K=m[32];const O=M??null;let P,Q;m[33]!==p?(P=e=>p(""===e.target.value?null:Number(e.target.value)),m[33]=p,m[34]=P):P=m[34],m[35]!==f?(Q=e=>{k(!0),f&&f(e)},m[35]=f,m[36]=Q):Q=m[36];const R=Y&&!!L,U=Y?L:"";let X,Z;return m[37]!==w||m[38]!==d||m[39]!==j||m[40]!==s||m[41]!==c||m[42]!==C||m[43]!==O||m[44]!==P||m[45]!==Q||m[46]!==R||m[47]!==U||m[48]!==W?(X=o(r,{variant:W,margin:j,fullWidth:w,id:s,label:d,name:s,required:C,...c,value:O,type:"number",onChange:P,onBlur:Q,error:R,helperText:U}),m[37]=w,m[38]=d,m[39]=j,m[40]=s,m[41]=c,m[42]=C,m[43]=O,m[44]=P,m[45]=Q,m[46]=R,m[47]=U,m[48]=W,m[49]=X):X=m[49],m[50]!==K||m[51]!==X?(Z=i(a,{children:[K,X]}),m[50]=K,m[51]=X,m[52]=Z):Z=m[52],Z};export{u as InputNumber};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FormNodeValidator } from './useFormState.js';
|
|
4
|
+
|
|
5
|
+
type StringValidator = FormNodeValidator<string>;
|
|
6
|
+
interface InputStringProps extends Omit<TextFieldProps, 'value' | 'onChange' | 'error' | 'helperText'> {
|
|
7
|
+
nameid?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
value: string | null;
|
|
10
|
+
setValue: (text: string) => void;
|
|
11
|
+
setValid?: (valid: boolean) => void;
|
|
12
|
+
emptyMessage?: string;
|
|
13
|
+
defaultErrorMessage?: string;
|
|
14
|
+
validators?: StringValidator[];
|
|
15
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
16
|
+
showError?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const InputString: React.FC<InputStringProps>;
|
|
19
|
+
|
|
20
|
+
export { InputString };
|
|
21
|
+
export type { InputStringProps, StringValidator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import t from"@mui/material/FormLabel";import r from"@mui/material/TextField";import o from"react";import{jsx as i,jsxs as l,Fragment as a}from"react/jsx-runtime";const n=[],u=u=>{const m=e(53);let d,s,f,c,v,p,g,h,x,E,b,q,y,B,F,M;m[0]!==u?(({nameid:s,title:F,value:M,setValue:p,setValid:v,emptyMessage:g,defaultErrorMessage:h,validators:x,variant:E,margin:b,fullWidth:q,label:d,required:y,onBlur:f,showError:B,...c}=u),m[0]=u,m[1]=d,m[2]=s,m[3]=f,m[4]=c,m[5]=v,m[6]=p,m[7]=g,m[8]=h,m[9]=x,m[10]=E,m[11]=b,m[12]=q,m[13]=y,m[14]=B,m[15]=F,m[16]=M):(d=m[1],s=m[2],f=m[3],c=m[4],v=m[5],p=m[6],g=m[7],h=m[8],x=m[9],E=m[10],b=m[11],q=m[12],y=m[13],B=m[14],F=m[15],M=m[16]);const S=void 0===g?"You cannot leave this field empty":g,T=void 0===h?"Invalid input":h,V=void 0===x?n:x,W=void 0===E?"outlined":E,j=void 0===b?"normal":b,w=void 0===q||q,C=void 0===y||y,I=void 0!==B&&B,[L,Y]=o.useState(C?S:""),[k,z]=o.useState(I);let A,D,G;m[17]!==I?(D=()=>{I&&z(!0)},A=[I],m[17]=I,m[18]=A,m[19]=D):(A=m[18],D=m[19]),o.useEffect(D,A),m[20]!==T||m[21]!==S||m[22]!==C||m[23]!==V?(G=e=>{if(C&&(""===e||null===e))return Y(S),!1;for(const t of V)if(!t.f(e))return Y(t.message??T),!1;return Y(""),!0},m[20]=T,m[21]=S,m[22]=C,m[23]=V,m[24]=G):G=m[24];const H=G;let J,K,N;m[25]!==v||m[26]!==H||m[27]!==M?(J=()=>{v?v(H(M)):H(M)},K=[M,H,v],m[25]=v,m[26]=H,m[27]=M,m[28]=J,m[29]=K):(J=m[28],K=m[29]),o.useEffect(J,K),m[30]!==s||m[31]!==F?(N=F&&i(t,{component:"legend",children:F??s}),m[30]=s,m[31]=F,m[32]=N):N=m[32];const O=M??null;let P,Q;m[33]!==p?(P=e=>p(e.target.value),m[33]=p,m[34]=P):P=m[34],m[35]!==f?(Q=e=>{z(!0),f&&f(e)},m[35]=f,m[36]=Q):Q=m[36];const R=k&&!!L,U=k?L:"";let X,Z;return m[37]!==w||m[38]!==d||m[39]!==j||m[40]!==s||m[41]!==c||m[42]!==C||m[43]!==O||m[44]!==P||m[45]!==Q||m[46]!==R||m[47]!==U||m[48]!==W?(X=i(r,{variant:W,margin:j,fullWidth:w,id:s,label:d,name:s,required:C,...c,value:O,onChange:P,onBlur:Q,error:R,helperText:U}),m[37]=w,m[38]=d,m[39]=j,m[40]=s,m[41]=c,m[42]=C,m[43]=O,m[44]=P,m[45]=Q,m[46]=R,m[47]=U,m[48]=W,m[49]=X):X=m[49],m[50]!==N||m[51]!==X?(Z=l(a,{children:[N,X]}),m[50]=N,m[51]=X,m[52]=Z):Z=m[52],Z};export{u as InputString};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface AvailableToolbarButtons {
|
|
4
|
+
heading?: boolean | 'full' | 'essential';
|
|
5
|
+
bold?: boolean;
|
|
6
|
+
italic?: boolean;
|
|
7
|
+
underline?: boolean;
|
|
8
|
+
strike?: boolean;
|
|
9
|
+
code?: boolean;
|
|
10
|
+
textAlign?: boolean;
|
|
11
|
+
color?: boolean;
|
|
12
|
+
nestBlock?: boolean;
|
|
13
|
+
link?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface CustomToolbarButton {
|
|
16
|
+
button: React.JSX.Element;
|
|
17
|
+
position?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type { AvailableToolbarButtons, CustomToolbarButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as t}from"react/compiler-runtime";import"@blocknote/core/fonts/inter.css";import"@blocknote/mantine/style.css";import{blockTypeSelectItems as e,BlockTypeSelect as n,BasicTextStyleButton as o,TextAlignButton as i,ColorStyleButton as l,NestBlockButton as r,UnnestBlockButton as c,FormattingToolbar as s}from"@blocknote/react";import"react";import{jsx as u}from"react/jsx-runtime";const a=a=>{const b=t(13),{editor:_,availableButtons:d,customButtons:g}=a,k=d?.heading??"full",m=d?.bold??!0,h=d?.italic??!0,f=d?.underline??!0,x=d?.strike??!0,p=d?.code??!1,y=d?.textAlign??!0,A=d?.color??!0,B=d?.nestBlock??!0,S=d?.link??!0;let T;if(b[0]!==g||b[1]!==_.dictionary||b[2]!==k||b[3]!==S||b[4]!==m||b[5]!==h||b[6]!==f||b[7]!==x||b[8]!==p||b[9]!==y||b[10]!==A||b[11]!==B){const t={heading:k,bold:m,italic:h,underline:f,strike:x,code:p,textAlign:y,color:A,nestBlock:B,link:S},a=e(_.dictionary),d=[u(n,{items:"full"===t.heading?a:a.slice(0,4)},"select_button"),u(o,{basicTextStyle:"bold"},"bold_button"),u(o,{basicTextStyle:"italic"},"italic_button"),u(o,{basicTextStyle:"underline"},"underline_button"),u(o,{basicTextStyle:"strike"},"strike_button"),u(o,{basicTextStyle:"code"},"code_button"),u(i,{textAlignment:"left"},"align_left_button"),u(i,{textAlignment:"center"},"align_center_butto"),u(i,{textAlignment:"right"},"align_right_button"),u(l,{},"color_button"),u(r,{},"nest_button"),u(c,{},"unnest_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;default:return!0}});let v;t:{if(!g||0===g.length){v=d;break t}const t=[...d];g.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)}),v=t}T=u(s,{children:v}),b[0]=g,b[1]=_.dictionary,b[2]=k,b[3]=S,b[4]=m,b[5]=h,b[6]=f,b[7]=x,b[8]=p,b[9]=y,b[10]=A,b[11]=B,b[12]=T}else T=b[12];return T};export{a as CustomFormattingToolbar};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PartialBlock } from '@blocknote/core';
|
|
3
|
+
import { ButtonProps } from '@mui/material/Button';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { AvailableToolbarButtons, CustomToolbarButton } from './FormattingToolbar.js';
|
|
6
|
+
|
|
7
|
+
interface RichTextEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'onBlur'> {
|
|
8
|
+
ref?: React.Ref<HTMLDivElement | null>;
|
|
9
|
+
id?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
mode?: 'html' | 'json' | 'markdown';
|
|
14
|
+
value?: string | PartialBlock[];
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
error?: boolean;
|
|
18
|
+
errorMessage?: string;
|
|
19
|
+
trailingBlock?: boolean;
|
|
20
|
+
onChange?: (text: string) => void;
|
|
21
|
+
onBlur?: (text: string) => void;
|
|
22
|
+
focus?: boolean;
|
|
23
|
+
toolbar?: 'default' | 'static';
|
|
24
|
+
menu?: boolean;
|
|
25
|
+
theme?: 'light' | 'dark';
|
|
26
|
+
backgroundPreset?: 'default' | 'paper';
|
|
27
|
+
menuPreset?: 'default' | 'paper';
|
|
28
|
+
submitButton?: ButtonProps & {
|
|
29
|
+
label?: string;
|
|
30
|
+
};
|
|
31
|
+
availableButtons?: AvailableToolbarButtons;
|
|
32
|
+
customButtons?: CustomToolbarButton[];
|
|
33
|
+
}
|
|
34
|
+
declare const RichTextEditor: (props: RichTextEditorProps) => react_jsx_runtime.JSX.Element;
|
|
35
|
+
|
|
36
|
+
export { RichTextEditor };
|
|
37
|
+
export type { RichTextEditorProps };
|
|
@@ -0,0 +1 @@
|
|
|
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 i from"@mui/material/Button";import l from"@mui/material/Collapse";import s from"@mui/material/GlobalStyles";import c from"@mui/material/Grid";import{useTheme as d}from"@mui/material/styles";import p from"@mui/material/Typography";import m from"react";import{useIsAiDirty as b,useIsAiEditing as u,useTypewriterSpeed as f}from"../AiEditingContext.js";import{aiLabelStyle as g}from"../AiUtils.js";import{CustomFormattingToolbar as h}from"./FormattingToolbar.js";import{jsxs as y,jsx as x}from"react/jsx-runtime";const k={};for(let e=0;e<50;e++)k[`.bn-ai-effect .bn-block-group .bn-block-outer:nth-of-type(${e+1})`]={animationDelay:`calc(${e} * var(--bn-ai-delay-step, 0.1s))`};const v=t,w=t=>{const w=e(97);let C,S,B,T,P,j,z,M,F,A,L,N,$,E,G,H,V,W,D,I,R,q,J;w[0]!==t?(({ref:F,id:B,name:P,label:T,placeholder:M,mode:N,value:J,readonly:$,disabled:E,error:G,errorMessage:S,trailingBlock:H,onChange:z,onBlur:j,focus:V,toolbar:W,menu:D,theme:q,submitButton:L,backgroundPreset:I,availableButtons:C,customButtons:R,...A}=t),w[0]=t,w[1]=C,w[2]=S,w[3]=B,w[4]=T,w[5]=P,w[6]=j,w[7]=z,w[8]=M,w[9]=F,w[10]=A,w[11]=L,w[12]=N,w[13]=$,w[14]=E,w[15]=G,w[16]=H,w[17]=V,w[18]=W,w[19]=D,w[20]=I,w[21]=R,w[22]=q,w[23]=J):(C=w[1],S=w[2],B=w[3],T=w[4],P=w[5],j=w[6],z=w[7],M=w[8],F=w[9],A=w[10],L=w[11],N=w[12],$=w[13],E=w[14],G=w[15],H=w[16],V=w[17],W=w[18],D=w[19],I=w[20],R=w[21],q=w[22],J=w[23]);const O=void 0===N?"html":N,U=void 0!==$&&$,K=void 0!==E&&E,Q=void 0!==G&&G,X=void 0!==H&&H,Y=void 0!==V&&V,Z=void 0===W?"static":W,_=void 0!==D&&D,ee=void 0===I?"paper":I;let te;w[24]!==R?(te=void 0===R?[]:R,w[24]=R,w[25]=te):te=w[25];const oe=te,re=b(P),ae=u(P),ne=f(),ie=A?.className,le=re?"bn-ai-dirty":"",se=ae?"bn-ai-effect":"";let ce;w[26]!==ie||w[27]!==le||w[28]!==se?(ce=[ie,le,se].filter(Boolean),w[26]=ie,w[27]=le,w[28]=se,w[29]=ce):ce=w[29];const de=ce.join(" ");let pe,me;w[30]!==M?(pe={...v,placeholders:{...v.placeholders,default:M}},w[30]=M,w[31]=pe):pe=w[31],w[32]!==pe||w[33]!==X?(me={trailingBlock:X,dictionary:pe},w[32]=pe,w[33]=X,w[34]=me):me=w[34];const be=n(me),[ue,fe]=m.useState(Y||!1),[ge,he]=m.useState(B?J:void 0),ye=d(),xe=q??ye.palette.mode,ke="default"===ee?ye.palette.background.default:ye.palette.background.paper,ve=Q?ye.palette.error.main:ue?"transparent":"silver";let we;w[35]!==ee||w[36]!==xe||w[37]!==K||w[38]!==ye?(we=((e="light",t,o,n=!1)=>{const i="default"===t?o.palette.background.default:o.palette.background.paper,l="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: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}}}})(xe,ee,ye,K),w[35]=ee,w[36]=xe,w[37]=K,w[38]=ye,w[39]=we):we=w[39];const Ce=we,Se="default"===Z?120:void 0,Be=re?"rgba(0,122,255,0.3)":ve,Te=ue?"0 0 0 2px "+ye.palette.primary.main:void 0,Pe=K?"none":"auto",je=K?"none":"auto",ze=K?"grayscale(100%)":"none";let Me;w[40]!==ke||w[41]!==Se||w[42]!==Be||w[43]!==Te||w[44]!==Pe||w[45]!==je||w[46]!==ze?(Me={backgroundColor:ke,paddingTop:10,width:"100%",minHeight:Se,borderWidth:1,borderStyle:"solid",borderColor:Be,borderRadius:8,boxShadow:Te,pointerEvents:Pe,userSelect:je,filter:ze},w[40]=ke,w[41]=Se,w[42]=Be,w[43]=Te,w[44]=Pe,w[45]=je,w[46]=ze,w[47]=Me):Me=w[47];const Fe=Me;let Ae;w[48]!==ne||w[49]!==ae||w[50]!==re?(Ae=((e,t={})=>{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:g.color}},r=e.duration||1.2,a={".bn-ai-effect":{borderColor:"rgba(0,122,255,0.5)",boxShadow:"0 0 12px rgba(0, 122, 255, 0.3)",animation:"glowPulse 1.2s ease-in-out infinite","--bn-ai-delay-step":`${Math.max(.03,Math.min(.15,r/12))}s`},".bn-ai-effect .bn-editor":{backgroundColor:"transparent",color:g.color},".bn-ai-effect .bn-block-group .bn-block-outer":{overflow:"hidden",clipPath:"inset(0 100% 0 0)",willChange:"clip-path",animation:`typing ${r}s ease-out forwards`}};return{".ProseMirror .bn-editor .bn-default-styles":{bakcgroundColor:"transparent"},".bn-editor":{backgroundColor:"transparent"},".bn-mantine .bn-select":{scrollbarColor:"silver transparent"},".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"},...e.dirty?o:{},...e.animate?{...a,"@keyframes glowPulse":{"0%":{boxShadow:"0 0 6px rgba(0,122,255,0.3)"},"50%":{boxShadow:"0 0 12px rgba(0,122,255,0.6)"},"100%":{boxShadow:"0 0 6px rgba(0,122,255,0.3)"}},"@keyframes typing":{from:{clipPath:"inset(0 100% 0 0)"},to:{clipPath:"inset(0 0 0 0)"}},"@media (prefers-reduced-motion: reduce)":{".bn-ai-effect":{animation:"none"},".bn-ai-effect .bn-block-group .bn-block-outer":{animation:"none",clipPath:"none"}},...k}:{},...t}})({animate:ae,dirty:re,duration:ne}),w[48]=ne,w[49]=ae,w[50]=re,w[51]=Ae):Ae=w[51];const Le=Ae,Ne="static"===Z&&ue&&!U&&!K;let $e;w[52]!==be||w[53]!==B||w[54]!==O||w[55]!==ge?($e=()=>{if(be){if("html"===O){const e=be.blocksToHTMLLossy(be.document);return B&&ge!==e&&he(e),e}if("json"===O)return JSON.stringify(be.document,null,2);if("markdown"===O){const e=be.blocksToMarkdownLossy(be.document);return B&&ge!==e&&he(e),e}}},w[52]=be,w[53]=B,w[54]=O,w[55]=ge,w[56]=$e):$e=w[56];const Ee=$e;let Ge;w[57]!==Ee||w[58]!==z?(Ge=()=>{const e=Ee();e&&z?.(e)},w[57]=Ee,w[58]=z,w[59]=Ge):Ge=w[59];const He=Ge;let Ve;w[60]!==Ee||w[61]!==ue||w[62]!==j?(Ve=e=>{e.stopPropagation();const t=document.querySelector(".bn-container, .bn-formatting-toolbar");if(t&&e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))return;ue&&fe(!1);const o=Ee();o&&j?.(o)},w[60]=Ee,w[61]=ue,w[62]=j,w[63]=Ve):Ve=w[63];const We=Ve,[De,Ie]=m.useState(!1);if(!De)e:switch(O){case"html":(()=>{if(be&&J&&"html"===O)if("string"==typeof J){try{const e=be.tryParseHTMLToBlocks(J);be.replaceBlocks(be.document,e)}catch(e){const t=e;console.error(t)}Ie(!0)}else console.log('Value must be a string when mode is "html"')})();break e;case"json":(()=>{if(be&&J&&"json"===O)if(Array.isArray(J)&&J.length>0){try{be.replaceBlocks(be.document,J)}catch(e){const t=e;console.error(t)}Ie(!0)}else console.error('Value must be an array of PartialBlock objects when mode is "json"')})();break e;case"markdown":(()=>{if(be&&J&&"markdown"===O)if("string"==typeof J){try{const e=be.tryParseMarkdownToBlocks(J);be.replaceBlocks(be.document,e)}catch(e){const t=e;console.error(t)}Ie(!0)}else console.log('Value must be a string when mode is "markdown"')})()}let Re,qe,Je,Oe,Ue;return w[64]!==Le?(Re=x(s,{styles:Le}),w[64]=Le,w[65]=Re):Re=w[65],w[66]!==re||w[67]!==T?(qe=T&&x(c,{size:12,children:x(p,{variant:"body1",color:re?g.color:"textSecondary",mb:1,children:T})}),w[66]=re,w[67]=T,w[68]=qe):qe=w[68],w[69]!==C||w[70]!==de||w[71]!==oe||w[72]!==K||w[73]!==be||w[74]!==Fe||w[75]!==Ce||w[76]!==We||w[77]!==He||w[78]!==B||w[79]!==Ne||w[80]!==_||w[81]!==M||w[82]!==U||w[83]!==F||w[84]!==A||w[85]!==L||w[86]!==Z||w[87]!==ge?(Je=be&&y(c,{ref:F,size:12,container:!0,component:"div",children:[x(o,{title:M,slashMenu:_,editor:be,editable:!U&&!K,theme:Ce,formattingToolbar:"static"!==Z,...A,className:de,onChange:He,onBlurCapture:We,onFocusCapture:()=>fe(!0),style:Fe,children:y(c,{container:!0,size:12,sx:{position:"relative",pointerEvents:K?"none":"auto",userSelect:K?"none":"auto"},children:[x(c,{flexGrow:1,children:x(l,{in:Ne,children:x(h,{editor:be,availableButtons:C,customButtons:oe})})}),L&&x(c,{container:!0,justifyContent:"flex-end",alignItems:"flex-end",m:"10px",mb:"12px",children:x(i,{type:L.type??"button",variant:L.variant??"contained",size:"small",color:L.color??"primary",onClick:L.onClick,children:L.label||"Custom Action"})})]})}),B&&x("input",{type:"hidden",name:B,value:ge??"",style:{display:"none"}})]}),w[69]=C,w[70]=de,w[71]=oe,w[72]=K,w[73]=be,w[74]=Fe,w[75]=Ce,w[76]=We,w[77]=He,w[78]=B,w[79]=Ne,w[80]=_,w[81]=M,w[82]=U,w[83]=F,w[84]=A,w[85]=L,w[86]=Z,w[87]=ge,w[88]=Je):Je=w[88],w[89]!==Q||w[90]!==S?(Oe=Q&&S&&x(c,{size:12,children:x(p,{variant:"caption",color:"error",style:{marginInline:"14px",marginTop:"3px",marginBottom:-1},children:S})}),w[89]=Q,w[90]=S,w[91]=Oe):Oe=w[91],w[92]!==Re||w[93]!==qe||w[94]!==Je||w[95]!==Oe?(Ue=y(c,{container:!0,size:12,children:[Re,qe,Je,Oe]}),w[92]=Re,w[93]=qe,w[94]=Je,w[95]=Oe,w[96]=Ue):Ue=w[96],Ue};export{w as RichTextEditor};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { FieldValues, Path, Control, FieldPathValue, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
import { RichTextEditorProps } from './RichTextEditor/RichTextEditor.js';
|
|
4
|
+
|
|
5
|
+
interface RichTextFieldProps<T extends FieldValues> extends Omit<RichTextEditorProps, 'name' | 'defaultValue'> {
|
|
6
|
+
name: Path<T>;
|
|
7
|
+
control: Control<T>;
|
|
8
|
+
defaultValue?: FieldPathValue<T, Path<T>>;
|
|
9
|
+
rules?: Omit<RegisterOptions<T, Path<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
10
|
+
shouldUnregister?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function RichTextField<T extends FieldValues>(props: RichTextFieldProps<T>): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { RichTextField };
|
|
15
|
+
export type { RichTextFieldProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import{Controller 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 i=e(17);let a,s,d,n,m,u,c,f;return i[0]!==l?(({name:d,control:a,defaultValue:s,rules:m,shouldUnregister:u,...n}=l),i[0]=l,i[1]=a,i[2]=s,i[3]=d,i[4]=n,i[5]=m,i[6]=u):(a=i[1],s=i[2],d=i[3],n=i[4],m=i[5],u=i[6]),i[7]!==n?(c=e=>{const{field:r,fieldState:l}=e,{error:i}=l;return t(o,{...n,...r,value:r.value,error:Boolean(i),errorMessage:i?.message})},i[7]=n,i[8]=c):c=i[8],i[9]!==a||i[10]!==s||i[11]!==d||i[12]!==n.disabled||i[13]!==m||i[14]!==u||i[15]!==c?(f=t(r,{name:d,control:a,defaultValue:s,disabled:n.disabled,rules:m,shouldUnregister:u,render:c}),i[9]=a,i[10]=s,i[11]=d,i[12]=n.disabled,i[13]=m,i[14]=u,i[15]=c,i[16]=f):f=i[16],f}export{l as RichTextField};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { SelectProps } from '@mui/material/Select';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { FieldValues, Path, Control, FieldPathValue, RegisterOptions } from 'react-hook-form';
|
|
5
|
+
|
|
6
|
+
interface SelectFieldProps<T extends FieldValues> extends Omit<SelectProps, 'name' | 'defaultValue' | 'variant' | 'error'> {
|
|
7
|
+
name: Path<T>;
|
|
8
|
+
control: Control<T>;
|
|
9
|
+
defaultValue?: FieldPathValue<T, Path<T>>;
|
|
10
|
+
rules?: Omit<RegisterOptions<T, Path<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
11
|
+
shouldUnregister?: boolean;
|
|
12
|
+
legend?: boolean;
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare function SelectField<T extends FieldValues>(props: SelectFieldProps<T>): react_jsx_runtime.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { SelectField };
|
|
18
|
+
export type { SelectFieldProps };
|
|
@@ -0,0 +1 @@
|
|
|
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 n,useIsAiDirty as d,useTypewriterSpeed as s}from"./AiEditingContext.js";import{aiSelectSxEffect as u,aiLabelStyle as c}from"./AiUtils.js";import{jsx as f,jsxs as p,Fragment as b}from"react/jsx-runtime";function h(h){const x=r(20),{name:v,control:g,defaultValue:A,rules:j,shouldUnregister:y,legend:z,children:I,...U}=h,C=void 0===z||z,F=n(v),L=d(v),S=s();let V;x[0]!==S||x[1]!==F||x[2]!==L?(V=u({animate:F,dirty:L,duration:S}),x[0]=S,x[1]=F,x[2]=L,x[3]=V):V=x[3];const W=[V,...Array.isArray(U.sx)?U.sx:U.sx?[U.sx]:[]];let $,k;return x[4]!==I||x[5]!==F||x[6]!==L||x[7]!==C||x[8]!==v||x[9]!==U||x[10]!==W?($=r=>{const{field:m,fieldState:n}=r,{error:d}=n;return p(b,{children:[C&&p(i,{sx:{color:L||F?c.color:void 0},children:[" ",U.label," "]}),p(e,{fullWidth:U.fullWidth??!0,size:U.size,sx:{position:"relative"},children:[!C&&p(o,{id:`${v}-label`,sx:{color:L||F?c.color:void 0},children:[" ",U.label," "]}),f(t,{labelId:`${v}-label`,variant:"outlined",...U,label:C?"":U.label,error:Boolean(d),...m,disabled:m.disabled,value:m.value??null,sx:W,children:I}),L&&!F&&f(l,{position:"end",sx:{position:"absolute",right:45,top:"50%",transform:"translateY(-50%)"},children:f(a,{size:20,color:"rgba(0,122,255,0.8)"})})]})]})},x[4]=I,x[5]=F,x[6]=L,x[7]=C,x[8]=v,x[9]=U,x[10]=W,x[11]=$):$=x[11],x[12]!==g||x[13]!==A||x[14]!==v||x[15]!==j||x[16]!==U.disabled||x[17]!==y||x[18]!==$?(k=f(m,{name:v,control:g,defaultValue:A,disabled:U.disabled,rules:j,shouldUnregister:y,render:$}),x[12]=g,x[13]=A,x[14]=v,x[15]=j,x[16]=U.disabled,x[17]=y,x[18]=$,x[19]=k):k=x[19],k}export{h as SelectField};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TimePickerProps } from '@mui/x-date-pickers';
|
|
3
|
+
import { FieldValues, Path, Control, FieldPathValue, RegisterOptions } from 'react-hook-form';
|
|
4
|
+
|
|
5
|
+
interface TimeFieldProps<T extends FieldValues> extends Omit<TimePickerProps, 'name' | 'defaultValue' | 'variant' | 'error'> {
|
|
6
|
+
name: Path<T>;
|
|
7
|
+
control: Control<T>;
|
|
8
|
+
defaultValue?: FieldPathValue<T, Path<T>>;
|
|
9
|
+
rules?: Omit<RegisterOptions<T, Path<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
10
|
+
shouldUnregister?: boolean;
|
|
11
|
+
legend?: boolean;
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
stringOnEmpty?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare function TimeField<T extends FieldValues>(props: TimeFieldProps<T>): react_jsx_runtime.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { TimeField };
|
|
18
|
+
export type { TimeFieldProps };
|
|
@@ -0,0 +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{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 h,jsxs as g}from"react/jsx-runtime";function y(y){const v=e(17),{name:A,control:P,defaultValue:F,rules:H,shouldUnregister:V,legend:k,fullWidth:z,stringOnEmpty:B,...j}=y,C=void 0===k||k,I=void 0===z||z,S=void 0!==B&&B,U=i(),D=S?"":null,E=c(A),O=p(A),W=f(),L=j.slotProps?.textField?.sx,M=[x({animate:E,dirty:O,duration:W}),...Array.isArray(L)?L:L?[L]:[]],T=E?"none":void 0;let q;v[0]!==T?(q={display:T},v[0]=T,v[1]=q):q=v[1];const w=[...Array.isArray(L)?L:L?[L]:[],q];let G;v[2]!==P||v[3]!==A?(G={control:P,name:A},v[2]=P,v[3]=A,v[4]=G):G=v[4];const J=d(G);let K;v[5]!==J?(K=()=>{if(J){const e=s(J,"HH:mm");return e.isValid()?e:null}return null},v[5]=J,v[6]=K):K=v[6];const[N,Q]=m.useState(K);if(J&&!N){const e=s(J,"HH:mm");e.isValid()&&Q(e)}let R;v[7]!==D?(R=(e,r,o)=>{if(!e||!e.isValid())return r(D),o(),void Q(null);r(s(e).format("HH:mm")),o(),Q(e)},v[7]=D,v[8]=R):R=v[8];const X=R,Y=e=>{const{field:i,fieldState:s}=e,{error:m}=s;return g(r,{fullWidth:I,sx:{margin:"auto",position:"relative"},children:[C&&h(o,{sx:{color:O?b.color:void 0},children:j.label}),h(l,{format:"HH:mm",ampm:!1,...j,...i,ref:i.ref,formatDensity:"dense",value:N,onChange:e=>{e&&e.isValid()?Q(e):Q(null)},enableAccessibleFieldDOMStructure:!1,onAccept:e=>X(e,i.onChange,i.onBlur),slots:{...j.slots,openPickerIcon:n},slotProps:{openPickerIcon:{color:U.palette.action.active,size:"small"===j.slotProps?.textField?.size?20:24},openPickerButton:{size:j.slotProps?.textField?.size,sx:w},...j.slotProps,textField:{label:C?"":j.label,error:Boolean(m),helperText:m?.message,onBlur:i.onBlur,...j.slotProps?.textField,sx:M}}}),O&&!E&&h(t,{position:"end",sx:{position:"absolute",right:48,top:C?"57%":"38%"},children:h(a,{size:20,color:"rgba(0,122,255,0.8)"})})]})};let Z;return v[9]!==P||v[10]!==j.disabled||v[11]!==F||v[12]!==A||v[13]!==H||v[14]!==V||v[15]!==Y?(Z=h(u,{name:A,control:P,defaultValue:F,disabled:j.disabled,rules:H,shouldUnregister:V,render:Y}),v[9]=P,v[10]=j.disabled,v[11]=F,v[12]=A,v[13]=H,v[14]=V,v[15]=Y,v[16]=Z):Z=v[16],Z}export{y as TimeField};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
type FormNodeType = string | number | boolean;
|
|
2
|
+
type FormNodeValidator<T extends FormNodeType> = {
|
|
3
|
+
id?: string;
|
|
4
|
+
f: (value?: T) => boolean;
|
|
5
|
+
message?: string;
|
|
6
|
+
};
|
|
7
|
+
interface FormNodeBase<T extends FormNodeType> {
|
|
8
|
+
validators?: FormNodeValidator<T>[];
|
|
9
|
+
type: 'node';
|
|
10
|
+
required?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface FormNodeString extends FormNodeBase<string> {
|
|
13
|
+
value: 'string';
|
|
14
|
+
}
|
|
15
|
+
interface FormNodeNumber extends FormNodeBase<number> {
|
|
16
|
+
value: 'number';
|
|
17
|
+
}
|
|
18
|
+
interface FormNodeBool extends FormNodeBase<boolean> {
|
|
19
|
+
value: 'bool';
|
|
20
|
+
}
|
|
21
|
+
type FormNode = FormNodeString | FormNodeNumber | FormNodeBool;
|
|
22
|
+
interface FormGroup {
|
|
23
|
+
type: 'group';
|
|
24
|
+
value: {
|
|
25
|
+
[id: string]: FormNode | FormGroup | FormArray;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface FormArrayBase<T extends FormNode | FormGroup> {
|
|
29
|
+
type: 'array';
|
|
30
|
+
value: T;
|
|
31
|
+
}
|
|
32
|
+
type FormArrayNode = FormArrayBase<FormNode>;
|
|
33
|
+
type FormArrayGroup = FormArrayBase<FormGroup>;
|
|
34
|
+
type FormArray = FormArrayNode | FormArrayGroup;
|
|
35
|
+
type Form = FormNode | FormArray | FormGroup;
|
|
36
|
+
type InferFormNodeValue<T extends FormNode> = T extends FormNodeString ? string : T extends FormNodeNumber ? number : T extends FormNodeBool ? boolean : never;
|
|
37
|
+
type InferFormNodePartialValue<T extends FormNode> = InferFormNodeValue<T> | undefined;
|
|
38
|
+
type InferFormGroupValue<T extends FormGroup> = {
|
|
39
|
+
[Prop in keyof T['value']]: InferFormValue<T['value'][Prop]>;
|
|
40
|
+
};
|
|
41
|
+
type InferFormGroupPartialValue<T extends FormGroup> = {
|
|
42
|
+
[Prop in keyof T['value']]+?: InferFormPartialValue<T['value'][Prop]>;
|
|
43
|
+
};
|
|
44
|
+
type InferFormArrayValue<T extends FormArray> = Array<InferFormValue<T['value']>>;
|
|
45
|
+
type InferFormArrayPartialValue<T extends FormArray> = Array<InferFormPartialValue<T['value']>>;
|
|
46
|
+
type InferFormValue<T extends Form> = T extends FormNode ? InferFormNodeValue<T> : T extends FormGroup ? InferFormGroupValue<T> : T extends FormArray ? InferFormArrayValue<T> : never;
|
|
47
|
+
type InferFormPartialValue<T extends Form> = T extends FormNode ? InferFormNodePartialValue<T> : T extends FormGroup ? InferFormGroupPartialValue<T> : T extends FormArray ? InferFormArrayPartialValue<T> : never;
|
|
48
|
+
type InferFormNodeValidator<T extends FormNode> = T extends FormNodeString ? FormNodeValidator<string>[] : T extends FormNodeNumber ? FormNodeValidator<number>[] : T extends FormNodeBool ? FormNodeValidator<boolean>[] : never;
|
|
49
|
+
type InferFormValidator<T extends Form> = T extends FormNode ? InferFormNodeValidator<T> : T extends FormGroup ? {
|
|
50
|
+
[Prop in keyof T['value']]: InferFormValidator<T['value'][Prop]>;
|
|
51
|
+
} : T extends FormArray ? InferFormValidator<T['value']> : never;
|
|
52
|
+
type InferFormRequired<T extends Form> = T extends FormNode ? boolean : T extends FormGroup ? {
|
|
53
|
+
[Prop in keyof T['value']]: InferFormRequired<T['value'][Prop]>;
|
|
54
|
+
} : T extends FormArray ? InferFormRequired<T['value']> : never;
|
|
55
|
+
type InferFormSetValue<T extends Form> = T extends FormNode ? (value: InferFormNodeValue<T>) => void : T extends FormGroup ? {
|
|
56
|
+
[Prop in keyof T['value']]: InferFormSetValue<T['value'][Prop]>;
|
|
57
|
+
} : T extends FormArray ? {
|
|
58
|
+
setAll: (value: InferFormArrayPartialValue<T>) => void;
|
|
59
|
+
set: (index: number) => InferFormSetValue<T['value']>;
|
|
60
|
+
add: (value?: InferFormPartialValue<T['value']>) => void;
|
|
61
|
+
remove: (index: number) => void;
|
|
62
|
+
} : never;
|
|
63
|
+
type InferFormIsValid<T extends Form> = T extends FormNode ? boolean : T extends FormGroup ? {
|
|
64
|
+
allValid: boolean;
|
|
65
|
+
children: {
|
|
66
|
+
[Prop in keyof T['value']]: InferFormIsValid<T['value'][Prop]>;
|
|
67
|
+
};
|
|
68
|
+
} : T extends FormArray ? {
|
|
69
|
+
allValid: boolean;
|
|
70
|
+
children: {
|
|
71
|
+
[index: number]: InferFormIsValid<T['value']>;
|
|
72
|
+
};
|
|
73
|
+
} : never;
|
|
74
|
+
/**
|
|
75
|
+
* Use this hook for complex form data management
|
|
76
|
+
*/
|
|
77
|
+
declare function useFormState<T extends Form>(form: T, initValue?: InferFormPartialValue<T>): {
|
|
78
|
+
Value: InferFormValue<T>;
|
|
79
|
+
Valid: InferFormIsValid<T>;
|
|
80
|
+
updatePartial: (changes: InferFormPartialValue<T>) => void;
|
|
81
|
+
setValue: InferFormSetValue<T>;
|
|
82
|
+
validators: InferFormValidator<T>;
|
|
83
|
+
requires: InferFormRequired<T>;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export { useFormState as default };
|
|
87
|
+
export type { Form, FormNodeType, FormNodeValidator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import e from"react";function t(r){return"node"===r.type}function n(r){return"array"===r.type}function o(r){return"group"===r.type}function u(r){if(t(r))return r.validators||[];if(n(r))return u(r.value);if(o(r))return Object.entries(r.value).reduce((r,[e,t])=>({...r,[e]:u(t)}),{});throw Error("Wrong form type")}function i(r){if(t(r))return!!r.required;if(n(r))return i(r.value);if(o(r))return Object.entries(r.value).reduce((r,[e,t])=>({...r,[e]:i(t)}),{});throw Error("Wrong form type")}function l(r,e){if(t(r))return r=>e(()=>r);if(n(r))return{setAll:r=>e(()=>r),set:t=>l(r.value,r=>e(e=>{const n=e;return[...n.slice(0,t),r(n[t]),...n.slice(t+1)]})),add:t=>e(e=>[...e,f(c(r.value),t)]),remove:r=>e(e=>{const t=e;return[...t.slice(0,r),...t.slice(r+1)]})};if(o(r))return Object.entries(r.value).reduce((r,[t,n])=>({...r,[t]:l(n,r=>e(e=>{const n=e;return{...n,[t]:r(n[t])}}))}),{});throw Error("Wrong form type")}function a(r,e,u,i){if(t(r)&&Array.isArray(i))return(!u||null!=e&&""!==e)&&i.map(r=>r.f(e)).every(r=>r);if(n(r)&&Array.isArray(e)){const n=e.map(e=>a(r.value,e,u,i));return{allValid:t(r.value)?n.every(r=>r):o(r.value)?n.every(r=>r.allValid):null,children:n}}if(o(r)){const t=e,n=u,o=i,l=Object.entries(r.value).reduce((r,[e,u])=>({...r,[e]:a(u,t[e],n[e],o[e])}),{});return{allValid:Object.entries(l).every(([,r])=>"boolean"==typeof r?r:r.allValid),children:l}}throw Error("Wrong form or value type")}function c(r){if(t(r))return function(r){r.value}(r),null;if(n(r))return[];if(o(r))return Object.entries(r.value).reduce((r,[e,t])=>({...r,[e]:c(t)}),{});throw Error("Wrong form type")}function f(r,e){if(void 0===e)return r;if(null===e)return null;if(Array.isArray(e))return e;if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if("object"==typeof e&&"object"==typeof r)return Object.entries(e).reduce((r,[e,t])=>{const n=r;return{...n,[e]:f(n[e],t)}},r);throw Error("Wrong changes")}function s(t,n){const o=r(21);let s;o[0]!==t?(s=u(t),o[0]=t,o[1]=s):s=o[1];const y=s;let d;o[2]!==t?(d=i(t),o[2]=t,o[3]=d):d=o[3];const p=d;let v;o[4]!==t||o[5]!==n?(v=f(c(t),n),o[4]=t,o[5]=n,o[6]=v):v=o[6];const[m,b]=e.useState(v);let h;o[7]===Symbol.for("react.memo_cache_sentinel")?(h=r=>b(e=>f(e,r)),o[7]=h):h=o[7];const g=h;let j;o[8]!==t?(j=l(t,b),o[8]=t,o[9]=j):j=o[9];const A=j;let O;o[10]!==m||o[11]!==t||o[12]!==p||o[13]!==y?(O=a(t,m,p,y),o[10]=m,o[11]=t,o[12]=p,o[13]=y,o[14]=O):O=o[14];const V=O;let w;return o[15]!==V||o[16]!==m||o[17]!==p||o[18]!==A||o[19]!==y?(w={Value:m,Valid:V,updatePartial:g,setValue:A,validators:y,requires:p},o[15]=V,o[16]=m,o[17]=p,o[18]=A,o[19]=y,o[20]=w):w=o[20],w}export{s as default};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ListProps } from '@mui/material/List';
|
|
2
|
+
import { SidebarItem } from './SidebarLayout.js';
|
|
3
|
+
|
|
4
|
+
interface FooterData {
|
|
5
|
+
itemsList: SidebarItem[];
|
|
6
|
+
avatar: {
|
|
7
|
+
username: string;
|
|
8
|
+
imageSrc: string;
|
|
9
|
+
};
|
|
10
|
+
listProps?: ListProps;
|
|
11
|
+
}
|
|
12
|
+
interface SidebarFooterProps {
|
|
13
|
+
footerData: FooterData;
|
|
14
|
+
sidebarOpen: boolean;
|
|
15
|
+
setSidebarOpen: (open: boolean) => void;
|
|
16
|
+
onSelectItem: (itemID: string, title: string, link: string) => void;
|
|
17
|
+
onHoverItem?: (itemID: string, title: string, link: string) => Promise<void> | void;
|
|
18
|
+
mobile?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type { FooterData, SidebarFooterProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"react/compiler-runtime";import{useTheme as r}from"@mui/material/styles";import o from"@mui/material/Avatar";import t from"@mui/material/Box";import i from"@mui/material/Grid";import m from"@mui/material/IconButton";import a from"@mui/material/List";import n from"@mui/material/ListItem";import l from"@mui/material/ListItemAvatar";import c from"@mui/material/ListItemButton";import s from"@mui/material/ListItemText";import p from"@mui/material/Popover";import d from"@mui/material/Typography";import{ChevronLeftIcon as u,ChevronRightIcon as f}from"lucide-react";import h from"react";import{MenuItems as b}from"../common/MenuItems.js";import{jsx as g,jsxs as v,Fragment as x}from"react/jsx-runtime";function y(y){const I=e(35),{footerData:S,sidebarOpen:_,setSidebarOpen:w,onSelectItem:L,onHoverItem:z,mobile:O}=y,{itemsList:k,avatar:B,listProps:C}=S;let P;I[0]!==C?(P=void 0===C?{}:C,I[0]=C,I[1]=P):P=I[1];const R=P,T=void 0!==O&&O,A=r(),[j,H]=h.useState(null);let D;I[2]===Symbol.for("react.memo_cache_sentinel")?(D=e=>{H(e.currentTarget)},I[2]=D):D=I[2];const E=D;let G;I[3]===Symbol.for("react.memo_cache_sentinel")?(G=()=>{H(null)},I[3]=G):G=I[3];const M=G,U=Boolean(j),q=U?"popover":void 0,F=k.length>0?c:"div";let J,K,N;I[4]===Symbol.for("react.memo_cache_sentinel")?(J=e=>E(e),I[4]=J):J=I[4],I[5]!==T||I[6]!==w||I[7]!==_||I[8]!==A?(K=T?void 0:g(m,{edge:"end",color:"inherit",disableRipple:!0,onClick:e=>{e.stopPropagation(),w(!_)},sx:{position:"absolute",backgroundColor:A.palette.background.paper,border:"1px solid rgba(0, 0, 0, 0.12)",borderRadius:"8px",padding:0,right:_?"5px":"-15px",bottom:"-10px"},children:g(_?u:f,{size:"1rem"})}),I[5]=T,I[6]=w,I[7]=_,I[8]=A,I[9]=K):K=I[9],I[10]===Symbol.for("react.memo_cache_sentinel")?(N={paddingInline:"12px",paddingRight:"32px"},I[10]=N):N=I[10];const Q=B.username||"",V=B.imageSrc||"";let W,X;I[11]!==Q||I[12]!==V?(W=g(l,{children:g(o,{alt:Q,src:V})}),I[11]=Q,I[12]=V,I[13]=W):W=I[13],I[14]===Symbol.for("react.memo_cache_sentinel")?(X={textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},I[14]=X):X=I[14];const Y=B.username||"User";let Z,$,ee,re;return I[15]!==Y?(Z=g(s,{primary:g(d,{sx:X,children:Y})}),I[15]=Y,I[16]=Z):Z=I[16],I[17]!==q||I[18]!==W||I[19]!==Z||I[20]!==F||I[21]!==K?($=g(a,{children:v(n,{component:F,"aria-describedby":q,onClick:J,disableRipple:!0,secondaryAction:K,sx:N,children:[W,Z]})}),I[17]=q,I[18]=W,I[19]=Z,I[20]=F,I[21]=K,I[22]=$):$=I[22],I[23]!==j||I[24]!==q||I[25]!==U||I[26]!==k||I[27]!==R||I[28]!==T||I[29]!==z||I[30]!==L?(ee=k.length>0&&g(p,{id:q,open:U,anchorEl:j,onClose:M,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"left"},elevation:6,children:g(t,{sx:{width:T?"100dvw":260},children:g(i,{container:!0,size:12,children:g(i,{size:12,children:g(b,{displayItems:k,listType:"footer",onSelectItem:(...e)=>{L(...e),M()},onHoverItem:z,listProps:{...R,sx:{margin:"auto 0",...R.sx||{}}},mobile:T})})})})}),I[23]=j,I[24]=q,I[25]=U,I[26]=k,I[27]=R,I[28]=T,I[29]=z,I[30]=L,I[31]=ee):ee=I[31],I[32]!==$||I[33]!==ee?(re=v(x,{children:[$,ee]}),I[32]=$,I[33]=ee,I[34]=re):re=I[34],re}export{y as SidebarFooter};
|