@zydon/plugin 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Viewer/index.js +13 -13
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { createContext, useState, useCallback, useMemo, useContext } from 'react';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import kt from '@zydon/common/components/Common';
|
|
4
|
+
import Zo from '@zydon/common/components/CustomAvatar';
|
|
5
|
+
import Ko from '@zydon/common/hooks/useLocalStorage';
|
|
6
|
+
import Go from '@zydon/common/layouts/Admin';
|
|
7
7
|
import C from '@mui/material/Stack';
|
|
8
8
|
import { styled, alpha } from '@mui/material/styles';
|
|
9
9
|
import s from '@mui/material/Button';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
10
|
+
import ut from '@mui/material/Drawer';
|
|
11
|
+
import Ct from '@mui/material/SvgIcon';
|
|
12
|
+
import st from '@mui/material/Tooltip';
|
|
13
|
+
import ht from '@mui/material/Typography';
|
|
14
14
|
import { m } from '@zydon/common/components/animate';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
15
|
+
import wt from '@zydon/common/components/IconButton';
|
|
16
|
+
import xt from '@zydon/common/hooks/useToggle';
|
|
17
17
|
import Y from '@mui/material/Box';
|
|
18
|
-
import
|
|
18
|
+
import mt from '@mui/material/IconButton';
|
|
19
19
|
|
|
20
|
-
var G="view",$="control",U="appType",q="layout",J=createContext(null),Q=({children:o})=>{let[t,e]=useState(sessionStorage.getItem($)||"on"),[i,m]=useState(sessionStorage.getItem(G)||"config"),[n,a]=useState(sessionStorage.getItem(U)||"global"),[d,c]=useState(sessionStorage.getItem(q)||"horizontal"),v=useCallback(l=>{e(l),sessionStorage.setItem($,l);},[]),p=useCallback(()=>{e("off"),sessionStorage.setItem($,"off");},[]),O=useCallback(l=>{m(l),sessionStorage.setItem(G,l);},[]),z=useCallback(l=>{a(l),sessionStorage.setItem(U,l);},[]),Do=useCallback(l=>{c(l),sessionStorage.setItem(q,l);},[]);return jsx(J.Provider,{value:{control:t,view:i,appType:n,layout:d,setControl:v,hideControl:p,changeView:O,changeAppType:z,changeLayout:Do},children:o})};function w(){let o=useContext(J);if(!o)throw new Error("useViewer must be used within a ViewerProvider");return o}var Jo=({children:o})=>{let[t,e]=Uo("isNavMini",!1);return jsx(qo,{isNavMini:t,onToggleNavMini:()=>e(!t),headerProps:{slots:{rightAreaEnd:jsx(Go,{name:"A"})}},sidebarContent:jsx(Fragment,{}),children:o})},X=Jo;var j=styled(C)({minHeight:"100vh"}),oo=styled(C)(({theme:o})=>({flexDirection:"row",alignItems:"center",padding:"0 40px",height:64,borderBottom:`1px dashed ${o.palette.grey[200]}`})),to=styled("div")(({theme:o})=>({display:"flex",alignItems:"center",justifyContent:"center",height:48,width:240,backgroundColor:o.palette.primary.main,borderRadius:4,color:o.palette.primary.contrastText,fontWeight:600})),eo=styled(C)({flexDirection:"row",alignItems:"center",padding:"0 40px",height:64,gap:8}),V=styled("div")(({theme:o})=>({height:32,width:120,backgroundColor:o.palette.grey[100],borderRadius:4})),ro=styled(C)(({theme:o})=>({backgroundColor:o.palette.grey[100],flex:1,padding:"24px 40px"}));var jo=({children:o})=>jsxs(j,{children:[jsxs(C,{children:[jsx(oo,{children:jsx(to,{children:"Logo"})}),jsxs(eo,{children:[jsx(V,{}),jsx(V,{}),jsx(V,{}),jsx(V,{})]})]}),jsx(ro,{children:o})]}),io=jo;var no=styled(C)({minHeight:"100vh",flexDirection:"row"}),ao=styled(C)(({theme:o})=>({gap:16,alignItems:"center",backgroundColor:o.palette.common.white,width:88,padding:16,borderRight:`1px solid ${o.palette.grey[200]}`})),po=styled(C)(({theme:o})=>({alignItems:"center",justifyContent:"center",width:"100%",height:56,backgroundColor:o.palette.primary.main,color:o.palette.primary.contrastText,fontWeight:600,borderRadius:4,marginBottom:8})),B=styled(C)(({theme:o})=>({width:"80%",height:40,backgroundColor:o.palette.grey[200],borderRadius:4})),lo=styled(C)(({theme:o})=>({justifyContent:"center",alignItems:"center",backgroundColor:o.palette.common.white,height:72})),co=styled(C)(({theme:o})=>({width:400,height:40,backgroundColor:o.palette.grey[200],borderRadius:4})),so=styled(C)(({theme:o})=>({backgroundColor:o.palette.grey[100],flex:1}));var ot=({children:o})=>jsxs(no,{children:[jsxs(ao,{children:[jsx(po,{children:"Logo"}),jsx(B,{}),jsx(B,{}),jsx(B,{})]}),jsxs(so,{children:[jsx(lo,{children:jsx(co,{})}),o]})]}),mo=ot;var uo=styled(C)({minHeight:"100vh",flexDirection:"row"}),go=styled(C)(({theme:o})=>({gap:4,alignItems:"center",backgroundColor:o.palette.common.white,width:300,padding:16,borderRight:`1px solid ${o.palette.grey[200]}`})),Co=styled(C)(({theme:o})=>({width:"80%",height:56,alignItems:"center",justifyContent:"center",backgroundColor:o.palette.primary.main,color:o.palette.primary.contrastText,fontWeight:600,borderRadius:4,marginBottom:12,marginRight:"auto"})),R=styled(C)(({theme:o})=>({width:"100%",height:40,backgroundColor:o.palette.grey[200],borderRadius:4})),fo=styled(C)(({theme:o})=>({justifyContent:"center",alignItems:"center",backgroundColor:o.palette.common.white,height:72})),ho=styled(C)(({theme:o})=>({width:400,height:40,backgroundColor:o.palette.grey[200],borderRadius:4})),yo=styled(C)(({theme:o})=>({backgroundColor:o.palette.grey[100],flex:1}));var tt=({children:o})=>jsxs(uo,{children:[jsxs(go,{children:[jsx(Co,{children:"Logo"}),jsx(R,{}),jsx(R,{}),jsx(R,{})]}),jsxs(yo,{children:[jsx(fo,{children:jsx(ho,{})}),o]})]}),wo=tt;var et=({children:o})=>{let{layout:t}=w(),i={horizontal:io,full:wo,mini:mo}[t];return jsx(i,{children:o})},xo=et;var it=()=>jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{opacity:"0.32",fillRule:"evenodd",clipRule:"evenodd",d:"M1.5 12C1.5 17.799 6.20101 22.5 12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12ZM12.9491 5.80725C12.5501 5.06425 11.4499 5.06425 11.051 5.80725L9.54862 8.60535L6.36352 9.2112C5.54932 9.36605 5.22022 10.319 5.77507 10.9151L8.03362 13.3415L7.61877 16.5888C7.51432 17.4065 8.39427 18.0073 9.15727 17.6394L12 16.2687L14.8428 17.6394C15.6058 18.0073 16.4857 17.4065 16.3813 16.5888L15.9664 13.3415L18.225 10.9151C18.7798 10.319 18.4507 9.36605 17.6365 9.2112L14.4514 8.60535L12.9491 5.80725Z",fill:"currentColor"}),jsx("path",{d:"M11.051 5.80725C11.4499 5.06425 12.5501 5.06425 12.9491 5.80725L14.4514 8.60535L17.6365 9.2112C18.4507 9.36605 18.7798 10.319 18.225 10.9151L15.9664 13.3415L16.3813 16.5888C16.4857 17.4065 15.6058 18.0073 14.8428 17.6394L12 16.2687L9.15727 17.6394C8.39427 18.0073 7.51432 17.4065 7.61877 16.5888L8.03362 13.3415L5.77507 10.9151C5.22022 10.319 5.54932 9.36605 6.36352 9.2112L9.54862 8.60535L11.051 5.80725Z",fill:"currentColor"})]}),bo=it;var at=()=>jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{opacity:"0.32",d:"M3.41016 2.00012C2.71981 2.00012 2.16016 2.55977 2.16016 3.25012C2.16016 3.94048 2.71981 4.50012 3.41016 4.50012H4.25251C4.48986 4.50012 4.69436 4.66605 4.74281 4.89837C4.96591 5.96777 5.59766 8.95907 6.10461 11.0001C6.73135 13.5236 7.29935 15.342 7.6574 16.4029C8.09928 16.1467 8.61259 16 9.16016 16C10.446 16 11.5429 16.809 11.9697 17.9457C12.7178 17.9791 13.5912 18.0001 14.6046 18.0001C15.462 18.0001 16.2042 17.9851 16.8452 17.9602C17.2681 16.8159 18.3689 16 19.6602 16C20.2143 16 20.7334 16.1503 21.1789 16.4123C21.5323 15.5226 22.0073 14.0331 22.4102 11.7501C22.6992 10.1123 22.8768 8.88287 22.986 7.99032C23.1201 6.89392 22.2647 6.00012 21.1602 6.00012H7.66016L7.03891 3.51505C6.81631 2.62472 6.01636 2.00012 5.09861 2.00012H3.41016Z",fill:"currentColor"}),jsx("path",{d:"M17.5505 10.594C17.6091 10.0083 17.1491 9.49997 16.5604 9.49997C16.0492 9.49997 15.6212 9.88732 15.5703 10.396L15.2694 13.4059C15.2108 13.9917 15.6708 14.5 16.2595 14.5C16.7707 14.5 17.1987 14.1126 17.2496 13.6039L17.5505 10.594Z",fill:"currentColor"}),jsx("path",{d:"M12.7496 10.396C12.6987 9.88732 12.2707 9.49997 11.7595 9.49997C11.1708 9.49997 10.7108 10.0083 10.7694 10.594L11.0703 13.6039C11.1212 14.1126 11.5492 14.5 12.0604 14.5C12.6491 14.5 13.1091 13.9917 13.0505 13.4059L12.7496 10.396Z",fill:"currentColor"}),jsx("path",{d:"M16.6602 19C16.6602 20.6569 18.0033 22 19.6602 22C21.317 22 22.6602 20.6569 22.6602 19C22.6602 17.3432 21.317 16 19.6602 16C18.0033 16 16.6602 17.3432 16.6602 19Z",fill:"currentColor"}),jsx("path",{d:"M6.16016 19C6.16016 20.6569 7.50331 22 9.16016 22C10.817 22 12.1602 20.6569 12.1602 19C12.1602 17.3432 10.817 16 9.16016 16C7.50331 16 6.16016 17.3432 6.16016 19Z",fill:"currentColor"})]}),ko=at;var lt=()=>jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxs("g",{opacity:"0.32",children:[jsx("path",{d:"M21.4286 9.6V5.6C21.4286 5.17565 21.263 4.76869 20.9683 4.46863C20.6736 4.16857 20.2739 4 19.8571 4H18C17.7239 4 17.5 4.22386 17.5 4.5V5.1C17.5 5.37614 17.7239 5.6 18 5.6H19.8571V9.6C19.8588 10.0559 19.9567 10.5061 20.144 10.9201C20.3313 11.3342 20.6038 11.7024 20.943 12C20.6038 12.2976 20.3313 12.6658 20.144 13.0799C19.9567 13.4939 19.8588 13.9441 19.8571 14.4V18.4H18C17.7239 18.4 17.5 18.6239 17.5 18.9V19.5C17.5 19.7761 17.7239 20 18 20H19.8571C20.2739 20 20.6736 19.8314 20.9683 19.5314C21.263 19.2313 21.4286 18.8243 21.4286 18.4V14.4C21.4286 13.9757 21.5941 13.5687 21.8888 13.2686C22.0644 13.0899 22.2772 12.9578 22.5087 12.8802C22.7705 12.7925 23 12.5761 23 12.3V11.7C23 11.4239 22.7705 11.2075 22.5087 11.1198C22.2772 11.0422 22.0644 10.9101 21.8888 10.7314C21.5941 10.4313 21.4286 10.0243 21.4286 9.6Z",fill:"currentColor"}),jsx("path",{d:"M4.14286 9.6V5.6H6C6.27614 5.6 6.5 5.37614 6.5 5.1V4.5C6.5 4.22386 6.27614 4 6 4H4.14286C3.72609 4 3.32639 4.16857 3.03169 4.46863C2.73699 4.76869 2.57143 5.17565 2.57143 5.6V9.6C2.57143 10.0243 2.40587 10.4313 2.11117 10.7314C1.93562 10.9101 1.72281 11.0422 1.49133 11.1198C1.2295 11.2075 1 11.4239 1 11.7V12.3C1 12.5761 1.2295 12.7925 1.49133 12.8802C1.72281 12.9578 1.93562 13.0899 2.11117 13.2686C2.40587 13.5687 2.57143 13.9757 2.57143 14.4V18.4C2.57143 18.8243 2.73699 19.2313 3.03169 19.5314C3.32639 19.8314 3.72609 20 4.14286 20H6C6.27614 20 6.5 19.7761 6.5 19.5V18.9C6.5 18.6239 6.27614 18.4 6 18.4H4.14286V14.4C4.14116 13.9441 4.04333 13.4939 3.856 13.0799C3.66866 12.6658 3.39619 12.2976 3.057 12C3.39619 11.7024 3.66866 11.3342 3.856 10.9201C4.04333 10.5061 4.14116 10.0559 4.14286 9.6Z",fill:"currentColor"})]}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.75 6.5L12.1072 8.85714H13.6072L14.25 6.5H15.75L15.1072 8.85714H16.5V10.4286H14.679L13.8218 13.5714H15.75V15.1429H13.3928L12.75 17.5H11.25L11.8928 15.1429H10.3928L9.75 17.5H8.25L8.89275 15.1429H7.5V13.5714H9.32175L10.179 10.4286H8.25V8.85714H10.6072L11.25 6.5H12.75ZM13.179 10.4286H11.679L10.8217 13.5714H12.3218L13.179 10.4286Z",fill:"currentColor"})]}),vo=lt;var Ho=styled(C)(({theme:o})=>({padding:"24px 16px 16px",gap:16,width:"100%",flexWrap:"wrap",borderRadius:12,position:"relative",flexDirection:"row",alignItems:"center",justifyContent:"center",backgroundColor:o.palette.background.paper,boxShadow:`0 0 0 1px ${alpha(o.palette.grey[500],.16)}`})),To=styled("span")(({theme:o})=>({padding:"2px 8px",top:0,marginLeft:20,left:0,borderRadius:8,position:"absolute",color:o.palette.text.primary,backgroundColor:o.palette.common.white,transform:"translateY(-50%)",fontSize:o.typography.caption.fontSize,fontWeight:600,border:`solid 1px ${alpha(o.palette.grey[500],.24)}`}));var ct=({title:o,children:t})=>jsxs(Ho,{children:[o&&jsx(To,{children:o}),t]}),W=ct;var Mo=styled(Y,{shouldForwardProp:o=>o!=="selected"})(({theme:o,selected:t})=>({flexShrink:0,borderRadius:8,backgroundColor:o.palette.grey[500],width:10,height:10,opacity:.8,...t&&{opacity:1,background:`linear-gradient(135deg, ${o.palette.primary.light} 0%, ${o.palette.primary.main} 100%)`}})),Bo=styled(Y,{shouldForwardProp:o=>o!=="selected"&&o!=="layout"})(({theme:o,layout:t,selected:e})=>({flexShrink:0,borderRadius:8,backgroundColor:o.palette.grey[500],width:"100%",height:4,opacity:.48,...t==="horizontal"&&{width:16},...e&&{background:`linear-gradient(135deg, ${o.palette.primary.light} 0%, ${o.palette.primary.main} 100%)`}})),Ro=styled(Y,{shouldForwardProp:o=>o!=="selected"})(({theme:o,selected:t,layout:e})=>({flexShrink:0,borderRadius:8,backgroundColor:o.palette.grey[500],width:"100%",height:4,maxWidth:14,opacity:.24,...e==="horizontal"&&{maxWidth:10},...t&&{background:`linear-gradient(135deg, ${o.palette.primary.light} 0%, ${o.palette.primary.main} 100%)`}})),Wo=styled(C,{shouldForwardProp:o=>o!=="layout"})(({theme:o,layout:t})=>({gap:4,flexShrink:0,padding:6,width:32,height:"100%",borderRightWidth:1,borderRightStyle:"solid",borderRightColor:alpha(o.palette.grey[500],.08),...t==="mini"&&{width:22},...t==="horizontal"&&{width:"100%",height:22,borderRight:"none",alignItems:"center",flexDirection:"row",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:alpha(o.palette.grey[500],.08)}})),Ao=styled(s,{shouldForwardProp:o=>o!=="layout"})(({theme:o,layout:t,selected:e})=>({width:"100%",height:64,borderRadius:12,borderWidth:1,borderStyle:"solid",padding:0,borderColor:alpha(o.palette.grey[500],.08),...t==="horizontal"&&{flexDirection:"column"},...e&&{boxShadow:`-8px 8px 20px -4px ${alpha(o.palette.grey[500],.12)}`}})),No=styled(C,{shouldForwardProp:o=>o!=="selected"})(({theme:o,selected:t})=>({width:"100%",height:"100%",opacity:.2,borderRadius:6,backgroundColor:o.palette.grey[500],...t&&{background:`linear-gradient(135deg, ${o.palette.primary.light} 0%, ${o.palette.primary.main} 100%)`}}));var N=({title:o,layout:t,selected:e,onClick:i})=>jsx(Ct,{title:o,children:jsxs(Ao,{variant:e?"soft":void 0,layout:t,selected:e,onClick:i,children:[jsxs(Wo,{layout:t,children:[jsx(Mo,{selected:e}),jsx(Bo,{layout:t,selected:e}),jsx(Ro,{selected:e,layout:t})]}),jsx(C,{p:.5,width:1,height:1,flexGrow:1,children:jsx(No,{selected:e})})]})});var zo=styled(ft)(({theme:o})=>({color:o.palette.grey[600],position:"fixed",bottom:32,right:32}));var vt=()=>{let[o,t]=St(!1),{control:e,view:i,changeView:m$1,appType:n,changeAppType:a,layout:d,changeLayout:c}=w();return jsxs(Fragment,{children:[e==="on"&&jsx(Ct,{title:"Configura\xE7\xF5es",children:jsx(zo,{onClick:t,children:jsxs(wt,{component:m.svg,animate:{rotate:360},transition:{duration:8,ease:"linear",repeat:1/0},children:[jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.279 2.152C13.909 2 13.439 2 12.5 2s-1.408 0-1.779.152a2.008 2.008 0 0 0-1.09 1.083c-.094.223-.13.484-.145.863a1.615 1.615 0 0 1-.796 1.353a1.64 1.64 0 0 1-1.579.008c-.338-.178-.583-.276-.825-.308a2.026 2.026 0 0 0-1.49.396c-.318.242-.553.646-1.022 1.453c-.47.807-.704 1.21-.757 1.605c-.07.526.074 1.058.4 1.479c.148.192.357.353.68.555c.477.297.783.803.783 1.361c0 .558-.306 1.064-.782 1.36c-.324.203-.533.364-.682.556a1.99 1.99 0 0 0-.399 1.479c.053.394.287.798.757 1.605c.47.807.704 1.21 1.022 1.453c.424.323.96.465 1.49.396c.242-.032.487-.13.825-.308a1.64 1.64 0 0 1 1.58.008c.486.28.774.795.795 1.353c.015.38.051.64.145.863c.204.49.596.88 1.09 1.083c.37.152.84.152 1.779.152s1.409 0 1.779-.152a2.008 2.008 0 0 0 1.09-1.083c.094-.223.13-.483.145-.863c.02-.558.309-1.074.796-1.353a1.64 1.64 0 0 1 1.579-.008c.338.178.583.276.825.308c.53.07 1.066-.073 1.49-.396c.318-.242.553-.646 1.022-1.453c.47-.807.704-1.21.757-1.605a1.99 1.99 0 0 0-.4-1.479c-.148-.192-.357-.353-.68-.555c-.477-.297-.783-.803-.783-1.361c0-.558.306-1.064.782-1.36c.324-.203.533-.364.682-.556a1.99 1.99 0 0 0 .399-1.479c-.053-.394-.287-.798-.757-1.605c-.47-.807-.704-1.21-1.022-1.453a2.026 2.026 0 0 0-1.49-.396c-.242.032-.487.13-.825.308a1.64 1.64 0 0 1-1.58-.008a1.615 1.615 0 0 1-.795-1.353c-.015-.38-.051-.64-.145-.863a2.007 2.007 0 0 0-1.09-1.083",clipRule:"evenodd",opacity:"0.5"}),jsx("path",{fill:"currentColor",d:"M15.523 12c0 1.657-1.354 3-3.023 3c-1.67 0-3.023-1.343-3.023-3S10.83 9 12.5 9c1.67 0 3.023 1.343 3.023 3"})]})})}),jsx(yt,{open:o&&e==="on",onClose:t,anchor:"right",PaperProps:{sx:{p:2,width:400}},children:jsxs(C,{gap:4,children:[jsxs(C,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[jsx(Lt,{variant:"subtitle1",fontWeight:700,children:"Configura\xE7\xF5es"}),jsx(kt,{onClick:t,icon:"CLOSE_MARK_BUTTON",label:"Fechar",color:"grey.500"})]}),jsx(W,{title:"Modo",children:jsxs(C,{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1,width:1,children:[jsx(s,{startIcon:jsx(vo,{}),variant:i==="config"?"contained":void 0,size:"large",fullWidth:!0,onClick:()=>m$1("config"),children:"Admin"}),jsx(s,{startIcon:jsx(bo,{}),variant:i==="app"?"contained":void 0,size:"large",fullWidth:!0,onClick:()=>m$1("app"),children:"Plugin"})]})}),i==="app"&&jsxs(Fragment,{children:[jsx(W,{title:"Tipo de plugin",children:jsxs(C,{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:1,width:1,children:[jsx(s,{variant:n==="global"?"contained":void 0,onClick:()=>a("global"),children:"Global"}),jsx(s,{variant:n==="new-order"?"contained":void 0,onClick:()=>a("new-order"),children:"Novo pedido"}),jsx(s,{variant:n==="products-list"?"contained":void 0,onClick:()=>a("products-list"),children:"Lista de produtos"}),jsx(s,{variant:n==="products-list-item"?"contained":void 0,onClick:()=>a("products-list-item"),children:"Item da lista de produtos"}),jsx(s,{variant:n==="product-detail"?"contained":void 0,onClick:()=>a("product-detail"),children:"Detalhes do produto"}),jsx(s,{variant:n==="product-detail-actions"?"contained":void 0,onClick:()=>a("product-detail-actions"),children:"A\xE7\xF5es do produto"}),jsx(s,{startIcon:jsx(ko,{}),variant:n==="checkout"?"contained":void 0,onClick:()=>a("checkout"),children:"Checkout"}),jsx(s,{variant:n==="screen"?"contained":void 0,onClick:()=>a("screen"),children:"Tela"})]})}),jsx(W,{title:"Layout",children:jsxs(C,{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:2,width:1,children:[jsx(N,{title:"Layout Mini",layout:"mini",selected:d==="mini",onClick:()=>c("mini")}),jsx(N,{title:"Layout Vertical",layout:"full",selected:d==="full",onClick:()=>c("full")}),jsx(N,{title:"Layout Horizontal",layout:"horizontal",selected:d==="horizontal",onClick:()=>c("horizontal")})]})})]})]})})]})},Eo=vt;var Ht=({configView:o,appView:t,checkoutView:e,productDetailView:i,newOrderView:m,productDetailActionsView:n,productsListView:a,productsListItemView:d,screenView:c})=>{let{view:v,appType:p}=w(),O=v==="config"?X:xo,z=useMemo(()=>{if(v==="config")return o;if(p==="global")return t;if(p==="checkout")return e;if(p==="product-detail")return i;if(p==="new-order")return m;if(p==="product-detail-actions")return n;if(p==="products-list")return a;if(p==="products-list-item")return d;if(p==="screen")return c},[v,o,p,t,e,i,m,n,a,d,c]);return jsxs(Fragment,{children:[jsx(O,{children:z}),jsx(Vt,{primaryColor:"#000000",children:jsx(Eo,{})})]})},Zo=Ht;var Mt=({appView:o,configView:t,checkoutView:e,productDetailView:i,newOrderView:m,productDetailActionsView:n,productsListView:a,productsListItemView:d,screenView:c})=>jsx(Q,{children:jsx(Zo,{configView:t,appView:o,checkoutView:e,productDetailView:i,newOrderView:m,productDetailActionsView:n,productsListView:a,productsListItemView:d,screenView:c})}),se=Mt;
|
|
20
|
+
var K="view",O="control",G="appType",U="layout",q=createContext(null),J=({children:o})=>{let[t,e]=useState(sessionStorage.getItem(O)||"on"),[i,m]=useState(sessionStorage.getItem(K)||"config"),[n,a]=useState(sessionStorage.getItem(G)||"global"),[d,c]=useState(sessionStorage.getItem(U)||"horizontal"),P=useCallback(l=>{e(l),sessionStorage.setItem(O,l);},[]),p=useCallback(()=>{e("off"),sessionStorage.setItem(O,"off");},[]),N=useCallback(l=>{m(l),sessionStorage.setItem(K,l);},[]),z=useCallback(l=>{a(l),sessionStorage.setItem(G,l);},[]),_o=useCallback(l=>{c(l),sessionStorage.setItem(U,l);},[]);return jsx(q.Provider,{value:{control:t,view:i,appType:n,layout:d,setControl:P,hideControl:p,changeView:N,changeAppType:z,changeLayout:_o},children:o})};function w(){let o=useContext(q);if(!o)throw new Error("useViewer must be used within a ViewerProvider");return o}var Uo=({children:o})=>{let[t,e]=Ko("isNavMini",!1);return jsx(Go,{isNavMini:t,onToggleNavMini:()=>e(!t),headerProps:{slots:{rightAreaEnd:jsx(Zo,{name:"A"})}},sidebarContent:jsx(Fragment,{}),children:o})},Q=Uo;var X=styled(C)({minHeight:"100vh"}),j=styled(C)(({theme:o})=>({flexDirection:"row",alignItems:"center",padding:"0 40px",height:64,borderBottom:`1px dashed ${o.palette.grey[200]}`})),oo=styled("div")(({theme:o})=>({display:"flex",alignItems:"center",justifyContent:"center",height:48,width:240,backgroundColor:o.palette.primary.main,borderRadius:4,color:o.palette.primary.contrastText,fontWeight:600})),to=styled(C)({flexDirection:"row",alignItems:"center",padding:"0 40px",height:64,gap:8}),V=styled("div")(({theme:o})=>({height:32,width:120,backgroundColor:o.palette.grey[100],borderRadius:4})),eo=styled(C)(({theme:o})=>({backgroundColor:o.palette.grey[100],flex:1,padding:"24px 40px"}));var Qo=({children:o})=>jsxs(X,{children:[jsxs(C,{children:[jsx(j,{children:jsx(oo,{children:"Logo"})}),jsxs(to,{children:[jsx(V,{}),jsx(V,{}),jsx(V,{}),jsx(V,{})]})]}),jsx(eo,{children:o})]}),ro=Qo;var io=styled(C)({minHeight:"100vh",flexDirection:"row"}),no=styled(C)(({theme:o})=>({gap:16,alignItems:"center",backgroundColor:o.palette.common.white,width:88,padding:16,borderRight:`1px solid ${o.palette.grey[200]}`})),ao=styled(C)(({theme:o})=>({alignItems:"center",justifyContent:"center",width:"100%",height:56,backgroundColor:o.palette.primary.main,color:o.palette.primary.contrastText,fontWeight:600,borderRadius:4,marginBottom:8})),R=styled(C)(({theme:o})=>({width:"80%",height:40,backgroundColor:o.palette.grey[200],borderRadius:4})),po=styled(C)(({theme:o})=>({justifyContent:"center",alignItems:"center",backgroundColor:o.palette.common.white,height:72})),lo=styled(C)(({theme:o})=>({width:400,height:40,backgroundColor:o.palette.grey[200],borderRadius:4})),co=styled(C)(({theme:o})=>({backgroundColor:o.palette.grey[100],flex:1}));var Xo=({children:o})=>jsxs(io,{children:[jsxs(no,{children:[jsx(ao,{children:"Logo"}),jsx(R,{}),jsx(R,{}),jsx(R,{})]}),jsxs(co,{children:[jsx(po,{children:jsx(lo,{})}),o]})]}),so=Xo;var mo=styled(C)({minHeight:"100vh",flexDirection:"row"}),go=styled(C)(({theme:o})=>({gap:4,alignItems:"center",backgroundColor:o.palette.common.white,width:300,padding:16,borderRight:`1px solid ${o.palette.grey[200]}`})),uo=styled(C)(({theme:o})=>({width:"80%",height:56,alignItems:"center",justifyContent:"center",backgroundColor:o.palette.primary.main,color:o.palette.primary.contrastText,fontWeight:600,borderRadius:4,marginBottom:12,marginRight:"auto"})),B=styled(C)(({theme:o})=>({width:"100%",height:40,backgroundColor:o.palette.grey[200],borderRadius:4})),Co=styled(C)(({theme:o})=>({justifyContent:"center",alignItems:"center",backgroundColor:o.palette.common.white,height:72})),fo=styled(C)(({theme:o})=>({width:400,height:40,backgroundColor:o.palette.grey[200],borderRadius:4})),ho=styled(C)(({theme:o})=>({backgroundColor:o.palette.grey[100],flex:1}));var jo=({children:o})=>jsxs(mo,{children:[jsxs(go,{children:[jsx(uo,{children:"Logo"}),jsx(B,{}),jsx(B,{}),jsx(B,{})]}),jsxs(ho,{children:[jsx(Co,{children:jsx(fo,{})}),o]})]}),yo=jo;var ot=({children:o})=>{let{layout:t}=w(),i={horizontal:ro,full:yo,mini:so}[t];return jsx(i,{children:o})},wo=ot;var et=()=>jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{opacity:"0.32",fillRule:"evenodd",clipRule:"evenodd",d:"M1.5 12C1.5 17.799 6.20101 22.5 12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12ZM12.9491 5.80725C12.5501 5.06425 11.4499 5.06425 11.051 5.80725L9.54862 8.60535L6.36352 9.2112C5.54932 9.36605 5.22022 10.319 5.77507 10.9151L8.03362 13.3415L7.61877 16.5888C7.51432 17.4065 8.39427 18.0073 9.15727 17.6394L12 16.2687L14.8428 17.6394C15.6058 18.0073 16.4857 17.4065 16.3813 16.5888L15.9664 13.3415L18.225 10.9151C18.7798 10.319 18.4507 9.36605 17.6365 9.2112L14.4514 8.60535L12.9491 5.80725Z",fill:"currentColor"}),jsx("path",{d:"M11.051 5.80725C11.4499 5.06425 12.5501 5.06425 12.9491 5.80725L14.4514 8.60535L17.6365 9.2112C18.4507 9.36605 18.7798 10.319 18.225 10.9151L15.9664 13.3415L16.3813 16.5888C16.4857 17.4065 15.6058 18.0073 14.8428 17.6394L12 16.2687L9.15727 17.6394C8.39427 18.0073 7.51432 17.4065 7.61877 16.5888L8.03362 13.3415L5.77507 10.9151C5.22022 10.319 5.54932 9.36605 6.36352 9.2112L9.54862 8.60535L11.051 5.80725Z",fill:"currentColor"})]}),bo=et;var it=()=>jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxs("g",{opacity:"0.32",children:[jsx("path",{d:"M21.4286 9.6V5.6C21.4286 5.17565 21.263 4.76869 20.9683 4.46863C20.6736 4.16857 20.2739 4 19.8571 4H18C17.7239 4 17.5 4.22386 17.5 4.5V5.1C17.5 5.37614 17.7239 5.6 18 5.6H19.8571V9.6C19.8588 10.0559 19.9567 10.5061 20.144 10.9201C20.3313 11.3342 20.6038 11.7024 20.943 12C20.6038 12.2976 20.3313 12.6658 20.144 13.0799C19.9567 13.4939 19.8588 13.9441 19.8571 14.4V18.4H18C17.7239 18.4 17.5 18.6239 17.5 18.9V19.5C17.5 19.7761 17.7239 20 18 20H19.8571C20.2739 20 20.6736 19.8314 20.9683 19.5314C21.263 19.2313 21.4286 18.8243 21.4286 18.4V14.4C21.4286 13.9757 21.5941 13.5687 21.8888 13.2686C22.0644 13.0899 22.2772 12.9578 22.5087 12.8802C22.7705 12.7925 23 12.5761 23 12.3V11.7C23 11.4239 22.7705 11.2075 22.5087 11.1198C22.2772 11.0422 22.0644 10.9101 21.8888 10.7314C21.5941 10.4313 21.4286 10.0243 21.4286 9.6Z",fill:"currentColor"}),jsx("path",{d:"M4.14286 9.6V5.6H6C6.27614 5.6 6.5 5.37614 6.5 5.1V4.5C6.5 4.22386 6.27614 4 6 4H4.14286C3.72609 4 3.32639 4.16857 3.03169 4.46863C2.73699 4.76869 2.57143 5.17565 2.57143 5.6V9.6C2.57143 10.0243 2.40587 10.4313 2.11117 10.7314C1.93562 10.9101 1.72281 11.0422 1.49133 11.1198C1.2295 11.2075 1 11.4239 1 11.7V12.3C1 12.5761 1.2295 12.7925 1.49133 12.8802C1.72281 12.9578 1.93562 13.0899 2.11117 13.2686C2.40587 13.5687 2.57143 13.9757 2.57143 14.4V18.4C2.57143 18.8243 2.73699 19.2313 3.03169 19.5314C3.32639 19.8314 3.72609 20 4.14286 20H6C6.27614 20 6.5 19.7761 6.5 19.5V18.9C6.5 18.6239 6.27614 18.4 6 18.4H4.14286V14.4C4.14116 13.9441 4.04333 13.4939 3.856 13.0799C3.66866 12.6658 3.39619 12.2976 3.057 12C3.39619 11.7024 3.66866 11.3342 3.856 10.9201C4.04333 10.5061 4.14116 10.0559 4.14286 9.6Z",fill:"currentColor"})]}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.75 6.5L12.1072 8.85714H13.6072L14.25 6.5H15.75L15.1072 8.85714H16.5V10.4286H14.679L13.8218 13.5714H15.75V15.1429H13.3928L12.75 17.5H11.25L11.8928 15.1429H10.3928L9.75 17.5H8.25L8.89275 15.1429H7.5V13.5714H9.32175L10.179 10.4286H8.25V8.85714H10.6072L11.25 6.5H12.75ZM13.179 10.4286H11.679L10.8217 13.5714H12.3218L13.179 10.4286Z",fill:"currentColor"})]}),ko=it;var vo=styled(C)(({theme:o})=>({padding:"24px 16px 16px",gap:16,width:"100%",flexWrap:"wrap",borderRadius:12,position:"relative",flexDirection:"row",alignItems:"center",justifyContent:"center",backgroundColor:o.palette.background.paper,boxShadow:`0 0 0 1px ${alpha(o.palette.grey[500],.16)}`})),Vo=styled("span")(({theme:o})=>({padding:"2px 8px",top:0,marginLeft:20,left:0,borderRadius:8,position:"absolute",color:o.palette.text.primary,backgroundColor:o.palette.common.white,transform:"translateY(-50%)",fontSize:o.typography.caption.fontSize,fontWeight:600,border:`solid 1px ${alpha(o.palette.grey[500],.24)}`}));var at=({title:o,children:t})=>jsxs(vo,{children:[o&&jsx(Vo,{children:o}),t]}),M=at;var Io=styled(Y,{shouldForwardProp:o=>o!=="selected"})(({theme:o,selected:t})=>({flexShrink:0,borderRadius:8,backgroundColor:o.palette.grey[500],width:10,height:10,opacity:.8,...t&&{opacity:1,background:`linear-gradient(135deg, ${o.palette.primary.light} 0%, ${o.palette.primary.main} 100%)`}})),Ho=styled(Y,{shouldForwardProp:o=>o!=="selected"&&o!=="layout"})(({theme:o,layout:t,selected:e})=>({flexShrink:0,borderRadius:8,backgroundColor:o.palette.grey[500],width:"100%",height:4,opacity:.48,...t==="horizontal"&&{width:16},...e&&{background:`linear-gradient(135deg, ${o.palette.primary.light} 0%, ${o.palette.primary.main} 100%)`}})),Ro=styled(Y,{shouldForwardProp:o=>o!=="selected"})(({theme:o,selected:t,layout:e})=>({flexShrink:0,borderRadius:8,backgroundColor:o.palette.grey[500],width:"100%",height:4,maxWidth:14,opacity:.24,...e==="horizontal"&&{maxWidth:10},...t&&{background:`linear-gradient(135deg, ${o.palette.primary.light} 0%, ${o.palette.primary.main} 100%)`}})),Bo=styled(C,{shouldForwardProp:o=>o!=="layout"})(({theme:o,layout:t})=>({gap:4,flexShrink:0,padding:6,width:32,height:"100%",borderRightWidth:1,borderRightStyle:"solid",borderRightColor:alpha(o.palette.grey[500],.08),...t==="mini"&&{width:22},...t==="horizontal"&&{width:"100%",height:22,borderRight:"none",alignItems:"center",flexDirection:"row",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:alpha(o.palette.grey[500],.08)}})),Mo=styled(s,{shouldForwardProp:o=>o!=="layout"})(({theme:o,layout:t,selected:e})=>({width:"100%",height:64,borderRadius:12,borderWidth:1,borderStyle:"solid",padding:0,borderColor:alpha(o.palette.grey[500],.08),...t==="horizontal"&&{flexDirection:"column"},...e&&{boxShadow:`-8px 8px 20px -4px ${alpha(o.palette.grey[500],.12)}`}})),Wo=styled(C,{shouldForwardProp:o=>o!=="selected"})(({theme:o,selected:t})=>({width:"100%",height:"100%",opacity:.2,borderRadius:6,backgroundColor:o.palette.grey[500],...t&&{background:`linear-gradient(135deg, ${o.palette.primary.light} 0%, ${o.palette.primary.main} 100%)`}}));var A=({title:o,layout:t,selected:e,onClick:i})=>jsx(st,{title:o,children:jsxs(Mo,{variant:e?"soft":void 0,layout:t,selected:e,onClick:i,children:[jsxs(Bo,{layout:t,children:[jsx(Io,{selected:e}),jsx(Ho,{layout:t,selected:e}),jsx(Ro,{selected:e,layout:t})]}),jsx(C,{p:.5,width:1,height:1,flexGrow:1,children:jsx(Wo,{selected:e})})]})});var No=styled(mt)(({theme:o})=>({color:o.palette.grey[600],position:"fixed",bottom:32,right:32}));var bt=()=>{let[o,t]=xt(!1),{control:e,view:i,changeView:m$1,appType:n,changeAppType:a,layout:d,changeLayout:c}=w();return jsxs(Fragment,{children:[e==="on"&&jsx(st,{title:"Configura\xE7\xF5es",children:jsx(No,{onClick:t,children:jsxs(Ct,{component:m.svg,animate:{rotate:360},transition:{duration:8,ease:"linear",repeat:1/0},children:[jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.279 2.152C13.909 2 13.439 2 12.5 2s-1.408 0-1.779.152a2.008 2.008 0 0 0-1.09 1.083c-.094.223-.13.484-.145.863a1.615 1.615 0 0 1-.796 1.353a1.64 1.64 0 0 1-1.579.008c-.338-.178-.583-.276-.825-.308a2.026 2.026 0 0 0-1.49.396c-.318.242-.553.646-1.022 1.453c-.47.807-.704 1.21-.757 1.605c-.07.526.074 1.058.4 1.479c.148.192.357.353.68.555c.477.297.783.803.783 1.361c0 .558-.306 1.064-.782 1.36c-.324.203-.533.364-.682.556a1.99 1.99 0 0 0-.399 1.479c.053.394.287.798.757 1.605c.47.807.704 1.21 1.022 1.453c.424.323.96.465 1.49.396c.242-.032.487-.13.825-.308a1.64 1.64 0 0 1 1.58.008c.486.28.774.795.795 1.353c.015.38.051.64.145.863c.204.49.596.88 1.09 1.083c.37.152.84.152 1.779.152s1.409 0 1.779-.152a2.008 2.008 0 0 0 1.09-1.083c.094-.223.13-.483.145-.863c.02-.558.309-1.074.796-1.353a1.64 1.64 0 0 1 1.579-.008c.338.178.583.276.825.308c.53.07 1.066-.073 1.49-.396c.318-.242.553-.646 1.022-1.453c.47-.807.704-1.21.757-1.605a1.99 1.99 0 0 0-.4-1.479c-.148-.192-.357-.353-.68-.555c-.477-.297-.783-.803-.783-1.361c0-.558.306-1.064.782-1.36c.324-.203.533-.364.682-.556a1.99 1.99 0 0 0 .399-1.479c-.053-.394-.287-.798-.757-1.605c-.47-.807-.704-1.21-1.022-1.453a2.026 2.026 0 0 0-1.49-.396c-.242.032-.487.13-.825.308a1.64 1.64 0 0 1-1.58-.008a1.615 1.615 0 0 1-.795-1.353c-.015-.38-.051-.64-.145-.863a2.007 2.007 0 0 0-1.09-1.083",clipRule:"evenodd",opacity:"0.5"}),jsx("path",{fill:"currentColor",d:"M15.523 12c0 1.657-1.354 3-3.023 3c-1.67 0-3.023-1.343-3.023-3S10.83 9 12.5 9c1.67 0 3.023 1.343 3.023 3"})]})})}),jsx(ut,{open:o&&e==="on",onClose:t,anchor:"right",PaperProps:{sx:{p:2,width:400}},children:jsxs(C,{gap:4,children:[jsxs(C,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[jsx(ht,{variant:"subtitle1",fontWeight:700,children:"Configura\xE7\xF5es"}),jsx(wt,{onClick:t,icon:"CLOSE_MARK_BUTTON",label:"Fechar",color:"grey.500"})]}),jsx(M,{title:"Modo",children:jsxs(C,{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1,width:1,children:[jsx(s,{startIcon:jsx(ko,{}),variant:i==="config"?"contained":void 0,size:"large",fullWidth:!0,onClick:()=>m$1("config"),children:"Admin"}),jsx(s,{startIcon:jsx(bo,{}),variant:i==="app"?"contained":void 0,size:"large",fullWidth:!0,onClick:()=>m$1("app"),children:"Plugin"})]})}),i==="app"&&jsxs(Fragment,{children:[jsx(M,{title:"Tipo de plugin",children:jsxs(C,{display:"grid",gridTemplateColumns:"1fr",gap:1,width:1,children:[jsx(s,{variant:n==="global"?"contained":void 0,onClick:()=>a("global"),children:"Global"}),jsx(s,{variant:n==="new-order"?"contained":void 0,onClick:()=>a("new-order"),children:"Novo pedido"}),jsx(s,{variant:n==="products-list"?"contained":void 0,onClick:()=>a("products-list"),children:"Lista de produtos"}),jsx(s,{variant:n==="products-list-item"?"contained":void 0,onClick:()=>a("products-list-item"),children:"Item da lista de produtos"}),jsx(s,{variant:n==="product-detail"?"contained":void 0,onClick:()=>a("product-detail"),children:"Detalhes do produto"}),jsx(s,{variant:n==="product-detail-actions"?"contained":void 0,onClick:()=>a("product-detail-actions"),children:"A\xE7\xF5es do produto"}),jsx(s,{variant:n==="checkout"?"contained":void 0,onClick:()=>a("checkout"),children:"Checkout"}),jsx(s,{variant:n==="screen"?"contained":void 0,onClick:()=>a("screen"),children:"Tela"})]})}),jsx(M,{title:"Layout",children:jsxs(C,{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:2,width:1,children:[jsx(A,{title:"Layout Mini",layout:"mini",selected:d==="mini",onClick:()=>c("mini")}),jsx(A,{title:"Layout Vertical",layout:"full",selected:d==="full",onClick:()=>c("full")}),jsx(A,{title:"Layout Horizontal",layout:"horizontal",selected:d==="horizontal",onClick:()=>c("horizontal")})]})})]})]})})]})},Oo=bt;var St=({configView:o,appView:t,checkoutView:e,productDetailView:i,newOrderView:m,productDetailActionsView:n,productsListView:a,productsListItemView:d,screenView:c})=>{let{view:P,appType:p}=w(),N=P==="config"?Q:wo,z=useMemo(()=>{if(P==="config")return o;if(p==="global")return t;if(p==="checkout")return e;if(p==="product-detail")return i;if(p==="new-order")return m;if(p==="product-detail-actions")return n;if(p==="products-list")return a;if(p==="products-list-item")return d;if(p==="screen")return c},[P,o,p,t,e,i,m,n,a,d,c]);return jsxs(Fragment,{children:[jsx(N,{children:z}),jsx(kt,{primaryColor:"#000000",children:jsx(Oo,{})})]})},$o=St;var Vt=({appView:o,configView:t,checkoutView:e,productDetailView:i,newOrderView:m,productDetailActionsView:n,productsListView:a,productsListItemView:d,screenView:c})=>jsx(J,{children:jsx($o,{configView:t,appView:o,checkoutView:e,productDetailView:i,newOrderView:m,productDetailActionsView:n,productsListView:a,productsListItemView:d,screenView:c})}),ir=Vt;
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export { ir as default };
|