@yakad/ui 1.3.40 → 1.3.41
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/dist/appBar/appBar.d.ts
CHANGED
package/dist/appBar/appBar.js
CHANGED
|
@@ -9,12 +9,36 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React, { forwardRef } from "react";
|
|
12
|
+
import React, { forwardRef, useEffect, useState } from "react";
|
|
13
13
|
import classNames from "classnames";
|
|
14
14
|
import styles from "./appBar.module.css";
|
|
15
15
|
export const AppBar = forwardRef((_a, ref) => {
|
|
16
|
-
var { sticky, blur, className, children } = _a, restProps = __rest(_a, ["sticky", "blur", "className", "children"]);
|
|
17
|
-
const
|
|
16
|
+
var { sticky, autohide, blur, className, children } = _a, restProps = __rest(_a, ["sticky", "autohide", "blur", "className", "children"]);
|
|
17
|
+
const [show, setShow] = useState(true);
|
|
18
|
+
const [lastScrollY, setLastScrollY] = useState(0);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!autohide)
|
|
21
|
+
return;
|
|
22
|
+
const handleScroll = () => {
|
|
23
|
+
const currentScrollY = window.scrollY;
|
|
24
|
+
if (currentScrollY > lastScrollY && currentScrollY > 50) {
|
|
25
|
+
// Scroll down
|
|
26
|
+
setShow(false);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
// Scroll up
|
|
30
|
+
setShow(true);
|
|
31
|
+
}
|
|
32
|
+
setLastScrollY(currentScrollY);
|
|
33
|
+
};
|
|
34
|
+
window.addEventListener("scroll", handleScroll);
|
|
35
|
+
return () => window.removeEventListener("scroll", handleScroll);
|
|
36
|
+
}, [lastScrollY, autohide]);
|
|
37
|
+
const joinedClassNames = classNames(styles.header, {
|
|
38
|
+
[styles.sticky]: sticky,
|
|
39
|
+
[styles.blur]: blur,
|
|
40
|
+
[styles.hidden]: autohide && !show,
|
|
41
|
+
}, className);
|
|
18
42
|
return (React.createElement("header", Object.assign({ ref: ref }, restProps, { className: joinedClassNames }), children));
|
|
19
43
|
});
|
|
20
44
|
//# sourceMappingURL=appBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appBar.js","sourceRoot":"","sources":["../../src/appBar/appBar.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"appBar.js","sourceRoot":"","sources":["../../src/appBar/appBar.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,MAAM,MAAM,qBAAqB,CAAC;AASzC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC5B,CAAC,EAA6D,EAAE,GAAG,EAAE,EAAE;QAAtE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,OAAgB,EAAX,SAAS,cAA3D,uDAA6D,CAAF;IACxD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAElD,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,MAAM,YAAY,GAAG,GAAG,EAAE;YACtB,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC;YAEtC,IAAI,cAAc,GAAG,WAAW,IAAI,cAAc,GAAG,EAAE,EAAE,CAAC;gBACtD,cAAc;gBACd,OAAO,CAAC,KAAK,CAAC,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACJ,YAAY;gBACZ,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;YAED,cAAc,CAAC,cAAc,CAAC,CAAC;QACnC,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAChD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACpE,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,MAAM,gBAAgB,GAAG,UAAU,CAC/B,MAAM,CAAC,MAAM,EACb;QACI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM;QACvB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI;QACnB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,IAAI,CAAC,IAAI;KACrC,EACD,SAAS,CACZ,CAAC;IAEF,OAAO,CACH,8CAAQ,GAAG,EAAE,GAAG,IAAM,SAAS,IAAE,SAAS,EAAE,gBAAgB,KACvD,QAAQ,CACJ,CACZ,CAAC;AACN,CAAC,CACJ,CAAC"}
|
|
@@ -8,13 +8,16 @@
|
|
|
8
8
|
padding: 0 2rem;
|
|
9
9
|
border-bottom: 0.1rem solid #7d7d7d40;
|
|
10
10
|
gap: 1rem;
|
|
11
|
-
z-index: 2;
|
|
12
11
|
background: rgb(var(--surfaceContainerColor, 243 237 247));
|
|
13
12
|
color: rgb(var(--onSurfaceColor, 28 27 31));
|
|
14
13
|
fill: rgb(var(--onSurfaceColor, 28 27 31));
|
|
14
|
+
transition: transform 0.3s ease;
|
|
15
|
+
will-change: transform;
|
|
16
|
+
z-index: 2;
|
|
15
17
|
user-select: none;
|
|
16
18
|
}
|
|
17
|
-
|
|
19
|
+
|
|
20
|
+
.header.sticky {
|
|
18
21
|
position: sticky;
|
|
19
22
|
top: 0;
|
|
20
23
|
}
|
|
@@ -22,8 +25,12 @@
|
|
|
22
25
|
.header.blur {
|
|
23
26
|
background-color: color-mix(
|
|
24
27
|
in srgb,
|
|
25
|
-
rgb(var(--surfaceContainerColor, 243 237 247))
|
|
28
|
+
rgb(var(--surfaceContainerColor, 243 237 247)) 85%,
|
|
26
29
|
transparent
|
|
27
30
|
);
|
|
28
|
-
backdrop-filter: blur(0.
|
|
31
|
+
backdrop-filter: blur(0.5rem);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.header.hidden {
|
|
35
|
+
transform: translateY(-100%);
|
|
29
36
|
}
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
.card.blur {
|
|
34
34
|
background-color: color-mix(
|
|
35
35
|
in srgb,
|
|
36
|
-
rgb(var(--surfaceContainerHighestColor, 230 224 233))
|
|
36
|
+
rgb(var(--surfaceContainerHighestColor, 230 224 233)) 85%,
|
|
37
37
|
transparent
|
|
38
38
|
);
|
|
39
|
-
backdrop-filter: blur(0.
|
|
39
|
+
backdrop-filter: blur(0.5rem);
|
|
40
40
|
}
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
.footer.blur {
|
|
33
33
|
background-color: color-mix(
|
|
34
34
|
in srgb,
|
|
35
|
-
rgb(var(--surfaceContainerColor, 243 237 247))
|
|
35
|
+
rgb(var(--surfaceContainerColor, 243 237 247)) 85%,
|
|
36
36
|
transparent
|
|
37
37
|
);
|
|
38
|
-
backdrop-filter: blur(0.
|
|
38
|
+
backdrop-filter: blur(0.5rem);
|
|
39
39
|
}
|