ehscan-react-components 0.1.53 → 0.1.55
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/README.md +2 -0
- package/dist/Components.d.ts +1 -0
- package/dist/Components.js +1 -0
- package/dist/style/textarea.module.css +102 -0
- package/dist/text/TextArea.d.ts +0 -1
- package/dist/text/TextArea.js +3 -4
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/Components.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export { DragAndDrop } from './dnd/DragAndDrop';
|
|
|
4
4
|
export { TextArea } from './text/TextArea';
|
|
5
5
|
export { TextElementStretch } from './text/TextElementStretch';
|
|
6
6
|
export { TextAreaDropDown } from './text/TextAreaDropDown';
|
|
7
|
+
export { FoldedElement } from './text/FoldedElement';
|
|
7
8
|
export { AddBox } from './AddBox';
|
|
8
9
|
export { useChangeAddBox } from './tools/useChangeAddBox';
|
package/dist/Components.js
CHANGED
|
@@ -5,5 +5,6 @@ export { DragAndDrop } from './dnd/DragAndDrop';
|
|
|
5
5
|
export { TextArea } from './text/TextArea';
|
|
6
6
|
export { TextElementStretch } from './text/TextElementStretch';
|
|
7
7
|
export { TextAreaDropDown } from './text/TextAreaDropDown';
|
|
8
|
+
export { FoldedElement } from './text/FoldedElement';
|
|
8
9
|
export { AddBox } from './AddBox';
|
|
9
10
|
export { useChangeAddBox } from './tools/useChangeAddBox';
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
.extTextareaWrapper {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--ext-textarea-gap, 10px);
|
|
6
|
+
padding: var(--ext-textarea-padding, 5px);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.extTextareaLable {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.extTextareaLableTitle {
|
|
15
|
+
flex: 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ext-textarea-lable-btn {
|
|
19
|
+
background-color: aquamarine;
|
|
20
|
+
display: flex;
|
|
21
|
+
gap: 10px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.extTextareaLableBtns {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
gap: var(--ext-textarea-btn-gap, 5px);
|
|
29
|
+
padding: var(--ext-textarea-btn-padding, 0);
|
|
30
|
+
line-height: var(--ext-textarea-btn-line-height, 0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.formContainerCount {
|
|
34
|
+
font-size: var(--ext-textarea-font-size, 0.7rem);
|
|
35
|
+
font-weight: var(--ext-textarea-font-weigth, 300);
|
|
36
|
+
;
|
|
37
|
+
color: var(--ext-textarea-count-clr, #666);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.extTextareaLableSvgClose {
|
|
41
|
+
background-color: transparent;
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.extTextareaLableSvgClose>svg {
|
|
48
|
+
width: var(--ext-textarea-svg-w, 20px);
|
|
49
|
+
height: var(--ext-textarea-svg-h, 20px);
|
|
50
|
+
display: flex;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.extTextareaLableSvgClosePath {
|
|
54
|
+
fill: var(--ext-textarea-svg-path, #666);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.textareaBox {
|
|
58
|
+
width: 100%;
|
|
59
|
+
background-color: var(--ext-textarea-box-bck-clr, lightgray);
|
|
60
|
+
border-radius: var(--ext-textarea-box-border-radius, 10px);
|
|
61
|
+
display: flex;
|
|
62
|
+
position: relative;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.extTextarea {
|
|
66
|
+
font-size: var(--ext-textarea-input-txt-size, 14px);
|
|
67
|
+
background-color: transparent;
|
|
68
|
+
color: var(--ext-textarea-input-clr, red);
|
|
69
|
+
caret-color: var(--ext-textarea-input-caret-clr, blue);
|
|
70
|
+
font-weight: var(--ext-textarea-d-font-weight, 400);
|
|
71
|
+
border-radius: var(--ext-textarea-box-border-radius, 10px);
|
|
72
|
+
border: none;
|
|
73
|
+
outline: none;
|
|
74
|
+
width: 100%;
|
|
75
|
+
display: grid;
|
|
76
|
+
justify-content: left;
|
|
77
|
+
align-items: center;
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
resize: none;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
padding: 10px;
|
|
82
|
+
line-height: 1.5;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.extTextarea::placeholder {
|
|
86
|
+
color: var(--ext-textarea-input-placeholder-clr, green);
|
|
87
|
+
opacity: 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.extTextarea:focus {
|
|
91
|
+
background-color: var(--ext-textarea-focus-bck-clr, lavender);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.highlight {
|
|
95
|
+
border: var(--ext-textarea-highlight-border, 2px dashed red);
|
|
96
|
+
outline: none;
|
|
97
|
+
transition: box-shadow 0.2s ease, border-color 0.2s ease;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.highlight:focus {
|
|
101
|
+
box-shadow: 0 0 3px rgba(74, 144, 226, 0.6);
|
|
102
|
+
}
|
package/dist/text/TextArea.d.ts
CHANGED
package/dist/text/TextArea.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLayoutEffect, useRef, useState, useCallback, useId } from "react";
|
|
3
|
-
import '../style/
|
|
3
|
+
import styles from '../style/textarea.module.css';
|
|
4
4
|
export const TextArea = ({ id, tabIndex, label, value, editable = true, required = false, onChange, placeholder, maxLength = 500, addClass }) => {
|
|
5
5
|
const textareaRef = useRef(null);
|
|
6
6
|
const [charCount, setCharCount] = useState(value.length);
|
|
7
|
-
const generatedId = useId();
|
|
7
|
+
const generatedId = useId();
|
|
8
8
|
const textareaId = id || `textarea-${generatedId}`;
|
|
9
|
-
// 🔧 Resize and update char count whenever value changes
|
|
10
9
|
useLayoutEffect(() => {
|
|
11
10
|
setHeight();
|
|
12
11
|
setCharCount(value.length);
|
|
@@ -40,5 +39,5 @@ export const TextArea = ({ id, tabIndex, label, value, editable = true, required
|
|
|
40
39
|
textareaRef.current.style.height = "auto";
|
|
41
40
|
}
|
|
42
41
|
}, [onChange]);
|
|
43
|
-
return (_jsxs("div", { className:
|
|
42
|
+
return (_jsxs("div", { className: `${styles.extTextareaWrapper} ${addClass}`, children: [label && (_jsxs("div", { className: styles.extTextareaLable, children: [_jsxs("label", { className: styles.extTextareaLableTitle, htmlFor: textareaId, children: [label, " ", required && _jsx("span", { children: "*" })] }), _jsxs("div", { className: styles.extTextareaLableBtns, children: [editable && charCount > 0 && (_jsxs("div", { className: styles.formContainerCount, children: [charCount, " / ", maxLength] })), editable && charCount > 0 && (_jsx("div", { className: styles.extTextareaLableSvgClose, onClick: clear, "aria-label": `Clear ${label !== null && label !== void 0 ? label : "text area"}`, children: _jsx("svg", { width: "24", height: "24", fill: "none", version: "1.1", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { className: styles.extTextareaLableSvgClosePath, d: "m18.017 5.2673-6.0173 6.0173-6.0173-6.0173-0.71539 0.71539 6.0173 6.0173-6.0173 6.0173 0.71539 0.71539 6.0173-6.0173 6.0173 6.0173 0.71539-0.71539-6.0173-6.0173 6.0173-6.0173z", fill: "#000" }) }) }))] })] })), _jsx("div", { className: styles.textareaBox, children: _jsx("textarea", { id: textareaId, tabIndex: tabIndex, ref: textareaRef, value: value !== null && value !== void 0 ? value : "", placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "...", maxLength: maxLength, onChange: handleInputChange, onFocus: handleFocus, onBlur: setHeight, className: `${styles.extTextarea} ${required && value === "" ? styles.highlight : ""}`, rows: 1, spellCheck: false, readOnly: !editable, "aria-required": required, "aria-label": label }) })] }));
|
|
44
43
|
};
|