@ichaingo/header 1.4.52 → 1.4.54
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/index.d.ts +8 -1
- package/dist/index.js +28 -24
- package/dist/lib/Drawer.js +9 -9
- package/dist/lib/Right.js +16 -7
- package/package.json +15 -15
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { JSX } from 'react/jsx-runtime';
|
|
|
3
3
|
|
|
4
4
|
export declare function emitUserEvent(eventName: string, data?: any): void;
|
|
5
5
|
|
|
6
|
-
declare function HeaderBar({ extra, children, className, hideNews, hideLogin }: HeaderBarProps): Promise<JSX.Element>;
|
|
6
|
+
declare function HeaderBar({ extra, children, className, hideNews, hideLogin, source }: HeaderBarProps): Promise<JSX.Element>;
|
|
7
7
|
export default HeaderBar;
|
|
8
8
|
|
|
9
9
|
export declare interface HeaderBarProps extends default_2.HTMLAttributes<HTMLDivElement> {
|
|
@@ -11,6 +11,13 @@ export declare interface HeaderBarProps extends default_2.HTMLAttributes<HTMLDiv
|
|
|
11
11
|
children?: default_2.ReactNode;
|
|
12
12
|
hideNews?: boolean;
|
|
13
13
|
hideLogin?: boolean;
|
|
14
|
+
source?: HeaderSource;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare enum HeaderSource {
|
|
18
|
+
EXPLORER = "explorer",
|
|
19
|
+
CHAT = "chat",
|
|
20
|
+
DEFAULT = "default"
|
|
14
21
|
}
|
|
15
22
|
|
|
16
23
|
export declare function onUserEvent(eventName: string, callback: (data?: any) => void): () => void;
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,46 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { twMerge as
|
|
3
|
-
import
|
|
4
|
-
import { cookies as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { USER_EVENTS as _, emitUserEvent as
|
|
8
|
-
async function
|
|
9
|
-
var
|
|
1
|
+
import { jsxs as r, Fragment as x, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { twMerge as i } from "tailwind-merge";
|
|
3
|
+
import k from "@ichaingo/request";
|
|
4
|
+
import { cookies as g } from "next/headers";
|
|
5
|
+
import m, { HeaderSource as a } from "./lib/Right.js";
|
|
6
|
+
import E from "./lib/Logo.js";
|
|
7
|
+
import { USER_EVENTS as _, emitUserEvent as w, onUserEvent as j } from "./lib/events.js";
|
|
8
|
+
async function N({ extra: l, children: p, className: f, hideNews: d, hideLogin: c, source: t = a.DEFAULT }) {
|
|
9
|
+
var n;
|
|
10
10
|
let e = {
|
|
11
11
|
data: {}
|
|
12
12
|
};
|
|
13
13
|
try {
|
|
14
|
-
const
|
|
15
|
-
if (typeof
|
|
14
|
+
const s = (n = (await g()).get("refresh_token")) == null ? void 0 : n.value;
|
|
15
|
+
if (typeof s < "u" && s !== "")
|
|
16
16
|
try {
|
|
17
|
-
e = await
|
|
17
|
+
e = await k.get("/v2/users/profile", {
|
|
18
18
|
baseURL: process.env.AUTH_INNER_API_URL
|
|
19
19
|
});
|
|
20
|
-
} catch (
|
|
21
|
-
console.error(
|
|
20
|
+
} catch (h) {
|
|
21
|
+
console.error(h), e = { data: {} };
|
|
22
22
|
}
|
|
23
23
|
} catch {
|
|
24
24
|
e = { data: {} };
|
|
25
25
|
}
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
|
|
26
|
+
return /* @__PURE__ */ r(x, { children: [
|
|
27
|
+
/* @__PURE__ */ r("div", { className: i("sticky left-0 right-0 top-0 bg-background h-16 z-999", t === a.CHAT ? "hidden md:block" : "block", f), children: [
|
|
28
|
+
/* @__PURE__ */ r("div", { className: "md:bg-module h-13 text-center flex flex-wrap justify-between items-center gap-2 px-4", children: [
|
|
29
|
+
/* @__PURE__ */ r("div", { className: i("items-center flex-1 gap-6", t === a.CHAT ? "hidden md:flex" : "flex"), children: [
|
|
30
|
+
/* @__PURE__ */ o(E, {}),
|
|
31
|
+
p
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ o(m, { hideNews: d, hideLogin: c, user: (e == null ? void 0 : e.data) || {} })
|
|
31
34
|
] }),
|
|
32
|
-
|
|
35
|
+
l
|
|
33
36
|
] }),
|
|
34
|
-
i
|
|
37
|
+
/* @__PURE__ */ o("div", { className: i(t === a.CHAT ? "block md:hidden" : "hidden"), children: /* @__PURE__ */ o(m, { hideNews: d, source: t, hideLogin: c, user: (e == null ? void 0 : e.data) || {} }) })
|
|
35
38
|
] });
|
|
36
39
|
}
|
|
37
40
|
export {
|
|
41
|
+
a as HeaderSource,
|
|
38
42
|
_ as USER_EVENTS,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
N as default,
|
|
44
|
+
w as emitUserEvent,
|
|
45
|
+
j as onUserEvent
|
|
42
46
|
};
|
package/dist/lib/Drawer.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { Menu as
|
|
3
|
+
import d from "rc-drawer";
|
|
4
|
+
import { Menu as m, X as c } from "lucide-react";
|
|
5
5
|
import f from "./Nav.js";
|
|
6
6
|
import { useState as p } from "react";
|
|
7
7
|
function b({ hideLogin: i, hideNews: a, user: n }) {
|
|
8
|
-
const [t,
|
|
8
|
+
const [t, r] = p(!1);
|
|
9
9
|
if (!t)
|
|
10
|
-
return /* @__PURE__ */ o(
|
|
11
|
-
const
|
|
12
|
-
e == null || e.preventDefault(), e == null || e.stopPropagation(),
|
|
10
|
+
return /* @__PURE__ */ o(m, { onClick: () => r(!0), size: 32, style: { color: "var(--title)" }, className: "md:hidden bg-module rounded-lg p-[4px] " });
|
|
11
|
+
const l = (e) => {
|
|
12
|
+
e == null || e.preventDefault(), e == null || e.stopPropagation(), r(!1);
|
|
13
13
|
};
|
|
14
|
-
return /* @__PURE__ */ o(
|
|
15
|
-
/* @__PURE__ */ o("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ o(c, { size: 24, style: { color: "var(--title)" }, onClick: (e) =>
|
|
16
|
-
/* @__PURE__ */ o(f, { onClick: (e) =>
|
|
14
|
+
return /* @__PURE__ */ o(d, { open: t, placement: "right", className: "block md:hidden fixed top-0 bottom-0 left-0 right-0 z-1001 bg-background p-2", children: /* @__PURE__ */ s("div", { className: "w-full max-h-full overflow-y-auto p-3 bg-module rounded-lg", children: [
|
|
15
|
+
/* @__PURE__ */ o("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ o(c, { size: 24, style: { color: "var(--title)" }, onClick: (e) => l(e) }) }),
|
|
16
|
+
/* @__PURE__ */ o(f, { onClick: (e) => l(e), hideLogin: i, hideNews: a, user: n })
|
|
17
17
|
] }) });
|
|
18
18
|
}
|
|
19
19
|
export {
|
package/dist/lib/Right.js
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import i from "./Nav.js";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import l from "./Drawer.js";
|
|
4
|
+
import { twMerge as o } from "tailwind-merge";
|
|
5
|
+
var d = /* @__PURE__ */ ((t) => (t.EXPLORER = "explorer", t.CHAT = "chat", t.DEFAULT = "default", t))(d || {});
|
|
6
|
+
function x({
|
|
7
|
+
hideNews: t,
|
|
8
|
+
hideLogin: m,
|
|
9
|
+
user: a,
|
|
10
|
+
source: e = "default"
|
|
11
|
+
/* DEFAULT */
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ f("div", { className: o(e === "chat" ? "" : "flex justify-end items-center md:gap-10 z-1001"), children: [
|
|
14
|
+
/* @__PURE__ */ r(l, { hideLogin: m, hideNews: t, user: a }),
|
|
15
|
+
/* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ r(i, { hideNews: t, hideLogin: m, user: a }) })
|
|
8
16
|
] });
|
|
9
17
|
}
|
|
10
18
|
export {
|
|
11
|
-
|
|
19
|
+
d as HeaderSource,
|
|
20
|
+
x as default
|
|
12
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/header",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.54",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -29,20 +29,20 @@
|
|
|
29
29
|
"rollup-plugin-preserve-use-client": "^1.0.0",
|
|
30
30
|
"tailwind-merge": "^2.5.5",
|
|
31
31
|
"next": "15.1.6",
|
|
32
|
-
"@ichaingo/
|
|
33
|
-
"@ichaingo/auth": "1.4.
|
|
34
|
-
"@ichaingo/
|
|
35
|
-
"@ichaingo/link": "1.4.
|
|
36
|
-
"@ichaingo/
|
|
37
|
-
"@ichaingo/
|
|
38
|
-
"@ichaingo/
|
|
39
|
-
"@ichaingo/
|
|
40
|
-
"@ichaingo/
|
|
41
|
-
"@ichaingo/
|
|
42
|
-
"@ichaingo/
|
|
43
|
-
"@ichaingo/
|
|
44
|
-
"@ichaingo/
|
|
45
|
-
"@ichaingo/
|
|
32
|
+
"@ichaingo/avatar": "1.4.54",
|
|
33
|
+
"@ichaingo/auth": "1.4.54",
|
|
34
|
+
"@ichaingo/image": "1.4.54",
|
|
35
|
+
"@ichaingo/better-link": "1.4.54",
|
|
36
|
+
"@ichaingo/link": "1.4.54",
|
|
37
|
+
"@ichaingo/translation": "1.4.54",
|
|
38
|
+
"@ichaingo/i18n": "1.4.54",
|
|
39
|
+
"@ichaingo/providers": "1.4.54",
|
|
40
|
+
"@ichaingo/request": "1.4.54",
|
|
41
|
+
"@ichaingo/with-login": "1.4.54",
|
|
42
|
+
"@ichaingo/tooltip": "1.4.54",
|
|
43
|
+
"@ichaingo/theme-toggle": "1.4.54",
|
|
44
|
+
"@ichaingo/iconfont": "1.4.54",
|
|
45
|
+
"@ichaingo/ui": "1.4.54"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/js-cookie": "^3.0.6"
|