@telefonica/mistica 15.15.0 → 15.16.1
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/css/mistica.css +1 -1
- package/dist/callout.css-mistica.js +10 -3
- package/dist/callout.css.d.ts +2 -0
- package/dist/callout.d.ts +1 -0
- package/dist/callout.js +60 -55
- package/dist/community/advanced-data-card.d.ts +2 -1
- package/dist/community/advanced-data-card.js +28 -27
- package/dist/community/blocks.d.ts +11 -1
- package/dist/community/blocks.js +69 -51
- package/dist/fixed-footer-layout.js +29 -29
- package/dist/grid.css.d.ts +6 -6
- package/dist/hooks.d.ts +3 -1
- package/dist/hooks.js +85 -79
- package/dist/package-version.js +1 -1
- package/dist/table.css-mistica.js +15 -12
- package/dist/table.css.d.ts +1 -0
- package/dist/table.d.ts +1 -0
- package/dist/table.js +83 -75
- package/dist-es/callout.css-mistica.js +3 -2
- package/dist-es/callout.js +84 -79
- package/dist-es/community/advanced-data-card.js +62 -61
- package/dist-es/community/blocks.js +99 -81
- package/dist-es/fixed-footer-layout.js +53 -53
- package/dist-es/hooks.js +91 -85
- package/dist-es/package-version.js +1 -1
- package/dist-es/style.css +1 -1
- package/dist-es/table.css-mistica.js +2 -2
- package/dist-es/table.js +118 -110
- package/package.json +1 -1
|
@@ -1,105 +1,105 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as p, Fragment as
|
|
2
|
+
import { jsxs as p, Fragment as H, jsx as a } from "react/jsx-runtime";
|
|
3
3
|
import * as v from "react";
|
|
4
|
-
import
|
|
5
|
-
import { debounce as
|
|
6
|
-
import { isRunningAcceptanceTest as
|
|
7
|
-
import { useBoundingRect as
|
|
8
|
-
import { getScrollableParentElement as
|
|
9
|
-
import { Portal as
|
|
4
|
+
import z from "classnames";
|
|
5
|
+
import { debounce as O } from "./utils/helpers.js";
|
|
6
|
+
import { isRunningAcceptanceTest as P } from "./utils/platform.js";
|
|
7
|
+
import { useBoundingRect as _, useScreenSize as j, useTheme as M, useElementDimensions as y, useWindowSize as W, useIsomorphicLayoutEffect as G } from "./hooks.js";
|
|
8
|
+
import { getScrollableParentElement as X, addPassiveEventListener as E, removePassiveEventListener as b, hasScroll as q, getScrollDistanceToBottom as J } from "./utils/dom.js";
|
|
9
|
+
import { Portal as K } from "./portal.js";
|
|
10
10
|
import { vars as T } from "./skins/skin-contract.css-mistica.js";
|
|
11
|
-
import { container as
|
|
12
|
-
import { applyCssVars as
|
|
13
|
-
import { useFixedToTopHeight as
|
|
14
|
-
import { useOverScrollColor as
|
|
15
|
-
const
|
|
11
|
+
import { container as Q, footer as U, withoutFooter as V, elevated as Y, fixedFooter as Z, portal as C, fixedBackgroundLayer as ee, absoluteBackgroundLayer as S, vars as te } from "./fixed-footer-layout.css-mistica.js";
|
|
12
|
+
import { applyCssVars as oe, safeAreaInsetBottom as re } from "./utils/css.js";
|
|
13
|
+
import { useFixedToTopHeight as se } from "./fixed-to-top.js";
|
|
14
|
+
import { useOverScrollColor as ae } from "./overscroll-color-context.js";
|
|
15
|
+
const ie = (e)=>e === document.documentElement ? window : e, ne = (e)=>{
|
|
16
16
|
const l = setTimeout(e, 0);
|
|
17
17
|
return {
|
|
18
18
|
cancel: ()=>clearTimeout(l)
|
|
19
19
|
};
|
|
20
|
-
},
|
|
20
|
+
}, ce = 200, le = (param)=>{
|
|
21
21
|
let { isFooterVisible: e = !0, footer: l, footerHeight: k = "auto", footerBgColor: i = T.colors.background, containerBgColor: F = T.colors.background, children: L, onChangeFooterHeight: n } = param;
|
|
22
|
-
const [
|
|
22
|
+
const [$, g] = v.useState(!1), d = v.useRef(null), { height: m } = _(d) || {
|
|
23
23
|
height: 0
|
|
24
|
-
}, { isTabletOrSmaller: u } =
|
|
25
|
-
|
|
24
|
+
}, { isTabletOrSmaller: u } = j(), { platformOverrides: h } = M(), { height: r, ref: w } = y({
|
|
25
|
+
includeMargins: !0
|
|
26
|
+
}), { visualHeight: D } = W(), s = se(), t = D - s - r > ce, { topColor: I = i } = ae(), { height: x, ref: N } = y();
|
|
27
|
+
G(()=>{
|
|
26
28
|
n == null || n(r);
|
|
27
29
|
}, [
|
|
28
30
|
n,
|
|
29
31
|
r
|
|
30
|
-
])
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (!u || j(x) || !t) {
|
|
34
|
-
h(!1);
|
|
32
|
+
]), v.useEffect(()=>{
|
|
33
|
+
if (!u || P(h) || !t) {
|
|
34
|
+
g(!1);
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
const f =
|
|
38
|
-
|
|
37
|
+
const f = X(d.current), A = ()=>q(f) && J(f) > s + 1, o = O(()=>{
|
|
38
|
+
g(A());
|
|
39
39
|
}, 50, {
|
|
40
40
|
leading: !0,
|
|
41
41
|
maxWait: 100
|
|
42
|
-
}),
|
|
43
|
-
return
|
|
44
|
-
o.cancel(),
|
|
42
|
+
}), B = ne(o), c = ie(f);
|
|
43
|
+
return E(c, "resize", o), E(c, "scroll", o), ()=>{
|
|
44
|
+
o.cancel(), b(c, "scroll", o), b(c, "resize", o), B.cancel();
|
|
45
45
|
};
|
|
46
46
|
}, [
|
|
47
|
-
|
|
47
|
+
h,
|
|
48
48
|
u,
|
|
49
49
|
t,
|
|
50
50
|
// `topDistance` and `contentHeight` dependencies are needed to recalculate the elevation state
|
|
51
51
|
s,
|
|
52
|
-
|
|
52
|
+
m
|
|
53
53
|
]);
|
|
54
|
-
const
|
|
55
|
-
className:
|
|
54
|
+
const R = ()=>/* @__PURE__ */ p(K, {
|
|
55
|
+
className: C,
|
|
56
56
|
children: [
|
|
57
57
|
/* @__PURE__ */ a("div", {
|
|
58
|
-
className:
|
|
58
|
+
className: ee,
|
|
59
59
|
style: {
|
|
60
|
-
background: `linear-gradient(180deg, ${
|
|
60
|
+
background: `linear-gradient(180deg, ${I} 50%, ${i} 50% 100%)`
|
|
61
61
|
}
|
|
62
62
|
}),
|
|
63
63
|
/* @__PURE__ */ a("div", {
|
|
64
|
-
ref:
|
|
65
|
-
className:
|
|
64
|
+
ref: N,
|
|
65
|
+
className: S,
|
|
66
66
|
style: {
|
|
67
67
|
background: F,
|
|
68
68
|
// this color could be a gradient
|
|
69
69
|
top: s - 1,
|
|
70
70
|
// -1 because the navigationbar could have a 1px transparent background
|
|
71
|
-
bottom: t ?
|
|
72
|
-
height: t ? "unset" :
|
|
71
|
+
bottom: t ? r : "unset",
|
|
72
|
+
height: t ? "unset" : m
|
|
73
73
|
}
|
|
74
74
|
}),
|
|
75
75
|
/* @__PURE__ */ a("div", {
|
|
76
|
-
className:
|
|
76
|
+
className: S,
|
|
77
77
|
style: {
|
|
78
78
|
background: i,
|
|
79
|
-
top:
|
|
80
|
-
height: `calc(${
|
|
79
|
+
top: x + s - 1,
|
|
80
|
+
height: `calc(${m}px - ${x}px)`
|
|
81
81
|
}
|
|
82
82
|
})
|
|
83
83
|
]
|
|
84
84
|
});
|
|
85
|
-
return /* @__PURE__ */ p(
|
|
85
|
+
return /* @__PURE__ */ p(H, {
|
|
86
86
|
children: [
|
|
87
87
|
/* @__PURE__ */ p("div", {
|
|
88
|
-
ref:
|
|
89
|
-
className:
|
|
90
|
-
style:
|
|
91
|
-
[
|
|
88
|
+
ref: d,
|
|
89
|
+
className: Q,
|
|
90
|
+
style: oe({
|
|
91
|
+
[te.footerHeight]: t ? `${r}px` : "0px"
|
|
92
92
|
}),
|
|
93
93
|
children: [
|
|
94
|
-
|
|
94
|
+
R(),
|
|
95
95
|
L
|
|
96
96
|
]
|
|
97
97
|
}),
|
|
98
98
|
/* @__PURE__ */ a("div", {
|
|
99
|
-
className:
|
|
100
|
-
[
|
|
101
|
-
[
|
|
102
|
-
[
|
|
99
|
+
className: z(U, {
|
|
100
|
+
[V]: !e,
|
|
101
|
+
[Y]: $,
|
|
102
|
+
[Z]: t
|
|
103
103
|
}),
|
|
104
104
|
style: {
|
|
105
105
|
background: u ? i : void 0
|
|
@@ -107,16 +107,16 @@ const ne = (e)=>e === document.documentElement ? window : e, ce = (e)=>{
|
|
|
107
107
|
"data-testid": `fixed-footer${e ? "-visible" : "-hidden"}`,
|
|
108
108
|
"data-position-fixed": "bottom",
|
|
109
109
|
children: e && /* @__PURE__ */ a("aside", {
|
|
110
|
-
ref:
|
|
110
|
+
ref: w,
|
|
111
111
|
"data-component-name": "FixedFooter",
|
|
112
112
|
style: {
|
|
113
113
|
height: k,
|
|
114
|
-
marginBottom:
|
|
114
|
+
marginBottom: re
|
|
115
115
|
},
|
|
116
116
|
children: l
|
|
117
117
|
})
|
|
118
118
|
})
|
|
119
119
|
]
|
|
120
120
|
});
|
|
121
|
-
},
|
|
122
|
-
export {
|
|
121
|
+
}, Se = le;
|
|
122
|
+
export { Se as default };
|
package/dist-es/hooks.js
CHANGED
|
@@ -1,162 +1,168 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { listenResize as
|
|
6
|
-
import { isClientSide as
|
|
7
|
-
import { isEqual as
|
|
8
|
-
const
|
|
9
|
-
const t =
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import I from "./theme-context.js";
|
|
3
|
+
import E from "./screen-size-context.js";
|
|
4
|
+
import H from "./aria-id-getter-context.js";
|
|
5
|
+
import { listenResize as T } from "./utils/dom.js";
|
|
6
|
+
import { isClientSide as l } from "./utils/environment.js";
|
|
7
|
+
import { isEqual as R } from "./utils/helpers.js";
|
|
8
|
+
const C = ()=>{
|
|
9
|
+
const t = n.useContext(I);
|
|
10
10
|
if (!t) throw Error("To use @telefonica/mistica components you must instantiate <ThemeContextProvider> as their parent.");
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
let
|
|
14
|
-
const
|
|
15
|
-
|
|
13
|
+
let f = "", S = 0, g = 0;
|
|
14
|
+
const M = (t)=>{
|
|
15
|
+
n.useEffect(()=>{
|
|
16
16
|
if (t) {
|
|
17
|
-
const
|
|
17
|
+
const r = document.scrollingElement || document.documentElement, e = ()=>{
|
|
18
18
|
var i;
|
|
19
19
|
var _ref, _ref1;
|
|
20
|
-
if (
|
|
20
|
+
if (g++, !(g > 1) && (S = (_ref = r == null ? void 0 : r.scrollTop) !== null && _ref !== void 0 ? _ref : 0, f = (_ref1 = (i = document.body) == null ? void 0 : i.style.cssText) !== null && _ref1 !== void 0 ? _ref1 : "", document.body)) {
|
|
21
21
|
var _ref2;
|
|
22
|
-
const o = window.innerWidth > ((_ref2 =
|
|
23
|
-
document.body.style.cssText =
|
|
22
|
+
const o = window.innerWidth > ((_ref2 = r == null ? void 0 : r.clientWidth) !== null && _ref2 !== void 0 ? _ref2 : window.innerWidth) ? "scroll" : "hidden";
|
|
23
|
+
document.body.style.cssText = f + (f.endsWith(";") ? "" : ";") + [
|
|
24
24
|
"overflow: hidden;",
|
|
25
25
|
`overflow-y: ${o};`,
|
|
26
26
|
"position: fixed;",
|
|
27
|
-
`top: ${-
|
|
27
|
+
`top: ${-S}px;`,
|
|
28
28
|
"left: 0px;",
|
|
29
29
|
"right: 0px;",
|
|
30
30
|
"bottom: 0px;",
|
|
31
31
|
"overscroll-behavior-y: contain;"
|
|
32
32
|
].join("");
|
|
33
33
|
}
|
|
34
|
-
},
|
|
35
|
-
|
|
34
|
+
}, c = ()=>{
|
|
35
|
+
g--, !(g > 0) && (document.body && (document.body.style.cssText = f), r && (r.scrollTop = S));
|
|
36
36
|
};
|
|
37
|
-
return e(),
|
|
37
|
+
return e(), c;
|
|
38
38
|
}
|
|
39
39
|
return ()=>{};
|
|
40
40
|
}, [
|
|
41
41
|
t
|
|
42
42
|
]);
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
}, k = ()=>n.useContext(E), F = function() {
|
|
44
|
+
let { includeMargins: t = !1 } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
45
|
+
const [r, e] = n.useState(0), [c, i] = n.useState(0), [s, o] = n.useState(null), d = n.useCallback((a)=>{
|
|
46
|
+
if (!a) {
|
|
47
|
+
e(0), i(0);
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
|
-
const { width:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const { width: w, height: m } = a[0].contentRect;
|
|
51
|
+
if (t) {
|
|
52
|
+
const h = window.getComputedStyle(a[0].target), v = parseInt(h.marginTop, 10), b = parseInt(h.marginBottom, 10), W = parseInt(h.marginLeft, 10), x = parseInt(h.marginRight, 10);
|
|
53
|
+
e(w + W + x), i(m + v + b);
|
|
54
|
+
} else e(w), i(m);
|
|
55
|
+
}, [
|
|
56
|
+
t
|
|
57
|
+
]), u = n.useCallback((a)=>{
|
|
58
|
+
o(a);
|
|
53
59
|
}, []);
|
|
54
|
-
return
|
|
55
|
-
if (!
|
|
56
|
-
|
|
60
|
+
return n.useEffect(()=>{
|
|
61
|
+
if (!s) {
|
|
62
|
+
e(0), i(0);
|
|
57
63
|
return;
|
|
58
64
|
}
|
|
59
|
-
return
|
|
65
|
+
return T(s, d);
|
|
60
66
|
}, [
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
s,
|
|
68
|
+
d
|
|
63
69
|
]), {
|
|
64
|
-
width:
|
|
65
|
-
height:
|
|
70
|
+
width: r,
|
|
71
|
+
height: c,
|
|
66
72
|
ref: u
|
|
67
73
|
};
|
|
68
|
-
},
|
|
69
|
-
const { useId:
|
|
70
|
-
if (
|
|
71
|
-
const e =
|
|
74
|
+
}, $ = (t)=>{
|
|
75
|
+
const { useId: r } = C();
|
|
76
|
+
if (r) {
|
|
77
|
+
const e = r();
|
|
72
78
|
return t || e;
|
|
73
79
|
} else {
|
|
74
|
-
const e =
|
|
75
|
-
return
|
|
80
|
+
const e = n.useContext(H);
|
|
81
|
+
return n.useRef(t || e()).current;
|
|
76
82
|
}
|
|
77
|
-
},
|
|
78
|
-
var
|
|
79
|
-
const [t,
|
|
80
|
-
return
|
|
81
|
-
const
|
|
82
|
-
var
|
|
83
|
-
|
|
83
|
+
}, y = ()=>{
|
|
84
|
+
var w;
|
|
85
|
+
const [t, r] = n.useState(l() ? window.innerHeight : 1200), [e, c] = n.useState(l() ? window.innerWidth : 800), [i, s] = n.useState(l() ? window.screen.availHeight : 1200), [o, d] = n.useState(l() ? window.screen.availWidth : 800), [u, a] = n.useState(l() ? ((w = window.visualViewport) == null ? void 0 : w.height) || window.screen.availHeight : 1200);
|
|
86
|
+
return n.useEffect(()=>{
|
|
87
|
+
const m = ()=>{
|
|
88
|
+
var h;
|
|
89
|
+
r(window.innerHeight), c(window.innerWidth), s(window.screen.availHeight), d(window.screen.availWidth), a(((h = window.visualViewport) == null ? void 0 : h.height) || window.screen.availHeight);
|
|
84
90
|
};
|
|
85
|
-
return window.addEventListener("resize",
|
|
86
|
-
window.removeEventListener("resize",
|
|
91
|
+
return window.addEventListener("resize", m), ()=>{
|
|
92
|
+
window.removeEventListener("resize", m);
|
|
87
93
|
};
|
|
88
|
-
}, []),
|
|
94
|
+
}, []), n.useMemo(()=>({
|
|
89
95
|
height: t,
|
|
90
96
|
width: e,
|
|
91
97
|
screenHeight: i,
|
|
92
98
|
screenWidth: o,
|
|
93
|
-
visualHeight:
|
|
99
|
+
visualHeight: u
|
|
94
100
|
}), [
|
|
95
101
|
t,
|
|
96
102
|
e,
|
|
97
103
|
i,
|
|
98
104
|
o,
|
|
99
|
-
|
|
105
|
+
u
|
|
100
106
|
]);
|
|
101
|
-
},
|
|
102
|
-
const { height: t } =
|
|
107
|
+
}, j = ()=>{
|
|
108
|
+
const { height: t } = y();
|
|
103
109
|
return t;
|
|
104
|
-
},
|
|
105
|
-
const { width: t } =
|
|
110
|
+
}, G = ()=>{
|
|
111
|
+
const { width: t } = y();
|
|
106
112
|
return t;
|
|
107
|
-
},
|
|
108
|
-
const [
|
|
109
|
-
return
|
|
113
|
+
}, O = l() ? n.useLayoutEffect : n.useEffect, B = (t, r, e)=>{
|
|
114
|
+
const [c, i] = n.useState(r);
|
|
115
|
+
return n.useEffect(()=>{
|
|
110
116
|
if (!t.current) return;
|
|
111
117
|
if (typeof window.IntersectionObserver > "u") return ()=>{};
|
|
112
|
-
const
|
|
118
|
+
const s = new IntersectionObserver((o)=>{
|
|
113
119
|
i(o[0].isIntersecting);
|
|
114
120
|
}, {
|
|
115
121
|
root: e == null ? void 0 : e.root,
|
|
116
122
|
rootMargin: e == null ? void 0 : e.rootMargin,
|
|
117
123
|
threshold: e == null ? void 0 : e.threshold
|
|
118
124
|
});
|
|
119
|
-
return
|
|
120
|
-
|
|
125
|
+
return s.observe(t.current), ()=>{
|
|
126
|
+
s.disconnect();
|
|
121
127
|
};
|
|
122
128
|
}, [
|
|
123
129
|
t,
|
|
124
130
|
e == null ? void 0 : e.root,
|
|
125
131
|
e == null ? void 0 : e.rootMargin,
|
|
126
132
|
e == null ? void 0 : e.threshold
|
|
127
|
-
]),
|
|
128
|
-
},
|
|
129
|
-
const { top:
|
|
133
|
+
]), c;
|
|
134
|
+
}, z = (t)=>{
|
|
135
|
+
const { top: r, right: e, bottom: c, left: i, width: s, height: o, x: d, y: u } = t.getBoundingClientRect();
|
|
130
136
|
return {
|
|
131
|
-
top:
|
|
137
|
+
top: r,
|
|
132
138
|
right: e,
|
|
133
|
-
bottom:
|
|
139
|
+
bottom: c,
|
|
134
140
|
left: i,
|
|
135
|
-
width:
|
|
141
|
+
width: s,
|
|
136
142
|
height: o,
|
|
137
|
-
x:
|
|
138
|
-
y:
|
|
143
|
+
x: d,
|
|
144
|
+
y: u
|
|
139
145
|
};
|
|
140
|
-
},
|
|
141
|
-
let
|
|
142
|
-
const [
|
|
143
|
-
return
|
|
146
|
+
}, P = function(t) {
|
|
147
|
+
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
|
|
148
|
+
const [c, i] = n.useState(), s = B(t, !1);
|
|
149
|
+
return n.useEffect(()=>{
|
|
144
150
|
let o;
|
|
145
|
-
const
|
|
146
|
-
if (t.current && (
|
|
147
|
-
const
|
|
148
|
-
|
|
151
|
+
const d = ()=>{
|
|
152
|
+
if (t.current && (s || e)) {
|
|
153
|
+
const u = z(t.current);
|
|
154
|
+
R(c, u) || i(u), r && (o = requestAnimationFrame(d));
|
|
149
155
|
} else i(void 0);
|
|
150
156
|
};
|
|
151
|
-
return o = requestAnimationFrame(
|
|
157
|
+
return o = requestAnimationFrame(d), ()=>{
|
|
152
158
|
cancelAnimationFrame(o);
|
|
153
159
|
};
|
|
154
160
|
}, [
|
|
155
161
|
t,
|
|
156
|
-
s,
|
|
157
162
|
c,
|
|
158
|
-
|
|
163
|
+
s,
|
|
164
|
+
r,
|
|
159
165
|
e
|
|
160
|
-
]),
|
|
166
|
+
]), c;
|
|
161
167
|
};
|
|
162
|
-
export {
|
|
168
|
+
export { $ as useAriaId, P as useBoundingRect, M as useDisableBodyScroll, F as useElementDimensions, B as useIsInViewport, O as useIsomorphicLayoutEffect, k as useScreenSize, C as useTheme, j as useWindowHeight, y as useWindowSize, G as useWindowWidth };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const o = "15.
|
|
1
|
+
const o = "15.16.1";
|
|
2
2
|
export { o as PACKAGE_VERSION };
|