@ilo-org/react 0.28.5 → 0.28.6
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),t=require("react"),A=require("./useGlobalSettings-chunk-Cd48T6lS.js"),p=require("./index-chunk-Cxg31gtu.js"),D=({clientHeight:e,clientWidth:r,scrollHeight:n,scrollWidth:o})=>n>e||o>r,J=(e,{maxSize:r=600,startingHeight:n=9,step:o=.5})=>{let s=n,c=!1;for(;!c&&s<r;)e.style.fontSize=`${s}px`,e.style.lineHeight=`${s}px`,c=D(e),c||(s=s+o);return e.style.fontSize="",e.style.lineHeight="",s-o},H=({baseClass:e,className:r,subbrand:n,alt:o,src:s,style:c,size:f="fluid",theme:l="light",...$})=>{const g=t.useRef(null),S=t.useRef(null),L=t.useRef(null),a=t.useRef(null),j=t.useRef(0),v=t.useRef(0),[d,N]=t.useState(!1),[z,k]=t.useState(0),[y,w]=t.useState(0),[E,q]=t.useState(!n),I=t.useRef(new ResizeObserver(i=>{const{height:m}=i[0].contentRect,R=Math.round(m*10)/10;a.current||(a.current=R),Math.abs(R-j.current)>=.1&&(j.current=R,k(R))}));t.useEffect(()=>{n&&d&&y&&q(!0)},[d,y,n]),t.useLayoutEffect(()=>{if(d&&S.current&&g.current){const i=g.current;return I.current.observe(i),()=>I.current.unobserve(i)}},[d]),t.useLayoutEffect(()=>{b()},[d,a.current]),t.useLayoutEffect(()=>{b()},[n]);function b(){if(S.current&&L.current&&a.current){const m=J(S.current,{maxSize:a.current})/a.current;Math.abs(m-v.current)>=.001&&(v.current=m,w(m))}}function B(){N(!0)}const h=!!n,F=f==="fluid",M=!F&&typeof f=="number",x=`${e}--sub-brand`,O=`${e}--size--fluid`,W=`${e}--visibility--hidden`,C=p.classNames(e,r,`${e}--theme--${l}`,{[W]:!E,[O]:F,[x]:h}),G=`${e}--image`,T=`${x}--image`,V=()=>{const i={};return h&&(i["--logo-image-height"]=`${z}px`,i["--logo-font-size"]=`${y*z}px`),M&&(i.width=`${f}px`),{...c,...i}},P=()=>typeof s=="string"?s:s[l];return u.jsxs("figure",{className:C,style:V(),children:[u.jsx("img",{ref:g,alt:o,src:P(),className:p.classNames({[T]:h,[G]:!h}),onLoad:B,...$}),h&&u.jsxs("div",{ref:S,className:`${x}--lock-up`,children:[u.jsx("span",{className:`${x}--lock-up--separator`}),u.jsx("span",{ref:L,children:n})]})]})},K=({className:e,url:r,target:n,style:o,size:s,...c})=>{const{prefix:f}=A.useGlobalSettings(),l=`${f}--logo`,$=`${l}--link`,g=`${l}--size--fluid`;return r?u.jsx("a",{href:r,target:n,className:p.classNames($,e,{[g]:s==="fluid"}),style:o,children:u.jsx(H,{...c,baseClass:l,size:s})}):u.jsx(H,{baseClass:l,className:e,style:o,size:s,...c})};exports.Logo=K;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as a, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as l, useState as x, useEffect as P, useLayoutEffect as v } from "react";
|
|
3
|
+
import { u as Q } from "./useGlobalSettings-chunk-BhfWlTcd.js";
|
|
4
|
+
import { c as I } from "./index-chunk-CY3PQDr4.js";
|
|
5
|
+
const U = ({
|
|
6
|
+
clientHeight: e,
|
|
7
|
+
clientWidth: s,
|
|
8
|
+
scrollHeight: n,
|
|
9
|
+
scrollWidth: i
|
|
10
|
+
}) => n > e || i > s, X = (e, { maxSize: s = 600, startingHeight: n = 9, step: i = 0.5 }) => {
|
|
11
|
+
let t = n, r = !1;
|
|
12
|
+
for (; !r && t < s; )
|
|
13
|
+
e.style.fontSize = `${t}px`, e.style.lineHeight = `${t}px`, r = U(e), r || (t = t + i);
|
|
14
|
+
return e.style.fontSize = "", e.style.lineHeight = "", t - i;
|
|
15
|
+
}, B = ({
|
|
16
|
+
baseClass: e,
|
|
17
|
+
className: s,
|
|
18
|
+
subbrand: n,
|
|
19
|
+
alt: i,
|
|
20
|
+
src: t,
|
|
21
|
+
style: r,
|
|
22
|
+
size: f = "fluid",
|
|
23
|
+
theme: c = "light",
|
|
24
|
+
...y
|
|
25
|
+
}) => {
|
|
26
|
+
const g = l(null), $ = l(null), L = l(null), u = l(null), R = l(0), F = l(0), [d, E] = x(!1), [H, M] = x(0), [z, W] = x(0), [j, C] = x(!n), k = l(
|
|
27
|
+
new ResizeObserver((o) => {
|
|
28
|
+
const { height: h } = o[0].contentRect, S = Math.round(h * 10) / 10;
|
|
29
|
+
u.current || (u.current = S), Math.abs(S - R.current) >= 0.1 && (R.current = S, M(S));
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
P(() => {
|
|
33
|
+
n && d && z && C(!0);
|
|
34
|
+
}, [d, z, n]), v(() => {
|
|
35
|
+
if (d && $.current && g.current) {
|
|
36
|
+
const o = g.current;
|
|
37
|
+
return k.current.observe(o), () => k.current.unobserve(o);
|
|
38
|
+
}
|
|
39
|
+
}, [d]), v(() => {
|
|
40
|
+
N();
|
|
41
|
+
}, [d, u.current]), v(() => {
|
|
42
|
+
N();
|
|
43
|
+
}, [n]);
|
|
44
|
+
function N() {
|
|
45
|
+
if ($.current && L.current && u.current) {
|
|
46
|
+
const h = X($.current, {
|
|
47
|
+
maxSize: u.current
|
|
48
|
+
}) / u.current;
|
|
49
|
+
Math.abs(h - F.current) >= 1e-3 && (F.current = h, W(h));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function O() {
|
|
53
|
+
E(!0);
|
|
54
|
+
}
|
|
55
|
+
const m = !!n, b = f === "fluid", V = !b && typeof f == "number", p = `${e}--sub-brand`, G = `${e}--size--fluid`, T = `${e}--visibility--hidden`, q = I(
|
|
56
|
+
e,
|
|
57
|
+
s,
|
|
58
|
+
`${e}--theme--${c}`,
|
|
59
|
+
{
|
|
60
|
+
[T]: !j,
|
|
61
|
+
[G]: b,
|
|
62
|
+
[p]: m
|
|
63
|
+
}
|
|
64
|
+
), A = `${e}--image`, D = `${p}--image`, J = () => {
|
|
65
|
+
const o = {};
|
|
66
|
+
return m && (o["--logo-image-height"] = `${H}px`, o["--logo-font-size"] = `${z * H}px`), V && (o.width = `${f}px`), { ...r, ...o };
|
|
67
|
+
}, K = () => typeof t == "string" ? t : t[c];
|
|
68
|
+
return /* @__PURE__ */ w("figure", { className: q, style: J(), children: [
|
|
69
|
+
/* @__PURE__ */ a(
|
|
70
|
+
"img",
|
|
71
|
+
{
|
|
72
|
+
ref: g,
|
|
73
|
+
alt: i,
|
|
74
|
+
src: K(),
|
|
75
|
+
className: I({
|
|
76
|
+
[D]: m,
|
|
77
|
+
[A]: !m
|
|
78
|
+
}),
|
|
79
|
+
onLoad: O,
|
|
80
|
+
...y
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
m && /* @__PURE__ */ w("div", { ref: $, className: `${p}--lock-up`, children: [
|
|
84
|
+
/* @__PURE__ */ a("span", { className: `${p}--lock-up--separator` }),
|
|
85
|
+
/* @__PURE__ */ a("span", { ref: L, children: n })
|
|
86
|
+
] })
|
|
87
|
+
] });
|
|
88
|
+
}, te = ({
|
|
89
|
+
className: e,
|
|
90
|
+
url: s,
|
|
91
|
+
target: n,
|
|
92
|
+
style: i,
|
|
93
|
+
size: t,
|
|
94
|
+
...r
|
|
95
|
+
}) => {
|
|
96
|
+
const { prefix: f } = Q(), c = `${f}--logo`, y = `${c}--link`, g = `${c}--size--fluid`;
|
|
97
|
+
return s ? /* @__PURE__ */ a(
|
|
98
|
+
"a",
|
|
99
|
+
{
|
|
100
|
+
href: s,
|
|
101
|
+
target: n,
|
|
102
|
+
className: I(y, e, {
|
|
103
|
+
[g]: t === "fluid"
|
|
104
|
+
}),
|
|
105
|
+
style: i,
|
|
106
|
+
children: /* @__PURE__ */ a(B, { ...r, baseClass: c, size: t })
|
|
107
|
+
}
|
|
108
|
+
) : /* @__PURE__ */ a(
|
|
109
|
+
B,
|
|
110
|
+
{
|
|
111
|
+
baseClass: c,
|
|
112
|
+
className: e,
|
|
113
|
+
style: i,
|
|
114
|
+
size: t,
|
|
115
|
+
...r
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
export {
|
|
120
|
+
te as Logo
|
|
121
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/react",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.6",
|
|
4
4
|
"description": "React components for the ILO's Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui_patterns",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"video.js": "^7.21.2",
|
|
76
76
|
"videojs-youtube": "^3.0.1",
|
|
77
77
|
"@ilo-org/brand-assets": "1.0.1",
|
|
78
|
-
"@ilo-org/fonts": "2.0.0",
|
|
79
78
|
"@ilo-org/icons-react": "1.0.6",
|
|
79
|
+
"@ilo-org/fonts": "2.0.0",
|
|
80
80
|
"@ilo-org/styles": "1.11.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),V=require("./useGlobalSettings-chunk-Cd48T6lS.js"),R=require("./index-chunk-Cxg31gtu.js"),M=({clientHeight:e,clientWidth:l,scrollHeight:n,scrollWidth:o})=>n>e||o>l,P=(e,{maxSize:l=600,startingHeight:n=9,step:o=.5})=>{let t=n,c=!1;for(;!c&&t<l;)e.style.fontSize=`${t}px`,e.style.lineHeight=`${t}px`,c=M(e),c||(t=t+o);return e.style.fontSize="",e.style.lineHeight="",t-o},I=({baseClass:e,className:l,subbrand:n,alt:o,src:t,style:c,size:f="fluid",theme:u="light",...$})=>{const g=s.useRef(null),h=s.useRef(null),p=s.useRef(null),a=s.useRef(null),[d,N]=s.useState(!1),[L,F]=s.useState(0),[y,b]=s.useState(0),[k,H]=s.useState(!n),j=s.useRef(new ResizeObserver(i=>{const{height:x}=i[0].contentRect;a.current||(a.current=x),F(x)}));s.useEffect(()=>{n&&d&&y&&H(!0)},[d,y,n]),s.useLayoutEffect(()=>{if(d&&h.current&&g.current){const i=g.current;return j.current.observe(i),()=>j.current.unobserve(i)}},[d]),s.useLayoutEffect(()=>{v()},[d,a.current]),s.useLayoutEffect(()=>{v()},[n]);function v(){if(h.current&&p.current&&a.current){const x=P(h.current,{maxSize:a.current})/a.current;b(x)}}function w(){N(!0)}const m=!!n,z=f==="fluid",E=!z&&typeof f=="number",S=`${e}--sub-brand`,q=`${e}--size--fluid`,B=`${e}--visibility--hidden`,O=R.classNames(e,l,`${e}--theme--${u}`,{[B]:!k,[q]:z,[S]:m}),W=`${e}--image`,C=`${S}--image`,G=()=>{const i={};return m&&(i["--logo-image-height"]=`${L}px`,i["--logo-font-size"]=`${y*L}px`),E&&(i.width=`${f}px`),{...c,...i}},T=()=>typeof t=="string"?t:t[u];return r.jsxs("figure",{className:O,style:G(),children:[r.jsx("img",{ref:g,alt:o,src:T(),className:R.classNames({[C]:m,[W]:!m}),onLoad:w,...$}),m&&r.jsxs("div",{ref:h,className:`${S}--lock-up`,children:[r.jsx("span",{className:`${S}--lock-up--separator`}),r.jsx("span",{ref:p,children:n})]})]})},A=({className:e,url:l,target:n,style:o,size:t,...c})=>{const{prefix:f}=V.useGlobalSettings(),u=`${f}--logo`,$=`${u}--link`,g=`${u}--size--fluid`;return l?r.jsx("a",{href:l,target:n,className:R.classNames($,e,{[g]:t==="fluid"}),style:o,children:r.jsx(I,{...c,baseClass:u,size:t})}):r.jsx(I,{baseClass:u,className:e,style:o,size:t,...c})};exports.Logo=A;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { jsx as u, jsxs as H } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as m, useState as S, useEffect as J, useLayoutEffect as v } from "react";
|
|
3
|
-
import { u as K } from "./useGlobalSettings-chunk-BhfWlTcd.js";
|
|
4
|
-
import { c as z } from "./index-chunk-CY3PQDr4.js";
|
|
5
|
-
const M = ({
|
|
6
|
-
clientHeight: e,
|
|
7
|
-
clientWidth: s,
|
|
8
|
-
scrollHeight: n,
|
|
9
|
-
scrollWidth: i
|
|
10
|
-
}) => n > e || i > s, P = (e, { maxSize: s = 600, startingHeight: n = 9, step: i = 0.5 }) => {
|
|
11
|
-
let t = n, r = !1;
|
|
12
|
-
for (; !r && t < s; )
|
|
13
|
-
e.style.fontSize = `${t}px`, e.style.lineHeight = `${t}px`, r = M(e), r || (t = t + i);
|
|
14
|
-
return e.style.fontSize = "", e.style.lineHeight = "", t - i;
|
|
15
|
-
}, N = ({
|
|
16
|
-
baseClass: e,
|
|
17
|
-
className: s,
|
|
18
|
-
subbrand: n,
|
|
19
|
-
alt: i,
|
|
20
|
-
src: t,
|
|
21
|
-
style: r,
|
|
22
|
-
size: f = "fluid",
|
|
23
|
-
theme: l = "light",
|
|
24
|
-
...x
|
|
25
|
-
}) => {
|
|
26
|
-
const a = m(null), h = m(null), L = m(null), c = m(null), [g, w] = S(!1), [I, B] = S(0), [y, b] = S(0), [E, W] = S(!n), R = m(
|
|
27
|
-
new ResizeObserver((o) => {
|
|
28
|
-
const { height: p } = o[0].contentRect;
|
|
29
|
-
c.current || (c.current = p), B(p);
|
|
30
|
-
})
|
|
31
|
-
);
|
|
32
|
-
J(() => {
|
|
33
|
-
n && g && y && W(!0);
|
|
34
|
-
}, [g, y, n]), v(() => {
|
|
35
|
-
if (g && h.current && a.current) {
|
|
36
|
-
const o = a.current;
|
|
37
|
-
return R.current.observe(o), () => R.current.unobserve(o);
|
|
38
|
-
}
|
|
39
|
-
}, [g]), v(() => {
|
|
40
|
-
F();
|
|
41
|
-
}, [g, c.current]), v(() => {
|
|
42
|
-
F();
|
|
43
|
-
}, [n]);
|
|
44
|
-
function F() {
|
|
45
|
-
if (h.current && L.current && c.current) {
|
|
46
|
-
const p = P(h.current, {
|
|
47
|
-
maxSize: c.current
|
|
48
|
-
}) / c.current;
|
|
49
|
-
b(p);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function j() {
|
|
53
|
-
w(!0);
|
|
54
|
-
}
|
|
55
|
-
const d = !!n, k = f === "fluid", C = !k && typeof f == "number", $ = `${e}--sub-brand`, O = `${e}--size--fluid`, V = `${e}--visibility--hidden`, G = z(
|
|
56
|
-
e,
|
|
57
|
-
s,
|
|
58
|
-
`${e}--theme--${l}`,
|
|
59
|
-
{
|
|
60
|
-
[V]: !E,
|
|
61
|
-
[O]: k,
|
|
62
|
-
[$]: d
|
|
63
|
-
}
|
|
64
|
-
), T = `${e}--image`, q = `${$}--image`, A = () => {
|
|
65
|
-
const o = {};
|
|
66
|
-
return d && (o["--logo-image-height"] = `${I}px`, o["--logo-font-size"] = `${y * I}px`), C && (o.width = `${f}px`), { ...r, ...o };
|
|
67
|
-
}, D = () => typeof t == "string" ? t : t[l];
|
|
68
|
-
return /* @__PURE__ */ H("figure", { className: G, style: A(), children: [
|
|
69
|
-
/* @__PURE__ */ u(
|
|
70
|
-
"img",
|
|
71
|
-
{
|
|
72
|
-
ref: a,
|
|
73
|
-
alt: i,
|
|
74
|
-
src: D(),
|
|
75
|
-
className: z({
|
|
76
|
-
[q]: d,
|
|
77
|
-
[T]: !d
|
|
78
|
-
}),
|
|
79
|
-
onLoad: j,
|
|
80
|
-
...x
|
|
81
|
-
}
|
|
82
|
-
),
|
|
83
|
-
d && /* @__PURE__ */ H("div", { ref: h, className: `${$}--lock-up`, children: [
|
|
84
|
-
/* @__PURE__ */ u("span", { className: `${$}--lock-up--separator` }),
|
|
85
|
-
/* @__PURE__ */ u("span", { ref: L, children: n })
|
|
86
|
-
] })
|
|
87
|
-
] });
|
|
88
|
-
}, Z = ({
|
|
89
|
-
className: e,
|
|
90
|
-
url: s,
|
|
91
|
-
target: n,
|
|
92
|
-
style: i,
|
|
93
|
-
size: t,
|
|
94
|
-
...r
|
|
95
|
-
}) => {
|
|
96
|
-
const { prefix: f } = K(), l = `${f}--logo`, x = `${l}--link`, a = `${l}--size--fluid`;
|
|
97
|
-
return s ? /* @__PURE__ */ u(
|
|
98
|
-
"a",
|
|
99
|
-
{
|
|
100
|
-
href: s,
|
|
101
|
-
target: n,
|
|
102
|
-
className: z(x, e, {
|
|
103
|
-
[a]: t === "fluid"
|
|
104
|
-
}),
|
|
105
|
-
style: i,
|
|
106
|
-
children: /* @__PURE__ */ u(N, { ...r, baseClass: l, size: t })
|
|
107
|
-
}
|
|
108
|
-
) : /* @__PURE__ */ u(
|
|
109
|
-
N,
|
|
110
|
-
{
|
|
111
|
-
baseClass: l,
|
|
112
|
-
className: e,
|
|
113
|
-
style: i,
|
|
114
|
-
size: t,
|
|
115
|
-
...r
|
|
116
|
-
}
|
|
117
|
-
);
|
|
118
|
-
};
|
|
119
|
-
export {
|
|
120
|
-
Z as Logo
|
|
121
|
-
};
|