@alextheman/components 6.15.2 → 6.15.3
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/v7/index.cjs +1 -1
- package/dist/v7/index.d.cts +1 -1
- package/dist/v7/index.d.ts +1 -1
- package/dist/v7/index.js +1 -1
- package/package.json +1 -1
package/dist/v7/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@alextheman/utility`),l=require(`@mui/material/AppBar`);l=s(l,1);let u=require(`@mui/material/Box`);u=s(u,1);let d=require(`@mui/material/CssBaseline`);d=s(d,1);let f=require(`@mui/material/Divider`);f=s(f,1);let p=require(`@mui/material/Drawer`);p=s(p,1);let m=require(`@mui/material/IconButton`);m=s(m,1);let h=require(`@mui/material/List`);h=s(h,1);let g=require(`@mui/material/ListItem`);g=s(g,1);let _=require(`@mui/material/ListItemButton`);_=s(_,1);let v=require(`@mui/material/ListItemIcon`);v=s(v,1);let y=require(`@mui/material/ListItemText`);y=s(y,1);let b=require(`@mui/material/styles`),x=require(`@mui/material/Toolbar`);x=s(x,1);let S=require(`@mui/material/Typography`);S=s(S,1);let C=require(`react`),w=require(`react-icons/md`),T=require(`wouter`),E=require(`@mui/material/Alert`);E=s(E,1);let D=require(`@mui/material/AlertTitle`);D=s(D,1);let O=require(`@mui/material/Container`);O=s(O,1);let k=require(`react/jsx-runtime`),A=require(`@mui/material/Link`);A=s(A,1);let ee=require(`wouter/memory-location`),te=require(`wouter/use-browser-location`),j=require(`@mui/material/Button`);j=s(j,1);let M=require(`@tanstack/react-form`),N=require(`@mui/material/TextField`);N=s(N,1);let P=require(`@mui/material/Menu`);P=s(P,1);let ne=require(`@alextheman/utility/v6`),F=require(`@mui/material/MenuItem`);F=s(F,1);function I({title:e,children:t}){return(0,k.jsx)(O.default,{maxWidth:`sm`,children:(0,k.jsxs)(E.default,{severity:`error`,children:[(0,k.jsx)(D.default,{children:e}),t]})})}function L({to:e,component:t=T.Link,children:n,ref:r,...i}){return(0,k.jsx)(A.default,{component:t,to:e,ref:r,...i,children:n})}function re({children:e,...t}){let{hook:n}=(0,ee.memoryLocation)({path:`/`});return(0,k.jsx)(z,{...t,hook:n,children:e})}function R(e,t){return e.replace(RegExp(`^${(0,c.escapeRegexPattern)(t.base)}`),``)}function ie(e=te.useBrowserLocation){return t=>{let[n,r]=e(t);return[n,(...[e,...n])=>r(R(e,t),...n)]}}function z({children:e,hook:t,...n}){return(0,k.jsx)(T.Router,{...n,hook:ie(t),hrefs:(e,t)=>R(e,t),children:e})}function ae({children:e,fallback:t=(0,k.jsxs)(I,{title:`Page Not Found`,children:[`This page is not available. Please click `,(0,k.jsx)(L,{to:`/`,children:`here`}),` to return to the homepage.`]}),...n}){return(0,k.jsxs)(T.Switch,{...n,children:[e,(0,k.jsx)(T.Route,{children:t})]})}function B(e){return{width:240,transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:`hidden`}}function V(e){return{transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:`hidden`,width:`calc(${e.spacing(7)} + 1px)`,[e.breakpoints.up(`sm`)]:{width:`calc(${e.spacing(8)} + 1px)`}}}const H=(0,b.styled)(`div`)(({theme:e})=>({display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:e.spacing(0,1),...e.mixins.toolbar})),oe=(0,b.styled)(l.default,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),variants:[{props:({open:e})=>e,style:{marginLeft:240,width:`calc(100% - 240px)`,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),se=(0,b.styled)(p.default,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({width:240,flexShrink:0,whiteSpace:`nowrap`,boxSizing:`border-box`,variants:[{props:({open:e})=>e,style:{...B(e),"& .MuiDrawer-paper":B(e)}},{props:({open:e})=>!e,style:{...V(e),"& .MuiDrawer-paper":V(e)}}]}));function ce({title:e,navItems:t,children:n,headerElements:r}){let i=(0,b.useTheme)(),[a,o]=(0,C.useState)(!0),[s]=(0,T.useLocation)();function l(){o(!0)}function p(){o(!1)}return(0,k.jsxs)(u.default,{sx:{display:`flex`},children:[(0,k.jsx)(d.default,{}),(0,k.jsx)(oe,{position:`fixed`,open:a,children:(0,k.jsxs)(x.default,{children:[(0,k.jsx)(m.default,{color:`inherit`,"aria-label":`open drawer`,onClick:l,edge:`start`,sx:[{marginRight:5},a&&{display:`none`}],children:(0,k.jsx)(w.MdMenu,{})}),(0,k.jsx)(S.default,{variant:`h6`,noWrap:!0,component:`div`,children:e}),r]})}),(0,k.jsxs)(se,{variant:`permanent`,open:a,children:[(0,k.jsx)(H,{children:(0,k.jsx)(m.default,{onClick:p,children:i.direction===`rtl`?(0,k.jsx)(w.MdChevronRight,{}):(0,k.jsx)(w.MdChevronLeft,{})})}),(0,k.jsx)(f.default,{}),t.map(e=>(0,k.jsxs)(C.Fragment,{children:[(0,k.jsxs)(h.default,{children:[(0,k.jsx)(S.default,{variant:a?`h5`:`h6`,sx:{paddingLeft:a?2:1},children:a?e.category:(0,c.truncate)(e.category,4)}),e.options.map(e=>(0,k.jsx)(g.default,{disablePadding:!0,sx:{display:`block`},children:(0,k.jsxs)(_.default,{sx:[{minHeight:48,px:2.5},a?{justifyContent:`initial`}:{justifyContent:`center`}],component:L,to:e.to,selected:s===e.to,children:[(0,k.jsx)(v.default,{sx:[{minWidth:0,justifyContent:`center`},a?{mr:3}:{mr:`auto`}],children:e.icon?e.icon:a?null:(0,k.jsx)(S.default,{children:(0,c.truncate)(e.label,4)})}),(0,k.jsx)(y.default,{primary:e.label,sx:[a?{opacity:1}:{opacity:0}]})]})},e.to))]}),(0,k.jsx)(f.default,{})]},e.category))]}),(0,k.jsxs)(u.default,{component:`main`,sx:{flexGrow:1,p:3},children:[(0,k.jsx)(H,{}),n]})]})}const{fieldContext:U,formContext:W,useFieldContext:G,useFormContext:K}=(0,M.createFormHookContexts)();function le(e){return(0,M.createFormHook)({fieldContext:U,formContext:W,fieldComponents:{TextField:J,...e?.fieldComponents},formComponents:{SubmitButton:q,...e?.formComponents},...(0,c.omitProperties)(e??{},[`formComponents`,`fieldComponents`])})}function q({disableClean:e,label:t=`Submit`,...n}){let r=K();return(0,k.jsx)(j.default,{color:`primary`,disabled:n.disabled||e&&!r.state.isDirty,loading:r.state.isSubmitting,type:`submit`,variant:`contained`,...n,children:t})}function J(e){let t=G();return(0,k.jsx)(N.default,{...e,error:t.state.meta.errors.length!==0,type:`text`,value:t.state.value,onChange:e=>t.handleChange(e.target.value),onBlur:t.handleBlur,placeholder:t.name,helperText:t.state.meta.errors[0]??``})}const Y=(0,C.createContext)(void 0);function X({strict:e=!0}={}){let t=(0,C.useContext)(Y);if(e&&!t)throw new ne.DataError({strict:e,context:t},`DROPDOWN_MENU_NOT_FOUND`,`Could not find the DropdownMenu context. Please double-check that it is present.`);return t}function Z({strict:e=!0}={}){return X({strict:e})}function Q({children:e}){let[t,n]=(0,C.useState)(null),r=(0,C.useMemo)(()=>!!t,[t]);function i(){n(null)}return(0,k.jsx)(Y.Provider,{value:{closeMenu:i,isDropdownOpen:r,anchorElement:t,setAnchorElement:n},children:e})}function $({children:e,onClose:t,...n}){let{anchorElement:r,isDropdownOpen:i,closeMenu:a}=Z();return(0,k.jsx)(P.default,{anchorEl:r,open:i,onClose:(e,n)=>{e.defaultPrevented||a(),t&&t(e,n)},...n,children:e})}function ue({component:e,children:t,ref:n,onClick:r,...i}){let{closeMenu:a}=X();return(0,k.jsx)(F.default,{component:e,ref:n,...i,onClick:e=>{r&&r(e),!e.defaultPrevented&&a()},children:t})}function de({component:e,onClick:t,openIcon:n=w.MdArrowDropUp,closedIcon:r=w.MdArrowDropDown,variant:i=`contained`,...a}){let{isDropdownOpen:o,setAnchorElement:s}=Z();return(0,k.jsx)(j.default,{...e?{component:e}:{},"aria-controls":o?`dropdown-menu`:void 0,"aria-haspopup":`true`,"aria-expanded":o,endIcon:o?(0,k.jsx)(n,{}):(0,k.jsx)(r,{}),variant:i,...a,onClick:e=>{t&&t(e),!e.defaultPrevented&&s(e.currentTarget)}})}function fe({children:e,trigger:t,triggerProps:n}){return(0,k.jsxs)(Q,{children:[(0,k.jsx)(de,{component:t,...n,children:n?.children??`Menu`}),(0,k.jsx)($,{children:e})]})}exports.DropdownMenu=$,exports.DropdownMenuItem=ue,exports.DropdownMenuProvider=Q,exports.DropdownMenuTrigger=de,exports.DropdownMenuWrapper=fe,exports.ErrorPage=I,exports.InternalLink=L,exports.MemoryRouter=re,exports.NavigationDrawer=ce,exports.Router=z,exports.SubmitButton=q,exports.Switch=ae,exports.TextField=J,exports.fieldContext=U,exports.formContext=W,exports.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@alextheman/utility`),l=require(`@mui/material/AppBar`);l=s(l,1);let u=require(`@mui/material/Box`);u=s(u,1);let d=require(`@mui/material/CssBaseline`);d=s(d,1);let f=require(`@mui/material/Divider`);f=s(f,1);let p=require(`@mui/material/Drawer`);p=s(p,1);let m=require(`@mui/material/IconButton`);m=s(m,1);let h=require(`@mui/material/List`);h=s(h,1);let g=require(`@mui/material/ListItem`);g=s(g,1);let _=require(`@mui/material/ListItemButton`);_=s(_,1);let v=require(`@mui/material/ListItemIcon`);v=s(v,1);let y=require(`@mui/material/ListItemText`);y=s(y,1);let b=require(`@mui/material/styles`),x=require(`@mui/material/Toolbar`);x=s(x,1);let S=require(`@mui/material/Typography`);S=s(S,1);let C=require(`react`),w=require(`react-icons/md`),T=require(`wouter`),E=require(`@mui/material/Alert`);E=s(E,1);let D=require(`@mui/material/AlertTitle`);D=s(D,1);let O=require(`@mui/material/Container`);O=s(O,1);let k=require(`react/jsx-runtime`),A=require(`@mui/material/Link`);A=s(A,1);let ee=require(`wouter/memory-location`),te=require(`wouter/use-browser-location`),j=require(`@mui/material/Button`);j=s(j,1);let M=require(`@tanstack/react-form`),N=require(`@mui/material/TextField`);N=s(N,1);let P=require(`@mui/material/Menu`);P=s(P,1);let ne=require(`@alextheman/utility/v6`),F=require(`@mui/material/MenuItem`);F=s(F,1);function I({title:e,children:t}){return(0,k.jsx)(O.default,{maxWidth:`sm`,children:(0,k.jsxs)(E.default,{severity:`error`,children:[(0,k.jsx)(D.default,{children:e}),t]})})}function L({to:e,component:t=T.Link,children:n,ref:r,...i}){return(0,k.jsx)(A.default,{component:t,to:e,ref:r,...i,children:n})}function re({children:e,...t}){let{hook:n}=(0,ee.memoryLocation)({path:`/`});return(0,k.jsx)(z,{...t,hook:n,children:e})}function R(e,t){return e.replace(RegExp(`^${(0,c.escapeRegexPattern)(t.base)}`),``)}function ie(e=te.useBrowserLocation){return t=>{let[n,r]=e(t);return[n,(...[e,...n])=>r(R(e,t),...n)]}}function z({children:e,hook:t,...n}){return(0,k.jsx)(T.Router,{...n,hook:ie(t),hrefs:(e,t)=>R(e,t),children:e})}function ae({children:e,fallback:t=(0,k.jsxs)(I,{title:`Page Not Found`,children:[`This page is not available. Please click `,(0,k.jsx)(L,{to:`/`,children:`here`}),` to return to the homepage.`]}),...n}){return(0,k.jsxs)(T.Switch,{...n,children:[e,(0,k.jsx)(T.Route,{children:t})]})}function B(e){return{width:240,transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:`hidden`}}function V(e){return{transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:`hidden`,width:`calc(${e.spacing(7)} + 1px)`,[e.breakpoints.up(`sm`)]:{width:`calc(${e.spacing(8)} + 1px)`}}}const H=(0,b.styled)(`div`)(({theme:e})=>({display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:e.spacing(0,1),...e.mixins.toolbar})),oe=(0,b.styled)(l.default,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),variants:[{props:({open:e})=>e,style:{marginLeft:240,width:`calc(100% - 240px)`,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),se=(0,b.styled)(p.default,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({width:240,flexShrink:0,whiteSpace:`nowrap`,boxSizing:`border-box`,variants:[{props:({open:e})=>e,style:{...B(e),"& .MuiDrawer-paper":B(e)}},{props:({open:e})=>!e,style:{...V(e),"& .MuiDrawer-paper":V(e)}}]}));function ce({title:e,navItems:t,children:n,headerElements:r}){let i=(0,b.useTheme)(),[a,o]=(0,C.useState)(!0),[s]=(0,T.useLocation)();function l(){o(!0)}function p(){o(!1)}return(0,k.jsxs)(u.default,{sx:{display:`flex`},children:[(0,k.jsx)(d.default,{}),(0,k.jsx)(oe,{position:`fixed`,open:a,children:(0,k.jsxs)(x.default,{children:[(0,k.jsx)(m.default,{color:`inherit`,"aria-label":`open drawer`,onClick:l,edge:`start`,sx:[{marginRight:5},a&&{display:`none`}],children:(0,k.jsx)(w.MdMenu,{})}),(0,k.jsx)(S.default,{variant:`h6`,noWrap:!0,component:`div`,children:e}),r]})}),(0,k.jsxs)(se,{variant:`permanent`,open:a,children:[(0,k.jsx)(H,{children:(0,k.jsx)(m.default,{onClick:p,children:i.direction===`rtl`?(0,k.jsx)(w.MdChevronRight,{}):(0,k.jsx)(w.MdChevronLeft,{})})}),(0,k.jsx)(f.default,{}),t.map(e=>(0,k.jsxs)(C.Fragment,{children:[(0,k.jsxs)(h.default,{children:[(0,k.jsx)(S.default,{variant:a?`h5`:`h6`,sx:{paddingLeft:a?2:1},children:a?e.category:(0,c.truncate)(e.category,4)}),e.options.map(e=>(0,k.jsx)(g.default,{disablePadding:!0,sx:{display:`block`},children:(0,k.jsxs)(_.default,{sx:[{minHeight:48,px:2.5},a?{justifyContent:`initial`}:{justifyContent:`center`}],component:L,to:e.to,selected:s===e.to,children:[(0,k.jsx)(v.default,{sx:[{minWidth:0,justifyContent:`center`},a?{mr:3}:{mr:`auto`}],children:e.icon?e.icon:a?null:(0,k.jsx)(S.default,{children:(0,c.truncate)(e.label,4)})}),(0,k.jsx)(y.default,{primary:e.label,sx:[a?{opacity:1}:{opacity:0}]})]})},e.to))]}),(0,k.jsx)(f.default,{})]},e.category))]}),(0,k.jsxs)(u.default,{component:`main`,sx:{flexGrow:1,p:3},children:[(0,k.jsx)(H,{}),n]})]})}const{fieldContext:U,formContext:W,useFieldContext:G,useFormContext:K}=(0,M.createFormHookContexts)();function le(e){return(0,M.createFormHook)({fieldContext:U,formContext:W,fieldComponents:{TextField:J,...e?.fieldComponents},formComponents:{SubmitButton:q,...e?.formComponents},...(0,c.omitProperties)(e??{},[`formComponents`,`fieldComponents`])})}function q({disableClean:e,label:t=`Submit`,...n}){let r=K();return(0,k.jsx)(j.default,{color:`primary`,disabled:n.disabled||e&&!r.state.isDirty,loading:r.state.isSubmitting,type:`submit`,variant:`contained`,...n,children:t})}function J(e){let t=G();return(0,k.jsx)(N.default,{...e,error:t.state.meta.errors.length!==0,type:`text`,value:t.state.value,onChange:e=>t.handleChange(e.target.value),onBlur:t.handleBlur,placeholder:t.name,helperText:t.state.meta.errors[0]??``})}const Y=(0,C.createContext)(void 0);function X({strict:e=!0}={}){let t=(0,C.useContext)(Y);if(e&&!t)throw new ne.DataError({strict:e,context:t},`DROPDOWN_MENU_NOT_FOUND`,`Could not find the DropdownMenu context. Please double-check that it is present.`);return t}function Z({strict:e=!0}={}){return X({strict:e})}function Q({children:e}){let[t,n]=(0,C.useState)(null),r=(0,C.useMemo)(()=>!!t,[t]);function i(){n(null)}return(0,k.jsx)(Y.Provider,{value:{closeMenu:i,isDropdownOpen:r,anchorElement:t,setAnchorElement:n},children:e})}function $({children:e,onClose:t,...n}){let{anchorElement:r,isDropdownOpen:i,closeMenu:a}=Z();return(0,k.jsx)(P.default,{anchorEl:r,open:i,onClose:(e,n)=>{e.defaultPrevented||a(),t&&t(e,n)},...n,children:e})}function ue({component:e,children:t,ref:n,onClick:r,...i}){let{closeMenu:a}=X();return(0,k.jsx)(F.default,{component:e,ref:n,...i,onClick:e=>{r&&r(e),!e.defaultPrevented&&a()},children:t})}function de({component:e,onClick:t,openIcon:n=w.MdArrowDropUp,closedIcon:r=w.MdArrowDropDown,variant:i=`contained`,...a}){let{isDropdownOpen:o,setAnchorElement:s}=Z();return(0,k.jsx)(j.default,{...e?{component:e}:{},"aria-controls":o?`dropdown-menu`:void 0,"aria-haspopup":`true`,"aria-expanded":o,endIcon:o?(0,k.jsx)(n,{}):(0,k.jsx)(r,{}),variant:i,...a,onClick:e=>{t&&t(e),!e.defaultPrevented&&s(e.currentTarget)}})}function fe({children:e,trigger:t,triggerProps:n}){return(0,k.jsxs)(Q,{children:[(0,k.jsx)(de,{component:t,...n,children:n?.children??`Menu`}),(0,k.jsx)($,{children:e})]})}exports.DropdownMenu=$,exports.DropdownMenuItem=ue,exports.DropdownMenuProvider=Q,exports.DropdownMenuTrigger=de,exports.DropdownMenuWrapper=fe,exports.ErrorPage=I,exports.InternalLink=L,exports.MemoryRouter=re,exports.NavigationDrawer=ce,exports.Router=z,exports.SubmitButton=q,exports.Switch=ae,exports.TextField=J,exports.createFormHook=le,exports.fieldContext=U,exports.formContext=W,exports.useDropdownMenu=X,exports.useFieldContext=G,exports.useFormContext=K;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/v7/index.d.cts
CHANGED
|
@@ -958,5 +958,5 @@ declare function createFormHook(options?: Partial<Parameters<typeof createFormHo
|
|
|
958
958
|
//#region src/v7/hooks/formHooks.d.ts
|
|
959
959
|
declare const fieldContext: _$react.Context<_$_tanstack_react_form0.AnyFieldApi>, formContext: _$react.Context<_$_tanstack_react_form0.AnyFormApi>, useFieldContext: <TData>() => _$_tanstack_react_form0.FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>, useFormContext: () => _$_tanstack_react_form0.ReactFormExtendedApi<Record<string, never>, any, any, any, any, any, any, any, any, any, any, any>;
|
|
960
960
|
//#endregion
|
|
961
|
-
export { DropdownMenu, type DropdownMenuContextValue, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, DropdownMenuProvider, type DropdownMenuProviderProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, DropdownMenuWrapper, type DropdownMenuWrapperProps, ErrorPage, type ErrorPageProps, InternalLink, type InternalLinkProps, MemoryRouter, type NavMenuItem, NavigationDrawer, type NavigationDrawerProps, Router, SubmitButton, type SubmitButtonProps, Switch, type SwitchProps, TextField, fieldContext, formContext,
|
|
961
|
+
export { DropdownMenu, type DropdownMenuContextValue, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, DropdownMenuProvider, type DropdownMenuProviderProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, DropdownMenuWrapper, type DropdownMenuWrapperProps, ErrorPage, type ErrorPageProps, InternalLink, type InternalLinkProps, MemoryRouter, type NavMenuItem, NavigationDrawer, type NavigationDrawerProps, Router, SubmitButton, type SubmitButtonProps, Switch, type SwitchProps, TextField, createFormHook, fieldContext, formContext, useDropdownMenu, useFieldContext, useFormContext };
|
|
962
962
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/v7/index.d.ts
CHANGED
|
@@ -958,5 +958,5 @@ declare function createFormHook(options?: Partial<Parameters<typeof createFormHo
|
|
|
958
958
|
//#region src/v7/hooks/formHooks.d.ts
|
|
959
959
|
declare const fieldContext: _$react.Context<_$_tanstack_react_form0.AnyFieldApi>, formContext: _$react.Context<_$_tanstack_react_form0.AnyFormApi>, useFieldContext: <TData>() => _$_tanstack_react_form0.FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>, useFormContext: () => _$_tanstack_react_form0.ReactFormExtendedApi<Record<string, never>, any, any, any, any, any, any, any, any, any, any, any>;
|
|
960
960
|
//#endregion
|
|
961
|
-
export { DropdownMenu, type DropdownMenuContextValue, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, DropdownMenuProvider, type DropdownMenuProviderProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, DropdownMenuWrapper, type DropdownMenuWrapperProps, ErrorPage, type ErrorPageProps, InternalLink, type InternalLinkProps, MemoryRouter, type NavMenuItem, NavigationDrawer, type NavigationDrawerProps, Router, SubmitButton, type SubmitButtonProps, Switch, type SwitchProps, TextField, fieldContext, formContext,
|
|
961
|
+
export { DropdownMenu, type DropdownMenuContextValue, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, DropdownMenuProvider, type DropdownMenuProviderProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, DropdownMenuWrapper, type DropdownMenuWrapperProps, ErrorPage, type ErrorPageProps, InternalLink, type InternalLinkProps, MemoryRouter, type NavMenuItem, NavigationDrawer, type NavigationDrawerProps, Router, SubmitButton, type SubmitButtonProps, Switch, type SwitchProps, TextField, createFormHook, fieldContext, formContext, useDropdownMenu, useFieldContext, useFormContext };
|
|
962
962
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/v7/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{escapeRegexPattern as e,omitProperties as t,truncate as n}from"@alextheman/utility";import r from"@mui/material/AppBar";import i from"@mui/material/Box";import a from"@mui/material/CssBaseline";import o from"@mui/material/Divider";import s from"@mui/material/Drawer";import c from"@mui/material/IconButton";import l from"@mui/material/List";import u from"@mui/material/ListItem";import d from"@mui/material/ListItemButton";import ee from"@mui/material/ListItemIcon";import te from"@mui/material/ListItemText";import{styled as f,useTheme as ne}from"@mui/material/styles";import re from"@mui/material/Toolbar";import p from"@mui/material/Typography";import{Fragment as ie,createContext as m,useContext as h,useMemo as g,useState as _}from"react";import{MdArrowDropDown as v,MdArrowDropUp as y,MdChevronLeft as b,MdChevronRight as x,MdMenu as S}from"react-icons/md";import{Link as ae,Route as oe,Router as se,Switch as ce,useLocation as le}from"wouter";import ue from"@mui/material/Alert";import de from"@mui/material/AlertTitle";import fe from"@mui/material/Container";import{jsx as C,jsxs as w}from"react/jsx-runtime";import pe from"@mui/material/Link";import{memoryLocation as me}from"wouter/memory-location";import{useBrowserLocation as he}from"wouter/use-browser-location";import T from"@mui/material/Button";import{createFormHook as E,createFormHookContexts as D}from"@tanstack/react-form";import O from"@mui/material/TextField";import k from"@mui/material/Menu";import{DataError as A}from"@alextheman/utility/v6";import j from"@mui/material/MenuItem";function M({title:e,children:t}){return C(fe,{maxWidth:`sm`,children:w(ue,{severity:`error`,children:[C(de,{children:e}),t]})})}function N({to:e,component:t=ae,children:n,ref:r,...i}){return C(pe,{component:t,to:e,ref:r,...i,children:n})}function P({children:e,...t}){let{hook:n}=me({path:`/`});return C(L,{...t,hook:n,children:e})}function F(t,n){return t.replace(RegExp(`^${e(n.base)}`),``)}function I(e=he){return t=>{let[n,r]=e(t);return[n,(...[e,...n])=>r(F(e,t),...n)]}}function L({children:e,hook:t,...n}){return C(se,{...n,hook:I(t),hrefs:(e,t)=>F(e,t),children:e})}function R({children:e,fallback:t=w(M,{title:`Page Not Found`,children:[`This page is not available. Please click `,C(N,{to:`/`,children:`here`}),` to return to the homepage.`]}),...n}){return w(ce,{...n,children:[e,C(oe,{children:t})]})}function z(e){return{width:240,transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:`hidden`}}function B(e){return{transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:`hidden`,width:`calc(${e.spacing(7)} + 1px)`,[e.breakpoints.up(`sm`)]:{width:`calc(${e.spacing(8)} + 1px)`}}}const V=f(`div`)(({theme:e})=>({display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:e.spacing(0,1),...e.mixins.toolbar})),ge=f(r,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),variants:[{props:({open:e})=>e,style:{marginLeft:240,width:`calc(100% - 240px)`,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),_e=f(s,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({width:240,flexShrink:0,whiteSpace:`nowrap`,boxSizing:`border-box`,variants:[{props:({open:e})=>e,style:{...z(e),"& .MuiDrawer-paper":z(e)}},{props:({open:e})=>!e,style:{...B(e),"& .MuiDrawer-paper":B(e)}}]}));function ve({title:e,navItems:t,children:r,headerElements:s}){let f=ne(),[m,h]=_(!0),[g]=le();function v(){h(!0)}function y(){h(!1)}return w(i,{sx:{display:`flex`},children:[C(a,{}),C(ge,{position:`fixed`,open:m,children:w(re,{children:[C(c,{color:`inherit`,"aria-label":`open drawer`,onClick:v,edge:`start`,sx:[{marginRight:5},m&&{display:`none`}],children:C(S,{})}),C(p,{variant:`h6`,noWrap:!0,component:`div`,children:e}),s]})}),w(_e,{variant:`permanent`,open:m,children:[C(V,{children:C(c,{onClick:y,children:f.direction===`rtl`?C(x,{}):C(b,{})})}),C(o,{}),t.map(e=>w(ie,{children:[w(l,{children:[C(p,{variant:m?`h5`:`h6`,sx:{paddingLeft:m?2:1},children:m?e.category:n(e.category,4)}),e.options.map(e=>C(u,{disablePadding:!0,sx:{display:`block`},children:w(d,{sx:[{minHeight:48,px:2.5},m?{justifyContent:`initial`}:{justifyContent:`center`}],component:N,to:e.to,selected:g===e.to,children:[C(ee,{sx:[{minWidth:0,justifyContent:`center`},m?{mr:3}:{mr:`auto`}],children:e.icon?e.icon:m?null:C(p,{children:n(e.label,4)})}),C(te,{primary:e.label,sx:[m?{opacity:1}:{opacity:0}]})]})},e.to))]}),C(o,{})]},e.category))]}),w(i,{component:`main`,sx:{flexGrow:1,p:3},children:[C(V,{}),r]})]})}const{fieldContext:H,formContext:U,useFieldContext:W,useFormContext:G}=D();function ye(e){return E({fieldContext:H,formContext:U,fieldComponents:{TextField:q,...e?.fieldComponents},formComponents:{SubmitButton:K,...e?.formComponents},...t(e??{},[`formComponents`,`fieldComponents`])})}function K({disableClean:e,label:t=`Submit`,...n}){let r=G();return C(T,{color:`primary`,disabled:n.disabled||e&&!r.state.isDirty,loading:r.state.isSubmitting,type:`submit`,variant:`contained`,...n,children:t})}function q(e){let t=W();return C(O,{...e,error:t.state.meta.errors.length!==0,type:`text`,value:t.state.value,onChange:e=>t.handleChange(e.target.value),onBlur:t.handleBlur,placeholder:t.name,helperText:t.state.meta.errors[0]??``})}const J=m(void 0);function Y({strict:e=!0}={}){let t=h(J);if(e&&!t)throw new A({strict:e,context:t},`DROPDOWN_MENU_NOT_FOUND`,`Could not find the DropdownMenu context. Please double-check that it is present.`);return t}function X({strict:e=!0}={}){return Y({strict:e})}function Z({children:e}){let[t,n]=_(null),r=g(()=>!!t,[t]);function i(){n(null)}return C(J.Provider,{value:{closeMenu:i,isDropdownOpen:r,anchorElement:t,setAnchorElement:n},children:e})}function Q({children:e,onClose:t,...n}){let{anchorElement:r,isDropdownOpen:i,closeMenu:a}=X();return C(k,{anchorEl:r,open:i,onClose:(e,n)=>{e.defaultPrevented||a(),t&&t(e,n)},...n,children:e})}function be({component:e,children:t,ref:n,onClick:r,...i}){let{closeMenu:a}=Y();return C(j,{component:e,ref:n,...i,onClick:e=>{r&&r(e),!e.defaultPrevented&&a()},children:t})}function $({component:e,onClick:t,openIcon:n=y,closedIcon:r=v,variant:i=`contained`,...a}){let{isDropdownOpen:o,setAnchorElement:s}=X();return C(T,{...e?{component:e}:{},"aria-controls":o?`dropdown-menu`:void 0,"aria-haspopup":`true`,"aria-expanded":o,endIcon:C(o?n:r,{}),variant:i,...a,onClick:e=>{t&&t(e),!e.defaultPrevented&&s(e.currentTarget)}})}function xe({children:e,trigger:t,triggerProps:n}){return w(Z,{children:[C($,{component:t,...n,children:n?.children??`Menu`}),C(Q,{children:e})]})}export{Q as DropdownMenu,be as DropdownMenuItem,Z as DropdownMenuProvider,$ as DropdownMenuTrigger,xe as DropdownMenuWrapper,M as ErrorPage,N as InternalLink,P as MemoryRouter,ve as NavigationDrawer,L as Router,K as SubmitButton,R as Switch,q as TextField,H as fieldContext,U as formContext,
|
|
1
|
+
import{escapeRegexPattern as e,omitProperties as t,truncate as n}from"@alextheman/utility";import r from"@mui/material/AppBar";import i from"@mui/material/Box";import a from"@mui/material/CssBaseline";import o from"@mui/material/Divider";import s from"@mui/material/Drawer";import c from"@mui/material/IconButton";import l from"@mui/material/List";import u from"@mui/material/ListItem";import d from"@mui/material/ListItemButton";import ee from"@mui/material/ListItemIcon";import te from"@mui/material/ListItemText";import{styled as f,useTheme as ne}from"@mui/material/styles";import re from"@mui/material/Toolbar";import p from"@mui/material/Typography";import{Fragment as ie,createContext as m,useContext as h,useMemo as g,useState as _}from"react";import{MdArrowDropDown as v,MdArrowDropUp as y,MdChevronLeft as b,MdChevronRight as x,MdMenu as S}from"react-icons/md";import{Link as ae,Route as oe,Router as se,Switch as ce,useLocation as le}from"wouter";import ue from"@mui/material/Alert";import de from"@mui/material/AlertTitle";import fe from"@mui/material/Container";import{jsx as C,jsxs as w}from"react/jsx-runtime";import pe from"@mui/material/Link";import{memoryLocation as me}from"wouter/memory-location";import{useBrowserLocation as he}from"wouter/use-browser-location";import T from"@mui/material/Button";import{createFormHook as E,createFormHookContexts as D}from"@tanstack/react-form";import O from"@mui/material/TextField";import k from"@mui/material/Menu";import{DataError as A}from"@alextheman/utility/v6";import j from"@mui/material/MenuItem";function M({title:e,children:t}){return C(fe,{maxWidth:`sm`,children:w(ue,{severity:`error`,children:[C(de,{children:e}),t]})})}function N({to:e,component:t=ae,children:n,ref:r,...i}){return C(pe,{component:t,to:e,ref:r,...i,children:n})}function P({children:e,...t}){let{hook:n}=me({path:`/`});return C(L,{...t,hook:n,children:e})}function F(t,n){return t.replace(RegExp(`^${e(n.base)}`),``)}function I(e=he){return t=>{let[n,r]=e(t);return[n,(...[e,...n])=>r(F(e,t),...n)]}}function L({children:e,hook:t,...n}){return C(se,{...n,hook:I(t),hrefs:(e,t)=>F(e,t),children:e})}function R({children:e,fallback:t=w(M,{title:`Page Not Found`,children:[`This page is not available. Please click `,C(N,{to:`/`,children:`here`}),` to return to the homepage.`]}),...n}){return w(ce,{...n,children:[e,C(oe,{children:t})]})}function z(e){return{width:240,transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:`hidden`}}function B(e){return{transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:`hidden`,width:`calc(${e.spacing(7)} + 1px)`,[e.breakpoints.up(`sm`)]:{width:`calc(${e.spacing(8)} + 1px)`}}}const V=f(`div`)(({theme:e})=>({display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:e.spacing(0,1),...e.mixins.toolbar})),ge=f(r,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),variants:[{props:({open:e})=>e,style:{marginLeft:240,width:`calc(100% - 240px)`,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),_e=f(s,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({width:240,flexShrink:0,whiteSpace:`nowrap`,boxSizing:`border-box`,variants:[{props:({open:e})=>e,style:{...z(e),"& .MuiDrawer-paper":z(e)}},{props:({open:e})=>!e,style:{...B(e),"& .MuiDrawer-paper":B(e)}}]}));function ve({title:e,navItems:t,children:r,headerElements:s}){let f=ne(),[m,h]=_(!0),[g]=le();function v(){h(!0)}function y(){h(!1)}return w(i,{sx:{display:`flex`},children:[C(a,{}),C(ge,{position:`fixed`,open:m,children:w(re,{children:[C(c,{color:`inherit`,"aria-label":`open drawer`,onClick:v,edge:`start`,sx:[{marginRight:5},m&&{display:`none`}],children:C(S,{})}),C(p,{variant:`h6`,noWrap:!0,component:`div`,children:e}),s]})}),w(_e,{variant:`permanent`,open:m,children:[C(V,{children:C(c,{onClick:y,children:f.direction===`rtl`?C(x,{}):C(b,{})})}),C(o,{}),t.map(e=>w(ie,{children:[w(l,{children:[C(p,{variant:m?`h5`:`h6`,sx:{paddingLeft:m?2:1},children:m?e.category:n(e.category,4)}),e.options.map(e=>C(u,{disablePadding:!0,sx:{display:`block`},children:w(d,{sx:[{minHeight:48,px:2.5},m?{justifyContent:`initial`}:{justifyContent:`center`}],component:N,to:e.to,selected:g===e.to,children:[C(ee,{sx:[{minWidth:0,justifyContent:`center`},m?{mr:3}:{mr:`auto`}],children:e.icon?e.icon:m?null:C(p,{children:n(e.label,4)})}),C(te,{primary:e.label,sx:[m?{opacity:1}:{opacity:0}]})]})},e.to))]}),C(o,{})]},e.category))]}),w(i,{component:`main`,sx:{flexGrow:1,p:3},children:[C(V,{}),r]})]})}const{fieldContext:H,formContext:U,useFieldContext:W,useFormContext:G}=D();function ye(e){return E({fieldContext:H,formContext:U,fieldComponents:{TextField:q,...e?.fieldComponents},formComponents:{SubmitButton:K,...e?.formComponents},...t(e??{},[`formComponents`,`fieldComponents`])})}function K({disableClean:e,label:t=`Submit`,...n}){let r=G();return C(T,{color:`primary`,disabled:n.disabled||e&&!r.state.isDirty,loading:r.state.isSubmitting,type:`submit`,variant:`contained`,...n,children:t})}function q(e){let t=W();return C(O,{...e,error:t.state.meta.errors.length!==0,type:`text`,value:t.state.value,onChange:e=>t.handleChange(e.target.value),onBlur:t.handleBlur,placeholder:t.name,helperText:t.state.meta.errors[0]??``})}const J=m(void 0);function Y({strict:e=!0}={}){let t=h(J);if(e&&!t)throw new A({strict:e,context:t},`DROPDOWN_MENU_NOT_FOUND`,`Could not find the DropdownMenu context. Please double-check that it is present.`);return t}function X({strict:e=!0}={}){return Y({strict:e})}function Z({children:e}){let[t,n]=_(null),r=g(()=>!!t,[t]);function i(){n(null)}return C(J.Provider,{value:{closeMenu:i,isDropdownOpen:r,anchorElement:t,setAnchorElement:n},children:e})}function Q({children:e,onClose:t,...n}){let{anchorElement:r,isDropdownOpen:i,closeMenu:a}=X();return C(k,{anchorEl:r,open:i,onClose:(e,n)=>{e.defaultPrevented||a(),t&&t(e,n)},...n,children:e})}function be({component:e,children:t,ref:n,onClick:r,...i}){let{closeMenu:a}=Y();return C(j,{component:e,ref:n,...i,onClick:e=>{r&&r(e),!e.defaultPrevented&&a()},children:t})}function $({component:e,onClick:t,openIcon:n=y,closedIcon:r=v,variant:i=`contained`,...a}){let{isDropdownOpen:o,setAnchorElement:s}=X();return C(T,{...e?{component:e}:{},"aria-controls":o?`dropdown-menu`:void 0,"aria-haspopup":`true`,"aria-expanded":o,endIcon:C(o?n:r,{}),variant:i,...a,onClick:e=>{t&&t(e),!e.defaultPrevented&&s(e.currentTarget)}})}function xe({children:e,trigger:t,triggerProps:n}){return w(Z,{children:[C($,{component:t,...n,children:n?.children??`Menu`}),C(Q,{children:e})]})}export{Q as DropdownMenu,be as DropdownMenuItem,Z as DropdownMenuProvider,$ as DropdownMenuTrigger,xe as DropdownMenuWrapper,M as ErrorPage,N as InternalLink,P as MemoryRouter,ve as NavigationDrawer,L as Router,K as SubmitButton,R as Switch,q as TextField,ye as createFormHook,H as fieldContext,U as formContext,Y as useDropdownMenu,W as useFieldContext,G as useFormContext};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|