@lokalise/harmony 1.1.0 → 1.2.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.
- package/dist/harmony.cjs +1 -1
- package/dist/harmony.mjs +35 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/types/node.d.ts +11 -0
- package/dist/types/utils/billing/plan/plan.d.ts +15 -0
- package/dist/types/utils/content/text/text.d.ts +3 -0
- package/dist/types/utils/content/url/url.d.ts +3 -0
- package/dist/types/utils/i18n/date/date.d.ts +3 -0
- package/package.json +13 -11
package/dist/harmony.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
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;
|
package/dist/harmony.mjs
CHANGED
@@ -1,5 +1,38 @@
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
2
|
-
|
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);
|
7
|
+
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);
|
3
17
|
export {
|
4
|
-
|
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
|
5
38
|
};
|
package/dist/types/index.d.ts
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
export
|
1
|
+
export * from './node'
|
2
|
+
export {}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* COMPONENTS EXPORTS
|
3
|
+
*/
|
4
|
+
export { NavigationPanel } from './components/NavigationPanel/NavigationPanel';
|
5
|
+
/**
|
6
|
+
* UTILITIES EXPORTS
|
7
|
+
*/
|
8
|
+
export { isPaidPlan, isProPlan, isEnterpriseOpenSourcePlan, isEnterprisePlan, isEssentialPlan, isStartPlan, isFreePlan, isTrialPlan, ENTERPRISE_PLAN_IDS, START_PLAN_IDS, ESSENTIAL_PLAN_IDS, PRO_PLAN_IDS, FREE_PLAN_ID, TRIAL_PLAN_ID, ENTERPRISE_OPENSOURCE_PLAN_ID, } from './utils/billing/plan/plan';
|
9
|
+
export { convertNewLineToBreakTag } from './utils/content/text/text';
|
10
|
+
export { makeUrlClickable } from './utils/content/url/url';
|
11
|
+
export { formatDate, formatDateTz } from './utils/i18n/date/date';
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export declare const FREE_PLAN_ID = 0;
|
2
|
+
export declare const TRIAL_PLAN_ID = 9999;
|
3
|
+
export declare const START_PLAN_IDS: number[];
|
4
|
+
export declare const ESSENTIAL_PLAN_IDS: number[];
|
5
|
+
export declare const PRO_PLAN_IDS: number[];
|
6
|
+
export declare const ENTERPRISE_PLAN_IDS: number[];
|
7
|
+
export declare const ENTERPRISE_OPENSOURCE_PLAN_ID = 9998;
|
8
|
+
export declare const isFreePlan: (planId: number) => planId is 0;
|
9
|
+
export declare const isTrialPlan: (planId: number) => planId is 9999;
|
10
|
+
export declare const isStartPlan: (planId: number) => boolean;
|
11
|
+
export declare const isEssentialPlan: (planId: number) => boolean;
|
12
|
+
export declare const isProPlan: (planId: number) => boolean;
|
13
|
+
export declare const isEnterprisePlan: (planId: number) => boolean;
|
14
|
+
export declare const isPaidPlan: (planId: number) => boolean;
|
15
|
+
export declare const isEnterpriseOpenSourcePlan: (planId: number) => planId is 9998;
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
2
|
+
export declare const replaceStringWithElement: (input: string | readonly ReactNode[], search: RegExp, replace: ReactElement) => readonly ReactNode[];
|
3
|
+
export declare const convertNewLineToBreakTag: (text: string | ReactNode[]) => readonly ReactNode[];
|
@@ -0,0 +1,3 @@
|
|
1
|
+
export type DateFormat = 'PP' | 'PP H:mm:ss' | 'PPpp' | 'LLLL y' | 'LLLL do' | 'dd-MM-yyyy' | 'MMM dd, yyyy HH:mm' | 'yyyy-MM-dd' | 'yyyy-MM-dd H:mm:ss';
|
2
|
+
export declare const formatDate: (date: Date, format?: DateFormat) => string;
|
3
|
+
export declare const formatDateTz: (date: Date, timezone: string, format?: DateFormat) => string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lokalise/harmony",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.2.0",
|
4
4
|
"author": {
|
5
5
|
"name": "Lokalise",
|
6
6
|
"url": "https://lokalise.com/"
|
@@ -32,13 +32,15 @@
|
|
32
32
|
"peerDependencies": {
|
33
33
|
"@lokalise/louis": ">=26.0.0",
|
34
34
|
"@lokalise/token-dictionary": ">=2.42.1",
|
35
|
+
"date-fns": ">=4.1",
|
36
|
+
"date-fns-tz": ">=3.2",
|
35
37
|
"react": ">=18.0.0",
|
36
38
|
"react-dom": ">=18.0.0"
|
37
39
|
},
|
38
40
|
"devDependencies": {
|
39
41
|
"@biomejs/biome": "^1.9.4",
|
40
42
|
"@chromatic-com/storybook": "^3.2.4",
|
41
|
-
"@lokalise/biome-config": "^1.
|
43
|
+
"@lokalise/biome-config": "^1.6.1",
|
42
44
|
"@lokalise/styled": "^3.0.0",
|
43
45
|
"@semantic-release/changelog": "^6.0.3",
|
44
46
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
@@ -46,23 +48,23 @@
|
|
46
48
|
"@semantic-release/github": "^11.0.1",
|
47
49
|
"@semantic-release/npm": "^12.0.1",
|
48
50
|
"@semantic-release/release-notes-generator": "^14.0.3",
|
49
|
-
"@storybook/addon-essentials": "^8.6.0-alpha.
|
50
|
-
"@storybook/addon-interactions": "^8.6.0-alpha.
|
51
|
-
"@storybook/addon-onboarding": "^8.6.0-alpha.
|
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",
|
52
54
|
"@storybook/blocks": "^8.6.0-alpha.1",
|
53
|
-
"@storybook/react": "^8.6.0-alpha.
|
54
|
-
"@storybook/react-vite": "^8.6.0-alpha.
|
55
|
+
"@storybook/react": "^8.6.0-alpha.4",
|
56
|
+
"@storybook/react-vite": "^8.6.0-alpha.4",
|
55
57
|
"@storybook/test": "^8.6.0-alpha.1",
|
56
58
|
"@testing-library/jest-dom": "^6.4.6",
|
57
59
|
"@testing-library/react": "^16.2.0",
|
58
60
|
"@testing-library/user-event": "^14.6.1",
|
59
|
-
"@types/node": "^22.
|
61
|
+
"@types/node": "^22.13.1",
|
60
62
|
"@types/react": "^18.3.18",
|
61
63
|
"@types/react-dom": "18.3.0",
|
62
|
-
"@typescript-eslint/parser": "^8.
|
64
|
+
"@typescript-eslint/parser": "^8.23.0",
|
63
65
|
"@vitejs/plugin-react": "^4.3.4",
|
64
|
-
"@vitest/coverage-v8": "^3.0.
|
65
|
-
"bundlesize2": "^0.0.
|
66
|
+
"@vitest/coverage-v8": "^3.0.5",
|
67
|
+
"bundlesize2": "^0.0.34",
|
66
68
|
"conventional-changelog-conventionalcommits": "^8.0.0",
|
67
69
|
"eslint-plugin-i18next": "^6.0.9",
|
68
70
|
"eslint-plugin-storybook": "^0.11.2",
|