@solostylist/ui-kit 1.0.167 → 1.0.169
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/{Typography-B7LOtCzI.js → Typography-C8jwvSWe.js} +1 -1
- package/dist/main.d.ts +5 -3
- package/dist/main.js +187 -173
- package/dist/s-accordion/index.js +2 -2
- package/dist/s-accordion/s-accordion.d.ts +17 -1
- package/dist/s-accordion/s-accordion.js +252 -238
- package/dist/s-action-overlay/index.js +1 -1
- package/dist/s-action-overlay/s-action-overlay.d.ts +34 -1
- package/dist/s-action-overlay/s-action-overlay.js +67 -55
- package/dist/s-ai-tool-bar/index.d.ts +2 -0
- package/dist/s-ai-tool-bar/index.js +3 -2
- package/dist/s-ai-tool-bar/s-ai-tool-bar.d.ts +33 -22
- package/dist/s-ai-tool-bar/s-ai-tool-bar.js +295 -247
- package/dist/s-autocomplete/index.js +2 -2
- package/dist/s-autocomplete/s-autocomplete.d.ts +13 -15
- package/dist/s-autocomplete/s-autocomplete.js +25 -17
- package/dist/s-avatar/index.js +2 -2
- package/dist/s-avatar/s-avatar.d.ts +16 -1
- package/dist/s-avatar/s-avatar.js +23 -10
- package/dist/s-blur-text/index.js +2 -2
- package/dist/s-blur-text/s-blur-text.d.ts +4 -13
- package/dist/s-blur-text/s-blur-text.js +57 -51
- package/dist/s-breadcrumbs/index.js +2 -2
- package/dist/s-breadcrumbs/s-breadcrumbs.d.ts +20 -1
- package/dist/s-breadcrumbs/s-breadcrumbs.js +39 -30
- package/dist/s-button/index.js +2 -2
- package/dist/s-button/s-button.d.ts +7 -1
- package/dist/s-button/s-button.js +15 -5
- package/dist/s-button-link/index.js +2 -2
- package/dist/s-button-link/s-button-link.d.ts +12 -26
- package/dist/s-button-link/s-button-link.js +36 -26
- package/dist/s-carousel/index.js +1 -1
- package/dist/s-carousel/s-carousel.d.ts +11 -1
- package/dist/s-carousel/s-carousel.js +233 -223
- package/dist/s-category-card/index.js +2 -2
- package/dist/s-category-card/s-category-card.d.ts +28 -1
- package/dist/s-category-card/s-category-card.js +77 -58
- package/dist/s-chat-input/index.js +2 -2
- package/dist/s-chat-input/s-chat-input.d.ts +12 -1
- package/dist/s-chat-input/s-chat-input.js +92 -82
- package/dist/s-chat-message/index.js +2 -2
- package/dist/s-chat-message/s-chat-message.d.ts +22 -1
- package/dist/s-chat-message/s-chat-message.js +144 -133
- package/dist/s-checkbox/index.js +2 -2
- package/dist/s-checkbox/s-checkbox.d.ts +2 -15
- package/dist/s-checkbox/s-checkbox.js +20 -10
- package/dist/s-chip/index.js +2 -2
- package/dist/s-chip/s-chip.d.ts +7 -1
- package/dist/s-chip/s-chip.js +15 -5
- package/dist/s-chips/index.js +2 -2
- package/dist/s-chips/s-chips.d.ts +5 -18
- package/dist/s-chips/s-chips.js +56 -41
- package/dist/s-comment-message/index.js +2 -2
- package/dist/s-comment-message/s-comment-message.d.ts +26 -1
- package/dist/s-comment-message/s-comment-message.js +95 -89
- package/dist/s-copyable-text/index.js +1 -1
- package/dist/s-copyable-text/s-copyable-text.d.ts +9 -36
- package/dist/s-copyable-text/s-copyable-text.js +31 -21
- package/dist/s-countdown/index.d.ts +3 -2
- package/dist/s-countdown/index.js +4 -3
- package/dist/s-countdown/s-count-box.d.ts +39 -0
- package/dist/s-countdown/s-count-box.js +112 -0
- package/dist/s-countdown/s-count-down.d.ts +6 -50
- package/dist/s-countdown/s-count-down.js +110 -175
- package/dist/s-data-table/index.js +2 -2
- package/dist/s-data-table/s-data-table.d.ts +9 -65
- package/dist/s-data-table/s-data-table.js +381 -371
- package/dist/s-date-picker/index.js +2 -2
- package/dist/s-date-picker/s-date-picker.d.ts +6 -17
- package/dist/s-date-picker/s-date-picker.js +124 -107
- package/dist/s-datetime-picker/index.js +2 -2
- package/dist/s-datetime-picker/s-datetime-picker.d.ts +5 -16
- package/dist/s-datetime-picker/s-datetime-picker.js +897 -887
- package/dist/s-dialog/index.js +2 -2
- package/dist/s-dialog/s-dialog.d.ts +3 -16
- package/dist/s-dialog/s-dialog.js +32 -23
- package/dist/s-dialog-confirm/index.js +3 -3
- package/dist/s-dialog-confirm/s-dialog-confirm.d.ts +5 -13
- package/dist/s-dialog-confirm/s-dialog-confirm.js +55 -48
- package/dist/s-dialog-message/index.js +4 -4
- package/dist/s-dialog-message/s-dialog-message.d.ts +5 -15
- package/dist/s-dialog-message/s-dialog-message.js +45 -38
- package/dist/s-empty/index.js +2 -2
- package/dist/s-empty/s-empty.d.ts +5 -20
- package/dist/s-empty/s-empty.js +14 -4
- package/dist/s-error/index.js +2 -2
- package/dist/s-error/s-error.d.ts +5 -20
- package/dist/s-error/s-error.js +16 -6
- package/dist/s-error-layout/index.js +2 -2
- package/dist/s-error-layout/s-error-layout.d.ts +6 -1
- package/dist/s-error-layout/s-error-layout.js +60 -51
- package/dist/s-file-dropzone/index.js +2 -2
- package/dist/s-file-dropzone/s-file-dropzone.d.ts +6 -51
- package/dist/s-file-dropzone/s-file-dropzone.js +64 -54
- package/dist/s-file-icon/index.js +2 -2
- package/dist/s-file-icon/s-file-icon.d.ts +5 -25
- package/dist/s-file-icon/s-file-icon.js +14 -8
- package/dist/s-flex-box/index.js +2 -2
- package/dist/s-flex-box/s-flex-box.d.ts +10 -1
- package/dist/s-flex-box/s-flex-box.js +14 -4
- package/dist/s-form/index.js +2 -2
- package/dist/s-form/s-form.d.ts +5 -14
- package/dist/s-form/s-form.js +19 -9
- package/dist/s-gallery/index.js +33 -3
- package/dist/s-gallery/s-gallery.d.ts +3 -36
- package/dist/s-gallery/s-gallery.js +108 -78
- package/dist/s-glow-button/s-glow-button.d.ts +6 -42
- package/dist/s-glow-button/s-glow-button.js +29 -47
- package/dist/s-gradient-icon/index.d.ts +1 -1
- package/dist/s-gradient-icon/index.js +1 -1
- package/dist/s-gradient-icon/s-gradient-icon.d.ts +8 -68
- package/dist/s-gradient-icon/s-gradient-icon.js +54 -44
- package/dist/s-i18n-provider/index.js +1 -1
- package/dist/s-i18n-provider/s-i18n-provider.d.ts +5 -33
- package/dist/s-i18n-provider/s-i18n-provider.js +25 -15
- package/dist/s-icon-button/index.js +2 -2
- package/dist/s-icon-button/s-icon-button.d.ts +6 -19
- package/dist/s-icon-button/s-icon-button.js +14 -4
- package/dist/s-image-comparison/s-image-comparison.js +50 -45
- package/dist/s-image-modal/index.js +3 -3
- package/dist/s-image-modal/s-image-modal.d.ts +4 -20
- package/dist/s-image-modal/s-image-modal.js +150 -135
- package/dist/s-item-not-found/index.js +2 -2
- package/dist/s-item-not-found/s-item-not-found.d.ts +14 -1
- package/dist/s-item-not-found/s-item-not-found.js +21 -10
- package/dist/s-label/index.js +2 -2
- package/dist/s-label/s-label.d.ts +9 -25
- package/dist/s-label/s-label.js +19 -9
- package/dist/s-language-switcher/index.js +3 -3
- package/dist/s-language-switcher/s-language-switcher.d.ts +20 -33
- package/dist/s-language-switcher/s-language-switcher.js +137 -115
- package/dist/s-lazy-image/index.js +10 -2
- package/dist/s-lazy-image/s-lazy-image.d.ts +12 -58
- package/dist/s-lazy-image/s-lazy-image.js +53 -58
- package/dist/s-localization-provider/index.js +2 -2
- package/dist/s-localization-provider/s-localization-provider.d.ts +6 -27
- package/dist/s-localization-provider/s-localization-provider.js +157 -149
- package/dist/s-moving-border/index.js +2 -2
- package/dist/s-moving-border/s-moving-border.d.ts +3 -33
- package/dist/s-moving-border/s-moving-border.js +65 -55
- package/dist/s-multi-select/index.js +2 -2
- package/dist/s-multi-select/s-multi-select.d.ts +5 -15
- package/dist/s-multi-select/s-multi-select.js +54 -45
- package/dist/s-no-ssr/index.js +2 -2
- package/dist/s-no-ssr/s-no-ssr.d.ts +5 -33
- package/dist/s-no-ssr/s-no-ssr.js +21 -11
- package/dist/s-overlay-scrollbar/index.js +2 -2
- package/dist/s-overlay-scrollbar/s-overlay-scrollbar.d.ts +10 -1
- package/dist/s-overlay-scrollbar/s-overlay-scrollbar.js +16 -11
- package/dist/s-pagination/index.js +2 -2
- package/dist/s-pagination/s-pagination.d.ts +5 -23
- package/dist/s-pagination/s-pagination.js +17 -11
- package/dist/s-pixel-reveal/index.js +2 -2
- package/dist/s-pixel-reveal/s-pixel-reveal.d.ts +15 -1
- package/dist/s-pixel-reveal/s-pixel-reveal.js +83 -78
- package/dist/s-radial-pulse-animate/index.js +2 -2
- package/dist/s-radial-pulse-animate/s-radial-pulse-animate.d.ts +12 -1
- package/dist/s-radial-pulse-animate/s-radial-pulse-animate.js +52 -42
- package/dist/s-rating/index.js +2 -2
- package/dist/s-rating/s-rating.d.ts +7 -1
- package/dist/s-rating/s-rating.js +15 -5
- package/dist/s-review/index.js +2 -2
- package/dist/s-review/s-review.d.ts +25 -1
- package/dist/s-review/s-review.js +104 -97
- package/dist/s-scroll-reveal/index.js +2 -2
- package/dist/s-scroll-reveal/s-scroll-reveal.d.ts +17 -36
- package/dist/s-scroll-reveal/s-scroll-reveal.js +43 -33
- package/dist/s-scroll-to-top/index.js +2 -2
- package/dist/s-scroll-to-top/s-scroll-to-top.d.ts +12 -17
- package/dist/s-scroll-to-top/s-scroll-to-top.js +20 -15
- package/dist/s-scroll-velocity/index.d.ts +6 -0
- package/dist/s-scroll-velocity/index.js +8 -0
- package/dist/s-scroll-velocity/package.json +5 -0
- package/dist/s-scroll-velocity/s-scroll-velocity.d.ts +24 -0
- package/dist/s-scroll-velocity/s-scroll-velocity.js +22 -0
- package/dist/s-scroll-velocity/scroll-velocity-container.d.ts +20 -0
- package/dist/s-scroll-velocity/scroll-velocity-container.js +40 -0
- package/dist/s-scroll-velocity/scroll-velocity-row.d.ts +27 -0
- package/dist/s-scroll-velocity/scroll-velocity-row.js +131 -0
- package/dist/s-select/index.js +2 -2
- package/dist/s-select/s-select.d.ts +3 -22
- package/dist/s-select/s-select.js +76 -72
- package/dist/s-select-list/index.js +2 -2
- package/dist/s-select-list/s-select-list.d.ts +16 -19
- package/dist/s-select-list/s-select-list.js +33 -28
- package/dist/s-skeleton/index.js +2 -2
- package/dist/s-skeleton/s-skeleton.d.ts +6 -22
- package/dist/s-skeleton/s-skeleton.js +28 -18
- package/dist/s-snackbar-message/index.js +4 -4
- package/dist/s-snackbar-message/s-snackbar-message.d.ts +5 -23
- package/dist/s-snackbar-message/s-snackbar-message.js +38 -31
- package/dist/s-spotlight-cursor/index.js +2 -2
- package/dist/s-spotlight-cursor/s-spotlight-cursor.d.ts +10 -44
- package/dist/s-spotlight-cursor/s-spotlight-cursor.js +35 -29
- package/dist/s-stripe/index.d.ts +4 -1
- package/dist/s-stripe/index.js +7 -4
- package/dist/s-stripe/s-stripe-cvc.d.ts +8 -0
- package/dist/s-stripe/s-stripe-cvc.js +15 -0
- package/dist/s-stripe/s-stripe-expiry.d.ts +8 -0
- package/dist/s-stripe/s-stripe-expiry.js +15 -0
- package/dist/s-stripe/s-stripe-number.d.ts +8 -0
- package/dist/s-stripe/s-stripe-number.js +15 -0
- package/dist/s-stripe/s-stripe.d.ts +6 -85
- package/dist/s-stripe/s-stripe.js +24 -27
- package/dist/s-stripe/stripe-input.js +22 -18
- package/dist/s-tabs/index.js +6 -6
- package/dist/s-tabs/s-tab-panel.d.ts +11 -1
- package/dist/s-tabs/s-tab-panel.js +25 -16
- package/dist/s-tabs/s-tab.js +9 -5
- package/dist/s-tabs/s-tabs.d.ts +24 -3
- package/dist/s-tabs/s-tabs.js +34 -25
- package/dist/s-text-editor/index.js +3 -3
- package/dist/s-text-editor/s-text-editor-toolbar.js +91 -76
- package/dist/s-text-editor/s-text-editor.d.ts +13 -11
- package/dist/s-text-editor/s-text-editor.js +44 -30
- package/dist/s-text-field/index.js +2 -2
- package/dist/s-text-field/s-text-field.d.ts +6 -15
- package/dist/s-text-field/s-text-field.js +38 -28
- package/dist/s-text-shimmer/index.js +2 -2
- package/dist/s-text-shimmer/s-text-shimmer.d.ts +10 -1
- package/dist/s-text-shimmer/s-text-shimmer.js +27 -18
- package/dist/s-text-truncation/index.js +2 -2
- package/dist/s-text-truncation/s-text-truncation.d.ts +9 -38
- package/dist/s-text-truncation/s-text-truncation.js +34 -20
- package/dist/s-theme-demo/s-theme-demo.js +238 -223
- package/dist/s-theme-provider/index.js +1 -1
- package/dist/s-theme-provider/s-theme-provider.d.ts +5 -17
- package/dist/s-theme-provider/s-theme-provider.js +44 -34
- package/dist/s-theme-switch/s-theme-switch.js +23 -19
- package/dist/s-tip/index.js +2 -2
- package/dist/s-tip/s-tip.d.ts +5 -22
- package/dist/s-tip/s-tip.js +22 -12
- package/dist/s-two-pane-layout/index.js +10 -2
- package/dist/s-two-pane-layout/s-two-pane-layout.d.ts +7 -1
- package/dist/s-two-pane-layout/s-two-pane-layout.js +58 -48
- package/dist/s-typewriter-text/index.js +2 -2
- package/dist/s-typewriter-text/s-typewriter-text.d.ts +17 -1
- package/dist/s-typewriter-text/s-typewriter-text.js +37 -27
- package/dist/s-zoom-image/index.js +10 -2
- package/dist/s-zoom-image/s-zoom-image.d.ts +10 -42
- package/dist/s-zoom-image/s-zoom-image.js +62 -52
- package/dist/theme/components/alert.d.ts +1436 -1436
- package/dist/theme/components/button.d.ts +2150 -2150
- package/dist/theme/components/chip.d.ts +2 -2
- package/dist/theme/customizations/data-display.js +1 -1
- package/dist/{typographyClasses-C7fhAsUD.js → typographyClasses-DDyl9mok.js} +4 -4
- package/dist/{useMobilePicker-DgxcRrRB.js → useMobilePicker-C1RZZUWr.js} +1 -1
- package/package.json +23 -6
|
@@ -12,22 +12,9 @@ export interface SChipsProps {
|
|
|
12
12
|
/** Text used in overflow chip (default: 'keywords') */
|
|
13
13
|
overflowText?: string;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* - Dynamic width calculation using DOM measurement
|
|
21
|
-
* - Tooltip display of hidden chips on hover
|
|
22
|
-
* - Click handling for individual chips
|
|
23
|
-
* - Automatic recalculation on window resize
|
|
24
|
-
* - Configurable overflow text for different use cases
|
|
25
|
-
*
|
|
26
|
-
* The component uses real DOM measurement to accurately calculate chip widths
|
|
27
|
-
* and determines how many chips can fit in the available space.
|
|
28
|
-
*
|
|
29
|
-
* @param props - SChipsProps with chips array and configuration options
|
|
30
|
-
* @returns JSX.Element - Responsive chip display with overflow handling
|
|
31
|
-
*/
|
|
32
|
-
declare const SChips: ({ chips, overflow, onClick, overflowText }: SChipsProps) => React.JSX.Element;
|
|
15
|
+
/** A smart chip display component that handles overflow with intelligent truncation. */
|
|
16
|
+
export declare const SChips: {
|
|
17
|
+
({ chips, overflow, onClick, overflowText, }: SChipsProps): React.JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
33
20
|
export default SChips;
|
package/dist/s-chips/s-chips.js
CHANGED
|
@@ -1,72 +1,77 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Box as
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { j as n } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
+
import { useRef as j, useState as c, useEffect as k } from "react";
|
|
3
|
+
import { Box as l, Chip as u, Tooltip as V } from "@mui/material";
|
|
4
|
+
const h = ({
|
|
5
|
+
chips: e,
|
|
6
|
+
overflow: s = !0,
|
|
7
|
+
onClick: a,
|
|
8
|
+
overflowText: m = "keywords"
|
|
9
|
+
}) => {
|
|
10
|
+
const f = j(null), [v, g] = c([]), [C, b] = c([]), [w, _] = c(0), p = () => {
|
|
11
|
+
var y;
|
|
12
|
+
const i = ((y = f.current) == null ? void 0 : y.offsetWidth) || 0;
|
|
13
|
+
let t = 0, r = 0;
|
|
14
|
+
for (let o = 0; o < e.length; o++) {
|
|
15
|
+
const x = d(e[o]);
|
|
16
|
+
if (t + x <= i)
|
|
17
|
+
t += x, r++;
|
|
13
18
|
else
|
|
14
19
|
break;
|
|
15
20
|
}
|
|
16
|
-
if (
|
|
17
|
-
const o = d(`+${
|
|
18
|
-
for (;
|
|
19
|
-
|
|
21
|
+
if (r < e.length) {
|
|
22
|
+
const o = d(`+${e.length - r} ${m}`);
|
|
23
|
+
for (; t + o > i && r > 0; )
|
|
24
|
+
r--, t -= d(e[r]);
|
|
20
25
|
}
|
|
21
|
-
|
|
22
|
-
}, d = (
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
return document.body.removeChild(
|
|
27
|
-
},
|
|
28
|
-
return
|
|
29
|
-
if (
|
|
26
|
+
g(e.slice(0, r)), b(e.slice(r)), _(e.length - r);
|
|
27
|
+
}, d = (i) => {
|
|
28
|
+
const t = document.createElement("span");
|
|
29
|
+
t.style.visibility = "hidden", t.style.position = "absolute", t.style.whiteSpace = "nowrap", t.textContent = i.trim(), document.body.appendChild(t);
|
|
30
|
+
const r = t.offsetWidth;
|
|
31
|
+
return document.body.removeChild(t), r + 16;
|
|
32
|
+
}, W = s ? { textOverflow: "ellipsis", whiteSpace: "nowrap", overflow: "hidden" } : {};
|
|
33
|
+
return k(() => {
|
|
34
|
+
if (s)
|
|
30
35
|
return p(), window.addEventListener("resize", p), () => {
|
|
31
36
|
window.removeEventListener("resize", p);
|
|
32
37
|
};
|
|
33
|
-
}, [
|
|
34
|
-
(
|
|
35
|
-
|
|
38
|
+
}, [e, s]), /* @__PURE__ */ n.jsxs(l, { ref: f, display: "flex", maxWidth: "100%", flexWrap: s ? "nowrap" : "wrap", ...W, children: [
|
|
39
|
+
(s ? v : e).map((i) => /* @__PURE__ */ n.jsx(
|
|
40
|
+
l,
|
|
36
41
|
{
|
|
37
42
|
component: "span",
|
|
38
43
|
textTransform: "lowercase",
|
|
39
44
|
onClick: () => {
|
|
40
|
-
|
|
45
|
+
a == null || a(i);
|
|
41
46
|
},
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
|
|
47
|
+
children: /* @__PURE__ */ n.jsx(
|
|
48
|
+
u,
|
|
44
49
|
{
|
|
45
|
-
label:
|
|
50
|
+
label: i.trim(),
|
|
46
51
|
sx: {
|
|
47
52
|
mr: 1,
|
|
48
53
|
mb: 1,
|
|
49
54
|
userSelect: "none",
|
|
50
|
-
cursor:
|
|
55
|
+
cursor: a ? "pointer" : "default"
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
58
|
)
|
|
54
59
|
},
|
|
55
|
-
|
|
60
|
+
i
|
|
56
61
|
)),
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
s && w > 0 && /* @__PURE__ */ n.jsx(
|
|
63
|
+
V,
|
|
59
64
|
{
|
|
60
65
|
slotProps: {
|
|
61
66
|
tooltip: { style: { padding: "0.5rem" } }
|
|
62
67
|
},
|
|
63
68
|
arrow: !0,
|
|
64
69
|
placement: "top",
|
|
65
|
-
title: /* @__PURE__ */
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
-
|
|
70
|
+
title: /* @__PURE__ */ n.jsx(l, { display: "flex", gap: 1, maxWidth: "240px", flexWrap: "wrap", children: C.map((i) => /* @__PURE__ */ n.jsx(u, { label: i.trim() }, i)) }),
|
|
71
|
+
children: /* @__PURE__ */ n.jsx(l, { component: "span", textTransform: "lowercase", children: /* @__PURE__ */ n.jsx(
|
|
72
|
+
u,
|
|
68
73
|
{
|
|
69
|
-
label: `+${
|
|
74
|
+
label: `+${w} ${m}`,
|
|
70
75
|
variant: "outlined",
|
|
71
76
|
sx: { mr: 1, mb: 1, userSelect: "none", cursor: "pointer" }
|
|
72
77
|
}
|
|
@@ -75,6 +80,16 @@ const L = ({ chips: n, overflow: r = !0, onClick: l, overflowText: c = "keywords
|
|
|
75
80
|
)
|
|
76
81
|
] });
|
|
77
82
|
};
|
|
83
|
+
h.displayName = "SChips";
|
|
84
|
+
try {
|
|
85
|
+
h.displayName = "SChips", h.__docgenInfo = { description: "A smart chip display component that handles overflow with intelligent truncation.", displayName: "SChips", props: { chips: { defaultValue: null, description: "Array of strings to display as chips", name: "chips", required: !0, type: { name: "string[]" } }, overflow: { defaultValue: { value: "true" }, description: "Whether to handle overflow with '+N more' chip (default: true)", name: "overflow", required: !1, type: { name: "boolean" } }, onClick: { defaultValue: null, description: "Callback fired when a chip is clicked", name: "onClick", required: !1, type: { name: "((tag: string) => void)" } }, overflowText: { defaultValue: { value: "keywords" }, description: "Text used in overflow chip (default: 'keywords')", name: "overflowText", required: !1, type: { name: "string" } } } };
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
schips.displayName = "schips", schips.__docgenInfo = { description: "A smart chip display component that handles overflow with intelligent truncation.", displayName: "schips", props: { chips: { defaultValue: null, description: "Array of strings to display as chips", name: "chips", required: !0, type: { name: "string[]" } }, overflow: { defaultValue: { value: "true" }, description: "Whether to handle overflow with '+N more' chip (default: true)", name: "overflow", required: !1, type: { name: "boolean" } }, onClick: { defaultValue: null, description: "Callback fired when a chip is clicked", name: "onClick", required: !1, type: { name: "((tag: string) => void)" } }, overflowText: { defaultValue: { value: "keywords" }, description: "Text used in overflow chip (default: 'keywords')", name: "overflowText", required: !1, type: { name: "string" } } } };
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
78
92
|
export {
|
|
79
|
-
|
|
93
|
+
h as SChips,
|
|
94
|
+
h as default
|
|
80
95
|
};
|
|
@@ -1,25 +1,50 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { SxProps } from '@mui/material';
|
|
3
|
+
/**
|
|
4
|
+
* Props interface for SCommentMessage component
|
|
5
|
+
*/
|
|
3
6
|
export interface SCommentMessageProps {
|
|
7
|
+
/** Unique identifier for the comment */
|
|
4
8
|
id?: string | number;
|
|
9
|
+
/** Name of the user who posted the comment */
|
|
5
10
|
userName: string;
|
|
11
|
+
/** URL of the user avatar image */
|
|
6
12
|
userAvatar?: string;
|
|
13
|
+
/** The text content of the comment */
|
|
7
14
|
commentContent: string;
|
|
15
|
+
/** Date/time when the comment was posted */
|
|
8
16
|
datetime: Date | string;
|
|
17
|
+
/** Number of likes the comment has received */
|
|
9
18
|
likes?: number;
|
|
19
|
+
/** Whether the current user has liked this comment */
|
|
10
20
|
isLiked?: boolean;
|
|
21
|
+
/** Array of reply comments */
|
|
11
22
|
replies?: SCommentMessageProps[];
|
|
23
|
+
/** Total count of replies to display */
|
|
12
24
|
totalReplies?: number;
|
|
25
|
+
/** Callback function triggered when the like button is clicked */
|
|
13
26
|
onLike?: (commentId: string | number) => void;
|
|
27
|
+
/** Callback function triggered when the reply button is clicked */
|
|
14
28
|
onReply?: (commentId: string | number, parentId?: string | number) => void;
|
|
29
|
+
/** Callback function triggered when the expand/collapse replies button is clicked */
|
|
15
30
|
onToggleReplies?: (commentId: string | number) => void;
|
|
31
|
+
/** Whether to show replies and the expand/collapse functionality */
|
|
16
32
|
showReplies?: boolean;
|
|
33
|
+
/** Size of the avatar in pixels */
|
|
17
34
|
avatarSize?: number;
|
|
35
|
+
/** Current nesting level of the comment */
|
|
18
36
|
level?: number;
|
|
37
|
+
/** Maximum nesting level allowed before stopping further indentation */
|
|
19
38
|
maxLevel?: number;
|
|
39
|
+
/** Whether to show skeleton loading state instead of content */
|
|
20
40
|
loading?: boolean;
|
|
41
|
+
/** Custom content to display below the comment actions */
|
|
21
42
|
children?: React.ReactNode;
|
|
43
|
+
/** Material-UI sx prop for custom styling */
|
|
22
44
|
sx?: SxProps;
|
|
23
45
|
}
|
|
24
|
-
|
|
46
|
+
/**
|
|
47
|
+
* A comprehensive comment message component with avatar display, user information, relative timestamps, like functionality, and nested reply support.
|
|
48
|
+
*/
|
|
49
|
+
export declare const SCommentMessage: React.FC<SCommentMessageProps>;
|
|
25
50
|
export default SCommentMessage;
|
|
@@ -1,125 +1,131 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Box as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { F as
|
|
7
|
-
import { c as
|
|
8
|
-
import { E as
|
|
9
|
-
const
|
|
1
|
+
import { j as e } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
+
import { useState as M, useEffect as _ } from "react";
|
|
3
|
+
import { Box as d, Stack as m, Typography as h, IconButton as U, Button as N, Collapse as H } from "@mui/material";
|
|
4
|
+
import { SAvatar as Y } from "../s-avatar/s-avatar.js";
|
|
5
|
+
import { SSkeleton as t } from "../s-skeleton/s-skeleton.js";
|
|
6
|
+
import { F as G } from "../Favorite-DS5Gpq2s.js";
|
|
7
|
+
import { c as C } from "../createSvgIcon-DxwgGAVe.js";
|
|
8
|
+
import { E as J } from "../ExpandMore-DTWX_mHf.js";
|
|
9
|
+
const K = C(/* @__PURE__ */ e.jsx("path", {
|
|
10
10
|
d: "m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"
|
|
11
|
-
}), "ExpandLess"),
|
|
11
|
+
}), "ExpandLess"), O = C(/* @__PURE__ */ e.jsx("path", {
|
|
12
12
|
d: "M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3m-4.4 15.55-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05"
|
|
13
|
-
}), "FavoriteBorder"),
|
|
13
|
+
}), "FavoriteBorder"), Q = C(/* @__PURE__ */ e.jsx("path", {
|
|
14
14
|
d: "M10 9V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11"
|
|
15
|
-
}), "Reply"),
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
},
|
|
19
|
-
id:
|
|
20
|
-
userName:
|
|
21
|
-
userAvatar:
|
|
22
|
-
commentContent:
|
|
23
|
-
datetime:
|
|
24
|
-
likes:
|
|
25
|
-
isLiked:
|
|
26
|
-
replies:
|
|
27
|
-
totalReplies:
|
|
15
|
+
}), "Reply"), X = (a) => {
|
|
16
|
+
const u = /* @__PURE__ */ new Date(), g = typeof a == "string" ? new Date(a) : a, y = u.getTime() - g.getTime(), p = Math.floor(y / 1e3), i = Math.floor(p / 60), s = Math.floor(i / 60), n = Math.floor(s / 24), c = Math.floor(n / 7), r = Math.floor(n / 30), o = Math.floor(n / 365);
|
|
17
|
+
return p < 60 ? "just now" : i < 60 ? i === 1 ? "1 minute ago" : `${i} minutes ago` : s < 24 ? s === 1 ? "1 hour ago" : `${s} hours ago` : n < 7 ? n === 1 ? "1 day ago" : `${n} days ago` : c < 4 ? c === 1 ? "1 week ago" : `${c} weeks ago` : r < 12 ? r === 1 ? "1 month ago" : `${r} months ago` : o === 1 ? "1 year ago" : `${o} years ago`;
|
|
18
|
+
}, x = ({
|
|
19
|
+
id: a = Date.now(),
|
|
20
|
+
userName: u,
|
|
21
|
+
userAvatar: g,
|
|
22
|
+
commentContent: y,
|
|
23
|
+
datetime: p,
|
|
24
|
+
likes: i = 0,
|
|
25
|
+
isLiked: s = !1,
|
|
26
|
+
replies: n = [],
|
|
27
|
+
totalReplies: c,
|
|
28
28
|
onLike: r,
|
|
29
|
-
onReply:
|
|
30
|
-
onToggleReplies:
|
|
31
|
-
showReplies:
|
|
32
|
-
avatarSize:
|
|
33
|
-
level:
|
|
34
|
-
maxLevel:
|
|
35
|
-
loading:
|
|
36
|
-
children:
|
|
37
|
-
sx:
|
|
29
|
+
onReply: o,
|
|
30
|
+
onToggleReplies: q,
|
|
31
|
+
showReplies: v = !0,
|
|
32
|
+
avatarSize: f = 48,
|
|
33
|
+
level: S = 0,
|
|
34
|
+
maxLevel: V = 3,
|
|
35
|
+
loading: $ = !1,
|
|
36
|
+
children: L,
|
|
37
|
+
sx: R = {}
|
|
38
38
|
}) => {
|
|
39
|
-
const [
|
|
40
|
-
w ? (
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
39
|
+
const [z, j] = M(i), [w, b] = M(s), [I, E] = M(!1), A = () => {
|
|
40
|
+
w ? (j((l) => Math.max(0, l - 1)), b(!1)) : (j((l) => l + 1), b(!0)), r && r(a);
|
|
41
|
+
}, B = () => {
|
|
42
|
+
o && o(a);
|
|
43
|
+
}, W = () => {
|
|
44
|
+
E(!I), q && q(a);
|
|
45
|
+
}, F = X(p), k = c ?? n.length, D = k > 0, T = Math.min(S, V) * 2;
|
|
46
|
+
return _(() => {
|
|
47
|
+
j(i);
|
|
48
|
+
}, [i]), _(() => {
|
|
49
|
+
b(s);
|
|
50
|
+
}, [s]), $ ? /* @__PURE__ */ e.jsx(d, { sx: { pl: T, py: 1, ...R }, children: /* @__PURE__ */ e.jsxs(m, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
|
|
51
|
+
/* @__PURE__ */ e.jsx(t, { component: "rounded-avatar", width: f, height: f }),
|
|
52
|
+
/* @__PURE__ */ e.jsxs(d, { sx: { flex: 1 }, children: [
|
|
53
|
+
/* @__PURE__ */ e.jsxs(m, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
|
|
54
|
+
/* @__PURE__ */ e.jsx(t, { variant: "text", width: 120, height: 20 }),
|
|
55
|
+
/* @__PURE__ */ e.jsx(t, { variant: "text", width: 80, height: 16 })
|
|
56
56
|
] }),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ e.jsx(t, { variant: "text", width: "100%", height: 16, sx: { mb: 0.5 } }),
|
|
58
|
+
/* @__PURE__ */ e.jsx(t, { variant: "text", width: "85%", height: 16, sx: { mb: 0.5 } }),
|
|
59
|
+
/* @__PURE__ */ e.jsx(t, { variant: "text", width: "70%", height: 16, sx: { mb: 2 } }),
|
|
60
|
+
/* @__PURE__ */ e.jsxs(m, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
61
|
+
/* @__PURE__ */ e.jsx(t, { component: "icon-button" }),
|
|
62
|
+
/* @__PURE__ */ e.jsx(t, { variant: "text", width: 20, height: 16 }),
|
|
63
|
+
/* @__PURE__ */ e.jsx(t, { variant: "text", width: 60, height: 32 }),
|
|
64
|
+
/* @__PURE__ */ e.jsx(t, { variant: "text", width: 80, height: 32 })
|
|
65
65
|
] })
|
|
66
66
|
] })
|
|
67
|
-
] }) }) : /* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
67
|
+
] }) }) : /* @__PURE__ */ e.jsxs(d, { sx: { pl: T, py: 1, ...R }, children: [
|
|
68
|
+
/* @__PURE__ */ e.jsxs(m, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
|
|
69
|
+
/* @__PURE__ */ e.jsx(Y, { avatar: g, name: u, size: f }),
|
|
70
|
+
/* @__PURE__ */ e.jsxs(d, { sx: { flex: 1 }, children: [
|
|
71
|
+
/* @__PURE__ */ e.jsxs(m, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
|
|
72
|
+
/* @__PURE__ */ e.jsx(h, { variant: "subtitle2", fontWeight: "600", children: u }),
|
|
73
|
+
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(h, { variant: "caption", color: "text.secondary", children: F }) })
|
|
74
74
|
] }),
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
75
|
+
/* @__PURE__ */ e.jsx(h, { variant: "body2", sx: { mb: 2, lineHeight: 1.6 }, children: y }),
|
|
76
|
+
/* @__PURE__ */ e.jsxs(m, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
77
|
+
/* @__PURE__ */ e.jsx(
|
|
78
|
+
U,
|
|
79
79
|
{
|
|
80
80
|
size: "small",
|
|
81
|
-
onClick:
|
|
81
|
+
onClick: A,
|
|
82
82
|
sx: {
|
|
83
83
|
color: w ? "error.main" : "text.secondary"
|
|
84
84
|
},
|
|
85
|
-
children: w ? /* @__PURE__ */
|
|
85
|
+
children: w ? /* @__PURE__ */ e.jsx(G, { fontSize: "small" }) : /* @__PURE__ */ e.jsx(O, { fontSize: "small" })
|
|
86
86
|
}
|
|
87
87
|
),
|
|
88
|
-
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
z > 0 && /* @__PURE__ */ e.jsx(h, { variant: "caption", color: "text.secondary", children: z }),
|
|
89
|
+
/* @__PURE__ */ e.jsx(N, { size: "small", startIcon: /* @__PURE__ */ e.jsx(Q, { fontSize: "small" }), onClick: B, variant: "text", children: "Reply" }),
|
|
90
|
+
D && v && /* @__PURE__ */ e.jsxs(
|
|
91
|
+
N,
|
|
92
92
|
{
|
|
93
93
|
size: "small",
|
|
94
|
-
startIcon:
|
|
95
|
-
onClick:
|
|
94
|
+
startIcon: I ? /* @__PURE__ */ e.jsx(K, { fontSize: "small" }) : /* @__PURE__ */ e.jsx(J, { fontSize: "small" }),
|
|
95
|
+
onClick: W,
|
|
96
96
|
variant: "text",
|
|
97
97
|
children: [
|
|
98
|
-
|
|
98
|
+
k,
|
|
99
99
|
" ",
|
|
100
|
-
|
|
100
|
+
k === 1 ? "reply" : "replies"
|
|
101
101
|
]
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
] }),
|
|
105
|
-
|
|
105
|
+
L && /* @__PURE__ */ e.jsx(d, { sx: { mt: 2 }, children: L })
|
|
106
106
|
] })
|
|
107
107
|
] }),
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
D && v && /* @__PURE__ */ e.jsx(H, { in: I, children: /* @__PURE__ */ e.jsx(d, { sx: { mt: 2 }, children: n.map((l, P) => /* @__PURE__ */ e.jsx(
|
|
109
|
+
x,
|
|
110
110
|
{
|
|
111
111
|
...l,
|
|
112
|
-
level:
|
|
113
|
-
maxLevel:
|
|
112
|
+
level: S + 1,
|
|
113
|
+
maxLevel: V,
|
|
114
114
|
onLike: r,
|
|
115
|
-
onReply:
|
|
116
|
-
showReplies:
|
|
117
|
-
avatarSize: Math.max(32,
|
|
115
|
+
onReply: o,
|
|
116
|
+
showReplies: v,
|
|
117
|
+
avatarSize: Math.max(32, f - 8)
|
|
118
118
|
},
|
|
119
|
-
l.id || `reply-${
|
|
119
|
+
l.id || `reply-${P}`
|
|
120
120
|
)) }) })
|
|
121
121
|
] });
|
|
122
122
|
};
|
|
123
|
+
x.displayName = "SCommentMessage";
|
|
124
|
+
try {
|
|
125
|
+
x.displayName = "SCommentMessage", x.__docgenInfo = { description: "A comprehensive comment message component with avatar display, user information, relative timestamps, like functionality, and nested reply support.", displayName: "SCommentMessage", props: { id: { defaultValue: { value: "Date.now()" }, description: "Unique identifier for the comment", name: "id", required: !1, type: { name: "string | number" } }, userName: { defaultValue: null, description: "Name of the user who posted the comment", name: "userName", required: !0, type: { name: "string" } }, userAvatar: { defaultValue: null, description: "URL of the user avatar image", name: "userAvatar", required: !1, type: { name: "string" } }, commentContent: { defaultValue: null, description: "The text content of the comment", name: "commentContent", required: !0, type: { name: "string" } }, datetime: { defaultValue: null, description: "Date/time when the comment was posted", name: "datetime", required: !0, type: { name: "string | Date" } }, likes: { defaultValue: { value: "0" }, description: "Number of likes the comment has received", name: "likes", required: !1, type: { name: "number" } }, isLiked: { defaultValue: { value: "false" }, description: "Whether the current user has liked this comment", name: "isLiked", required: !1, type: { name: "boolean" } }, replies: { defaultValue: { value: "[]" }, description: "Array of reply comments", name: "replies", required: !1, type: { name: "SCommentMessageProps[]" } }, totalReplies: { defaultValue: null, description: "Total count of replies to display", name: "totalReplies", required: !1, type: { name: "number" } }, onLike: { defaultValue: null, description: "Callback function triggered when the like button is clicked", name: "onLike", required: !1, type: { name: "((commentId: string | number) => void)" } }, onReply: { defaultValue: null, description: "Callback function triggered when the reply button is clicked", name: "onReply", required: !1, type: { name: "((commentId: string | number, parentId?: string | number) => void)" } }, onToggleReplies: { defaultValue: null, description: "Callback function triggered when the expand/collapse replies button is clicked", name: "onToggleReplies", required: !1, type: { name: "((commentId: string | number) => void)" } }, showReplies: { defaultValue: { value: "true" }, description: "Whether to show replies and the expand/collapse functionality", name: "showReplies", required: !1, type: { name: "boolean" } }, avatarSize: { defaultValue: { value: "48" }, description: "Size of the avatar in pixels", name: "avatarSize", required: !1, type: { name: "number" } }, level: { defaultValue: { value: "0" }, description: "Current nesting level of the comment", name: "level", required: !1, type: { name: "number" } }, maxLevel: { defaultValue: { value: "3" }, description: "Maximum nesting level allowed before stopping further indentation", name: "maxLevel", required: !1, type: { name: "number" } }, loading: { defaultValue: { value: "false" }, description: "Whether to show skeleton loading state instead of content", name: "loading", required: !1, type: { name: "boolean" } }, children: { defaultValue: null, description: "Custom content to display below the comment actions", name: "children", required: !1, type: { name: "ReactNode" } }, sx: { defaultValue: { value: "{}" }, description: "Material-UI sx prop for custom styling", name: "sx", required: !1, type: { name: "SxProps" } } } };
|
|
126
|
+
} catch {
|
|
127
|
+
}
|
|
123
128
|
export {
|
|
124
|
-
|
|
129
|
+
x as SCommentMessage,
|
|
130
|
+
x as default
|
|
125
131
|
};
|
|
@@ -1,49 +1,22 @@
|
|
|
1
1
|
import { PaperProps, TypographyProps } from '@mui/material';
|
|
2
2
|
/**
|
|
3
|
-
* Props for
|
|
3
|
+
* Props interface for SCopyableText component
|
|
4
4
|
*/
|
|
5
5
|
export interface SCopyableTextProps {
|
|
6
6
|
/** The text content to display and copy */
|
|
7
7
|
text?: string;
|
|
8
|
-
/**
|
|
8
|
+
/** Props to pass to the Typography component for styling */
|
|
9
9
|
typographyProps?: TypographyProps;
|
|
10
|
-
/** Callback function
|
|
10
|
+
/** Callback function triggered after text is successfully copied */
|
|
11
11
|
onCopied?: () => void;
|
|
12
|
-
/**
|
|
12
|
+
/** Props to pass to the Paper component container */
|
|
13
13
|
paperProps?: PaperProps;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Displays text content in a styled container with a copy button overlay.
|
|
19
|
-
* Features visual feedback when copying is successful and handles copy
|
|
20
|
-
* errors gracefully.
|
|
21
|
-
*
|
|
22
|
-
* Features:
|
|
23
|
-
* - One-click copy to clipboard using modern Clipboard API
|
|
24
|
-
* - Visual feedback with icon change and color indication
|
|
25
|
-
* - Automatic reset of copied state after 2 seconds
|
|
26
|
-
* - Styled text container with border and proper spacing
|
|
27
|
-
* - Word wrapping and break-word handling for long content
|
|
28
|
-
* - Customizable typography through props
|
|
29
|
-
* - Optional callback for copy success events
|
|
30
|
-
*
|
|
31
|
-
* @param text - The text content to display and enable copying for
|
|
32
|
-
* @param typographyProps - Additional Material-UI Typography props for styling
|
|
33
|
-
* @param onCopied - Optional callback function triggered when copy succeeds
|
|
34
|
-
* @returns JSX element containing styled text with copy button, or null if no text
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```tsx
|
|
38
|
-
* <SCopyableText
|
|
39
|
-
* text="const apiKey = 'sk-1234567890abcdef';"
|
|
40
|
-
* onCopied={() => console.log('API key copied!')}
|
|
41
|
-
* typographyProps={{
|
|
42
|
-
* variant: 'code',
|
|
43
|
-
* color: 'primary'
|
|
44
|
-
* }}
|
|
45
|
-
* />
|
|
46
|
-
* ```
|
|
16
|
+
* A text display component with built-in copy-to-clipboard functionality and visual feedback.
|
|
47
17
|
*/
|
|
48
|
-
declare const SCopyableText:
|
|
18
|
+
export declare const SCopyableText: {
|
|
19
|
+
({ text, typographyProps, onCopied, paperProps }: SCopyableTextProps): import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
49
22
|
export default SCopyableText;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Paper as
|
|
4
|
-
import { c as
|
|
5
|
-
const
|
|
2
|
+
import { useState as d } from "react";
|
|
3
|
+
import { Paper as u, Box as y, IconButton as m, Typography as f } from "@mui/material";
|
|
4
|
+
import { c as s } from "../createSvgIcon-DxwgGAVe.js";
|
|
5
|
+
const x = s(/* @__PURE__ */ e.jsx("path", {
|
|
6
6
|
d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"
|
|
7
|
-
}), "Check"),
|
|
7
|
+
}), "Check"), h = s(/* @__PURE__ */ e.jsx("path", {
|
|
8
8
|
d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"
|
|
9
|
-
}), "ContentCopy"),
|
|
10
|
-
const [
|
|
11
|
-
if (
|
|
9
|
+
}), "ContentCopy"), r = ({ text: t, typographyProps: o, onCopied: a, paperProps: i }) => {
|
|
10
|
+
const [p, n] = d(!1), l = async () => {
|
|
11
|
+
if (t)
|
|
12
12
|
try {
|
|
13
|
-
await navigator.clipboard.writeText(
|
|
14
|
-
} catch (
|
|
15
|
-
console.error("Failed to copy text:",
|
|
13
|
+
await navigator.clipboard.writeText(t), n(!0), setTimeout(() => n(!1), 2e3), a == null || a();
|
|
14
|
+
} catch (c) {
|
|
15
|
+
console.error("Failed to copy text:", c);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
return
|
|
18
|
+
return t ? /* @__PURE__ */ e.jsx(u, { sx: { p: 2, border: "1px dashed", borderColor: "divider" }, ...i, children: /* @__PURE__ */ e.jsxs(y, { sx: { position: "relative" }, children: [
|
|
19
19
|
/* @__PURE__ */ e.jsx(
|
|
20
|
-
|
|
20
|
+
m,
|
|
21
21
|
{
|
|
22
|
-
onClick:
|
|
22
|
+
onClick: l,
|
|
23
23
|
size: "small",
|
|
24
24
|
sx: {
|
|
25
25
|
position: "absolute",
|
|
@@ -28,14 +28,14 @@ const f = n(/* @__PURE__ */ e.jsx("path", {
|
|
|
28
28
|
right: 0,
|
|
29
29
|
zIndex: 1,
|
|
30
30
|
// Ensure button appears above text
|
|
31
|
-
color:
|
|
31
|
+
color: p ? "success.main" : "inherit"
|
|
32
32
|
// Green when copied
|
|
33
33
|
},
|
|
34
|
-
children:
|
|
34
|
+
children: p ? /* @__PURE__ */ e.jsx(x, {}) : /* @__PURE__ */ e.jsx(h, {})
|
|
35
35
|
}
|
|
36
36
|
),
|
|
37
37
|
/* @__PURE__ */ e.jsx(
|
|
38
|
-
|
|
38
|
+
f,
|
|
39
39
|
{
|
|
40
40
|
variant: "body1",
|
|
41
41
|
sx: {
|
|
@@ -43,16 +43,26 @@ const f = n(/* @__PURE__ */ e.jsx("path", {
|
|
|
43
43
|
// Preserve whitespace and line breaks
|
|
44
44
|
wordBreak: "break-word",
|
|
45
45
|
// Handle long words gracefully
|
|
46
|
-
...
|
|
46
|
+
...o == null ? void 0 : o.sx
|
|
47
47
|
// Allow custom styling override
|
|
48
48
|
},
|
|
49
49
|
color: "text.secondary",
|
|
50
|
-
...
|
|
51
|
-
children:
|
|
50
|
+
...o,
|
|
51
|
+
children: t
|
|
52
52
|
}
|
|
53
53
|
)
|
|
54
54
|
] }) }) : null;
|
|
55
55
|
};
|
|
56
|
+
r.displayName = "SCopyableText";
|
|
57
|
+
try {
|
|
58
|
+
r.displayName = "SCopyableText", r.__docgenInfo = { description: "A text display component with built-in copy-to-clipboard functionality and visual feedback.", displayName: "SCopyableText", props: { text: { defaultValue: null, description: "The text content to display and copy", name: "text", required: !1, type: { name: "string" } }, typographyProps: { defaultValue: null, description: "Props to pass to the Typography component for styling", name: "typographyProps", required: !1, type: { name: "TypographyProps" } }, onCopied: { defaultValue: null, description: "Callback function triggered after text is successfully copied", name: "onCopied", required: !1, type: { name: "(() => void)" } }, paperProps: { defaultValue: null, description: "Props to pass to the Paper component container", name: "paperProps", required: !1, type: { name: "PaperProps" } } } };
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
scopyabletext.displayName = "scopyabletext", scopyabletext.__docgenInfo = { description: "A text display component with built-in copy-to-clipboard functionality and visual feedback.", displayName: "scopyabletext", props: { text: { defaultValue: null, description: "The text content to display and copy", name: "text", required: !1, type: { name: "string" } }, typographyProps: { defaultValue: null, description: "Props to pass to the Typography component for styling", name: "typographyProps", required: !1, type: { name: "TypographyProps" } }, onCopied: { defaultValue: null, description: "Callback function triggered after text is successfully copied", name: "onCopied", required: !1, type: { name: "(() => void)" } }, paperProps: { defaultValue: null, description: "Props to pass to the Paper component container", name: "paperProps", required: !1, type: { name: "PaperProps" } } } };
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
56
65
|
export {
|
|
57
|
-
|
|
66
|
+
r as SCopyableText,
|
|
67
|
+
r as default
|
|
58
68
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as SCountdown } from './s-count-down';
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
2
|
+
export type { SCountDownProps } from './s-count-down';
|
|
3
|
+
export { SCountBox } from './s-count-box';
|
|
4
|
+
export type { SCountBoxProps } from './s-count-box';
|