@mieweb/ui 0.8.0-dev.22 → 0.8.0-dev.24
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/Animated-Cs-naa2g.d.cts +175 -0
- package/dist/Animated-Cs-naa2g.d.ts +175 -0
- package/dist/brands/index.cjs +7 -7
- package/dist/brands/index.js +2 -2
- package/dist/{chunk-YIOZQEMV.cjs → chunk-3LHICE4I.cjs} +3 -3
- package/dist/{chunk-YIOZQEMV.cjs.map → chunk-3LHICE4I.cjs.map} +1 -1
- package/dist/{chunk-DWRIU4MW.js → chunk-3RB35GYK.js} +3 -3
- package/dist/{chunk-DWRIU4MW.js.map → chunk-3RB35GYK.js.map} +1 -1
- package/dist/{chunk-BT7SXNZU.cjs → chunk-4SM3I7WE.cjs} +3 -3
- package/dist/{chunk-BT7SXNZU.cjs.map → chunk-4SM3I7WE.cjs.map} +1 -1
- package/dist/{chunk-JWB4UA4J.cjs → chunk-5BVFVXHN.cjs} +197 -147
- package/dist/chunk-5BVFVXHN.cjs.map +1 -0
- package/dist/{chunk-62FT5JRH.js → chunk-5H7SAEQO.js} +4 -4
- package/dist/{chunk-62FT5JRH.js.map → chunk-5H7SAEQO.js.map} +1 -1
- package/dist/{chunk-KRYJJMYN.js → chunk-6SAYPXHX.js} +3 -3
- package/dist/{chunk-KRYJJMYN.js.map → chunk-6SAYPXHX.js.map} +1 -1
- package/dist/{chunk-KTJETOOH.cjs → chunk-6XDPJWSC.cjs} +36 -36
- package/dist/{chunk-KTJETOOH.cjs.map → chunk-6XDPJWSC.cjs.map} +1 -1
- package/dist/{chunk-WUKXQZZR.cjs → chunk-7KN6J7XV.cjs} +8 -8
- package/dist/{chunk-WUKXQZZR.cjs.map → chunk-7KN6J7XV.cjs.map} +1 -1
- package/dist/chunk-BN75TLUN.cjs +163 -0
- package/dist/chunk-BN75TLUN.cjs.map +1 -0
- package/dist/{chunk-WWJIW2IH.cjs → chunk-BVMABVC4.cjs} +3 -3
- package/dist/{chunk-WWJIW2IH.cjs.map → chunk-BVMABVC4.cjs.map} +1 -1
- package/dist/{chunk-RS5VA6QU.cjs → chunk-C3DUS2VE.cjs} +3 -3
- package/dist/{chunk-RS5VA6QU.cjs.map → chunk-C3DUS2VE.cjs.map} +1 -1
- package/dist/{chunk-VIE7UI2R.cjs → chunk-CXDMZT45.cjs} +4 -2
- package/dist/chunk-CXDMZT45.cjs.map +1 -0
- package/dist/{chunk-TXRQQMG5.js → chunk-CYMZ2QS5.js} +2 -2
- package/dist/{chunk-TXRQQMG5.js.map → chunk-CYMZ2QS5.js.map} +1 -1
- package/dist/{chunk-KY2CZK5F.js → chunk-D25WH7MH.js} +2 -2
- package/dist/{chunk-KY2CZK5F.js.map → chunk-D25WH7MH.js.map} +1 -1
- package/dist/{chunk-ATOWMVZH.js → chunk-DFYMIRMW.js} +3 -3
- package/dist/{chunk-ATOWMVZH.js.map → chunk-DFYMIRMW.js.map} +1 -1
- package/dist/{chunk-PDS7OM73.js → chunk-DGRXAIWK.js} +4 -2
- package/dist/chunk-DGRXAIWK.js.map +1 -0
- package/dist/{chunk-JHR4PNUA.cjs → chunk-FQBTGS3E.cjs} +5 -5
- package/dist/{chunk-JHR4PNUA.cjs.map → chunk-FQBTGS3E.cjs.map} +1 -1
- package/dist/{chunk-W3N5XENB.cjs → chunk-FUFBRKOG.cjs} +24 -24
- package/dist/{chunk-W3N5XENB.cjs.map → chunk-FUFBRKOG.cjs.map} +1 -1
- package/dist/{chunk-UEDTZYGI.cjs → chunk-H4AVMUOC.cjs} +3 -3
- package/dist/{chunk-UEDTZYGI.cjs.map → chunk-H4AVMUOC.cjs.map} +1 -1
- package/dist/{chunk-X5ZPYYMS.js → chunk-I3DQXUSC.js} +3 -3
- package/dist/{chunk-X5ZPYYMS.js.map → chunk-I3DQXUSC.js.map} +1 -1
- package/dist/{chunk-LZVPVY5P.js → chunk-KU3XRHWA.js} +3 -3
- package/dist/{chunk-LZVPVY5P.js.map → chunk-KU3XRHWA.js.map} +1 -1
- package/dist/{chunk-P2VTQ5AR.cjs → chunk-L52N6BEN.cjs} +39 -23
- package/dist/chunk-L52N6BEN.cjs.map +1 -0
- package/dist/{chunk-SRMTRD7F.js → chunk-L5W7TJQ5.js} +3 -3
- package/dist/{chunk-SRMTRD7F.js.map → chunk-L5W7TJQ5.js.map} +1 -1
- package/dist/{chunk-Z5KFXHDP.cjs → chunk-MM7QKUE3.cjs} +5 -5
- package/dist/{chunk-Z5KFXHDP.cjs.map → chunk-MM7QKUE3.cjs.map} +1 -1
- package/dist/{chunk-FJ7YPVKV.js → chunk-MUIDWFYJ.js} +3 -3
- package/dist/{chunk-FJ7YPVKV.js.map → chunk-MUIDWFYJ.js.map} +1 -1
- package/dist/{chunk-L2LH4CEN.js → chunk-MXQ7J4BB.js} +3 -3
- package/dist/{chunk-L2LH4CEN.js.map → chunk-MXQ7J4BB.js.map} +1 -1
- package/dist/{chunk-R4E6DMZS.js → chunk-O6GJ4IYS.js} +195 -147
- package/dist/chunk-O6GJ4IYS.js.map +1 -0
- package/dist/{chunk-MX46D4UJ.cjs → chunk-O7XHHTTP.cjs} +2 -2
- package/dist/{chunk-MX46D4UJ.cjs.map → chunk-O7XHHTTP.cjs.map} +1 -1
- package/dist/{chunk-7IBZA7G6.js → chunk-OAZUDUGX.js} +4 -4
- package/dist/{chunk-7IBZA7G6.js.map → chunk-OAZUDUGX.js.map} +1 -1
- package/dist/{chunk-NFKX6QJP.cjs → chunk-OCV33S5Q.cjs} +3 -3
- package/dist/{chunk-NFKX6QJP.cjs.map → chunk-OCV33S5Q.cjs.map} +1 -1
- package/dist/{chunk-334BUQMR.js → chunk-ODYQYLO2.js} +7 -7
- package/dist/{chunk-334BUQMR.js.map → chunk-ODYQYLO2.js.map} +1 -1
- package/dist/{chunk-FK2WTX7D.js → chunk-OHDIJOGG.js} +3 -3
- package/dist/{chunk-FK2WTX7D.js.map → chunk-OHDIJOGG.js.map} +1 -1
- package/dist/{chunk-GQVL2JKQ.cjs → chunk-OHKO5THF.cjs} +3 -3
- package/dist/{chunk-GQVL2JKQ.cjs.map → chunk-OHKO5THF.cjs.map} +1 -1
- package/dist/{chunk-LMBXJZLG.js → chunk-ON4JULCA.js} +3 -3
- package/dist/{chunk-LMBXJZLG.js.map → chunk-ON4JULCA.js.map} +1 -1
- package/dist/{chunk-57DPXKUV.js → chunk-ONNY7UO4.js} +4 -4
- package/dist/{chunk-57DPXKUV.js.map → chunk-ONNY7UO4.js.map} +1 -1
- package/dist/{chunk-KFEN2SRZ.js → chunk-PHK4XBO5.js} +3 -3
- package/dist/{chunk-KFEN2SRZ.js.map → chunk-PHK4XBO5.js.map} +1 -1
- package/dist/{chunk-XMCIXHGH.js → chunk-Q7G56ZIO.js} +39 -23
- package/dist/chunk-Q7G56ZIO.js.map +1 -0
- package/dist/{chunk-T5BBZQ66.js → chunk-QAKASRE6.js} +3 -3
- package/dist/{chunk-T5BBZQ66.js.map → chunk-QAKASRE6.js.map} +1 -1
- package/dist/{chunk-UBOVDAD7.js → chunk-QAQOCS2J.js} +3 -3
- package/dist/{chunk-UBOVDAD7.js.map → chunk-QAQOCS2J.js.map} +1 -1
- package/dist/{chunk-GLEIVJQB.cjs → chunk-QKAYRHWP.cjs} +9 -9
- package/dist/{chunk-GLEIVJQB.cjs.map → chunk-QKAYRHWP.cjs.map} +1 -1
- package/dist/{chunk-JWTCEWQ4.cjs → chunk-SNEQXSC5.cjs} +2 -2
- package/dist/{chunk-JWTCEWQ4.cjs.map → chunk-SNEQXSC5.cjs.map} +1 -1
- package/dist/{chunk-ZSGEGISB.cjs → chunk-SRA2L3SQ.cjs} +4 -4
- package/dist/{chunk-ZSGEGISB.cjs.map → chunk-SRA2L3SQ.cjs.map} +1 -1
- package/dist/{chunk-3SHLOF4V.cjs → chunk-VTR2KGLY.cjs} +9 -9
- package/dist/{chunk-3SHLOF4V.cjs.map → chunk-VTR2KGLY.cjs.map} +1 -1
- package/dist/chunk-WYMO3IIK.js +136 -0
- package/dist/chunk-WYMO3IIK.js.map +1 -0
- package/dist/{chunk-CFI3TQMA.cjs → chunk-X5QRRMGB.cjs} +3 -3
- package/dist/{chunk-CFI3TQMA.cjs.map → chunk-X5QRRMGB.cjs.map} +1 -1
- package/dist/{chunk-SH6B4MG5.js → chunk-XBXDUAIM.js} +4 -4
- package/dist/{chunk-SH6B4MG5.js.map → chunk-XBXDUAIM.js.map} +1 -1
- package/dist/{chunk-K5GQPTTA.cjs → chunk-XEEVDZDK.cjs} +3 -3
- package/dist/{chunk-K5GQPTTA.cjs.map → chunk-XEEVDZDK.cjs.map} +1 -1
- package/dist/{chunk-GXODR6V4.js → chunk-XOIIUO6O.js} +3 -3
- package/dist/{chunk-GXODR6V4.js.map → chunk-XOIIUO6O.js.map} +1 -1
- package/dist/{chunk-AHHFFXJR.cjs → chunk-XTHMC76F.cjs} +3 -3
- package/dist/{chunk-AHHFFXJR.cjs.map → chunk-XTHMC76F.cjs.map} +1 -1
- package/dist/{chunk-64SSWBJN.cjs → chunk-YJP6DUFO.cjs} +6 -6
- package/dist/{chunk-64SSWBJN.cjs.map → chunk-YJP6DUFO.cjs.map} +1 -1
- package/dist/components/Alert/index.d.cts +1 -1
- package/dist/components/Alert/index.d.ts +1 -1
- package/dist/components/AlertDialog/index.cjs +5 -4
- package/dist/components/AlertDialog/index.js +4 -3
- package/dist/components/Autocomplete/index.cjs +3 -3
- package/dist/components/Autocomplete/index.js +2 -2
- package/dist/components/Badge/index.d.cts +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Card/index.d.cts +2 -2
- package/dist/components/Card/index.d.ts +2 -2
- package/dist/components/CountryCodeDropdown/index.cjs +5 -5
- package/dist/components/CountryCodeDropdown/index.js +2 -2
- package/dist/components/CustomizableDashboard/index.cjs +10 -10
- package/dist/components/CustomizableDashboard/index.js +3 -3
- package/dist/components/DateInput/index.cjs +4 -4
- package/dist/components/DateInput/index.js +3 -3
- package/dist/components/Dropdown/index.cjs +9 -9
- package/dist/components/Dropdown/index.js +2 -2
- package/dist/components/GlossaryTooltip/index.cjs +3 -3
- package/dist/components/GlossaryTooltip/index.js +2 -2
- package/dist/components/KeyboardShortcutsOverlay/index.cjs +6 -5
- package/dist/components/KeyboardShortcutsOverlay/index.js +4 -3
- package/dist/components/Markdown/index.cjs +10 -10
- package/dist/components/Markdown/index.js +2 -2
- package/dist/components/MediaEditor/index.cjs +11 -10
- package/dist/components/MediaEditor/index.js +6 -5
- package/dist/components/MediaPlayer/index.cjs +1 -1
- package/dist/components/MediaPlayer/index.js +1 -1
- package/dist/components/Modal/index.cjs +11 -10
- package/dist/components/Modal/index.d.cts +1 -1
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.js +3 -2
- package/dist/components/Pagination/index.d.cts +1 -1
- package/dist/components/Pagination/index.d.ts +1 -1
- package/dist/components/PhoneInput/index.cjs +4 -4
- package/dist/components/PhoneInput/index.js +2 -2
- package/dist/components/Progress/index.d.cts +1 -1
- package/dist/components/Progress/index.d.ts +1 -1
- package/dist/components/RecordButton/index.d.cts +1 -1
- package/dist/components/RecordButton/index.d.ts +1 -1
- package/dist/components/RichTextEditor/index.cjs +7 -7
- package/dist/components/RichTextEditor/index.js +4 -4
- package/dist/components/SectionSpyNav/index.cjs +3 -3
- package/dist/components/SectionSpyNav/index.js +2 -2
- package/dist/components/Select/index.cjs +4 -4
- package/dist/components/Select/index.js +2 -2
- package/dist/components/Sheet/index.cjs +11 -11
- package/dist/components/Sheet/index.js +2 -2
- package/dist/components/Slider/index.d.cts +2 -2
- package/dist/components/Slider/index.d.ts +2 -2
- package/dist/components/SourceTip/index.cjs +3 -3
- package/dist/components/SourceTip/index.js +2 -2
- package/dist/components/SuperChat/index.cjs +10 -10
- package/dist/components/SuperChat/index.js +4 -4
- package/dist/components/SuperChat/plugins/index.cjs +4 -4
- package/dist/components/SuperChat/plugins/index.js +3 -3
- package/dist/components/Text/index.d.cts +1 -1
- package/dist/components/Text/index.d.ts +1 -1
- package/dist/components/ThemeProvider/index.cjs +9 -9
- package/dist/components/ThemeProvider/index.d.cts +1 -1
- package/dist/components/ThemeProvider/index.d.ts +1 -1
- package/dist/components/ThemeProvider/index.js +3 -3
- package/dist/components/Toggle/index.d.cts +1 -1
- package/dist/components/Toggle/index.d.ts +1 -1
- package/dist/components/Tooltip/index.cjs +3 -3
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/esheet.cjs +12 -11
- package/dist/esheet.cjs.map +1 -1
- package/dist/esheet.js +9 -8
- package/dist/esheet.js.map +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +722 -620
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -24
- package/dist/index.d.ts +38 -24
- package/dist/index.js +216 -129
- package/dist/index.js.map +1 -1
- package/dist/motion.cjs +87 -0
- package/dist/motion.cjs.map +1 -0
- package/dist/motion.d.cts +52 -0
- package/dist/motion.d.ts +52 -0
- package/dist/motion.js +50 -0
- package/dist/motion.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind-preset.cjs +4 -4
- package/dist/tailwind-preset.js +1 -1
- package/package.json +16 -1
- package/dist/chunk-JWB4UA4J.cjs.map +0 -1
- package/dist/chunk-P2VTQ5AR.cjs.map +0 -1
- package/dist/chunk-PDS7OM73.js.map +0 -1
- package/dist/chunk-R4E6DMZS.js.map +0 -1
- package/dist/chunk-VIE7UI2R.cjs.map +0 -1
- package/dist/chunk-XMCIXHGH.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkAOHJILLU_cjs = require('./chunk-AOHJILLU.cjs');
|
|
4
3
|
var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
|
|
5
|
-
var
|
|
4
|
+
var chunkAOHJILLU_cjs = require('./chunk-AOHJILLU.cjs');
|
|
5
|
+
var React3 = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var reactDom = require('react-dom');
|
|
8
7
|
var classVarianceAuthority = require('class-variance-authority');
|
|
8
|
+
var reactDom = require('react-dom');
|
|
9
9
|
|
|
10
10
|
function _interopNamespace(e) {
|
|
11
11
|
if (e && e.__esModule) return e;
|
|
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
|
|
|
25
25
|
return Object.freeze(n);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
29
29
|
|
|
30
30
|
function getFileType(mimeType) {
|
|
31
31
|
if (mimeType.startsWith("image/")) return "image";
|
|
@@ -271,7 +271,7 @@ function AttachmentPreviewItem({
|
|
|
271
271
|
);
|
|
272
272
|
}
|
|
273
273
|
AttachmentPreviewItem.displayName = "AttachmentPreviewItem";
|
|
274
|
-
var AttachmentPicker =
|
|
274
|
+
var AttachmentPicker = React3__namespace.forwardRef(
|
|
275
275
|
({
|
|
276
276
|
onFilesSelected,
|
|
277
277
|
acceptedTypes = ["image/*", "video/*", ".pdf", ".doc", ".docx"],
|
|
@@ -284,8 +284,8 @@ var AttachmentPicker = React2__namespace.forwardRef(
|
|
|
284
284
|
className,
|
|
285
285
|
children
|
|
286
286
|
}, ref) => {
|
|
287
|
-
const inputRef =
|
|
288
|
-
|
|
287
|
+
const inputRef = React3__namespace.useRef(null);
|
|
288
|
+
React3__namespace.useImperativeHandle(ref, () => inputRef.current);
|
|
289
289
|
const handleClick = () => {
|
|
290
290
|
inputRef.current?.click();
|
|
291
291
|
};
|
|
@@ -374,11 +374,12 @@ function DragDropZone({
|
|
|
374
374
|
maxFiles = 10,
|
|
375
375
|
disabled = false,
|
|
376
376
|
onError,
|
|
377
|
+
overlayLabel = "Drop files here",
|
|
377
378
|
children,
|
|
378
379
|
className
|
|
379
380
|
}) {
|
|
380
|
-
const [isDragging, setIsDragging] =
|
|
381
|
-
const dragCounterRef =
|
|
381
|
+
const [isDragging, setIsDragging] = React3__namespace.useState(false);
|
|
382
|
+
const dragCounterRef = React3__namespace.useRef(0);
|
|
382
383
|
const handleDragEnter = (event) => {
|
|
383
384
|
event.preventDefault();
|
|
384
385
|
event.stopPropagation();
|
|
@@ -465,7 +466,7 @@ function DragDropZone({
|
|
|
465
466
|
)
|
|
466
467
|
}
|
|
467
468
|
),
|
|
468
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-primary-700 dark:text-primary-300 mt-2 text-sm font-medium", children:
|
|
469
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-primary-700 dark:text-primary-300 mt-2 text-sm font-medium", children: overlayLabel })
|
|
469
470
|
] })
|
|
470
471
|
}
|
|
471
472
|
)
|
|
@@ -480,7 +481,7 @@ function CameraButton({
|
|
|
480
481
|
disabled = false,
|
|
481
482
|
className
|
|
482
483
|
}) {
|
|
483
|
-
const inputRef =
|
|
484
|
+
const inputRef = React3__namespace.useRef(null);
|
|
484
485
|
const handleClick = () => {
|
|
485
486
|
inputRef.current?.click();
|
|
486
487
|
};
|
|
@@ -565,6 +566,162 @@ function activeMentionQuery(value, caret) {
|
|
|
565
566
|
const query = match[2];
|
|
566
567
|
return { query, start: caret - query.length - 1 };
|
|
567
568
|
}
|
|
569
|
+
function useMentionAutocomplete({
|
|
570
|
+
options,
|
|
571
|
+
value,
|
|
572
|
+
setValue,
|
|
573
|
+
textareaRef
|
|
574
|
+
}) {
|
|
575
|
+
const enabled = !!options && options.length > 0;
|
|
576
|
+
const [mention, setMention] = React3__namespace.useState(null);
|
|
577
|
+
const [highlight, setHighlight] = React3__namespace.useState(0);
|
|
578
|
+
const listId = React3__namespace.useId();
|
|
579
|
+
const optionId = React3__namespace.useCallback(
|
|
580
|
+
(index) => `${listId}-option-${index}`,
|
|
581
|
+
[listId]
|
|
582
|
+
);
|
|
583
|
+
const suggestions = React3__namespace.useMemo(() => {
|
|
584
|
+
if (!mention || !options) return [];
|
|
585
|
+
const q = mention.query.toLowerCase();
|
|
586
|
+
return options.filter((o) => o.label.toLowerCase().includes(q));
|
|
587
|
+
}, [mention, options]);
|
|
588
|
+
const menuOpen = enabled && mention !== null && suggestions.length > 0;
|
|
589
|
+
const {
|
|
590
|
+
anchorRef,
|
|
591
|
+
floatingRef,
|
|
592
|
+
style: menuStyle
|
|
593
|
+
} = chunkAOHJILLU_cjs.useAnchoredPosition({
|
|
594
|
+
open: menuOpen,
|
|
595
|
+
placement: "top-start",
|
|
596
|
+
maxHeight: 224
|
|
597
|
+
});
|
|
598
|
+
const clampedHighlight = menuOpen ? Math.min(highlight, suggestions.length - 1) : -1;
|
|
599
|
+
const activeOptionId = menuOpen ? optionId(clampedHighlight) : void 0;
|
|
600
|
+
const sync = React3__namespace.useCallback(
|
|
601
|
+
(nextValue, caret) => {
|
|
602
|
+
if (!enabled) return;
|
|
603
|
+
setMention(activeMentionQuery(nextValue, caret));
|
|
604
|
+
setHighlight(0);
|
|
605
|
+
},
|
|
606
|
+
[enabled]
|
|
607
|
+
);
|
|
608
|
+
const insert = (option) => {
|
|
609
|
+
if (!mention) return;
|
|
610
|
+
const insertValue = option.value ?? option.label.split(" ")[0];
|
|
611
|
+
const before = value.slice(0, mention.start);
|
|
612
|
+
const after = value.slice(mention.start + 1 + mention.query.length);
|
|
613
|
+
const insertText = `@${insertValue} `;
|
|
614
|
+
setValue(before + insertText + after);
|
|
615
|
+
setMention(null);
|
|
616
|
+
const caret = before.length + insertText.length;
|
|
617
|
+
requestAnimationFrame(() => {
|
|
618
|
+
const el = textareaRef.current;
|
|
619
|
+
if (el) {
|
|
620
|
+
el.focus();
|
|
621
|
+
el.setSelectionRange(caret, caret);
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
};
|
|
625
|
+
const handleKeyDown = (event) => {
|
|
626
|
+
if (!menuOpen) return false;
|
|
627
|
+
if (event.key === "ArrowDown") {
|
|
628
|
+
event.preventDefault();
|
|
629
|
+
setHighlight(
|
|
630
|
+
(h) => (Math.min(h, suggestions.length - 1) + 1) % suggestions.length
|
|
631
|
+
);
|
|
632
|
+
return true;
|
|
633
|
+
}
|
|
634
|
+
if (event.key === "ArrowUp") {
|
|
635
|
+
event.preventDefault();
|
|
636
|
+
setHighlight(
|
|
637
|
+
(h) => (Math.min(h, suggestions.length - 1) - 1 + suggestions.length) % suggestions.length
|
|
638
|
+
);
|
|
639
|
+
return true;
|
|
640
|
+
}
|
|
641
|
+
if (event.key === "Enter" || event.key === "Tab") {
|
|
642
|
+
event.preventDefault();
|
|
643
|
+
const chosen = suggestions[clampedHighlight];
|
|
644
|
+
if (chosen) insert(chosen);
|
|
645
|
+
return true;
|
|
646
|
+
}
|
|
647
|
+
if (event.key === "Escape") {
|
|
648
|
+
event.preventDefault();
|
|
649
|
+
setMention(null);
|
|
650
|
+
return true;
|
|
651
|
+
}
|
|
652
|
+
return false;
|
|
653
|
+
};
|
|
654
|
+
const inputProps = enabled ? {
|
|
655
|
+
"aria-controls": menuOpen ? listId : void 0,
|
|
656
|
+
"aria-activedescendant": activeOptionId,
|
|
657
|
+
"aria-autocomplete": "list"
|
|
658
|
+
} : {};
|
|
659
|
+
return {
|
|
660
|
+
enabled,
|
|
661
|
+
menuOpen,
|
|
662
|
+
suggestions,
|
|
663
|
+
highlight: clampedHighlight,
|
|
664
|
+
listId,
|
|
665
|
+
optionId,
|
|
666
|
+
anchorRef,
|
|
667
|
+
floatingRef,
|
|
668
|
+
menuStyle,
|
|
669
|
+
sync,
|
|
670
|
+
insert,
|
|
671
|
+
setHighlight,
|
|
672
|
+
handleKeyDown,
|
|
673
|
+
inputProps
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
function MentionMenu({
|
|
677
|
+
mention,
|
|
678
|
+
label = "Mention",
|
|
679
|
+
dataSlot = "composer-mention-list"
|
|
680
|
+
}) {
|
|
681
|
+
if (!mention.menuOpen) return null;
|
|
682
|
+
return reactDom.createPortal(
|
|
683
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
684
|
+
"ul",
|
|
685
|
+
{
|
|
686
|
+
ref: mention.floatingRef,
|
|
687
|
+
style: mention.menuStyle,
|
|
688
|
+
id: mention.listId,
|
|
689
|
+
role: "listbox",
|
|
690
|
+
"aria-label": label,
|
|
691
|
+
"data-slot": dataSlot,
|
|
692
|
+
className: "w-64 overflow-y-auto rounded-lg border border-neutral-200 bg-white py-1 shadow-lg dark:border-neutral-700 dark:bg-neutral-800",
|
|
693
|
+
children: mention.suggestions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
694
|
+
"button",
|
|
695
|
+
{
|
|
696
|
+
type: "button",
|
|
697
|
+
id: mention.optionId(i),
|
|
698
|
+
role: "option",
|
|
699
|
+
"aria-selected": i === mention.highlight,
|
|
700
|
+
onMouseDown: (e) => {
|
|
701
|
+
e.preventDefault();
|
|
702
|
+
mention.insert(option);
|
|
703
|
+
},
|
|
704
|
+
onMouseEnter: () => mention.setHighlight(i),
|
|
705
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
706
|
+
"flex w-full items-center gap-2 px-3 py-1.5 text-start text-sm",
|
|
707
|
+
i === mention.highlight ? "bg-primary-100 text-primary-900 dark:bg-primary-900/40 dark:text-primary-100" : "text-neutral-700 dark:text-neutral-200"
|
|
708
|
+
),
|
|
709
|
+
children: [
|
|
710
|
+
option.icon,
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
712
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: option.label }),
|
|
713
|
+
option.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ms-1 text-xs text-neutral-400", children: option.description })
|
|
714
|
+
] }),
|
|
715
|
+
option.meta && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-neutral-400", children: option.meta })
|
|
716
|
+
]
|
|
717
|
+
}
|
|
718
|
+
) }, option.id))
|
|
719
|
+
}
|
|
720
|
+
),
|
|
721
|
+
document.body
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
MentionMenu.displayName = "MentionMenu";
|
|
568
725
|
function isFileAccepted(file, accepted) {
|
|
569
726
|
if (!accepted || accepted.length === 0) return true;
|
|
570
727
|
const mime = file.type;
|
|
@@ -636,7 +793,7 @@ var sendButtonVariants = classVarianceAuthority.cva(
|
|
|
636
793
|
}
|
|
637
794
|
}
|
|
638
795
|
);
|
|
639
|
-
var SendButton =
|
|
796
|
+
var SendButton = React3__namespace.forwardRef(
|
|
640
797
|
({ className, variant, canSend, isLoading, disabled, ...props }, ref) => {
|
|
641
798
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
642
799
|
"button",
|
|
@@ -701,7 +858,7 @@ var SendButton = React2__namespace.forwardRef(
|
|
|
701
858
|
}
|
|
702
859
|
);
|
|
703
860
|
SendButton.displayName = "SendButton";
|
|
704
|
-
var MessageComposer =
|
|
861
|
+
var MessageComposer = React3__namespace.forwardRef(
|
|
705
862
|
({
|
|
706
863
|
onSend,
|
|
707
864
|
onTypingStart,
|
|
@@ -727,11 +884,11 @@ var MessageComposer = React2__namespace.forwardRef(
|
|
|
727
884
|
mentionOptions,
|
|
728
885
|
className
|
|
729
886
|
}, ref) => {
|
|
730
|
-
const textareaRef =
|
|
731
|
-
const [internalContent, setInternalContent] =
|
|
887
|
+
const textareaRef = React3__namespace.useRef(null);
|
|
888
|
+
const [internalContent, setInternalContent] = React3__namespace.useState("");
|
|
732
889
|
const isControlled = controlledValue !== void 0;
|
|
733
890
|
const content = isControlled ? controlledValue : internalContent;
|
|
734
|
-
const setContent =
|
|
891
|
+
const setContent = React3__namespace.useCallback(
|
|
735
892
|
(val) => {
|
|
736
893
|
if (isControlled) {
|
|
737
894
|
const newVal = typeof val === "function" ? val(controlledValue) : val;
|
|
@@ -742,20 +899,20 @@ var MessageComposer = React2__namespace.forwardRef(
|
|
|
742
899
|
},
|
|
743
900
|
[isControlled, controlledValue, onValueChange]
|
|
744
901
|
);
|
|
745
|
-
const [attachments, setAttachments] =
|
|
902
|
+
const [attachments, setAttachments] = React3__namespace.useState(
|
|
746
903
|
[]
|
|
747
904
|
);
|
|
748
|
-
const [isTyping, setIsTyping] =
|
|
749
|
-
const typingTimeoutRef =
|
|
750
|
-
|
|
751
|
-
|
|
905
|
+
const [isTyping, setIsTyping] = React3__namespace.useState(false);
|
|
906
|
+
const typingTimeoutRef = React3__namespace.useRef(null);
|
|
907
|
+
React3__namespace.useImperativeHandle(ref, () => textareaRef.current);
|
|
908
|
+
React3__namespace.useEffect(() => {
|
|
752
909
|
const textarea = textareaRef.current;
|
|
753
910
|
if (textarea) {
|
|
754
911
|
textarea.style.height = "auto";
|
|
755
912
|
textarea.style.height = `${Math.min(textarea.scrollHeight, 150)}px`;
|
|
756
913
|
}
|
|
757
914
|
}, [content]);
|
|
758
|
-
|
|
915
|
+
React3__namespace.useEffect(() => {
|
|
759
916
|
if (content.length > 0 && !isTyping) {
|
|
760
917
|
setIsTyping(true);
|
|
761
918
|
onTypingStart?.();
|
|
@@ -775,63 +932,22 @@ var MessageComposer = React2__namespace.forwardRef(
|
|
|
775
932
|
}
|
|
776
933
|
};
|
|
777
934
|
}, [content, isTyping, onTypingStart, onTypingStop]);
|
|
778
|
-
|
|
935
|
+
React3__namespace.useEffect(() => {
|
|
779
936
|
if (autoFocus) {
|
|
780
937
|
textareaRef.current?.focus();
|
|
781
938
|
}
|
|
782
939
|
}, [autoFocus]);
|
|
783
|
-
|
|
940
|
+
React3__namespace.useEffect(() => {
|
|
784
941
|
if (replyTo) {
|
|
785
942
|
textareaRef.current?.focus();
|
|
786
943
|
}
|
|
787
944
|
}, [replyTo]);
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
const mentionSuggestions = React2__namespace.useMemo(() => {
|
|
794
|
-
if (!mention || !mentionOptions) return [];
|
|
795
|
-
const q = mention.query.toLowerCase();
|
|
796
|
-
return mentionOptions.filter((o) => o.label.toLowerCase().includes(q));
|
|
797
|
-
}, [mention, mentionOptions]);
|
|
798
|
-
const mentionMenuOpen = mentionsEnabled && mention !== null && mentionSuggestions.length > 0;
|
|
799
|
-
const {
|
|
800
|
-
anchorRef: mentionAnchorRef,
|
|
801
|
-
floatingRef: mentionFloatingRef,
|
|
802
|
-
style: mentionStyle
|
|
803
|
-
} = chunkAOHJILLU_cjs.useAnchoredPosition({
|
|
804
|
-
open: mentionMenuOpen,
|
|
805
|
-
placement: "top-start",
|
|
806
|
-
maxHeight: 224
|
|
945
|
+
const mention = useMentionAutocomplete({
|
|
946
|
+
options: mentionOptions,
|
|
947
|
+
value: content,
|
|
948
|
+
setValue: setContent,
|
|
949
|
+
textareaRef
|
|
807
950
|
});
|
|
808
|
-
const clampedMentionHighlight = mentionMenuOpen ? Math.min(mentionHighlight, mentionSuggestions.length - 1) : -1;
|
|
809
|
-
const activeMentionOptionId = mentionMenuOpen ? mentionOptionId(clampedMentionHighlight) : void 0;
|
|
810
|
-
const syncMention = React2__namespace.useCallback(
|
|
811
|
-
(value, caret) => {
|
|
812
|
-
if (!mentionsEnabled) return;
|
|
813
|
-
setMention(activeMentionQuery(value, caret));
|
|
814
|
-
setMentionHighlight(0);
|
|
815
|
-
},
|
|
816
|
-
[mentionsEnabled]
|
|
817
|
-
);
|
|
818
|
-
const insertMention = (option) => {
|
|
819
|
-
if (!mention) return;
|
|
820
|
-
const insertValue = option.value ?? option.label.split(" ")[0];
|
|
821
|
-
const before = content.slice(0, mention.start);
|
|
822
|
-
const after = content.slice(mention.start + 1 + mention.query.length);
|
|
823
|
-
const insert = `@${insertValue} `;
|
|
824
|
-
setContent(before + insert + after);
|
|
825
|
-
setMention(null);
|
|
826
|
-
const caret = before.length + insert.length;
|
|
827
|
-
requestAnimationFrame(() => {
|
|
828
|
-
const el = textareaRef.current;
|
|
829
|
-
if (el) {
|
|
830
|
-
el.focus();
|
|
831
|
-
el.setSelectionRange(caret, caret);
|
|
832
|
-
}
|
|
833
|
-
});
|
|
834
|
-
};
|
|
835
951
|
const canSend = (content.trim().length > 0 || attachments.length > 0) && content.length <= maxLength && !disabled && !isSending;
|
|
836
952
|
const handleSubmit = async (event) => {
|
|
837
953
|
event.preventDefault();
|
|
@@ -853,31 +969,7 @@ var MessageComposer = React2__namespace.forwardRef(
|
|
|
853
969
|
}
|
|
854
970
|
};
|
|
855
971
|
const handleKeyDown = (event) => {
|
|
856
|
-
if (
|
|
857
|
-
if (event.key === "ArrowDown") {
|
|
858
|
-
event.preventDefault();
|
|
859
|
-
setMentionHighlight((h) => (h + 1) % mentionSuggestions.length);
|
|
860
|
-
return;
|
|
861
|
-
}
|
|
862
|
-
if (event.key === "ArrowUp") {
|
|
863
|
-
event.preventDefault();
|
|
864
|
-
setMentionHighlight(
|
|
865
|
-
(h) => (h - 1 + mentionSuggestions.length) % mentionSuggestions.length
|
|
866
|
-
);
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
if (event.key === "Enter" || event.key === "Tab") {
|
|
870
|
-
event.preventDefault();
|
|
871
|
-
const chosen = mentionSuggestions[mentionHighlight] ?? mentionSuggestions[0];
|
|
872
|
-
if (chosen) insertMention(chosen);
|
|
873
|
-
return;
|
|
874
|
-
}
|
|
875
|
-
if (event.key === "Escape") {
|
|
876
|
-
event.preventDefault();
|
|
877
|
-
setMention(null);
|
|
878
|
-
return;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
972
|
+
if (mention.handleKeyDown(event)) return;
|
|
881
973
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
882
974
|
event.preventDefault();
|
|
883
975
|
if (canSend) {
|
|
@@ -923,7 +1015,7 @@ var MessageComposer = React2__namespace.forwardRef(
|
|
|
923
1015
|
return prev.filter((a) => a.id !== attachmentId);
|
|
924
1016
|
});
|
|
925
1017
|
};
|
|
926
|
-
|
|
1018
|
+
React3__namespace.useEffect(() => {
|
|
927
1019
|
const currentAttachments = attachments;
|
|
928
1020
|
return () => {
|
|
929
1021
|
currentAttachments.forEach((a) => {
|
|
@@ -1054,49 +1146,9 @@ var MessageComposer = React2__namespace.forwardRef(
|
|
|
1054
1146
|
{
|
|
1055
1147
|
"data-slot": "composer-input-wrapper",
|
|
1056
1148
|
className: "relative flex-1",
|
|
1057
|
-
ref:
|
|
1149
|
+
ref: mention.anchorRef,
|
|
1058
1150
|
children: [
|
|
1059
|
-
|
|
1060
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1061
|
-
"ul",
|
|
1062
|
-
{
|
|
1063
|
-
ref: mentionFloatingRef,
|
|
1064
|
-
style: mentionStyle,
|
|
1065
|
-
id: mentionListId,
|
|
1066
|
-
role: "listbox",
|
|
1067
|
-
"aria-label": "Mention",
|
|
1068
|
-
"data-slot": "composer-mention-list",
|
|
1069
|
-
className: "w-64 overflow-y-auto rounded-lg border border-neutral-200 bg-white py-1 shadow-lg dark:border-neutral-700 dark:bg-neutral-800",
|
|
1070
|
-
children: mentionSuggestions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1071
|
-
"button",
|
|
1072
|
-
{
|
|
1073
|
-
type: "button",
|
|
1074
|
-
id: mentionOptionId(i),
|
|
1075
|
-
role: "option",
|
|
1076
|
-
"aria-selected": i === clampedMentionHighlight,
|
|
1077
|
-
onMouseDown: (e) => {
|
|
1078
|
-
e.preventDefault();
|
|
1079
|
-
insertMention(option);
|
|
1080
|
-
},
|
|
1081
|
-
onMouseEnter: () => setMentionHighlight(i),
|
|
1082
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
1083
|
-
"flex w-full items-center gap-2 px-3 py-1.5 text-start text-sm",
|
|
1084
|
-
i === clampedMentionHighlight ? "bg-primary-100 text-primary-900 dark:bg-primary-900/40 dark:text-primary-100" : "text-neutral-700 dark:text-neutral-200"
|
|
1085
|
-
),
|
|
1086
|
-
children: [
|
|
1087
|
-
option.icon,
|
|
1088
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
1089
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: option.label }),
|
|
1090
|
-
option.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ms-1 text-xs text-neutral-400", children: option.description })
|
|
1091
|
-
] }),
|
|
1092
|
-
option.meta && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-neutral-400", children: option.meta })
|
|
1093
|
-
]
|
|
1094
|
-
}
|
|
1095
|
-
) }, option.id))
|
|
1096
|
-
}
|
|
1097
|
-
),
|
|
1098
|
-
document.body
|
|
1099
|
-
),
|
|
1151
|
+
/* @__PURE__ */ jsxRuntime.jsx(MentionMenu, { mention }),
|
|
1100
1152
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1101
1153
|
"textarea",
|
|
1102
1154
|
{
|
|
@@ -1105,14 +1157,14 @@ var MessageComposer = React2__namespace.forwardRef(
|
|
|
1105
1157
|
value: content,
|
|
1106
1158
|
onChange: (e) => {
|
|
1107
1159
|
setContent(e.target.value);
|
|
1108
|
-
|
|
1160
|
+
mention.sync(
|
|
1109
1161
|
e.target.value,
|
|
1110
1162
|
e.target.selectionStart ?? e.target.value.length
|
|
1111
1163
|
);
|
|
1112
1164
|
},
|
|
1113
1165
|
onClick: (e) => {
|
|
1114
1166
|
const el = e.currentTarget;
|
|
1115
|
-
|
|
1167
|
+
mention.sync(el.value, el.selectionStart ?? el.value.length);
|
|
1116
1168
|
},
|
|
1117
1169
|
onKeyDown: handleKeyDown,
|
|
1118
1170
|
onPaste: handlePaste,
|
|
@@ -1132,11 +1184,7 @@ var MessageComposer = React2__namespace.forwardRef(
|
|
|
1132
1184
|
),
|
|
1133
1185
|
"aria-label": "Message",
|
|
1134
1186
|
"aria-describedby": showCharacterCount ? "char-count" : void 0,
|
|
1135
|
-
...
|
|
1136
|
-
"aria-controls": mentionMenuOpen ? mentionListId : void 0,
|
|
1137
|
-
"aria-activedescendant": activeMentionOptionId,
|
|
1138
|
-
"aria-autocomplete": "list"
|
|
1139
|
-
} : {}
|
|
1187
|
+
...mention.inputProps
|
|
1140
1188
|
}
|
|
1141
1189
|
),
|
|
1142
1190
|
inputTrailing && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1184,11 +1232,13 @@ exports.AttachmentPreviewItem = AttachmentPreviewItem;
|
|
|
1184
1232
|
exports.CameraButton = CameraButton;
|
|
1185
1233
|
exports.CharacterCounter = CharacterCounter;
|
|
1186
1234
|
exports.DragDropZone = DragDropZone;
|
|
1235
|
+
exports.MentionMenu = MentionMenu;
|
|
1187
1236
|
exports.MessageComposer = MessageComposer;
|
|
1188
1237
|
exports.SendButton = SendButton;
|
|
1189
1238
|
exports.generateAttachmentId = generateAttachmentId;
|
|
1190
1239
|
exports.getFileType = getFileType;
|
|
1191
1240
|
exports.sendButtonVariants = sendButtonVariants;
|
|
1241
|
+
exports.useMentionAutocomplete = useMentionAutocomplete;
|
|
1192
1242
|
exports.validateFile = validateFile;
|
|
1193
|
-
//# sourceMappingURL=chunk-
|
|
1194
|
-
//# sourceMappingURL=chunk-
|
|
1243
|
+
//# sourceMappingURL=chunk-5BVFVXHN.cjs.map
|
|
1244
|
+
//# sourceMappingURL=chunk-5BVFVXHN.cjs.map
|