@tedi-design-system/react 15.0.0-rc.6 → 15.0.0-rc.8
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/_virtual/index.cjs10.js +1 -1
- package/_virtual/index.cjs11.js +1 -1
- package/_virtual/index.cjs12.js +1 -1
- package/_virtual/index.cjs13.js +1 -1
- package/_virtual/index.cjs5.js +1 -1
- package/_virtual/index.cjs6.js +1 -1
- package/_virtual/index.cjs7.js +1 -1
- package/_virtual/index.cjs8.js +1 -1
- package/_virtual/index.cjs9.js +1 -1
- package/_virtual/index.es10.js +1 -1
- package/_virtual/index.es11.js +1 -1
- package/_virtual/index.es12.js +1 -1
- package/_virtual/index.es13.js +2 -4
- package/_virtual/index.es5.js +4 -2
- package/_virtual/index.es6.js +1 -1
- package/_virtual/index.es7.js +1 -1
- package/_virtual/index.es8.js +1 -1
- package/_virtual/index.es9.js +1 -1
- package/bundle-stats.html +1 -1
- package/external/@mui/system/colorManipulator.cjs.js +1 -1
- package/external/@mui/system/colorManipulator.es.js +2 -2
- package/external/@mui/system/createStyled.cjs.js +1 -1
- package/external/@mui/system/createStyled.es.js +6 -6
- package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
- package/external/@mui/system/useThemeWithoutDefault.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/misc/scroll-visibility/scroll-visibility.cjs.js +2 -1
- package/src/tedi/components/misc/scroll-visibility/scroll-visibility.es.js +44 -32
- package/src/tedi/helpers/hooks/use-scroll.cjs.js +1 -1
- package/src/tedi/helpers/hooks/use-scroll.d.ts +3 -1
- package/src/tedi/helpers/hooks/use-scroll.es.js +19 -19
package/package.json
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("react/jsx-runtime"),v=require("../../../../../external/classnames/index.cjs.js"),t=require("react"),V=require("../../../helpers/hooks/use-scroll.cjs.js"),b=require("./scroll-visibility.module.scss.cjs.js"),g=w=>{const{children:l,enabled:o=!0,className:H,visibility:n="hide",toggleVisibility:h=!1,scrollDistance:c=100,scrollDirection:u="down",scrollContainer:p,animationDirection:q="center"}=w,[d,D]=t.useState(!1),{scrollTop:i=0,scrollHeight:a=0,clientHeight:f=0}=V.useScroll(p)??{},[E,m]=t.useState(!1),S=t.useRef(0);t.useEffect(()=>{if(D(!0),!o)return;const e=u==="down"?i:a-f-i,s=n==="hide"?e>c:e<=c;m(s),S.current=e},[]),t.useEffect(()=>{if(!d||!o)return;const e=n==="show",s=u==="down"?i:a-f-i;let r;h&&s<S.current?r=e:s>c?r=!e:r=e,m(r),S.current=s},[d,o,n,h,c,i,u,a,f]);const y=v.default(b.default["tedi-scroll-visibility"],b.default[`tedi-scroll-visibility--${q}`],{[b.default["tedi-scroll-visibility--hidden"]]:d&&o&&E},H);return t.isValidElement(l)?t.cloneElement(l,{className:v.default(l.props.className,y)}):M.jsx("div",{className:y,children:l})};exports.ScrollVisibility=g;exports.default=g;
|
|
@@ -1,40 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as M } from "react/jsx-runtime";
|
|
3
|
+
import y from "../../../../../external/classnames/index.es.js";
|
|
4
|
+
import { useState as S, useRef as V, useEffect as w, cloneElement as x, isValidElement as I } from "react";
|
|
5
|
+
import { useScroll as T } from "../../../helpers/hooks/use-scroll.es.js";
|
|
6
|
+
import f from "./scroll-visibility.module.scss.es.js";
|
|
7
|
+
const k = (H) => {
|
|
7
8
|
const {
|
|
8
|
-
children:
|
|
9
|
-
enabled:
|
|
10
|
-
className:
|
|
9
|
+
children: t,
|
|
10
|
+
enabled: l = !0,
|
|
11
|
+
className: v,
|
|
11
12
|
visibility: n = "hide",
|
|
12
|
-
toggleVisibility:
|
|
13
|
-
scrollDistance:
|
|
14
|
-
scrollDirection:
|
|
15
|
-
scrollContainer:
|
|
16
|
-
animationDirection:
|
|
17
|
-
} =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (!
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
toggleVisibility: h = !1,
|
|
14
|
+
scrollDistance: o = 100,
|
|
15
|
+
scrollDirection: c = "down",
|
|
16
|
+
scrollContainer: D,
|
|
17
|
+
animationDirection: N = "center"
|
|
18
|
+
} = H, [d, g] = S(!1), { scrollTop: s = 0, scrollHeight: a = 0, clientHeight: u = 0 } = T(D) ?? {}, [E, p] = S(!1), m = V(0);
|
|
19
|
+
w(() => {
|
|
20
|
+
if (g(!0), !l) return;
|
|
21
|
+
const e = c === "down" ? s : a - u - s, i = n === "hide" ? e > o : e <= o;
|
|
22
|
+
p(i), m.current = e;
|
|
23
|
+
}, []), w(() => {
|
|
24
|
+
if (!d || !l) return;
|
|
25
|
+
const e = n === "show", i = c === "down" ? s : a - u - s;
|
|
26
|
+
let r;
|
|
27
|
+
h && i < m.current ? r = e : i > o ? r = !e : r = e, p(r), m.current = i;
|
|
28
|
+
}, [
|
|
29
|
+
d,
|
|
30
|
+
l,
|
|
31
|
+
n,
|
|
32
|
+
h,
|
|
33
|
+
o,
|
|
34
|
+
s,
|
|
35
|
+
c,
|
|
36
|
+
a,
|
|
37
|
+
u
|
|
38
|
+
]);
|
|
39
|
+
const b = y(
|
|
40
|
+
f["tedi-scroll-visibility"],
|
|
41
|
+
f[`tedi-scroll-visibility--${N}`],
|
|
30
42
|
{
|
|
31
|
-
[
|
|
43
|
+
[f["tedi-scroll-visibility--hidden"]]: d && l && E
|
|
32
44
|
},
|
|
33
|
-
|
|
45
|
+
v
|
|
34
46
|
);
|
|
35
|
-
return
|
|
47
|
+
return I(t) ? x(t, { className: y(t.props.className, b) }) : /* @__PURE__ */ M("div", { className: b, children: t });
|
|
36
48
|
};
|
|
37
49
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
k as ScrollVisibility,
|
|
51
|
+
k as default
|
|
40
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../../../external/lodash-es/throttle.cjs.js"),r=require("react"),u={scrollTop:0,scrollHeight:0,clientHeight:0},a=t=>{const[s,n]=r.useState(u);return r.useEffect(()=>{const e=t??document.documentElement,o=t??window,c=()=>{n({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight})},l=i.default(c,50);return o.addEventListener("scroll",l),c(),()=>{o.removeEventListener("scroll",l),l.cancel()}},[t]),s};exports.useScroll=a;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
10
|
-
const t =
|
|
11
|
-
|
|
12
|
-
scrollTop:
|
|
13
|
-
scrollHeight:
|
|
14
|
-
clientHeight:
|
|
1
|
+
import n from "../../../../external/lodash-es/throttle.es.js";
|
|
2
|
+
import { useState as i, useEffect as g } from "react";
|
|
3
|
+
const u = {
|
|
4
|
+
scrollTop: 0,
|
|
5
|
+
scrollHeight: 0,
|
|
6
|
+
clientHeight: 0
|
|
7
|
+
}, a = (t) => {
|
|
8
|
+
const [r, s] = i(u);
|
|
9
|
+
return g(() => {
|
|
10
|
+
const o = t ?? document.documentElement, l = t ?? window, c = () => {
|
|
11
|
+
s({
|
|
12
|
+
scrollTop: o.scrollTop,
|
|
13
|
+
scrollHeight: o.scrollHeight,
|
|
14
|
+
clientHeight: o.clientHeight
|
|
15
15
|
});
|
|
16
|
-
}, 50);
|
|
17
|
-
return
|
|
18
|
-
|
|
16
|
+
}, e = n(c, 50);
|
|
17
|
+
return l.addEventListener("scroll", e), c(), () => {
|
|
18
|
+
l.removeEventListener("scroll", e), e.cancel();
|
|
19
19
|
};
|
|
20
|
-
}, [
|
|
20
|
+
}, [t]), r;
|
|
21
21
|
};
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
a as useScroll
|
|
24
24
|
};
|