@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/react",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.7",
|
|
4
4
|
"description": "React components for the ILO's Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui_patterns",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@ilo-org/brand-assets": "1.0.1",
|
|
78
78
|
"@ilo-org/fonts": "2.0.0",
|
|
79
79
|
"@ilo-org/icons-react": "1.0.6",
|
|
80
|
-
"@ilo-org/styles": "1.11.
|
|
80
|
+
"@ilo-org/styles": "1.11.2"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@chromatic-com/storybook": "3.2.7",
|
|
@@ -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
|
-
};
|