app-layout-frame 0.0.44 → 0.0.45

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.
@@ -1,2 +1,2 @@
1
- import"@7shifts/sous-chef/dist/index.css";import e,{useState as t,useCallback as n,useRef as a}from"react";import r from"classnames";import{Inline as l,Badge as i,Chip as c,IconAward as o,IconChevronRight as m,IconChevronLeft as s,Avatar as u,Tooltip as d,Dropdown as p,Card as f,Stack as E}from"@7shifts/sous-chef";import{Link as g}from"react-router-dom";var v,_,y={"layout-frame":"_2C1bf","layout-frame--no-height":"___2VV","layout-frame__banner":"_32ZI5","layout-frame__banner--expanded":"_2R4LD","layout-frame__middle-area":"_34YPL","layout-frame__middle-area--full-size":"_jG606","layout-frame__middle-area--no-footer-padding":"_2q-8S","layout-frame__side-bar":"_2dNiZ","layout-frame__side-bar--expanded":"_3kzKX","layout-frame__top-bar":"_299Kx","layout-frame__top-bar--hidden":"_3Gz0Y","layout-frame__content":"_Ri_78"},h=function(){return Boolean(window.navigator.maxTouchPoints)},b=function(t){var n,a=t.as,i=void 0===a?"li":a,c=t.isActive,o=t.children,m={className:r("_1ycHa",(n={},n._1D7jK=void 0!==c&&c,n))},s=e.createElement(l,{alignItems:"center",space:16,flex:["0 1 auto","0 0 145px"]},o);return e.createElement(i,m,s)},N=function(e){if("number"==typeof e){if(e>0&&e<=99)return String(e);if(e>99)return"99+"}else if("string"==typeof e)return"0"===e?null:parseInt(e)>99?"99+":e;return null},w=function(t){var n,a=t.isActive,l=t.icon,o=t.badge,m=t.children,s="string"==typeof o&&""!==o,u="number"==typeof o&&o>0;return e.createElement("li",{className:r("_amex_",(n={},n._WdXeV=void 0!==a&&a,n._1zt6h=!l,n))},l,e.createElement("div",{className:"_lLwWh"},m,u&&e.createElement(i,null,N(o)),s&&e.createElement(c,null,o)))},x=function(t){var n,a=t.isExpanded,l=t.children;return e.createElement("div",{className:r("_1ne7X",(n={},n._1UcHo=a,n["_3Li-q"]=!a,n))},e.createElement(i,null,l))},L={"side-nav-menu-item-group__submenu":"_3_Pzu"},I=function(n){var a=n.isExpanded,r=n.toggleExpand,l=n.item,i=l.label,c=l.badge,m=Boolean(l.items.find(function(e){return e.isActive})),s=t(!!m),u=s[0],d=s[1],p=l.items.sort(function(e,t){return Number(e.isPaywalled||!1)-Number(t.isPaywalled||!1)}),f=l.icon;return e.createElement("li",{className:L["side-nav-menu-item-group"]},e.createElement(g,{to:l.url||l.items[0].url,key:i,onClick:function(){if(!a&&m&&r)return r(),void d(!0);u&&!m||d(!u)}},e.createElement(b,{as:"div",isActive:m},f&&e.createElement(e.Fragment,null,e.createElement(f,null),c>0?e.createElement(x,{isExpanded:a}):void 0),a&&i)),a&&m&&e.createElement("ul",{className:L["side-nav-menu-item-group__submenu"]},p.map(function(t){return e.createElement(g,{to:t.url,key:t.label,onClick:function(){t.onClick&&t.onClick()}},e.createElement(w,{isActive:t.isActive,badge:t.badge,icon:t.isPaywalled?e.createElement(o,{size:"medium",color:"eggplant-500"}):void 0},t.label))})))};function k(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(v||(v={})),function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(_||(_={}));var P=function(){return e.createElement("span",{className:"_22FqA","data-testid":"notification-bullet"})},R=function(t){var n=t.isExpanded,a=t.item,r=a.url,l=a.label,i=a.badge,c=a.icon,o="string"==typeof i&&""!==i,m="number"==typeof i&&i>0,s=!!function(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),k("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let a=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(e,t)=>(a.push(t),"/([^\\/]+)"));return e.endsWith("*")?(a.push("*"),r+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":""!==e&&"/"!==e&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),a]}(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let l=r[0],i=l.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:a.reduce((e,t,n)=>("*"===t&&(i=l.slice(0,l.length-(c[n]||"").length).replace(/(.)\/+$/,"$1")),e[t]=function(e,t){try{return decodeURIComponent(e)}catch(n){return k(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+n+")."),e}}(c[n]||"",t),e),{}),pathname:l,pathnameBase:i,pattern:e}}(window.location.pathname,r);return e.createElement(g,{to:r,key:l,onClick:function(e){s&&e.preventDefault(),a.onClick&&a.onClick()}},e.createElement(b,{isActive:s},c&&e.createElement(e.Fragment,null,e.createElement(c,null),m?e.createElement(x,{isExpanded:n},N(i)):o?e.createElement(P,null):null),n&&l))},C=function(t){var n=t.isExpanded,a=t.toggleExpand,r=U(t.navItems);return e.createElement("ul",{className:"_244gq"},r.map(function(t,l){return"type"in t?l===r.length-1?null:e.createElement("div",{key:l,className:"_BLBDK"}):"items"in t?e.createElement(I,{key:t.label,isExpanded:n,item:t,toggleExpand:a}):e.createElement(R,{key:t.label,isExpanded:n,item:t})}))},U=function(e){return e.filter(function(t,n){return"type"in t?!(n===e.length-1):t.isShowing})},$=function(t){var n=t.navPosition,a=void 0===n?"collapsed":n,r=t.toggleExpand,i=t.navItems,c=t.appLogo,o="expanded"===a||t.isHovering,u=h();return e.createElement("nav",{className:"_9eWEa"},e.createElement("div",{className:"_2gqbS"},e.createElement(l,{alignItems:"center",justifyContent:"space-between"},(!u||o)&&e.createElement("div",{className:"_2l01n"},c),(o||u)&&e.createElement("button",{onClick:r,className:"_1Ccg2"},e.createElement("collapsed"===a?m:s,null)))),e.createElement(C,{isExpanded:o,toggleExpand:r,navItems:i}))},z=function(t){var n=t.companyLogoURL,a=t.companyName;return e.createElement("div",{className:"_9ii6i"},n&&e.createElement("div",{className:"_3iCo3"},e.createElement(u,{size:"large",url:n})),e.createElement(d,{overlay:"Company name"},e.createElement("span",{className:"_2IZqu"},a)))},S=function(t){var n=t.accountMenuDropdown,a=e.createElement("div",{className:"_2yvUY"},e.createElement(u,{size:"large",url:t.userPrifileImageURL}));return e.createElement(p,{trigger:a,triggersOn:"hover",zIndex:6},n)},D=function(t){var n=t.actions,a=t.accountMenuDropdown,r=t.userPrifileImageURL;return e.createElement("div",{className:"_1Hpad"},e.createElement("div",null,e.createElement(z,{companyLogoURL:t.companyLogoURL,companyName:t.companyName})),e.createElement(l,{space:24,alignItems:"center"},e.createElement(l,{space:12,alignItems:"center"},n),e.createElement(S,{accountMenuDropdown:a,userPrifileImageURL:r})))},A=function(l){var i,c,o=l.navItems,m=l.appLogo,s=l.actions,u=l.companyLogoURL,d=l.companyName,p=l.userPrifileImageURL,f=l.accountMenuDropdown,E=l.banner,g=l.children,v=a(null),_=function(e,a){var r=t(function(){try{var t=window.localStorage.getItem(e);return!t||JSON.parse(t)}catch(e){return!0}}),l=r[0],i=r[1],c=n(function(t){try{var n=t instanceof Function?t(l):t;i(n),window.localStorage.setItem(e,JSON.stringify(n))}catch(e){throw new Error(e)}},[e,l]);return[l,c]}("vertical-nav-is-expanded"),b=_[0],N=_[1],w=t(!1),x=w[0],L=w[1],I=h();return e.createElement("div",{className:y["layout-frame"]},e.createElement("div",{ref:v,className:r(y["layout-frame__side-bar"],(i={},i[y["layout-frame__side-bar--expanded"]]=b,i[y["layout-frame__side-bar--collapsed"]]=!b,i)),onMouseEnter:function(){!I&&L(!0)},onMouseLeave:function(){!I&&L(!1)},style:{width:b||x?240:72}},e.createElement($,{isHovering:x,navPosition:b?"expanded":"collapsed",toggleExpand:function(){N(!b),b&&v&&L(!1)},navItems:o,appLogo:m})),e.createElement("div",{className:r(y["layout-frame__middle-area"],(c={},c[y["layout-frame__middle-area--full-size"]]=!1,c))},e.createElement("div",{className:y["layout-frame__top-bar"]},E,e.createElement(D,{companyLogoURL:u,companyName:d,actions:s,userPrifileImageURL:p,accountMenuDropdown:f})),e.createElement("div",{className:y["layout-frame__content"]},g)))},M=function(t){var n=t.onClick;return e.createElement(d,{overlay:t.tooltipContent},e.createElement("button",{className:"_3RkpO",tabIndex:0,onClick:function(){return n()}},t.children))},W=function(t){var n=t.marketingPane,a=t.formBackground,r=t.children;return e.createElement("div",{className:"_3zD6l"},e.createElement("div",{className:"_1Ny96",style:{background:void 0===a?"linear-gradient(235deg, #3a6d7c -8.99%, #2e7eed 85.7%)":a}},e.createElement("div",{className:"_1m5-W"},e.createElement("div",{className:"_2jkua"},t.logo),e.createElement("div",null,e.createElement(f,null,r)))),e.createElement("div",{className:"_2MMwX"},e.createElement(E,{justifyContent:"center",alignItems:"center"},n)))};export{A as LayoutFrame,W as LoginLayoutFrame,M as NavButton};
1
+ import"@7shifts/sous-chef/dist/index.css";import e,{useState as t,useCallback as a,useRef as n}from"react";import r from"classnames";import{Inline as l,Badge as o,Chip as c,IconAward as i,IconChevronRight as m,IconChevronLeft as s,Avatar as u,Tooltip as d,Dropdown as p,Card as f,Stack as E}from"@7shifts/sous-chef";import{Link as v}from"react-router-dom";var g,_,y={"layout-frame":"_2C1bf","layout-frame--no-height":"___2VV","layout-frame__banner":"_32ZI5","layout-frame__banner--expanded":"_2R4LD","layout-frame__middle-area":"_34YPL","layout-frame__middle-area--full-size":"_jG606","layout-frame__middle-area--no-footer-padding":"_2q-8S","layout-frame__side-bar":"_2dNiZ","layout-frame__side-bar--expanded":"_3kzKX","layout-frame__top-bar":"_299Kx","layout-frame__top-bar--hidden":"_3Gz0Y","layout-frame__content":"_Ri_78"},h=function(){return Boolean(window.navigator.maxTouchPoints)},b=function(t){var a,n=t.as,o=void 0===n?"li":n,c=t.isActive,i=t.children,m={className:r("_1ycHa",(a={},a._1D7jK=void 0!==c&&c,a))},s=e.createElement(l,{alignItems:"center",space:16,flex:["0 1 auto","0 0 145px"]},i);return e.createElement(o,m,s)},N=function e(t,a){switch(void 0===a&&(a=99),typeof t){case"number":return t>a?a+"+":""+t;case"string":var n=Number(t);return isNaN(n)?t:e(n);default:return null}},w=function(t){var a,n=t.isActive,l=t.icon,i=t.badge,m=t.children,s="string"==typeof i&&""!==i,u="number"==typeof i&&i>0;return e.createElement("li",{className:r("_amex_",(a={},a._WdXeV=void 0!==n&&n,a._1zt6h=!l,a))},l,e.createElement("div",{className:"_lLwWh"},m,u&&e.createElement(o,null,N(i)),s&&e.createElement(c,null,i)))},x=function(t){var a,n=t.isExpanded,l=t.children;return e.createElement("div",{className:r("_1ne7X",(a={},a._1UcHo=n,a["_3Li-q"]=!n,a))},e.createElement(o,null,l))},L={"side-nav-menu-item-group__submenu":"_3_Pzu"},k=function(a){var n=a.isExpanded,r=a.toggleExpand,l=a.item,o=l.label,c=l.badge,m=Boolean(l.items.find(function(e){return e.isActive})),s=t(!!m),u=s[0],d=s[1],p=l.items.sort(function(e,t){return Number(e.isPaywalled||!1)-Number(t.isPaywalled||!1)}),f=l.icon;return e.createElement("li",{className:L["side-nav-menu-item-group"]},e.createElement(v,{to:l.url||l.items[0].url,key:o,onClick:function(){if(!n&&m&&r)return r(),void d(!0);u&&!m||d(!u)}},e.createElement(b,{as:"div",isActive:m},f&&e.createElement(e.Fragment,null,e.createElement(f,null),c>0?e.createElement(x,{isExpanded:n}):void 0),n&&o)),n&&m&&e.createElement("ul",{className:L["side-nav-menu-item-group__submenu"]},p.map(function(t){return e.createElement(v,{to:t.url,key:t.label,onClick:function(){t.onClick&&t.onClick()}},e.createElement(w,{isActive:t.isActive,badge:t.badge,icon:t.isPaywalled?e.createElement(i,{size:"medium",color:"eggplant-500"}):void 0},t.label))})))};function I(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(g||(g={})),function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(_||(_={}));var P=function(){return e.createElement("span",{className:"_22FqA","data-testid":"notification-bullet"})},R=function(t){var a=t.isExpanded,n=t.item,r=n.url,l=n.label,o=n.badge,c=n.icon,i="string"==typeof o&&""!==o,m="number"==typeof o&&o>0,s=!!function(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[a,n]=function(e,t,a){void 0===t&&(t=!1),void 0===a&&(a=!0),I("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let n=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(e,t)=>(n.push(t),"/([^\\/]+)"));return e.endsWith("*")?(n.push("*"),r+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?r+="\\/*$":""!==e&&"/"!==e&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),n]}(e.path,e.caseSensitive,e.end),r=t.match(a);if(!r)return null;let l=r[0],o=l.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:n.reduce((e,t,a)=>("*"===t&&(o=l.slice(0,l.length-(c[a]||"").length).replace(/(.)\/+$/,"$1")),e[t]=function(e,t){try{return decodeURIComponent(e)}catch(a){return I(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+a+")."),e}}(c[a]||"",t),e),{}),pathname:l,pathnameBase:o,pattern:e}}(window.location.pathname,r);return e.createElement(v,{to:r,key:l,onClick:function(e){s&&e.preventDefault(),n.onClick&&n.onClick()}},e.createElement(b,{isActive:s},c&&e.createElement(e.Fragment,null,e.createElement(c,null),m?e.createElement(x,{isExpanded:a},N(o)):i?e.createElement(P,null):null),a&&l))},C=function(t){var a=t.isExpanded,n=t.toggleExpand,r=U(t.navItems);return e.createElement("ul",{className:"_244gq"},r.map(function(t,l){return"type"in t?l===r.length-1?null:e.createElement("div",{key:l,className:"_BLBDK"}):"items"in t?e.createElement(k,{key:t.label,isExpanded:a,item:t,toggleExpand:n}):e.createElement(R,{key:t.label,isExpanded:a,item:t})}))},U=function(e){return e.filter(function(t,a){return"type"in t?!(a===e.length-1):t.isShowing})},$=function(t){var a=t.navPosition,n=void 0===a?"collapsed":a,r=t.toggleExpand,o=t.navItems,c=t.appLogo,i="expanded"===n||t.isHovering,u=h();return e.createElement("nav",{className:"_9eWEa"},e.createElement("div",{className:"_2gqbS"},e.createElement(l,{alignItems:"center",justifyContent:"space-between"},(!u||i)&&e.createElement("div",{className:"_2l01n"},c),(i||u)&&e.createElement("button",{onClick:r,className:"_1Ccg2"},e.createElement("collapsed"===n?m:s,null)))),e.createElement(C,{isExpanded:i,toggleExpand:r,navItems:o}))},z=function(t){var a=t.companyLogoURL,n=t.companyName;return e.createElement("div",{className:"_9ii6i"},a&&e.createElement("div",{className:"_3iCo3"},e.createElement(u,{size:"large",url:a})),e.createElement(d,{overlay:"Company name"},e.createElement("span",{className:"_2IZqu"},n)))},D=function(t){var a=t.accountMenuDropdown,n=e.createElement("div",{className:"_2yvUY"},e.createElement(u,{size:"large",url:t.userProfileImageURL}));return e.createElement(p,{trigger:n,triggersOn:"hover",zIndex:6},a)},S=function(t){var a=t.actions,n=t.accountMenuDropdown,r=t.userProfileImageURL;return e.createElement("div",{className:"_1Hpad"},e.createElement("div",null,e.createElement(z,{companyLogoURL:t.companyLogoURL,companyName:t.companyName})),e.createElement(l,{space:24,alignItems:"center"},e.createElement(l,{space:12,alignItems:"center"},a),e.createElement(D,{accountMenuDropdown:n,userProfileImageURL:r})))},A=function(l){var o,c,i=l.navItems,m=l.appLogo,s=l.actions,u=l.companyLogoURL,d=l.companyName,p=l.userProfileImageURL,f=l.accountMenuDropdown,E=l.banner,v=l.children,g=n(null),_=function(e,n){var r=t(function(){try{var t=window.localStorage.getItem(e);return!t||JSON.parse(t)}catch(e){return!0}}),l=r[0],o=r[1],c=a(function(t){try{var a=t instanceof Function?t(l):t;o(a),window.localStorage.setItem(e,JSON.stringify(a))}catch(e){throw new Error(e)}},[e,l]);return[l,c]}("vertical-nav-is-expanded"),b=_[0],N=_[1],w=t(!1),x=w[0],L=w[1],k=h();return e.createElement("div",{className:y["layout-frame"]},e.createElement("div",{ref:g,className:r(y["layout-frame__side-bar"],(o={},o[y["layout-frame__side-bar--expanded"]]=b,o[y["layout-frame__side-bar--collapsed"]]=!b,o)),onMouseEnter:function(){!k&&L(!0)},onMouseLeave:function(){!k&&L(!1)},style:{width:b||x?240:72}},e.createElement($,{isHovering:x,navPosition:b?"expanded":"collapsed",toggleExpand:function(){N(!b),b&&g&&L(!1)},navItems:i,appLogo:m})),e.createElement("div",{className:r(y["layout-frame__middle-area"],(c={},c[y["layout-frame__middle-area--full-size"]]=!1,c))},e.createElement("div",{className:y["layout-frame__top-bar"]},E,e.createElement(S,{companyLogoURL:u,companyName:d,actions:s,userProfileImageURL:p,accountMenuDropdown:f})),e.createElement("div",{className:y["layout-frame__content"]},v)))},M=function(t){var a=t.onClick;return e.createElement(d,{overlay:t.tooltipContent},e.createElement("button",{className:"_3RkpO",tabIndex:0,onClick:function(){return a()}},t.children))},W=function(t){var a=t.marketingPane,n=t.formBackground,r=t.children;return e.createElement("div",{className:"_3zD6l"},e.createElement("div",{className:"_1Ny96",style:{background:void 0===n?"linear-gradient(235deg, #3a6d7c -8.99%, #2e7eed 85.7%)":n}},e.createElement("div",{className:"_1m5-W"},e.createElement("div",{className:"_2jkua"},t.logo),e.createElement("div",null,e.createElement(f,null,r)))),e.createElement("div",{className:"_2MMwX"},e.createElement(E,{justifyContent:"center",alignItems:"center"},a)))};export{A as LayoutFrame,W as LoginLayoutFrame,M as NavButton};
2
2
  //# sourceMappingURL=index.modern.js.map