@arcblock/ux 3.0.8 → 3.0.10
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/Address/did-address.js +47 -49
- package/lib/Address/responsive-did-address.js +53 -57
- package/lib/Avatar/index.js +16 -16
- package/lib/BlockletV2/blocklet.js +64 -64
- package/lib/BlockletV2/components/tooltip-icon.js +26 -27
- package/lib/CardSelector/index.js +1 -2
- package/lib/ClickToCopy/hook.js +10 -11
- package/lib/ClickToCopy/index.js +16 -16
- package/lib/Config/theme-mode-toggle.js +7 -8
- package/lib/DID/index.js +131 -133
- package/lib/DIDConnect/app-info-item.js +18 -18
- package/lib/DIDConnect/auth-apps/index.js +83 -84
- package/lib/DIDConnect/did-connect-container.js +89 -90
- package/lib/DIDConnect/did-connect-footer.js +25 -25
- package/lib/DIDConnect/landing-page.js +17 -17
- package/lib/DIDConnect/powered-by.js +11 -11
- package/lib/DIDConnect/request-storage-access-api-dialog.js +36 -37
- package/lib/DIDConnect/with-container.js +66 -68
- package/lib/Dialog/use-confirm.js +40 -43
- package/lib/Earth/index.js +21 -22
- package/lib/Footer/index.js +15 -16
- package/lib/Header/responsive-header.js +23 -24
- package/lib/Layout/dashboard/index.js +63 -72
- package/lib/Layout/dashboard/sidebar.js +20 -21
- package/lib/Layout/dashboard-legacy/index.js +52 -52
- package/lib/Locale/context.js +36 -37
- package/lib/Locale/selector.js +40 -42
- package/lib/NFTDisplay/index.js +114 -118
- package/lib/NFTDisplay/render-svg.js +12 -12
- package/lib/NavMenu/nav-menu.js +159 -161
- package/lib/NavMenu/sub-container.js +25 -26
- package/lib/PageScroller/index.js +28 -32
- package/lib/Passport/passport.js +11 -11
- package/lib/PhoneInput/country-select.js +38 -38
- package/lib/PhoneInput/index.js +65 -66
- package/lib/Screenshot/index.js +26 -27
- package/lib/SessionBlocklet/index.js +87 -93
- package/lib/SessionPermission/index.js +5 -9
- package/lib/SessionUser/components/did-space.js +24 -25
- package/lib/SessionUser/components/logged-in.js +122 -127
- package/lib/SessionUser/components/quick-login-item.js +41 -42
- package/lib/SessionUser/components/session-user-item.js +35 -36
- package/lib/SessionUser/components/session-user-switch.js +81 -85
- package/lib/SessionUser/components/un-login.js +41 -41
- package/lib/SessionUser/components/user-info.js +43 -47
- package/lib/SessionUser/index.js +1 -1
- package/lib/SessionUser/libs/utils.js +24 -30
- package/lib/SharedBridge/index.js +35 -35
- package/lib/Theme/index.js +16 -16
- package/lib/Theme/theme.js +42 -43
- package/lib/Toast/index.js +24 -25
- package/lib/Typography/index.js +42 -42
- package/lib/UserCard/Content/basic.js +91 -93
- package/lib/UserCard/Content/shorten-label.js +9 -9
- package/lib/UserCard/components.js +15 -15
- package/lib/Util/deprecate.js +1 -1
- package/lib/Util/federated.js +28 -32
- package/lib/Util/iframe.js +9 -10
- package/lib/Util/index.js +134 -135
- package/lib/Util/security.js +9 -10
- package/lib/Util/wallet.js +6 -9
- package/lib/VerificationCode/index.js +26 -28
- package/lib/hooks/use-blocklet-logo.js +11 -14
- package/lib/ux.css +1 -1
- package/lib/withTracker/index.js +13 -14
- package/package.json +9 -10
package/lib/NavMenu/nav-menu.js
CHANGED
@@ -1,117 +1,115 @@
|
|
1
|
-
import { jsx as o, jsxs as
|
2
|
-
import { useRef as
|
3
|
-
import { useTheme as oe, ClickAwayListener as
|
4
|
-
import
|
5
|
-
import { Menu as ie, MoreHoriz as
|
6
|
-
import { useCreation as
|
7
|
-
import
|
8
|
-
import { NavMenuProvider as
|
9
|
-
import { NavMenuStyled as
|
10
|
-
import { SubContainer as
|
1
|
+
import { jsx as o, jsxs as x } from "react/jsx-runtime";
|
2
|
+
import { useRef as $, useLayoutEffect as ee, useEffect as P, Children as U, isValidElement as ne, cloneElement as te } from "react";
|
3
|
+
import { useTheme as oe, ClickAwayListener as re } from "@mui/material";
|
4
|
+
import E from "clsx";
|
5
|
+
import { Menu as ie, MoreHoriz as ae, ArrowForward as le, ExpandMore as se } from "@mui/icons-material";
|
6
|
+
import { useCreation as S, useReactive as ce, useMemoizedFn as z, useSize as ue, useThrottleFn as de } from "ahooks";
|
7
|
+
import me from "lodash/noop";
|
8
|
+
import { NavMenuProvider as fe, useNavMenuContext as V } from "./nav-menu-context.js";
|
9
|
+
import { NavMenuStyled as ve, NavMenuRoot as pe, NavMenuItem as he, NavMenuSub as Ce, NavMenuSubList as Ne } from "./style.js";
|
10
|
+
import { SubContainer as Ie } from "./sub-container.js";
|
11
11
|
import "../Theme/theme.js";
|
12
12
|
import "../Theme/theme-provider.js";
|
13
|
-
function
|
14
|
-
return
|
13
|
+
function B(i) {
|
14
|
+
return i ? U.toArray(i).filter((r) => ne(r) ? r.type === W || r.type === L : !1) : null;
|
15
15
|
}
|
16
|
-
function
|
17
|
-
return
|
16
|
+
function D(i) {
|
17
|
+
return $(i || `navmenu-item-id-${Math.random().toString(36).slice(2)}`).current;
|
18
18
|
}
|
19
|
-
function
|
20
|
-
items:
|
21
|
-
mode:
|
22
|
-
children:
|
23
|
-
activeId:
|
19
|
+
function G({
|
20
|
+
items: i = [],
|
21
|
+
mode: r = "horizontal",
|
22
|
+
children: p = null,
|
23
|
+
activeId: s = null,
|
24
24
|
// eslint-disable-next-line react/require-default-props
|
25
|
-
textColor:
|
25
|
+
textColor: _,
|
26
26
|
// eslint-disable-next-line react/require-default-props
|
27
|
-
activeTextColor:
|
27
|
+
activeTextColor: M,
|
28
28
|
// eslint-disable-next-line react/require-default-props
|
29
|
-
bgColor:
|
30
|
-
onSelected:
|
31
|
-
...
|
29
|
+
bgColor: b,
|
30
|
+
onSelected: u = void 0,
|
31
|
+
...d
|
32
32
|
}) {
|
33
|
-
|
34
|
-
|
35
|
-
if (!(n != null && n.length) && !(c != null && c.length))
|
33
|
+
const t = oe(), m = S(() => t.palette.text.secondary, [t]), y = S(() => t.palette.text.primary, [t]), c = S(() => t.palette.background.default, [t]), h = B(p);
|
34
|
+
if (!i?.length && !h?.length)
|
36
35
|
throw new Error("One of 'items' or 'children' is required by NavMenu component.");
|
37
|
-
const
|
38
|
-
activeId:
|
36
|
+
const n = ce({
|
37
|
+
activeId: s,
|
39
38
|
openedIds: [],
|
40
39
|
hiddenItemCount: 0
|
41
|
-
}),
|
42
|
-
|
43
|
-
}),
|
44
|
-
|
45
|
-
}),
|
46
|
-
|
47
|
-
}),
|
48
|
-
...
|
49
|
-
mode:
|
50
|
-
textColor:
|
51
|
-
activeTextColor:
|
52
|
-
bgColor:
|
53
|
-
activate:
|
54
|
-
open:
|
55
|
-
close:
|
40
|
+
}), C = z((e) => {
|
41
|
+
n.activeId = e, u?.(e);
|
42
|
+
}), N = z((e) => {
|
43
|
+
n.openedIds.push(e);
|
44
|
+
}), T = z((e) => {
|
45
|
+
n.openedIds = n.openedIds.filter((a) => a !== e);
|
46
|
+
}), R = S(() => ({
|
47
|
+
...n,
|
48
|
+
mode: r,
|
49
|
+
textColor: m,
|
50
|
+
activeTextColor: y,
|
51
|
+
bgColor: c,
|
52
|
+
activate: C,
|
53
|
+
open: N,
|
54
|
+
close: T
|
56
55
|
}), [
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
n.activeId,
|
57
|
+
n.hiddenItemCount,
|
58
|
+
n.openedIds,
|
59
|
+
r,
|
60
|
+
m,
|
61
|
+
y,
|
62
|
+
c,
|
63
|
+
C,
|
64
64
|
N,
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
p.current[h] = b;
|
65
|
+
T
|
66
|
+
]), g = $(null), f = $([]), w = $(null), j = $(0), A = n.hiddenItemCount === f.current?.length, J = A ? { marginLeft: "0px" } : void 0, K = S(() => A ? /* @__PURE__ */ o(ie, {}) : /* @__PURE__ */ o(ae, {}), [A]), Q = (e) => U.map(e, (a, v) => te(a, {
|
67
|
+
ref: (I) => {
|
68
|
+
f.current[v] = I;
|
70
69
|
}
|
71
|
-
})),
|
72
|
-
|
73
|
-
let e = 0,
|
74
|
-
const
|
75
|
-
|
76
|
-
if (
|
77
|
-
|
78
|
-
const
|
79
|
-
|
70
|
+
})), q = ue(g.current), { run: k } = de(
|
71
|
+
z(() => {
|
72
|
+
let e = 0, a = 0, v = !1;
|
73
|
+
const I = w.current ? w.current.offsetWidth + parseFloat(window.getComputedStyle(w.current).marginLeft) : 0;
|
74
|
+
f.current.forEach((l, H) => {
|
75
|
+
if (l) {
|
76
|
+
l.style.display = "flex";
|
77
|
+
const Z = H > 0 ? parseFloat(window.getComputedStyle(l).marginLeft) : 0, O = l.offsetWidth + Z;
|
78
|
+
j.current - I >= e + O && !v ? e += O : (l.style.display = "none", v = !0, a++);
|
80
79
|
}
|
81
|
-
}),
|
80
|
+
}), a !== n.hiddenItemCount && (n.hiddenItemCount = a);
|
82
81
|
}),
|
83
82
|
{ wait: 100 }
|
84
83
|
);
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
window.removeEventListener("resize", R);
|
84
|
+
ee(() => {
|
85
|
+
j.current = q?.width || g.current?.clientWidth || 0, r === "horizontal" && k();
|
86
|
+
}, [q?.width, r]), P(() => {
|
87
|
+
if (r === "horizontal")
|
88
|
+
return k(), window.addEventListener("resize", k), () => {
|
89
|
+
window.removeEventListener("resize", k);
|
92
90
|
};
|
93
|
-
}, [
|
94
|
-
|
95
|
-
}, [
|
96
|
-
const
|
97
|
-
const
|
98
|
-
return e
|
99
|
-
|
91
|
+
}, [r, i]), P(() => {
|
92
|
+
s != null && (n.activeId = s);
|
93
|
+
}, [s]);
|
94
|
+
const X = E("navmenu", `navmenu--${r}`, d.className), F = (e, a, v = 0) => {
|
95
|
+
const I = v === 0;
|
96
|
+
return e?.children ? v > 0 ? null : /* @__PURE__ */ o(
|
97
|
+
L,
|
100
98
|
{
|
101
99
|
id: e.id,
|
102
100
|
icon: e.icon,
|
103
101
|
label: e.label,
|
104
|
-
variant:
|
105
|
-
ref:
|
106
|
-
|
102
|
+
variant: I ? "default" : "panel",
|
103
|
+
ref: I ? (l) => {
|
104
|
+
f.current[a] = l;
|
107
105
|
} : void 0,
|
108
106
|
children: typeof e.children == "function" ? e.children : e.children.map(
|
109
|
-
(
|
107
|
+
(l, H) => F({ ...l, variant: "panel" }, H, v + 1)
|
110
108
|
)
|
111
109
|
},
|
112
110
|
e.id
|
113
111
|
) : /* @__PURE__ */ o(
|
114
|
-
|
112
|
+
W,
|
115
113
|
{
|
116
114
|
id: e.id,
|
117
115
|
icon: e.icon,
|
@@ -119,118 +117,118 @@ function J({
|
|
119
117
|
description: e.description,
|
120
118
|
active: e.active,
|
121
119
|
variant: e.variant,
|
122
|
-
ref:
|
123
|
-
|
120
|
+
ref: I ? (l) => {
|
121
|
+
f.current[a] = l;
|
124
122
|
} : void 0
|
125
123
|
},
|
126
124
|
e.id
|
127
125
|
);
|
128
|
-
},
|
129
|
-
return /* @__PURE__ */ o(
|
130
|
-
|
131
|
-
|
126
|
+
}, Y = i ? i?.slice(-n.hiddenItemCount).map((e, a) => F(e, a, 1)) : h?.slice(-n.hiddenItemCount);
|
127
|
+
return /* @__PURE__ */ o(fe, { value: R, children: /* @__PURE__ */ o(ve, { ...d, className: X, $textColor: m, $bgColor: c, children: /* @__PURE__ */ x(pe, { className: E("navmenu-root", `navmenu-root--${r}`), ref: g, children: [
|
128
|
+
i ? i.map((e, a) => F(e, a)) : Q(h || []),
|
129
|
+
n.hiddenItemCount > 0 && /* @__PURE__ */ o(L, { expandIcon: !1, icon: K, label: "", ref: w, style: J, children: Y })
|
132
130
|
] }) }) });
|
133
131
|
}
|
134
|
-
function
|
135
|
-
ref:
|
136
|
-
id:
|
137
|
-
icon:
|
138
|
-
label:
|
139
|
-
description:
|
140
|
-
active:
|
141
|
-
variant:
|
142
|
-
onClick:
|
143
|
-
...
|
132
|
+
function W({
|
133
|
+
ref: i = void 0,
|
134
|
+
id: r = "",
|
135
|
+
icon: p = null,
|
136
|
+
label: s = "",
|
137
|
+
description: _ = void 0,
|
138
|
+
active: M = !1,
|
139
|
+
variant: b = "default",
|
140
|
+
onClick: u = me,
|
141
|
+
...d
|
144
142
|
}) {
|
145
|
-
const
|
143
|
+
const t = D(r), { mode: m, activeId: y, activate: c, activeTextColor: h } = V(), n = E(
|
146
144
|
"navmenu-item",
|
147
|
-
{ "navmenu-item--active":
|
148
|
-
`navmenu-item--${
|
149
|
-
`navmenu-item--${
|
150
|
-
|
145
|
+
{ "navmenu-item--active": y === t },
|
146
|
+
`navmenu-item--${m}`,
|
147
|
+
`navmenu-item--${b}`,
|
148
|
+
d.className
|
151
149
|
);
|
152
|
-
return
|
153
|
-
|
154
|
-
}, [
|
155
|
-
/* @__PURE__ */
|
156
|
-
|
150
|
+
return P(() => {
|
151
|
+
M && c?.(t);
|
152
|
+
}, [M]), // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
153
|
+
/* @__PURE__ */ x(
|
154
|
+
he,
|
157
155
|
{
|
158
|
-
...
|
159
|
-
className:
|
160
|
-
ref:
|
161
|
-
$activeTextColor:
|
156
|
+
...d,
|
157
|
+
className: n,
|
158
|
+
ref: i,
|
159
|
+
$activeTextColor: h,
|
162
160
|
onClick: () => {
|
163
|
-
|
161
|
+
u?.(), c?.(t);
|
164
162
|
},
|
165
163
|
children: [
|
166
|
-
|
167
|
-
/* @__PURE__ */
|
168
|
-
/* @__PURE__ */
|
169
|
-
|
164
|
+
p && /* @__PURE__ */ o("span", { className: "navmenu-item__icon", children: p }),
|
165
|
+
/* @__PURE__ */ x("div", { className: "navmenu-item__content", children: [
|
166
|
+
/* @__PURE__ */ x("span", { className: "navmenu-item__label", children: [
|
167
|
+
s,
|
170
168
|
" ",
|
171
|
-
/* @__PURE__ */ o(
|
169
|
+
/* @__PURE__ */ o(le, { className: "navmenu-item__label-arrow" })
|
172
170
|
] }),
|
173
|
-
|
171
|
+
_ && /* @__PURE__ */ o("span", { className: "navmenu-item__desc", children: _ })
|
174
172
|
] })
|
175
173
|
]
|
176
174
|
}
|
177
175
|
);
|
178
176
|
}
|
179
|
-
|
180
|
-
function
|
181
|
-
ref:
|
182
|
-
id:
|
183
|
-
icon:
|
184
|
-
label:
|
185
|
-
description:
|
186
|
-
variant:
|
187
|
-
children:
|
188
|
-
expandIcon:
|
189
|
-
|
177
|
+
W.displayName = "NavMenu.Item";
|
178
|
+
function L({
|
179
|
+
ref: i = void 0,
|
180
|
+
id: r = "",
|
181
|
+
icon: p = null,
|
182
|
+
label: s = null,
|
183
|
+
description: _,
|
184
|
+
variant: M = "default",
|
185
|
+
children: b = void 0,
|
186
|
+
expandIcon: u = ({ isOpen: t }) => /* @__PURE__ */ o(
|
187
|
+
se,
|
190
188
|
{
|
191
189
|
style: {
|
192
|
-
transform: `rotate(${
|
190
|
+
transform: `rotate(${t ? 180 : 0}deg)`
|
193
191
|
}
|
194
192
|
}
|
195
193
|
),
|
196
|
-
...
|
194
|
+
...d
|
197
195
|
}) {
|
198
|
-
const
|
196
|
+
const t = D(r), { openedIds: m, open: y, close: c, mode: h, activeTextColor: n } = V(), C = m?.includes(t) ?? !1, N = h === "inline", T = E(
|
199
197
|
"navmenu-sub",
|
200
198
|
"navmenu-item",
|
201
|
-
{ "navmenu-item--panel":
|
202
|
-
{ "navmenu-sub--opened":
|
203
|
-
|
204
|
-
),
|
199
|
+
{ "navmenu-item--panel": M === "panel" },
|
200
|
+
{ "navmenu-sub--opened": C, "navmenu-item--inline": N },
|
201
|
+
d.className
|
202
|
+
), R = {
|
205
203
|
onClick: () => {
|
206
|
-
|
204
|
+
m?.includes(t) ? c?.(t) : y?.(t);
|
207
205
|
}
|
208
|
-
},
|
209
|
-
|
206
|
+
}, g = N ? { onClick: (w) => w.stopPropagation() } : {}, f = /* @__PURE__ */ x(
|
207
|
+
Ce,
|
210
208
|
{
|
211
|
-
...
|
212
|
-
className:
|
213
|
-
...
|
214
|
-
ref:
|
215
|
-
$activeTextColor:
|
209
|
+
...d,
|
210
|
+
className: T,
|
211
|
+
...R,
|
212
|
+
ref: i,
|
213
|
+
$activeTextColor: n,
|
216
214
|
children: [
|
217
|
-
|
218
|
-
/* @__PURE__ */
|
219
|
-
/* @__PURE__ */ o("span", { className: "navmenu-item__label", children:
|
220
|
-
|
215
|
+
p && /* @__PURE__ */ o("span", { className: "navmenu-item__icon", children: p }),
|
216
|
+
/* @__PURE__ */ x("div", { className: "navmenu-item__content", children: [
|
217
|
+
/* @__PURE__ */ o("span", { className: "navmenu-item__label", children: s }),
|
218
|
+
_ && /* @__PURE__ */ o("span", { className: "navmenu-item__desc", children: _ })
|
221
219
|
] }),
|
222
|
-
|
223
|
-
/* @__PURE__ */ o(
|
220
|
+
u && /* @__PURE__ */ o("span", { className: "navmenu-sub__expand-icon", children: typeof u == "function" ? u({ isOpen: C }) : u }),
|
221
|
+
/* @__PURE__ */ o(Ie, { inline: N, ...g, children: typeof b == "function" ? b({ isOpen: C }) : /* @__PURE__ */ o(Ne, { className: "navmenu-sub__list", children: B(b) }) })
|
224
222
|
]
|
225
223
|
}
|
226
224
|
);
|
227
|
-
return
|
225
|
+
return N ? f : /* @__PURE__ */ o(re, { onClickAway: () => c?.(t), children: f });
|
228
226
|
}
|
229
|
-
|
230
|
-
|
231
|
-
|
227
|
+
L.displayName = "NavMenu.Sub";
|
228
|
+
G.Item = W;
|
229
|
+
G.Sub = L;
|
232
230
|
export {
|
233
|
-
|
234
|
-
|
235
|
-
|
231
|
+
W as Item,
|
232
|
+
L as Sub,
|
233
|
+
G as default
|
236
234
|
};
|
@@ -1,21 +1,21 @@
|
|
1
1
|
import { jsx as h } from "react/jsx-runtime";
|
2
2
|
import { useThrottleFn as x } from "ahooks";
|
3
|
-
import { useRef as b, useState as
|
3
|
+
import { useRef as b, useState as v, useEffect as a } from "react";
|
4
4
|
const z = 8;
|
5
|
-
function
|
6
|
-
const
|
5
|
+
function C({ children: m, inline: i = !1, ...R }) {
|
6
|
+
const n = b(null), s = b(null), [c, l] = v(!1), [g, f] = v(0), { run: d } = x(
|
7
7
|
() => {
|
8
|
-
if (
|
9
|
-
f(0),
|
8
|
+
if (i) {
|
9
|
+
f(0), c || l(!0);
|
10
10
|
return;
|
11
11
|
}
|
12
|
-
if (!
|
13
|
-
const e =
|
12
|
+
if (!n.current || !s.current) return;
|
13
|
+
const e = n.current.parentElement;
|
14
14
|
if (!e) return;
|
15
|
-
const t = e.getBoundingClientRect(),
|
16
|
-
let r = (t.width -
|
17
|
-
const
|
18
|
-
|
15
|
+
const t = e.getBoundingClientRect(), u = s.current.getBoundingClientRect(), p = window.innerWidth, w = 32;
|
16
|
+
let r = (t.width - u.width) / 2;
|
17
|
+
const o = t.left + r;
|
18
|
+
o < 0 ? r = r - o + w : o + u.width > p && (r -= o + u.width - p + w), f(r), c || l(!0);
|
19
19
|
},
|
20
20
|
{
|
21
21
|
wait: 100
|
@@ -23,48 +23,47 @@ function L({ children: v, inline: s = !1, ...R }) {
|
|
23
23
|
);
|
24
24
|
return a(() => {
|
25
25
|
const e = new ResizeObserver(() => {
|
26
|
-
|
26
|
+
d();
|
27
27
|
});
|
28
|
-
return e.observe(
|
28
|
+
return e.observe(n.current), () => e.disconnect();
|
29
29
|
}, []), a(() => {
|
30
|
-
|
31
|
-
const e = (n = o.current) == null ? void 0 : n.parentElement;
|
30
|
+
const e = n.current?.parentElement;
|
32
31
|
let t = null;
|
33
32
|
return e && (t = new ResizeObserver(() => {
|
34
|
-
|
35
|
-
}), t.observe(e)), () => t
|
33
|
+
d();
|
34
|
+
}), t.observe(e)), () => t?.disconnect();
|
36
35
|
}, []), a(() => {
|
37
36
|
const e = () => {
|
38
|
-
|
37
|
+
d();
|
39
38
|
};
|
40
39
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
41
40
|
}, []), /* @__PURE__ */ h(
|
42
41
|
"div",
|
43
42
|
{
|
44
|
-
ref:
|
43
|
+
ref: n,
|
45
44
|
className: "navmenu-sub__container",
|
46
45
|
style: {
|
47
46
|
width: "100%",
|
48
47
|
paddingTop: `${z}px`,
|
49
48
|
transform: `translateX(${g}px)`,
|
50
|
-
overflow:
|
49
|
+
overflow: c ? "visible" : "hidden"
|
51
50
|
},
|
52
51
|
...R,
|
53
52
|
children: /* @__PURE__ */ h(
|
54
53
|
"div",
|
55
54
|
{
|
56
55
|
style: {
|
57
|
-
display:
|
58
|
-
boxShadow:
|
56
|
+
display: i ? "block" : "inline-block",
|
57
|
+
boxShadow: i ? "none" : "0px 40px 60px rgba(0, 0, 0, 0.08)"
|
59
58
|
},
|
60
|
-
ref:
|
61
|
-
children:
|
59
|
+
ref: s,
|
60
|
+
children: m
|
62
61
|
}
|
63
62
|
)
|
64
63
|
}
|
65
64
|
);
|
66
65
|
}
|
67
66
|
export {
|
68
|
-
|
69
|
-
|
67
|
+
C as SubContainer,
|
68
|
+
C as default
|
70
69
|
};
|
@@ -1,37 +1,37 @@
|
|
1
1
|
import { jsx as W } from "react/jsx-runtime";
|
2
|
-
import { useState as
|
2
|
+
import { useState as S, useRef as J, Children as U, useCallback as l, cloneElement as Q, useEffect as p } from "react";
|
3
3
|
import A from "lodash/isEqual";
|
4
4
|
import r from "lodash/isNil";
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import { withDeprecated as
|
5
|
+
import Z from "lodash/isNull";
|
6
|
+
import g from "./usePrevValue.js";
|
7
|
+
import { withDeprecated as P } from "../Util/deprecate.js";
|
8
8
|
const I = {
|
9
9
|
TOUCHMOVE: "touchmove",
|
10
10
|
KEYDOWN: "keydown"
|
11
|
-
},
|
11
|
+
}, b = 500, ee = "ease-in-out", te = "100vh", ne = "100vw", K = 0, k = 0, D = 100, se = 38, oe = 40, y = "rps-scroll--disabled";
|
12
12
|
let M = null, d = !1, a = !1, w = !0, Y = !1;
|
13
13
|
const T = [];
|
14
|
-
function
|
15
|
-
animationTimer: f =
|
14
|
+
function re({
|
15
|
+
animationTimer: f = b,
|
16
16
|
blockScrollDown: F = !1,
|
17
17
|
blockScrollUp: H = !1,
|
18
|
-
children:
|
19
|
-
height:
|
20
|
-
width:
|
18
|
+
children: B = void 0,
|
19
|
+
height: V = te,
|
20
|
+
width: G = ne,
|
21
21
|
customPageNumber: s = void 0,
|
22
22
|
onScrollUnavailable: E = void 0,
|
23
23
|
onChange: R = void 0,
|
24
24
|
renderAllPagesOnFirstRender: $ = !1,
|
25
|
-
transitionTimingFunction:
|
25
|
+
transitionTimingFunction: j = ee
|
26
26
|
}) {
|
27
|
-
const [n, v] =
|
27
|
+
const [n, v] = S(K), [c, C] = S(k), m = g(n), i = J(null), o = U.toArray(B), L = l(
|
28
28
|
(e) => {
|
29
29
|
let t = 0;
|
30
30
|
r(e) || (t = e), t = Math.max(t, c), t <= n + 1 && (r(o[n + 1]) || t++), C(t);
|
31
31
|
},
|
32
32
|
[o, n, c]
|
33
|
-
),
|
34
|
-
$ ? C(
|
33
|
+
), q = l(() => {
|
34
|
+
$ ? C(U.count(o)) : r(o[K + 1]) || L(k + 1);
|
35
35
|
}, [L, o, $]), O = l(() => {
|
36
36
|
w && (w = !1, window.scrollTo({
|
37
37
|
left: 0,
|
@@ -40,12 +40,12 @@ function ie({
|
|
40
40
|
}), document.body.classList.add(y), document.documentElement.classList.add(y));
|
41
41
|
}, []), _ = l(() => {
|
42
42
|
w || (w = !0, document.body.classList.remove(y), document.documentElement.classList.remove(y));
|
43
|
-
}, []),
|
43
|
+
}, []), X = l(() => {
|
44
44
|
const e = [];
|
45
45
|
let t = 0;
|
46
46
|
for (; t < c && !r(o[t]); )
|
47
47
|
T[t] = !0, e.push(
|
48
|
-
/* @__PURE__ */ W("div", { style: { height: "100%", width: "100%" }, children:
|
48
|
+
/* @__PURE__ */ W("div", { style: { height: "100%", width: "100%" }, children: Q(o[t], { ...o[t].props }) }, t)
|
49
49
|
), t++;
|
50
50
|
return e;
|
51
51
|
}, [o, c]), h = l(() => {
|
@@ -58,27 +58,23 @@ function ie({
|
|
58
58
|
}, f + D)));
|
59
59
|
}, [f, H, n, O, _, E]), N = l(
|
60
60
|
(e) => {
|
61
|
-
|
61
|
+
Z(M) ? M = e.touches[0].clientY : e.touches[0].clientY > M ? u() : h();
|
62
62
|
},
|
63
63
|
[h, u]
|
64
|
-
),
|
64
|
+
), z = l(
|
65
65
|
(e) => {
|
66
66
|
e.deltaY < 0 ? u() : h();
|
67
67
|
},
|
68
68
|
[h, u]
|
69
69
|
), x = l(
|
70
70
|
(e) => {
|
71
|
-
A(e.keyCode,
|
71
|
+
A(e.keyCode, se) && u(), A(e.keyCode, oe) && h();
|
72
72
|
},
|
73
73
|
[h, u]
|
74
74
|
);
|
75
|
-
return p(() => {
|
76
|
-
|
77
|
-
|
78
|
-
var S;
|
79
|
-
(S = i.current) != null && S.removeEventListener && (i.current.removeEventListener(I.TOUCHMOVE, N), i.current.removeEventListener(I.KEYDOWN, x));
|
80
|
-
};
|
81
|
-
}, [N, x]), p(() => (a = !0, X(), () => {
|
75
|
+
return p(() => (i.current?.addEventListener(I.TOUCHMOVE, N), i.current?.addEventListener(I.KEYDOWN, x), () => {
|
76
|
+
i.current?.removeEventListener && (i.current.removeEventListener(I.TOUCHMOVE, N), i.current.removeEventListener(I.KEYDOWN, x));
|
77
|
+
}), [N, x]), p(() => (a = !0, q(), () => {
|
82
78
|
a = !1;
|
83
79
|
}), []), p(() => {
|
84
80
|
d = !1, M = null, m !== void 0 && n > m && L();
|
@@ -103,23 +99,23 @@ function ie({
|
|
103
99
|
Y && (Y = !1, i.current.style.transform = `translate3d(0, ${s * -100}%, 0)`, setTimeout(() => {
|
104
100
|
v(s);
|
105
101
|
}, f + D));
|
106
|
-
}, [f, c, s]), /* @__PURE__ */ W("div", { style: { height:
|
102
|
+
}, [f, c, s]), /* @__PURE__ */ W("div", { style: { height: V, width: G, overflow: "hidden" }, children: /* @__PURE__ */ W(
|
107
103
|
"div",
|
108
104
|
{
|
109
105
|
ref: i,
|
110
|
-
onWheel:
|
106
|
+
onWheel: z,
|
111
107
|
style: {
|
112
108
|
height: "100%",
|
113
109
|
width: "100%",
|
114
|
-
transition: `transform ${f}ms ${
|
110
|
+
transition: `transform ${f}ms ${j}`,
|
115
111
|
outline: "none"
|
116
112
|
},
|
117
113
|
tabIndex: 0,
|
118
|
-
children:
|
114
|
+
children: X()
|
119
115
|
}
|
120
116
|
) });
|
121
117
|
}
|
122
|
-
const
|
118
|
+
const ue = P(re, { name: "PageScroller" });
|
123
119
|
export {
|
124
|
-
|
120
|
+
ue as default
|
125
121
|
};
|