@solostylist/ui-kit 1.0.101 → 1.0.103
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/main.d.ts +2 -0
- package/dist/main.js +60 -58
- package/dist/s-chat-input/s-chat-input.js +57 -57
- package/dist/s-chat-message/index.d.ts +1 -1
- package/dist/s-chat-message/s-chat-message.d.ts +13 -1
- package/dist/s-chat-message/s-chat-message.js +207 -54
- package/dist/s-lazy-image/s-lazy-image.js +25 -23
- package/dist/s-spotlight-cursor/index.d.ts +2 -0
- package/dist/s-spotlight-cursor/index.js +4 -0
- package/dist/s-spotlight-cursor/package.json +5 -0
- package/dist/s-spotlight-cursor/s-spotlight-cursor.d.ts +63 -0
- package/dist/s-spotlight-cursor/s-spotlight-cursor.js +59 -0
- package/dist/theme/components/alert.d.ts +16 -0
- package/dist/theme/components/alert.js +11 -7
- package/dist/theme/components/components.d.ts +16 -0
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export { default as SGlowButton } from './s-glow-button/index';
|
|
|
82
82
|
export type { SGlowButtonProps } from './s-glow-button/index';
|
|
83
83
|
export { default as SMovingBorder } from './s-moving-border/index';
|
|
84
84
|
export type { SMovingBorderProps } from './s-moving-border/index';
|
|
85
|
+
export { default as SSpotlightCursor } from './s-spotlight-cursor/index';
|
|
86
|
+
export type { SSpotlightCursorProps, SpotlightConfig } from './s-spotlight-cursor/index';
|
|
85
87
|
export { default as SCopyableText } from './s-copyable-text/index';
|
|
86
88
|
export type { SCopyableTextProps } from './s-copyable-text/index';
|
|
87
89
|
export { default as SInteractiveGallery, MediaItem } from './s-interactive-gallery/index';
|
package/dist/main.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as t } from "./s-accordion/s-accordion.js";
|
|
2
2
|
import { default as f } from "./s-autocomplete/s-autocomplete.js";
|
|
3
|
-
import { default as
|
|
3
|
+
import { default as s } from "./s-avatar/s-avatar.js";
|
|
4
4
|
import { default as p } from "./s-button/s-button.js";
|
|
5
5
|
import { default as S } from "./s-button-link/s-button-link.js";
|
|
6
|
-
import { default as
|
|
6
|
+
import { default as x } from "./s-carousel/s-carousel.js";
|
|
7
7
|
import { default as n } from "./s-chat-input/s-chat-input.js";
|
|
8
8
|
import { default as c } from "./s-chat-message/s-chat-message.js";
|
|
9
9
|
import { default as C } from "./s-text-editor/s-text-editor.js";
|
|
@@ -11,7 +11,7 @@ import "./s-text-editor/s-text-editor-toolbar.js";
|
|
|
11
11
|
import { default as v } from "./s-checkbox/s-checkbox.js";
|
|
12
12
|
import { default as b } from "./s-chip/s-chip.js";
|
|
13
13
|
import { default as I } from "./s-chips/s-chips.js";
|
|
14
|
-
import { default as
|
|
14
|
+
import { default as k } from "./s-data-table/s-data-table.js";
|
|
15
15
|
import { DialogConfirmProvider as y, default as F, useDialogConfirm as B } from "./s-dialog-confirm/s-dialog-confirm.js";
|
|
16
16
|
import { DialogMessageProvider as A, default as E, useDialogMessage as G } from "./s-dialog-message/s-dialog-message.js";
|
|
17
17
|
import { default as w } from "./s-error/s-error.js";
|
|
@@ -24,17 +24,17 @@ import { default as X } from "./s-icon-button/s-icon-button.js";
|
|
|
24
24
|
import { default as Z } from "./s-label/s-label.js";
|
|
25
25
|
import { default as $ } from "./s-multi-select/s-multi-select.js";
|
|
26
26
|
import { default as oe } from "./s-no-ssr/s-no-ssr.js";
|
|
27
|
-
import { default as
|
|
27
|
+
import { default as te } from "./s-text-field/s-text-field.js";
|
|
28
28
|
import { default as fe } from "./s-pagination/s-pagination.js";
|
|
29
|
-
import { default as
|
|
29
|
+
import { default as se } from "./s-select/s-select.js";
|
|
30
30
|
import { default as pe } from "./s-skeleton/s-skeleton.js";
|
|
31
31
|
import { default as Se } from "./s-tip/s-tip.js";
|
|
32
|
-
import { default as
|
|
32
|
+
import { default as xe } from "./s-text-truncation/s-text-truncation.js";
|
|
33
33
|
import { default as ne, SnackbarMessageProvider as ge, useSnackbarMessage as ce } from "./s-snackbar-message/s-snackbar-message.js";
|
|
34
34
|
import { default as Ce } from "./s-form/s-form.js";
|
|
35
35
|
import { SSmartTextField as ve } from "./s-smart-text-field/s-smart-text-field.js";
|
|
36
36
|
import { SCopilotKitProvider as be } from "./s-copilot-kit-provider/s-copilot-kit-provider.js";
|
|
37
|
-
import { SStripeCVC as Ie, SStripeExpiry as
|
|
37
|
+
import { SStripeCVC as Ie, SStripeExpiry as he, SStripeNumber as ke, StripeTextField as Le } from "./s-stripe/s-stripe.js";
|
|
38
38
|
import { default as Fe } from "./s-theme-provider/s-theme-provider.js";
|
|
39
39
|
import { default as ze } from "./s-datetime-picker/s-datetime-picker.js";
|
|
40
40
|
import { default as Ee } from "./s-date-picker/s-date-picker.js";
|
|
@@ -42,44 +42,45 @@ import { default as Re } from "./s-localization-provider/s-localization-provider
|
|
|
42
42
|
import { default as Ne } from "./s-gradient-icon/s-gradient-icon.js";
|
|
43
43
|
import { default as Ke } from "./s-glow-button/s-glow-button.js";
|
|
44
44
|
import { default as qe } from "./s-moving-border/s-moving-border.js";
|
|
45
|
-
import { default as Je } from "./s-
|
|
46
|
-
import {
|
|
47
|
-
import { default as Xe } from "./s-
|
|
48
|
-
import { default as Ze } from "./s-
|
|
49
|
-
import { default as $e } from "./s-image
|
|
50
|
-
import { default as oo } from "./s-
|
|
51
|
-
import { default as
|
|
52
|
-
import { default as fo } from "./s-
|
|
53
|
-
import { default as
|
|
54
|
-
import { default as po } from "./s-tabs/s-
|
|
55
|
-
import { default as
|
|
56
|
-
import { default as io } from "./s-
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
45
|
+
import { default as Je } from "./s-spotlight-cursor/s-spotlight-cursor.js";
|
|
46
|
+
import { default as Qe } from "./s-copyable-text/s-copyable-text.js";
|
|
47
|
+
import { MediaItem as We, default as Xe } from "./s-interactive-gallery/s-interactive-gallery.js";
|
|
48
|
+
import { default as Ze } from "./s-image-modal/s-image-modal.js";
|
|
49
|
+
import { default as $e } from "./s-lazy-image/s-lazy-image.js";
|
|
50
|
+
import { default as oo } from "./s-image-comparison/s-image-comparison.js";
|
|
51
|
+
import { default as to } from "./s-radial-pulse-animate/s-radial-pulse-animate.js";
|
|
52
|
+
import { default as fo } from "./s-rating/s-rating.js";
|
|
53
|
+
import { default as so } from "./s-review/s-review.js";
|
|
54
|
+
import { default as po } from "./s-tabs/s-tabs.js";
|
|
55
|
+
import { default as uo } from "./s-tabs/s-tab.js";
|
|
56
|
+
import { default as io } from "./s-tabs/s-tab-panel.js";
|
|
57
|
+
import { default as go } from "./s-text-shimmer/s-text-shimmer.js";
|
|
58
|
+
import { useDialog as To } from "./hooks/use-dialog.js";
|
|
59
|
+
import { usePopover as Po } from "./hooks/use-popover.js";
|
|
60
|
+
import { formatDatePosted as Do } from "./utils/dayjs.js";
|
|
61
|
+
import { bytesToSize as Mo } from "./utils/bytes-to-size.js";
|
|
62
|
+
import { LogLevel as ho, Logger as ko, createLogger as Lo, logger as yo } from "./utils/logger.js";
|
|
63
|
+
import { default as Bo } from "dayjs";
|
|
63
64
|
export {
|
|
64
65
|
y as DialogConfirmProvider,
|
|
65
66
|
A as DialogMessageProvider,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
ho as LogLevel,
|
|
68
|
+
ko as Logger,
|
|
69
|
+
We as MediaItem,
|
|
70
|
+
t as SAccordion,
|
|
70
71
|
f as SAutocomplete,
|
|
71
|
-
|
|
72
|
+
s as SAvatar,
|
|
72
73
|
p as SButton,
|
|
73
74
|
S as SButtonLink,
|
|
74
|
-
|
|
75
|
+
x as SCarousel,
|
|
75
76
|
n as SChatInput,
|
|
76
77
|
c as SChatMessage,
|
|
77
78
|
v as SCheckbox,
|
|
78
79
|
b as SChip,
|
|
79
80
|
I as SChips,
|
|
80
81
|
be as SCopilotKitProvider,
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
Qe as SCopyableText,
|
|
83
|
+
k as SDataTable,
|
|
83
84
|
Ee as SDatePicker,
|
|
84
85
|
ze as SDateTimePicker,
|
|
85
86
|
V as SDialog,
|
|
@@ -94,45 +95,46 @@ export {
|
|
|
94
95
|
Ne as SGradientIcon,
|
|
95
96
|
U as SI18nProvider,
|
|
96
97
|
X as SIconButton,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
oo as SImageComparison,
|
|
99
|
+
Ze as SImageModal,
|
|
100
|
+
Xe as SInteractiveGallery,
|
|
100
101
|
Z as SLabel,
|
|
101
|
-
|
|
102
|
+
$e as SLazyImage,
|
|
102
103
|
Re as SLocalizationProvider,
|
|
103
104
|
qe as SMovingBorder,
|
|
104
105
|
$ as SMultiSelect,
|
|
105
106
|
oe as SNoSsr,
|
|
106
107
|
fe as SPagination,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
to as SRadialPulseAnimate,
|
|
109
|
+
fo as SRating,
|
|
110
|
+
so as SReview,
|
|
111
|
+
se as SSelect,
|
|
111
112
|
pe as SSkeleton,
|
|
112
113
|
ve as SSmartTextField,
|
|
113
114
|
ne as SSnackbarMessage,
|
|
115
|
+
Je as SSpotlightCursor,
|
|
114
116
|
Ie as SStripeCVC,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
he as SStripeExpiry,
|
|
118
|
+
ke as SStripeNumber,
|
|
119
|
+
uo as STab,
|
|
120
|
+
io as STabPanel,
|
|
121
|
+
po as STabs,
|
|
120
122
|
C as STextEditor,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
te as STextField,
|
|
124
|
+
go as STextShimmer,
|
|
125
|
+
xe as STextTruncation,
|
|
124
126
|
Fe as SThemeProvider,
|
|
125
127
|
Se as STip,
|
|
126
128
|
ge as SnackbarMessageProvider,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
Le as StripeTextField,
|
|
130
|
+
Mo as bytesToSize,
|
|
131
|
+
Lo as createLogger,
|
|
132
|
+
Bo as dayjs,
|
|
133
|
+
Do as formatDatePosted,
|
|
134
|
+
yo as logger,
|
|
135
|
+
To as useDialog,
|
|
134
136
|
B as useDialogConfirm,
|
|
135
137
|
G as useDialogMessage,
|
|
136
|
-
|
|
138
|
+
Po as usePopover,
|
|
137
139
|
ce as useSnackbarMessage
|
|
138
140
|
};
|
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
import { j as r } from "../jsx-runtime-DywqP_6a.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Box as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { forwardRef as S, useState as c, useRef as K, useId as T, useEffect as B } from "react";
|
|
3
|
+
import { Box as s, outlinedInputClasses as D, Typography as E, Popper as W, ClickAwayListener as H } from "@mui/material";
|
|
4
|
+
import _ from "emoji-picker-react";
|
|
5
|
+
import q from "../s-file-icon/s-file-icon.js";
|
|
6
6
|
import d from "../s-icon-button/s-icon-button.js";
|
|
7
|
-
import
|
|
8
|
-
import { C as
|
|
9
|
-
import { c as
|
|
10
|
-
const
|
|
7
|
+
import G from "../s-text-field/s-text-field.js";
|
|
8
|
+
import { C as J } from "../Close-DqRHeMAW.js";
|
|
9
|
+
import { c as v } from "../createSvgIcon-DCQI9UV5.js";
|
|
10
|
+
const N = v(/* @__PURE__ */ r.jsx("path", {
|
|
11
11
|
d: "m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"
|
|
12
|
-
}), "ArrowUpward"),
|
|
12
|
+
}), "ArrowUpward"), Q = v(/* @__PURE__ */ r.jsx("path", {
|
|
13
13
|
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"),
|
|
14
|
+
}), "AttachFile"), X = v(/* @__PURE__ */ r.jsx("path", {
|
|
15
15
|
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:
|
|
18
|
-
const [u, h] = c(""), [l, x] = c([]), [i, f] = c(/* @__PURE__ */ new Map()), [
|
|
16
|
+
}), "EmojiEmotions"), ie = S(
|
|
17
|
+
({ onSubmit: p, onFileSelect: m, disabled: a, acceptedFileTypes: M, maxFileSize: k, ...z }, U) => {
|
|
18
|
+
const [u, h] = c(""), [l, x] = c([]), [i, f] = c(/* @__PURE__ */ new Map()), [C, g] = c(!1), y = K(null), w = T(), b = (e) => e.type.startsWith("image/"), L = (e) => {
|
|
19
19
|
const o = `${e.name}-${e.size}-${e.lastModified}`;
|
|
20
20
|
if (i.has(o))
|
|
21
21
|
return i.get(o);
|
|
22
22
|
if (b(e)) {
|
|
23
23
|
const n = URL.createObjectURL(e);
|
|
24
|
-
return f((
|
|
24
|
+
return f((t) => new Map(t).set(o, n)), n;
|
|
25
25
|
}
|
|
26
26
|
return "";
|
|
27
|
-
}, L = (e) => {
|
|
28
|
-
h(e.target.value);
|
|
29
27
|
}, $ = (e) => {
|
|
28
|
+
h(e.target.value);
|
|
29
|
+
}, P = (e) => {
|
|
30
30
|
h((o) => o + e.emoji), g(!1);
|
|
31
|
-
},
|
|
32
|
-
g(!
|
|
31
|
+
}, V = () => {
|
|
32
|
+
g(!C);
|
|
33
33
|
}, R = () => {
|
|
34
34
|
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
|
-
},
|
|
36
|
-
const n = Array.from(e.target.files || []).filter((
|
|
37
|
-
x((
|
|
38
|
-
},
|
|
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
|
+
}, F = (e) => {
|
|
39
39
|
const o = l[e];
|
|
40
40
|
if (o && b(o)) {
|
|
41
|
-
const n = `${o.name}-${o.size}-${o.lastModified}`,
|
|
42
|
-
|
|
41
|
+
const n = `${o.name}-${o.size}-${o.lastModified}`, t = i.get(n);
|
|
42
|
+
t && (URL.revokeObjectURL(t), f((j) => {
|
|
43
43
|
const I = new Map(j);
|
|
44
44
|
return I.delete(n), I;
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
|
-
x((n) => n.filter((
|
|
48
|
-
},
|
|
47
|
+
x((n) => n.filter((t, j) => j !== e));
|
|
48
|
+
}, O = (e) => {
|
|
49
49
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), R());
|
|
50
50
|
};
|
|
51
51
|
return B(() => () => {
|
|
52
52
|
i.forEach((e) => URL.revokeObjectURL(e));
|
|
53
|
-
}, [i]), /* @__PURE__ */ r.jsxs(
|
|
53
|
+
}, [i]), /* @__PURE__ */ r.jsxs(s, { border: "1px solid", borderColor: "divider", borderRadius: 2, padding: "8px 12px", children: [
|
|
54
54
|
/* @__PURE__ */ r.jsx(
|
|
55
|
-
|
|
55
|
+
G,
|
|
56
56
|
{
|
|
57
57
|
placeholder: "Enter your message here...",
|
|
58
58
|
disabled: a,
|
|
59
59
|
value: u,
|
|
60
|
-
onChange:
|
|
61
|
-
onKeyDown:
|
|
60
|
+
onChange: $,
|
|
61
|
+
onKeyDown: O,
|
|
62
62
|
multiline: !0,
|
|
63
63
|
minRows: 1,
|
|
64
64
|
maxRows: 10,
|
|
65
65
|
size: "small",
|
|
66
66
|
variant: "outlined",
|
|
67
67
|
fullWidth: !0,
|
|
68
|
-
inputRef:
|
|
68
|
+
inputRef: U,
|
|
69
69
|
slotProps: {
|
|
70
70
|
input: {
|
|
71
71
|
sx: {
|
|
@@ -73,7 +73,7 @@ const J = k(/* @__PURE__ */ r.jsx("path", {
|
|
|
73
73
|
backgroundColor: "transparent",
|
|
74
74
|
border: "none",
|
|
75
75
|
padding: 0,
|
|
76
|
-
[`&.${
|
|
76
|
+
[`&.${D.focused}`]: {
|
|
77
77
|
outline: "none"
|
|
78
78
|
},
|
|
79
79
|
"& fieldset": {
|
|
@@ -91,10 +91,10 @@ const J = k(/* @__PURE__ */ r.jsx("path", {
|
|
|
91
91
|
...z
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
|
-
l.length > 0 && /* @__PURE__ */ r.jsx(
|
|
95
|
-
const n = b(e),
|
|
94
|
+
l.length > 0 && /* @__PURE__ */ r.jsx(s, { mt: 1, children: l.map((e, o) => {
|
|
95
|
+
const n = b(e), t = e.name.split(".").pop();
|
|
96
96
|
return /* @__PURE__ */ r.jsxs(
|
|
97
|
-
|
|
97
|
+
s,
|
|
98
98
|
{
|
|
99
99
|
display: "flex",
|
|
100
100
|
alignItems: "center",
|
|
@@ -108,12 +108,12 @@ const J = k(/* @__PURE__ */ r.jsx("path", {
|
|
|
108
108
|
mb: 0.5
|
|
109
109
|
},
|
|
110
110
|
children: [
|
|
111
|
-
/* @__PURE__ */ r.jsxs(
|
|
111
|
+
/* @__PURE__ */ r.jsxs(s, { display: "flex", alignItems: "center", gap: 1, children: [
|
|
112
112
|
n ? /* @__PURE__ */ r.jsx(
|
|
113
|
-
|
|
113
|
+
s,
|
|
114
114
|
{
|
|
115
115
|
component: "img",
|
|
116
|
-
src:
|
|
116
|
+
src: L(e),
|
|
117
117
|
alt: e.name,
|
|
118
118
|
sx: {
|
|
119
119
|
width: 40,
|
|
@@ -124,31 +124,31 @@ const J = k(/* @__PURE__ */ r.jsx("path", {
|
|
|
124
124
|
borderColor: "divider"
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
) : /* @__PURE__ */ r.jsx(
|
|
128
|
-
/* @__PURE__ */ r.jsxs(
|
|
129
|
-
/* @__PURE__ */ r.jsx(
|
|
130
|
-
/* @__PURE__ */ r.
|
|
127
|
+
) : /* @__PURE__ */ r.jsx(q, { extension: t }),
|
|
128
|
+
/* @__PURE__ */ r.jsxs(s, { display: "flex", flexDirection: "row", alignItems: "center", gap: 1, children: [
|
|
129
|
+
/* @__PURE__ */ r.jsx(E, { variant: "subtitle2", textOverflow: "ellipsis", overflow: "hidden", whiteSpace: "nowrap", children: e.name }),
|
|
130
|
+
/* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsxs(E, { variant: "caption", color: "text.secondary", children: [
|
|
131
131
|
"(",
|
|
132
132
|
Math.round(e.size / 1024),
|
|
133
133
|
" KB)"
|
|
134
|
-
] })
|
|
134
|
+
] }) })
|
|
135
135
|
] })
|
|
136
136
|
] }),
|
|
137
|
-
/* @__PURE__ */ r.jsx(d, { size: "small", onClick: () =>
|
|
137
|
+
/* @__PURE__ */ r.jsx(d, { size: "small", onClick: () => F(o), sx: { minWidth: "auto", p: 0.5 }, children: /* @__PURE__ */ r.jsx(J, {}) })
|
|
138
138
|
]
|
|
139
139
|
},
|
|
140
140
|
`${e.name}-${o}`
|
|
141
141
|
);
|
|
142
142
|
}) }),
|
|
143
|
-
/* @__PURE__ */ r.jsxs(
|
|
144
|
-
/* @__PURE__ */ r.jsxs(
|
|
143
|
+
/* @__PURE__ */ r.jsxs(s, { display: "flex", justifyContent: "space-between", alignItems: "center", mt: 1, children: [
|
|
144
|
+
/* @__PURE__ */ r.jsxs(s, { display: "flex", gap: 1, children: [
|
|
145
145
|
/* @__PURE__ */ r.jsx(
|
|
146
146
|
"input",
|
|
147
147
|
{
|
|
148
148
|
type: "file",
|
|
149
149
|
multiple: !0,
|
|
150
|
-
accept:
|
|
151
|
-
onChange:
|
|
150
|
+
accept: M,
|
|
151
|
+
onChange: A,
|
|
152
152
|
style: { display: "none" },
|
|
153
153
|
id: `file-attachment-input-${w}`,
|
|
154
154
|
disabled: a
|
|
@@ -166,14 +166,14 @@ const J = k(/* @__PURE__ */ r.jsx("path", {
|
|
|
166
166
|
transform: "scale(1.1)"
|
|
167
167
|
}
|
|
168
168
|
},
|
|
169
|
-
children: /* @__PURE__ */ r.jsx(
|
|
169
|
+
children: /* @__PURE__ */ r.jsx(Q, {})
|
|
170
170
|
}
|
|
171
171
|
) }),
|
|
172
172
|
/* @__PURE__ */ r.jsx(
|
|
173
173
|
d,
|
|
174
174
|
{
|
|
175
175
|
ref: y,
|
|
176
|
-
onClick:
|
|
176
|
+
onClick: V,
|
|
177
177
|
disabled: a,
|
|
178
178
|
size: "small",
|
|
179
179
|
sx: {
|
|
@@ -182,7 +182,7 @@ const J = k(/* @__PURE__ */ r.jsx("path", {
|
|
|
182
182
|
transform: "scale(1.1)"
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
|
-
children: /* @__PURE__ */ r.jsx(
|
|
185
|
+
children: /* @__PURE__ */ r.jsx(X, {})
|
|
186
186
|
}
|
|
187
187
|
)
|
|
188
188
|
] }),
|
|
@@ -198,12 +198,12 @@ const J = k(/* @__PURE__ */ r.jsx("path", {
|
|
|
198
198
|
transform: "scale(1.2)"
|
|
199
199
|
}
|
|
200
200
|
},
|
|
201
|
-
children: /* @__PURE__ */ r.jsx(
|
|
201
|
+
children: /* @__PURE__ */ r.jsx(N, {})
|
|
202
202
|
}
|
|
203
203
|
)
|
|
204
204
|
] }),
|
|
205
|
-
/* @__PURE__ */ r.jsx(W, { open:
|
|
206
|
-
|
|
205
|
+
/* @__PURE__ */ r.jsx(W, { open: C, anchorEl: y.current, placement: "top-start", sx: { zIndex: 1300 }, children: /* @__PURE__ */ r.jsx(H, { onClickAway: () => g(!1), children: /* @__PURE__ */ r.jsx(
|
|
206
|
+
s,
|
|
207
207
|
{
|
|
208
208
|
sx: {
|
|
209
209
|
border: "1px solid",
|
|
@@ -293,9 +293,9 @@ const J = k(/* @__PURE__ */ r.jsx("path", {
|
|
|
293
293
|
}
|
|
294
294
|
},
|
|
295
295
|
children: /* @__PURE__ */ r.jsx(
|
|
296
|
-
|
|
296
|
+
_,
|
|
297
297
|
{
|
|
298
|
-
onEmojiClick:
|
|
298
|
+
onEmojiClick: P,
|
|
299
299
|
width: 300,
|
|
300
300
|
height: 400,
|
|
301
301
|
searchDisabled: !1,
|
|
@@ -309,5 +309,5 @@ const J = k(/* @__PURE__ */ r.jsx("path", {
|
|
|
309
309
|
}
|
|
310
310
|
);
|
|
311
311
|
export {
|
|
312
|
-
|
|
312
|
+
ie as default
|
|
313
313
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './s-chat-message';
|
|
2
|
-
export type { SChatMessageProps } from './s-chat-message';
|
|
2
|
+
export type { SChatMessageProps, ChatAttachment } from './s-chat-message';
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { BoxProps } from '@mui/material';
|
|
3
|
+
export interface ChatAttachment {
|
|
4
|
+
id: string;
|
|
5
|
+
type: 'image' | 'file';
|
|
6
|
+
url: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
size?: number;
|
|
9
|
+
mimeType?: string;
|
|
10
|
+
thumbnailUrl?: string;
|
|
11
|
+
}
|
|
3
12
|
export interface SChatMessageProps extends Omit<BoxProps, 'children'> {
|
|
4
|
-
message
|
|
13
|
+
message?: string;
|
|
5
14
|
variant?: 'sent' | 'received';
|
|
6
15
|
timestamp?: string | Date;
|
|
7
16
|
avatar?: string;
|
|
@@ -9,6 +18,9 @@ export interface SChatMessageProps extends Omit<BoxProps, 'children'> {
|
|
|
9
18
|
showAvatar?: boolean;
|
|
10
19
|
showTimestamp?: boolean;
|
|
11
20
|
maxWidth?: string | number;
|
|
21
|
+
attachments?: ChatAttachment[];
|
|
22
|
+
onAttachmentClick?: (attachment: ChatAttachment) => void;
|
|
23
|
+
onDownload?: (attachment: ChatAttachment) => void;
|
|
12
24
|
}
|
|
13
25
|
declare const SChatMessage: React.FC<SChatMessageProps>;
|
|
14
26
|
export default SChatMessage;
|
|
@@ -1,50 +1,69 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { j as r } from "../jsx-runtime-DywqP_6a.js";
|
|
2
|
+
import { useState as v } from "react";
|
|
3
|
+
import { Box as o, Typography as l, Paper as H, IconButton as D } from "@mui/material";
|
|
4
|
+
import S from "../s-avatar/s-avatar.js";
|
|
5
|
+
import L from "../s-image-modal/s-image-modal.js";
|
|
6
|
+
import O from "../s-lazy-image/s-lazy-image.js";
|
|
7
|
+
import { c as b } from "../createSvgIcon-DCQI9UV5.js";
|
|
8
|
+
const R = b(/* @__PURE__ */ r.jsx("path", {
|
|
9
|
+
d: "M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"
|
|
10
|
+
}), "Download"), U = b(/* @__PURE__ */ r.jsx("path", {
|
|
11
|
+
d: "M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm7 7V3.5L18.5 9z"
|
|
12
|
+
}), "InsertDriveFile"), Q = ({
|
|
13
|
+
message: m,
|
|
14
|
+
variant: z = "received",
|
|
15
|
+
timestamp: f,
|
|
16
|
+
avatar: g,
|
|
17
|
+
senderName: t,
|
|
18
|
+
showAvatar: h = !0,
|
|
19
|
+
showTimestamp: I = !1,
|
|
20
|
+
maxWidth: w = "70%",
|
|
21
|
+
attachments: x = [],
|
|
22
|
+
onAttachmentClick: s,
|
|
23
|
+
onDownload: n,
|
|
24
|
+
sx: M,
|
|
25
|
+
...k
|
|
15
26
|
}) => {
|
|
16
|
-
const
|
|
27
|
+
const [a, u] = v(null), [C, j] = v(!1), i = z === "sent", T = (e) => (typeof e == "string" ? new Date(e) : e).toLocaleTimeString("en-US", {
|
|
17
28
|
hour: "2-digit",
|
|
18
29
|
minute: "2-digit",
|
|
19
30
|
hour12: !0
|
|
20
|
-
})
|
|
21
|
-
|
|
31
|
+
}), B = (e) => {
|
|
32
|
+
if (!e) return "";
|
|
33
|
+
const c = ["Bytes", "KB", "MB", "GB"], p = Math.floor(Math.log(e) / Math.log(1024));
|
|
34
|
+
return Math.round(e / Math.pow(1024, p) * 100) / 100 + " " + c[p];
|
|
35
|
+
}, F = (e) => {
|
|
36
|
+
s ? s(e) : (u(e), j(!0));
|
|
37
|
+
}, W = (e) => {
|
|
38
|
+
s ? s(e) : n && n(e);
|
|
39
|
+
}, d = x.filter((e) => e.type === "image"), y = x.filter((e) => e.type === "file");
|
|
40
|
+
return /* @__PURE__ */ r.jsxs(
|
|
22
41
|
o,
|
|
23
42
|
{
|
|
24
43
|
display: "flex",
|
|
25
|
-
flexDirection:
|
|
44
|
+
flexDirection: i ? "row-reverse" : "row",
|
|
26
45
|
alignItems: "flex-start",
|
|
27
46
|
gap: 1,
|
|
28
47
|
mb: 1,
|
|
29
48
|
sx: {
|
|
30
|
-
maxWidth:
|
|
31
|
-
alignSelf:
|
|
32
|
-
...
|
|
49
|
+
maxWidth: w,
|
|
50
|
+
alignSelf: i ? "flex-end" : "flex-start",
|
|
51
|
+
...M
|
|
33
52
|
},
|
|
34
|
-
...
|
|
53
|
+
...k,
|
|
35
54
|
children: [
|
|
36
|
-
|
|
37
|
-
/* @__PURE__ */
|
|
55
|
+
h && !i && /* @__PURE__ */ r.jsx(S, { avatar: g, name: t, size: 36 }),
|
|
56
|
+
/* @__PURE__ */ r.jsxs(
|
|
38
57
|
o,
|
|
39
58
|
{
|
|
40
59
|
display: "flex",
|
|
41
60
|
flexDirection: "column",
|
|
42
|
-
alignItems:
|
|
61
|
+
alignItems: i ? "flex-end" : "flex-start",
|
|
43
62
|
gap: 0.5,
|
|
44
63
|
sx: { minWidth: 0 },
|
|
45
64
|
children: [
|
|
46
|
-
|
|
47
|
-
|
|
65
|
+
t && !i && /* @__PURE__ */ r.jsx(
|
|
66
|
+
l,
|
|
48
67
|
{
|
|
49
68
|
variant: "caption",
|
|
50
69
|
sx: {
|
|
@@ -53,62 +72,196 @@ const b = ({
|
|
|
53
72
|
fontWeight: 500,
|
|
54
73
|
ml: 0.5
|
|
55
74
|
},
|
|
56
|
-
children:
|
|
75
|
+
children: t
|
|
57
76
|
}
|
|
58
77
|
),
|
|
59
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ r.jsxs(
|
|
60
79
|
o,
|
|
61
80
|
{
|
|
62
81
|
sx: {
|
|
63
82
|
display: "inline-block",
|
|
64
|
-
px: 2,
|
|
65
|
-
py: 1.5,
|
|
66
83
|
borderRadius: 2,
|
|
67
84
|
wordBreak: "break-word",
|
|
68
85
|
maxWidth: "100%",
|
|
69
|
-
backgroundColor:
|
|
70
|
-
color:
|
|
71
|
-
border:
|
|
86
|
+
backgroundColor: i ? "primary.main" : "",
|
|
87
|
+
color: i ? "primary.contrastText" : "text.primary",
|
|
88
|
+
border: i ? "none" : "1px solid",
|
|
72
89
|
borderColor: "divider",
|
|
73
|
-
...
|
|
90
|
+
...i && {
|
|
74
91
|
backgroundColor: "primary.dark"
|
|
75
|
-
}
|
|
92
|
+
},
|
|
93
|
+
overflow: "hidden"
|
|
76
94
|
},
|
|
77
|
-
children:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
children: [
|
|
96
|
+
d.length > 0 && /* @__PURE__ */ r.jsx(
|
|
97
|
+
o,
|
|
98
|
+
{
|
|
99
|
+
sx: {
|
|
100
|
+
display: "grid",
|
|
101
|
+
gridTemplateColumns: d.length === 1 ? "1fr" : "repeat(2, 1fr)",
|
|
102
|
+
gap: 0.5,
|
|
103
|
+
p: 0.5
|
|
104
|
+
},
|
|
105
|
+
minWidth: 200,
|
|
106
|
+
children: d.map((e) => /* @__PURE__ */ r.jsx(
|
|
107
|
+
o,
|
|
108
|
+
{
|
|
109
|
+
sx: {
|
|
110
|
+
position: "relative",
|
|
111
|
+
paddingTop: d.length === 1 ? "66.67%" : "100%",
|
|
112
|
+
cursor: "pointer",
|
|
113
|
+
borderRadius: 1.5,
|
|
114
|
+
overflow: "hidden",
|
|
115
|
+
"&:hover": {
|
|
116
|
+
opacity: 0.9
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
onClick: () => F(e),
|
|
120
|
+
children: /* @__PURE__ */ r.jsx(
|
|
121
|
+
O,
|
|
122
|
+
{
|
|
123
|
+
src: e.thumbnailUrl || e.url,
|
|
124
|
+
alt: e.name || "Image",
|
|
125
|
+
width: "100%",
|
|
126
|
+
height: "100%",
|
|
127
|
+
style: {
|
|
128
|
+
position: "absolute",
|
|
129
|
+
top: 0,
|
|
130
|
+
left: 0,
|
|
131
|
+
objectFit: "cover"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
},
|
|
136
|
+
e.id
|
|
137
|
+
))
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
y.length > 0 && /* @__PURE__ */ r.jsx(o, { sx: { p: 1.5 }, children: y.map((e, c) => /* @__PURE__ */ r.jsxs(
|
|
141
|
+
H,
|
|
142
|
+
{
|
|
143
|
+
variant: "outlined",
|
|
144
|
+
sx: {
|
|
145
|
+
display: "flex",
|
|
146
|
+
alignItems: "center",
|
|
147
|
+
gap: 1.5,
|
|
148
|
+
p: 1,
|
|
149
|
+
mt: c > 0 ? 1 : 0,
|
|
150
|
+
cursor: "pointer",
|
|
151
|
+
backgroundColor: i ? "rgba(0,0,0,0.1)" : "background.paper",
|
|
152
|
+
"&:hover": {
|
|
153
|
+
backgroundColor: i ? "rgba(0,0,0,0.2)" : "action.hover"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
onClick: () => W(e),
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ r.jsx(
|
|
159
|
+
U,
|
|
160
|
+
{
|
|
161
|
+
sx: {
|
|
162
|
+
fontSize: 32,
|
|
163
|
+
color: i ? "primary.contrastText" : "action.active"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
/* @__PURE__ */ r.jsxs(o, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
168
|
+
/* @__PURE__ */ r.jsx(
|
|
169
|
+
l,
|
|
170
|
+
{
|
|
171
|
+
variant: "body2",
|
|
172
|
+
sx: {
|
|
173
|
+
fontSize: "0.875rem",
|
|
174
|
+
fontWeight: 500,
|
|
175
|
+
overflow: "hidden",
|
|
176
|
+
textOverflow: "ellipsis",
|
|
177
|
+
whiteSpace: "nowrap",
|
|
178
|
+
color: i ? "inherit" : "text.primary"
|
|
179
|
+
},
|
|
180
|
+
children: e.name || "Unnamed File"
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
e.size && /* @__PURE__ */ r.jsx(
|
|
184
|
+
l,
|
|
185
|
+
{
|
|
186
|
+
variant: "caption",
|
|
187
|
+
sx: {
|
|
188
|
+
fontSize: "0.75rem",
|
|
189
|
+
color: i ? "rgba(255,255,255,0.7)" : "text.secondary"
|
|
190
|
+
},
|
|
191
|
+
children: B(e.size)
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
] }),
|
|
195
|
+
n && /* @__PURE__ */ r.jsx(
|
|
196
|
+
D,
|
|
197
|
+
{
|
|
198
|
+
size: "small",
|
|
199
|
+
onClick: (p) => {
|
|
200
|
+
p.stopPropagation(), n(e);
|
|
201
|
+
},
|
|
202
|
+
sx: {
|
|
203
|
+
color: i ? "primary.contrastText" : "action.active"
|
|
204
|
+
},
|
|
205
|
+
children: /* @__PURE__ */ r.jsx(R, { fontSize: "small" })
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
]
|
|
85
209
|
},
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
210
|
+
e.id
|
|
211
|
+
)) }),
|
|
212
|
+
m && /* @__PURE__ */ r.jsx(o, { sx: { px: 2, py: 1.5, pt: x.length > 0 ? 0 : 1.5 }, children: /* @__PURE__ */ r.jsx(
|
|
213
|
+
l,
|
|
214
|
+
{
|
|
215
|
+
variant: "body2",
|
|
216
|
+
sx: {
|
|
217
|
+
fontSize: "0.875rem",
|
|
218
|
+
lineHeight: 1.4,
|
|
219
|
+
whiteSpace: "pre-wrap"
|
|
220
|
+
},
|
|
221
|
+
children: m
|
|
222
|
+
}
|
|
223
|
+
) })
|
|
224
|
+
]
|
|
89
225
|
}
|
|
90
226
|
),
|
|
91
|
-
|
|
92
|
-
|
|
227
|
+
I && f && /* @__PURE__ */ r.jsx(
|
|
228
|
+
l,
|
|
93
229
|
{
|
|
94
230
|
variant: "caption",
|
|
95
231
|
sx: {
|
|
96
232
|
color: "text.secondary",
|
|
97
233
|
fontSize: "0.7rem",
|
|
98
|
-
ml:
|
|
99
|
-
mr:
|
|
234
|
+
ml: i ? 0 : 0.5,
|
|
235
|
+
mr: i ? 0.5 : 0
|
|
100
236
|
},
|
|
101
|
-
children:
|
|
237
|
+
children: T(f)
|
|
102
238
|
}
|
|
103
239
|
)
|
|
104
240
|
]
|
|
105
241
|
}
|
|
106
242
|
),
|
|
107
|
-
|
|
243
|
+
h && i && /* @__PURE__ */ r.jsx(S, { avatar: g, name: t, size: 36 }),
|
|
244
|
+
a && /* @__PURE__ */ r.jsx(
|
|
245
|
+
L,
|
|
246
|
+
{
|
|
247
|
+
isOpen: C,
|
|
248
|
+
onClose: () => {
|
|
249
|
+
j(!1), u(null);
|
|
250
|
+
},
|
|
251
|
+
selectedItem: {
|
|
252
|
+
id: a.id,
|
|
253
|
+
type: "image",
|
|
254
|
+
url: a.url,
|
|
255
|
+
title: a.name
|
|
256
|
+
},
|
|
257
|
+
showNavigation: !1,
|
|
258
|
+
showThumbnailDock: !1
|
|
259
|
+
}
|
|
260
|
+
)
|
|
108
261
|
]
|
|
109
262
|
}
|
|
110
263
|
);
|
|
111
264
|
};
|
|
112
265
|
export {
|
|
113
|
-
|
|
266
|
+
Q as default
|
|
114
267
|
};
|
|
@@ -1,63 +1,65 @@
|
|
|
1
1
|
import { j as a } from "../jsx-runtime-DywqP_6a.js";
|
|
2
|
-
import { useId as
|
|
3
|
-
import { useTheme as j, Box as
|
|
4
|
-
const
|
|
5
|
-
src:
|
|
2
|
+
import { useId as i, useState as f } from "react";
|
|
3
|
+
import { useTheme as j, Box as m, Skeleton as L } from "@mui/material";
|
|
4
|
+
const I = ({
|
|
5
|
+
src: n,
|
|
6
6
|
variant: e = "rounded",
|
|
7
7
|
height: o = "auto",
|
|
8
8
|
width: s = "100%",
|
|
9
|
-
style:
|
|
10
|
-
minWidth:
|
|
11
|
-
minHeight:
|
|
12
|
-
...
|
|
9
|
+
style: r,
|
|
10
|
+
minWidth: t = "auto",
|
|
11
|
+
minHeight: u = "auto",
|
|
12
|
+
...c
|
|
13
13
|
}) => {
|
|
14
|
-
const
|
|
14
|
+
const l = i(), p = j(), [d, x] = f(!1);
|
|
15
15
|
return (
|
|
16
16
|
// Container box maintains consistent dimensions throughout the loading process
|
|
17
17
|
// This prevents layout shifts and provides stable positioning for both skeleton and image
|
|
18
|
-
/* @__PURE__ */ a.jsxs(
|
|
19
|
-
!
|
|
18
|
+
/* @__PURE__ */ a.jsxs(m, { height: o, width: s, children: [
|
|
19
|
+
!d && /* @__PURE__ */ a.jsx(
|
|
20
20
|
L,
|
|
21
21
|
{
|
|
22
22
|
variant: e,
|
|
23
|
-
id: `image-skeleton-${
|
|
23
|
+
id: `image-skeleton-${l}`,
|
|
24
24
|
animation: "wave",
|
|
25
25
|
style: {
|
|
26
26
|
height: o,
|
|
27
27
|
width: s,
|
|
28
|
-
minWidth:
|
|
29
|
-
minHeight:
|
|
30
|
-
...
|
|
28
|
+
minWidth: t,
|
|
29
|
+
minHeight: u,
|
|
30
|
+
...r
|
|
31
31
|
// User styles applied to skeleton for consistency
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
),
|
|
35
35
|
/* @__PURE__ */ a.jsx(
|
|
36
|
-
|
|
36
|
+
m,
|
|
37
37
|
{
|
|
38
38
|
component: "img",
|
|
39
|
-
src:
|
|
39
|
+
src: n,
|
|
40
40
|
style: {
|
|
41
41
|
height: o,
|
|
42
42
|
width: s,
|
|
43
|
+
minWidth: t,
|
|
44
|
+
minHeight: u,
|
|
43
45
|
// Performance optimization: display toggling instead of opacity transitions
|
|
44
46
|
// This approach reduces GPU usage and improves rendering performance
|
|
45
|
-
display:
|
|
47
|
+
display: d ? "block" : "none",
|
|
46
48
|
// Theme-aware border radius calculation for consistent styling
|
|
47
49
|
// Matches Material-UI skeleton variants with proper theme integration
|
|
48
|
-
borderRadius: e === "circular" ? "50%" : e === "rounded" ?
|
|
49
|
-
...
|
|
50
|
+
borderRadius: e === "circular" ? "50%" : e === "rounded" ? p.shape.borderRadius : "0px",
|
|
51
|
+
...r
|
|
50
52
|
// User-provided styles override defaults
|
|
51
53
|
},
|
|
52
54
|
onLoad: () => {
|
|
53
|
-
|
|
55
|
+
x(!0);
|
|
54
56
|
},
|
|
55
|
-
...
|
|
57
|
+
...c
|
|
56
58
|
}
|
|
57
59
|
)
|
|
58
60
|
] })
|
|
59
61
|
);
|
|
60
62
|
};
|
|
61
63
|
export {
|
|
62
|
-
|
|
64
|
+
I as default
|
|
63
65
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration interface for spotlight effect appearance and behavior
|
|
4
|
+
*/
|
|
5
|
+
export interface SpotlightConfig {
|
|
6
|
+
/** Radius of the spotlight effect in pixels (recommended: 50-500) */
|
|
7
|
+
radius: number;
|
|
8
|
+
/** Brightness/opacity of the spotlight effect (range: 0-1, where 0 is invisible and 1 is fully opaque) */
|
|
9
|
+
brightness: number;
|
|
10
|
+
/** Color of the spotlight effect in hexadecimal format (e.g., '#ff0000', '#00ff00') */
|
|
11
|
+
color: string;
|
|
12
|
+
/** Smoothing factor for cursor movement - reserved for future implementation */
|
|
13
|
+
smoothing: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Props interface for the SSpotlightCursor component
|
|
17
|
+
*/
|
|
18
|
+
export interface SSpotlightCursorProps extends HTMLAttributes<HTMLCanvasElement> {
|
|
19
|
+
/** Configuration object for spotlight appearance and behavior. If not provided, uses default blue spotlight */
|
|
20
|
+
config?: SpotlightConfig;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* SSpotlightCursor - Creates an interactive spotlight effect that follows the mouse cursor
|
|
24
|
+
*
|
|
25
|
+
* This component renders a full-screen HTML5 canvas with a radial gradient spotlight that
|
|
26
|
+
* smoothly tracks the user's mouse movement. The spotlight effect is highly customizable
|
|
27
|
+
* and optimized for performance using requestAnimationFrame.
|
|
28
|
+
*
|
|
29
|
+
* Key features:
|
|
30
|
+
* - Mouse-following spotlight with smooth animation
|
|
31
|
+
* - Customizable radius, brightness, color, and smoothing
|
|
32
|
+
* - Performance-optimized with proper cleanup
|
|
33
|
+
* - Responsive design that adapts to window resizing
|
|
34
|
+
* - Non-interfering overlay (pointer-events: none)
|
|
35
|
+
* - Memory-safe event listener management
|
|
36
|
+
*
|
|
37
|
+
* Technical implementation:
|
|
38
|
+
* - Uses HTML5 Canvas with 2D context for rendering
|
|
39
|
+
* - Implements radial gradient for spotlight effect
|
|
40
|
+
* - Leverages requestAnimationFrame for 60fps animations
|
|
41
|
+
* - Automatically handles canvas sizing and viewport changes
|
|
42
|
+
* - Converts hex colors to RGB for gradient creation
|
|
43
|
+
*
|
|
44
|
+
* @param props - SSpotlightCursorProps containing configuration and styling options
|
|
45
|
+
* @returns JSX.Element - Fixed-positioned canvas element rendering the spotlight effect
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Basic usage with default blue spotlight
|
|
49
|
+
* <SSpotlightCursor />
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* // Custom orange spotlight with larger radius
|
|
53
|
+
* <SSpotlightCursor
|
|
54
|
+
* config={{
|
|
55
|
+
* radius: 300,
|
|
56
|
+
* brightness: 0.25,
|
|
57
|
+
* color: '#ff6b35',
|
|
58
|
+
* smoothing: 0.1
|
|
59
|
+
* }}
|
|
60
|
+
* />
|
|
61
|
+
*/
|
|
62
|
+
declare const SSpotlightCursor: ({ config, className, ...props }: SSpotlightCursorProps) => import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
export default SSpotlightCursor;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { j as g } from "../jsx-runtime-DywqP_6a.js";
|
|
2
|
+
import { useRef as p, useEffect as x } from "react";
|
|
3
|
+
import { Box as E } from "@mui/material";
|
|
4
|
+
const b = (t) => {
|
|
5
|
+
const a = p(null);
|
|
6
|
+
return x(() => {
|
|
7
|
+
const e = a.current;
|
|
8
|
+
if (!e) return;
|
|
9
|
+
const o = e.getContext("2d");
|
|
10
|
+
if (!o) return;
|
|
11
|
+
let d, r = -1e3, s = -1e3;
|
|
12
|
+
const c = () => {
|
|
13
|
+
e.width = window.innerWidth, e.height = window.innerHeight;
|
|
14
|
+
}, l = (n) => {
|
|
15
|
+
r = n.clientX, s = n.clientY;
|
|
16
|
+
}, m = () => {
|
|
17
|
+
r = -1e3, s = -1e3;
|
|
18
|
+
}, h = (n) => {
|
|
19
|
+
const i = parseInt(n.slice(1), 16), w = i >> 16 & 255, v = i >> 8 & 255, f = i & 255;
|
|
20
|
+
return `${w},${v},${f}`;
|
|
21
|
+
}, u = () => {
|
|
22
|
+
if (o.clearRect(0, 0, e.width, e.height), r !== -1e3 && s !== -1e3) {
|
|
23
|
+
const n = o.createRadialGradient(r, s, 0, r, s, t.radius || 200), i = h(t.color);
|
|
24
|
+
n.addColorStop(0, `rgba(${i}, ${t.brightness})`), n.addColorStop(1, "rgba(0,0,0,0)"), o.fillStyle = n, o.fillRect(0, 0, e.width, e.height);
|
|
25
|
+
}
|
|
26
|
+
d = requestAnimationFrame(u);
|
|
27
|
+
};
|
|
28
|
+
return c(), window.addEventListener("resize", c), window.addEventListener("mousemove", l), window.addEventListener("mouseleave", m), d = requestAnimationFrame(u), () => {
|
|
29
|
+
window.removeEventListener("resize", c), window.removeEventListener("mousemove", l), window.removeEventListener("mouseleave", m), cancelAnimationFrame(d);
|
|
30
|
+
};
|
|
31
|
+
}, [t.radius, t.brightness, t.color]), a;
|
|
32
|
+
}, S = ({
|
|
33
|
+
config: t = { radius: 200, brightness: 0.15, color: "#0000ff", smoothing: 0.1 },
|
|
34
|
+
className: a,
|
|
35
|
+
...e
|
|
36
|
+
}) => {
|
|
37
|
+
const o = b(t);
|
|
38
|
+
return /* @__PURE__ */ g.jsx(
|
|
39
|
+
E,
|
|
40
|
+
{
|
|
41
|
+
component: "canvas",
|
|
42
|
+
ref: o,
|
|
43
|
+
className: a,
|
|
44
|
+
sx: {
|
|
45
|
+
position: "fixed",
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
pointerEvents: "none",
|
|
49
|
+
zIndex: 9999,
|
|
50
|
+
width: "100%",
|
|
51
|
+
height: "100%"
|
|
52
|
+
},
|
|
53
|
+
...e
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
S as default
|
|
59
|
+
};
|
|
@@ -10,6 +10,10 @@ export declare const MuiAlert: {
|
|
|
10
10
|
color: string;
|
|
11
11
|
'& .MuiAlert-icon': {
|
|
12
12
|
color: string;
|
|
13
|
+
alignSelf: string;
|
|
14
|
+
};
|
|
15
|
+
'& .MuiAlert-message': {
|
|
16
|
+
alignSelf: string;
|
|
13
17
|
};
|
|
14
18
|
backgroundColor: string;
|
|
15
19
|
border: string;
|
|
@@ -22,6 +26,10 @@ export declare const MuiAlert: {
|
|
|
22
26
|
color: string;
|
|
23
27
|
'& .MuiAlert-icon': {
|
|
24
28
|
color: string;
|
|
29
|
+
alignSelf: string;
|
|
30
|
+
};
|
|
31
|
+
'& .MuiAlert-message': {
|
|
32
|
+
alignSelf: string;
|
|
25
33
|
};
|
|
26
34
|
backgroundColor: string;
|
|
27
35
|
border: string;
|
|
@@ -34,6 +42,10 @@ export declare const MuiAlert: {
|
|
|
34
42
|
color: string;
|
|
35
43
|
'& .MuiAlert-icon': {
|
|
36
44
|
color: string;
|
|
45
|
+
alignSelf: string;
|
|
46
|
+
};
|
|
47
|
+
'& .MuiAlert-message': {
|
|
48
|
+
alignSelf: string;
|
|
37
49
|
};
|
|
38
50
|
backgroundColor: string;
|
|
39
51
|
border: string;
|
|
@@ -46,6 +58,10 @@ export declare const MuiAlert: {
|
|
|
46
58
|
color: string;
|
|
47
59
|
'& .MuiAlert-icon': {
|
|
48
60
|
color: string;
|
|
61
|
+
alignSelf: string;
|
|
62
|
+
};
|
|
63
|
+
'& .MuiAlert-message': {
|
|
64
|
+
alignSelf: string;
|
|
49
65
|
};
|
|
50
66
|
backgroundColor: string;
|
|
51
67
|
border: string;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { alpha as s } from "@mui/material";
|
|
2
|
-
import { green as o, red as i, orange as t, blue as
|
|
2
|
+
import { green as o, red as i, orange as t, blue as n } from "../theme-primitives.js";
|
|
3
3
|
const e = (r) => ({
|
|
4
4
|
color: r[50],
|
|
5
5
|
"& .MuiAlert-icon": {
|
|
6
|
-
color: r[500]
|
|
6
|
+
color: r[500],
|
|
7
|
+
alignSelf: "center"
|
|
7
8
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
9
|
+
"& .MuiAlert-message": {
|
|
10
|
+
alignSelf: "center"
|
|
11
|
+
},
|
|
12
|
+
backgroundColor: `${s(r[900], 0.9)}`,
|
|
13
|
+
border: `1px solid ${s(r[800], 0.8)}`
|
|
14
|
+
}), y = {
|
|
11
15
|
styleOverrides: {
|
|
12
16
|
root: () => ({
|
|
13
17
|
borderRadius: 10,
|
|
@@ -41,7 +45,7 @@ const e = (r) => ({
|
|
|
41
45
|
severity: "info"
|
|
42
46
|
},
|
|
43
47
|
style: {
|
|
44
|
-
...e(
|
|
48
|
+
...e(n)
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
]
|
|
@@ -49,5 +53,5 @@ const e = (r) => ({
|
|
|
49
53
|
}
|
|
50
54
|
};
|
|
51
55
|
export {
|
|
52
|
-
|
|
56
|
+
y as MuiAlert
|
|
53
57
|
};
|
|
@@ -6049,6 +6049,10 @@ export declare const components: {
|
|
|
6049
6049
|
color: string;
|
|
6050
6050
|
'& .MuiAlert-icon': {
|
|
6051
6051
|
color: string;
|
|
6052
|
+
alignSelf: string;
|
|
6053
|
+
};
|
|
6054
|
+
'& .MuiAlert-message': {
|
|
6055
|
+
alignSelf: string;
|
|
6052
6056
|
};
|
|
6053
6057
|
backgroundColor: string;
|
|
6054
6058
|
border: string;
|
|
@@ -6061,6 +6065,10 @@ export declare const components: {
|
|
|
6061
6065
|
color: string;
|
|
6062
6066
|
'& .MuiAlert-icon': {
|
|
6063
6067
|
color: string;
|
|
6068
|
+
alignSelf: string;
|
|
6069
|
+
};
|
|
6070
|
+
'& .MuiAlert-message': {
|
|
6071
|
+
alignSelf: string;
|
|
6064
6072
|
};
|
|
6065
6073
|
backgroundColor: string;
|
|
6066
6074
|
border: string;
|
|
@@ -6073,6 +6081,10 @@ export declare const components: {
|
|
|
6073
6081
|
color: string;
|
|
6074
6082
|
'& .MuiAlert-icon': {
|
|
6075
6083
|
color: string;
|
|
6084
|
+
alignSelf: string;
|
|
6085
|
+
};
|
|
6086
|
+
'& .MuiAlert-message': {
|
|
6087
|
+
alignSelf: string;
|
|
6076
6088
|
};
|
|
6077
6089
|
backgroundColor: string;
|
|
6078
6090
|
border: string;
|
|
@@ -6085,6 +6097,10 @@ export declare const components: {
|
|
|
6085
6097
|
color: string;
|
|
6086
6098
|
'& .MuiAlert-icon': {
|
|
6087
6099
|
color: string;
|
|
6100
|
+
alignSelf: string;
|
|
6101
|
+
};
|
|
6102
|
+
'& .MuiAlert-message': {
|
|
6103
|
+
alignSelf: string;
|
|
6088
6104
|
};
|
|
6089
6105
|
backgroundColor: string;
|
|
6090
6106
|
border: string;
|