@vuu-ui/vuu-shell 0.8.12 → 0.8.13
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/cjs/index.js +2 -2
- package/cjs/index.js.map +4 -4
- package/esm/index.js +2 -2
- package/esm/index.js.map +4 -4
- package/index.css +1 -1
- package/index.css.map +3 -3
- package/package.json +9 -9
- package/types/ShellContextProvider.d.ts +6 -2
- package/types/feature/Feature.d.ts +2 -0
- package/types/index.d.ts +1 -0
- package/types/layout-management/SaveLayoutPanel.d.ts +4 -3
- package/types/layout-management/layoutTypes.d.ts +6 -1
- package/types/layout-management/useLayoutManager.d.ts +8 -6
- package/types/left-nav/LeftNav.d.ts +9 -5
- package/types/login/LoginPanel.d.ts +3 -2
- package/types/login/VuuLogo.d.ts +2 -0
- package/types/shell-layouts/index.d.ts +1 -0
- package/types/shell-layouts/side-panel/SidePanel.d.ts +9 -0
- package/types/shell-layouts/side-panel/index.d.ts +1 -0
- package/types/shell-layouts/useFullHeightLeftPanel.d.ts +1 -1
- package/types/shell-layouts/useInlayLeftPanel.d.ts +1 -1
- package/types/shell-layouts/useShellLayout.d.ts +2 -1
- package/types/shell.d.ts +5 -3
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import xt,{useEffect as bt,useState as Nt}from"react";import Ct from"classnames";import{Fragment as Pt,jsx as Mt,jsxs as Me}from"react/jsx-runtime";var $a=({connectionStatus:e,className:t,element:o="span",...a})=>{let[n,r]=Nt("vuuConnectingStatus");bt(()=>{switch(e){case"connected":case"reconnected":r("vuuActiveStatus");break;case"connecting":r("vuuConnectingStatus");break;case"disconnected":r("vuuDisconnectedStatus");break;default:break}},[e]);let u=xt.createElement(o,{...a,className:Ct("vuuStatus vuuIcon",n,t)});return Mt(Pt,{children:Me("div",{className:"vuuStatus-container salt-theme",children:[u,Me("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};import{Dropdown as Et}from"@salt-ds/lab";import{useCallback as Ft}from"react";import Dt from"classnames";import{jsx as Vt}from"react/jsx-runtime";var wt="vuuDensitySwitch",Ht=["high","medium","low","touch"],kt="high",Ka=({className:e,defaultDensity:t=kt,onChange:o})=>{let a=Ft((r,u)=>{o(u)},[o]),n=Dt(wt,e);return Vt(Et,{className:n,source:Ht,defaultSelected:t,onSelectionChange:a})};import we,{Suspense as $t,useEffect as Bt}from"react";import{registerComponent as Ot}from"@vuu-ui/vuu-layout";import Rt from"react";import{Fragment as It,jsx as Ee,jsxs as At}from"react/jsx-runtime";var W=class extends Rt.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(`error creating component at ${this.props.url}`),console.log(t,o)}render(){return this.state.errorMessage?At(It,{children:[Ee("h1",{children:"An error occured while creating component."}),Ee("p",{children:this.state.errorMessage})]}):this.props.children}};import{jsx as Ut}from"react/jsx-runtime";var Fe=()=>Ut("div",{className:"hwLoader",children:"loading"});var De=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};import{jsx as K}from"react/jsx-runtime";var q=new Map,_t=e=>{Bt(()=>()=>{q.delete(e)},[e]),q.has(e)||q.set(e,we.lazy(()=>import(e)));let t=q.get(e);if(t)return t;throw Error(`Unable to load Lazy Feature at url ${e}`)};function Gt({url:e,css:t,ComponentProps:o,...a}){t&&De(t).then(r=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]});let n=_t(e);return K(W,{url:e,children:K($t,{fallback:K(Fe,{}),children:K(n,{...a,...o})})})}var z=we.memo(Gt);z.displayName="Feature";Ot("Feature",z,"view");import{useEffect as Jt,useState as O}from"react";import{Input as Yt,Button as He,FormField as X,FormFieldLabel as Z,Text as Wt}from"@salt-ds/core";import{ComboBox as qt,Checkbox as Kt,RadioButton as zt}from"@vuu-ui/vuu-ui-controls";import{formatDate as Xt,takeScreenshot as Zt}from"@vuu-ui/vuu-utils";import{jsx as L,jsxs as k}from"react/jsx-runtime";var x="saveLayoutPanel",Q=`${x}-formField`,Qt=["Group 1","Group 2","Group 3","Group 4","Group 5"],jt=["Value 1","Value 2","Value 3"],ke=["Value 1","Value 2","Value 3"],Nr=e=>{let{onCancel:t,onSave:o,componentId:a}=e,[n,r]=O(""),[u,d]=O(""),[s,i]=O([]),[l,f]=O(ke[0]),[p,h]=O();Jt(()=>{a&&Zt(document.getElementById(a)).then(m=>h(m))},[a]);let g=()=>{o({name:n,group:u,screenshot:p!=null?p:"",user:"User",date:Xt(new Date,"dd.mm.yyyy")})};return k("div",{className:`${x}-panelContainer`,children:[k("div",{className:`${x}-panelContent`,children:[k("div",{className:`${x}-formContainer`,children:[k(X,{className:Q,children:[L(Z,{children:"Group"}),L(qt,{source:Qt,allowFreeText:!0,InputProps:{inputProps:{className:`${x}-inputText`,placeholder:"Select Group or Enter New Name",onChange:m=>d(m.target.value)}},width:"100%",onSelectionChange:(m,b)=>d(b||"")})]}),k(X,{className:Q,children:[L(Z,{children:"Layout Name"}),L(Yt,{inputProps:{className:`${x}-inputText`,placeholder:"Enter Layout Name"},onChange:m=>r(m.target.value),value:n})]}),k(X,{className:Q,children:[L(Z,{children:"Some Layout Setting"}),L("div",{className:`${x}-settingsGroup`,children:jt.map((m,b)=>L(Kt,{onToggle:()=>i(P=>P.includes(m)?P.filter(R=>R!==m):[...P,m]),checked:s.includes(m),label:m},b))})]}),k(X,{className:Q,children:[L(Z,{children:"Some Layout Setting"}),L("div",{className:`${x}-settingsGroup`,children:ke.map((m,b)=>L(zt,{onClick:()=>f(m),checked:l===m,label:m,groupName:"radioGroup"},b))})]})]}),L("div",{className:`${x}-screenshotContainer`,children:p?L("img",{className:`${x}-screenshot`,src:p,alt:"screenshot of current layout"}):L(Wt,{className:"screenshot",children:"No screenshot available"})})]}),k("div",{className:`${x}-buttonsContainer`,children:[L(He,{className:`${x}-cancelButton`,onClick:t,children:"Cancel"}),L(He,{className:`${x}-saveButton`,onClick:g,disabled:n===""||u==="",children:"Save"})]})]})};import{List as io}from"@vuu-ui/vuu-ui-controls";import eo,{useState as Ve,useCallback as j,useContext as to,useEffect as oo,useRef as ao}from"react";import{LocalLayoutPersistenceManager as ro,resolveJSONPath as no}from"@vuu-ui/vuu-layout";import{defaultLayout as ce}from"@vuu-ui/vuu-layout/";import{jsx as so}from"react/jsx-runtime";var _=new ro,Re=eo.createContext({layoutMetadata:[],saveLayout:()=>{},applicationLayout:ce,saveApplicationLayout:()=>{},loadLayoutById:()=>ce}),wr=e=>{let[t,o]=Ve([]),[,a]=Ve({}),n=ao(ce),r=j((i,l=!0)=>{n.current=i,l&&a({})},[]);oo(()=>{_.loadMetadata().then(i=>{o(i)}),_.loadApplicationLayout().then(i=>{r(i)})},[r]);let u=j(i=>{r(i,!1),_.saveApplicationLayout(i)},[r]),d=j(i=>{let l=no(n.current,"#main-tabs.ACTIVE_CHILD");l&&_.createLayout(i,l).then(f=>{let p={...i,id:f};o(h=>[...h,p])})},[]),s=j(i=>{_.loadLayout(i).then(l=>{var p,h;let{current:f}=n;r({...f,active:(h=(p=f.children)==null?void 0:p.length)!=null?h:0,children:[...f.children||[],l]})})},[r]);return so(Re.Provider,{value:{layoutMetadata:t,saveLayout:d,applicationLayout:n.current,saveApplicationLayout:u,loadLayoutById:s},children:e.children})},ee=()=>to(Re);import{Fragment as Ie,jsx as V,jsxs as te}from"react/jsx-runtime";var I="vuuLayoutList",Ae=e=>{let{layoutMetadata:t,loadLayoutById:o}=ee(),a=r=>{r&&o(r)},n=t.reduce((r,u)=>r[u.group]?{...r,[u.group]:[...r[u.group],u]}:{...r,[u.group]:[u]},{});return te("div",{className:I,...e,children:[V("div",{className:`${I}-header`,children:"My Layouts"}),V(io,{height:"auto",source:Object.entries(n),ListItem:({item:r})=>{if(!r)return V(Ie,{});let[u,d]=r;return te(Ie,{children:[V("div",{className:`${I}-groupName`,children:u}),d.map(s=>te("div",{className:`${I}-layoutContainer`,onClick:()=>a(s==null?void 0:s.id),children:[V("img",{className:`${I}-screenshot`,src:s==null?void 0:s.screenshot}),te("div",{children:[V("div",{className:`${I}-layoutName`,children:s==null?void 0:s.name}),V("div",{className:`${I}-layoutDetails`,children:V("div",{children:`${s==null?void 0:s.user}, ${s==null?void 0:s.date}`})})]})]},s==null?void 0:s.id))]})}})]})};import{VuuLogo as xo}from"@vuu-ui/vuu-icons";import{Action as $e,Stack as bo,useLayoutProviderDispatch as No}from"@vuu-ui/vuu-layout";import{Tab as J,Tabstrip as Co}from"@vuu-ui/vuu-ui-controls";import he from"classnames";import{useCallback as ae,useState as Po}from"react";import{Palette as uo,PaletteItem as lo}from"@vuu-ui/vuu-layout";import{jsx as G,jsxs as co}from"react/jsx-runtime";var me="vuuFeatureList",de=({features:e,title:t="VUU TABLES",...o})=>{let a={},n={height:"100%"};return co("div",{...o,className:me,children:[G("div",{className:`${me}-header`,children:t}),G("div",{className:`${me}-content`,children:G(uo,{orientation:"vertical",ListProps:n,ViewProps:a,children:e.map((r,u)=>G(lo,{closeable:!0,label:r.title,resizeable:!0,resize:"defer",header:!0,children:G(z,{...r})},u))})})]})};import{createContext as mo,isValidElement as po,cloneElement as fo,useContext as Ue}from"react";import ho from"classnames";import{jsx as So}from"react/jsx-runtime";var go="medium",yo="salt-theme",vo="light",pe=mo({density:"high",theme:"vuu",themeMode:"light"}),Lo=["vuu","vuu-density-high","light"],oe=e=>{let t=Ue(pe);return e?[e.themeClass,e.densityClass,e.dataMode]:t?[`${t.theme}-theme`,`${t.theme}-density-${t.density}`,t.themeMode]:Lo},To=(e,t,o,a)=>{var n;return po(e)?fo(e,{className:ho((n=e.props)==null?void 0:n.className,`${t}-theme`,`${t}-density-${a}`),"data-mode":o}):(console.warn(`
|
|
1
|
+
import{useCallback as ko}from"react";import Fo from"classnames";import{Toolbar as $o}from"@vuu-ui/vuu-layout";import{useCallback as it,useEffect as So,useRef as No,useState as at}from"react";import{Button as Ro,FormField as ut,FormFieldLabel as lt}from"@salt-ds/core";import{VuuInput as ct}from"@vuu-ui/vuu-ui-controls";import{useMemo as wo}from"react";import{jsx as H,jsxs as Z}from"react/jsx-runtime";var st=()=>wo(()=>Z("svg",{width:"184",height:"90",viewBox:"0 0 184 90",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Z("g",{clipPath:"url(#clip0_1173_59965)",children:[H("path",{d:"M77.0775 31.1019L69.4572 15.1795L66.3997 13.7093L47.6353 44.165L75.7224 61.2361L81.8124 51.2694L77.0775 31.1019Z",fill:"url(#paint0_linear_1173_59965)"}),H("path",{d:"M82.4101 49.7431C81.0488 51.8314 79.1993 53.648 76.8897 54.9809C74.2954 56.4792 71.4601 57.194 68.6623 57.194C63.3422 57.194 58.1597 54.6188 55.0209 49.971L30.5358 7.8193L30.5232 7.84116C25.8791 0.274825 16.0118 -2.26289 8.27258 2.21011C0.411306 6.74866 -2.26753 16.7872 2.28587 24.625L35.5054 81.8189C36.9856 84.3691 39.0542 86.3668 41.4358 87.7527C41.4545 87.7652 41.4733 87.7777 41.4921 87.7902C41.5015 87.7964 41.514 87.8027 41.5234 87.8089C42.6312 88.4457 43.8079 88.942 45.0253 89.3072C45.116 89.3353 45.2099 89.3634 45.3007 89.3883C45.7388 89.5101 46.1801 89.6193 46.6276 89.7067C46.7121 89.7223 46.7966 89.7317 46.8811 89.7473C47.241 89.8097 47.604 89.8628 47.967 89.9003C48.111 89.9159 48.2549 89.9315 48.3989 89.9408C48.8151 89.9752 49.2313 89.997 49.6507 90.0001C49.6726 90.0001 49.6945 90.0001 49.7132 90.0001C49.7195 90.0001 49.7226 90.0001 49.7289 90.0001C49.7352 90.0001 49.7383 90.0001 49.7445 90.0001C50.1983 90.0001 50.6552 89.9752 51.109 89.9377C51.2123 89.9283 51.3155 89.919 51.422 89.9065C51.8663 89.8597 52.3107 89.8004 52.7551 89.7192C52.7614 89.7192 52.7676 89.7192 52.7739 89.7192C53.2621 89.6287 53.7503 89.5101 54.2322 89.3727C54.2635 89.3634 54.2917 89.354 54.323 89.3446C55.024 89.1418 55.7156 88.8889 56.3978 88.5861C56.4104 88.5799 56.426 88.5736 56.4385 88.5674C56.958 88.3364 57.4712 88.0836 57.9751 87.7933C58.4852 87.4999 58.9703 87.1815 59.4334 86.8413C59.8371 86.5478 60.2252 86.2357 60.6039 85.9048C61.0639 85.499 61.4989 85.0745 61.9026 84.6282C62.2062 84.2942 62.4972 83.9446 62.7757 83.5825C62.8665 83.4639 62.951 83.3421 63.0355 83.2235C63.2264 82.9613 63.4079 82.6929 63.5831 82.4182C63.6739 82.2746 63.7646 82.1342 63.8523 81.9906C63.8867 81.9344 63.9242 81.8813 63.9555 81.8251L82.5854 49.7525H82.4039L82.4101 49.7431Z",fill:"url(#paint1_linear_1173_59965)"}),H("path",{d:"M82.8264 32.8436L81.4181 30.4464L75.3375 19.1687L72.5178 14.3929C71.9858 13.1225 70.7309 12.2266 69.26 12.2266C67.3104 12.2266 65.7331 13.8029 65.7331 15.7445C65.7331 16.4031 65.924 17.0086 66.2401 17.5362L66.2025 17.5611L77.1557 36.1617C78.4764 38.4372 78.83 41.0873 78.1509 43.6281C77.4718 46.169 75.8445 48.2915 73.5631 49.6119C72.0609 50.4797 70.3553 50.9385 68.6341 50.9385C65.1166 50.9385 61.84 49.0563 60.0812 46.0285L44.3368 19.2654H44.3681L37.7179 7.81917L37.7054 7.84102C37.5896 7.65061 37.455 7.47893 37.333 7.29477L37.1452 6.97326C37.1452 6.97326 37.1296 6.98262 37.1233 6.98887C34.0001 2.55332 29.0054 0.0780356 23.8512 0.0187285V0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C79.1961 53.651 81.0425 51.8312 82.407 49.7461H82.5885L82.5259 49.8523C83.399 48.4695 84.0687 46.9462 84.5006 45.3231C85.6304 41.0904 85.042 36.6705 82.8201 32.8467L82.8264 32.8436Z",fill:"#F37880"}),Z("g",{opacity:"0.86",children:[H("path",{d:"M66.1994 17.5642L77.1526 36.1648C78.4732 38.4403 78.8269 41.0904 78.1478 43.6313C77.7347 45.1795 76.9648 46.5716 75.9133 47.7234C77.2903 46.4686 78.2823 44.8486 78.7737 43.007C79.4527 40.4661 79.0991 37.816 77.7785 35.5405L66.8253 16.94L66.8628 16.915C66.5467 16.3875 66.3558 15.7819 66.3558 15.1233C66.3558 14.3117 66.6344 13.5657 67.0975 12.9695C66.2651 13.6125 65.7299 14.6176 65.7299 15.7476C65.7299 16.4062 65.9208 17.0118 66.2369 17.5393L66.1994 17.5642Z",fill:"white"}),H("path",{d:"M82.5382 49.8335L82.5291 49.8487C82.5291 49.8487 82.5352 49.8365 82.5413 49.8304C82.5413 49.8304 82.5413 49.8304 82.5413 49.8335H82.5382Z",fill:"white"}),H("path",{d:"M77.5156 54.3596C74.9213 55.8579 72.0859 56.5727 69.2882 56.5727C63.9681 56.5727 58.7856 53.9975 55.6467 49.3497L31.1616 7.19488L31.1491 7.21673C28.9053 3.56154 25.4441 1.08626 21.5917 0H15.3515V0.0436999C21.2881 -0.368328 27.2247 2.46593 30.5232 7.84102L30.5357 7.81917L55.0177 49.974C58.1566 54.6187 63.3422 57.197 68.6592 57.197C71.4569 57.197 74.2922 56.4853 76.8866 54.9839C78.2698 54.1848 79.4809 53.2109 80.5293 52.1122C79.6311 52.9581 78.6266 53.7166 77.5125 54.3596H77.5156Z",fill:"white"})]})]}),H("path",{d:"M117.046 58.661C116.362 58.661 115.792 58.509 115.336 58.205C114.906 57.8757 114.551 57.3943 114.272 56.761L104.354 34.493C104.076 33.8597 104 33.3023 104.126 32.821C104.253 32.3397 104.519 31.9597 104.924 31.681C105.33 31.4023 105.811 31.263 106.368 31.263C107.103 31.263 107.648 31.4277 108.002 31.757C108.382 32.061 108.699 32.5297 108.952 33.163L117.958 54.025H116.324L125.292 33.125C125.571 32.517 125.9 32.061 126.28 31.757C126.66 31.4277 127.192 31.263 127.876 31.263C128.434 31.263 128.89 31.4023 129.244 31.681C129.624 31.9597 129.865 32.3397 129.966 32.821C130.068 33.3023 129.979 33.8597 129.7 34.493L119.782 56.761C119.504 57.3943 119.149 57.8757 118.718 58.205C118.313 58.509 117.756 58.661 117.046 58.661Z",fill:"white"}),H("path",{d:"M144.63 58.737C142.781 58.737 141.147 58.4963 139.728 58.015C138.335 57.5337 137.157 56.8243 136.194 55.887C135.232 54.9243 134.51 53.7337 134.028 52.315C133.547 50.8963 133.306 49.2497 133.306 47.375V33.733C133.306 32.897 133.509 32.2763 133.914 31.871C134.345 31.4657 134.953 31.263 135.738 31.263C136.524 31.263 137.119 31.4657 137.524 31.871C137.955 32.2763 138.17 32.897 138.17 33.733V47.337C138.17 49.7437 138.715 51.555 139.804 52.771C140.919 53.9617 142.528 54.557 144.63 54.557C146.733 54.557 148.329 53.9617 149.418 52.771C150.508 51.555 151.052 49.7437 151.052 47.337V33.733C151.052 32.897 151.255 32.2763 151.66 31.871C152.091 31.4657 152.699 31.263 153.484 31.263C154.244 31.263 154.827 31.4657 155.232 31.871C155.663 32.2763 155.878 32.897 155.878 33.733V47.375C155.878 49.8577 155.448 51.9477 154.586 53.645C153.75 55.3423 152.496 56.6217 150.824 57.483C149.152 58.319 147.088 58.737 144.63 58.737Z",fill:"white"}),H("path",{d:"M172.685 58.737C170.836 58.737 169.202 58.4963 167.783 58.015C166.39 57.5337 165.212 56.8243 164.249 55.887C163.286 54.9243 162.564 53.7337 162.083 52.315C161.602 50.8963 161.361 49.2497 161.361 47.375V33.733C161.361 32.897 161.564 32.2763 161.969 31.871C162.4 31.4657 163.008 31.263 163.793 31.263C164.578 31.263 165.174 31.4657 165.579 31.871C166.01 32.2763 166.225 32.897 166.225 33.733V47.337C166.225 49.7437 166.77 51.555 167.859 52.771C168.974 53.9617 170.582 54.557 172.685 54.557C174.788 54.557 176.384 53.9617 177.473 52.771C178.562 51.555 179.107 49.7437 179.107 47.337V33.733C179.107 32.897 179.31 32.2763 179.715 31.871C180.146 31.4657 180.754 31.263 181.539 31.263C182.299 31.263 182.882 31.4657 183.287 31.871C183.718 32.2763 183.933 32.897 183.933 33.733V47.375C183.933 49.8577 183.502 51.9477 182.641 53.645C181.805 55.3423 180.551 56.6217 178.879 57.483C177.207 58.319 175.142 58.737 172.685 58.737Z",fill:"white"}),Z("defs",{children:[Z("linearGradient",{id:"paint0_linear_1173_59965",x1:"47.6353",y1:"37.4727",x2:"81.8124",y2:"37.4727",gradientUnits:"userSpaceOnUse",children:[H("stop",{stopColor:"#4906A5"}),H("stop",{offset:"1",stopColor:"#D3423A"})]}),Z("linearGradient",{id:"paint1_linear_1173_59965",x1:"0.0670626",y1:"45.0017",x2:"82.5916",y2:"45.0017",gradientUnits:"userSpaceOnUse",children:[H("stop",{stopColor:"#7C06A5"}),H("stop",{offset:"1",stopColor:"#D3423A"})]}),H("clipPath",{id:"clip0_1173_59965",children:H("rect",{width:"85",height:"90",fill:"white",transform:"translate(0.0670471)"})})]})]}),[]);import Ho from"classnames";import{jsx as V,jsxs as ee}from"react/jsx-runtime";var _="vuuLoginPanel",ui=({appName:e="Demo App",className:t,requirePassword:o=!0,onSubmit:n,...s})=>{let[r,a]=at(""),[l,i]=at(""),c=No(null),f=()=>{n(r,l)},M=m=>{a(m.target.value)},h=m=>{i(m.target.value)},d=it(()=>{o||n(r)},[n,o,r]),g=it(()=>{r&&n(r,l)},[n,l,r]),p=r.trim()!==""&&(o===!1||l.trim()!=="");return So(()=>{var m;console.log("inputRef",{input:c.current}),(m=c.current)==null||m.focus()},[]),ee("div",{...s,className:Ho(_,t),children:[ee("div",{className:`${_}-branding`,children:[V(st,{}),V("div",{className:`${_}-appName`,children:e})]}),ee("div",{className:`${_}-form`,children:[V("div",{className:`${_}-title`,children:"Welcome Back"}),ee(ut,{children:[V(lt,{children:"Username"}),V(ct,{value:r,id:"text-username",inputRef:c,onChange:M,onCommit:d})]}),o?ee(ut,{children:[V(lt,{children:"Password"}),V(ct,{className:`${_}-password`,inputProps:{type:"password"},value:l,id:"text-password",onChange:h,onCommit:g,endAdornment:V("span",{"data-icon":"eye",style:{cursor:"pointer"}})})]}):null,V(Ro,{className:`${_}-login`,disabled:!p,onClick:f,variant:"cta",children:"Login"})]})]})};import{getCookieValue as we}from"@vuu-ui/vuu-utils";var Do=()=>{let e=we("vuu-auth-mode");return e!=null?e:""},di=()=>{let e=we("vuu-username"),t=we("vuu-auth-token");return[e,t]},Ao=()=>Do()==="login"?"login.html":"demo.html",Io=(e=Ao())=>{window.location.href=e},pt=e=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",Io(e)};import{Button as ie}from"@salt-ds/core";import{jsx as ae,jsxs as Se}from"react/jsx-runtime";var te="vuuAppHeader",dt=({className:e,layoutId:t,loginUrl:o,onNavigate:n,onSwitchTheme:s,themeMode:r="light",user:a,...l})=>{let i=Fo(te,e),c=ko(()=>{pt(o)},[o]);return Se($o,{alignItems:"end",className:i,height:36,showSeparators:!0,...l,children:[ae(ie,{className:`${te}-menuItem`,variant:"secondary",children:"Help"}),Se(ie,{className:`${te}-menuItem`,variant:"secondary",children:["History ",ae("span",{"data-icon":"history"})]}),Se(ie,{className:`${te}-menuItem`,variant:"secondary",children:["View ",ae("span",{"data-icon":"settings"})]}),ae(ie,{className:`${te}-menuItem`,onClick:c,variant:"secondary",children:"Log out"})]})};import Bo,{useEffect as Vo,useState as Oo}from"react";import Uo from"classnames";import{Fragment as Ko,jsx as Go,jsxs as mt}from"react/jsx-runtime";var ki=({connectionStatus:e,className:t,element:o="span",...n})=>{let[s,r]=Oo("vuuConnectingStatus");Vo(()=>{switch(e){case"connected":case"reconnected":r("vuuActiveStatus");break;case"connecting":r("vuuConnectingStatus");break;case"disconnected":r("vuuDisconnectedStatus");break;default:break}},[e]);let a=Bo.createElement(o,{...n,className:Uo("vuuStatus vuuIcon",s,t)});return Go(Ko,{children:mt("div",{className:"vuuStatus-container salt-theme",children:[a,mt("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};import{Dropdown as Jo}from"@salt-ds/lab";import{useCallback as _o}from"react";import zo from"classnames";import{jsx as Xo}from"react/jsx-runtime";var Wo="vuuDensitySwitch",qo=["high","medium","low","touch"],Zo="high",Ji=({className:e,defaultDensity:t=Zo,onChange:o})=>{let n=_o((r,a)=>{o(a)},[o]),s=zo(Wo,e);return Xo(Jo,{className:s,source:qo,defaultSelected:t,onSelectionChange:n})};import yt,{Suspense as tn,useEffect as on}from"react";import{registerComponent as nn}from"@vuu-ui/vuu-layout";import Yo from"react";import{Fragment as Qo,jsx as ft,jsxs as jo}from"react/jsx-runtime";var ue=class extends Yo.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(`error creating component at ${this.props.url}`),console.log(t,o)}render(){return this.state.errorMessage?jo(Qo,{children:[ft("h1",{children:"An error occured while creating component."}),ft("p",{children:this.state.errorMessage})]}):this.props.children}};import{jsx as en}from"react/jsx-runtime";var ht=()=>en("div",{className:"hwLoader"});var gt=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};import{jsx as ce}from"react/jsx-runtime";var le=new Map,rn=e=>{on(()=>()=>{le.delete(e)},[e]),le.has(e)||le.set(e,yt.lazy(()=>import(e)));let t=le.get(e);if(t)return t;throw Error(`Unable to load Lazy Feature at url ${e}`)};function sn({url:e,css:t,ComponentProps:o,...n}){t&>(t).then(r=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]});let s=rn(e);return ce(ue,{url:e,children:ce(tn,{fallback:ce(ht,{}),children:ce(s,{...n,...o})})})}var pe=yt.memo(sn);pe.displayName="Feature";nn("Feature",pe,"view");import{useEffect as an,useState as oe}from"react";import{Input as un,Button as vt,FormField as de,FormFieldLabel as me,Text as ln}from"@salt-ds/core";import{ComboBox as cn,Checkbox as pn,RadioButton as dn}from"@vuu-ui/vuu-ui-controls";import{takeScreenshot as mn}from"@vuu-ui/vuu-utils";import{jsx as D,jsxs as K}from"react/jsx-runtime";var A="saveLayoutPanel",fe=`${A}-formField`,fn=["Group 1","Group 2","Group 3","Group 4","Group 5"],hn=["Value 1","Value 2","Value 3"],Ct=["Value 1","Value 2","Value 3"],ba=e=>{let{defaultTitle:t="",onCancel:o,onSave:n,componentId:s}=e,[r,a]=oe(t),[l,i]=oe(""),[c,f]=oe([]),[M,h]=oe(Ct[0]),[d,g]=oe();an(()=>{s&&mn(document.getElementById(s)).then(m=>g(m))},[s]);let p=()=>{n({name:r,group:l,screenshot:d!=null?d:"",user:"User"})};return K("div",{className:`${A}-panelContainer`,children:[K("div",{className:`${A}-panelContent`,children:[K("div",{className:`${A}-formContainer`,children:[K(de,{className:fe,children:[D(me,{children:"Group"}),D(cn,{source:fn,allowFreeText:!0,InputProps:{inputProps:{className:`${A}-inputText`,placeholder:"Select Group or Enter New Name",onChange:m=>i(m.target.value)}},width:"100%",onSelectionChange:(m,P)=>i(P||"")})]}),K(de,{className:fe,children:[D(me,{children:"Layout Name"}),D(un,{inputProps:{className:`${A}-inputText`,placeholder:"Enter Layout Name"},onChange:m=>a(m.target.value),value:r})]}),K(de,{className:fe,children:[D(me,{children:"Some Layout Setting"}),D("div",{className:`${A}-settingsGroup`,children:hn.map((m,P)=>D(pn,{onToggle:()=>f(S=>S.includes(m)?S.filter(w=>w!==m):[...S,m]),checked:c.includes(m),label:m},P))})]}),K(de,{className:fe,children:[D(me,{children:"Some Layout Setting"}),D("div",{className:`${A}-settingsGroup`,children:Ct.map((m,P)=>D(dn,{onClick:()=>h(m),checked:M===m,label:m,groupName:"radioGroup"},P))})]})]}),D("div",{className:`${A}-screenshotContainer`,children:d?D("img",{className:`${A}-screenshot`,src:d,alt:"screenshot of current layout"}):D(ln,{className:"screenshot",children:"No screenshot available"})})]}),K("div",{className:`${A}-buttonsContainer`,children:[D(vt,{className:`${A}-cancelButton`,onClick:o,children:"Cancel"}),D(vt,{className:`${A}-saveButton`,onClick:p,disabled:r===""||l==="",children:"Save"})]})]})};import{List as Fr}from"@vuu-ui/vuu-ui-controls";import Er,{useCallback as z,useContext as wr,useEffect as Sr,useRef as Nr,useState as Xt}from"react";import{loadingApplicationJson as Rr,LocalLayoutPersistenceManager as Hr,resolveJSONPath as Dr,defaultApplicationJson as Ar}from"@vuu-ui/vuu-layout";import{Scrim as En}from"@salt-ds/lab";import wn from"classnames";import{useCallback as Sn,useRef as Nn}from"react";import{useLayoutEffect as Mt,useRef as gn,useState as yn}from"react";import{createPortal as vn}from"react-dom";function Cn(e){return typeof e=="function"?e():e}var Mn="vuu-portal-root",X=({children:e,container:t=document.body,id:o=Mn,onRender:n,open:s=!0,themeAttributes:r})=>{var d;let[a,l]=yn(!1),i=gn(null),c=(d=Cn(t))!=null?d:document.body,[f,M,h]=G(r);return Mt(()=>{let g=document.getElementById(o);g?i.current=g:(i.current=document.createElement("div"),i.current.id=o);let p=i.current;c.contains(p)||c.appendChild(p),p.classList.add(f,M),p.dataset.mode=h,l(!0)},[o,c,f,M,h]),Mt(()=>{requestAnimationFrame(()=>{n==null||n()})},[n]),s&&a&&i.current&&e?vn(e,i.current):null};import{Button as bn,Text as xn}from"@salt-ds/core";import Ln from"classnames";import{jsx as bt,jsxs as Tn}from"react/jsx-runtime";var Pn="vuuDialogHeader",xt=({hideCloseButton:e=!1,title:t,onClose:o,...n})=>Tn("div",{...n,className:Ln(Pn,"vuuToolbarProxy"),children:[bt(xn,{className:"dialogHeader",children:t}),!e&&bt(bn,{onClick:o,"data-align":"end","data-icon":"close",variant:"secondary"},"close")]});import{jsx as he,jsxs as Rn}from"react/jsx-runtime";var Ne="vuuDialog",Lt=({children:e,className:t,isOpen:o=!1,onClose:n,title:s,hideCloseButton:r=!1,...a})=>{let l=Nn(null),i=Sn(()=>{n==null||n()},[n]);return o?he(X,{children:he(En,{className:`${Ne}-scrim`,open:o,autoFocusRef:l,children:Rn("div",{...a,className:wn(Ne,t),ref:l,children:[he(xt,{hideCloseButton:r,onClose:i,title:s}),he("div",{className:`${Ne}-body`,children:e})]})})}):null};import{useCallback as Hn,useState as Dn}from"react";import{jsx as An}from"react/jsx-runtime";var Pt=()=>{let[e,t]=Dn(),o=Hn(()=>{t(void 0)},[]);return{dialog:e?An(Lt,{className:"vuDialog",isOpen:!0,onClose:o,style:{maxHeight:500},title:e.title,hideCloseButton:e.hideCloseButton,children:e.content}):null,setDialogState:t}};import{useCallback as Kt,useRef as Be}from"react";import kt,{useLayoutEffect as qn,useMemo as Zn,useRef as Xn}from"react";import Ft from"classnames";import{useId as Yn}from"@vuu-ui/vuu-layout";import{useCallback as ge,useMemo as Un,useRef as Re,useState as Kn}from"react";var Tt=e=>e.closest("[data-root='true']")!==null,Et=(e,t)=>{var o;return e.ariaHasPopup==="true"&&((o=e.dataset)==null?void 0:o.idx)===`${t}`||e.querySelector(`:scope > [data-index='${t}'][aria-haspopup='true']`)!==null};function In(e,...t){let o=new Set(e);for(let n of t)for(let s of n)o.add(s);return o}var kn="Enter";var Fn="Delete",$n=new Set([kn,Fn]),Bn=new Set(["Tab"]),Vn=new Set(["ArrowRight","ArrowLeft"]),wt=new Set(["Home","End","ArrowDown","ArrowUp"]),St=new Set(["Home","End","ArrowRight","ArrowLeft"]),On=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),cu=In($n,St,wt,Vn,On,Bn);var Nt=({key:e},t="vertical")=>(t==="vertical"?wt:St).has(e);import{isValidNumber as He}from"@vuu-ui/vuu-utils";var Rt=({autoHighlightFirstItem:e=!1,count:t,defaultHighlightedIdx:o,highlightedIndex:n,onActivate:s,onHighlight:r,onCloseMenu:a,onOpenMenu:l})=>{var N;if(He(n)&&He(o))throw Error("useKeyboardNavigation do not pass values for both highlightedIndex and defaultHighlightedIdx");let i=He(n),c=Re((N=o!=null?o:n)!=null?N:e?0:-1),[,f]=Kn(null),M=ge(L=>{c.current=L,r==null||r(L),f({})},[r]),h=ge(L=>{L!==c.current&&(i||M(L))},[i,M]),d=Re(!0),g=Re(!1),p=L=>g.current=L,m=i?n:c.current,P=ge(L=>{let y=Gn(t,L.key,c.current);y!==c.current&&h(y)},[t,h]),S=ge(L=>{if(Nt(L))L.preventDefault(),L.stopPropagation(),d.current=!0,P(L);else if((L.key==="ArrowRight"||L.key==="Enter")&&Et(L.target,m)){let v=L.target.querySelector(`:scope > [data-index='${m}']`);v&&(l==null||l(v,!0))}else L.key==="ArrowLeft"&&!Tt(L.target)?a(m):L.key==="Enter"?(L.preventDefault(),L.stopPropagation(),s&&s(m)):L.key==="Tab"&&a(-1)},[m,P,s,a,l]),w=Un(()=>({onFocus:()=>{m===-1&&M(0)},onKeyDown:S,onMouseDownCapture:()=>{d.current=!1,p(!0)},onMouseMove:()=>{d.current&&(d.current=!1)},onMouseLeave:()=>{d.current=!0,p(!1),h(-1)}}),[S,m,M,h]);return{focusVisible:d.current?m:-1,controlledHighlighting:i,highlightedIndex:m,setHighlightedIndex:h,listProps:w,setIgnoreFocus:p}};function Gn(e,t,o){return t==="ArrowUp"?o>0?o-1:o:o===null?0:o===e-1?o:o+1}import Ht,{useCallback as Jn,useMemo as _n}from"react";var De=e=>e.type===Ae||!!e.props["data-group"],zn=e=>{if(Array.isArray(e)&&Ie(e[0]))return e[0]},Wn=(e,t,o,n=!1)=>{let{props:{children:s}}=e;return{childWithId:Ht.cloneElement(e,{hasSeparator:n,id:`${t}`,key:t,children:o?zn(s):s}),grandChildren:o?s:void 0}},Dt=(e,t)=>{let o=Jn(()=>{let r=(a,l=t,i={},c={})=>{let f=i[l]=[],M=0,h=!1;return Ht.Children.forEach(a,d=>{if(!Ie(d))if(d.type===At)h=!0;else{let g=De(d),p=`${l}-${M}`,{props:{action:m,options:P}}=d,{childWithId:S,grandChildren:w}=Wn(d,p,g,h);f.push(S),w?r(w,p,i,c):c[p]={action:m,options:P},M+=1,h=!1}}),[i,c]};return r(e)},[t,e]),[n,s]=_n(()=>o(),[o]);return[n,s]};import{Fragment as tr,jsx as Y}from"react/jsx-runtime";var It="vuuMenuList",At=()=>Y("li",{className:"vuuMenuItem-divider"}),Ae=()=>null,ke=({children:e,idx:t,options:o,...n})=>Y("div",{...n,children:e}),$t=({children:e})=>Y(tr,{children:e});$t.displayName="MenuItemLabel";ke.Label=$t;var Qn=e=>kt.isValidElement(e)&&typeof e.type!="string"&&"displayName"in e.type?e.type.displayName:void 0,Ie=e=>Qn(e)==="MenuItemLabel",jn=e=>e.props["data-icon"],Fe=({activatedByKeyboard:e,childMenuShowing:t,children:o,className:n,defaultHighlightedIdx:s,highlightedIdx:r,id:a,isRoot:l,listItemProps:i,onHighlightMenuItem:c,onActivate:f,onCloseMenu:M,openMenu:h,...d})=>{let g=Yn(a),p=Xn(null),m=Zn(()=>new Map,[]),P=C=>{var b;let u=(b=p.current)==null?void 0:b.querySelector(`:scope > [data-index='${C}']`);u!=null&&u.id&&(f==null||f(u.id))},{focusVisible:S,highlightedIndex:w,listProps:N}=Rt({count:kt.Children.count(o),defaultHighlightedIdx:s,highlightedIndex:r,onActivate:P,onHighlight:c,onOpenMenu:h,onCloseMenu:M}),L=t==null?S:-1;qn(()=>{var C;t===void 0&&e&&((C=p.current)==null||C.focus())},[e,t]);let y=()=>w===void 0||w===-1?void 0:m.get(w);function v(){let C={...i,role:"menuitem"},u=(E,x,R)=>x?[Y("span",{className:"vuuIconContainer","data-icon":R},"icon")].concat(E):E;function b(E,x,R,k){var rt;let{children:B,className:Lo,"data-icon":ot,id:se,hasSeparator:Po,label:Te,...To}=x.props,Ee=De(x),nt=Ee&&t===se,Eo=nt?`${g}-${se}`:void 0;E.push(Y(ke,{...To,...C,...er(se,R,(rt=x.key)!=null?rt:se,w,L,Lo,Po),"aria-controls":Eo,"aria-haspopup":Ee||void 0,"aria-expanded":nt||void 0,children:u(Ee&&Te!=null?Te:B,k,ot)}))}let T=[];if(o.length>0){let E=o.some(jn);o.forEach((x,R)=>{b(T,x,R,E)})}return T}return Y("div",{...d,...N,"aria-activedescendant":y(),className:Ft(It,n,{[`${It}-childMenuShowing`]:t!==void 0}),"data-root":l||void 0,id:g,ref:p,role:"menu",children:v()})},er=(e,t,o,n,s,r,a)=>({id:`menuitem-${e}`,key:o!=null?o:t,"data-index":t,"data-highlighted":t===n||void 0,className:Ft("vuuMenuItem",r,{"vuuMenuItem-separator":a,focusVisible:s===t})});Fe.displayName="MenuList";import{useCallback as F,useMemo as or,useRef as ye,useState as nr}from"react";var $e=e=>e==null?void 0:e.closest("[data-index],[aria-posinset]");var Vt=(e,t,o)=>e.map((n,s)=>s===e.length-1?{...n,[o]:n[o]-t}:n),rr=(e,t)=>Vt(e,t,"left"),sr=(e,t)=>Vt(e,t,"top"),ir=(e,t)=>{let[o,n]=t.slice(-2),s=document.getElementById(`${e}-${n.id}`);if(s===null)throw Error(`useCascade.flipSides element with id ${n.id} not found`);let{width:r}=s.getBoundingClientRect();return t.map(a=>a===n?{...a,left:o.left-(r-2)}:a)},ar=(e,t)=>{let[{left:o,top:n}]=t.slice(-1),{offsetWidth:s,offsetTop:r}=e;return{left:o+s,top:r+n}},Ot=(e,t)=>{let o=e.lastIndexOf("-");return e.startsWith("menuitem")?o>-1?e.slice(9,o):t:o>-1?e.slice(0,o):t},ur=e=>e.slice(9),Bt=({ariaExpanded:e,ariaHasPopup:t,id:o},n)=>{if(o.startsWith("menuitem"))return{hostMenuId:Ot(o,n),targetMenuId:ur(o),menuItemId:o,isGroup:t==="true",isOpen:e==="true"};throw Error(`getMenuItemDetails #${o} is not a menuitem`)},Ut=({id:e,onActivate:t,onMouseEnterItem:o,position:{x:n,y:s}})=>{let[,r]=nr({}),a=ye([{id:e,left:n,top:s}]),l=F(y=>a.current.findIndex(v=>v.id===y)!==-1,[]),i=F(y=>{let v=h.current[y];if(v===void 0)throw Error(`getOpenMenuState no entry for menu ${y}`);return v},[]),c=F(y=>{a.current=y,r({})},[]),f=ye(),M=ye(),h=ye({[e]:"no-popup"}),d=F((y=e,v,C=null)=>{if(y===e&&C===null)c([{id:e,left:n,top:s}]);else{h.current[y]="popup-open";let u=document.getElementById(C);if(u!==null){let{left:b,top:T}=ar(u,a.current);c(a.current.concat({id:v,left:b,top:T}))}else throw Error(`openMenu no menuItem ${C}`)}},[e,n,s,c]),g=F(y=>{if(y===e)c([]);else{let v=a.current.slice(),C=v.pop();h.current[C.id]="no-popup";let u=v.at(-1);u&&(h.current[u.id]="no-popup"),c(v)}},[e,c]),p=F(y=>{let v=a.current.slice(),C=y.slice(9),{id:u}=v.at(-1);for(;v.length>1&&!C.startsWith(u);){let b=Ot(u,e);v.pop(),h.current[u]="no-popup",h.current[b]="no-popup",{id:u}=v[v.length-1]}v.length<a.current.length&&c(v)},[e,c]),m=F(()=>{f.current&&(clearTimeout(f.current),f.current=void 0)},[]),P=F((y,v,C,u=300)=>{m(),f.current=window.setTimeout(()=>{p(C),h.current[y]="popup-open",h.current[v]="no-popup",d(y,v,C)},u)},[m,p,d]),S=F((y,v,C)=>{h.current[v]="pending-close",M.current=window.setTimeout(()=>{p(C)},400)},[p]),w=F(()=>{let{current:y}=a,v=y.at(-1),C=v?document.getElementById(v.id):void 0;if(C){let{right:u,bottom:b}=C.getBoundingClientRect(),{clientHeight:T,clientWidth:E}=document.body;if(u>E){let x=y.length>1?ir(e,y):rr(y,u-E);c(x)}else if(b>T){let x=sr(y,b-T);c(x)}typeof C.tabIndex=="number"&&C.focus()}},[e,c]),N=F((y,v=!1)=>{let{hostMenuId:C,targetMenuId:u,menuItemId:b,isGroup:T,isOpen:E}=Bt(y,e),{current:{[C]:x}}=h,R=v?0:void 0;if(x==="no-popup"&&T)h.current[C]="popup-pending",P(C,u,b,R);else if(x==="popup-pending"&&!T)h.current[C]="no-popup",clearTimeout(f.current),f.current=void 0;else if(x==="popup-pending"&&T)clearTimeout(f.current),P(C,u,b,R);else if(x==="popup-open")if(l(u)){let k=i(u);switch(p(b),k){case"pending-close":clearTimeout(M.current),M.current=void 0,h.current[u]="no-popup",m();break;default:}}else{let[k,B]=a.current.slice(-2);k.id===C&&h.current[B.id]!=="pending-close"?(S(C,B.id,b),T&&!E&&P(C,u,b,R)):k.id===C&&T&&b!==B.id&&h.current[B.id]==="pending-close"||T?P(C,u,b,R):h.current[B.id]!=="pending-close"&&p(b)}x==="pending-close"&&(m(),clearTimeout(M.current),M.current=void 0,h.current[C]="popup-open")},[m,p,i,l,e,S,P]),L=or(()=>({onMouseEnter:y=>{let v=$e(y.target);N(v),o(y,v.id)},onClick:y=>{let v=$e(y.target),{isGroup:C,menuItemId:u}=Bt(v,e);C?N(v):t(u)}}),[t,o,e,N]);return{closeMenu:g,handleRender:w,listItemProps:L,openMenu:N,openMenus:a.current}};import{useId as lr}from"@vuu-ui/vuu-layout";import{Fragment as pr,jsx as Jt}from"react/jsx-runtime";import{createElement as Gt}from"react";var cr=()=>{},_t=({PortalProps:e,activatedByKeyboard:t,children:o,className:n,id:s,onClose:r=()=>{},position:a={x:0,y:0},style:l,...i})=>{let c=Be(r);c.current=r;let f=lr(s),M=Be(cr),[h,d]=Dt(o,f),g=Be(t),p=Kt(()=>{g.current=!1},[]),m=Kt(b=>{let T=b.slice(9),{action:E,options:x}=d[T];M.current(f),r({type:"menu-action",menuId:E,options:x})},[d,f,r]),{closeMenu:P,listItemProps:S,openMenu:w,openMenus:N,handleRender:L}=Ut({id:`${f}`,onActivate:m,onMouseEnterItem:p,position:a});M.current=P;let y=()=>{g.current=!0,P()},v=()=>{},C=N.length-1,u=b=>{if(!(b>=C)){let{id:T}=N[b+1];return T}};return Jt(pr,{children:N.map(({id:b,left:T,top:E},x,R)=>{let k=u(x);return Gt(X,{...e,key:x,onRender:L},Jt(zt,{anchorElement:{current:document.body},placement:"absolute",position:{left:T,top:E},children:Gt(Fe,{...i,activatedByKeyboard:g.current,childMenuShowing:k,className:n,id:b,isRoot:x===0,key:x,listItemProps:S,onActivate:m,onHighlightMenuItem:v,onCloseMenu:y,openMenu:w,style:l,tabIndex:x===R.length-1?0:void 0},h[b])}))})})};_t.displayName="ContextMenu";import{createContext as dr,useCallback as mr,useMemo as fr}from"react";import{jsx as Ve}from"react/jsx-runtime";var Oe=dr(null),hr=({children:e,context:t,menuActionHandler:o,menuBuilder:n})=>{let s=fr(()=>t!=null&&t.menuBuilders&&n?t.menuBuilders.concat(n):n?[n]:(t==null?void 0:t.menuBuilders)||[],[t,n]),r=mr(a=>{var l;if(o!=null&&o(a)||(l=t==null?void 0:t.menuActionHandler)!=null&&l.call(t,a))return!0},[t,o]);return Ve(Oe.Provider,{value:{menuActionHandler:r,menuBuilders:s},children:e})},Wt=({children:e,label:t,menuActionHandler:o,menuBuilder:n})=>Ve(Oe.Consumer,{children:s=>Ve(hr,{context:s,label:t,menuActionHandler:o,menuBuilder:n,children:e})});import{isGroupMenuItemDescriptor as Gl}from"@vuu-ui/vuu-utils";import{cloneElement as _l,useCallback as zl,useContext as Wl,useMemo as ql}from"react";import fl from"classnames";import gl,{createElement as yl}from"react";import xl from"react-dom";import*as gr from"react-dom";import il from"classnames";import br from"classnames";import{useCallback as yr,useLayoutEffect as vr,useRef as Cr,useState as Mr}from"react";var qt=(e,t,o,n,s,r)=>{let{bottom:a,height:l,left:i,right:c,top:f,width:M}=e.getBoundingClientRect();switch(t){case"below":return{left:i+o,top:a+n};case"right":return{left:c+o,top:f+n};case"below-center":return{left:i+M/2+o,top:a+n};case"below-right":return{left:i,minWidth:s,top:a+n};case"below-full-width":return{left:i+o,minWidth:s,top:a+n,width:M};case"center":return r?{left:M/2-r.width/2+o,top:l/2-r.height/2+n,visibility:"visible"}:{left:M/2+o,top:l/2+n,visibility:"hidden"};default:throw Error("Popup getPositionRelativeToAnchor only supported placement values are below and right")}},Ue=({anchorElement:e,minWidth:t,offsetLeft:o=0,offsetTop:n=0,placement:s,position:r})=>{let a=Cr(null),[l,i]=Mr(r);vr(()=>{if(s==="absolute"&&r)i(r);else if(e.current){let f=a.current===null?void 0:a.current.getBoundingClientRect(),M=qt(e.current,s,o,n,t,f);i(M)}},[e,t,o,n,s,r]);let c=yr(f=>{if(a.current=f,f&&s==="center"&&e.current){let{height:M,width:h}=f.getBoundingClientRect();i(qt(e.current,s,o,n,void 0,{height:M,width:h}))}},[e,o,n,s]);return{position:l,popupRef:s==="center"?c:void 0}};import{jsx as xr}from"react/jsx-runtime";var zt=({children:e,className:t,anchorElement:o,minWidth:n,placement:s,position:r})=>{let{popupRef:a,position:l}=Ue({anchorElement:o,minWidth:n,placement:s,position:r});return l===void 0?null:xr("div",{className:br("vuuPortal",t),ref:a,style:l,children:e})};import{jsx as rc}from"react/jsx-runtime";import{useCallback as vc,useRef as Cc,useState as Mc}from"react";import Ec from"classnames";import{Button as Sc}from"@salt-ds/core";import{useId as Rc}from"@vuu-ui/vuu-layout";import{jsx as Ac}from"react/jsx-runtime";import{Button as Uc}from"@salt-ds/core";import Gc from"classnames";import{useLayoutEffect as zc,useRef as Wc}from"react";import{jsx as jc,jsxs as ep}from"react/jsx-runtime";var Yc={current:document.body};import{useLayoutEffect as ip,useState as ap}from"react";import gp from"classnames";import{jsx as Cp}from"react/jsx-runtime";import{useCallback as Pp,useRef as Tp,useState as Ep}from"react";import{useId as Sp}from"@vuu-ui/vuu-layout";import Lr,{useState as Fp,useContext as Pr,useCallback as $p,useEffect as Bp}from"react";import Op from"classnames";import{getUniqueId as Kp}from"@vuu-ui/vuu-utils";import{jsx as zp,jsxs as Wp}from"react/jsx-runtime";var Tr=Lr.createContext({notify:()=>"have you forgotten to provide a NotificationProvider?"});var Zt=()=>Pr(Tr);import{jsx as kr}from"react/jsx-runtime";var Ke,ne=()=>(Ke===void 0&&(Ke=new Hr),Ke),Yt=Er.createContext({layoutMetadata:[],saveLayout:()=>{},applicationJson:Ar,saveApplicationLayout:()=>{},saveApplicationSettings:()=>{},loadLayoutById:()=>{}}),Ir=(e,t)=>{var o;return((o=e.props)==null?void 0:o.title)!==void 0?e:{...e,props:{...e.props,title:t.name}}},yd=e=>{let[t,o]=Xt([]),[,n]=Xt({}),{notify:s}=Zt(),r=Nr(Rr),a=z((d,g=!0)=>{r.current=d,g&&n({})},[]),l=z((d,g=!0)=>{a({...r.current,layout:d},g)},[a]),i=z(d=>{a({...r.current,settings:{...r.current.settings,...d}},!1)},[a]);Sr(()=>{let d=ne();d.loadMetadata().then(g=>{o(g)}).catch(g=>{s({type:"error",header:"Failed to Load Layouts",body:"Could not load list of available layouts"}),console.error("Error occurred while retrieving metadata",g)}),d.loadApplicationJSON().then(g=>{a(g)}).catch(g=>{s({type:"error",header:"Failed to Load Layout",body:"Could not load your latest view"}),console.error("Error occurred while retrieving application layout",g)})},[s,a]);let c=z(d=>{l(d,!1),ne().saveApplicationJSON(r.current)},[l]),f=z(d=>{let g=Dr(r.current.layout,"#main-tabs.ACTIVE_CHILD");g?ne().createLayout(d,Ir(g,d)).then(p=>{s({type:"success",header:"Layout Saved Successfully",body:`${p.name} saved successfully`}),o(m=>[...m,p])}).catch(p=>{s({type:"error",header:"Failed to Save Layout",body:`Failed to save layout ${d.name}`}),console.error("Error occurred while saving layout",p)}):s({type:"error",header:"Failed to Save Layout",body:"Cannot save undefined layout"})},[s]),M=z(d=>{i(d),ne().saveApplicationJSON(r.current)},[i]),h=z(d=>{ne().loadLayout(d).then(g=>{var m,P;let{layout:p}=r.current;l({...p,children:(p.children||[]).concat(g),props:{...p.props,active:(P=(m=p.children)==null?void 0:m.length)!=null?P:0}})}).catch(g=>{s({type:"error",header:"Failed to Load Layout",body:"Failed to load the requested layout"}),console.error("Error occurred while loading layout",g)})},[s,l]);return kr(Yt.Provider,{value:{layoutMetadata:t,saveLayout:f,applicationJson:r.current,saveApplicationLayout:c,saveApplicationSettings:M,loadLayoutById:h},children:e.children})},ve=()=>wr(Yt);import{Fragment as Qt,jsx as J,jsxs as Ce}from"react/jsx-runtime";var W="vuuLayoutList",jt=e=>{let{layoutMetadata:t,loadLayoutById:o}=ve(),n=r=>{r&&o(r)},s=t.reduce((r,a)=>r[a.group]?{...r,[a.group]:[...r[a.group],a]}:{...r,[a.group]:[a]},{});return Ce("div",{className:W,...e,children:[J("div",{className:`${W}-header`,children:"My Layouts"}),J(Fr,{height:"auto",source:Object.entries(s),ListItem:({item:r})=>{if(!r)return J(Qt,{});let[a,l]=r;return Ce(Qt,{children:[J("div",{className:`${W}-groupName`,children:a}),l.map(i=>Ce("div",{className:`${W}-layoutContainer`,onClick:()=>n(i==null?void 0:i.id),children:[J("img",{className:`${W}-screenshot`,src:i==null?void 0:i.screenshot}),Ce("div",{children:[J("div",{className:`${W}-layoutName`,children:i==null?void 0:i.name}),J("div",{className:`${W}-layoutDetails`,children:J("div",{children:`${i==null?void 0:i.user}, ${i==null?void 0:i.created}`})})]})]},i==null?void 0:i.id))]})}})]})};import{VuuLogo as Xr}from"@vuu-ui/vuu-icons";import{Stack as Yr,useLayoutProviderDispatch as Qr}from"@vuu-ui/vuu-layout";import{Tab as Me,Tabstrip as jr}from"@vuu-ui/vuu-ui-controls";import We from"classnames";import{useCallback as qe,useState as es}from"react";import{Palette as $r,PaletteItem as Br}from"@vuu-ui/vuu-layout";import{jsx as re,jsxs as Vr}from"react/jsx-runtime";var Ge="vuuFeatureList",Je=({features:e,title:t="VUU TABLES",...o})=>{let n={},s={height:"100%"};return Vr("div",{...o,className:Ge,children:[re("div",{className:`${Ge}-header`,children:t}),re("div",{className:`${Ge}-content`,children:re($r,{orientation:"vertical",ListProps:s,ViewProps:n,children:e.map((r,a)=>re(Br,{closeable:!0,label:r.title,resizeable:!0,resize:"defer",header:!0,children:re(pe,{...r})},a))})})]})};import{createContext as Or,isValidElement as Ur,cloneElement as Kr,useContext as eo}from"react";import Gr from"classnames";import{jsx as Zr}from"react/jsx-runtime";var Jr="medium",_r="salt-theme",zr="light",_e=Or({density:"high",theme:"vuu",themeMode:"light"}),Wr=["vuu","vuu-density-high","light"],G=e=>{let t=eo(_e);return e?[e.themeClass,e.densityClass,e.dataMode]:t?[`${t.theme}-theme`,`${t.theme}-density-${t.density}`,t.themeMode]:Wr},qr=(e,t,o,n)=>{var s;return Ur(e)?Kr(e,{className:Gr((s=e.props)==null?void 0:s.className,`${t}-theme`,`${t}-density-${n}`),"data-mode":o}):(console.warn(`
|
|
2
2
|
ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
|
|
3
|
-
Wrap elements with a single container`),e)},fe=({applyThemeClasses:e=!1,children:t,theme:o,themeMode:a,density:n})=>{var p,h,g;let{density:r,themeMode:u,theme:d}=Ue(pe),s=(p=n!=null?n:r)!=null?p:go,i=(h=a!=null?a:u)!=null?h:vo,l=(g=o!=null?o:d)!=null?g:yo,f=e?To(t,l,i,s):t;return So(pe.Provider,{value:{themeMode:i,density:s,theme:l},children:f})};fe.displayName="ThemeProvider";import{jsx as T,jsxs as re}from"react/jsx-runtime";var $="vuuLeftNav",Cn=({"data-path":e,features:t,onResize:o,sizeCollapsed:a=80,sizeContent:n=300,sizeExpanded:r=240,style:u,tableFeatures:d,...s})=>{let i=No(),[l,f]=Po({activeTabIndex:0,navStatus:"menu-full"}),[p]=oe(),h=ae(y=>{switch(y){case"menu-icons":return r;case"menu-full":return a;case"menu-full-content":return a+n;case"menu-icons-content":return r+n}},[a,n,r]),g=y=>{switch(y){case"menu-icons":return"menu-full";case"menu-full":return"menu-icons";case"menu-full-content":return"menu-icons-content";case"menu-icons-content":return"menu-full-content"}},m=ae((y,N)=>{if(N===0){let S=y==="menu-full-content"?"menu-full":y==="menu-icons-content"?"menu-icons":y;return S==="menu-icons"?[a,S]:[r,S]}else{let S=y==="menu-full"?"menu-full-content":y==="menu-icons"?"menu-icons-content":y;return S==="menu-icons-content"?[a+n,S]:[r+n,S]}},[a,n,r]),b=ae(y=>{let[N,S]=m(l.navStatus,y);f({activeTabIndex:y,navStatus:S}),i({type:$e.LAYOUT_RESIZE,path:e,size:N})},[i,m,l,e]),P=ae(()=>{let{activeTabIndex:y,navStatus:N}=l;f({activeTabIndex:y,navStatus:g(N)}),i({type:$e.LAYOUT_RESIZE,path:e,size:h(N)})},[i,l,e,h]),R={...u,"--nav-menu-collapsed-width":`${a}px`,"--nav-menu-expanded-width":`${r}px`,"--nav-menu-content-width":`${n}px`};return re("div",{...s,className:he($,`${$}-${l.navStatus}`),style:R,children:[re("div",{className:he(`${$}-menu-primary`,p),"data-mode":"dark",children:[T("div",{className:"vuuLeftNav-logo",children:T(xo,{})}),T("div",{className:`${$}-main`,children:re(Co,{activeTabIndex:l.activeTabIndex,animateSelectionThumb:!1,className:`${$}-Tabstrip`,onActiveChange:b,orientation:"vertical",children:[T(J,{"data-icon":"demo",label:"DEMO"}),T(J,{"data-icon":"features",label:"VUU FEATURES"}),T(J,{"data-icon":"tables",label:"VUU TABLES"}),T(J,{"data-icon":"templates",label:"LAYOUT TEMPLATES"}),T(J,{"data-icon":"layouts",label:"MY LAYOUTS"})]})}),T("div",{className:"vuuLeftNav-buttonBar",children:T("button",{className:he("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":l.navStatus.startsWith("menu-full"),"vuuLeftNav-toggleButton-closed":l.navStatus.startsWith("menu-icons")}),"data-icon":l.navStatus.startsWith("menu-full")?"chevron-left":"chevron-right",onClick:P})})]}),re(bo,{active:l.activeTabIndex-1,className:`${$}-menu-secondary`,showTabs:!1,children:[T(de,{features:t,title:"VUU FEATURES"}),T(de,{features:d,title:"VUU TABLES"}),T("div",{style:{background:"green",height:"100%"},children:"LAYOUT TEMPLATES"}),T("div",{className:"vuuLeftNav-drawer",children:T(Ae,{})})]})]})};import{useState as Be}from"react";import{Button as Mo,FormField as Oe,FormFieldLabel as _e,Input as Ge}from"@salt-ds/core";import{jsx as Y,jsxs as ge}from"react/jsx-runtime";var Je="vuuLoginPanel",An=({requirePassword:e=!0,onSubmit:t})=>{let[o,a]=Be(""),[n,r]=Be(""),u=()=>{t(o,n)},d=l=>{a(l.target.value)},s=l=>{r(l.target.value)},i=o.trim()!==""&&(e===!1||n.trim()!=="");return ge("div",{className:Je,children:[ge(Oe,{style:{width:200},children:[Y(_e,{children:"Username"}),Y(Ge,{value:o,id:"text-username",onChange:d})]}),e?ge(Oe,{style:{width:200},children:[Y(_e,{children:"Password"}),Y(Ge,{inputProps:{type:"password"},value:n,id:"text-password",onChange:s})]}):null,Y(Mo,{className:`${Je}-login`,disabled:!i,onClick:u,variant:"cta",children:"Login"})]})};import{getCookieValue as ye}from"@vuu-ui/vuu-utils";var Eo=()=>{let e=ye("vuu-auth-mode");return e!=null?e:""},On=()=>{let e=ye("vuu-username"),t=ye("vuu-auth-token");return[e,t]},Fo=()=>Eo()==="login"?"login.html":"demo.html",Do=(e=Fo())=>{window.location.href=e},Ye=e=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",Do(e)};import{useCallback as B,useEffect as We,useMemo as wo,useRef as ve,useState as qe}from"react";import Ke from"classnames";import{useIdMemo as Ho}from"@salt-ds/core";import{Button as ze}from"@salt-ds/core";import{hasAction as ko,isErrorResponse as Vo,RemoteDataSource as Ro}from"@vuu-ui/vuu-data";import{buildColumnMap as Io,isValidNumber as Xe,shallowEquals as Ao}from"@vuu-ui/vuu-utils";import{jsx as A,jsxs as Le}from"react/jsx-runtime";var D="vuuSessionEditingForm",Ze=(e,t)=>{let o=e.find(a=>a.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},Qe=e=>{let{dataset:{field:t},value:o}=e.target;if(t===void 0)throw Error("SessionEditingForm, form field has no field name");return[t,o]},w={uninitialised:0,unchanged:1,changed:2,invalid:3};function je(e,t,o=!1){switch(t){case"int":case"long":{let a=parseInt(e,10);if(Xe(a))return a;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let a=parseFloat(e);return Xe(a)?a:void 0}case"boolean":return e==="true";default:return e}}var Uo=(e,t)=>{if(e)return e;if(t)return new Ro({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},ss=({className:e,config:{fields:t,key:o},dataSource:a,id:n,onClose:r,schema:u,...d})=>{let[s,i]=qe(),[l,f]=qe(""),p=ve(null),h=ve(),g=ve(w.uninitialised),m=wo(()=>{let c=E=>{if(M){let F={};for(let U of m.columns)F[U]=E[M[U]];g.current===w.uninitialised&&(g.current=w.unchanged,h.current=F),i(F)}},v=Uo(a,u),M=Io(v.columns);return v.subscribe({range:{from:0,to:5}},E=>{E.type==="viewport-update"&&E.rows&&(g.current===w.uninitialised?c(E.rows[0]):console.log("what do we do with server updates"))}),v},[a,u]),b=Ho(n),P=B(c=>{let[v,M]=Qe(c),{type:E}=Ze(t,v),F=je(M,E);i((U={})=>{let Pe={...U,[v]:F},St=Ao(Pe,h.current);return g.current=St?w.unchanged:F!==void 0?w.changed:w.invalid,Pe})},[t]),R=B(c=>{let[v,M]=Qe(c),{type:E}=Ze(t,v),F=s==null?void 0:s[o],U=je(M,E,!0);typeof F=="string"&&m.menuRpcCall({rowKey:F,field:v,value:U,type:"VP_EDIT_CELL_RPC"})},[m,t,o,s]),y=B(c=>{typeof c=="object"&&c!==null&&"type"in c&&c.type==="CLOSE_DIALOG_ACTION"&&r()},[r]),N=B(async()=>{let c=await m.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});Vo(c)?f(c.error):ko(c)&&y(c.action)},[y,m]),S=B(c=>{c.key==="Enter"&&g.current===w.changed&&N()},[N]),ue=B(()=>{r()},[r]),le=c=>{var M;let v=String((M=s==null?void 0:s[c.name])!=null?M:"");return c.readonly||c.name===o?A("div",{className:`${D}-fieldValue vuuReadOnly`,children:v}):A("input",{className:`${D}-fieldValue`,"data-field":c.name,onBlur:R,onChange:P,type:"text",value:v,id:`${b}-input-${c.name}`})};We(()=>{if(p.current){let c=p.current.querySelector("input");c&&setTimeout(()=>{c.focus(),c.select()},100)}},[]),We(()=>()=>{m&&m.unsubscribe()},[m]);let H=g.current===w.changed;return Le("div",{...d,className:Ke(D,e),children:[l?A("div",{className:`${D}-errorBanner`,"data-icon":"error",title:l,children:"Error, edit(s) not saved"}):void 0,A("div",{className:`${D}-content`,ref:p,onKeyDown:S,children:t.map(c=>{var v;return Le("div",{className:`${D}-field`,children:[A("label",{className:Ke(`${D}-fieldLabel`,{[`${D}-required`]:c.required}),htmlFor:`${b}-input-${c.name}`,children:(v=c==null?void 0:c.label)!=null?v:c.description}),le(c)]},c.name)})}),Le("div",{className:`${D}-buttonbar salt-theme salt-density-high`,children:[A(ze,{type:"submit",variant:"cta",disabled:!H,onClick:N,children:"Submit"}),A(ze,{variant:"secondary",onClick:ue,children:"Cancel"})]})]})};import{connectToServer as ba}from"@vuu-ui/vuu-data";import Na from"classnames";import{useCallback as Se,useEffect as Ca,useRef as Tt}from"react";import{DraggableLayout as Pa,LayoutProvider as Ma}from"@vuu-ui/vuu-layout";import{useCallback as na}from"react";import{Button as zo}from"@salt-ds/core";import{DropdownBase as Xo}from"@salt-ds/lab";import{UserSolidIcon as Zo}from"@salt-ds/icons";import{formatDate as $o}from"@vuu-ui/vuu-utils";import{List as Bo,ListItem as Oo}from"@salt-ds/lab";import{Button as _o}from"@salt-ds/core";import{ExportIcon as Go}from"@salt-ds/icons";import{forwardRef as Jo,useCallback as tt,useEffect as Yo,useState as Wo}from"react";var et=async e=>await fetch(`api/vui/${e.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});import{jsx as ne,jsxs as ot}from"react/jsx-runtime";var qo=({lastUpdate:e},{lastUpdate:t})=>t===e?0:t<e?-1:1,Ko=e=>ne(Oo,{...e}),at=Jo(function({loginUrl:t,onNavigate:o,user:a,layoutId:n="latest"},r){let[u,d]=Wo([]);Yo(()=>{async function f(){let h=(await et(a)).filter(g=>g.id!=="latest").sort(qo).map(({id:g,lastUpdate:m})=>({lastUpdate:m,id:g,label:`Saved at ${$o(new Date(m),"kk:mm:ss")}`}));console.log({sortedHistory:h}),d(h)}f()},[a]);let s=tt((f,p)=>{p&&o(p.id)},[o]),i=tt(()=>{Ye(t)},[t]),l=u.length===0?null:n==="latest"?u[0]:u.find(f=>f.id===n);return ot("div",{className:"vuuUserPanel",ref:r,children:[ne(Bo,{ListItem:Ko,className:"vuuUserPanel-history",onSelect:s,selected:l,source:u}),ne("div",{className:"vuuUserPanel-buttonBar",children:ot(_o,{"aria-label":"logout",onClick:i,children:[ne(Go,{})," Logout"]})})]})});import{jsx as Te,jsxs as Qo}from"react/jsx-runtime";var rt=({layoutId:e,loginUrl:t,onNavigate:o,user:a})=>Qo(Xo,{className:"vuuUserProfile",placement:"bottom-end",children:[Te(zo,{variant:"secondary",children:Te(Zo,{})}),Te(at,{layoutId:e,loginUrl:t,onNavigate:r=>{o(r)},user:a})]});import jo from"classnames";import{ToggleButton as nt,ToggleButtonGroup as ea,useControlled as ta}from"@salt-ds/core";import{useCallback as oa}from"react";import{jsx as st,jsxs as ra}from"react/jsx-runtime";var aa="vuuThemeSwitch",it=({className:e,defaultMode:t,mode:o,onChange:a,...n})=>{let[r,u]=ta({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),d=oa(i=>{let{value:l}=i.target;u(l),a(l)},[a,u]),s=jo(aa,e);return ra(ea,{className:s,...n,onChange:d,value:r,children:[st(nt,{"aria-label":"alert","data-icon":"light",value:"dark"}),st(nt,{"aria-label":"home","data-icon":"dark",value:"light"})]})};import sa from"classnames";import{jsx as ut,jsxs as ua}from"react/jsx-runtime";var ia="vuuAppHeader",lt=({className:e,layoutId:t,loginUrl:o,onNavigate:a,onSwitchTheme:n,themeMode:r="light",user:u,...d})=>{let s=sa(ia,e),i=na(l=>n==null?void 0:n(l),[n]);return ua("header",{className:s,...d,children:[ut(it,{defaultMode:r,onChange:i}),ut(rt,{layoutId:t,loginUrl:o,onNavigate:a,user:u})]})};import{logger as Ea}from"@vuu-ui/vuu-utils";import{Button as la}from"@salt-ds/core";import ct from"classnames";import{useCallback as ca,useMemo as ma}from"react";import{layoutFromJson as da,useLayoutProviderDispatch as pa}from"@vuu-ui/vuu-layout";import{jsx as se,jsxs as mt}from"react/jsx-runtime";var C="vuuContextPanel",dt=({className:e,expanded:t=!1,content:o,overlay:a=!1,title:n})=>{let r=pa(),u=ca(()=>{r({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[r]),d=ct(C,e,{[`${C}-expanded`]:t,[`${C}-inline`]:a!==!0,[`${C}-overlay`]:a}),s=ma(()=>o?da(o,"context-0"):null,[o]);return se("div",{className:ct(C,d),children:mt("div",{className:`${C}-inner`,children:[mt("div",{className:`${C}-header`,children:[se("h2",{className:`${C}-title`,children:n}),se(la,{className:`${C}-close`,"data-icon":"close",onClick:u,variant:"secondary"})]}),se("div",{className:`${C}-content`,children:s})]})})};import{DraggableLayout as fa,Flexbox as pt}from"@vuu-ui/vuu-layout";import{jsx as ft,jsxs as ht}from"react/jsx-runtime";var gt=({appHeader:e,leftSidePanel:t})=>ht(pt,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[t,ht(pt,{className:"vuuShell-content",style:{flex:1,flexDirection:"column"},children:[e,ft(fa,{dropTarget:!0,style:{flex:1}},"main-content")]}),ft(dt,{id:"context-panel",overlay:!0,title:"Column Settings"})]});import{DockLayout as ha,DraggableLayout as ga,Drawer as ya,Flexbox as va,View as La}from"@vuu-ui/vuu-layout";import{useCallback as yt,useRef as Ta,useState as Sa}from"react";import{jsx as ie,jsxs as xa}from"react/jsx-runtime";var vt=({appHeader:e,leftSidePanel:t})=>{let o=Ta(null),[a,n]=Sa(!0),r=yt(d=>{var i;let s=d.target;(i=o.current)!=null&&i.contains(s)||n(!a)},[a]),u=yt(d=>{let s=[];return s.push(ie(ya,{onClick:r,open:a,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:ie(La,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:d},"app-palette")},"left-panel")),s},[r,a]);return xa(va,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,ie(ha,{style:{flex:1},children:u(t).concat(ie(ga,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var Lt=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?vt:gt)(t);import{jsx as be,jsxs as Fa}from"react/jsx-runtime";var{error:xe}=Ea("Shell"),eu=({LayoutProps:e,children:t,className:o,leftSidePanel:a,leftSidePanelLayout:n,loginUrl:r,saveLocation:u="remote",saveUrl:d,serverUrl:s,user:i,...l})=>{let f=Tt(null),p=Tt("latest"),{applicationLayout:h,saveApplicationLayout:g,loadLayoutById:m}=ee(),b=Se((H,c)=>{try{g(H)}catch{xe==null||xe("Failed to save layout")}},[g]),P=Se(H=>{f.current&&(f.current.dataset.mode=H)},[]),R=Se(H=>{p.current=H,m(H)},[m]);Ca(()=>{s&&i.token&&ba({authToken:i.token,url:s,username:i.username})},[s,i.token,i.username]);let[y,N,S]=oe(),ue=Na("vuuShell",o,y,N),le=Lt({leftSidePanelLayout:n,appHeader:be(lt,{layoutId:p.current,loginUrl:r,user:i,onNavigate:R,onSwitchTheme:P}),leftSidePanel:a});return Fa(fe,{children:[be(Ma,{...e,layout:h,onLayoutChange:b,children:be(Pa,{className:ue,"data-mode":S,ref:f,...l,children:le})}),t]})};var au=e=>e==="*",ru=e=>typeof e=="object"&&typeof e.module=="string"&&typeof e.table=="string";import{createContext as Da,useContext as wa}from"react";import{jsx as Ne}from"react/jsx-runtime";var Ha={},Ce=Da(Ha),ka=({children:e,context:t,inheritedContext:o})=>{let a={...o,...t};return Ne(Ce.Provider,{value:a,children:e})},lu=({children:e,value:t})=>Ne(Ce.Consumer,{children:o=>Ne(ka,{context:t,inheritedContext:o,children:e})}),cu=()=>wa(Ce);export{$a as ConnectionStatusIcon,dt as ContextPanel,go as DEFAULT_DENSITY,yo as DEFAULT_THEME,vo as DEFAULT_THEME_MODE,Ka as DensitySwitch,z as Feature,de as FeatureList,Re as LayoutManagementContext,wr as LayoutManagementProvider,Ae as LayoutsList,Cn as LeftNav,An as LoginPanel,Nr as SaveLayoutPanel,ss as SessionEditingForm,eu as Shell,lu as ShellContextProvider,pe as ThemeContext,fe as ThemeProvider,it as ThemeSwitch,On as getAuthDetailsFromCookies,Eo as getAuthModeFromCookies,ru as isTableSchema,au as isWildcardSchema,Ye as logout,Do as redirectToLogin,ee as useLayoutManager,cu as useShellContext,Lt as useShellLayout,oe as useThemeAttributes};
|
|
3
|
+
Wrap elements with a single container`),e)},ze=({applyThemeClasses:e=!1,children:t,theme:o,themeMode:n,density:s})=>{var h,d,g;let{density:r,themeMode:a,theme:l}=eo(_e),i=(h=s!=null?s:r)!=null?h:Jr,c=(d=n!=null?n:a)!=null?d:zr,f=(g=o!=null?o:l)!=null?g:_r,M=e?qr(t,f,c,i):t;return Zr(_e.Provider,{value:{themeMode:c,density:i,theme:f},children:M})};ze.displayName="ThemeProvider";import{jsx as I,jsxs as be}from"react/jsx-runtime";var Q="vuuLeftNav",ts=(e,t)=>e===0?t?"menu-full":"menu-icons":t?"menu-full-content":"menu-icons-content",cm=e=>{let t=Qr(),[o]=G(),{"data-path":n,defaultExpanded:s=!0,defaultActiveTabIndex:r=0,features:a,onActiveChange:l,onTogglePrimaryMenu:i,sizeCollapsed:c=80,sizeContent:f=300,sizeExpanded:M=240,style:h,tableFeatures:d,...g}=e,[p,m]=es({activeTabIndex:r,expanded:s}),P=qe((y,v)=>y===0?v?M:c:v?M+f:c+f,[c,f,M]),S=qe(y=>{let{activeTabIndex:v,expanded:C}=p;if(m({activeTabIndex:y,expanded:C}),y===0||v===0){let b=P(y,C);t({type:"layout-resize",path:"#vuu-side-panel",size:b})}l==null||l(y)},[t,P,p,l]),w=ts(p.activeTabIndex,p.expanded),N=qe(()=>{let{activeTabIndex:y,expanded:v}=p,C=!v;m({activeTabIndex:y,expanded:C}),t({type:"layout-resize",path:"#vuu-side-panel",size:P(y,C)}),i==null||i(C)},[t,P,p,i]),L={...h,"--nav-menu-collapsed-width":`${c}px`,"--nav-menu-expanded-width":`${M}px`,"--nav-menu-content-width":`${f}px`};return be("div",{...g,className:We(Q,`${Q}-${w}`),style:L,children:[be("div",{className:We(`${Q}-menu-primary`,o),"data-mode":"dark",children:[I("div",{className:"vuuLeftNav-logo",children:I(Xr,{})}),I("div",{className:`${Q}-main`,children:be(jr,{activeTabIndex:p.activeTabIndex,animateSelectionThumb:!1,className:`${Q}-Tabstrip`,onActiveChange:S,orientation:"vertical",children:[I(Me,{"data-icon":"demo",label:"DEMO"}),I(Me,{"data-icon":"features",label:"VUU FEATURES"}),I(Me,{"data-icon":"tables",label:"VUU TABLES"}),I(Me,{"data-icon":"layouts",label:"MY LAYOUTS"})]})}),I("div",{className:"vuuLeftNav-buttonBar",children:I("button",{className:We("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":w.startsWith("menu-full"),"vuuLeftNav-toggleButton-closed":w.startsWith("menu-icons")}),"data-icon":w.startsWith("menu-full")?"chevron-left":"chevron-right",onClick:N})})]}),be(Yr,{active:p.activeTabIndex-1,className:`${Q}-menu-secondary`,showTabs:!1,children:[I(Je,{features:a,title:"VUU FEATURES"}),I(Je,{features:d,title:"VUU TABLES"}),I("div",{className:"vuuLeftNav-drawer",children:I(jt,{})})]})]})};import{useCallback as j,useEffect as to,useMemo as os,useRef as Ze,useState as oo}from"react";import no from"classnames";import{useIdMemo as ns}from"@salt-ds/core";import{Button as ro}from"@salt-ds/core";import{hasAction as rs,isErrorResponse as ss,RemoteDataSource as is}from"@vuu-ui/vuu-data";import{buildColumnMap as as,isValidNumber as so,shallowEquals as us}from"@vuu-ui/vuu-utils";import{jsx as q,jsxs as Xe}from"react/jsx-runtime";var O="vuuSessionEditingForm",io=(e,t)=>{let o=e.find(n=>n.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},ao=e=>{let{dataset:{field:t},value:o}=e.target;if(t===void 0)throw Error("SessionEditingForm, form field has no field name");return[t,o]},U={uninitialised:0,unchanged:1,changed:2,invalid:3};function uo(e,t,o=!1){switch(t){case"int":case"long":{let n=parseInt(e,10);if(so(n))return n;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let n=parseFloat(e);return so(n)?n:void 0}case"boolean":return e==="true";default:return e}}var ls=(e,t)=>{if(e)return e;if(t)return new is({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},Nm=({className:e,config:{fields:t,key:o},dataSource:n,id:s,onClose:r,schema:a,...l})=>{let[i,c]=oo(),[f,M]=oo(""),h=Ze(null),d=Ze(),g=Ze(U.uninitialised),p=os(()=>{let u=E=>{if(T){let x={};for(let R of p.columns)x[R]=E[T[R]];g.current===U.uninitialised&&(g.current=U.unchanged,d.current=x),c(x)}},b=ls(n,a),T=as(b.columns);return b.subscribe({range:{from:0,to:5}},E=>{E.type==="viewport-update"&&E.rows&&(g.current===U.uninitialised?u(E.rows[0]):console.log("what do we do with server updates"))}),b},[n,a]),m=ns(s),P=j(u=>{let[b,T]=ao(u),{type:E}=io(t,b),x=uo(T,E);c((R={})=>{let k={...R,[b]:x},B=us(k,d.current);return g.current=B?U.unchanged:x!==void 0?U.changed:U.invalid,k})},[t]),S=j(u=>{let[b,T]=ao(u),{type:E}=io(t,b),x=i==null?void 0:i[o],R=uo(T,E,!0);typeof x=="string"&&p.menuRpcCall({rowKey:x,field:b,value:R,type:"VP_EDIT_CELL_RPC"})},[p,t,o,i]),w=j(u=>{typeof u=="object"&&u!==null&&"type"in u&&u.type==="CLOSE_DIALOG_ACTION"&&r()},[r]),N=j(async()=>{let u=await p.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});ss(u)?M(u.error):rs(u)&&w(u.action)},[w,p]),L=j(u=>{u.key==="Enter"&&g.current===U.changed&&N()},[N]),y=j(()=>{r()},[r]),v=u=>{var T;let b=String((T=i==null?void 0:i[u.name])!=null?T:"");return u.readonly||u.name===o?q("div",{className:`${O}-fieldValue vuuReadOnly`,children:b}):q("input",{className:`${O}-fieldValue`,"data-field":u.name,onBlur:S,onChange:P,type:"text",value:b,id:`${m}-input-${u.name}`})};to(()=>{if(h.current){let u=h.current.querySelector("input");u&&setTimeout(()=>{u.focus(),u.select()},100)}},[]),to(()=>()=>{p&&p.unsubscribe()},[p]);let C=g.current===U.changed;return Xe("div",{...l,className:no(O,e),children:[f?q("div",{className:`${O}-errorBanner`,"data-icon":"error",title:f,children:"Error, edit(s) not saved"}):void 0,q("div",{className:`${O}-content`,ref:h,onKeyDown:L,children:t.map(u=>{var b;return Xe("div",{className:`${O}-field`,children:[q("label",{className:no(`${O}-fieldLabel`,{[`${O}-required`]:u.required}),htmlFor:`${m}-input-${u.name}`,children:(b=u==null?void 0:u.label)!=null?b:u.description}),v(u)]},u.name)})}),Xe("div",{className:`${O}-buttonbar salt-theme salt-density-high`,children:[q(ro,{type:"submit",variant:"cta",disabled:!C,onClick:N,children:"Submit"}),q(ro,{variant:"secondary",onClick:y,children:"Cancel"})]})]})};import{connectToServer as Ns}from"@vuu-ui/vuu-data";import{DraggableLayout as Rs,LayoutProvider as Hs,loadingApplicationJson as Ds,useLayoutContextMenuItems as As}from"@vuu-ui/vuu-layout";import{logger as Is}from"@vuu-ui/vuu-utils";import ks from"classnames";import{useCallback as Qe,useEffect as Fs,useRef as Mo}from"react";import{Button as cs}from"@salt-ds/core";import lo from"classnames";import{useCallback as ps,useMemo as ds}from"react";import{layoutFromJson as ms,View as fs,useLayoutProviderDispatch as hs}from"@vuu-ui/vuu-layout";import{jsx as xe,jsxs as co}from"react/jsx-runtime";var $="vuuContextPanel",po=({className:e,expanded:t=!1,content:o,overlay:n=!1,title:s})=>{let r=hs(),a=ps(()=>{r({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[r]),l=lo($,e,{[`${$}-expanded`]:t,[`${$}-inline`]:n!==!0,[`${$}-overlay`]:n}),i=ds(()=>o&&t?ms(o,"context-0"):null,[o,t]);return xe("div",{className:lo($,l,{[`${$}-expanded`]:t}),children:co(fs,{className:`${$}-inner`,header:!1,id:"context-panel",children:[co("div",{className:`${$}-header`,children:[xe("h2",{className:`${$}-title`,children:s}),xe(cs,{className:`${$}-close`,"data-icon":"close",onClick:a,variant:"secondary"})]}),xe("div",{className:`${$}-content`,children:i})]})})};import{DraggableLayout as Ms,Flexbox as fo}from"@vuu-ui/vuu-layout";import{useMemo as gs}from"react";import ys from"classnames";import{jsx as Cs}from"react/jsx-runtime";var vs="vuuShellSidePanel",mo=({children:e,open:t=!0,sizeClosed:o=90,sizeOpen:n=200,style:s,...r})=>{let a=gs(()=>({...s,"--shell-left-nav-size":t?`${n}px`:`${o}px`}),[t,o,n,s]);return Cs("div",{...r,className:ys(vs),style:a,children:e})};import{jsx as Ye,jsxs as ho}from"react/jsx-runtime";var go=({appHeader:e,LeftSidePanelProps:t})=>ho(fo,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[Ye(mo,{...t,id:"vuu-side-panel"}),ho(fo,{className:"vuuShell-content",style:{flex:1,flexDirection:"column"},children:[e,Ye(Ms,{dropTarget:!0,style:{flex:1}},"main-content")]}),Ye(po,{id:"context-panel",overlay:!0})]});import{DockLayout as bs,DraggableLayout as xs,Drawer as Ls,Flexbox as Ps,View as Ts}from"@vuu-ui/vuu-layout";import{useCallback as yo,useRef as Es,useState as ws}from"react";import{jsx as Le,jsxs as Ss}from"react/jsx-runtime";var vo=({appHeader:e,LeftSidePanelProps:t})=>{let o=Es(null),[n,s]=ws(!0),r=yo(l=>{var c;let i=l.target;(c=o.current)!=null&&c.contains(i)||s(!n)},[n]),a=yo(l=>{let i=[];return i.push(Le(Ls,{onClick:r,open:n,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:Le(Ts,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:l},"app-palette")},"left-panel")),i},[r,n]);return Ss(Ps,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,Le(bs,{style:{flex:1},children:a(t==null?void 0:t.children).concat(Le(xs,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var Co=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?vo:go)(t);import{jsx as Pe,jsxs as Bs}from"react/jsx-runtime";var{error:je}=Is("Shell"),$s={},Uf=({LayoutProps:e,LeftSidePanelProps:t=$s,children:o,className:n,leftSidePanelLayout:s,loginUrl:r,saveLocation:a="remote",saveUrl:l,serverUrl:i,user:c,...f})=>{let M=Mo(null),{dialog:h,setDialogState:d}=Pt(),g=Mo("latest"),{applicationJson:p,saveApplicationLayout:m,loadLayoutById:P}=ve(),{buildMenuOptions:S,handleMenuAction:w}=As(d),N=Qe((x,R)=>{try{m(x)}catch{je==null||je("Failed to save layout")}},[m]),L=Qe(x=>{M.current&&(M.current.dataset.mode=x)},[]),y=Qe(x=>{g.current=x,P(x)},[P]);Fs(()=>{i&&c.token&&Ns({authToken:c.token,url:i,username:c.username})},[i,c.token,c.username]);let[v,C,u]=G(),b=ks("vuuShell",n,v,C),T=p===Ds,E=Co({LeftSidePanelProps:t,leftSidePanelLayout:s,appHeader:Pe(dt,{layoutId:g.current,loginUrl:r,user:c,onNavigate:y,onSwitchTheme:L})});return T?null:Pe(ze,{children:Bs(Wt,{menuActionHandler:w,menuBuilder:S,children:[Pe(Hs,{...e,layout:p.layout,onLayoutChange:N,children:Pe(Rs,{className:b,"data-mode":u,ref:M,...f,children:E})}),o||h]})})};var Jf=e=>e==="*",_f=e=>typeof e=="object"&&typeof e.module=="string"&&typeof e.table=="string";import{createContext as Vs,useContext as Os}from"react";import{jsx as et}from"react/jsx-runtime";var Us={},tt=Vs(Us),Ks=({children:e,context:t,inheritedContext:o})=>{let n={...o,...t};return et(tt.Provider,{value:n,children:e})},Xf=({children:e,value:t})=>et(tt.Consumer,{children:o=>et(Ks,{context:t,inheritedContext:o,children:e})}),Yf=()=>Os(tt);import Gs from"classnames";import{ToggleButton as bo,ToggleButtonGroup as Js,useControlled as _s}from"@salt-ds/core";import{useCallback as zs}from"react";import{jsx as xo,jsxs as qs}from"react/jsx-runtime";var Ws="vuuThemeSwitch",u1=({className:e,defaultMode:t,mode:o,onChange:n,...s})=>{let[r,a]=_s({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),l=zs(c=>{let{value:f}=c.target;a(f),n(f)},[n,a]),i=Gs(Ws,e);return qs(Js,{className:i,...s,onChange:l,value:r,children:[xo(bo,{"aria-label":"alert","data-icon":"light",value:"dark"}),xo(bo,{"aria-label":"home","data-icon":"dark",value:"light"})]})};export{dt as AppHeader,ki as ConnectionStatusIcon,po as ContextPanel,Jr as DEFAULT_DENSITY,_r as DEFAULT_THEME,zr as DEFAULT_THEME_MODE,Ji as DensitySwitch,pe as Feature,Je as FeatureList,Yt as LayoutManagementContext,yd as LayoutManagementProvider,jt as LayoutsList,cm as LeftNav,ui as LoginPanel,ba as SaveLayoutPanel,Nm as SessionEditingForm,Uf as Shell,Xf as ShellContextProvider,mo as SidePanel,_e as ThemeContext,ze as ThemeProvider,u1 as ThemeSwitch,di as getAuthDetailsFromCookies,Do as getAuthModeFromCookies,_f as isTableSchema,Jf as isWildcardSchema,pt as logout,Io as redirectToLogin,ve as useLayoutManager,Yf as useShellContext,Co as useShellLayout,G as useThemeAttributes};
|
|
4
4
|
//# sourceMappingURL=index.js.map
|