funda-ui 4.6.151 → 4.6.333
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/Chatbox/index.css +88 -14
- package/Chatbox/index.d.ts +5 -0
- package/Chatbox/index.js +457 -281
- package/Utils/format-string.d.ts +64 -0
- package/Utils/format-string.js +157 -0
- package/lib/cjs/Chatbox/index.d.ts +5 -0
- package/lib/cjs/Chatbox/index.js +457 -281
- package/lib/cjs/Utils/format-string.d.ts +64 -0
- package/lib/cjs/Utils/format-string.js +157 -0
- package/lib/css/Chatbox/index.css +88 -14
- package/lib/esm/Chatbox/PureLoader.tsx +4 -2
- package/lib/esm/Chatbox/TypingEffect.tsx +12 -41
- package/lib/esm/Chatbox/index.scss +118 -28
- package/lib/esm/Chatbox/index.tsx +148 -36
- package/lib/esm/Chatbox/utils/func.ts +52 -1
- package/lib/esm/Textarea/index.tsx +0 -2
- package/lib/esm/Utils/libs/format-string.ts +106 -0
- package/package.json +1 -1
|
@@ -7,8 +7,6 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
|
7
7
|
import { actualPropertyValue, getTextTop } from 'funda-utils/dist/cjs/inputsCalculation';
|
|
8
8
|
import useDebounce from 'funda-utils/dist/cjs/useDebounce';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
10
|
export type TextareaProps = {
|
|
13
11
|
contentRef?: React.ForwardedRef<any>; // could use "Array" on contentRef.current, such as contentRef.current[0], contentRef.current[1]
|
|
14
12
|
wrapperClassName?: string;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String formatting utility functions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Remove all special characters except space from a string
|
|
7
|
+
* @param {string} input - The input string to process
|
|
8
|
+
* @returns {string} The processed string
|
|
9
|
+
*/
|
|
10
|
+
function rmSpec(input: string): string {
|
|
11
|
+
return input.replace(/[^a-zA-Z0-9 \u4E00-\u9FFF]/g, "");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Allow only numbers and letters in a string
|
|
16
|
+
* @param {string} input - The input string to process
|
|
17
|
+
* @returns {string} The processed string
|
|
18
|
+
*/
|
|
19
|
+
function onlyNumAndLetter(input: string): string {
|
|
20
|
+
return input.replace(/[^a-zA-Z0-9 ]/g, "");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Remove all spaces including those in the middle
|
|
25
|
+
* @param {string} input - The input string to process
|
|
26
|
+
* @returns {string} The processed string
|
|
27
|
+
*/
|
|
28
|
+
function rmAllSpace(input: string): string {
|
|
29
|
+
return input.replace(/\s/g, "");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Remove whitespace from both sides of a string
|
|
34
|
+
* @param {string} input - The input string to process
|
|
35
|
+
* @returns {string} The processed string
|
|
36
|
+
*/
|
|
37
|
+
function trimAll(input: string): string {
|
|
38
|
+
return input.replace(/(^\s+)|(\s+$)/g, "");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Replace multiple spaces with a single space
|
|
43
|
+
* @param {string} input - The input string to process
|
|
44
|
+
* @returns {string} The processed string
|
|
45
|
+
*/
|
|
46
|
+
function multiSpacesToSingle(input: string): string {
|
|
47
|
+
return input.replace(/\s+(\W)/g, ' ');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Convert HTML text to plain text
|
|
52
|
+
* @param {string} input - The input string to process
|
|
53
|
+
* @returns {string} The processed string
|
|
54
|
+
*/
|
|
55
|
+
function htmlToPlain(input: string): string {
|
|
56
|
+
return input.replace(/(<([^>]+)>)/ig, '');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Strip HTML tags and their content
|
|
61
|
+
* @param {string} input - The input string to process
|
|
62
|
+
* @returns {string} The processed string
|
|
63
|
+
*/
|
|
64
|
+
function stripTagsAndContent(input: string): string {
|
|
65
|
+
return input.replace(/<\/?[^>]+(>|$)(.*?)<\/?[^>]+(>|$)/ig, '');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Remove first and last slash from a URL
|
|
70
|
+
* @param {string} input - The input URL to process
|
|
71
|
+
* @returns {string} The processed URL
|
|
72
|
+
*/
|
|
73
|
+
function removeFirstLastSlash(input: string): string {
|
|
74
|
+
return input.replace(/^\/|\/$/g, '');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Remove trailing slash from a URL
|
|
79
|
+
* @param {string} input - The input URL to process
|
|
80
|
+
* @returns {string} The processed URL
|
|
81
|
+
*/
|
|
82
|
+
function removeTrailingSlash(input: string): string {
|
|
83
|
+
return input.replace(/\/+$/, '');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Remove first slash from a URL
|
|
88
|
+
* @param {string} input - The input URL to process
|
|
89
|
+
* @returns {string} The processed URL
|
|
90
|
+
*/
|
|
91
|
+
function removeFirstSlash(input: string): string {
|
|
92
|
+
return input.replace(/\//, '');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
rmSpec,
|
|
97
|
+
onlyNumAndLetter,
|
|
98
|
+
rmAllSpace,
|
|
99
|
+
trimAll,
|
|
100
|
+
multiSpacesToSingle,
|
|
101
|
+
htmlToPlain,
|
|
102
|
+
stripTagsAndContent,
|
|
103
|
+
removeFirstLastSlash,
|
|
104
|
+
removeTrailingSlash,
|
|
105
|
+
removeFirstSlash
|
|
106
|
+
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "UIUX Lab",
|
|
3
3
|
"email": "uiuxlab@gmail.com",
|
|
4
4
|
"name": "funda-ui",
|
|
5
|
-
"version": "4.6.
|
|
5
|
+
"version": "4.6.333",
|
|
6
6
|
"description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|