@solostylist/ui-kit 1.0.151 → 1.0.152
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/ArrowUpward-DvTpkKgd.js +8 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +8 -6
- package/dist/hooks/use-is-passed-position.d.ts +1 -0
- package/dist/hooks/use-is-passed-position.js +21 -0
- package/dist/main.js +25 -23
- package/dist/s-chat-input/s-chat-input.js +36 -37
- package/dist/s-scroll-to-top/index.d.ts +2 -0
- package/dist/s-scroll-to-top/index.js +4 -0
- package/dist/s-scroll-to-top/package.json +5 -0
- package/dist/s-scroll-to-top/s-scroll-to-top.d.ts +27 -0
- package/dist/s-scroll-to-top/s-scroll-to-top.js +50 -0
- package/package.json +1 -1
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { useDialog as
|
|
2
|
-
import { usePopover as
|
|
1
|
+
import { useDialog as s } from "./use-dialog.js";
|
|
2
|
+
import { usePopover as i } from "./use-popover.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { useScrollAnimation as
|
|
4
|
+
import { useScrollAnimation as p } from "./use-scroll-animation.js";
|
|
5
|
+
import { useIsPassedPosition as u } from "./use-is-passed-position.js";
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
s as useDialog,
|
|
8
|
+
u as useIsPassedPosition,
|
|
9
|
+
i as usePopover,
|
|
10
|
+
p as useScrollAnimation
|
|
9
11
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsPassedPosition(el: React.RefObject<HTMLElement> | string | Window, positionY: number): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useState as f, useEffect as d } from "react";
|
|
2
|
+
function a(s, r) {
|
|
3
|
+
const [c, l] = f(!1);
|
|
4
|
+
return d(() => {
|
|
5
|
+
let e = null;
|
|
6
|
+
if (typeof s == "string" ? e = document.getElementById(s) ?? null : s instanceof Window ? e = s : s != null && s.current && (e = s.current), !e || !("addEventListener" in e)) return;
|
|
7
|
+
const n = () => {
|
|
8
|
+
let t = 0;
|
|
9
|
+
e instanceof Window ? t = e.scrollY : e instanceof HTMLElement && (t = e.scrollTop), l((o) => {
|
|
10
|
+
const i = t > r;
|
|
11
|
+
return o !== i ? i : o;
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
return n(), e.addEventListener("scroll", n), () => {
|
|
15
|
+
e == null || e.removeEventListener("scroll", n);
|
|
16
|
+
};
|
|
17
|
+
}, [s, r]), c;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
a as useIsPassedPosition
|
|
21
|
+
};
|
package/dist/main.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { default as t } from "./s-accordion/s-accordion.js";
|
|
2
2
|
import { default as l } from "./s-action-overlay/s-action-overlay.js";
|
|
3
|
-
import { default as
|
|
3
|
+
import { default as m } from "./s-autocomplete/s-autocomplete.js";
|
|
4
4
|
import { default as u } from "./s-avatar/s-avatar.js";
|
|
5
5
|
import { default as d } from "./s-button/s-button.js";
|
|
6
6
|
import { default as i } from "./s-button-link/s-button-link.js";
|
|
7
7
|
import { default as g } from "./s-carousel/s-carousel.js";
|
|
8
8
|
import { default as T } from "./s-chat-input/s-chat-input.js";
|
|
9
|
-
import { default as
|
|
9
|
+
import { default as P } from "./s-chat-message/s-chat-message.js";
|
|
10
10
|
import { default as b } from "./s-comment-message/s-comment-message.js";
|
|
11
11
|
import { default as D } from "./s-text-editor/s-text-editor.js";
|
|
12
12
|
import "./s-text-editor/s-text-editor-toolbar.js";
|
|
@@ -26,13 +26,13 @@ import { default as ee } from "./s-file-dropzone/s-file-dropzone.js";
|
|
|
26
26
|
import { default as re } from "./s-file-icon/s-file-icon.js";
|
|
27
27
|
import { default as te } from "./s-i18n-provider/s-i18n-provider.js";
|
|
28
28
|
import { default as le } from "./s-icon-button/s-icon-button.js";
|
|
29
|
-
import { default as
|
|
29
|
+
import { default as me } from "./s-label/s-label.js";
|
|
30
30
|
import { default as ue } from "./s-multi-select/s-multi-select.js";
|
|
31
31
|
import { default as de } from "./s-no-ssr/s-no-ssr.js";
|
|
32
32
|
import { default as ie } from "./s-overlay-scrollbar/s-overlay-scrollbar.js";
|
|
33
33
|
import { default as ge } from "./s-text-field/s-text-field.js";
|
|
34
34
|
import { default as Te } from "./s-pagination/s-pagination.js";
|
|
35
|
-
import { default as
|
|
35
|
+
import { default as Pe } from "./s-select/s-select.js";
|
|
36
36
|
import { default as be } from "./s-skeleton/s-skeleton.js";
|
|
37
37
|
import { default as De } from "./s-tip/s-tip.js";
|
|
38
38
|
import { default as Me } from "./s-text-truncation/s-text-truncation.js";
|
|
@@ -50,13 +50,13 @@ import { default as $e } from "./s-gradient-icon/s-gradient-icon.js";
|
|
|
50
50
|
import { default as oo } from "./s-glow-button/s-glow-button.js";
|
|
51
51
|
import { default as ao } from "./s-moving-border/s-moving-border.js";
|
|
52
52
|
import { default as fo } from "./s-scroll-reveal/s-scroll-reveal.js";
|
|
53
|
-
import { default as
|
|
53
|
+
import { default as so } from "./s-spotlight-cursor/s-spotlight-cursor.js";
|
|
54
54
|
import { default as po } from "./s-copyable-text/s-copyable-text.js";
|
|
55
55
|
import { MediaItem as So, default as xo } from "./s-gallery/s-gallery.js";
|
|
56
56
|
import { default as no } from "./s-image-modal/s-image-modal.js";
|
|
57
57
|
import { default as co } from "./s-lazy-image/s-lazy-image.js";
|
|
58
58
|
import { default as Co } from "./s-image-comparison/s-image-comparison.js";
|
|
59
|
-
import { default as
|
|
59
|
+
import { default as vo } from "./s-item-not-found/s-item-not-found.js";
|
|
60
60
|
import { default as yo } from "./s-category-card/s-category-card.js";
|
|
61
61
|
import { default as Lo } from "./s-radial-pulse-animate/s-radial-pulse-animate.js";
|
|
62
62
|
import { default as ho } from "./s-rating/s-rating.js";
|
|
@@ -71,26 +71,27 @@ import { useDialog as Jo } from "./hooks/use-dialog.js";
|
|
|
71
71
|
import { usePopover as Uo } from "./hooks/use-popover.js";
|
|
72
72
|
import "react";
|
|
73
73
|
import { useScrollAnimation as Xo } from "./hooks/use-scroll-animation.js";
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
74
|
+
import { useIsPassedPosition as Zo } from "./hooks/use-is-passed-position.js";
|
|
75
|
+
import { formatDatePosted as $o } from "./utils/dayjs.js";
|
|
76
|
+
import { bytesToSize as or } from "./utils/bytes-to-size.js";
|
|
77
|
+
import { LogLevel as ar, Logger as tr, createLogger as fr, logger as lr } from "./utils/logger.js";
|
|
78
|
+
import { default as mr } from "dayjs";
|
|
78
79
|
export {
|
|
79
80
|
E as DialogConfirmProvider,
|
|
80
81
|
N as DialogMessageProvider,
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
ar as LogLevel,
|
|
83
|
+
tr as Logger,
|
|
83
84
|
So as MediaItem,
|
|
84
85
|
t as SAccordion,
|
|
85
86
|
l as SActionOverlay,
|
|
86
|
-
|
|
87
|
+
m as SAutocomplete,
|
|
87
88
|
u as SAvatar,
|
|
88
89
|
d as SButton,
|
|
89
90
|
i as SButtonLink,
|
|
90
91
|
g as SCarousel,
|
|
91
92
|
yo as SCategoryCard,
|
|
92
93
|
T as SChatInput,
|
|
93
|
-
|
|
94
|
+
P as SChatMessage,
|
|
94
95
|
M as SCheckbox,
|
|
95
96
|
I as SChip,
|
|
96
97
|
F as SChips,
|
|
@@ -117,8 +118,8 @@ export {
|
|
|
117
118
|
le as SIconButton,
|
|
118
119
|
Co as SImageComparison,
|
|
119
120
|
no as SImageModal,
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
vo as SItemNotFound,
|
|
122
|
+
me as SLabel,
|
|
122
123
|
Ko as SLanguagePopover,
|
|
123
124
|
Vo as SLanguageSwitcher,
|
|
124
125
|
co as SLazyImage,
|
|
@@ -132,11 +133,11 @@ export {
|
|
|
132
133
|
ho as SRating,
|
|
133
134
|
ko as SReview,
|
|
134
135
|
fo as SScrollReveal,
|
|
135
|
-
|
|
136
|
+
Pe as SSelect,
|
|
136
137
|
be as SSkeleton,
|
|
137
138
|
Ee as SSmartTextField,
|
|
138
139
|
Ie as SSnackbarMessage,
|
|
139
|
-
|
|
140
|
+
so as SSpotlightCursor,
|
|
140
141
|
Ne as SStripeCVC,
|
|
141
142
|
Oe as SStripeExpiry,
|
|
142
143
|
je as SStripeNumber,
|
|
@@ -154,15 +155,16 @@ export {
|
|
|
154
155
|
Oo as STypewriterText,
|
|
155
156
|
ke as SnackbarMessageProvider,
|
|
156
157
|
Ke as StripeTextField,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
or as bytesToSize,
|
|
159
|
+
fr as createLogger,
|
|
160
|
+
mr as dayjs,
|
|
160
161
|
qo as defaultLanguageOptions,
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
$o as formatDatePosted,
|
|
163
|
+
lr as logger,
|
|
163
164
|
Jo as useDialog,
|
|
164
165
|
R as useDialogConfirm,
|
|
165
166
|
j as useDialogMessage,
|
|
167
|
+
Zo as useIsPassedPosition,
|
|
166
168
|
Uo as usePopover,
|
|
167
169
|
Xo as useScrollAnimation,
|
|
168
170
|
Fe as useSnackbarMessage
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { j as r } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Box as s, outlinedInputClasses as D, Typography as
|
|
2
|
+
import { forwardRef as K, useState as c, useRef as T, useId as V, useEffect as B } from "react";
|
|
3
|
+
import { Box as s, outlinedInputClasses as D, Typography as I, Popper as W, ClickAwayListener as H } from "@mui/material";
|
|
4
4
|
import _ from "emoji-picker-react";
|
|
5
5
|
import q from "../s-file-icon/s-file-icon.js";
|
|
6
6
|
import d from "../s-icon-button/s-icon-button.js";
|
|
7
7
|
import G from "../s-text-field/s-text-field.js";
|
|
8
8
|
import { C as J } from "../Close-D4kX7Vbc.js";
|
|
9
|
-
import { c as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}), "ArrowUpward"), Q = v(/* @__PURE__ */ r.jsx("path", {
|
|
9
|
+
import { c as E } from "../createSvgIcon-Dq42_0tn.js";
|
|
10
|
+
import { A as N } from "../ArrowUpward-DvTpkKgd.js";
|
|
11
|
+
const Q = E(/* @__PURE__ */ r.jsx("path", {
|
|
13
12
|
d: "M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6z"
|
|
14
|
-
}), "AttachFile"), X =
|
|
13
|
+
}), "AttachFile"), X = E(/* @__PURE__ */ r.jsx("path", {
|
|
15
14
|
d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M8.5 8c.83 0 1.5.67 1.5 1.5S9.33 11 8.5 11 7 10.33 7 9.5 7.67 8 8.5 8M12 18c-2.28 0-4.22-1.66-5-4h10c-.78 2.34-2.72 4-5 4m3.5-7c-.83 0-1.5-.67-1.5-1.5S14.67 8 15.5 8s1.5.67 1.5 1.5-.67 1.5-1.5 1.5"
|
|
16
|
-
}), "EmojiEmotions"),
|
|
17
|
-
({ onSubmit: p, onFileSelect: m, disabled: a, acceptedFileTypes: M, maxFileSize:
|
|
18
|
-
const [u, h] = c(""), [l, x] = c([]), [i, f] = c(/* @__PURE__ */ new Map()), [
|
|
15
|
+
}), "EmojiEmotions"), le = K(
|
|
16
|
+
({ onSubmit: p, onFileSelect: m, disabled: a, acceptedFileTypes: M, maxFileSize: v, ...z }, U) => {
|
|
17
|
+
const [u, h] = c(""), [l, x] = c([]), [i, f] = c(/* @__PURE__ */ new Map()), [k, g] = c(!1), C = T(null), y = V(), b = (e) => e.type.startsWith("image/"), $ = (e) => {
|
|
19
18
|
const o = `${e.name}-${e.size}-${e.lastModified}`;
|
|
20
19
|
if (i.has(o))
|
|
21
20
|
return i.get(o);
|
|
@@ -24,29 +23,29 @@ const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
|
24
23
|
return f((t) => new Map(t).set(o, n)), n;
|
|
25
24
|
}
|
|
26
25
|
return "";
|
|
27
|
-
}, $ = (e) => {
|
|
28
|
-
h(e.target.value);
|
|
29
26
|
}, P = (e) => {
|
|
27
|
+
h(e.target.value);
|
|
28
|
+
}, L = (e) => {
|
|
30
29
|
h((o) => o + e.emoji), g(!1);
|
|
31
|
-
},
|
|
32
|
-
g(!
|
|
33
|
-
},
|
|
30
|
+
}, A = () => {
|
|
31
|
+
g(!k);
|
|
32
|
+
}, w = () => {
|
|
34
33
|
a || u.trim().length === 0 && l.length === 0 || (p == null || p(u, l), h(""), i.forEach((e) => URL.revokeObjectURL(e)), f(/* @__PURE__ */ new Map()), x([]));
|
|
35
|
-
}, A = (e) => {
|
|
36
|
-
const n = Array.from(e.target.files || []).filter((t) => !(k && t.size > k));
|
|
37
|
-
x((t) => [...t, ...n]), m == null || m(n), e.target.value = "";
|
|
38
34
|
}, F = (e) => {
|
|
35
|
+
const n = Array.from(e.target.files || []).filter((t) => !(v && t.size > v));
|
|
36
|
+
x((t) => [...t, ...n]), m == null || m(n), e.target.value = "";
|
|
37
|
+
}, O = (e) => {
|
|
39
38
|
const o = l[e];
|
|
40
39
|
if (o && b(o)) {
|
|
41
40
|
const n = `${o.name}-${o.size}-${o.lastModified}`, t = i.get(n);
|
|
42
41
|
t && (URL.revokeObjectURL(t), f((j) => {
|
|
43
|
-
const
|
|
44
|
-
return
|
|
42
|
+
const R = new Map(j);
|
|
43
|
+
return R.delete(n), R;
|
|
45
44
|
}));
|
|
46
45
|
}
|
|
47
46
|
x((n) => n.filter((t, j) => j !== e));
|
|
48
|
-
},
|
|
49
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(),
|
|
47
|
+
}, S = (e) => {
|
|
48
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), w());
|
|
50
49
|
};
|
|
51
50
|
return B(() => () => {
|
|
52
51
|
i.forEach((e) => URL.revokeObjectURL(e));
|
|
@@ -57,8 +56,8 @@ const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
|
57
56
|
placeholder: "Enter your message here...",
|
|
58
57
|
disabled: a,
|
|
59
58
|
value: u,
|
|
60
|
-
onChange:
|
|
61
|
-
onKeyDown:
|
|
59
|
+
onChange: P,
|
|
60
|
+
onKeyDown: S,
|
|
62
61
|
multiline: !0,
|
|
63
62
|
minRows: 1,
|
|
64
63
|
maxRows: 10,
|
|
@@ -113,7 +112,7 @@ const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
|
113
112
|
s,
|
|
114
113
|
{
|
|
115
114
|
component: "img",
|
|
116
|
-
src:
|
|
115
|
+
src: $(e),
|
|
117
116
|
alt: e.name,
|
|
118
117
|
sx: {
|
|
119
118
|
width: 40,
|
|
@@ -126,15 +125,15 @@ const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
|
126
125
|
}
|
|
127
126
|
) : /* @__PURE__ */ r.jsx(q, { extension: t }),
|
|
128
127
|
/* @__PURE__ */ r.jsxs(s, { display: "flex", flexDirection: "row", alignItems: "center", gap: 1, children: [
|
|
129
|
-
/* @__PURE__ */ r.jsx(
|
|
130
|
-
/* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsxs(
|
|
128
|
+
/* @__PURE__ */ r.jsx(I, { variant: "subtitle2", textOverflow: "ellipsis", overflow: "hidden", whiteSpace: "nowrap", children: e.name }),
|
|
129
|
+
/* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsxs(I, { variant: "caption", color: "text.secondary", children: [
|
|
131
130
|
"(",
|
|
132
131
|
Math.round(e.size / 1024),
|
|
133
132
|
" KB)"
|
|
134
133
|
] }) })
|
|
135
134
|
] })
|
|
136
135
|
] }),
|
|
137
|
-
/* @__PURE__ */ r.jsx(d, { size: "small", onClick: () =>
|
|
136
|
+
/* @__PURE__ */ r.jsx(d, { size: "small", onClick: () => O(o), sx: { minWidth: "auto", p: 0.5 }, children: /* @__PURE__ */ r.jsx(J, {}) })
|
|
138
137
|
]
|
|
139
138
|
},
|
|
140
139
|
`${e.name}-${o}`
|
|
@@ -148,13 +147,13 @@ const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
|
148
147
|
type: "file",
|
|
149
148
|
multiple: !0,
|
|
150
149
|
accept: M,
|
|
151
|
-
onChange:
|
|
150
|
+
onChange: F,
|
|
152
151
|
style: { display: "none" },
|
|
153
|
-
id: `file-attachment-input-${
|
|
152
|
+
id: `file-attachment-input-${y}`,
|
|
154
153
|
disabled: a
|
|
155
154
|
}
|
|
156
155
|
),
|
|
157
|
-
/* @__PURE__ */ r.jsx("label", { htmlFor: `file-attachment-input-${
|
|
156
|
+
/* @__PURE__ */ r.jsx("label", { htmlFor: `file-attachment-input-${y}`, children: /* @__PURE__ */ r.jsx(
|
|
158
157
|
d,
|
|
159
158
|
{
|
|
160
159
|
component: "span",
|
|
@@ -172,8 +171,8 @@ const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
|
172
171
|
/* @__PURE__ */ r.jsx(
|
|
173
172
|
d,
|
|
174
173
|
{
|
|
175
|
-
ref:
|
|
176
|
-
onClick:
|
|
174
|
+
ref: C,
|
|
175
|
+
onClick: A,
|
|
177
176
|
disabled: a,
|
|
178
177
|
size: "small",
|
|
179
178
|
sx: {
|
|
@@ -189,7 +188,7 @@ const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
|
189
188
|
/* @__PURE__ */ r.jsx(
|
|
190
189
|
d,
|
|
191
190
|
{
|
|
192
|
-
onClick:
|
|
191
|
+
onClick: w,
|
|
193
192
|
disabled: a,
|
|
194
193
|
size: "small",
|
|
195
194
|
sx: {
|
|
@@ -202,7 +201,7 @@ const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
|
202
201
|
}
|
|
203
202
|
)
|
|
204
203
|
] }),
|
|
205
|
-
/* @__PURE__ */ r.jsx(W, { open:
|
|
204
|
+
/* @__PURE__ */ r.jsx(W, { open: k, anchorEl: C.current, placement: "top-start", sx: { zIndex: 1300 }, children: /* @__PURE__ */ r.jsx(H, { onClickAway: () => g(!1), children: /* @__PURE__ */ r.jsx(
|
|
206
205
|
s,
|
|
207
206
|
{
|
|
208
207
|
sx: {
|
|
@@ -295,7 +294,7 @@ const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
|
295
294
|
children: /* @__PURE__ */ r.jsx(
|
|
296
295
|
_,
|
|
297
296
|
{
|
|
298
|
-
onEmojiClick:
|
|
297
|
+
onEmojiClick: L,
|
|
299
298
|
width: 300,
|
|
300
299
|
height: 400,
|
|
301
300
|
searchDisabled: !1,
|
|
@@ -309,5 +308,5 @@ const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
|
309
308
|
}
|
|
310
309
|
);
|
|
311
310
|
export {
|
|
312
|
-
|
|
311
|
+
le as default
|
|
313
312
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
export interface SScrollToTopProps {
|
|
4
|
+
/**
|
|
5
|
+
* Handler called when the scroll-to-top button is clicked
|
|
6
|
+
*/
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
/**
|
|
9
|
+
* ID of the scrollable element to monitor. If not provided, monitors the window scroll
|
|
10
|
+
*/
|
|
11
|
+
scrollElementId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Scroll position (in pixels) after which the button becomes visible
|
|
14
|
+
* @default 100
|
|
15
|
+
*/
|
|
16
|
+
threshold?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Custom icon to display instead of the default arrow
|
|
19
|
+
*/
|
|
20
|
+
icon?: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* System prop for custom styling
|
|
23
|
+
*/
|
|
24
|
+
sx?: SxProps<Theme>;
|
|
25
|
+
}
|
|
26
|
+
declare const SScrollToTop: React.MemoExoticComponent<({ onClick, scrollElementId, threshold, icon, sx }: SScrollToTopProps) => import("react/jsx-runtime").JSX.Element>;
|
|
27
|
+
export default SScrollToTop;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { j as i } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
+
import d from "react";
|
|
3
|
+
import { A as c } from "../ArrowUpward-DvTpkKgd.js";
|
|
4
|
+
import { useIsPassedPosition as m } from "../hooks/use-is-passed-position.js";
|
|
5
|
+
import { s as p } from "../styled-BD_erj7E.js";
|
|
6
|
+
import { B as f } from "../Box-DqmXop3Z.js";
|
|
7
|
+
const h = p(f)({
|
|
8
|
+
position: "fixed",
|
|
9
|
+
bottom: 20,
|
|
10
|
+
right: 20,
|
|
11
|
+
zIndex: 100,
|
|
12
|
+
display: "flex",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
borderRadius: "50%",
|
|
16
|
+
width: 40,
|
|
17
|
+
height: 40,
|
|
18
|
+
backgroundColor: "background.paper",
|
|
19
|
+
cursor: "pointer",
|
|
20
|
+
transition: "all 0.3s ease",
|
|
21
|
+
"&:hover": {
|
|
22
|
+
transform: "scale(1.1)"
|
|
23
|
+
}
|
|
24
|
+
}), u = d.memo(({ onClick: r, scrollElementId: o, threshold: e = 100, icon: a, sx: n }) => {
|
|
25
|
+
const s = m(o || window, e), l = () => {
|
|
26
|
+
if (r)
|
|
27
|
+
r();
|
|
28
|
+
else if (o) {
|
|
29
|
+
const t = document.getElementById(o);
|
|
30
|
+
t == null || t.scrollTo({ top: 0, behavior: "smooth" });
|
|
31
|
+
} else
|
|
32
|
+
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ i.jsx(
|
|
35
|
+
h,
|
|
36
|
+
{
|
|
37
|
+
sx: {
|
|
38
|
+
opacity: s ? 1 : 0,
|
|
39
|
+
visibility: s ? "visible" : "hidden",
|
|
40
|
+
...n
|
|
41
|
+
},
|
|
42
|
+
onClick: l,
|
|
43
|
+
children: a || /* @__PURE__ */ i.jsx(c, {})
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
u.displayName = "SScrollToTop";
|
|
48
|
+
export {
|
|
49
|
+
u as default
|
|
50
|
+
};
|