reachat 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/{CSVFileRenderer-C95MrG0M.js → CSVFileRenderer-Dy3iLTeu.js} +2 -2
- package/dist/{CSVFileRenderer-C95MrG0M.js.map → CSVFileRenderer-Dy3iLTeu.js.map} +1 -1
- package/dist/ChatBubble/ChatBubble.d.ts +7 -11
- package/dist/{DefaultFileRenderer-Chpp-Qiu.js → DefaultFileRenderer-Dxar9MFe.js} +2 -2
- package/dist/{DefaultFileRenderer-Chpp-Qiu.js.map → DefaultFileRenderer-Dxar9MFe.js.map} +1 -1
- package/dist/docs.json +7 -26
- package/dist/{index-B1krf7tH.js → index-NuRjkHCl.js} +30 -135
- package/dist/{index-B1krf7tH.js.map → index-NuRjkHCl.js.map} +1 -1
- package/dist/index.css +25 -21
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +27 -132
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +2 -1
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { useState, useRef, useEffect } from "react";
|
|
4
4
|
import { AnimatePresence, motion } from "motion/react";
|
|
5
|
-
import { a as SvgCopy } from "./index-
|
|
5
|
+
import { a as SvgCopy } from "./index-NuRjkHCl.js";
|
|
6
6
|
import { IconButton } from "reablocks";
|
|
7
7
|
const sanitizeSVGCell = (cell) => {
|
|
8
8
|
const trimmed = cell.trim();
|
|
@@ -138,4 +138,4 @@ const CSVFileRenderer = ({ name, url, fileIcon }) => {
|
|
|
138
138
|
export {
|
|
139
139
|
CSVFileRenderer as default
|
|
140
140
|
};
|
|
141
|
-
//# sourceMappingURL=CSVFileRenderer-
|
|
141
|
+
//# sourceMappingURL=CSVFileRenderer-Dy3iLTeu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CSVFileRenderer-C95MrG0M.js","sources":["../src/utils/sanitize.ts","../src/utils/parseCSV.ts","../src/assets/download.svg?react","../src/SessionMessages/SessionMessage/MessageFile/renderers/CSVFileRenderer.tsx"],"sourcesContent":["\n/**\n * Sanitizes cell content to prevent CSV injection and other potential vulnerabilities.\n * Based on the documentation of OWASP for CSV Injection\n * https://owasp.org/www-community/attacks/CSV_Injection\n * @param cell The cell content to sanitize.\n * @returns The sanitized cell content.\n */\nexport const sanitizeSVGCell = (cell: string): string => {\n const trimmed = cell.trim();\n // Escape double quotes by doubling them\n const escaped = trimmed.replace(/\"/g, '\"\"');\n // Add single quote prefix only for potentially dangerous content\n const prefix = /^[=+\\-@]/.test(trimmed) ? '\\'' : '';\n // Only wrap in quotes if the content contains special characters\n const needsQuotes = /[\",\\n\\r]/.test(escaped) || prefix;\n\n return needsQuotes ? `\"${prefix}${escaped}\"` : escaped;\n};\n","import { sanitizeSVGCell } from './sanitize';\n\n/**\n * Parses a CSV string from a local file and returns an array of rows.\n * Sanitizes cell data to prevent injection attacks.\n * @param csvString The raw CSV string content to parse.\n * @returns The parsed CSV data as a 2D array of strings.\n */\nexport const parseCSV = (csvString: string): string[][] => {\n try {\n const rows = csvString.split('\\n');\n return rows.map((row) => row.split(',').map((cell) => sanitizeSVGCell(cell)));\n } catch (error) {\n console.error('Error parsing CSV:', error);\n throw new Error('Failed to parse CSV file.');\n }\n};\n","import * as React from \"react\";\nconst SvgDownload = (props) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\", className: \"lucide lucide-cloud-download\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M12 12v9\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"m8 17 4 4 4-4\" }));\nexport default SvgDownload;\n","import { FC, useEffect, useState, ReactElement, useRef } from 'react';\nimport { motion, AnimatePresence } from 'motion/react';\nimport { parseCSV } from '@/utils/parseCSV';\nimport DownloadIcon from '@/assets/download.svg?react';\nimport PlaceholderIcon from '@/assets/copy.svg?react';\nimport { IconButton } from 'reablocks';\n\ninterface CSVFileRendererProps {\n /**\n * Name of the file.\n */\n name?: string;\n\n /**\n * URL of the file.\n */\n url: string;\n\n /**\n * Icon to for file type.\n */\n fileIcon?: ReactElement;\n}\n\n/**\n * Renderer for CSV files that fetches and displays a snippet of the file data.\n */\nconst CSVFileRenderer: FC<CSVFileRendererProps> = ({ name, url, fileIcon }) => {\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [csvData, setCsvData] = useState<string[][]>([]);\n const [error, setError] = useState<string | null>(null);\n const [isModalOpen, setIsModalOpen] = useState(false);\n const modalRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const fetchCsvData = async () => {\n try {\n setIsLoading(true);\n const response = await fetch(url);\n const data = parseCSV(await response.text());\n setCsvData(data);\n } catch {\n setError('Failed to load CSV file.');\n } finally {\n setIsLoading(false);\n }\n };\n\n fetchCsvData();\n }, [url]);\n\n const toggleModal = () => {\n setIsModalOpen(prev => !prev);\n };\n\n const handleClickOutside = (event: MouseEvent) => {\n if (modalRef.current && !modalRef.current.contains(event.target as Node)) {\n setIsModalOpen(false);\n }\n };\n\n useEffect(() => {\n if (isModalOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n } else {\n document.removeEventListener('mousedown', handleClickOutside);\n }\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, [isModalOpen]);\n\n const downloadCSV = () => {\n if (csvData.length === 0) return;\n\n const csvContent = csvData.map(row => row.join(',')).join('\\n');\n const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.setAttribute('download', `${name || 'data'}`);\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n };\n\n const renderTable = (data: string[][], maxRows?: number) => (\n <motion.table\n layout\n className=\"w-full\"\n transition={{ type: 'spring', stiffness: 100, damping: 20 }}\n >\n <thead className=\"sticky top-0 bg-gray-200 dark:bg-gray-800 z-10\">\n <tr>\n <th className=\"py-4 px-6\">#</th>\n {data[0].map((header, index) => (\n <th key={`header-${index}`} className=\"py-4 px-6\">\n {header}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {data.slice(1, maxRows).map((row, rowIndex) => (\n <tr\n key={`row-${rowIndex}`}\n className=\"border-b border-panel-accent light:border-gray-700 hover:bg-panel-accent hover:light:bg-gray-700/40 transition-colors text-base\"\n >\n <td className=\"py-4 px-6\">{rowIndex + 1}</td>\n {row.map((cell, cellIndex) => (\n <td key={`cell-${rowIndex}-${cellIndex}`} className=\"py-4 px-6\">\n {cell}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </motion.table>\n );\n\n return (\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex justify-between items-center gap-4\">\n <div className=\"csv-icon flex items-center\">\n {fileIcon}\n {name && <figcaption className=\"ml-1\">{name}</figcaption>}\n </div>\n <div className=\"csv-icon flex items-center gap-6\">\n <IconButton size=\"small\" variant=\"text\" onClick={downloadCSV}>\n <DownloadIcon />\n </IconButton>\n <IconButton size=\"small\" variant=\"text\" onClick={toggleModal}>\n <PlaceholderIcon />\n </IconButton>\n </div>\n </div>\n\n {error && <div className=\"error-message\">{error}</div>}\n\n {isLoading && !csvData && (\n <div className=\"text-text-secondary\">Loading...</div>\n )}\n\n <div className=\"flex justify-between\">\n {!error && csvData.length > 0 && renderTable(csvData, 6)}\n </div>\n\n <AnimatePresence>\n {isModalOpen && (\n <motion.div\n className=\"fixed inset-0 bg-black/70 flex justify-center items-center z-50\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3 }}\n >\n <motion.div\n ref={modalRef}\n className=\"bg-white dark:bg-gray-900 rounded-md w-11/12 h-5/6 overflow-auto\"\n initial={{ scale: 0.8 }}\n animate={{ scale: 1 }}\n exit={{ scale: 0.8 }}\n transition={{ duration: 0.3 }}\n >\n {!error && csvData.length > 0 && renderTable(csvData)}\n </motion.div>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n};\n\nexport default CSVFileRenderer;\n"],"names":["url","DownloadIcon","PlaceholderIcon"],"mappings":";;;;;;AAQa,MAAA,kBAAkB,CAAC,SAAyB;AACjD,QAAA,UAAU,KAAK,KAAK;AAE1B,QAAM,UAAU,QAAQ,QAAQ,MAAM,IAAI;AAE1C,QAAM,SAAS,WAAW,KAAK,OAAO,IAAI,MAAO;AAEjD,QAAM,cAAc,WAAW,KAAK,OAAO,KAAK;AAEhD,SAAO,cAAc,IAAI,MAAM,GAAG,OAAO,MAAM;AACjD;ACVa,MAAA,WAAW,CAAC,cAAkC;AACrD,MAAA;AACI,UAAA,OAAO,UAAU,MAAM,IAAI;AACjC,WAAO,KAAK,IAAI,CAAC,QAAQ,IAAI,MAAM,GAAG,EAAE,IAAI,CAAC,SAAS,gBAAgB,IAAI,CAAC,CAAC;AAAA,WACrE,OAAO;AACN,YAAA,MAAM,sBAAsB,KAAK;AACnC,UAAA,IAAI,MAAM,2BAA2B;AAAA,EAAA;AAE/C;ACfA,MAAM,cAAc,CAAC,UAA0B,sBAAM,cAAc,OAAO,EAAE,OAAO,8BAA8B,OAAO,IAAI,QAAQ,IAAI,SAAS,aAAa,MAAM,QAAQ,QAAQ,gBAAgB,aAAa,GAAG,eAAe,SAAS,gBAAgB,SAAS,WAAW,gCAAgC,GAAG,MAAO,GAAkB,sBAAM,cAAc,QAAQ,EAAE,GAAG,2DAA4D,CAAA,GAAmB,sBAAM,cAAc,QAAQ,EAAE,GAAG,WAAU,CAAE,GAAmB,sBAAM,cAAc,QAAQ,EAAE,GAAG,gBAAiB,CAAA,CAAC;AC0B/iB,MAAM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SAAS,QAAQ,SAAS,KAAK,YAAY,OAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MACtD;AAAA,IAAA,EAGN,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"CSVFileRenderer-Dy3iLTeu.js","sources":["../src/utils/sanitize.ts","../src/utils/parseCSV.ts","../src/assets/download.svg?react","../src/SessionMessages/SessionMessage/MessageFile/renderers/CSVFileRenderer.tsx"],"sourcesContent":["\n/**\n * Sanitizes cell content to prevent CSV injection and other potential vulnerabilities.\n * Based on the documentation of OWASP for CSV Injection\n * https://owasp.org/www-community/attacks/CSV_Injection\n * @param cell The cell content to sanitize.\n * @returns The sanitized cell content.\n */\nexport const sanitizeSVGCell = (cell: string): string => {\n const trimmed = cell.trim();\n // Escape double quotes by doubling them\n const escaped = trimmed.replace(/\"/g, '\"\"');\n // Add single quote prefix only for potentially dangerous content\n const prefix = /^[=+\\-@]/.test(trimmed) ? '\\'' : '';\n // Only wrap in quotes if the content contains special characters\n const needsQuotes = /[\",\\n\\r]/.test(escaped) || prefix;\n\n return needsQuotes ? `\"${prefix}${escaped}\"` : escaped;\n};\n","import { sanitizeSVGCell } from './sanitize';\n\n/**\n * Parses a CSV string from a local file and returns an array of rows.\n * Sanitizes cell data to prevent injection attacks.\n * @param csvString The raw CSV string content to parse.\n * @returns The parsed CSV data as a 2D array of strings.\n */\nexport const parseCSV = (csvString: string): string[][] => {\n try {\n const rows = csvString.split('\\n');\n return rows.map((row) => row.split(',').map((cell) => sanitizeSVGCell(cell)));\n } catch (error) {\n console.error('Error parsing CSV:', error);\n throw new Error('Failed to parse CSV file.');\n }\n};\n","import * as React from \"react\";\nconst SvgDownload = (props) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\", className: \"lucide lucide-cloud-download\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M12 12v9\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"m8 17 4 4 4-4\" }));\nexport default SvgDownload;\n","import { FC, useEffect, useState, ReactElement, useRef } from 'react';\nimport { motion, AnimatePresence } from 'motion/react';\nimport { parseCSV } from '@/utils/parseCSV';\nimport DownloadIcon from '@/assets/download.svg?react';\nimport PlaceholderIcon from '@/assets/copy.svg?react';\nimport { IconButton } from 'reablocks';\n\ninterface CSVFileRendererProps {\n /**\n * Name of the file.\n */\n name?: string;\n\n /**\n * URL of the file.\n */\n url: string;\n\n /**\n * Icon to for file type.\n */\n fileIcon?: ReactElement;\n}\n\n/**\n * Renderer for CSV files that fetches and displays a snippet of the file data.\n */\nconst CSVFileRenderer: FC<CSVFileRendererProps> = ({ name, url, fileIcon }) => {\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [csvData, setCsvData] = useState<string[][]>([]);\n const [error, setError] = useState<string | null>(null);\n const [isModalOpen, setIsModalOpen] = useState(false);\n const modalRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const fetchCsvData = async () => {\n try {\n setIsLoading(true);\n const response = await fetch(url);\n const data = parseCSV(await response.text());\n setCsvData(data);\n } catch {\n setError('Failed to load CSV file.');\n } finally {\n setIsLoading(false);\n }\n };\n\n fetchCsvData();\n }, [url]);\n\n const toggleModal = () => {\n setIsModalOpen(prev => !prev);\n };\n\n const handleClickOutside = (event: MouseEvent) => {\n if (modalRef.current && !modalRef.current.contains(event.target as Node)) {\n setIsModalOpen(false);\n }\n };\n\n useEffect(() => {\n if (isModalOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n } else {\n document.removeEventListener('mousedown', handleClickOutside);\n }\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, [isModalOpen]);\n\n const downloadCSV = () => {\n if (csvData.length === 0) return;\n\n const csvContent = csvData.map(row => row.join(',')).join('\\n');\n const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.setAttribute('download', `${name || 'data'}`);\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n };\n\n const renderTable = (data: string[][], maxRows?: number) => (\n <motion.table\n layout\n className=\"w-full\"\n transition={{ type: 'spring', stiffness: 100, damping: 20 }}\n >\n <thead className=\"sticky top-0 bg-gray-200 dark:bg-gray-800 z-10\">\n <tr>\n <th className=\"py-4 px-6\">#</th>\n {data[0].map((header, index) => (\n <th key={`header-${index}`} className=\"py-4 px-6\">\n {header}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {data.slice(1, maxRows).map((row, rowIndex) => (\n <tr\n key={`row-${rowIndex}`}\n className=\"border-b border-panel-accent light:border-gray-700 hover:bg-panel-accent hover:light:bg-gray-700/40 transition-colors text-base\"\n >\n <td className=\"py-4 px-6\">{rowIndex + 1}</td>\n {row.map((cell, cellIndex) => (\n <td key={`cell-${rowIndex}-${cellIndex}`} className=\"py-4 px-6\">\n {cell}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </motion.table>\n );\n\n return (\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex justify-between items-center gap-4\">\n <div className=\"csv-icon flex items-center\">\n {fileIcon}\n {name && <figcaption className=\"ml-1\">{name}</figcaption>}\n </div>\n <div className=\"csv-icon flex items-center gap-6\">\n <IconButton size=\"small\" variant=\"text\" onClick={downloadCSV}>\n <DownloadIcon />\n </IconButton>\n <IconButton size=\"small\" variant=\"text\" onClick={toggleModal}>\n <PlaceholderIcon />\n </IconButton>\n </div>\n </div>\n\n {error && <div className=\"error-message\">{error}</div>}\n\n {isLoading && !csvData && (\n <div className=\"text-text-secondary\">Loading...</div>\n )}\n\n <div className=\"flex justify-between\">\n {!error && csvData.length > 0 && renderTable(csvData, 6)}\n </div>\n\n <AnimatePresence>\n {isModalOpen && (\n <motion.div\n className=\"fixed inset-0 bg-black/70 flex justify-center items-center z-50\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3 }}\n >\n <motion.div\n ref={modalRef}\n className=\"bg-white dark:bg-gray-900 rounded-md w-11/12 h-5/6 overflow-auto\"\n initial={{ scale: 0.8 }}\n animate={{ scale: 1 }}\n exit={{ scale: 0.8 }}\n transition={{ duration: 0.3 }}\n >\n {!error && csvData.length > 0 && renderTable(csvData)}\n </motion.div>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n};\n\nexport default CSVFileRenderer;\n"],"names":["url","DownloadIcon","PlaceholderIcon"],"mappings":";;;;;;AAQa,MAAA,kBAAkB,CAAC,SAAyB;AACjD,QAAA,UAAU,KAAK,KAAK;AAE1B,QAAM,UAAU,QAAQ,QAAQ,MAAM,IAAI;AAE1C,QAAM,SAAS,WAAW,KAAK,OAAO,IAAI,MAAO;AAEjD,QAAM,cAAc,WAAW,KAAK,OAAO,KAAK;AAEhD,SAAO,cAAc,IAAI,MAAM,GAAG,OAAO,MAAM;AACjD;ACVa,MAAA,WAAW,CAAC,cAAkC;AACrD,MAAA;AACI,UAAA,OAAO,UAAU,MAAM,IAAI;AACjC,WAAO,KAAK,IAAI,CAAC,QAAQ,IAAI,MAAM,GAAG,EAAE,IAAI,CAAC,SAAS,gBAAgB,IAAI,CAAC,CAAC;AAAA,WACrE,OAAO;AACN,YAAA,MAAM,sBAAsB,KAAK;AACnC,UAAA,IAAI,MAAM,2BAA2B;AAAA,EAAA;AAE/C;ACfA,MAAM,cAAc,CAAC,UAA0B,sBAAM,cAAc,OAAO,EAAE,OAAO,8BAA8B,OAAO,IAAI,QAAQ,IAAI,SAAS,aAAa,MAAM,QAAQ,QAAQ,gBAAgB,aAAa,GAAG,eAAe,SAAS,gBAAgB,SAAS,WAAW,gCAAgC,GAAG,MAAO,GAAkB,sB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L,WAAU;AAAA,YACV,SAAS,EAAE,OAAO,IAAI;AAAA,YACtB,SAAS,EAAE,OAAO,EAAE;AAAA,YACpB,MAAM,EAAE,OAAO,IAAI;AAAA,YACnB,YAAY,EAAE,UAAU,IAAI;AAAA,YAE3B,WAAC,SAAS,QAAQ,SAAS,KAAK,YAAY,OAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MACtD;AAAA,IAAA,EAGN,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Modifiers, Placement } from 'reablocks';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
3
|
export interface ChatBubbleProps {
|
|
4
4
|
/**
|
|
5
5
|
* The main content to be rendered.
|
|
@@ -11,18 +11,14 @@ export interface ChatBubbleProps {
|
|
|
11
11
|
bubbleContent: ReactNode;
|
|
12
12
|
/**
|
|
13
13
|
* The position of the chat bubble on the screen.
|
|
14
|
-
* @default '
|
|
14
|
+
* @default 'right-end'
|
|
15
15
|
*/
|
|
16
|
-
position?:
|
|
16
|
+
position?: Placement;
|
|
17
17
|
/**
|
|
18
|
-
* Custom
|
|
18
|
+
* Custom position modifiers.
|
|
19
|
+
* @default [offset({ mainAxis: 0, crossAxis: -40 })]
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The DOM element where the chat bubble should be rendered.
|
|
23
|
-
* @default document.body
|
|
24
|
-
*/
|
|
25
|
-
portalTarget?: HTMLElement | null;
|
|
21
|
+
modifiers?: Modifiers;
|
|
26
22
|
/**
|
|
27
23
|
* Additional CSS classes to apply to the chat bubble.
|
|
28
24
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { S as SvgFile } from "./index-
|
|
2
|
+
import { S as SvgFile } from "./index-NuRjkHCl.js";
|
|
3
3
|
import { cn, Ellipsis } from "reablocks";
|
|
4
4
|
const DefaultFileRenderer = ({
|
|
5
5
|
name,
|
|
@@ -12,4 +12,4 @@ const DefaultFileRenderer = ({
|
|
|
12
12
|
export {
|
|
13
13
|
DefaultFileRenderer as default
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=DefaultFileRenderer-
|
|
15
|
+
//# sourceMappingURL=DefaultFileRenderer-Dxar9MFe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultFileRenderer-
|
|
1
|
+
{"version":3,"file":"DefaultFileRenderer-Dxar9MFe.js","sources":["../src/SessionMessages/SessionMessage/MessageFile/renderers/DefaultFileRenderer.tsx"],"sourcesContent":["import { FC, ReactElement } from 'react';\nimport FileIcon from '@/assets/file.svg?react';\nimport { Ellipsis, cn } from 'reablocks';\n\ninterface DefaultFileRendererProps {\n /**\n * Limit for the name.\n */\n limit?: number;\n\n /**\n * Name of the file.\n */\n name?: string;\n\n /**\n * URL of the file.\n */\n url: string;\n\n /**\n * Icon to for file type.\n */\n fileIcon?: ReactElement;\n}\n\n/**\n * Default renderer for unspecified file types.\n */\nconst DefaultFileRenderer: FC<DefaultFileRendererProps> = ({\n name,\n limit = 100,\n fileIcon = <FileIcon />,\n}) => (\n <figure className=\"flex items-center gap-2\">\n {fileIcon}\n {name && (\n <figcaption className={cn('file-name-class')}>\n <Ellipsis value={name} limit={limit} />\n </figcaption>\n )}\n </figure>\n);\n\nexport default DefaultFileRenderer;\n"],"names":["FileIcon"],"mappings":";;;AA6BA,MAAM,sBAAoD,CAAC;AAAA,EACzD;AAAA,EACA,QAAQ;AAAA,EACR,+BAAYA,SAAS,CAAA,CAAA;AACvB,MACE,qBAAC,UAAO,EAAA,WAAU,2BACf,UAAA;AAAA,EAAA;AAAA,EACA,QACC,oBAAC,cAAW,EAAA,WAAW,GAAG,iBAAiB,GACzC,UAAA,oBAAC,UAAS,EAAA,OAAO,MAAM,MAAc,CAAA,EACvC,CAAA;AAAA,EAEJ,CAAA;"}
|
package/dist/docs.json
CHANGED
|
@@ -391,7 +391,7 @@
|
|
|
391
391
|
},
|
|
392
392
|
"position": {
|
|
393
393
|
"defaultValue": {
|
|
394
|
-
"value": "'
|
|
394
|
+
"value": "'right-end'"
|
|
395
395
|
},
|
|
396
396
|
"description": "The position of the chat bubble on the screen.",
|
|
397
397
|
"name": "position",
|
|
@@ -407,34 +407,15 @@
|
|
|
407
407
|
],
|
|
408
408
|
"required": false,
|
|
409
409
|
"type": {
|
|
410
|
-
"name": "
|
|
410
|
+
"name": "Placement"
|
|
411
411
|
}
|
|
412
412
|
},
|
|
413
|
-
"
|
|
414
|
-
"defaultValue": null,
|
|
415
|
-
"description": "Custom CSS styles to override the default positioning.",
|
|
416
|
-
"name": "customPosition",
|
|
417
|
-
"parent": {
|
|
418
|
-
"fileName": "src/ChatBubble/ChatBubble.tsx",
|
|
419
|
-
"name": "ChatBubbleProps"
|
|
420
|
-
},
|
|
421
|
-
"declarations": [
|
|
422
|
-
{
|
|
423
|
-
"fileName": "src/ChatBubble/ChatBubble.tsx",
|
|
424
|
-
"name": "ChatBubbleProps"
|
|
425
|
-
}
|
|
426
|
-
],
|
|
427
|
-
"required": false,
|
|
428
|
-
"type": {
|
|
429
|
-
"name": "CSSProperties"
|
|
430
|
-
}
|
|
431
|
-
},
|
|
432
|
-
"portalTarget": {
|
|
413
|
+
"modifiers": {
|
|
433
414
|
"defaultValue": {
|
|
434
|
-
"value": "
|
|
415
|
+
"value": "[offset({ mainAxis: 0, crossAxis: -40 })]"
|
|
435
416
|
},
|
|
436
|
-
"description": "
|
|
437
|
-
"name": "
|
|
417
|
+
"description": "Custom position modifiers.",
|
|
418
|
+
"name": "modifiers",
|
|
438
419
|
"parent": {
|
|
439
420
|
"fileName": "src/ChatBubble/ChatBubble.tsx",
|
|
440
421
|
"name": "ChatBubbleProps"
|
|
@@ -447,7 +428,7 @@
|
|
|
447
428
|
],
|
|
448
429
|
"required": false,
|
|
449
430
|
"type": {
|
|
450
|
-
"name": "
|
|
431
|
+
"name": "Modifiers"
|
|
451
432
|
}
|
|
452
433
|
},
|
|
453
434
|
"className": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { createContext, useContext, useRef, forwardRef, useState, useEffect, useImperativeHandle, lazy, useMemo, Suspense, useCallback, memo } from "react";
|
|
4
|
-
import { Button, cn, Textarea, Ellipsis, DateFormat, IconButton, Card, Divider, useInfinityList, useComponentTheme, ListItem, List } from "reablocks";
|
|
4
|
+
import { Button, cn, Textarea, Ellipsis, DateFormat, IconButton, Card, Divider, useInfinityList, useComponentTheme, ListItem, List, ConnectedOverlay } from "reablocks";
|
|
5
5
|
import { Slot } from "@radix-ui/react-slot";
|
|
6
6
|
import { motion, AnimatePresence } from "motion/react";
|
|
7
7
|
import ReactMarkdown from "react-markdown";
|
|
@@ -13,7 +13,7 @@ import remarkGfm from "remark-gfm";
|
|
|
13
13
|
import remarkYoutube from "remark-youtube";
|
|
14
14
|
import remarkMath from "remark-math";
|
|
15
15
|
import { isToday, isYesterday, isThisWeek, differenceInYears, format } from "date-fns";
|
|
16
|
-
import {
|
|
16
|
+
import { offset } from "@floating-ui/react";
|
|
17
17
|
const SvgSend = (props) => /* @__PURE__ */ React.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { id: "send" }, /* @__PURE__ */ React.createElement("path", { id: "Vector", d: "M14.6111 2.33327C14.5349 2.3339 14.4598 2.35194 14.3917 2.386L2.39168 8.386C2.31456 8.42456 2.24872 8.4824 2.20055 8.55391C2.15238 8.62543 2.12352 8.70818 2.11677 8.79414C2.11002 8.88009 2.12561 8.96634 2.16203 9.04449C2.19845 9.12264 2.25446 9.19005 2.32462 9.24017L4.52514 10.8124L5.47371 13.6581C5.50257 13.7447 5.55457 13.8217 5.62406 13.8808C5.69355 13.9399 5.7779 13.9789 5.86796 13.9935C5.95802 14.0082 6.05036 13.9979 6.13499 13.9638C6.21962 13.9297 6.2933 13.873 6.34806 13.8001L7.05249 12.8606L10.3207 15.2376C10.3843 15.2839 10.4579 15.3146 10.5355 15.3271C10.6132 15.3396 10.6927 15.3336 10.7676 15.3097C10.8425 15.2857 10.9107 15.2444 10.9667 15.1891C11.0226 15.1338 11.0647 15.0661 11.0896 14.9915L15.0896 2.99147C15.1148 2.91597 15.1216 2.83555 15.1094 2.7569C15.0972 2.67825 15.0665 2.60363 15.0197 2.53926C14.9729 2.47488 14.9114 2.42261 14.8403 2.38678C14.7693 2.35096 14.6907 2.33261 14.6111 2.33327ZM13.2478 5.35345L10.3565 14.0266L7.67293 12.0755L13.2478 5.35345ZM10.684 5.35801L4.934 9.87559L3.58113 8.90879L10.684 5.35801ZM11.2784 6.16205L6.56746 11.843C6.56681 11.8437 6.56616 11.8443 6.56551 11.845L6.56355 11.8476C6.55841 11.8538 6.55342 11.8601 6.54858 11.8665C6.54319 11.8733 6.53798 11.8802 6.53295 11.8873L6.12085 12.4361L5.53426 10.6751L11.2784 6.16205Z", fill: "currentColor" })));
|
|
18
18
|
const SvgStop = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-octagon-x", ...props }, /* @__PURE__ */ React.createElement("path", { d: "m15 9-6 6" }), /* @__PURE__ */ React.createElement("path", { d: "M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z" }), /* @__PURE__ */ React.createElement("path", { d: "m9 9 6 6" }));
|
|
19
19
|
const ChatContext = createContext({
|
|
@@ -1335,8 +1335,8 @@ function remarkCve() {
|
|
|
1335
1335
|
}
|
|
1336
1336
|
}
|
|
1337
1337
|
const SvgFile = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "currentColor", ...props }, /* @__PURE__ */ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.7036 1.37034C3.04741 1.02653 3.51373 0.833374 3.99996 0.833374H9.33329H9.33331C9.47275 0.833374 9.59885 0.890449 9.68954 0.98251L13.6843 4.97722C13.7763 5.0679 13.8333 5.19398 13.8333 5.33337L13.8333 5.3379V13.3334C13.8333 13.8196 13.6401 14.2859 13.2963 14.6297C12.9525 14.9736 12.4862 15.1667 12 15.1667H3.99996C3.51373 15.1667 3.04741 14.9736 2.7036 14.6297C2.35978 14.2859 2.16663 13.8196 2.16663 13.3334V2.66671C2.16663 2.18048 2.35978 1.71416 2.7036 1.37034ZM3.99996 1.83337H8.83331V5.33337C8.83331 5.60952 9.05717 5.83337 9.33331 5.83337H12.8333V13.3334C12.8333 13.5544 12.7455 13.7663 12.5892 13.9226C12.4329 14.0789 12.221 14.1667 12 14.1667H3.99996C3.77895 14.1667 3.56698 14.0789 3.4107 13.9226C3.25442 13.7663 3.16663 13.5544 3.16663 13.3334V2.66671C3.16663 2.44569 3.25442 2.23373 3.4107 2.07745C3.56698 1.92117 3.77895 1.83337 3.99996 1.83337ZM9.83331 2.5405L12.1262 4.83337H9.83331V2.5405ZM5.33331 8.16663C5.05717 8.16663 4.83331 8.39048 4.83331 8.66663C4.83331 8.94277 5.05717 9.16663 5.33331 9.16663H10.6666C10.9428 9.16663 11.1666 8.94277 11.1666 8.66663C11.1666 8.39048 10.9428 8.16663 10.6666 8.16663H5.33331ZM4.83331 11.3334C4.83331 11.0572 5.05717 10.8334 5.33331 10.8334H10.6666C10.9428 10.8334 11.1666 11.0572 11.1666 11.3334C11.1666 11.6095 10.9428 11.8334 10.6666 11.8334H5.33331C5.05717 11.8334 4.83331 11.6095 4.83331 11.3334ZM5.33331 5.5C5.05717 5.5 4.83331 5.72386 4.83331 6C4.83331 6.27614 5.05717 6.5 5.33331 6.5H6.66665C6.94279 6.5 7.16665 6.27614 7.16665 6C7.16665 5.72386 6.94279 5.5 6.66665 5.5H5.33331Z" }));
|
|
1338
|
-
const DefaultFileRenderer = lazy(() => import("./DefaultFileRenderer-
|
|
1339
|
-
const CSVFileRenderer = lazy(() => import("./CSVFileRenderer-
|
|
1338
|
+
const DefaultFileRenderer = lazy(() => import("./DefaultFileRenderer-Dxar9MFe.js"));
|
|
1339
|
+
const CSVFileRenderer = lazy(() => import("./CSVFileRenderer-Dy3iLTeu.js"));
|
|
1340
1340
|
const ImageFileRenderer = lazy(() => import("./ImageFileRenderer-C8tVW3I8.js"));
|
|
1341
1341
|
const PDFFileRenderer = lazy(() => import("./PDFFileRenderer-DQdFS2l6.js"));
|
|
1342
1342
|
const FILE_TYPE_RENDERER_MAP = {
|
|
@@ -2162,144 +2162,39 @@ const AppBar = ({
|
|
|
2162
2162
|
const theme = useComponentTheme("chat", customTheme);
|
|
2163
2163
|
return /* @__PURE__ */ jsx("div", { className: cn(theme.appbar), children: content });
|
|
2164
2164
|
};
|
|
2165
|
-
const defaultPositions = {
|
|
2166
|
-
"bottom-left": "bottom-5 left-5",
|
|
2167
|
-
"bottom-right": "bottom-5 right-5",
|
|
2168
|
-
"top-left": "top-5 left-5",
|
|
2169
|
-
"top-right": "top-5 right-5"
|
|
2170
|
-
};
|
|
2171
2165
|
const ChatBubble = memo(
|
|
2172
2166
|
({
|
|
2173
2167
|
children,
|
|
2174
2168
|
bubbleContent,
|
|
2175
|
-
position = "
|
|
2176
|
-
|
|
2177
|
-
portalTarget = typeof document !== "undefined" ? document.body : null,
|
|
2169
|
+
position = "right-end",
|
|
2170
|
+
modifiers = [offset({ mainAxis: 0, crossAxis: -40 })],
|
|
2178
2171
|
className
|
|
2179
2172
|
}) => {
|
|
2180
2173
|
const [isOpen, setIsOpen] = useState(false);
|
|
2181
|
-
const
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
setIsOpen((prev) => !prev);
|
|
2194
|
-
}, []);
|
|
2195
|
-
const getContentPosition = () => {
|
|
2196
|
-
if (!bubbleRect) return {};
|
|
2197
|
-
const positions = {
|
|
2198
|
-
"bottom-left": {
|
|
2199
|
-
bottom: `calc(100vh - ${bubbleRect.top}px)`,
|
|
2200
|
-
left: `${bubbleRect.right}px`
|
|
2201
|
-
},
|
|
2202
|
-
"bottom-right": {
|
|
2203
|
-
bottom: `calc(100vh - ${bubbleRect.top}px)`,
|
|
2204
|
-
right: `calc(100vw - ${bubbleRect.left}px)`
|
|
2205
|
-
},
|
|
2206
|
-
"top-left": {
|
|
2207
|
-
top: `${bubbleRect.bottom}px`,
|
|
2208
|
-
left: `${bubbleRect.right}px`
|
|
2209
|
-
},
|
|
2210
|
-
"top-right": {
|
|
2211
|
-
top: `${bubbleRect.bottom}px`,
|
|
2212
|
-
right: `calc(100vw - ${bubbleRect.left}px)`
|
|
2174
|
+
const ref = useRef(null);
|
|
2175
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2176
|
+
/* @__PURE__ */ jsx(
|
|
2177
|
+
ConnectedOverlay,
|
|
2178
|
+
{
|
|
2179
|
+
placement: position,
|
|
2180
|
+
modifiers,
|
|
2181
|
+
reference: ref.current,
|
|
2182
|
+
open: isOpen,
|
|
2183
|
+
onOpen: () => setIsOpen(true),
|
|
2184
|
+
onClose: () => setIsOpen(false),
|
|
2185
|
+
content: () => /* @__PURE__ */ jsx(Fragment, { children })
|
|
2213
2186
|
}
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
...portalTarget ? { position: "absolute" } : {}
|
|
2226
|
-
},
|
|
2227
|
-
onClick: handleToggle,
|
|
2228
|
-
className: cn(
|
|
2229
|
-
"z-[1000]",
|
|
2230
|
-
!portalTarget && "fixed",
|
|
2231
|
-
defaultPositions[position],
|
|
2232
|
-
"cursor-pointer",
|
|
2233
|
-
className
|
|
2234
|
-
),
|
|
2235
|
-
role: "button",
|
|
2236
|
-
tabIndex: 0,
|
|
2237
|
-
"aria-label": "Open chat",
|
|
2238
|
-
children: bubbleContent
|
|
2239
|
-
}
|
|
2240
|
-
),
|
|
2241
|
-
/* @__PURE__ */ jsx(AnimatePresence, { children: children && isOpen && bubbleRect && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2242
|
-
/* @__PURE__ */ jsx(
|
|
2243
|
-
motion.div,
|
|
2244
|
-
{
|
|
2245
|
-
initial: { opacity: 0 },
|
|
2246
|
-
animate: { opacity: 0.5 },
|
|
2247
|
-
exit: { opacity: 0 },
|
|
2248
|
-
className: "fixed inset-0 z-[998]",
|
|
2249
|
-
onClick: handleClose
|
|
2250
|
-
}
|
|
2251
|
-
),
|
|
2252
|
-
/* @__PURE__ */ jsx(
|
|
2253
|
-
motion.div,
|
|
2254
|
-
{
|
|
2255
|
-
ref: contentRef,
|
|
2256
|
-
initial: false,
|
|
2257
|
-
animate: {
|
|
2258
|
-
opacity: 1,
|
|
2259
|
-
scale: 1,
|
|
2260
|
-
x: 0,
|
|
2261
|
-
pointerEvents: "auto"
|
|
2262
|
-
},
|
|
2263
|
-
exit: {
|
|
2264
|
-
opacity: 0,
|
|
2265
|
-
scale: 0.8,
|
|
2266
|
-
x: position.includes("right") ? 20 : -20,
|
|
2267
|
-
pointerEvents: "none"
|
|
2268
|
-
},
|
|
2269
|
-
transition: { type: "spring", duration: 0.5 },
|
|
2270
|
-
className: cn(
|
|
2271
|
-
"fixed z-[999]",
|
|
2272
|
-
position.includes("right") ? "origin-right" : "origin-left",
|
|
2273
|
-
position.includes("top") ? "origin-top" : "origin-bottom"
|
|
2274
|
-
),
|
|
2275
|
-
style: getContentPosition(),
|
|
2276
|
-
children
|
|
2277
|
-
}
|
|
2278
|
-
)
|
|
2279
|
-
] }) })
|
|
2280
|
-
] }),
|
|
2281
|
-
[
|
|
2282
|
-
children,
|
|
2283
|
-
customPosition,
|
|
2284
|
-
portalTarget,
|
|
2285
|
-
position,
|
|
2286
|
-
className,
|
|
2287
|
-
bubbleContent,
|
|
2288
|
-
isOpen,
|
|
2289
|
-
handleClose,
|
|
2290
|
-
handleToggle,
|
|
2291
|
-
bubbleRect
|
|
2292
|
-
]
|
|
2293
|
-
);
|
|
2294
|
-
if (!portalTarget) {
|
|
2295
|
-
return content;
|
|
2296
|
-
}
|
|
2297
|
-
try {
|
|
2298
|
-
return createPortal(content, portalTarget);
|
|
2299
|
-
} catch (error) {
|
|
2300
|
-
console.error("Failed to create portal for ChatBubble:", error);
|
|
2301
|
-
return content;
|
|
2302
|
-
}
|
|
2187
|
+
),
|
|
2188
|
+
/* @__PURE__ */ jsx(
|
|
2189
|
+
"div",
|
|
2190
|
+
{
|
|
2191
|
+
ref,
|
|
2192
|
+
className,
|
|
2193
|
+
onClick: () => setIsOpen((prev) => !prev),
|
|
2194
|
+
children: bubbleContent
|
|
2195
|
+
}
|
|
2196
|
+
)
|
|
2197
|
+
] });
|
|
2303
2198
|
}
|
|
2304
2199
|
);
|
|
2305
2200
|
export {
|
|
@@ -2338,4 +2233,4 @@ export {
|
|
|
2338
2233
|
light as y,
|
|
2339
2234
|
ChatContext as z
|
|
2340
2235
|
};
|
|
2341
|
-
//# sourceMappingURL=index-
|
|
2236
|
+
//# sourceMappingURL=index-NuRjkHCl.js.map
|