@lokalise/harmony 1.6.0 → 1.8.1

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/harmony.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),h=require("react"),f=require("@lokalise/louis"),qe=require("date-fns"),Qe=require("date-fns-tz");function en(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const k=en(h);var B=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function De(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var z,fe;function ae(){if(fe)return z;fe=1;function e(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}return z=e,z}var F,me;function nn(){if(me)return F;me=1;var e=typeof B=="object"&&B&&B.Object===Object&&B;return F=e,F}var W,ge;function Be(){if(ge)return W;ge=1;var e=nn(),n=typeof self=="object"&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return W=t,W}var H,be;function tn(){if(be)return H;be=1;var e=Be(),n=function(){return e.Date.now()};return H=n,H}var G,he;function rn(){if(he)return G;he=1;var e=/\s/;function n(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}return G=n,G}var V,pe;function an(){if(pe)return V;pe=1;var e=rn(),n=/^\s+/;function t(r){return r&&r.slice(0,e(r)+1).replace(n,"")}return V=t,V}var Y,_e;function $e(){if(_e)return Y;_e=1;var e=Be(),n=e.Symbol;return Y=n,Y}var Z,ve;function sn(){if(ve)return Z;ve=1;var e=$e(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,a=e?e.toStringTag:void 0;function s(o){var l=t.call(o,a),u=o[a];try{o[a]=void 0;var c=!0}catch{}var d=r.call(o);return c&&(l?o[a]=u:delete o[a]),d}return Z=s,Z}var X,je;function on(){if(je)return X;je=1;var e=Object.prototype,n=e.toString;function t(r){return n.call(r)}return X=t,X}var J,xe;function cn(){if(xe)return J;xe=1;var e=$e(),n=sn(),t=on(),r="[object Null]",a="[object Undefined]",s=e?e.toStringTag:void 0;function o(l){return l==null?l===void 0?a:r:s&&s in Object(l)?n(l):t(l)}return J=o,J}var K,Te;function ln(){if(Te)return K;Te=1;function e(n){return n!=null&&typeof n=="object"}return K=e,K}var Q,Ie;function un(){if(Ie)return Q;Ie=1;var e=cn(),n=ln(),t="[object Symbol]";function r(a){return typeof a=="symbol"||n(a)&&e(a)==t}return Q=r,Q}var ee,Ne;function dn(){if(Ne)return ee;Ne=1;var e=an(),n=ae(),t=un(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,l=parseInt;function u(c){if(typeof c=="number")return c;if(t(c))return r;if(n(c)){var d=typeof c.valueOf=="function"?c.valueOf():c;c=n(d)?d+"":d}if(typeof c!="string")return c===0?c:+c;c=e(c);var b=s.test(c);return b||o.test(c)?l(c.slice(2),b?2:8):a.test(c)?r:+c}return ee=u,ee}var ne,we;function Ue(){if(we)return ne;we=1;var e=ae(),n=tn(),t=dn(),r="Expected a function",a=Math.max,s=Math.min;function o(l,u,c){var d,b,T,w,g,j,I=0,N=!1,p=!1,y=!0;if(typeof l!="function")throw new TypeError(r);u=t(u)||0,e(c)&&(N=!!c.leading,p="maxWait"in c,T=p?a(t(c.maxWait)||0,u):T,y="trailing"in c?!!c.trailing:y);function v(m){var S=d,O=b;return d=b=void 0,I=m,w=l.apply(O,S),w}function _(m){return I=m,g=setTimeout(D,u),N?v(m):w}function q(m){var S=m-j,O=m-I,de=u-S;return p?s(de,T-O):de}function le(m){var S=m-j,O=m-I;return j===void 0||S>=u||S<0||p&&O>=T}function D(){var m=n();if(le(m))return ue(m);g=setTimeout(D,q(m))}function ue(m){return g=void 0,y&&d?v(m):(d=b=void 0,w)}function Je(){g!==void 0&&clearTimeout(g),I=0,d=j=b=g=void 0}function Ke(){return g===void 0?w:ue(n())}function U(){var m=n(),S=le(m);if(d=arguments,b=this,j=m,S){if(g===void 0)return _(j);if(p)return clearTimeout(g),g=setTimeout(D,u),v(j)}return g===void 0&&(g=setTimeout(D,u)),w}return U.cancel=Je,U.flush=Ke,U}return ne=o,ne}var fn=Ue();const mn=De(fn);var te,ye;function gn(){if(ye)return te;ye=1;var e=Ue(),n=ae(),t="Expected a function";function r(a,s,o){var l=!0,u=!0;if(typeof a!="function")throw new TypeError(t);return n(o)&&(l="leading"in o?!!o.leading:l,u="trailing"in o?!!o.trailing:u),e(a,s,{leading:l,maxWait:s,trailing:u})}return te=r,te}var bn=gn();const hn=De(bn),pn=(e,n,t,r)=>{switch(n){case"debounce":return mn(e,t,r);case"throttle":return hn(e,t,r);default:return e}},_n=e=>{const n=k.useRef(e);return k.useEffect(()=>{n.current=e}),k.useMemo(()=>(...t)=>{var r;return(r=n.current)===null||r===void 0?void 0:r.call(n,...t)},[])},vn=e=>{const[n,t]=k.useState((e==null?void 0:e.current)||null);return e&&setTimeout(()=>{e.current!==n&&t(e.current)},0),{refProxy:k.useMemo(()=>new Proxy(a=>{a!==n&&t(a)},{get(a,s){return s==="current"?n:a[s]},set(a,s,o){return s==="current"?t(o):a[s]=o,!0}}),[n]),refElement:n,setRefElement:t}},jn=(e,n)=>n==="border-box"?{width:e.borderBoxSize[0].inlineSize,height:e.borderBoxSize[0].blockSize}:n==="content-box"?{width:e.contentBoxSize[0].inlineSize,height:e.contentBoxSize[0].blockSize}:{width:e.contentRect.width,height:e.contentRect.height};function xn({skipOnMount:e=!1,refreshMode:n,refreshRate:t=1e3,refreshOptions:r,handleWidth:a=!0,handleHeight:s=!0,targetRef:o,observerOptions:l,onResize:u}={}){const c=h.useRef(e),d=_n(u),[b,T]=h.useState({width:void 0,height:void 0}),{refProxy:w,refElement:g}=vn(o),{box:j}=l||{},I=h.useCallback(p=>{if(!a&&!s)return;if(c.current){c.current=!1;return}const y=(v,_)=>a&&v.width!==_.width||s&&v.height!==_.height;p.forEach(v=>{const _=jn(v,j);T(q=>y(q,_)?(d==null||d({width:_.width,height:_.height,entry:v}),_):q)})},[a,s,c,j]),N=h.useCallback(pn(I,n,t,r),[I,n,t,r]);return h.useEffect(()=>{let p;return g?(p=new window.ResizeObserver(N),p.observe(g,l)):(b.width||b.height)&&(d==null||d({width:null,height:null,entry:null}),T({width:void 0,height:void 0})),()=>{var y,v,_;(y=p==null?void 0:p.disconnect)===null||y===void 0||y.call(p),(_=(v=N).cancel)===null||_===void 0||_.call(v)}},[N,g]),Object.assign({ref:w},b)}function ze(e){var n,t,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(n=0;n<a;n++)e[n]&&(t=ze(e[n]))&&(r&&(r+=" "),r+=t)}else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function L(){for(var e,n,t=0,r="",a=arguments.length;t<a;t++)(e=arguments[t])&&(n=ze(e))&&(r&&(r+=" "),r+=n);return r}const Tn="_headerContainer_1cubo_1",In="_navigationTabList_1cubo_8",Nn="_navigationTab_1cubo_8",wn="_headerContent_1cubo_34",yn="_staticEnabled_1cubo_50",C={headerContainer:Tn,navigationTabList:In,navigationTab:Nn,headerContent:wn,staticEnabled:yn},Sn=77,A=({sticky:e,children:n})=>{const{ref:t,height:r}=xn({refreshMode:"debounce",refreshRate:0}),[a,s]=h.useState(!1),o=()=>a?!e:!0;h.useEffect(()=>{const u=()=>{s(window.scrollY>0)};return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const l=`${r||Sn}px`;return i.jsx("div",{style:{minHeight:l},children:i.jsx("div",{children:i.jsxs("div",{ref:t,className:L(C.headerContent,{[C.staticEnabled]:o()}),children:[i.jsx(A.Header,{}),i.jsx(A.Tabs,{}),n]})})})};A.Header=({children:e})=>i.jsx("div",{className:C.headerContainer,children:e});A.Tabs=({children:e})=>i.jsx("div",{className:"flex justify-between gap-2 nowrap",children:e});const Pn="_sidebarContainer_bmdti_1",En={sidebarContainer:Pn},Ln="_logoLink_1baxb_1",Rn={logoLink:Ln},Cn=({src:e,href:n="/",ariaLabel:t="Home",alt:r="Lokalise"})=>i.jsx("a",{className:Rn.logoLink,href:n,"aria-label":t,children:i.jsx("img",{src:e,alt:r})}),On="_link_1weq1_1",kn="_active_1weq1_18",Se={link:On,active:kn},An=({label:e,to:n,icon:t})=>i.jsx(f.Tooltip,{placement:"right",tooltip:e,children:i.jsx(f.Link,{className:L(Se.link,{[Se.active]:window.location.pathname.startsWith(n)}),href:n,children:i.jsx(t,{size:"25px"})})}),Mn="_dropdownButton_hwh0c_1",qn="_dropdownButtonActive_hwh0c_18",Pe={dropdownButton:Mn,dropdownButtonActive:qn},Dn=({children:e,icon:n})=>i.jsx(f.Menu,{menuButton:({opened:t})=>i.jsx(f.Tooltip,{placement:"right",tooltip:"Help",children:i.jsx("button",{type:"button",className:L(Pe.dropdownButton,{[Pe.dropdownButtonActive]:t}),children:i.jsx(n,{size:"25px"})})}),children:i.jsx(f.MenuList,{placement:"right-start",children:e})}),Bn="_iconContainer_nz34m_1",$n={iconContainer:Bn},Fe=({className:e=""})=>i.jsx("div",{"aria-label":"Upgrade Icon",className:L($n.iconContainer,"flex-row","items-center","justify-center",e),children:i.jsx(f.CaretUpIcon,{})}),Un="_menuContainer_wbu3u_5",zn="_profileButton_wbu3u_16",Fn="_profileImage_wbu3u_29",Wn="_profileImageHighlight_wbu3u_37",Hn="_profileImageUpgradeIcon_wbu3u_41",Gn="_userIconWrapper_wbu3u_47",P={menuContainer:Un,profileButton:zn,profileImage:Fn,profileImageHighlight:Wn,profileImageUpgradeIcon:Hn,userIconWrapper:Gn},We=h.createContext({}),M=()=>h.useContext(We),Vn=({children:e})=>{const{currentTeam:n,otherTeams:t,showUpgradeCta:r,showBillingButton:a,allowTeamCreation:s,isProviderAlpha:o,canAccessTeamSettings:l,isEndOfTrialActive:u,isTeamSuspended:c,isFullyAuthenticated:d}=M();return i.jsx(f.Menu,{menuButton:()=>i.jsxs("button",{className:P.profileButton,"aria-label":"Profile menu",type:"button",children:[n!=null&&n.logoUrl?i.jsx("img",{src:n.logoUrl,className:L(P.profileImage,{[P.profileImageHighlight]:r}),alt:"Team Logo"}):i.jsx("div",{className:L(P.userIconWrapper,"flex-row","align-center","items-center",{[P.profileImageHighlight]:r}),children:i.jsx(f.UserIcon,{size:"25px"})}),r&&i.jsx(Fe,{className:P.profileImageUpgradeIcon})]}),children:i.jsx(f.MenuList,{placement:"right-end",className:P.menuContainer,children:e({allowTeamCreation:s,otherTeams:t,canAccessTeamSettings:l,isEndOfTrialActive:u,isTeamSuspended:c,showBillingButton:a,isProviderAlpha:o,isFullyAuthenticated:d})})})},se=0,He=9999,Ge=[150,151,250,251],Ve=[152,153,252,253],Ye=[154,155,157,158,254,255,258,354,355,358],Ze=[156,159,160,256,259,260],oe=9998,$=e=>e===se,ce=e=>e===He,Yn=e=>Ge.includes(e),Zn=e=>Ve.includes(e),Xn=e=>Ye.includes(e),Jn=e=>Ze.includes(e),Kn=e=>e>se&&e<oe,Qn=e=>e===oe,et=/\n/,Ee=(e,n,t)=>e.split(n).flatMap((r,a)=>a!==0?[h.cloneElement(t,{key:Math.random().toString(32).slice(0,10)}),r]:r),nt=(e,n,t)=>typeof e=="string"?Ee(e,n,t):e.flatMap(r=>typeof r=="string"?Ee(r,n,t):r),tt=e=>nt(e,et,i.jsx("br",{})),rt=/(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi,it=e=>e.match(rt)??[],Le=(e,n,t)=>{const r=e.split(n);if(r.length===1)return e;const a=[];return r[0]!==""&&a.push(r[0]),r.shift(),r[r.length-1]===""&&r.pop(),a.push(i.jsx("a",{href:n,target:"_blank",rel:"noreferrer noopener",children:n},n+t)),a.push(r.join(n)),a.filter(s=>s!=="")},Re=e=>{const n=it(e);return n!=null&&n.length?n.reduce((t,r,a)=>typeof t=="string"?Le(t,r,a):t.flatMap(s=>typeof s=="string"?Le(s,r,a):s),e):e},at=e=>typeof e=="string"?Re(e):e.flatMap(n=>typeof n=="string"?Re(n):n,e),st=(e,n="PP")=>qe.format(e,n),ot=(e,n,t="PP")=>qe.format(Qe.toZonedTime(e,n),t),ct=e=>{h.useEffect(e,[])},Ce={biller:"biller",owner:"owner"},Oe=[Ce.biller,Ce.owner],lt=({children:e,config:n})=>{const{teams:t,currentTeamId:r,planId:a,isEndOfTrialActive:s,isFullyAuthenticated:o,userTeamRole:l}=n,u=t.find(N=>N.id===r),c=t.filter(N=>N.id!==r),d=Oe.includes(l),b=Oe.includes(l),T=$(a)||ce(a),I={...n,currentTeam:u,otherTeams:c,canChangeBilling:d,canAccessTeamSettings:b,isOnFreeOrTrialPlan:T,showUpgradeCta:o&&T&&d,showBillingButton:o&&b&&d,allowTeamCreation:o&&!s};return i.jsx(We.Provider,{value:I,children:e})},ut=({config:e,children:n})=>i.jsx(lt,{config:e,children:i.jsx(Vn,{children:n})}),dt="_container_q5pot_1",ft="_profileEmail_q5pot_5",ke={container:dt,profileEmail:ft},mt=({href:e,onClick:n,userEmail:t,hideBottomDivider:r})=>{const{isEndOfTrialActive:a,isTeamSuspended:s}=M();return a||s?null:i.jsxs(i.Fragment,{children:[i.jsx(f.MenuItem,{href:e,onClick:()=>{n==null||n()},children:i.jsxs("div",{className:`flex-col ${ke.container}`,children:[i.jsx("span",{children:"Profile Settings"}),i.jsx("span",{className:ke.profileEmail,children:t})]})}),!r&&i.jsx(f.MenuDivider,{})]})},gt="_wrapper_15d85_1",bt="_profileImage_15d85_14",ht="_teamName_15d85_22",pt="_planLabel_15d85_29",_t="_membership_15d85_38",vt="_defaultProfileImage_15d85_44",R={wrapper:gt,profileImage:bt,teamName:ht,planLabel:pt,membership:_t,defaultProfileImage:vt},Xe=({team:e,onClick:n,hidePlanLabel:t})=>{const{currentTeam:r,planId:a}=M(),s=e||r;if(!s)return null;const o=$(a)?"Free":ce(a)?"Trial":void 0,l=n?f.MenuItem:"div";return i.jsxs(l,{className:`flex-row gap-2 flex-nowrap items-center ${R.wrapper}`,...n&&{onClick:()=>n(s)},children:[s.logoUrl?i.jsx("img",{className:R.profileImage,src:s.logoUrl,alt:"Team Logo"}):i.jsx("span",{className:`flex-row justify-center items-center ${R.defaultProfileImage}`,children:i.jsx(f.UserIcon,{size:"25px"})}),i.jsxs("div",{className:"flex-col items-start",children:[i.jsxs("div",{className:"flex-row items-center flex-nowrap gap-2",children:[i.jsx("span",{title:s.name,className:R.teamName,children:s.name}),o&&!t&&i.jsx("span",{className:`flex-row justify-center items-center ${R.planLabel}`,children:o})]}),i.jsx("span",{className:R.membership,children:s.role})]})]})},jt="_teamsContainer_1t68g_1",xt={teamsContainer:jt},Tt=({onSwitchTeam:e})=>{const{otherTeams:n}=M();return n.length===0?null:i.jsx("div",{className:`flex-col items-stretch ${xt.teamsContainer}`,children:n.map(t=>i.jsx(Xe,{team:t,onClick:e,hidePlanLabel:!0},t.id))})},It="_container_1u995_1",Nt="_planCta_1u995_15",wt="_upgradeIconWrapper_1u995_19",re={container:It,planCta:Nt,upgradeIconWrapper:wt},yt=({upgradeOptionHref:e})=>{const{planId:n,trialDaysLeft:t,showUpgradeCta:r}=M();if(!r)return null;const o=$(n)?"Your team is currently on the Free plan":`Free trial ends in ${t} ${t===1?"day":"days"}`;return i.jsxs(f.MenuItem,{href:e,className:`flex-col gap-1 items-start ${re.container}`,children:[i.jsx("span",{className:re.planCta,children:o}),i.jsxs("div",{className:`flex-row items-center gap-1 ${re.upgradeIconWrapper}`,children:[i.jsx(Fe,{}),i.jsx("span",{children:"See upgrade options"})]})]})},x=({children:e,...n})=>i.jsx("nav",{...n,className:En.sidebarContainer,children:e});x.Top=({children:e})=>i.jsx("div",{children:e});x.Bottom=({children:e})=>i.jsx("div",{children:e});x.Avatar=Cn;x.IconLink=An;x.Menu=Dn;x.ProfileMenu=ut;x.TeamSwitch=Tt;x.TeamMenuItem=Xe;x.UpgradeMenuItem=yt;x.ProfileSettingsMenuItem=mt;const St="_breadcrumbsItem_1hm6a_1",Pt="_breadcrumbs_1hm6a_1",Ae={breadcrumbsItem:St,breadcrumbs:Pt},Et=({items:e})=>i.jsx("nav",{"aria-label":"breadcrumb",className:Ae.breadcrumbs,children:e.map((n,t)=>i.jsxs(h.Fragment,{children:[i.jsx(f.Link,{className:Ae.breadcrumbsItem,href:n.link,rel:"noreferrer",children:n.name}),t<e.length-1&&i.jsx("span",{children:" — "})]},`${n.link}-${n.name}`))}),Lt=({items:e})=>i.jsx(i.Fragment,{children:e.map((n,t)=>i.jsxs(h.Fragment,{children:[!!t&&n.some(r=>r.visible)&&i.jsx(f.MenuDivider,{}),n.filter(({visible:r})=>r).map(({link:r,label:a,onClick:s})=>i.jsx(f.MenuItem,{href:r||"#","aria-label":a,onClick:s,children:a},a))]},n[0].label))}),Rt="_badge_1pc1v_1",Ct="_tag_1pc1v_15",Ot="_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21",kt="_disabled_1pc1v_57",At="_projectNavigationItem_1pc1v_61",Mt="_projectNavigationItemDisabled_1pc1v_67",E={badge:Rt,tag:Ct,withNavLinkStyle:Ot,disabled:kt,projectNavigationItem:At,projectNavigationItemDisabled:Mt},Me=({label:e,badge:n,novel:t})=>i.jsxs("div",{className:"flex gap-1",children:[i.jsxs("div",{children:[i.jsx("span",{children:e}),!!n&&i.jsx("div",{className:E.badge,"aria-label":`${n} items requiring attention`,children:n>9?"9+":n})]}),!!t&&i.jsx(f.Tag,{className:E.tag,children:t})]}),ie=h.forwardRef(({label:e,href:n="",disabled:t=!1,badge:r,onClick:a,novel:s},o)=>i.jsx(f.Tooltip,{tooltip:"You do not have access to this function",show:t,children:i.jsx("div",{className:t?E.projectNavigationItemDisabled:E.projectNavigationItem,children:a||t||!n?i.jsx("button",{type:"button",ref:o,className:L(E.withNavLinkStyle,{[E.disabled]:t}),disabled:t,onClick:a,children:i.jsx(Me,{label:e,badge:r,novel:s})}):i.jsx("a",{href:n,className:E.withNavLinkStyle,children:i.jsx(Me,{label:e,badge:r,novel:s})})})}));ie.displayName="NavigationTabsItem";const qt=e=>(e==null?void 0:e.some(n=>n.some(t=>t.visible)))??!1,Dt=e=>e.visible&&(!e.dropdown||qt(e.dropdown)),Bt=({navigation:e,activeItem:n})=>i.jsx("nav",{"aria-label":"Project",children:i.jsx("ul",{className:C.navigationTabList,"aria-orientation":"horizontal",children:e.filter(Dt).map(t=>{var r,a,s;return t.dropdown?i.jsx("li",{className:C.navigationTab,"data-testid":t.key,"aria-selected":(r=t.isActive)==null?void 0:r.call(t,n),children:i.jsx(f.Menu,{menuButton:({opened:o})=>i.jsx(ie,{label:t.label,disabled:t.disabled,active:o}),children:i.jsx(f.MenuList,{children:i.jsx(Lt,{items:t.dropdown})})})},t.key):i.jsx("li",{className:C.navigationTab,"data-testid":t.key,"aria-selected":(a=t.isActive)==null?void 0:a.call(t,n),children:i.jsx(ie,{label:t.label,href:t.link,onClick:t.onClick,disabled:t.disabled,badge:t.badge,novel:t.novel,active:(s=t.isActive)==null?void 0:s.call(t,n)})},t.key)})})});exports.Breadcrumbs=Et;exports.ENTERPRISE_OPENSOURCE_PLAN_ID=oe;exports.ENTERPRISE_PLAN_IDS=Ze;exports.ESSENTIAL_PLAN_IDS=Ve;exports.FREE_PLAN_ID=se;exports.NavigationPanel=A;exports.NavigationTabs=Bt;exports.PRO_PLAN_IDS=Ye;exports.START_PLAN_IDS=Ge;exports.Sidebar=x;exports.TRIAL_PLAN_ID=He;exports.convertNewLineToBreakTag=tt;exports.formatDate=st;exports.formatDateTz=ot;exports.isEnterpriseOpenSourcePlan=Qn;exports.isEnterprisePlan=Jn;exports.isEssentialPlan=Zn;exports.isFreePlan=$;exports.isPaidPlan=Kn;exports.isProPlan=Xn;exports.isStartPlan=Yn;exports.isTrialPlan=ce;exports.makeUrlClickable=at;exports.useEffectOnce=ct;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),p=require("react"),f=require("@lokalise/louis"),qe=require("date-fns"),Qe=require("date-fns-tz");function en(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const k=en(p);var B=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function De(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var z,fe;function ae(){if(fe)return z;fe=1;function e(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}return z=e,z}var F,me;function nn(){if(me)return F;me=1;var e=typeof B=="object"&&B&&B.Object===Object&&B;return F=e,F}var W,ge;function Be(){if(ge)return W;ge=1;var e=nn(),n=typeof self=="object"&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return W=t,W}var H,be;function tn(){if(be)return H;be=1;var e=Be(),n=function(){return e.Date.now()};return H=n,H}var G,pe;function rn(){if(pe)return G;pe=1;var e=/\s/;function n(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}return G=n,G}var V,he;function an(){if(he)return V;he=1;var e=rn(),n=/^\s+/;function t(r){return r&&r.slice(0,e(r)+1).replace(n,"")}return V=t,V}var Y,_e;function $e(){if(_e)return Y;_e=1;var e=Be(),n=e.Symbol;return Y=n,Y}var Z,ve;function sn(){if(ve)return Z;ve=1;var e=$e(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,a=e?e.toStringTag:void 0;function s(o){var l=t.call(o,a),u=o[a];try{o[a]=void 0;var c=!0}catch{}var d=r.call(o);return c&&(l?o[a]=u:delete o[a]),d}return Z=s,Z}var X,je;function on(){if(je)return X;je=1;var e=Object.prototype,n=e.toString;function t(r){return n.call(r)}return X=t,X}var J,xe;function cn(){if(xe)return J;xe=1;var e=$e(),n=sn(),t=on(),r="[object Null]",a="[object Undefined]",s=e?e.toStringTag:void 0;function o(l){return l==null?l===void 0?a:r:s&&s in Object(l)?n(l):t(l)}return J=o,J}var K,Te;function ln(){if(Te)return K;Te=1;function e(n){return n!=null&&typeof n=="object"}return K=e,K}var Q,Ie;function un(){if(Ie)return Q;Ie=1;var e=cn(),n=ln(),t="[object Symbol]";function r(a){return typeof a=="symbol"||n(a)&&e(a)==t}return Q=r,Q}var ee,Ne;function dn(){if(Ne)return ee;Ne=1;var e=an(),n=ae(),t=un(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,l=parseInt;function u(c){if(typeof c=="number")return c;if(t(c))return r;if(n(c)){var d=typeof c.valueOf=="function"?c.valueOf():c;c=n(d)?d+"":d}if(typeof c!="string")return c===0?c:+c;c=e(c);var b=s.test(c);return b||o.test(c)?l(c.slice(2),b?2:8):a.test(c)?r:+c}return ee=u,ee}var ne,we;function Ue(){if(we)return ne;we=1;var e=ae(),n=tn(),t=dn(),r="Expected a function",a=Math.max,s=Math.min;function o(l,u,c){var d,b,T,w,g,j,I=0,N=!1,h=!1,y=!0;if(typeof l!="function")throw new TypeError(r);u=t(u)||0,e(c)&&(N=!!c.leading,h="maxWait"in c,T=h?a(t(c.maxWait)||0,u):T,y="trailing"in c?!!c.trailing:y);function v(m){var S=d,O=b;return d=b=void 0,I=m,w=l.apply(O,S),w}function _(m){return I=m,g=setTimeout(D,u),N?v(m):w}function q(m){var S=m-j,O=m-I,de=u-S;return h?s(de,T-O):de}function le(m){var S=m-j,O=m-I;return j===void 0||S>=u||S<0||h&&O>=T}function D(){var m=n();if(le(m))return ue(m);g=setTimeout(D,q(m))}function ue(m){return g=void 0,y&&d?v(m):(d=b=void 0,w)}function Je(){g!==void 0&&clearTimeout(g),I=0,d=j=b=g=void 0}function Ke(){return g===void 0?w:ue(n())}function U(){var m=n(),S=le(m);if(d=arguments,b=this,j=m,S){if(g===void 0)return _(j);if(h)return clearTimeout(g),g=setTimeout(D,u),v(j)}return g===void 0&&(g=setTimeout(D,u)),w}return U.cancel=Je,U.flush=Ke,U}return ne=o,ne}var fn=Ue();const mn=De(fn);var te,ye;function gn(){if(ye)return te;ye=1;var e=Ue(),n=ae(),t="Expected a function";function r(a,s,o){var l=!0,u=!0;if(typeof a!="function")throw new TypeError(t);return n(o)&&(l="leading"in o?!!o.leading:l,u="trailing"in o?!!o.trailing:u),e(a,s,{leading:l,maxWait:s,trailing:u})}return te=r,te}var bn=gn();const pn=De(bn),hn=(e,n,t,r)=>{switch(n){case"debounce":return mn(e,t,r);case"throttle":return pn(e,t,r);default:return e}},_n=e=>{const n=k.useRef(e);return k.useEffect(()=>{n.current=e}),k.useMemo(()=>(...t)=>{var r;return(r=n.current)===null||r===void 0?void 0:r.call(n,...t)},[])},vn=e=>{const[n,t]=k.useState((e==null?void 0:e.current)||null);return e&&setTimeout(()=>{e.current!==n&&t(e.current)},0),{refProxy:k.useMemo(()=>new Proxy(a=>{a!==n&&t(a)},{get(a,s){return s==="current"?n:a[s]},set(a,s,o){return s==="current"?t(o):a[s]=o,!0}}),[n]),refElement:n,setRefElement:t}},jn=(e,n)=>n==="border-box"?{width:e.borderBoxSize[0].inlineSize,height:e.borderBoxSize[0].blockSize}:n==="content-box"?{width:e.contentBoxSize[0].inlineSize,height:e.contentBoxSize[0].blockSize}:{width:e.contentRect.width,height:e.contentRect.height};function xn({skipOnMount:e=!1,refreshMode:n,refreshRate:t=1e3,refreshOptions:r,handleWidth:a=!0,handleHeight:s=!0,targetRef:o,observerOptions:l,onResize:u}={}){const c=p.useRef(e),d=_n(u),[b,T]=p.useState({width:void 0,height:void 0}),{refProxy:w,refElement:g}=vn(o),{box:j}=l||{},I=p.useCallback(h=>{if(!a&&!s)return;if(c.current){c.current=!1;return}const y=(v,_)=>a&&v.width!==_.width||s&&v.height!==_.height;h.forEach(v=>{const _=jn(v,j);T(q=>y(q,_)?(d==null||d({width:_.width,height:_.height,entry:v}),_):q)})},[a,s,c,j]),N=p.useCallback(hn(I,n,t,r),[I,n,t,r]);return p.useEffect(()=>{let h;return g?(h=new window.ResizeObserver(N),h.observe(g,l)):(b.width||b.height)&&(d==null||d({width:null,height:null,entry:null}),T({width:void 0,height:void 0})),()=>{var y,v,_;(y=h==null?void 0:h.disconnect)===null||y===void 0||y.call(h),(_=(v=N).cancel)===null||_===void 0||_.call(v)}},[N,g]),Object.assign({ref:w},b)}function ze(e){var n,t,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(n=0;n<a;n++)e[n]&&(t=ze(e[n]))&&(r&&(r+=" "),r+=t)}else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function L(){for(var e,n,t=0,r="",a=arguments.length;t<a;t++)(e=arguments[t])&&(n=ze(e))&&(r&&(r+=" "),r+=n);return r}const Tn="_headerContainer_1cubo_1",In="_navigationTabList_1cubo_8",Nn="_navigationTab_1cubo_8",wn="_headerContent_1cubo_34",yn="_staticEnabled_1cubo_50",C={headerContainer:Tn,navigationTabList:In,navigationTab:Nn,headerContent:wn,staticEnabled:yn},Sn=77,A=({sticky:e,children:n})=>{const{ref:t,height:r}=xn({refreshMode:"debounce",refreshRate:0}),[a,s]=p.useState(!1),o=()=>a?!e:!0;p.useEffect(()=>{const u=()=>{s(window.scrollY>0)};return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]);const l=`${r||Sn}px`;return i.jsx("div",{style:{minHeight:l},children:i.jsx("div",{children:i.jsxs("div",{ref:t,className:L(C.headerContent,{[C.staticEnabled]:o()}),children:[i.jsx(A.Header,{}),i.jsx(A.Tabs,{}),n]})})})};A.Header=({children:e})=>i.jsx("div",{className:C.headerContainer,children:e});A.Tabs=({children:e})=>i.jsx("div",{className:"flex justify-between gap-2 nowrap",children:e});const Pn="_sidebarContainer_bmdti_1",En={sidebarContainer:Pn},Ln="_logoLink_1baxb_1",Rn={logoLink:Ln},Cn=({src:e,href:n="/",ariaLabel:t="Home",alt:r="Lokalise"})=>i.jsx("a",{className:Rn.logoLink,href:n,"aria-label":t,children:i.jsx("img",{src:e,alt:r})}),On="_link_1weq1_1",kn="_active_1weq1_18",Se={link:On,active:kn},An=({label:e,to:n,icon:t})=>i.jsx(f.Tooltip,{placement:"right",tooltip:e,children:i.jsx(f.Link,{className:L(Se.link,{[Se.active]:window.location.pathname.startsWith(n)}),href:n,children:i.jsx(t,{size:"25px"})})}),Mn="_dropdownButton_hwh0c_1",qn="_dropdownButtonActive_hwh0c_18",Pe={dropdownButton:Mn,dropdownButtonActive:qn},Dn=({children:e,icon:n})=>i.jsx(f.Menu,{menuButton:({opened:t})=>i.jsx(f.Tooltip,{placement:"right",tooltip:"Help",children:i.jsx("button",{type:"button",className:L(Pe.dropdownButton,{[Pe.dropdownButtonActive]:t}),children:i.jsx(n,{size:"25px"})})}),children:i.jsx(f.MenuList,{placement:"right-start",children:e})}),Bn="_iconContainer_nz34m_1",$n={iconContainer:Bn},Fe=({className:e=""})=>i.jsx("div",{"aria-label":"Upgrade Icon",className:L($n.iconContainer,"flex-row","items-center","justify-center",e),children:i.jsx(f.CaretUpIcon,{})}),Un="_menuContainer_wbu3u_5",zn="_profileButton_wbu3u_16",Fn="_profileImage_wbu3u_29",Wn="_profileImageHighlight_wbu3u_37",Hn="_profileImageUpgradeIcon_wbu3u_41",Gn="_userIconWrapper_wbu3u_47",P={menuContainer:Un,profileButton:zn,profileImage:Fn,profileImageHighlight:Wn,profileImageUpgradeIcon:Hn,userIconWrapper:Gn},We=p.createContext({}),M=()=>p.useContext(We),Vn=({children:e})=>{const{currentTeam:n,otherTeams:t,showUpgradeCta:r,showBillingButton:a,allowTeamCreation:s,isProviderAlpha:o,canAccessTeamSettings:l,isEndOfTrialActive:u,isTeamSuspended:c,isFullyAuthenticated:d}=M();return i.jsx(f.Menu,{menuButton:()=>i.jsxs("button",{className:P.profileButton,"aria-label":"Profile menu",type:"button",children:[n!=null&&n.logoUrl?i.jsx("img",{src:n.logoUrl,className:L(P.profileImage,{[P.profileImageHighlight]:r}),alt:"Team Logo"}):i.jsx("div",{className:L(P.userIconWrapper,"flex-row","align-center","items-center",{[P.profileImageHighlight]:r}),children:i.jsx(f.UserIcon,{size:"25px"})}),r&&i.jsx(Fe,{className:P.profileImageUpgradeIcon})]}),children:i.jsx(f.MenuList,{placement:"right-end",className:P.menuContainer,children:e({allowTeamCreation:s,otherTeams:t,canAccessTeamSettings:l,isEndOfTrialActive:u,isTeamSuspended:c,showBillingButton:a,isProviderAlpha:o,isFullyAuthenticated:d})})})},se=0,He=9999,Ge=[150,151,250,251],Ve=[152,153,252,253],Ye=[154,155,157,158,254,255,258,354,355,358],Ze=[156,159,160,256,259,260],oe=9998,$=e=>e===se,ce=e=>e===He,Yn=e=>Ge.includes(e),Zn=e=>Ve.includes(e),Xn=e=>Ye.includes(e),Jn=e=>Ze.includes(e),Kn=e=>e>se&&e<oe,Qn=e=>e===oe,et=/\n/,Ee=(e,n,t)=>e.split(n).flatMap((r,a)=>a!==0?[p.cloneElement(t,{key:Math.random().toString(32).slice(0,10)}),r]:r),nt=(e,n,t)=>typeof e=="string"?Ee(e,n,t):e.flatMap(r=>typeof r=="string"?Ee(r,n,t):r),tt=e=>nt(e,et,i.jsx("br",{})),rt=/(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi,it=e=>e.match(rt)??[],Le=(e,n,t)=>{const r=e.split(n);if(r.length===1)return e;const a=[];return r[0]!==""&&a.push(r[0]),r.shift(),r[r.length-1]===""&&r.pop(),a.push(i.jsx("a",{href:n,target:"_blank",rel:"noreferrer noopener",children:n},n+t)),a.push(r.join(n)),a.filter(s=>s!=="")},Re=e=>{const n=it(e);return n!=null&&n.length?n.reduce((t,r,a)=>typeof t=="string"?Le(t,r,a):t.flatMap(s=>typeof s=="string"?Le(s,r,a):s),e):e},at=e=>typeof e=="string"?Re(e):e.flatMap(n=>typeof n=="string"?Re(n):n,e),st=(e,n="PP")=>qe.format(e,n),ot=(e,n,t="PP")=>qe.format(Qe.toZonedTime(e,n),t),ct=e=>{p.useEffect(e,[])},Ce={biller:"biller",owner:"owner"},Oe=[Ce.biller,Ce.owner],lt=({children:e,config:n})=>{const{teams:t,currentTeamId:r,planId:a,isEndOfTrialActive:s,isFullyAuthenticated:o,userTeamRole:l}=n,u=t.find(N=>N.id===r),c=t.filter(N=>N.id!==r),d=Oe.includes(l),b=Oe.includes(l),T=$(a)||ce(a),I={...n,currentTeam:u,otherTeams:c,canChangeBilling:d,canAccessTeamSettings:b,isOnFreeOrTrialPlan:T,showUpgradeCta:o&&T&&d,showBillingButton:o&&b&&d,allowTeamCreation:o&&!s};return i.jsx(We.Provider,{value:I,children:e})},ut=({config:e,children:n})=>i.jsx(lt,{config:e,children:i.jsx(Vn,{children:n})}),dt="_container_q5pot_1",ft="_profileEmail_q5pot_5",ke={container:dt,profileEmail:ft},mt=({href:e,onClick:n,userEmail:t,hideBottomDivider:r})=>{const{isEndOfTrialActive:a,isTeamSuspended:s}=M();return a||s?null:i.jsxs(i.Fragment,{children:[i.jsx(f.MenuItem,{href:e,onClick:()=>{n==null||n()},children:i.jsxs("div",{className:`flex-col ${ke.container}`,children:[i.jsx("span",{children:"Profile Settings"}),i.jsx("span",{className:ke.profileEmail,children:t})]})}),!r&&i.jsx(f.MenuDivider,{})]})},gt="_wrapper_15d85_1",bt="_profileImage_15d85_14",pt="_teamName_15d85_22",ht="_planLabel_15d85_29",_t="_membership_15d85_38",vt="_defaultProfileImage_15d85_44",R={wrapper:gt,profileImage:bt,teamName:pt,planLabel:ht,membership:_t,defaultProfileImage:vt},Xe=({team:e,onClick:n,hidePlanLabel:t})=>{const{currentTeam:r,planId:a}=M(),s=e||r;if(!s)return null;const o=$(a)?"Free":ce(a)?"Trial":void 0,l=n?f.MenuItem:"div";return i.jsxs(l,{className:`flex-row gap-2 flex-nowrap items-center ${R.wrapper}`,...n&&{onClick:()=>n(s)},children:[s.logoUrl?i.jsx("img",{className:R.profileImage,src:s.logoUrl,alt:"Team Logo"}):i.jsx("span",{className:`flex-row justify-center items-center ${R.defaultProfileImage}`,children:i.jsx(f.UserIcon,{size:"25px"})}),i.jsxs("div",{className:"flex-col items-start",children:[i.jsxs("div",{className:"flex-row items-center flex-nowrap gap-2",children:[i.jsx("span",{title:s.name,className:R.teamName,children:s.name}),o&&!t&&i.jsx("span",{className:`flex-row justify-center items-center ${R.planLabel}`,children:o})]}),i.jsx("span",{className:R.membership,children:s.role})]})]})},jt="_teamsContainer_1t68g_1",xt={teamsContainer:jt},Tt=({onSwitchTeam:e})=>{const{otherTeams:n}=M();return n.length===0?null:i.jsx("div",{className:`flex-col items-stretch ${xt.teamsContainer}`,children:n.map(t=>i.jsx(Xe,{team:t,onClick:e,hidePlanLabel:!0},t.id))})},It="_container_1u995_1",Nt="_planCta_1u995_15",wt="_upgradeIconWrapper_1u995_19",re={container:It,planCta:Nt,upgradeIconWrapper:wt},yt=({upgradeOptionHref:e})=>{const{planId:n,trialDaysLeft:t,showUpgradeCta:r}=M();if(!r)return null;const o=$(n)?"Your team is currently on the Free plan":`Free trial ends in ${t} ${t===1?"day":"days"}`;return i.jsxs(f.MenuItem,{href:e,className:`flex-col gap-1 items-start ${re.container}`,children:[i.jsx("span",{className:re.planCta,children:o}),i.jsxs("div",{className:`flex-row items-center gap-1 ${re.upgradeIconWrapper}`,children:[i.jsx(Fe,{}),i.jsx("span",{children:"See upgrade options"})]})]})},x=({children:e,...n})=>i.jsx("nav",{...n,className:En.sidebarContainer,children:e}),St=({children:e})=>i.jsx("div",{children:e});x.Top=St;const Pt=({children:e})=>i.jsx("div",{children:e});x.Bottom=Pt;x.Avatar=Cn;x.IconLink=An;x.Menu=Dn;x.ProfileMenu=ut;x.TeamSwitch=Tt;x.TeamMenuItem=Xe;x.UpgradeMenuItem=yt;x.ProfileSettingsMenuItem=mt;const Et="_breadcrumbsItem_1hm6a_1",Lt="_breadcrumbs_1hm6a_1",Ae={breadcrumbsItem:Et,breadcrumbs:Lt},Rt=({items:e})=>i.jsx("nav",{"aria-label":"breadcrumb",className:Ae.breadcrumbs,children:e.map((n,t)=>i.jsxs(p.Fragment,{children:[i.jsx(f.Link,{className:Ae.breadcrumbsItem,href:n.link,rel:"noreferrer",children:n.name}),t<e.length-1&&i.jsx("span",{children:" — "})]},`${n.link}-${n.name}`))}),Ct=({items:e})=>i.jsx(i.Fragment,{children:e.map((n,t)=>i.jsxs(p.Fragment,{children:[!!t&&n.some(r=>r.visible)&&i.jsx(f.MenuDivider,{}),n.filter(({visible:r})=>r).map(({link:r,label:a,onClick:s})=>i.jsx(f.MenuItem,{href:r||"#","aria-label":a,onClick:s,children:a},a))]},n[0].label))}),Ot="_badge_1pc1v_1",kt="_tag_1pc1v_15",At="_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21",Mt="_disabled_1pc1v_57",qt="_projectNavigationItem_1pc1v_61",Dt="_projectNavigationItemDisabled_1pc1v_67",E={badge:Ot,tag:kt,withNavLinkStyle:At,disabled:Mt,projectNavigationItem:qt,projectNavigationItemDisabled:Dt},Me=({label:e,badge:n,novel:t})=>i.jsxs("div",{className:"flex gap-1",children:[i.jsxs("div",{children:[i.jsx("span",{children:e}),!!n&&i.jsx("div",{className:E.badge,"aria-label":`${n} items requiring attention`,children:n>9?"9+":n})]}),!!t&&i.jsx(f.Tag,{className:E.tag,children:t})]}),ie=p.forwardRef(({label:e,href:n="",disabled:t=!1,badge:r,onClick:a,novel:s},o)=>i.jsx(f.Tooltip,{tooltip:"You do not have access to this function",show:t,children:i.jsx("div",{className:t?E.projectNavigationItemDisabled:E.projectNavigationItem,children:a||t||!n?i.jsx("button",{type:"button",ref:o,className:L(E.withNavLinkStyle,{[E.disabled]:t}),disabled:t,onClick:a,children:i.jsx(Me,{label:e,badge:r,novel:s})}):i.jsx("a",{href:n,className:E.withNavLinkStyle,children:i.jsx(Me,{label:e,badge:r,novel:s})})})}));ie.displayName="NavigationTabsItem";const Bt=e=>(e==null?void 0:e.some(n=>n.some(t=>t.visible)))??!1,$t=e=>e.visible&&(!e.dropdown||Bt(e.dropdown)),Ut=({navigation:e,activeItem:n})=>i.jsx("nav",{"aria-label":"Project",children:i.jsx("ul",{className:C.navigationTabList,"aria-orientation":"horizontal",children:e.filter($t).map(t=>{var r,a,s;return t.dropdown?i.jsx("li",{className:C.navigationTab,"data-testid":t.key,"aria-selected":(r=t.isActive)==null?void 0:r.call(t,n),children:i.jsx(f.Menu,{menuButton:({opened:o})=>i.jsx(ie,{label:t.label,disabled:t.disabled,active:o}),children:i.jsx(f.MenuList,{children:i.jsx(Ct,{items:t.dropdown})})})},t.key):i.jsx("li",{className:C.navigationTab,"data-testid":t.key,"aria-selected":(a=t.isActive)==null?void 0:a.call(t,n),children:i.jsx(ie,{label:t.label,href:t.link,onClick:t.onClick,disabled:t.disabled,badge:t.badge,novel:t.novel,active:(s=t.isActive)==null?void 0:s.call(t,n)})},t.key)})})});exports.Breadcrumbs=Rt;exports.ENTERPRISE_OPENSOURCE_PLAN_ID=oe;exports.ENTERPRISE_PLAN_IDS=Ze;exports.ESSENTIAL_PLAN_IDS=Ve;exports.FREE_PLAN_ID=se;exports.NavigationPanel=A;exports.NavigationTabs=Ut;exports.PRO_PLAN_IDS=Ye;exports.START_PLAN_IDS=Ge;exports.Sidebar=x;exports.TRIAL_PLAN_ID=He;exports.convertNewLineToBreakTag=tt;exports.formatDate=st;exports.formatDateTz=ot;exports.isEnterpriseOpenSourcePlan=Qn;exports.isEnterprisePlan=Jn;exports.isEssentialPlan=Zn;exports.isFreePlan=$;exports.isPaidPlan=Kn;exports.isProPlan=Xn;exports.isStartPlan=Yn;exports.isTrialPlan=ce;exports.makeUrlClickable=at;exports.useEffectOnce=ct;
package/dist/harmony.mjs CHANGED
@@ -460,7 +460,7 @@ const Un = "_sidebarContainer_bmdti_1", Dn = {
460
460
  }) })
461
461
  }
462
462
  );
463
- }, Qe = 0, ot = 9999, st = [150, 151, 250, 251], ct = [152, 153, 252, 253], lt = [154, 155, 157, 158, 254, 255, 258, 354, 355, 358], ut = [156, 159, 160, 256, 259, 260], en = 9998, le = (e) => e === Qe, nn = (e) => e === ot, Zt = (e) => st.includes(e), Xt = (e) => ct.includes(e), Jt = (e) => lt.includes(e), Kt = (e) => ut.includes(e), Qt = (e) => e > Qe && e < en, er = (e) => e === en, dt = /\n/, Ce = (e, n, t) => e.split(n).flatMap((r, a) => a !== 0 ? [ln(t, { key: Math.random().toString(32).slice(0, 10) }), r] : r), ft = (e, n, t) => typeof e == "string" ? Ce(e, n, t) : e.flatMap((r) => typeof r == "string" ? Ce(r, n, t) : r), nr = (e) => ft(e, dt, /* @__PURE__ */ i("br", {})), mt = /(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi, ht = (e) => e.match(mt) ?? [], Le = (e, n, t) => {
463
+ }, Qe = 0, ot = 9999, st = [150, 151, 250, 251], ct = [152, 153, 252, 253], lt = [154, 155, 157, 158, 254, 255, 258, 354, 355, 358], ut = [156, 159, 160, 256, 259, 260], en = 9998, le = (e) => e === Qe, nn = (e) => e === ot, Jt = (e) => st.includes(e), Kt = (e) => ct.includes(e), Qt = (e) => lt.includes(e), er = (e) => ut.includes(e), nr = (e) => e > Qe && e < en, tr = (e) => e === en, dt = /\n/, Ce = (e, n, t) => e.split(n).flatMap((r, a) => a !== 0 ? [ln(t, { key: Math.random().toString(32).slice(0, 10) }), r] : r), ft = (e, n, t) => typeof e == "string" ? Ce(e, n, t) : e.flatMap((r) => typeof r == "string" ? Ce(r, n, t) : r), rr = (e) => ft(e, dt, /* @__PURE__ */ i("br", {})), mt = /(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi, ht = (e) => e.match(mt) ?? [], Le = (e, n, t) => {
464
464
  const r = e.split(n);
465
465
  if (r.length === 1)
466
466
  return e;
@@ -471,7 +471,7 @@ const Un = "_sidebarContainer_bmdti_1", Dn = {
471
471
  }, ke = (e) => {
472
472
  const n = ht(e);
473
473
  return n != null && n.length ? n.reduce((t, r, a) => typeof t == "string" ? Le(t, r, a) : t.flatMap((o) => typeof o == "string" ? Le(o, r, a) : o), e) : e;
474
- }, tr = (e) => typeof e == "string" ? ke(e) : e.flatMap((n) => typeof n == "string" ? ke(n) : n, e), rr = (e, n = "PP") => He(e, n), ir = (e, n, t = "PP") => He(mn(e, n), t), ar = (e) => {
474
+ }, ir = (e) => typeof e == "string" ? ke(e) : e.flatMap((n) => typeof n == "string" ? ke(n) : n, e), ar = (e, n = "PP") => He(e, n), or = (e, n, t = "PP") => He(mn(e, n), t), sr = (e) => {
475
475
  ie(e, []);
476
476
  }, Oe = {
477
477
  biller: "biller",
@@ -568,9 +568,10 @@ const Un = "_sidebarContainer_bmdti_1", Dn = {
568
568
  /* @__PURE__ */ i("span", { children: "See upgrade options" })
569
569
  ] })
570
570
  ] });
571
- }, y = ({ children: e, ...n }) => /* @__PURE__ */ i("nav", { ...n, className: Dn.sidebarContainer, children: e });
572
- y.Top = ({ children: e }) => /* @__PURE__ */ i("div", { children: e });
573
- y.Bottom = ({ children: e }) => /* @__PURE__ */ i("div", { children: e });
571
+ }, y = ({ children: e, ...n }) => /* @__PURE__ */ i("nav", { ...n, className: Dn.sidebarContainer, children: e }), kt = ({ children: e }) => /* @__PURE__ */ i("div", { children: e });
572
+ y.Top = kt;
573
+ const Ot = ({ children: e }) => /* @__PURE__ */ i("div", { children: e });
574
+ y.Bottom = Ot;
574
575
  y.Avatar = Wn;
575
576
  y.IconLink = Vn;
576
577
  y.Menu = Xn;
@@ -579,22 +580,22 @@ y.TeamSwitch = jt;
579
580
  y.TeamMenuItem = tn;
580
581
  y.UpgradeMenuItem = Lt;
581
582
  y.ProfileSettingsMenuItem = vt;
582
- const kt = "_breadcrumbsItem_1hm6a_1", Ot = "_breadcrumbs_1hm6a_1", Be = {
583
- breadcrumbsItem: kt,
584
- breadcrumbs: Ot
585
- }, or = ({ items: e }) => /* @__PURE__ */ i("nav", { "aria-label": "breadcrumb", className: Be.breadcrumbs, children: e.map((n, t) => /* @__PURE__ */ b(De, { children: [
583
+ const At = "_breadcrumbsItem_1hm6a_1", qt = "_breadcrumbs_1hm6a_1", Be = {
584
+ breadcrumbsItem: At,
585
+ breadcrumbs: qt
586
+ }, cr = ({ items: e }) => /* @__PURE__ */ i("nav", { "aria-label": "breadcrumb", className: Be.breadcrumbs, children: e.map((n, t) => /* @__PURE__ */ b(De, { children: [
586
587
  /* @__PURE__ */ i(ze, { className: Be.breadcrumbsItem, href: n.link, rel: "noreferrer", children: n.name }),
587
588
  t < e.length - 1 && /* @__PURE__ */ i("span", { children: " — " })
588
- ] }, `${n.link}-${n.name}`)) }), At = ({ items: e }) => /* @__PURE__ */ i($e, { children: e.map((n, t) => /* @__PURE__ */ b(De, { children: [
589
+ ] }, `${n.link}-${n.name}`)) }), Bt = ({ items: e }) => /* @__PURE__ */ i($e, { children: e.map((n, t) => /* @__PURE__ */ b(De, { children: [
589
590
  !!t && n.some((r) => r.visible) && /* @__PURE__ */ i(We, {}),
590
591
  n.filter(({ visible: r }) => r).map(({ link: r, label: a, onClick: o }) => /* @__PURE__ */ i($, { href: r || "#", "aria-label": a, onClick: o, children: a }, a))
591
- ] }, n[0].label)) }), qt = "_badge_1pc1v_1", Bt = "_tag_1pc1v_15", Mt = "_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21", $t = "_disabled_1pc1v_57", Ut = "_projectNavigationItem_1pc1v_61", Dt = "_projectNavigationItemDisabled_1pc1v_67", j = {
592
- badge: qt,
593
- tag: Bt,
594
- withNavLinkStyle: Mt,
595
- disabled: $t,
596
- projectNavigationItem: Ut,
597
- projectNavigationItemDisabled: Dt
592
+ ] }, n[0].label)) }), Mt = "_badge_1pc1v_1", $t = "_tag_1pc1v_15", Ut = "_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21", Dt = "_disabled_1pc1v_57", zt = "_projectNavigationItem_1pc1v_61", Ft = "_projectNavigationItemDisabled_1pc1v_67", j = {
593
+ badge: Mt,
594
+ tag: $t,
595
+ withNavLinkStyle: Ut,
596
+ disabled: Dt,
597
+ projectNavigationItem: zt,
598
+ projectNavigationItemDisabled: Ft
598
599
  }, Me = ({ label: e, badge: n, novel: t }) => /* @__PURE__ */ b("div", { className: "flex gap-1", children: [
599
600
  /* @__PURE__ */ b("div", { children: [
600
601
  /* @__PURE__ */ i("span", { children: e }),
@@ -623,7 +624,7 @@ const kt = "_breadcrumbsItem_1hm6a_1", Ot = "_breadcrumbs_1hm6a_1", Be = {
623
624
  ) })
624
625
  );
625
626
  re.displayName = "NavigationTabsItem";
626
- const zt = (e) => (e == null ? void 0 : e.some((n) => n.some((t) => t.visible))) ?? !1, Ft = (e) => e.visible && (!e.dropdown || zt(e.dropdown)), sr = ({ navigation: e, activeItem: n }) => /* @__PURE__ */ i("nav", { "aria-label": "Project", children: /* @__PURE__ */ i("ul", { className: C.navigationTabList, "aria-orientation": "horizontal", children: e.filter(Ft).map((t) => {
627
+ const Wt = (e) => (e == null ? void 0 : e.some((n) => n.some((t) => t.visible))) ?? !1, Ht = (e) => e.visible && (!e.dropdown || Wt(e.dropdown)), lr = ({ navigation: e, activeItem: n }) => /* @__PURE__ */ i("nav", { "aria-label": "Project", children: /* @__PURE__ */ i("ul", { className: C.navigationTabList, "aria-orientation": "horizontal", children: e.filter(Ht).map((t) => {
627
628
  var r, a, o;
628
629
  return t.dropdown ? /* @__PURE__ */ i(
629
630
  "li",
@@ -635,7 +636,7 @@ const zt = (e) => (e == null ? void 0 : e.some((n) => n.some((t) => t.visible)))
635
636
  oe,
636
637
  {
637
638
  menuButton: ({ opened: s }) => /* @__PURE__ */ i(re, { label: t.label, disabled: t.disabled, active: s }),
638
- children: /* @__PURE__ */ i(se, { children: /* @__PURE__ */ i(At, { items: t.dropdown }) })
639
+ children: /* @__PURE__ */ i(se, { children: /* @__PURE__ */ i(Bt, { items: t.dropdown }) })
639
640
  }
640
641
  )
641
642
  },
@@ -663,28 +664,28 @@ const zt = (e) => (e == null ? void 0 : e.some((n) => n.some((t) => t.visible)))
663
664
  );
664
665
  }) }) });
665
666
  export {
666
- or as Breadcrumbs,
667
+ cr as Breadcrumbs,
667
668
  en as ENTERPRISE_OPENSOURCE_PLAN_ID,
668
669
  ut as ENTERPRISE_PLAN_IDS,
669
670
  ct as ESSENTIAL_PLAN_IDS,
670
671
  Qe as FREE_PLAN_ID,
671
672
  M as NavigationPanel,
672
- sr as NavigationTabs,
673
+ lr as NavigationTabs,
673
674
  lt as PRO_PLAN_IDS,
674
675
  st as START_PLAN_IDS,
675
676
  y as Sidebar,
676
677
  ot as TRIAL_PLAN_ID,
677
- nr as convertNewLineToBreakTag,
678
- rr as formatDate,
679
- ir as formatDateTz,
680
- er as isEnterpriseOpenSourcePlan,
681
- Kt as isEnterprisePlan,
682
- Xt as isEssentialPlan,
678
+ rr as convertNewLineToBreakTag,
679
+ ar as formatDate,
680
+ or as formatDateTz,
681
+ tr as isEnterpriseOpenSourcePlan,
682
+ er as isEnterprisePlan,
683
+ Kt as isEssentialPlan,
683
684
  le as isFreePlan,
684
- Qt as isPaidPlan,
685
- Jt as isProPlan,
686
- Zt as isStartPlan,
685
+ nr as isPaidPlan,
686
+ Qt as isProPlan,
687
+ Jt as isStartPlan,
687
688
  nn as isTrialPlan,
688
- tr as makeUrlClickable,
689
- ar as useEffectOnce
689
+ ir as makeUrlClickable,
690
+ sr as useEffectOnce
690
691
  };
@@ -2,10 +2,13 @@ import { HTMLProps, PropsWithChildren, ReactNode } from 'react';
2
2
  type SidebarProps = HTMLProps<HTMLElement> & {
3
3
  children: ReactNode;
4
4
  };
5
+ /**
6
+ * Sidebar is a self-contained component using widgets.
7
+ */
5
8
  declare const Sidebar: {
6
9
  ({ children, ...navProps }: SidebarProps): import("react/jsx-runtime").JSX.Element;
7
- Top({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
8
- Bottom({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
10
+ Top: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
11
+ Bottom: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
9
12
  Avatar: ({ src, href, ariaLabel, alt }: {
10
13
  src: string;
11
14
  href?: string;
@@ -4,5 +4,8 @@ type AvatarProps = {
4
4
  ariaLabel?: string;
5
5
  alt?: string;
6
6
  };
7
+ /**
8
+ * Display company main avatar / logo in the top section
9
+ */
7
10
  export declare const Avatar: ({ src, href, ariaLabel, alt }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
8
11
  export {};
@@ -5,5 +5,8 @@ type IconLinkProps = {
5
5
  label: string;
6
6
  icon: FC<SvgIconProps>;
7
7
  };
8
+ /**
9
+ * Display link with an icon. Mainly used in the top section
10
+ */
8
11
  export declare const IconLink: ({ label, to, icon: Icon }: IconLinkProps) => import("react/jsx-runtime").JSX.Element;
9
12
  export {};
@@ -3,5 +3,8 @@ import { FC, PropsWithChildren } from 'react';
3
3
  type MenuProps = PropsWithChildren<{
4
4
  icon: FC<SvgIconProps>;
5
5
  }>;
6
+ /**
7
+ * Use this widget for simple side menu. Currently utilised for `Help` section
8
+ */
6
9
  export declare const Menu: ({ children, icon: Icon }: MenuProps) => import("react/jsx-runtime").JSX.Element;
7
10
  export {};
@@ -4,5 +4,9 @@ type ProfileMenuProps = {
4
4
  config: SidebarProfileMenuConfig;
5
5
  children: ProfileMenuContentProps['children'];
6
6
  };
7
+ /**
8
+ * Contextual component, requires initial configuration
9
+ * and works with internal widgets
10
+ */
7
11
  export declare const ProfileMenu: ({ config, children }: ProfileMenuProps) => import("react/jsx-runtime").JSX.Element;
8
12
  export {};
@@ -4,5 +4,9 @@ type ProfileSettingsMenuItemProps = {
4
4
  onClick?: () => void;
5
5
  hideBottomDivider?: boolean;
6
6
  };
7
+ /**
8
+ * Menu item that comes with a small user's email and renders conditionally,
9
+ * only if team is not suspended or is not at the end of a trial
10
+ */
7
11
  export declare const ProfileSettingsMenuItem: ({ href, onClick, userEmail, hideBottomDivider, }: ProfileSettingsMenuItemProps) => import("react/jsx-runtime").JSX.Element | null;
8
12
  export {};
@@ -4,5 +4,10 @@ type TeamMenuItemProps = {
4
4
  onClick?: (team: SidebarTeam) => void;
5
5
  hidePlanLabel?: boolean;
6
6
  };
7
+ /**
8
+ * Uses context of current team, and depending on ability to switch team or not,
9
+ * it renders as a div or clickable MenuItem. If used with TeamSwitch, it triggers `onSwitchTeams`
10
+ * callback, passing relevant team as an argument
11
+ */
7
12
  export declare const TeamMenuItem: ({ team, onClick, hidePlanLabel }: TeamMenuItemProps) => import("react/jsx-runtime").JSX.Element | null;
8
13
  export {};
@@ -2,5 +2,8 @@ import { SidebarTeam } from '../../../types';
2
2
  type TeamSwitchProps = {
3
3
  onSwitchTeam: (team: SidebarTeam) => void;
4
4
  };
5
+ /**
6
+ * Uses available teams (other than current) and allows user to switch between them
7
+ */
5
8
  export declare const TeamSwitch: ({ onSwitchTeam }: TeamSwitchProps) => import("react/jsx-runtime").JSX.Element | null;
6
9
  export {};
@@ -1,5 +1,10 @@
1
1
  type UpgradeMenuItemProps = {
2
2
  upgradeOptionHref: string;
3
3
  };
4
+ /**
5
+ * Menu item conditionally rendering only if `showUpgradeButton` is `true`.
6
+ * It renders correct upgrade note depending on the current team plan
7
+ * and red arrow up to indicate an update option.
8
+ */
4
9
  export declare const UpgradeMenuItem: ({ upgradeOptionHref }: UpgradeMenuItemProps) => import("react/jsx-runtime").JSX.Element | null;
5
10
  export {};
@@ -1,4 +1,5 @@
1
1
  import { SidebarTeam, SidebarTeamRole } from '../../types';
2
+ export type { SidebarTeam, SidebarTeamRole } from '../../types';
2
3
  export type SidebarProfileMenuConfig = {
3
4
  teams: SidebarTeam[];
4
5
  isTeamSuspended: boolean;
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * COMPONENTS EXPORTS
3
3
  */
4
+ export * from './components/Sidebar/Widgets/ProfileMenu/types';
4
5
  export { NavigationPanel } from './components/NavigationPanel/NavigationPanel';
5
6
  export { Sidebar } from './components/Sidebar/Sidebar';
6
7
  export { Breadcrumbs } from './components/NavigationPanel/components/Breadcrumbs/Breadcrumbs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/harmony",
3
- "version": "1.6.0",
3
+ "version": "1.8.1",
4
4
  "author": {
5
5
  "name": "Lokalise",
6
6
  "url": "https://lokalise.com/"
@@ -8,7 +8,7 @@
8
8
  "homepage": "https://github.com/lokalise/harmony",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/lokalise/harmony.git"
11
+ "url": "git+https://github.com/lokalise/harmony.git"
12
12
  },
13
13
  "files": ["dist/**", "README.md"],
14
14
  "type": "module",
@@ -39,8 +39,8 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@biomejs/biome": "^1.9.4",
42
- "@chromatic-com/storybook": "^3.2.4",
43
- "@faker-js/faker": "^9.5.0",
42
+ "@chromatic-com/storybook": "^3.2.5",
43
+ "@faker-js/faker": "^9.6.0",
44
44
  "@lokalise/biome-config": "^1.6.1",
45
45
  "@semantic-release/changelog": "^6.0.3",
46
46
  "@semantic-release/commit-analyzer": "^13.0.1",
@@ -48,13 +48,13 @@
48
48
  "@semantic-release/github": "^11.0.1",
49
49
  "@semantic-release/npm": "^12.0.1",
50
50
  "@semantic-release/release-notes-generator": "^14.0.3",
51
- "@storybook/addon-essentials": "^8.6.0-alpha.4",
52
- "@storybook/addon-interactions": "^8.6.0-alpha.4",
53
- "@storybook/addon-onboarding": "^8.6.0-alpha.4",
54
- "@storybook/addon-themes": "^8.6.1",
51
+ "@storybook/addon-essentials": "^8.6.4",
52
+ "@storybook/addon-interactions": "^8.6.4",
53
+ "@storybook/addon-onboarding": "^8.6.4",
54
+ "@storybook/addon-themes": "^8.6.4",
55
55
  "@storybook/blocks": "^8.6.0-alpha.1",
56
- "@storybook/react": "^8.6.0-alpha.4",
57
- "@storybook/react-vite": "^8.6.0-alpha.4",
56
+ "@storybook/react": "^8.6.4",
57
+ "@storybook/react-vite": "^8.6.4",
58
58
  "@storybook/test": "^8.6.0-alpha.1",
59
59
  "@testing-library/jest-dom": "^6.4.6",
60
60
  "@testing-library/react": "^16.2.0",
@@ -62,21 +62,21 @@
62
62
  "@types/node": "^22.13.1",
63
63
  "@types/react": "^18.3.18",
64
64
  "@types/react-dom": "18.3.0",
65
- "@typescript-eslint/parser": "^8.23.0",
65
+ "@typescript-eslint/parser": "^8.26.1",
66
66
  "@vitejs/plugin-react": "^4.3.4",
67
- "@vitest/coverage-v8": "^3.0.5",
67
+ "@vitest/coverage-v8": "^3.0.8",
68
68
  "bundlesize2": "^0.0.34",
69
69
  "conventional-changelog-conventionalcommits": "^8.0.0",
70
70
  "eslint-plugin-i18next": "^6.0.9",
71
- "eslint-plugin-storybook": "^0.11.2",
71
+ "eslint-plugin-storybook": "^0.11.4",
72
72
  "eslint-plugin-testing-library": "^7.1.1",
73
73
  "jsdom": "26.0.0",
74
74
  "rimraf": "^6.0.1",
75
- "semantic-release": "^24.2.1",
75
+ "semantic-release": "^24.2.3",
76
76
  "storybook": "^8.6.0-alpha.1",
77
77
  "typescript": "^5.7.3",
78
- "vite": "^6.0.11",
79
- "vite-plugin-dts": "^4.5.0",
78
+ "vite": "^6.2.1",
79
+ "vite-plugin-dts": "^4.5.3",
80
80
  "vite-plugin-tsconfig-paths": "^1.4.1",
81
81
  "vitest": "^3.0.3"
82
82
  },