UNPKG

p3x-redis-ui-material

Version:

💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity

1 lines • 11 kB
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{B as t,C as n,D as r,E as i,T as a,V as o,X as s,Y as c,Z as l,c as u,h as d,i as f,lt as p,r as m,w as h,y as g}from"./Box-DSXpVc0K.js";import{o as _}from"./i18n.store-ZJjZbIIr.js";import{d as v}from"./KeyboardArrowDown-D_jWdzEv.js";import{T as y,_ as b,w as x}from"./TextField-CfzwSAUF.js";import{t as S}from"./createSimplePaletteValueFilter-Bt9IjErz.js";import{H as C}from"./index-O55eiSgD.js";var w=e(_(),1);function T(e){return s(`MuiFormControlLabel`,e)}var E=c(`MuiFormControlLabel`,[`root`,`labelPlacementStart`,`labelPlacementEnd`,`labelPlacementTop`,`labelPlacementBottom`,`disabled`,`label`,`error`,`required`,`asterisk`]),D=p();function O(e){return s(`PrivateSwitchBase`,e)}c(`PrivateSwitchBase`,[`root`,`checked`,`disabled`,`input`,`edgeStart`,`edgeEnd`]);var k=e=>{let{classes:t,checked:r,disabled:i,edge:a}=e,s={root:[`root`,r&&`checked`,i&&`disabled`,a&&`edge${n(a)}`],input:[`input`]};return o(s,O,t)},A=i(m,{name:`MuiSwitchBase`})({padding:9,borderRadius:`50%`,variants:[{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e===`start`&&t.size!==`small`,style:{marginLeft:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e===`end`&&t.size!==`small`,style:{marginRight:-12}}]}),j=i(`input`,{name:`MuiSwitchBase`,shouldForwardProp:r})({cursor:`inherit`,position:`absolute`,opacity:0,width:`100%`,height:`100%`,top:0,left:0,margin:0,padding:0,zIndex:1}),M=w.forwardRef(function(e,t){let{autoFocus:n,checked:r,checkedIcon:i,defaultChecked:a,disabled:o,disableFocusRipple:s=!1,edge:c=!1,icon:l,id:d,name:f,onBlur:p,onChange:m,onFocus:h,readOnly:g,required:_=!1,tabIndex:y,type:b,value:S,slots:C={},slotProps:w={},...T}=e,{nativeButton:E,...O}=T,[M,N]=v({controlled:r,default:!!a,name:`SwitchBase`,state:`checked`}),P=x(),F=e=>{h&&h(e),P&&P.onFocus&&P.onFocus(e)},I=e=>{p&&p(e),P&&P.onBlur&&P.onBlur(e)},L=e=>{if(e.nativeEvent.defaultPrevented||g)return;let t=e.target.checked;N(t),m&&m(e,t)},R=o;P&&R===void 0&&(R=P.disabled);let z=b===`checkbox`||b===`radio`,B={...e,checked:M,disabled:R,disableFocusRipple:s,edge:c},V=k(B),H={slots:C,slotProps:w},[U,W]=u(`root`,{ref:t,elementType:A,className:V.root,shouldForwardComponentProp:!0,externalForwardedProps:{...H,component:`span`,...O},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),F(t)},onBlur:t=>{e.onBlur?.(t),I(t)}}),ownerState:B,additionalProps:{centerRipple:!0,focusRipple:!s,role:void 0,tabIndex:null,internalDisabledThemeFocusVisible:!0}}),[G,K]=u(`input`,{elementType:j,className:V.input,externalForwardedProps:H,getSlotProps:e=>({...e,onChange:t=>{e.onChange?.(t),L(t)}}),ownerState:B,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:R,id:z?d:void 0,name:f,readOnly:g,required:_,tabIndex:y,type:b,...b===`checkbox`&&S===void 0?{}:{value:S}}});return(0,D.jsxs)(U,{...W,children:[(0,D.jsx)(G,{...K}),M?i:l]})}),N=e=>{let{classes:t,disabled:r,labelPlacement:i,error:a,required:s}=e,c={root:[`root`,r&&`disabled`,`labelPlacement${n(i)}`,a&&`error`,s&&`required`],label:[`label`,r&&`disabled`],asterisk:[`asterisk`,a&&`error`]};return o(c,T,t)},P=i(`label`,{name:`MuiFormControlLabel`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:r}=e;return[{[`& .${E.label}`]:t.label},t.root,t[`labelPlacement${n(r.labelPlacement)}`]]}})(a(({theme:e})=>({display:`inline-flex`,alignItems:`center`,cursor:`pointer`,verticalAlign:`middle`,WebkitTapHighlightColor:`transparent`,marginLeft:-11,marginRight:16,[`&.${E.disabled}`]:{cursor:`default`},[`& .${E.label}`]:{[`&.${E.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:`start`},style:{flexDirection:`row-reverse`,marginRight:-11}},{props:{labelPlacement:`top`},style:{flexDirection:`column-reverse`}},{props:{labelPlacement:`bottom`},style:{flexDirection:`column`}},{props:({labelPlacement:e})=>e===`start`||e===`top`||e===`bottom`,style:{marginLeft:16}}]}))),F=i(`span`,{name:`MuiFormControlLabel`,slot:`Asterisk`})(a(({theme:e})=>({[`&.${E.error}`]:{color:(e.vars||e).palette.error.main}}))),I=w.forwardRef(function(e,t){let n=h({props:e,name:`MuiFormControlLabel`}),{checked:r,className:i,control:a,disabled:o,disableTypography:s,inputRef:c,label:d,labelPlacement:f=`end`,name:p,onChange:m,required:g,slots:_={},slotProps:v={},value:b,...x}=n,[S,T]=y({props:n,states:[`error`]}),E=o??a.props.disabled??T?.disabled,O=g??a.props.required,k={disabled:E,required:O};[`checked`,`name`,`onChange`,`value`,`inputRef`].forEach(e=>{a.props[e]===void 0&&n[e]!==void 0&&(k[e]=n[e])});let A={...n,disabled:E,labelPlacement:f,required:O,error:S.error},j=N(A),[M,I]=u(`typography`,{elementType:C,externalForwardedProps:{slots:_,slotProps:v},ownerState:A}),L=d;return L!=null&&L.type!==C&&!s&&(L=(0,D.jsx)(M,{component:`span`,...I,className:l(j.label,I?.className),children:L})),(0,D.jsxs)(P,{className:l(j.root,i),ownerState:A,ref:t,...x,children:[w.cloneElement(a,k),O?(0,D.jsxs)(`div`,{children:[L,(0,D.jsxs)(F,{ownerState:A,"aria-hidden":!0,className:j.asterisk,children:[` `,`*`]})]}):L]})});function L(e){return s(`MuiSwitch`,e)}var R=c(`MuiSwitch`,[`root`,`edgeStart`,`edgeEnd`,`switchBase`,`colorPrimary`,`colorSecondary`,`sizeSmall`,`sizeMedium`,`checked`,`disabled`,`input`,`thumb`,`track`]),z=e=>{let{classes:t,edge:r,size:i,color:a,checked:s,disabled:c}=e,l={root:[`root`,r&&`edge${n(r)}`,`size${n(i)}`],switchBase:[`switchBase`,`color${n(a)}`,s&&`checked`,c&&`disabled`],thumb:[`thumb`],track:[`track`],input:[`input`]},u=o(l,L,t);return{...t,...u}},B=i(`span`,{name:`MuiSwitch`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,r.edge&&t[`edge${n(r.edge)}`],t[`size${n(r.size)}`]]}})({display:`inline-flex`,width:58,height:38,overflow:`hidden`,padding:12,boxSizing:`border-box`,position:`relative`,flexShrink:0,zIndex:0,verticalAlign:`middle`,"@media print":{colorAdjust:`exact`},variants:[{props:{edge:`start`},style:{marginLeft:-8}},{props:{edge:`end`},style:{marginRight:-8}},{props:{size:`small`},style:{width:40,height:24,padding:7,[`& .${R.thumb}`]:{width:16,height:16},[`& .${R.switchBase}`]:{padding:4,[`&.${R.checked}`]:{transform:`translateX(16px)`}}}}]}),V=i(M,{name:`MuiSwitch`,slot:`SwitchBase`,overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.switchBase,{[`& .${R.input}`]:t.input},r.color!=="default"&&t[`color${n(r.color)}`]]}})(a(({theme:e})=>({position:`absolute`,top:0,left:0,zIndex:1,color:e.vars?e.vars.palette.Switch.defaultColor:`${e.palette.mode===`light`?e.palette.common.white:e.palette.grey[300]}`,...g(e,[`left`,`transform`],{duration:e.transitions.duration.shortest}),[`&.${R.checked}`]:{transform:`translateX(20px)`},[`&.${R.disabled}`]:{color:e.vars?e.vars.palette.Switch.defaultDisabledColor:`${e.palette.mode===`light`?e.palette.grey[100]:e.palette.grey[600]}`},...e.focusVisible?{[`&.${f.focusVisible} ~ .${R.track}`]:{...t,...e.focusVisible},[`&.${R.checked} + .${R.track}`]:{backgroundColor:e.alpha(e.vars?e.vars.palette.common.onBackground:`${e.palette.mode===`light`?e.palette.common.black:e.palette.common.white}`,.5)},[`&.${R.disabled} + .${R.track}`]:{backgroundColor:e.alpha(e.vars?e.vars.palette.common.onBackground:`${e.palette.mode===`light`?e.palette.common.black:e.palette.common.white}`,e.vars?e.vars.opacity.switchTrackDisabled:`${e.palette.mode===`light`?.12:.2}`)}}:{[`&.${R.checked} + .${R.track}`]:{opacity:.5},[`&.${R.disabled} + .${R.track}`]:{opacity:e.vars?e.vars.opacity.switchTrackDisabled:`${e.palette.mode===`light`?.12:.2}`}},[`& .${R.input}`]:{left:`-100%`,width:`300%`}})),a(({theme:e})=>({"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},variants:[...Object.entries(e.palette).filter(S([`light`])).map(([t])=>({props:{color:t},style:{[`&.${R.checked}`]:{color:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${R.disabled}`]:{color:e.vars?e.vars.palette.Switch[`${t}DisabledColor`]:`${e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.55)}`}},[`&.${R.checked} + .${R.track}`]:{backgroundColor:(e.vars||e).palette[t].main},...e.focusVisible&&{[`&.${R.checked} + .${R.track}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,.5)},[`&.${R.disabled} + .${R.track}`]:{backgroundColor:e.alpha(e.vars?e.vars.palette.common.onBackground:`${e.palette.mode===`light`?e.palette.common.black:e.palette.common.white}`,e.vars?e.vars.opacity.switchTrackDisabled:`${e.palette.mode===`light`?.12:.2}`)},[`&.${R.checked}.${R.disabled} + .${R.track}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,e.vars?e.vars.opacity.switchTrackDisabled:`${e.palette.mode===`light`?.12:.2}`)}}}}))]}))),H=i(`span`,{name:`MuiSwitch`,slot:`Track`})(a(({theme:e})=>({height:`100%`,width:`100%`,borderRadius:7,zIndex:-1,...g(e,[`opacity`,`background-color`],{duration:e.transitions.duration.shortest}),"@media (forced-colors: active)":{boxSizing:`border-box`,border:`1px solid ButtonBorder`},...e.focusVisible?{backgroundColor:e.alpha(e.vars?e.vars.palette.common.onBackground:`${e.palette.mode===`light`?e.palette.common.black:e.palette.common.white}`,e.vars?e.vars.opacity.switchTrack:`${e.palette.mode===`light`?.38:.3}`)}:{backgroundColor:e.vars?e.vars.palette.common.onBackground:`${e.palette.mode===`light`?e.palette.common.black:e.palette.common.white}`,opacity:e.vars?e.vars.opacity.switchTrack:`${e.palette.mode===`light`?.38:.3}`}}))),U=i(`span`,{name:`MuiSwitch`,slot:`Thumb`})(a(({theme:e})=>({boxShadow:(e.vars||e).shadows[1],backgroundColor:`currentColor`,boxSizing:`border-box`,border:`1px solid transparent`,width:20,height:20,borderRadius:`50%`}))),W=w.forwardRef(function(e,t){let n=h({props:e,name:`MuiSwitch`}),{className:r,color:i=`primary`,edge:a=!1,size:o=`medium`,sx:s,slots:c={},slotProps:d={},...f}=n,p={...n,color:i,edge:a,size:o},m=z(p),g=d.input,_={slots:c,slotProps:d},[v,y]=u(`root`,{className:l(m.root,r),elementType:B,externalForwardedProps:_,ownerState:p,additionalProps:{sx:s}}),[x,S]=u(`thumb`,{className:m.thumb,elementType:U,externalForwardedProps:_,ownerState:p}),C=(0,D.jsx)(x,{...S}),[w,T]=u(`track`,{className:m.track,elementType:H,externalForwardedProps:_,ownerState:p});return(0,D.jsxs)(v,{...y,children:[(0,D.jsx)(V,{type:`checkbox`,icon:C,checkedIcon:C,ref:t,ownerState:p,...f,classes:{...m,root:m.switchBase},slots:{...c.switchBase&&{root:c.switchBase},...c.input&&{input:c.input}},slotProps:{...d.switchBase&&{root:typeof d.switchBase==`function`?d.switchBase(p):d.switchBase},input:b(typeof g==`function`?g(p):g,{role:`switch`})}}),(0,D.jsx)(w,{...T})]})}),G=d((0,D.jsx)(`path`,{d:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z`}),`Add`),K=d((0,D.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z`}),`Delete`);export{M as a,I as i,G as n,W as r,K as t};