@solostylist/ui-kit 2.0.0 → 2.0.1
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/{gradients-90SYkAC0.js → gradients-DSnBONEQ.js} +1 -1
- package/dist/main.js +1 -1
- package/dist/palettes/index.js +1 -1
- package/dist/{palettes-Dw3PEYF5.js → palettes-CJLuEy1m.js} +163 -163
- package/dist/s-accordion/index.js +1 -1
- package/dist/s-accordion/s-accordion.js +70 -2
- package/dist/s-action-overlay/s-action-overlay.js +21 -21
- package/dist/s-autocomplete/s-autocomplete.js +1 -1
- package/dist/s-avatar/s-avatar.js +17 -17
- package/dist/s-blur-text/s-blur-text.js +16 -16
- package/dist/s-brand-logo/index.js +1 -1
- package/dist/s-brand-logo/s-brand-logo.js +1 -1
- package/dist/s-breadcrumbs/s-breadcrumbs.js +19 -19
- package/dist/s-carousel/index.js +1 -1
- package/dist/s-carousel/s-carousel.js +184 -2
- package/dist/s-category-card/s-category-card.js +22 -22
- package/dist/s-chat-input/index.js +1 -1
- package/dist/s-chat-input/s-chat-input.js +398 -2
- package/dist/s-chat-message/index.js +1 -1
- package/dist/s-chat-message/s-chat-message.js +314 -2
- package/dist/s-checkbox/s-checkbox.js +18 -19
- package/dist/s-chips/index.js +1 -1
- package/dist/s-chips/s-chips.js +174 -2
- package/dist/s-code-block/index.js +1 -1
- package/dist/s-code-block/s-code-block.js +103 -2
- package/dist/s-comment-message/index.js +1 -1
- package/dist/s-comment-message/s-comment-message.js +189 -2
- package/dist/s-copyable-text/s-copyable-text.js +18 -18
- package/dist/s-countdown/s-count-box.js +18 -18
- package/dist/s-data-table/index.js +1 -1
- package/dist/s-data-table/s-data-table.js +213 -2
- package/dist/s-date-picker/index.js +1 -1
- package/dist/s-date-picker/s-date-picker.js +106 -2
- package/dist/s-datetime-picker/index.js +1 -1
- package/dist/s-datetime-picker/s-datetime-picker.js +108 -2
- package/dist/s-dialog/index.js +1 -1
- package/dist/s-dialog/s-dialog.js +80 -2
- package/dist/s-dialog-confirm/s-dialog-confirm.js +32 -33
- package/dist/s-dialog-message/s-dialog-message.js +31 -32
- package/dist/s-empty/s-empty.js +13 -14
- package/dist/s-file-dropzone/index.js +1 -1
- package/dist/s-file-dropzone/s-file-dropzone.js +219 -2
- package/dist/s-file-icon/s-file-icon.js +87 -88
- package/dist/s-flex-box/s-flex-box.js +11 -12
- package/dist/s-form/s-form.js +15 -15
- package/dist/s-gallery/s-gallery.js +1 -1
- package/dist/s-glow-button/s-glow-button.js +9 -10
- package/dist/s-icon-button/s-icon-button.js +15 -16
- package/dist/s-image-comparison/s-image-comparison.js +29 -31
- package/dist/s-image-viewer/image-viewer-thumbnail-dock.js +1 -1
- package/dist/s-image-viewer/index.js +3 -3
- package/dist/s-image-viewer/s-image-viewer.js +266 -2
- package/dist/s-image-viewer/use-image-viewer-navigation.js +7 -7
- package/dist/s-label/s-label.js +26 -27
- package/dist/s-language-switcher/index.js +2 -2
- package/dist/s-language-switcher/s-language-switcher.js +150 -2
- package/dist/s-lazy-image/s-lazy-image.js +17 -18
- package/dist/s-link/index.js +1 -1
- package/dist/s-link/s-link.js +5 -2
- package/dist/s-localization-provider/index.js +1 -1
- package/dist/s-localization-provider/s-localization-provider.js +12 -2
- package/dist/s-nav-item/s-nav-item.js +16 -16
- package/dist/s-nav-items/index.js +2 -2
- package/dist/s-nav-items/s-nav-items.js +167 -2
- package/dist/s-no-ssr/index.js +1 -1
- package/dist/s-no-ssr/s-no-ssr.js +5 -2
- package/dist/s-pagination/index.js +1 -1
- package/dist/s-pagination/s-pagination.js +85 -2
- package/dist/s-pixel-reveal/s-pixel-reveal.js +20 -20
- package/dist/s-quantity-input/index.js +1 -1
- package/dist/s-quantity-input/s-quantity-input.js +246 -2
- package/dist/s-review/index.js +1 -1
- package/dist/s-review/s-review.js +272 -2
- package/dist/s-scroll-reveal/s-scroll-reveal.js +7 -8
- package/dist/s-scroll-to-top/s-scroll-to-top.js +27 -28
- package/dist/s-scroll-velocity/scroll-velocity-row.js +29 -29
- package/dist/s-select/index.js +1 -1
- package/dist/s-select/s-select.js +201 -2
- package/dist/s-select-list/s-select-list.js +47 -50
- package/dist/s-skeleton/s-skeleton.js +16 -17
- package/dist/s-snackbar-message/index.js +2 -2
- package/dist/s-snackbar-message/s-snackbar-message.js +89 -2
- package/dist/s-spotlight-cursor/s-spotlight-cursor.js +27 -27
- package/dist/s-status-illustration/s-status-illustration.js +74 -74
- package/dist/s-stripe/s-stripe.js +11 -12
- package/dist/s-stripe/stripe-input.js +3 -2
- package/dist/s-switch/index.js +1 -1
- package/dist/s-switch/s-switch.js +48 -2
- package/dist/s-tabs/s-tabs.js +48 -50
- package/dist/s-text-editor/index.js +1 -1
- package/dist/s-text-editor/s-text-editor-toolbar.js +216 -2
- package/dist/s-text-editor/s-text-editor.js +25 -26
- package/dist/s-text-field/index.js +1 -1
- package/dist/s-text-field/s-text-field.js +52 -2
- package/dist/s-text-shimmer/s-text-shimmer.js +1 -3
- package/dist/s-text-truncation/s-text-truncation.js +20 -20
- package/dist/s-theme-demo/s-theme-demo.js +8 -8
- package/dist/s-theme-demo/theme-demo-color-palette-section.js +1 -1
- package/dist/s-theme-demo/theme-demo-color-ramps-section.js +1 -1
- package/dist/s-theme-demo/theme-demo-components-section.js +265 -2
- package/dist/s-theme-demo/theme-demo-typography-section.js +10 -10
- package/dist/s-theme-provider/s-theme-provider.js +1 -1
- package/dist/s-theme-switch/index.js +1 -1
- package/dist/s-theme-switch/s-theme-switch.js +60 -2
- package/dist/s-tip/index.js +1 -1
- package/dist/s-tip/s-tip.js +61 -2
- package/dist/s-tool-bar/s-tool-bar.js +28 -28
- package/dist/s-tool-bar/tool-bar-action-buttons.js +55 -2
- package/dist/s-tool-bar/tool-bar-image-input.js +148 -2
- package/dist/s-tool-bar/tool-bar-inputs.js +55 -55
- package/dist/s-tool-item/s-tool-item.js +22 -22
- package/dist/s-two-pane-layout/s-two-pane-layout.js +32 -32
- package/dist/s-zoom-image/s-zoom-image.js +18 -19
- package/dist/theme/components/autocomplete.js +43 -2
- package/dist/theme/components/avatar.js +9 -2
- package/dist/theme/components/card.js +3 -3
- package/dist/theme/components/checkbox.js +90 -2
- package/dist/theme/components/chip.js +3 -3
- package/dist/theme/components/components.js +20 -20
- package/dist/theme/components/date-calendar.js +1 -0
- package/dist/theme/components/day-calendar.js +1 -0
- package/dist/theme/components/field-label-styles.js +19 -2
- package/dist/theme/components/form-label.js +1 -1
- package/dist/theme/components/list-item-button.js +1 -1
- package/dist/theme/components/list-item.js +7 -7
- package/dist/theme/components/month-calendar.js +14 -13
- package/dist/theme/components/multi-section-digital-clock-section.js +1 -0
- package/dist/theme/components/outlined-input.js +6 -6
- package/dist/theme/components/picker-day.js +1 -0
- package/dist/theme/components/pickers-arrow-switcher.js +1 -0
- package/dist/theme/components/pickers-calendar-header.js +3 -2
- package/dist/theme/components/select.js +6 -6
- package/dist/theme/components/switch.js +1 -1
- package/dist/theme/components/table-pagination.js +1 -1
- package/dist/theme/components/toggle-button.js +93 -2
- package/dist/theme/components/year-calendar.js +14 -13
- package/dist/theme/theme-primitives.js +2 -2
- package/dist/{theme-primitives-Dt_DT9b5.js → theme-primitives-CRfnMsNy.js} +108 -109
- package/dist/utils/dayjs.js +9 -146
- package/package.json +1 -1
- package/dist/Add-COc9VdNg.js +0 -6
- package/dist/ArrowUpward-D88i2k4q.js +0 -6
- package/dist/Box-9oeZgA1U.js +0 -46
- package/dist/Button-DgIFcM44.js +0 -534
- package/dist/ButtonBase-DxKtpFYs.js +0 -747
- package/dist/Checkbox-BoZu9z2l.js +0 -152
- package/dist/ChevronRight-BxsM4W78.js +0 -6
- package/dist/Close-o4HFfK0I.js +0 -6
- package/dist/Collapse-zgIFP5Sj.js +0 -266
- package/dist/ContentCopy-5unyTYXy.js +0 -6
- package/dist/DefaultPropsProvider-ebWx4_5E.js +0 -128
- package/dist/DialogContent-CAry6lVf.js +0 -450
- package/dist/Download-DtvoRwpl.js +0 -6
- package/dist/ExpandMore-Ba5bg6s-.js +0 -6
- package/dist/Favorite-B_GsElm0.js +0 -6
- package/dist/FormControl-BxmM9UP6.js +0 -221
- package/dist/FormControlLabel-DzgppcC_.js +0 -173
- package/dist/Grow-zRRuwUl-.js +0 -121
- package/dist/InfoOutlined-VC7X46pc.js +0 -6
- package/dist/List-CnGIAXAS.js +0 -103
- package/dist/ListContext-B1HQt3OD.js +0 -6
- package/dist/Menu-C4Zabc9U.js +0 -504
- package/dist/MenuItem-rXJfQzDC.js +0 -223
- package/dist/MenuList-DDV8J-yd.js +0 -407
- package/dist/Modal-jAiibALV.js +0 -707
- package/dist/Paper-ixxCeml9.js +0 -115
- package/dist/Popper-CVYyMS3c.js +0 -1350
- package/dist/Portal-AnyvFRC4.js +0 -53
- package/dist/RtlProvider-B7uVJXUY.js +0 -19
- package/dist/Skeleton-iZFynl7z.js +0 -220
- package/dist/Stack-UMc4dV4G.js +0 -158
- package/dist/SwitchBase-D7zqrstO.js +0 -198
- package/dist/Tooltip-DbCd6rgF.js +0 -447
- package/dist/Typography-yXjc7kVP.js +0 -168
- package/dist/UnfoldMoreRounded-DsN0HVDV.js +0 -6
- package/dist/appendOwnerState-CELpvdMz.js +0 -17
- package/dist/assets/stripe-input.css +0 -1
- package/dist/autocomplete-B_4y84Ba.js +0 -43
- package/dist/avatar-BHuZu3DN.js +0 -10
- package/dist/buttonBaseClasses-BvBqFLb_.js +0 -13
- package/dist/capitalize-CccCFNpQ.js +0 -5
- package/dist/checkbox-BKMZEVU5.js +0 -88
- package/dist/checkboxClasses-CEsqS4sc.js +0 -18
- package/dist/chunk-C_CI6nMA.js +0 -13
- package/dist/clsx-DGZSe4Nt.js +0 -16
- package/dist/colorManipulator-DmUjcif3.js +0 -129
- package/dist/contains-WOhYaq1E.js +0 -16
- package/dist/createSimplePaletteValueFilter-C1gWywW_.js +0 -14
- package/dist/createSvgIcon-B0SZlJF1.js +0 -155
- package/dist/createTheme-xB2Em0Na.js +0 -1869
- package/dist/defaultTheme-BaGcIzCh.js +0 -210
- package/dist/elementAcceptingRef-DhkNAkFH.js +0 -472
- package/dist/exactProp-C_IsucXf.js +0 -13
- package/dist/field-label-styles-BOyhp6gw.js +0 -50
- package/dist/formLabelClasses-B0Fa-86T.js +0 -18
- package/dist/generateUtilityClass-PAIOm1jC.js +0 -34
- package/dist/generateUtilityClasses-DvX505Gy.js +0 -10
- package/dist/iconButtonClasses-CkciZuIe.js +0 -27
- package/dist/inputAdornmentClasses-D5yYK5bM.js +0 -19
- package/dist/inputBaseClasses-DuWQGq8Z.js +0 -25
- package/dist/integerPropType-Disnft4a.js +0 -27
- package/dist/isEventHandler-8dPdzK9U.js +0 -7
- package/dist/isFocusVisible-Y7157FQS.js +0 -35
- package/dist/isLayoutSupported-Ceir7nyK.js +0 -21
- package/dist/listItemButtonClasses-DbL-aTVf.js +0 -18
- package/dist/memoTheme-qFyKAk7y.js +0 -15
- package/dist/mergeSlotProps-xl1-PgWL.js +0 -45
- package/dist/monthCalendarClasses-BYVHyEfI.js +0 -14
- package/dist/objectWithoutPropertiesLoose-Cpds-4w8.js +0 -23
- package/dist/outlinedInputClasses-DECY98u0.js +0 -17
- package/dist/pickersCalendarHeaderClasses-CIj0gBye.js +0 -12
- package/dist/prop-types-BzYPyWN7.js +0 -516
- package/dist/resolveProps-7jIA45vn.js +0 -30
- package/dist/s-accordion-B8nlrdFc.js +0 -487
- package/dist/s-carousel-Dnjke4JQ.js +0 -1353
- package/dist/s-chat-input-DCS0mJE4.js +0 -419
- package/dist/s-chat-message-9oollJJq.js +0 -315
- package/dist/s-chips-WqGdqHW9.js +0 -176
- package/dist/s-code-block-DzGoGg5e.js +0 -658
- package/dist/s-comment-message-C6kfgRjv.js +0 -191
- package/dist/s-data-table-B1TGVupB.js +0 -805
- package/dist/s-date-picker-BpX4HmBp.js +0 -656
- package/dist/s-datetime-picker-ByzW44E0.js +0 -3878
- package/dist/s-dialog-BLiyjLkx.js +0 -123
- package/dist/s-file-dropzone-CVQpYRdY.js +0 -422
- package/dist/s-image-viewer-DNIEYdtL.js +0 -269
- package/dist/s-language-switcher-D-1nywT3.js +0 -251
- package/dist/s-link-CAMTGfd9.js +0 -234
- package/dist/s-localization-provider-Xw3NO2uP.js +0 -519
- package/dist/s-nav-items-BUp7DddG.js +0 -327
- package/dist/s-no-ssr-D8tPdDfh.js +0 -25
- package/dist/s-pagination-Dt8Pk5Tp.js +0 -606
- package/dist/s-quantity-input-mYCixlJc.js +0 -246
- package/dist/s-review-DSXXtWlL.js +0 -272
- package/dist/s-select-dwY2DYa9.js +0 -204
- package/dist/s-snackbar-message-3Z6VySlB.js +0 -808
- package/dist/s-switch-B8bZAzLh.js +0 -307
- package/dist/s-text-editor-toolbar-D-XgFQix.js +0 -2121
- package/dist/s-text-field-BM4qk0mf.js +0 -51
- package/dist/s-theme-switch-BLMz1_m2.js +0 -60
- package/dist/s-tip-ty41ePQm.js +0 -62
- package/dist/selectClasses-DoUlWfzV.js +0 -22
- package/dist/styled-Bog8QCl3.js +0 -163
- package/dist/svgIconClasses-C8D4AsMj.js +0 -20
- package/dist/switchClasses-eiq1bkQN.js +0 -23
- package/dist/theme-demo-components-section-gtIYRngY.js +0 -267
- package/dist/toggle-button-Cxi5CfXC.js +0 -104
- package/dist/tool-bar-action-buttons-Dt-pV3GA.js +0 -54
- package/dist/tool-bar-image-input-BXlll_hV.js +0 -148
- package/dist/typographyClasses-BLM3NmYd.js +0 -31
- package/dist/useControlled-BeB0W_Ui.js +0 -5
- package/dist/useControlled-C4QJnpiR.js +0 -29
- package/dist/useEnhancedEffect-Bc3gBClC.js +0 -5
- package/dist/useEnhancedEffect-DFq_FMGX.js +0 -5
- package/dist/useEventCallback-CVqMfiG_.js +0 -14
- package/dist/useForkRef-CKneCEtr.js +0 -29
- package/dist/useFormControl-iWLrn7Ek.js +0 -18
- package/dist/useMobilePicker-C4UQFvkj.js +0 -7580
- package/dist/useSlot-iIu8ek6E.js +0 -83
- package/dist/useTheme-BIWMbX3i.js +0 -9
- package/dist/useThemeProps-BI9yq95N.js +0 -19
- package/dist/useThemeProps-Cr28OQu3.js +0 -13
- package/dist/utils-oJyTAkZY.js +0 -214
- package/dist/warning-CNkSZkq6.js +0 -98
- package/dist/yearCalendarClasses-CuAQumpz.js +0 -14
- /package/dist/{colors-DKqWMRgW.js → colors-CNjL5fhq.js} +0 -0
- /package/dist/{s-brand-logo-jtAJZQIv.js → s-brand-logo-CErW9Slg.js} +0 -0
- /package/dist/{utils-DaSrTYUS.js → utils-CMeAWSRO.js} +0 -0
|
@@ -1,2 +1,314 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as e, r as t } from "../utils-CMeAWSRO.js";
|
|
2
|
+
import { toSxArray as n } from "../utils/sx.js";
|
|
3
|
+
import { SLazyImage as r } from "../s-lazy-image/s-lazy-image.js";
|
|
4
|
+
import { SIconButton as i } from "../s-icon-button/s-icon-button.js";
|
|
5
|
+
import { SSkeleton as a } from "../s-skeleton/s-skeleton.js";
|
|
6
|
+
import { SAvatar as o } from "../s-avatar/s-avatar.js";
|
|
7
|
+
import { SImageViewer as s } from "../s-image-viewer/s-image-viewer.js";
|
|
8
|
+
import c, { useState as l } from "react";
|
|
9
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
10
|
+
import { Download as f, InsertDriveFile as p, Refresh as m } from "@mui/icons-material";
|
|
11
|
+
import { Box as h, ButtonBase as g, Paper as _, Typography as v, styled as y, useTheme as b, useThemeProps as x } from "@mui/material";
|
|
12
|
+
//#region lib/s-chat-message/s-chat-message.tsx
|
|
13
|
+
var S = y(h, {
|
|
14
|
+
name: "SChatMessage",
|
|
15
|
+
slot: "Root"
|
|
16
|
+
})({}), C = c.forwardRef(function({ isSent: e, showAvatar: t, showTimestamp: r, senderName: i, maxWidth: o, ownerState: s, sx: c, ...l }, f) {
|
|
17
|
+
return /* @__PURE__ */ d(S, {
|
|
18
|
+
...l,
|
|
19
|
+
ownerState: s,
|
|
20
|
+
ref: f,
|
|
21
|
+
sx: [{
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: e ? "row-reverse" : "row",
|
|
24
|
+
alignItems: "flex-start",
|
|
25
|
+
gap: 1,
|
|
26
|
+
mb: 1,
|
|
27
|
+
maxWidth: o,
|
|
28
|
+
alignSelf: e ? "flex-end" : "flex-start"
|
|
29
|
+
}, ...n(c)],
|
|
30
|
+
children: [
|
|
31
|
+
t && !e && /* @__PURE__ */ u(a, {
|
|
32
|
+
variant: "circular",
|
|
33
|
+
width: 36,
|
|
34
|
+
height: 36
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ d(h, {
|
|
37
|
+
sx: {
|
|
38
|
+
display: "flex",
|
|
39
|
+
flexDirection: "column",
|
|
40
|
+
alignItems: e ? "flex-end" : "flex-start",
|
|
41
|
+
gap: .5,
|
|
42
|
+
minWidth: 0
|
|
43
|
+
},
|
|
44
|
+
children: [
|
|
45
|
+
i && !e && /* @__PURE__ */ u(a, {
|
|
46
|
+
width: 100,
|
|
47
|
+
height: 12,
|
|
48
|
+
sx: { ml: .5 }
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ d(h, {
|
|
51
|
+
sx: {
|
|
52
|
+
display: "inline-block",
|
|
53
|
+
width: "20rem",
|
|
54
|
+
maxWidth: "100%",
|
|
55
|
+
overflow: "hidden",
|
|
56
|
+
ml: .5
|
|
57
|
+
},
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ u(a, {
|
|
60
|
+
height: 16,
|
|
61
|
+
sx: { mb: .5 }
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ u(a, {
|
|
64
|
+
width: "85%",
|
|
65
|
+
height: 16,
|
|
66
|
+
sx: { mb: .5 }
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ u(a, {
|
|
69
|
+
width: "70%",
|
|
70
|
+
height: 16
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
}),
|
|
74
|
+
r && /* @__PURE__ */ u(a, {
|
|
75
|
+
width: 60,
|
|
76
|
+
height: 10,
|
|
77
|
+
sx: {
|
|
78
|
+
ml: e ? 0 : .5,
|
|
79
|
+
mr: e ? .5 : 0
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
}),
|
|
84
|
+
t && e && /* @__PURE__ */ u(a, {
|
|
85
|
+
variant: "circular",
|
|
86
|
+
width: 36,
|
|
87
|
+
height: 36
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}), w = c.forwardRef(function(a, c) {
|
|
92
|
+
let y = x({
|
|
93
|
+
props: a,
|
|
94
|
+
name: "SChatMessage"
|
|
95
|
+
}), w = b(), { children: T, variant: E = "received", timestamp: D, avatar: O, senderName: k, showAvatar: A = !0, showTimestamp: j = !1, maxWidth: M = "70%", attachments: N = [], onAttachmentClick: P, onDownload: F, hasError: I = !1, errorMessage: L = "Failed to send message", onRetry: R, loading: z = !1, sx: B, ...V } = y, [H, U] = l(null), [W, G] = l(!1), K = E === "sent", q = {
|
|
96
|
+
...y,
|
|
97
|
+
isSent: K,
|
|
98
|
+
loading: z,
|
|
99
|
+
variant: E
|
|
100
|
+
}, J = (e) => {
|
|
101
|
+
P ? P(e) : (U(e), G(!0));
|
|
102
|
+
}, Y = (e) => {
|
|
103
|
+
P ? P(e) : F && F(e);
|
|
104
|
+
}, X = N.filter((e) => e.type === "image"), Z = N.filter((e) => e.type === "file");
|
|
105
|
+
return z ? /* @__PURE__ */ u(C, {
|
|
106
|
+
isSent: K,
|
|
107
|
+
showAvatar: A,
|
|
108
|
+
showTimestamp: j,
|
|
109
|
+
senderName: k,
|
|
110
|
+
maxWidth: M,
|
|
111
|
+
ownerState: q,
|
|
112
|
+
ref: c,
|
|
113
|
+
sx: B,
|
|
114
|
+
...V
|
|
115
|
+
}) : /* @__PURE__ */ d(S, {
|
|
116
|
+
...V,
|
|
117
|
+
ownerState: q,
|
|
118
|
+
ref: c,
|
|
119
|
+
sx: [{
|
|
120
|
+
display: "flex",
|
|
121
|
+
flexDirection: K ? "row-reverse" : "row",
|
|
122
|
+
alignItems: "flex-start",
|
|
123
|
+
gap: 1,
|
|
124
|
+
mb: 1,
|
|
125
|
+
maxWidth: M,
|
|
126
|
+
alignSelf: K ? "flex-end" : "flex-start"
|
|
127
|
+
}, ...n(B)],
|
|
128
|
+
children: [
|
|
129
|
+
A && !K && /* @__PURE__ */ u(o, {
|
|
130
|
+
src: O,
|
|
131
|
+
name: k,
|
|
132
|
+
size: 36
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ d(h, {
|
|
135
|
+
sx: {
|
|
136
|
+
display: "flex",
|
|
137
|
+
flexDirection: "column",
|
|
138
|
+
alignItems: K ? "flex-end" : "flex-start",
|
|
139
|
+
gap: .5,
|
|
140
|
+
minWidth: 0
|
|
141
|
+
},
|
|
142
|
+
children: [
|
|
143
|
+
k && !K && /* @__PURE__ */ u(v, { children: k }),
|
|
144
|
+
/* @__PURE__ */ d(h, {
|
|
145
|
+
sx: {
|
|
146
|
+
display: "inline-block",
|
|
147
|
+
borderRadius: 1,
|
|
148
|
+
wordBreak: "break-word",
|
|
149
|
+
maxWidth: "100%",
|
|
150
|
+
border: "1px solid",
|
|
151
|
+
borderColor: I ? "error.main" : "divider",
|
|
152
|
+
overflow: "hidden"
|
|
153
|
+
},
|
|
154
|
+
children: [
|
|
155
|
+
X.length > 0 && /* @__PURE__ */ u(h, {
|
|
156
|
+
sx: {
|
|
157
|
+
minWidth: 200,
|
|
158
|
+
display: "grid",
|
|
159
|
+
gridTemplateColumns: X.length === 1 ? "1fr" : "repeat(2, 1fr)",
|
|
160
|
+
gap: .5,
|
|
161
|
+
p: .5
|
|
162
|
+
},
|
|
163
|
+
children: X.map((e) => /* @__PURE__ */ u(g, {
|
|
164
|
+
"aria-label": `View ${e.name ?? "image attachment"}`,
|
|
165
|
+
sx: {
|
|
166
|
+
display: "block",
|
|
167
|
+
position: "relative",
|
|
168
|
+
paddingTop: X.length === 1 ? "66.67%" : "100%",
|
|
169
|
+
overflow: "hidden",
|
|
170
|
+
width: "100%",
|
|
171
|
+
"@media (hover: hover) and (pointer: fine)": { "&:hover": { opacity: w.interaction.mediaHoverOpacity } },
|
|
172
|
+
"&.Mui-focusVisible": {
|
|
173
|
+
outline: "2px solid",
|
|
174
|
+
outlineColor: "primary.main",
|
|
175
|
+
outlineOffset: -2
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
onClick: () => J(e),
|
|
179
|
+
children: /* @__PURE__ */ u(r, {
|
|
180
|
+
src: e.thumbnailUrl ?? e.url,
|
|
181
|
+
alt: e.name ?? "Image",
|
|
182
|
+
sx: {
|
|
183
|
+
position: "absolute",
|
|
184
|
+
inset: 0
|
|
185
|
+
},
|
|
186
|
+
slotProps: { image: { sx: { objectFit: "cover" } } }
|
|
187
|
+
})
|
|
188
|
+
}, e.id))
|
|
189
|
+
}),
|
|
190
|
+
Z.length > 0 && /* @__PURE__ */ u(h, {
|
|
191
|
+
sx: { p: 1.5 },
|
|
192
|
+
children: Z.map((t, n) => /* @__PURE__ */ d(_, {
|
|
193
|
+
variant: "outlined",
|
|
194
|
+
sx: {
|
|
195
|
+
display: "flex",
|
|
196
|
+
alignItems: "center",
|
|
197
|
+
mt: +(n > 0),
|
|
198
|
+
overflow: "hidden"
|
|
199
|
+
},
|
|
200
|
+
children: [/* @__PURE__ */ d(g, {
|
|
201
|
+
"aria-label": `Open ${t.name ?? "file attachment"}`,
|
|
202
|
+
onClick: () => Y(t),
|
|
203
|
+
sx: {
|
|
204
|
+
display: "flex",
|
|
205
|
+
flex: 1,
|
|
206
|
+
minWidth: 0,
|
|
207
|
+
gap: 1,
|
|
208
|
+
p: 1,
|
|
209
|
+
justifyContent: "flex-start",
|
|
210
|
+
textAlign: "left",
|
|
211
|
+
"&.Mui-focusVisible": {
|
|
212
|
+
outline: "2px solid",
|
|
213
|
+
outlineColor: "primary.main",
|
|
214
|
+
outlineOffset: -2
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
children: [/* @__PURE__ */ u(p, { sx: { fontSize: 36 } }), /* @__PURE__ */ d(h, {
|
|
218
|
+
sx: {
|
|
219
|
+
flex: 1,
|
|
220
|
+
minWidth: 0
|
|
221
|
+
},
|
|
222
|
+
children: [/* @__PURE__ */ u(v, {
|
|
223
|
+
variant: "body2",
|
|
224
|
+
sx: {
|
|
225
|
+
overflow: "hidden",
|
|
226
|
+
textOverflow: "ellipsis",
|
|
227
|
+
whiteSpace: "nowrap"
|
|
228
|
+
},
|
|
229
|
+
children: t.name ?? "Unnamed File"
|
|
230
|
+
}), t.size && /* @__PURE__ */ u(v, {
|
|
231
|
+
variant: "caption",
|
|
232
|
+
children: e(t.size)
|
|
233
|
+
})]
|
|
234
|
+
})]
|
|
235
|
+
}), F && /* @__PURE__ */ u(i, {
|
|
236
|
+
"aria-label": `Download ${t.name ?? "attachment"}`,
|
|
237
|
+
onClick: () => F(t),
|
|
238
|
+
sx: { mr: 1 },
|
|
239
|
+
size: "small",
|
|
240
|
+
children: /* @__PURE__ */ u(f, {})
|
|
241
|
+
})]
|
|
242
|
+
}, t.id))
|
|
243
|
+
}),
|
|
244
|
+
T && /* @__PURE__ */ u(h, {
|
|
245
|
+
sx: {
|
|
246
|
+
px: 2,
|
|
247
|
+
py: 1.5,
|
|
248
|
+
pt: N.length > 0 ? 0 : 1.5
|
|
249
|
+
},
|
|
250
|
+
children: /* @__PURE__ */ u(v, {
|
|
251
|
+
variant: "body1",
|
|
252
|
+
sx: {
|
|
253
|
+
whiteSpace: "pre-wrap",
|
|
254
|
+
color: I ? "error.main" : "inherit"
|
|
255
|
+
},
|
|
256
|
+
children: T
|
|
257
|
+
})
|
|
258
|
+
})
|
|
259
|
+
]
|
|
260
|
+
}),
|
|
261
|
+
j && D && /* @__PURE__ */ u(v, {
|
|
262
|
+
variant: "caption",
|
|
263
|
+
children: t(D)
|
|
264
|
+
}),
|
|
265
|
+
I && /* @__PURE__ */ d(h, {
|
|
266
|
+
role: "alert",
|
|
267
|
+
sx: {
|
|
268
|
+
display: "flex",
|
|
269
|
+
alignItems: "center",
|
|
270
|
+
gap: .5,
|
|
271
|
+
color: "error.main"
|
|
272
|
+
},
|
|
273
|
+
children: [/* @__PURE__ */ u(v, {
|
|
274
|
+
sx: { color: "inherit" },
|
|
275
|
+
variant: "caption",
|
|
276
|
+
children: L
|
|
277
|
+
}), R && /* @__PURE__ */ u(i, {
|
|
278
|
+
"aria-label": "Retry sending message",
|
|
279
|
+
onClick: R,
|
|
280
|
+
size: "small",
|
|
281
|
+
children: /* @__PURE__ */ u(m, {})
|
|
282
|
+
})]
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
}),
|
|
286
|
+
A && K && /* @__PURE__ */ u(o, {
|
|
287
|
+
src: O,
|
|
288
|
+
name: k,
|
|
289
|
+
size: 36
|
|
290
|
+
}),
|
|
291
|
+
H && /* @__PURE__ */ u(s, {
|
|
292
|
+
"aria-label": "Message attachment viewer",
|
|
293
|
+
open: W,
|
|
294
|
+
onClose: () => {
|
|
295
|
+
G(!1), U(null);
|
|
296
|
+
},
|
|
297
|
+
onCloseButtonClick: () => {
|
|
298
|
+
G(!1), U(null);
|
|
299
|
+
},
|
|
300
|
+
selectedItem: {
|
|
301
|
+
id: H.id,
|
|
302
|
+
type: "image",
|
|
303
|
+
url: H.url,
|
|
304
|
+
title: H.name
|
|
305
|
+
},
|
|
306
|
+
showNavigation: !1,
|
|
307
|
+
showThumbnailDock: !1
|
|
308
|
+
})
|
|
309
|
+
]
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
w.displayName = "SChatMessage";
|
|
313
|
+
//#endregion
|
|
314
|
+
export { w as SChatMessage, w as default };
|
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import { jsx as c } from "react/jsx-runtime";
|
|
1
|
+
import { styled as e, useThemeProps as t } from "@mui/material/styles";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
import i from "@mui/material/Checkbox";
|
|
5
|
+
import a from "@mui/utils/appendOwnerState";
|
|
6
|
+
import { useFormControl as o } from "@mui/material/FormControl";
|
|
7
|
+
import s, { formControlLabelClasses as c } from "@mui/material/FormControlLabel";
|
|
9
8
|
//#region lib/s-checkbox/s-checkbox.tsx
|
|
10
|
-
var l = e(
|
|
9
|
+
var l = e(s, {
|
|
11
10
|
name: "SCheckbox",
|
|
12
11
|
slot: "Root",
|
|
13
12
|
shouldForwardProp: (e) => e !== "ownerState"
|
|
14
13
|
})(({ theme: e }) => ({
|
|
15
14
|
margin: 0,
|
|
16
15
|
userSelect: "none",
|
|
17
|
-
[`&&.${
|
|
18
|
-
[`&& .${
|
|
16
|
+
[`&&.${c.disabled}`]: { cursor: "not-allowed" },
|
|
17
|
+
[`&& .${c.label}.${c.disabled}`]: { color: (e.vars ?? e).palette.text.disabled }
|
|
19
18
|
}));
|
|
20
19
|
function u(e, t) {
|
|
21
20
|
return typeof e == "function" ? e(t) : e;
|
|
22
21
|
}
|
|
23
|
-
var d =
|
|
24
|
-
let
|
|
22
|
+
var d = n.forwardRef(function(e, n) {
|
|
23
|
+
let s = t({
|
|
25
24
|
props: e,
|
|
26
25
|
name: "SCheckbox"
|
|
27
|
-
}),
|
|
28
|
-
...
|
|
26
|
+
}), c = o(), { disabled: d, disableTypography: f, label: p, labelPlacement: m = "end", required: h, slotProps: g, slots: _, ...v } = s, y = d ?? c?.disabled ?? !1, b = h ?? c?.required ?? !1, x = f ?? (typeof p != "string" && typeof p != "number"), S = {
|
|
27
|
+
...s,
|
|
29
28
|
disabled: y,
|
|
30
29
|
labelPlacement: m,
|
|
31
30
|
required: b
|
|
32
|
-
}, C = _?.control ?? i, w =
|
|
33
|
-
return /* @__PURE__ */
|
|
31
|
+
}, C = _?.control ?? i, w = a(_?.control, u(g?.control, S) ?? {}, S);
|
|
32
|
+
return /* @__PURE__ */ r(l, {
|
|
34
33
|
...v,
|
|
35
|
-
control: /* @__PURE__ */
|
|
34
|
+
control: /* @__PURE__ */ r(C, { ...w }),
|
|
36
35
|
disabled: d,
|
|
37
36
|
disableTypography: x,
|
|
38
37
|
label: p,
|
|
39
38
|
labelPlacement: m,
|
|
40
39
|
ownerState: S,
|
|
41
|
-
ref:
|
|
40
|
+
ref: n,
|
|
42
41
|
required: b,
|
|
43
42
|
slots: _?.typography ? { typography: _.typography } : void 0,
|
|
44
43
|
slotProps: g?.typography ? { typography: g.typography } : void 0
|
package/dist/s-chips/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SChips as e } from "./s-chips.js";
|
|
2
2
|
export { e as SChips, e as default };
|
package/dist/s-chips/s-chips.js
CHANGED
|
@@ -1,2 +1,174 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { toSxArray as e } from "../utils/sx.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { createElement as n, useCallback as r, useEffect as i, useLayoutEffect as a, useRef as o, useState as s } from "react";
|
|
4
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
|
+
import { Done as ee } from "@mui/icons-material";
|
|
6
|
+
import { Box as u, Chip as d, Tooltip as f, styled as p, useThemeProps as m } from "@mui/material";
|
|
7
|
+
import { mergeSlotProps as te, useControlled as h, useForkRef as g } from "@mui/material/utils";
|
|
8
|
+
import _ from "@mui/utils/appendOwnerState";
|
|
9
|
+
//#region lib/s-chips/s-chips.tsx
|
|
10
|
+
var v = p(u, {
|
|
11
|
+
name: "SChips",
|
|
12
|
+
slot: "Root"
|
|
13
|
+
})({});
|
|
14
|
+
function y(e, t) {
|
|
15
|
+
return typeof e == "function" ? e(t) : e;
|
|
16
|
+
}
|
|
17
|
+
var b = t.forwardRef(function(t, p) {
|
|
18
|
+
let b = m({
|
|
19
|
+
props: t,
|
|
20
|
+
name: "SChips"
|
|
21
|
+
}), { chips: x, color: S = "primary", defaultValue: C = [], gap: w = 8, onChange: T, onItemClick: E, overflow: D = !0, overflowText: O = "keywords", size: k = "medium", slotProps: A, slots: j, sx: M, value: N, variant: P = "filled", ...ne } = b, F = o(null), I = o(null), [L, R] = s(x.length), [z, re] = h({
|
|
22
|
+
controlled: N,
|
|
23
|
+
default: C,
|
|
24
|
+
name: "SChips",
|
|
25
|
+
state: "value"
|
|
26
|
+
}), B = r(() => {
|
|
27
|
+
let e = F.current, t = I.current;
|
|
28
|
+
if (!e || !t) return;
|
|
29
|
+
let n = e.offsetWidth, r = Array.from(t.children), i = r[x.length]?.getBoundingClientRect().width ?? 0, a = 0, o = 0;
|
|
30
|
+
for (let e = 0; e < x.length; e++) {
|
|
31
|
+
let t = r[e]?.getBoundingClientRect().width ?? 0, i = o === 0 ? t : t + w;
|
|
32
|
+
if (a + i > n) break;
|
|
33
|
+
a += i, o++;
|
|
34
|
+
}
|
|
35
|
+
if (o < x.length) for (; o > 0 && a + w + i > n;) {
|
|
36
|
+
o--;
|
|
37
|
+
let e = r[o]?.getBoundingClientRect().width ?? 0;
|
|
38
|
+
a -= o === 0 ? e : e + w;
|
|
39
|
+
}
|
|
40
|
+
R(o);
|
|
41
|
+
}, [x, w]);
|
|
42
|
+
a(() => {
|
|
43
|
+
if (!D) {
|
|
44
|
+
R(x.length);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
B();
|
|
48
|
+
}, [
|
|
49
|
+
B,
|
|
50
|
+
x.length,
|
|
51
|
+
S,
|
|
52
|
+
D,
|
|
53
|
+
O,
|
|
54
|
+
z,
|
|
55
|
+
k,
|
|
56
|
+
P
|
|
57
|
+
]), i(() => {
|
|
58
|
+
if (!D) return;
|
|
59
|
+
let e = F.current;
|
|
60
|
+
if (!e) return;
|
|
61
|
+
let t = new ResizeObserver(B);
|
|
62
|
+
return t.observe(e), () => t.disconnect();
|
|
63
|
+
}, [B, D]);
|
|
64
|
+
let V = {
|
|
65
|
+
...b,
|
|
66
|
+
overflow: D,
|
|
67
|
+
selected: z,
|
|
68
|
+
visibleCount: L
|
|
69
|
+
}, H = j?.root ?? v, U = j?.chip ?? d, W = j?.overflowChip ?? d, G = j?.tooltip ?? f, K = y(A?.root, V), q = y(A?.overflowChip, V), J = y(A?.tooltip, V), { sx: Y, ...ie } = K ?? {}, { ref: ae, ...oe } = _(H, ie, V), se = g(F, ae, p), ce = _(j?.overflowChip, q ?? {}, V), { slotProps: X, ...le } = _(j?.tooltip, J ?? {}, V), ue = {
|
|
70
|
+
...X,
|
|
71
|
+
tooltip: te(X?.tooltip, { style: { padding: "0.5rem" } })
|
|
72
|
+
}, { sx: de, ...Z } = ce, fe = D ? x.slice(0, L) : x, Q = D ? x.slice(L) : [], $ = (t, r, i = !1) => {
|
|
73
|
+
let a = z.includes(t), o = {
|
|
74
|
+
...V,
|
|
75
|
+
index: r,
|
|
76
|
+
label: t,
|
|
77
|
+
selectedItem: a
|
|
78
|
+
}, s = y(A?.chip, o), { icon: l, onClick: u, sx: d, ...f } = _(j?.chip, s ?? {}, o), p = T != null || N != null || C.length > 0, m = u != null || E != null || p;
|
|
79
|
+
return /* @__PURE__ */ n(U, {
|
|
80
|
+
color: S,
|
|
81
|
+
size: k,
|
|
82
|
+
variant: P,
|
|
83
|
+
...f,
|
|
84
|
+
key: `${t}-${r}`,
|
|
85
|
+
"aria-pressed": !i && p ? a : void 0,
|
|
86
|
+
label: t.trim(),
|
|
87
|
+
icon: l ?? (a ? /* @__PURE__ */ c(ee, {}) : void 0),
|
|
88
|
+
onClick: i || !m ? void 0 : (e) => {
|
|
89
|
+
if (u?.(e), !e.defaultPrevented) {
|
|
90
|
+
if (T != null || N != null || C.length > 0) {
|
|
91
|
+
let n = a ? z.filter((e) => e !== t) : [...z, t];
|
|
92
|
+
re(n), T?.(e, n);
|
|
93
|
+
}
|
|
94
|
+
E?.(e, t);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
sx: [{ userSelect: "none" }, ...e(d)]
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
return /* @__PURE__ */ l(H, {
|
|
101
|
+
...ne,
|
|
102
|
+
...oe,
|
|
103
|
+
ref: se,
|
|
104
|
+
sx: [
|
|
105
|
+
{
|
|
106
|
+
display: "flex",
|
|
107
|
+
maxWidth: "100%",
|
|
108
|
+
flexWrap: D ? "nowrap" : "wrap",
|
|
109
|
+
gap: `${w}px`,
|
|
110
|
+
...D ? {
|
|
111
|
+
overflow: "hidden",
|
|
112
|
+
textOverflow: "ellipsis",
|
|
113
|
+
whiteSpace: "nowrap"
|
|
114
|
+
} : {}
|
|
115
|
+
},
|
|
116
|
+
...e(M),
|
|
117
|
+
...e(Y)
|
|
118
|
+
],
|
|
119
|
+
children: [
|
|
120
|
+
fe.map((e, t) => $(e, t)),
|
|
121
|
+
D && Q.length > 0 && /* @__PURE__ */ c(G, {
|
|
122
|
+
arrow: !0,
|
|
123
|
+
placement: "top",
|
|
124
|
+
title: /* @__PURE__ */ c(u, {
|
|
125
|
+
sx: {
|
|
126
|
+
display: "flex",
|
|
127
|
+
gap: 1,
|
|
128
|
+
maxWidth: 240,
|
|
129
|
+
flexWrap: "wrap"
|
|
130
|
+
},
|
|
131
|
+
children: Q.map((e, t) => $(e, L + t, !0))
|
|
132
|
+
}),
|
|
133
|
+
...le,
|
|
134
|
+
slotProps: ue,
|
|
135
|
+
children: /* @__PURE__ */ c(W, {
|
|
136
|
+
"aria-label": `${Q.length} more ${O}`,
|
|
137
|
+
color: S,
|
|
138
|
+
size: k,
|
|
139
|
+
variant: "outlined",
|
|
140
|
+
tabIndex: 0,
|
|
141
|
+
...Z,
|
|
142
|
+
label: `+${Q.length} ${O}`,
|
|
143
|
+
sx: [{
|
|
144
|
+
cursor: "help",
|
|
145
|
+
userSelect: "none"
|
|
146
|
+
}, ...e(de)]
|
|
147
|
+
})
|
|
148
|
+
}),
|
|
149
|
+
D && /* @__PURE__ */ l(u, {
|
|
150
|
+
ref: I,
|
|
151
|
+
"aria-hidden": !0,
|
|
152
|
+
sx: {
|
|
153
|
+
position: "absolute",
|
|
154
|
+
top: 0,
|
|
155
|
+
left: 0,
|
|
156
|
+
display: "flex",
|
|
157
|
+
visibility: "hidden",
|
|
158
|
+
pointerEvents: "none",
|
|
159
|
+
whiteSpace: "nowrap"
|
|
160
|
+
},
|
|
161
|
+
children: [x.map((e, t) => $(e, t, !0)), /* @__PURE__ */ c(W, {
|
|
162
|
+
color: S,
|
|
163
|
+
size: k,
|
|
164
|
+
variant: "outlined",
|
|
165
|
+
...Z,
|
|
166
|
+
label: `+${x.length} ${O}`
|
|
167
|
+
})]
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
b.displayName = "SChips";
|
|
173
|
+
//#endregion
|
|
174
|
+
export { b as SChips, b as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SCodeBlock as e } from "./s-code-block.js";
|
|
2
2
|
export { e as SCodeBlock, e as default };
|
|
@@ -1,2 +1,103 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { toSxArray as e } from "../utils/sx.js";
|
|
2
|
+
import { SIconButton as t } from "../s-icon-button/s-icon-button.js";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { useMemo as r, useState as i } from "react";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { Check as s, ContentCopy as c } from "@mui/icons-material";
|
|
7
|
+
import { Box as l, styled as u, useColorScheme as d, useThemeProps as f } from "@mui/material";
|
|
8
|
+
import p from "@mui/utils/appendOwnerState";
|
|
9
|
+
import { Prism as m } from "react-syntax-highlighter";
|
|
10
|
+
import { oneDark as h, oneLight as g } from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
11
|
+
//#region lib/s-code-block/s-code-block.tsx
|
|
12
|
+
var _ = u(l, {
|
|
13
|
+
name: "SCodeBlock",
|
|
14
|
+
slot: "Root"
|
|
15
|
+
})({});
|
|
16
|
+
function v(e, t) {
|
|
17
|
+
return typeof e == "function" ? e(t) : e;
|
|
18
|
+
}
|
|
19
|
+
var y = n.forwardRef(function(l, u) {
|
|
20
|
+
let y = f({
|
|
21
|
+
props: l,
|
|
22
|
+
name: "SCodeBlock"
|
|
23
|
+
}), { code: b, language: x = "typescript", onCopied: S, showCopyButton: C = !0, showLineNumbers: w = !0, slotProps: T, slots: E, sx: D, ...O } = y, [k, A] = i(!1), j = n.useRef(null), { mode: M } = d(), N = {
|
|
24
|
+
...y,
|
|
25
|
+
copied: k
|
|
26
|
+
}, P = E?.copyButton ?? t, F = E?.syntaxHighlighter ?? m, I = v(T?.copyButton, N), L = v(T?.syntaxHighlighter, N), R = p(E?.copyButton, I ?? {}, N), z = p(E?.syntaxHighlighter, L ?? {}, N), { onClick: B, sx: V, ...H } = R, { customStyle: U, ...W } = z, G = r(() => {
|
|
27
|
+
let e = M === "dark" ? h : g;
|
|
28
|
+
return {
|
|
29
|
+
...e,
|
|
30
|
+
"pre[class*=\"language-\"]": {
|
|
31
|
+
...e["pre[class*=\"language-\"]"],
|
|
32
|
+
background: "transparent"
|
|
33
|
+
},
|
|
34
|
+
"code[class*=\"language-\"]": {
|
|
35
|
+
...e["code[class*=\"language-\"]"],
|
|
36
|
+
background: "transparent"
|
|
37
|
+
},
|
|
38
|
+
linenumber: {
|
|
39
|
+
...e.linenumber,
|
|
40
|
+
fontStyle: "normal"
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}, [M]);
|
|
44
|
+
n.useEffect(() => () => {
|
|
45
|
+
j.current != null && window.clearTimeout(j.current);
|
|
46
|
+
}, []);
|
|
47
|
+
let K = async () => {
|
|
48
|
+
if (b) try {
|
|
49
|
+
await navigator.clipboard.writeText(b), A(!0), j.current != null && window.clearTimeout(j.current), j.current = window.setTimeout(() => {
|
|
50
|
+
j.current = null, A(!1);
|
|
51
|
+
}, 2e3), S?.();
|
|
52
|
+
} catch (e) {
|
|
53
|
+
console.error("Failed to copy code:", e);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return b ? /* @__PURE__ */ o(_, {
|
|
57
|
+
...O,
|
|
58
|
+
ownerState: N,
|
|
59
|
+
ref: u,
|
|
60
|
+
sx: [{
|
|
61
|
+
position: "relative",
|
|
62
|
+
width: "100%"
|
|
63
|
+
}, ...e(D)],
|
|
64
|
+
children: [C && /* @__PURE__ */ a(P, {
|
|
65
|
+
"aria-label": k ? "Code copied" : "Copy code",
|
|
66
|
+
...H,
|
|
67
|
+
onClick: (e) => {
|
|
68
|
+
B?.(e), e.defaultPrevented || K();
|
|
69
|
+
},
|
|
70
|
+
sx: [{
|
|
71
|
+
position: "absolute",
|
|
72
|
+
top: "50%",
|
|
73
|
+
right: 16,
|
|
74
|
+
transform: "translateY(-50%)",
|
|
75
|
+
zIndex: 1,
|
|
76
|
+
color: k ? "success.main" : "text.primary",
|
|
77
|
+
backdropFilter: "blur(8px)",
|
|
78
|
+
"&:active": { backgroundColor: "action.selected" }
|
|
79
|
+
}, ...e(V)],
|
|
80
|
+
children: a(k ? s : c, {})
|
|
81
|
+
}), /* @__PURE__ */ a(F, {
|
|
82
|
+
...W,
|
|
83
|
+
language: x,
|
|
84
|
+
style: G,
|
|
85
|
+
showLineNumbers: w,
|
|
86
|
+
customStyle: {
|
|
87
|
+
margin: 0,
|
|
88
|
+
padding: 16,
|
|
89
|
+
borderRadius: "var(--s-shape-borderRadius)",
|
|
90
|
+
fontSize: "0.875rem",
|
|
91
|
+
backgroundColor: "var(--s-palette-background-paper)",
|
|
92
|
+
border: "1px solid var(--s-palette-divider)",
|
|
93
|
+
...U
|
|
94
|
+
},
|
|
95
|
+
wrapLines: !0,
|
|
96
|
+
wrapLongLines: !0,
|
|
97
|
+
children: b
|
|
98
|
+
})]
|
|
99
|
+
}) : null;
|
|
100
|
+
});
|
|
101
|
+
y.displayName = "SCodeBlock";
|
|
102
|
+
//#endregion
|
|
103
|
+
export { y as SCodeBlock, y as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SCommentMessage as e } from "./s-comment-message.js";
|
|
2
2
|
export { e as SCommentMessage, e as default };
|