@lokalise/harmony 1.2.0 → 1.3.0

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.
Files changed (32) hide show
  1. package/dist/harmony.cjs +1 -1
  2. package/dist/harmony.css +1 -0
  3. package/dist/harmony.mjs +385 -35
  4. package/dist/types/index.d.ts +1 -1
  5. package/dist/types/src/components/NavigationPanel/NavigationPanel.d.ts +10 -0
  6. package/dist/types/src/components/NavigationPanel/components/Breadcrumbs/Breadcrumbs.d.ts +9 -0
  7. package/dist/types/src/components/NavigationPanel/components/Breadcrumbs/Breadcrumbs.test.d.ts +1 -0
  8. package/dist/types/src/components/NavigationPanel/components/DropdownContent/DropdownContent.d.ts +4 -0
  9. package/dist/types/src/components/NavigationPanel/components/DropdownContent/DropdownContent.test.d.ts +1 -0
  10. package/dist/types/src/components/NavigationPanel/components/NavigationTabs/NavigationTabs.d.ts +7 -0
  11. package/dist/types/src/components/NavigationPanel/components/NavigationTabs/NavigationTabs.test.d.ts +1 -0
  12. package/dist/types/src/components/NavigationPanel/components/NavigationTabs/NavigationTabsItem/NavItemContents.d.ts +7 -0
  13. package/dist/types/src/components/NavigationPanel/components/NavigationTabs/NavigationTabsItem/NavigationTabsItem.d.ts +11 -0
  14. package/dist/types/src/components/NavigationPanel/components/NavigationTabs/NavigationTabsItem/NavigationTabsItem.test.d.ts +1 -0
  15. package/dist/types/src/components/NavigationPanel/components/NavigationTabs/__fixtures__/navigationMock.d.ts +2 -0
  16. package/dist/types/src/components/NavigationPanel/components/NavigationTabs/helpers.d.ts +2 -0
  17. package/dist/types/src/components/NavigationPanel/stories/NavigationPanel.stories.d.ts +6 -0
  18. package/dist/types/src/components/NavigationPanel/types/navigation.d.ts +21 -0
  19. package/dist/types/src/utils/billing/plan/plan.test.d.ts +1 -0
  20. package/dist/types/src/utils/content/text/text.test.d.ts +1 -0
  21. package/dist/types/src/utils/content/url/url.test.d.ts +1 -0
  22. package/dist/types/src/utils/i18n/date/date.test.d.ts +1 -0
  23. package/dist/types/tests/setup.d.ts +0 -0
  24. package/dist/types/tests/utils.d.ts +7 -0
  25. package/package.json +7 -2
  26. package/dist/types/components/NavigationPanel/NavigationPanel.d.ts +0 -1
  27. package/dist/types/components/NavigationPanel/NavigationPanel.stories.d.ts +0 -5
  28. /package/dist/types/{node.d.ts → src/node.d.ts} +0 -0
  29. /package/dist/types/{utils → src/utils}/billing/plan/plan.d.ts +0 -0
  30. /package/dist/types/{utils → src/utils}/content/text/text.d.ts +0 -0
  31. /package/dist/types/{utils → src/utils}/content/url/url.d.ts +0 -0
  32. /package/dist/types/{utils → src/utils}/i18n/date/date.d.ts +0 -0
package/dist/harmony.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),g=require("react"),_=require("date-fns"),p=require("date-fns-tz"),T=()=>o.jsx("div",{children:"Navigation Panel"}),a=0,f=9999,u=[150,151,250,251],S=[152,153,252,253],N=[154,155,157,158,254,255,258,354,355,358],A=[156,159,160,256,259,260],l=9998,R=n=>n===a,I=n=>n===f,L=n=>u.includes(n),D=n=>S.includes(n),h=n=>N.includes(n),d=n=>A.includes(n),y=n=>n>a&&n<l,O=n=>n===l,k=/\n/,c=(n,e,t)=>n.split(e).flatMap((r,s)=>s!==0?[g.cloneElement(t,{key:Math.random().toString(32).slice(0,10)}),r]:r),m=(n,e,t)=>typeof n=="string"?c(n,e,t):n.flatMap(r=>typeof r=="string"?c(r,e,t):r),b=n=>m(n,k,o.jsx("br",{})),v=/(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi,j=n=>n.match(v)??[],P=(n,e,t)=>{const r=n.split(e);if(r.length===1)return n;const s=[];return r[0]!==""&&s.push(r[0]),r.shift(),r[r.length-1]===""&&r.pop(),s.push(o.jsx("a",{href:e,target:"_blank",rel:"noreferrer noopener",children:e},e+t)),s.push(r.join(e)),s.filter(i=>i!=="")},E=n=>{const e=j(n);return e!=null&&e.length?e.reduce((t,r,s)=>typeof t=="string"?P(t,r,s):t.flatMap(i=>typeof i=="string"?P(i,r,s):i),n):n},F=n=>typeof n=="string"?E(n):n.flatMap(e=>typeof e=="string"?E(e):e,n),M=(n,e="PP")=>_.format(n,e),z=(n,e,t="PP")=>_.format(p.toZonedTime(n,e),t);exports.ENTERPRISE_OPENSOURCE_PLAN_ID=l;exports.ENTERPRISE_PLAN_IDS=A;exports.ESSENTIAL_PLAN_IDS=S;exports.FREE_PLAN_ID=a;exports.NavigationPanel=T;exports.PRO_PLAN_IDS=N;exports.START_PLAN_IDS=u;exports.TRIAL_PLAN_ID=f;exports.convertNewLineToBreakTag=b;exports.formatDate=M;exports.formatDateTz=z;exports.isEnterpriseOpenSourcePlan=O;exports.isEnterprisePlan=d;exports.isEssentialPlan=D;exports.isFreePlan=R;exports.isPaidPlan=y;exports.isProPlan=h;exports.isStartPlan=L;exports.isTrialPlan=I;exports.makeUrlClickable=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),S=require("react"),Te=require("date-fns"),qe=require("date-fns-tz");function Le(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const w=Le(S);var x=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var L,re;function Y(){if(re)return L;re=1;function e(r){var n=typeof r;return r!=null&&(n=="object"||n=="function")}return L=e,L}var A,te;function Ae(){if(te)return A;te=1;var e=typeof x=="object"&&x&&x.Object===Object&&x;return A=e,A}var D,ne;function Ee(){if(ne)return D;ne=1;var e=Ae(),r=typeof self=="object"&&self&&self.Object===Object&&self,n=e||r||Function("return this")();return D=n,D}var k,ie;function De(){if(ie)return k;ie=1;var e=Ee(),r=function(){return e.Date.now()};return k=r,k}var C,oe;function ke(){if(oe)return C;oe=1;var e=/\s/;function r(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}return C=r,C}var z,ae;function Ce(){if(ae)return z;ae=1;var e=ke(),r=/^\s+/;function n(t){return t&&t.slice(0,e(t)+1).replace(r,"")}return z=n,z}var M,se;function ye(){if(se)return M;se=1;var e=Ee(),r=e.Symbol;return M=r,M}var F,ue;function ze(){if(ue)return F;ue=1;var e=ye(),r=Object.prototype,n=r.hasOwnProperty,t=r.toString,i=e?e.toStringTag:void 0;function a(s){var u=n.call(s,i),c=s[i];try{s[i]=void 0;var o=!0}catch{}var l=t.call(s);return o&&(u?s[i]=c:delete s[i]),l}return F=a,F}var G,ce;function Me(){if(ce)return G;ce=1;var e=Object.prototype,r=e.toString;function n(t){return r.call(t)}return G=n,G}var B,le;function Fe(){if(le)return B;le=1;var e=ye(),r=ze(),n=Me(),t="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function s(u){return u==null?u===void 0?i:t:a&&a in Object(u)?r(u):n(u)}return B=s,B}var U,fe;function Ge(){if(fe)return U;fe=1;function e(r){return r!=null&&typeof r=="object"}return U=e,U}var H,de;function Be(){if(de)return H;de=1;var e=Fe(),r=Ge(),n="[object Symbol]";function t(i){return typeof i=="symbol"||r(i)&&e(i)==n}return H=t,H}var W,be;function Ue(){if(be)return W;be=1;var e=Ce(),r=Y(),n=Be(),t=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,u=parseInt;function c(o){if(typeof o=="number")return o;if(n(o))return t;if(r(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=r(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=e(o);var g=a.test(o);return g||s.test(o)?u(o.slice(2),g?2:8):i.test(o)?t:+o}return W=c,W}var $,ge;function Pe(){if(ge)return $;ge=1;var e=Y(),r=De(),n=Ue(),t="Expected a function",i=Math.max,a=Math.min;function s(u,c,o){var l,g,R,E,d,m,y=0,j=!1,b=!1,_=!0;if(typeof u!="function")throw new TypeError(t);c=n(c)||0,e(o)&&(j=!!o.leading,b="maxWait"in o,R=b?i(n(o.maxWait)||0,c):R,_="trailing"in o?!!o.trailing:_);function v(f){var P=l,p=g;return l=g=void 0,y=f,E=u.apply(p,P),E}function h(f){return y=f,d=setTimeout(N,c),j?v(f):E}function I(f){var P=f-m,p=f-y,ee=c-P;return b?a(ee,R-p):ee}function Q(f){var P=f-m,p=f-y;return m===void 0||P>=c||P<0||b&&p>=R}function N(){var f=r();if(Q(f))return V(f);d=setTimeout(N,I(f))}function V(f){return d=void 0,_&&l?v(f):(l=g=void 0,E)}function Ne(){d!==void 0&&clearTimeout(d),y=0,l=m=g=d=void 0}function xe(){return d===void 0?E:V(r())}function q(){var f=r(),P=Q(f);if(l=arguments,g=this,m=f,P){if(d===void 0)return h(m);if(b)return clearTimeout(d),d=setTimeout(N,c),v(m)}return d===void 0&&(d=setTimeout(N,c)),E}return q.cancel=Ne,q.flush=xe,q}return $=s,$}var He=Pe();const We=Se(He);var Z,he;function $e(){if(he)return Z;he=1;var e=Pe(),r=Y(),n="Expected a function";function t(i,a,s){var u=!0,c=!0;if(typeof i!="function")throw new TypeError(n);return r(s)&&(u="leading"in s?!!s.leading:u,c="trailing"in s?!!s.trailing:c),e(i,a,{leading:u,maxWait:a,trailing:c})}return Z=t,Z}var Ze=$e();const Xe=Se(Ze),Ye=(e,r,n,t)=>{switch(r){case"debounce":return We(e,n,t);case"throttle":return Xe(e,n,t);default:return e}},Je=e=>{const r=w.useRef(e);return w.useEffect(()=>{r.current=e}),w.useMemo(()=>(...n)=>{var t;return(t=r.current)===null||t===void 0?void 0:t.call(r,...n)},[])},Ke=e=>{const[r,n]=w.useState((e==null?void 0:e.current)||null);return e&&setTimeout(()=>{e.current!==r&&n(e.current)},0),{refProxy:w.useMemo(()=>new Proxy(i=>{i!==r&&n(i)},{get(i,a){return a==="current"?r:i[a]},set(i,a,s){return a==="current"?n(s):i[a]=s,!0}}),[r]),refElement:r,setRefElement:n}},Qe=(e,r)=>r==="border-box"?{width:e.borderBoxSize[0].inlineSize,height:e.borderBoxSize[0].blockSize}:r==="content-box"?{width:e.contentBoxSize[0].inlineSize,height:e.contentBoxSize[0].blockSize}:{width:e.contentRect.width,height:e.contentRect.height};function Ve({skipOnMount:e=!1,refreshMode:r,refreshRate:n=1e3,refreshOptions:t,handleWidth:i=!0,handleHeight:a=!0,targetRef:s,observerOptions:u,onResize:c}={}){const o=S.useRef(e),l=Je(c),[g,R]=S.useState({width:void 0,height:void 0}),{refProxy:E,refElement:d}=Ke(s),{box:m}=u||{},y=S.useCallback(b=>{if(!i&&!a)return;if(o.current){o.current=!1;return}const _=(v,h)=>i&&v.width!==h.width||a&&v.height!==h.height;b.forEach(v=>{const h=Qe(v,m);R(I=>_(I,h)?(l==null||l({width:h.width,height:h.height,entry:v}),h):I)})},[i,a,o,m]),j=S.useCallback(Ye(y,r,n,t),[y,r,n,t]);return S.useEffect(()=>{let b;return d?(b=new window.ResizeObserver(j),b.observe(d,u)):(g.width||g.height)&&(l==null||l({width:null,height:null,entry:null}),R({width:void 0,height:void 0})),()=>{var _,v,h;(_=b==null?void 0:b.disconnect)===null||_===void 0||_.call(b),(h=(v=j).cancel)===null||h===void 0||h.call(v)}},[j,d]),Object.assign({ref:E},g)}function Re(e){var r,n,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(r=0;r<i;r++)e[r]&&(n=Re(e[r]))&&(t&&(t+=" "),t+=n)}else for(n in e)e[n]&&(t&&(t+=" "),t+=n);return t}function er(){for(var e,r,n=0,t="",i=arguments.length;n<i;n++)(e=arguments[n])&&(r=Re(e))&&(t&&(t+=" "),t+=r);return t}const rr="_headerContainer_1cubo_1",tr="_headerContent_1cubo_34",nr="_staticEnabled_1cubo_50",X={headerContainer:rr,headerContent:tr,staticEnabled:nr},ir=77,O=({sticky:e,children:r})=>{const{ref:n,height:t}=Ve({refreshMode:"debounce",refreshRate:0}),[i,a]=S.useState(!1),s=()=>i?!e:!0;S.useEffect(()=>{const c=()=>{a(window.scrollY>0)};return window.addEventListener("scroll",c),()=>window.removeEventListener("scroll",c)},[]);const u=`${t||ir}px`;return T.jsx("div",{style:{minHeight:u},children:T.jsx("div",{children:T.jsxs("div",{ref:n,className:er(X.headerContent,{[X.staticEnabled]:s()}),children:[T.jsx(O.Header,{}),T.jsx(O.Tabs,{}),r]})})})};O.Header=({children:e})=>T.jsx("div",{className:X.headerContainer,children:e});O.Tabs=({children:e})=>T.jsx("div",{className:"flex justify-between gap-2 nowrap",children:e});const J=0,je=9999,pe=[150,151,250,251],we=[152,153,252,253],Oe=[154,155,157,158,254,255,258,354,355,358],Ie=[156,159,160,256,259,260],K=9998,or=e=>e===J,ar=e=>e===je,sr=e=>pe.includes(e),ur=e=>we.includes(e),cr=e=>Oe.includes(e),lr=e=>Ie.includes(e),fr=e=>e>J&&e<K,dr=e=>e===K,br=/\n/,ve=(e,r,n)=>e.split(r).flatMap((t,i)=>i!==0?[S.cloneElement(n,{key:Math.random().toString(32).slice(0,10)}),t]:t),gr=(e,r,n)=>typeof e=="string"?ve(e,r,n):e.flatMap(t=>typeof t=="string"?ve(t,r,n):t),hr=e=>gr(e,br,T.jsx("br",{})),vr=/(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi,mr=e=>e.match(vr)??[],me=(e,r,n)=>{const t=e.split(r);if(t.length===1)return e;const i=[];return t[0]!==""&&i.push(t[0]),t.shift(),t[t.length-1]===""&&t.pop(),i.push(T.jsx("a",{href:r,target:"_blank",rel:"noreferrer noopener",children:r},r+n)),i.push(t.join(r)),i.filter(a=>a!=="")},_e=e=>{const r=mr(e);return r!=null&&r.length?r.reduce((n,t,i)=>typeof n=="string"?me(n,t,i):n.flatMap(a=>typeof a=="string"?me(a,t,i):a),e):e},_r=e=>typeof e=="string"?_e(e):e.flatMap(r=>typeof r=="string"?_e(r):r,e),Tr=(e,r="PP")=>Te.format(e,r),Sr=(e,r,n="PP")=>Te.format(qe.toZonedTime(e,r),n);exports.ENTERPRISE_OPENSOURCE_PLAN_ID=K;exports.ENTERPRISE_PLAN_IDS=Ie;exports.ESSENTIAL_PLAN_IDS=we;exports.FREE_PLAN_ID=J;exports.NavigationPanel=O;exports.PRO_PLAN_IDS=Oe;exports.START_PLAN_IDS=pe;exports.TRIAL_PLAN_ID=je;exports.convertNewLineToBreakTag=hr;exports.formatDate=Tr;exports.formatDateTz=Sr;exports.isEnterpriseOpenSourcePlan=dr;exports.isEnterprisePlan=lr;exports.isEssentialPlan=ur;exports.isFreePlan=or;exports.isPaidPlan=fr;exports.isProPlan=cr;exports.isStartPlan=sr;exports.isTrialPlan=ar;exports.makeUrlClickable=_r;
@@ -0,0 +1 @@
1
+ ._headerContainer_1cubo_1{display:flex;margin-bottom:var(--lok-spacing-1);width:100%;align-items:center}._navigationTabList_1cubo_8{display:flex;list-style:none;flex-wrap:wrap;margin:0 0 0 calc(-1 * var(--lok-spacing-6));padding:0}._navigationTab_1cubo_8{border:none;margin:0;border-bottom:2px solid transparent;background:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;font:var(--lok-typography-body-small-default);color:var(--lok-color-text-default);margin:0 0 0 var(--lok-spacing-6)}._navigationTab_1cubo_8[aria-selected=true]{font-weight:500;color:var(--lok-color-text-active);border-bottom-color:var(--lok-color-text-active)}._headerContent_1cubo_34{position:fixed;background-color:var(--lok-color-background-surface-default);top:0;left:95px;right:32px;z-index:899;padding-top:var(--lok-spacing-5);padding-left:30px;padding-right:30px;margin-left:-30px;margin-right:-30px;border-bottom:1px solid var(--lok-color-border-default)}._staticEnabled_1cubo_50{z-index:var(--lok-z-index-auto);position:relative;top:inherit;left:0;right:0;padding-top:0;box-shadow:none}
package/dist/harmony.mjs CHANGED
@@ -1,38 +1,388 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { cloneElement as u } from "react";
3
- import { format as f } from "date-fns";
4
- import { toZonedTime as g } from "date-fns-tz";
5
- const y = () => /* @__PURE__ */ i("div", { children: "Navigation Panel" }), P = 0, E = 9999, _ = [150, 151, 250, 251], h = [152, 153, 252, 253], S = [154, 155, 157, 158, 254, 255, 258, 354, 355, 358], A = [156, 159, 160, 256, 259, 260], p = 9998, k = (n) => n === P, M = (n) => n === E, b = (n) => _.includes(n), v = (n) => h.includes(n), O = (n) => S.includes(n), z = (n) => A.includes(n), U = (n) => n > P && n < p, Z = (n) => n === p, N = /\n/, c = (n, r, e) => n.split(r).flatMap((t, o) => o !== 0 ? [u(e, { key: Math.random().toString(32).slice(0, 10) }), t] : t), R = (n, r, e) => typeof n == "string" ? c(n, r, e) : n.flatMap((t) => typeof t == "string" ? c(t, r, e) : t), j = (n) => R(n, N, /* @__PURE__ */ i("br", {})), L = /(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi, T = (n) => n.match(L) ?? [], l = (n, r, e) => {
6
- const t = n.split(r);
1
+ import { jsx as E, jsxs as Ie } from "react/jsx-runtime";
2
+ import * as w from "react";
3
+ import { useRef as qe, useState as ve, useCallback as Q, useEffect as _e, cloneElement as xe } from "react";
4
+ import { format as Te } from "date-fns";
5
+ import { toZonedTime as Ne } from "date-fns-tz";
6
+ var I = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
7
+ function Se(e) {
8
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
9
+ }
10
+ var N, V;
11
+ function X() {
12
+ if (V) return N;
13
+ V = 1;
14
+ function e(r) {
15
+ var n = typeof r;
16
+ return r != null && (n == "object" || n == "function");
17
+ }
18
+ return N = e, N;
19
+ }
20
+ var L, ee;
21
+ function Le() {
22
+ if (ee) return L;
23
+ ee = 1;
24
+ var e = typeof I == "object" && I && I.Object === Object && I;
25
+ return L = e, L;
26
+ }
27
+ var A, re;
28
+ function ye() {
29
+ if (re) return A;
30
+ re = 1;
31
+ var e = Le(), r = typeof self == "object" && self && self.Object === Object && self, n = e || r || Function("return this")();
32
+ return A = n, A;
33
+ }
34
+ var k, te;
35
+ function Ae() {
36
+ if (te) return k;
37
+ te = 1;
38
+ var e = ye(), r = function() {
39
+ return e.Date.now();
40
+ };
41
+ return k = r, k;
42
+ }
43
+ var C, ne;
44
+ function ke() {
45
+ if (ne) return C;
46
+ ne = 1;
47
+ var e = /\s/;
48
+ function r(n) {
49
+ for (var t = n.length; t-- && e.test(n.charAt(t)); )
50
+ ;
51
+ return t;
52
+ }
53
+ return C = r, C;
54
+ }
55
+ var z, ie;
56
+ function Ce() {
57
+ if (ie) return z;
58
+ ie = 1;
59
+ var e = ke(), r = /^\s+/;
60
+ function n(t) {
61
+ return t && t.slice(0, e(t) + 1).replace(r, "");
62
+ }
63
+ return z = n, z;
64
+ }
65
+ var D, oe;
66
+ function Ee() {
67
+ if (oe) return D;
68
+ oe = 1;
69
+ var e = ye(), r = e.Symbol;
70
+ return D = r, D;
71
+ }
72
+ var G, ae;
73
+ function ze() {
74
+ if (ae) return G;
75
+ ae = 1;
76
+ var e = Ee(), r = Object.prototype, n = r.hasOwnProperty, t = r.toString, i = e ? e.toStringTag : void 0;
77
+ function a(u) {
78
+ var s = n.call(u, i), c = u[i];
79
+ try {
80
+ u[i] = void 0;
81
+ var o = !0;
82
+ } catch {
83
+ }
84
+ var f = t.call(u);
85
+ return o && (s ? u[i] = c : delete u[i]), f;
86
+ }
87
+ return G = a, G;
88
+ }
89
+ var M, ue;
90
+ function De() {
91
+ if (ue) return M;
92
+ ue = 1;
93
+ var e = Object.prototype, r = e.toString;
94
+ function n(t) {
95
+ return r.call(t);
96
+ }
97
+ return M = n, M;
98
+ }
99
+ var B, se;
100
+ function Ge() {
101
+ if (se) return B;
102
+ se = 1;
103
+ var e = Ee(), r = ze(), n = De(), t = "[object Null]", i = "[object Undefined]", a = e ? e.toStringTag : void 0;
104
+ function u(s) {
105
+ return s == null ? s === void 0 ? i : t : a && a in Object(s) ? r(s) : n(s);
106
+ }
107
+ return B = u, B;
108
+ }
109
+ var F, ce;
110
+ function Me() {
111
+ if (ce) return F;
112
+ ce = 1;
113
+ function e(r) {
114
+ return r != null && typeof r == "object";
115
+ }
116
+ return F = e, F;
117
+ }
118
+ var H, fe;
119
+ function Be() {
120
+ if (fe) return H;
121
+ fe = 1;
122
+ var e = Ge(), r = Me(), n = "[object Symbol]";
123
+ function t(i) {
124
+ return typeof i == "symbol" || r(i) && e(i) == n;
125
+ }
126
+ return H = t, H;
127
+ }
128
+ var U, le;
129
+ function Fe() {
130
+ if (le) return U;
131
+ le = 1;
132
+ var e = Ce(), r = X(), n = Be(), t = NaN, i = /^[-+]0x[0-9a-f]+$/i, a = /^0b[01]+$/i, u = /^0o[0-7]+$/i, s = parseInt;
133
+ function c(o) {
134
+ if (typeof o == "number")
135
+ return o;
136
+ if (n(o))
137
+ return t;
138
+ if (r(o)) {
139
+ var f = typeof o.valueOf == "function" ? o.valueOf() : o;
140
+ o = r(f) ? f + "" : f;
141
+ }
142
+ if (typeof o != "string")
143
+ return o === 0 ? o : +o;
144
+ o = e(o);
145
+ var h = a.test(o);
146
+ return h || u.test(o) ? s(o.slice(2), h ? 2 : 8) : i.test(o) ? t : +o;
147
+ }
148
+ return U = c, U;
149
+ }
150
+ var W, de;
151
+ function pe() {
152
+ if (de) return W;
153
+ de = 1;
154
+ var e = X(), r = Ae(), n = Fe(), t = "Expected a function", i = Math.max, a = Math.min;
155
+ function u(s, c, o) {
156
+ var f, h, p, T, d, v, S = 0, R = !1, b = !1, _ = !0;
157
+ if (typeof s != "function")
158
+ throw new TypeError(t);
159
+ c = n(c) || 0, e(o) && (R = !!o.leading, b = "maxWait" in o, p = b ? i(n(o.maxWait) || 0, c) : p, _ = "trailing" in o ? !!o.trailing : _);
160
+ function m(l) {
161
+ var y = f, j = h;
162
+ return f = h = void 0, S = l, T = s.apply(j, y), T;
163
+ }
164
+ function g(l) {
165
+ return S = l, d = setTimeout(O, c), R ? m(l) : T;
166
+ }
167
+ function P(l) {
168
+ var y = l - v, j = l - S, K = c - y;
169
+ return b ? a(K, p - j) : K;
170
+ }
171
+ function Y(l) {
172
+ var y = l - v, j = l - S;
173
+ return v === void 0 || y >= c || y < 0 || b && j >= p;
174
+ }
175
+ function O() {
176
+ var l = r();
177
+ if (Y(l))
178
+ return J(l);
179
+ d = setTimeout(O, P(l));
180
+ }
181
+ function J(l) {
182
+ return d = void 0, _ && f ? m(l) : (f = h = void 0, T);
183
+ }
184
+ function Pe() {
185
+ d !== void 0 && clearTimeout(d), S = 0, f = v = h = d = void 0;
186
+ }
187
+ function Oe() {
188
+ return d === void 0 ? T : J(r());
189
+ }
190
+ function x() {
191
+ var l = r(), y = Y(l);
192
+ if (f = arguments, h = this, v = l, y) {
193
+ if (d === void 0)
194
+ return g(v);
195
+ if (b)
196
+ return clearTimeout(d), d = setTimeout(O, c), m(v);
197
+ }
198
+ return d === void 0 && (d = setTimeout(O, c)), T;
199
+ }
200
+ return x.cancel = Pe, x.flush = Oe, x;
201
+ }
202
+ return W = u, W;
203
+ }
204
+ var He = pe();
205
+ const Ue = /* @__PURE__ */ Se(He);
206
+ var $, be;
207
+ function We() {
208
+ if (be) return $;
209
+ be = 1;
210
+ var e = pe(), r = X(), n = "Expected a function";
211
+ function t(i, a, u) {
212
+ var s = !0, c = !0;
213
+ if (typeof i != "function")
214
+ throw new TypeError(n);
215
+ return r(u) && (s = "leading" in u ? !!u.leading : s, c = "trailing" in u ? !!u.trailing : c), e(i, a, {
216
+ leading: s,
217
+ maxWait: a,
218
+ trailing: c
219
+ });
220
+ }
221
+ return $ = t, $;
222
+ }
223
+ var $e = We();
224
+ const Ze = /* @__PURE__ */ Se($e), Xe = (e, r, n, t) => {
225
+ switch (r) {
226
+ case "debounce":
227
+ return Ue(e, n, t);
228
+ case "throttle":
229
+ return Ze(e, n, t);
230
+ default:
231
+ return e;
232
+ }
233
+ }, Ye = (
234
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
235
+ (e) => {
236
+ const r = w.useRef(e);
237
+ return w.useEffect(() => {
238
+ r.current = e;
239
+ }), w.useMemo(() => (...n) => {
240
+ var t;
241
+ return (t = r.current) === null || t === void 0 ? void 0 : t.call(r, ...n);
242
+ }, []);
243
+ }
244
+ ), Je = (
245
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
246
+ (e) => {
247
+ const [r, n] = w.useState((e == null ? void 0 : e.current) || null);
248
+ return e && setTimeout(() => {
249
+ e.current !== r && n(e.current);
250
+ }, 0), { refProxy: w.useMemo(() => new Proxy((i) => {
251
+ i !== r && n(i);
252
+ }, {
253
+ get(i, a) {
254
+ return a === "current" ? r : i[a];
255
+ },
256
+ set(i, a, u) {
257
+ return a === "current" ? n(u) : i[a] = u, !0;
258
+ }
259
+ }), [r]), refElement: r, setRefElement: n };
260
+ }
261
+ ), Ke = (e, r) => r === "border-box" ? {
262
+ width: e.borderBoxSize[0].inlineSize,
263
+ height: e.borderBoxSize[0].blockSize
264
+ } : r === "content-box" ? {
265
+ width: e.contentBoxSize[0].inlineSize,
266
+ height: e.contentBoxSize[0].blockSize
267
+ } : {
268
+ width: e.contentRect.width,
269
+ height: e.contentRect.height
270
+ };
271
+ function Qe({ skipOnMount: e = !1, refreshMode: r, refreshRate: n = 1e3, refreshOptions: t, handleWidth: i = !0, handleHeight: a = !0, targetRef: u, observerOptions: s, onResize: c } = {}) {
272
+ const o = qe(e), f = Ye(c), [h, p] = ve({
273
+ width: void 0,
274
+ height: void 0
275
+ }), { refProxy: T, refElement: d } = Je(u), { box: v } = s || {}, S = Q((b) => {
276
+ if (!i && !a)
277
+ return;
278
+ if (o.current) {
279
+ o.current = !1;
280
+ return;
281
+ }
282
+ const _ = (m, g) => i && m.width !== g.width || a && m.height !== g.height;
283
+ b.forEach((m) => {
284
+ const g = Ke(m, v);
285
+ p((P) => _(P, g) ? (f == null || f({
286
+ width: g.width,
287
+ height: g.height,
288
+ entry: m
289
+ }), g) : P);
290
+ });
291
+ }, [i, a, o, v]), R = Q(Xe(S, r, n, t), [
292
+ S,
293
+ r,
294
+ n,
295
+ t
296
+ ]);
297
+ return _e(() => {
298
+ let b;
299
+ return d ? (b = new window.ResizeObserver(R), b.observe(d, s)) : (h.width || h.height) && (f == null || f({
300
+ width: null,
301
+ height: null,
302
+ entry: null
303
+ }), p({ width: void 0, height: void 0 })), () => {
304
+ var _, m, g;
305
+ (_ = b == null ? void 0 : b.disconnect) === null || _ === void 0 || _.call(b), (g = (m = R).cancel) === null || g === void 0 || g.call(m);
306
+ };
307
+ }, [R, d]), Object.assign({ ref: T }, h);
308
+ }
309
+ function Re(e) {
310
+ var r, n, t = "";
311
+ if (typeof e == "string" || typeof e == "number") t += e;
312
+ else if (typeof e == "object") if (Array.isArray(e)) {
313
+ var i = e.length;
314
+ for (r = 0; r < i; r++) e[r] && (n = Re(e[r])) && (t && (t += " "), t += n);
315
+ } else for (n in e) e[n] && (t && (t += " "), t += n);
316
+ return t;
317
+ }
318
+ function Ve() {
319
+ for (var e, r, n = 0, t = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (r = Re(e)) && (t && (t += " "), t += r);
320
+ return t;
321
+ }
322
+ const er = "_headerContainer_1cubo_1", rr = "_headerContent_1cubo_34", tr = "_staticEnabled_1cubo_50", Z = {
323
+ headerContainer: er,
324
+ headerContent: rr,
325
+ staticEnabled: tr
326
+ }, nr = 77, q = ({ sticky: e, children: r }) => {
327
+ const { ref: n, height: t } = Qe({
328
+ refreshMode: "debounce",
329
+ refreshRate: 0
330
+ }), [i, a] = ve(!1), u = () => i ? !e : !0;
331
+ _e(() => {
332
+ const c = () => {
333
+ a(window.scrollY > 0);
334
+ };
335
+ return window.addEventListener("scroll", c), () => window.removeEventListener("scroll", c);
336
+ }, []);
337
+ const s = `${t || nr}px`;
338
+ return /* @__PURE__ */ E("div", { style: { minHeight: s }, children: /* @__PURE__ */ E("div", { children: /* @__PURE__ */ Ie(
339
+ "div",
340
+ {
341
+ ref: n,
342
+ className: Ve(Z.headerContent, {
343
+ [Z.staticEnabled]: u()
344
+ }),
345
+ children: [
346
+ /* @__PURE__ */ E(q.Header, {}),
347
+ /* @__PURE__ */ E(q.Tabs, {}),
348
+ r
349
+ ]
350
+ }
351
+ ) }) });
352
+ };
353
+ q.Header = ({ children: e }) => /* @__PURE__ */ E("div", { className: Z.headerContainer, children: e });
354
+ q.Tabs = ({ children: e }) => /* @__PURE__ */ E("div", { className: "flex justify-between gap-2 nowrap", children: e });
355
+ const je = 0, ir = 9999, or = [150, 151, 250, 251], ar = [152, 153, 252, 253], ur = [154, 155, 157, 158, 254, 255, 258, 354, 355, 358], sr = [156, 159, 160, 256, 259, 260], we = 9998, vr = (e) => e === je, _r = (e) => e === ir, Tr = (e) => or.includes(e), Sr = (e) => ar.includes(e), yr = (e) => ur.includes(e), Er = (e) => sr.includes(e), pr = (e) => e > je && e < we, Rr = (e) => e === we, cr = /\n/, he = (e, r, n) => e.split(r).flatMap((t, i) => i !== 0 ? [xe(n, { key: Math.random().toString(32).slice(0, 10) }), t] : t), fr = (e, r, n) => typeof e == "string" ? he(e, r, n) : e.flatMap((t) => typeof t == "string" ? he(t, r, n) : t), jr = (e) => fr(e, cr, /* @__PURE__ */ E("br", {})), lr = /(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi, dr = (e) => e.match(lr) ?? [], ge = (e, r, n) => {
356
+ const t = e.split(r);
7
357
  if (t.length === 1)
8
- return n;
9
- const o = [];
10
- return t[0] !== "" && o.push(t[0]), t.shift(), t[t.length - 1] === "" && t.pop(), o.push(
11
- /* @__PURE__ */ i("a", { href: r, target: "_blank", rel: "noreferrer noopener", children: r }, r + e)
12
- ), o.push(t.join(r)), o.filter((s) => s !== "");
13
- }, a = (n) => {
14
- const r = T(n);
15
- return r != null && r.length ? r.reduce((e, t, o) => typeof e == "string" ? l(e, t, o) : e.flatMap((s) => typeof s == "string" ? l(s, t, o) : s), n) : n;
16
- }, w = (n) => typeof n == "string" ? a(n) : n.flatMap((r) => typeof r == "string" ? a(r) : r, n), C = (n, r = "PP") => f(n, r), F = (n, r, e = "PP") => f(g(n, r), e);
358
+ return e;
359
+ const i = [];
360
+ return t[0] !== "" && i.push(t[0]), t.shift(), t[t.length - 1] === "" && t.pop(), i.push(
361
+ /* @__PURE__ */ E("a", { href: r, target: "_blank", rel: "noreferrer noopener", children: r }, r + n)
362
+ ), i.push(t.join(r)), i.filter((a) => a !== "");
363
+ }, me = (e) => {
364
+ const r = dr(e);
365
+ return r != null && r.length ? r.reduce((n, t, i) => typeof n == "string" ? ge(n, t, i) : n.flatMap((a) => typeof a == "string" ? ge(a, t, i) : a), e) : e;
366
+ }, wr = (e) => typeof e == "string" ? me(e) : e.flatMap((r) => typeof r == "string" ? me(r) : r, e), Pr = (e, r = "PP") => Te(e, r), Or = (e, r, n = "PP") => Te(Ne(e, r), n);
17
367
  export {
18
- p as ENTERPRISE_OPENSOURCE_PLAN_ID,
19
- A as ENTERPRISE_PLAN_IDS,
20
- h as ESSENTIAL_PLAN_IDS,
21
- P as FREE_PLAN_ID,
22
- y as NavigationPanel,
23
- S as PRO_PLAN_IDS,
24
- _ as START_PLAN_IDS,
25
- E as TRIAL_PLAN_ID,
26
- j as convertNewLineToBreakTag,
27
- C as formatDate,
28
- F as formatDateTz,
29
- Z as isEnterpriseOpenSourcePlan,
30
- z as isEnterprisePlan,
31
- v as isEssentialPlan,
32
- k as isFreePlan,
33
- U as isPaidPlan,
34
- O as isProPlan,
35
- b as isStartPlan,
36
- M as isTrialPlan,
37
- w as makeUrlClickable
368
+ we as ENTERPRISE_OPENSOURCE_PLAN_ID,
369
+ sr as ENTERPRISE_PLAN_IDS,
370
+ ar as ESSENTIAL_PLAN_IDS,
371
+ je as FREE_PLAN_ID,
372
+ q as NavigationPanel,
373
+ ur as PRO_PLAN_IDS,
374
+ or as START_PLAN_IDS,
375
+ ir as TRIAL_PLAN_ID,
376
+ jr as convertNewLineToBreakTag,
377
+ Pr as formatDate,
378
+ Or as formatDateTz,
379
+ Rr as isEnterpriseOpenSourcePlan,
380
+ Er as isEnterprisePlan,
381
+ Sr as isEssentialPlan,
382
+ vr as isFreePlan,
383
+ pr as isPaidPlan,
384
+ yr as isProPlan,
385
+ Tr as isStartPlan,
386
+ _r as isTrialPlan,
387
+ wr as makeUrlClickable
38
388
  };
@@ -1,2 +1,2 @@
1
- export * from './node'
1
+ export * from './src/node'
2
2
  export {}
@@ -0,0 +1,10 @@
1
+ import { PropsWithChildren } from 'react';
2
+ type NavigationPanelProps = {
3
+ sticky?: boolean;
4
+ } & PropsWithChildren;
5
+ export declare const NavigationPanel: {
6
+ ({ sticky, children }: NavigationPanelProps): import("react/jsx-runtime").JSX.Element;
7
+ Header({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
8
+ Tabs({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
9
+ };
10
+ export {};
@@ -0,0 +1,9 @@
1
+ type Item = {
2
+ name: string;
3
+ link: string;
4
+ };
5
+ type BreadcrumbsProps = {
6
+ items: Item[];
7
+ };
8
+ export declare const Breadcrumbs: ({ items }: BreadcrumbsProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ import { DropdownItem } from '../../types/navigation';
2
+ export declare const DropdownContent: ({ items }: {
3
+ items: DropdownItem[][];
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { NavigationTabsItem as NavigationTabsItemTypes } from '../../types/navigation';
2
+ type NavigationTabsProps = {
3
+ navigation: NavigationTabsItemTypes[];
4
+ activeItem: string;
5
+ };
6
+ export declare const NavigationTabs: ({ navigation, activeItem }: NavigationTabsProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ interface NavItemContentProps {
2
+ label: string;
3
+ badge?: number;
4
+ novel?: string;
5
+ }
6
+ export declare const NavItemContents: ({ label, badge, novel }: NavItemContentProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ type NavigationTabsItemProps = {
2
+ label: string;
3
+ badge?: number;
4
+ disabled?: boolean;
5
+ active?: boolean;
6
+ onClick?: () => void;
7
+ href?: string;
8
+ novel?: string;
9
+ };
10
+ export declare const NavigationTabsItem: import('react').ForwardRefExoticComponent<NavigationTabsItemProps & import('react').RefAttributes<HTMLButtonElement>>;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ import { NavigationTabsItem } from '../../../types/navigation';
2
+ export declare const navigation: NavigationTabsItem[];
@@ -0,0 +1,2 @@
1
+ import { NavigationTabsItem } from '../../types/navigation';
2
+ export declare const isNavigationItemVisible: (item: NavigationTabsItem) => boolean;
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { NavigationPanel } from '../NavigationPanel';
3
+ declare const meta: Meta<typeof NavigationPanel>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof NavigationPanel>;
6
+ export declare const Default: Story;
@@ -0,0 +1,21 @@
1
+ export type NavIsActiveFunction = (input: string) => boolean;
2
+ export type NavItemIcon = 'tasks' | 'contributors' | 'download' | 'more' | 'files';
3
+ export type NavigationTabsItem = {
4
+ key: string;
5
+ label: string;
6
+ visible: boolean;
7
+ isActive?: NavIsActiveFunction;
8
+ disabled?: boolean;
9
+ badge?: number;
10
+ link?: string;
11
+ onClick?: () => void;
12
+ dropdown?: DropdownItem[][];
13
+ novel?: string;
14
+ icon?: NavItemIcon;
15
+ };
16
+ export type DropdownItem = {
17
+ label: string;
18
+ visible?: boolean;
19
+ link?: string;
20
+ onClick?: () => void;
21
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1,7 @@
1
+ import { RenderOptions } from '@testing-library/react';
2
+ import { ReactElement } from 'react';
3
+ interface ExtendedRenderOptions extends RenderOptions {
4
+ theme?: 'light' | 'dark';
5
+ }
6
+ export declare const renderWithProviders: (ui: ReactElement, { theme, ...options }?: ExtendedRenderOptions) => import('@testing-library/react').RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
7
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/harmony",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "author": {
5
5
  "name": "Lokalise",
6
6
  "url": "https://lokalise.com/"
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@lokalise/louis": ">=26.0.0",
34
+ "@lokalise/styled": ">=3.0.0",
34
35
  "@lokalise/token-dictionary": ">=2.42.1",
35
36
  "date-fns": ">=4.1",
36
37
  "date-fns-tz": ">=3.2",
@@ -41,7 +42,6 @@
41
42
  "@biomejs/biome": "^1.9.4",
42
43
  "@chromatic-com/storybook": "^3.2.4",
43
44
  "@lokalise/biome-config": "^1.6.1",
44
- "@lokalise/styled": "^3.0.0",
45
45
  "@semantic-release/changelog": "^6.0.3",
46
46
  "@semantic-release/commit-analyzer": "^13.0.1",
47
47
  "@semantic-release/git": "^10.0.1",
@@ -70,6 +70,7 @@
70
70
  "eslint-plugin-storybook": "^0.11.2",
71
71
  "eslint-plugin-testing-library": "^7.1.1",
72
72
  "jsdom": "26.0.0",
73
+ "rimraf": "^6.0.1",
73
74
  "semantic-release": "^24.2.1",
74
75
  "storybook": "^8.6.0-alpha.1",
75
76
  "typescript": "^5.7.3",
@@ -87,5 +88,9 @@
87
88
  "require": "./dist/harmony.cjs",
88
89
  "import": "./dist/harmony.mjs"
89
90
  }
91
+ },
92
+ "dependencies": {
93
+ "clsx": "^2.1.1",
94
+ "react-resize-detector": "^11.0.1"
90
95
  }
91
96
  }
@@ -1 +0,0 @@
1
- export declare const NavigationPanel: () => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- declare const meta: Meta;
3
- export default meta;
4
- type Story = StoryObj;
5
- export declare const Basic: Story;
File without changes