@ilo-org/react 0.28.5 → 0.28.7
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/lib/cjs/_store/Logo-entry-BtBNFSSE.js +1 -0
- package/lib/esm/_store/Logo-entry-CNT0VLHB.js +121 -0
- package/lib/styles/components/logo.css +1 -1
- package/lib/styles/index.css +1 -1
- package/lib/styles/index.css.map +1 -1
- package/lib/styles/monorepo.css +1 -1
- package/lib/styles/monorepo.css.map +1 -1
- package/package.json +2 -2
- package/lib/cjs/_store/Logo-entry-nsoJtWSa.js +0 -1
- package/lib/esm/_store/Logo-entry-CYL-mIHC.js +0 -121
|
@@ -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
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ilo--logo--visibility--hidden{visibility:hidden}.ilo--logo--size--fluid{height:auto;width:100%}.ilo--logo--theme--light{--logo-theme-color:var(--ilo-color-blue)}.ilo--logo--theme--dark{--logo-theme-color:var(--ilo-color-white)}.ilo--logo--link{all:unset;cursor:pointer}.ilo--logo--image{height:100%;width:100%}.ilo--logo--sub-brand{--lockup-height:calc(var(--logo-image-height)*0.703);--lockup-bottom-offset:calc(var(--lockup-height)*0.05);align-items:center;color:var(--logo-theme-color);display:inline-flex;font-family:var(--ilo-fonts-display);font-size:var(--logo-font-size);font-weight:700;justify-content:flex-start;line-height:var(--logo-font-size)}.ilo--logo--sub-brand--image{height:100%;width:
|
|
1
|
+
.ilo--logo{display:flex}.ilo--logo--visibility--hidden{visibility:hidden}.ilo--logo--size--fluid{height:auto;width:100%}.ilo--logo--theme--light{--logo-theme-color:var(--ilo-color-blue)}.ilo--logo--theme--dark{--logo-theme-color:var(--ilo-color-white)}.ilo--logo--link{all:unset;cursor:pointer}.ilo--logo--image{height:100%;width:100%}.ilo--logo--sub-brand{--lockup-height:calc(var(--logo-image-height)*0.703);--lockup-bottom-offset:calc(var(--lockup-height)*0.05);align-items:center;color:var(--logo-theme-color);display:inline-flex;font-family:var(--ilo-fonts-display);font-size:var(--logo-font-size);font-weight:700;justify-content:flex-start;line-height:var(--logo-font-size)}.ilo--logo--sub-brand--image{height:100%;width:60%}.ilo--logo--sub-brand--lock-up{align-items:center;bottom:var(--lockup-bottom-offset);display:flex;flex-flow:row nowrap;height:var(--lockup-height);justify-content:flex-start;position:relative;width:40%}.ilo--logo--sub-brand--lock-up--separator{display:inline-block;height:100%;line-height:0;overflow-y:hidden;padding:0 calc(var(--logo-image-height)*.25)}.ilo--logo--sub-brand--lock-up--separator:before{border-right:calc(var(--logo-image-height)*.033) solid var(--logo-theme-color);content:"";display:inline-block;height:100%;position:relative;width:0}
|