ehscan-react-components 0.1.54 → 0.1.56

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 CHANGED
@@ -327,6 +327,8 @@ const WindowWrapper = ({ windowOpen, setWindowOpen }) => {
327
327
  ----
328
328
  # Changelog
329
329
 
330
+ ## [0.1.54] - 2025-12-16
331
+ - Textarea module.css
330
332
 
331
333
  ## [0.1.53] - 2025-12-16
332
334
  - Added FoldedElement
@@ -3,7 +3,7 @@ type Props = {
3
3
  index?: string | number;
4
4
  text?: string;
5
5
  selected?: boolean;
6
- addClass?: string;
6
+ injectCSS?: string;
7
7
  notimeout?: boolean;
8
8
  click?: (args?: any) => void;
9
9
  type?: "raw" | "pop" | "ripple";
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useRef, useCallback } from "react";
3
3
  import useRipple from "../tools/useRipple";
4
4
  import styles from '../style/button.module.css';
5
- export const Button = ({ index, text, selected, addClass, notimeout, click, type = "raw", children }) => {
5
+ export const Button = ({ index, text, selected, injectCSS, notimeout, click, type = "raw", children }) => {
6
6
  const buttonRef = useRef(null);
7
7
  const handleRipple = useRipple();
8
8
  const handleButtonClick = useCallback((event) => {
@@ -16,5 +16,5 @@ export const Button = ({ index, text, selected, addClass, notimeout, click, type
16
16
  click === null || click === void 0 ? void 0 : click(event);
17
17
  }, 200);
18
18
  }, [notimeout, click, handleRipple]);
19
- return (_jsx(_Fragment, { children: _jsxs("button", { type: "button", ref: buttonRef, onClick: handleButtonClick, className: `${styles.button} ${styles.ApplyRipple} ${addClass !== null && addClass !== void 0 ? addClass : styles.btnPrimary}${type === 'pop' ? ` ${styles.buttonPop}` : ''}`, "aria-pressed": selected, children: [children, text && _jsx("div", { className: styles.btnLabel, children: text })] }, index) }));
19
+ return (_jsx(_Fragment, { children: _jsxs("button", { type: "button", ref: buttonRef, onClick: handleButtonClick, className: `${styles.button} ${styles.ApplyRipple} ${injectCSS !== null && injectCSS !== void 0 ? injectCSS : styles.btnPrimary}${type === 'pop' ? ` ${styles.buttonPop}` : ''}`, "aria-pressed": selected, children: [children, text && _jsx("div", { className: styles.btnLabel, children: text })] }, index) }));
20
20
  };
@@ -19,7 +19,7 @@
19
19
  text-align: center;
20
20
  text-decoration: none;
21
21
  user-select: none;
22
- line-height: var(--ext-btn-colorbtn-line-height, 1.5);
22
+ line-height: var(--ext-btn-line-height, 1.5);
23
23
  }
24
24
 
25
25
  .button:focus-visible {
@@ -48,23 +48,23 @@
48
48
  }
49
49
 
50
50
  .ext-btn--secondary {
51
- --btn-bg: #e5e5ea;
52
- --btn-color: #111;
51
+ --ext-btn-bg: #e5e5ea;
52
+ --ext-btn-color: #111;
53
53
  }
54
54
 
55
55
  .ext-btn--outline {
56
- --btn-bg: transparent;
57
- --btn-color: #007aff;
56
+ --ext-btn-bg: transparent;
57
+ --ext-btn-color: #007aff;
58
58
  }
59
59
 
60
60
  .ext-btn--ghost {
61
- --btn-bg: transparent;
62
- --btn-color: #007aff;
61
+ --ext-btn-bg: transparent;
62
+ --ext-btn-color: #007aff;
63
63
  }
64
64
 
65
65
  .ext-btn--danger {
66
- --btn-bg: #ff3b30;
67
- --btn-color: #fff;
66
+ --ext-btn-bg: #ff3b30;
67
+ --ext-btn-color: #fff;
68
68
  }
69
69
 
70
70
  /* Loading state */
@@ -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
+ }
@@ -1,4 +1,3 @@
1
- import '../style/input.css';
2
1
  interface Props {
3
2
  id?: string;
4
3
  tabIndex?: number;
@@ -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/input.css';
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(); // unique fallback for aria linking
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: `ext-textarea-wrapper ${addClass}`, children: [label && (_jsxs("div", { className: "ext-textarea-label", children: [_jsxs("label", { className: "ext-textarea-label-title", htmlFor: textareaId, children: [label, " ", required && _jsx("span", { className: "required", children: "*" })] }), _jsxs("div", { className: "ext-textarea-label-btns", children: [editable && charCount > 0 && (_jsxs("div", { className: "form-container-count", children: [charCount, " / ", maxLength] })), editable && charCount > 0 && (_jsx("div", { className: "ext-textarea-svg-close", onClick: clear, "aria-label": `Clear ${label !== null && label !== void 0 ? label : "text area"}`, children: _jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("line", { x1: "8", y1: "8", x2: "16", y2: "16", stroke: "#333", strokeWidth: "2", strokeLinecap: "round" }), _jsx("line", { x1: "16", y1: "8", x2: "8", y2: "16", stroke: "#333", strokeWidth: "2", strokeLinecap: "round" })] }) }))] })] })), _jsx("div", { className: "ext-textarea-box", 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: `ext-textarea${required && value === "" ? " highlight" : ""}`, rows: 1, spellCheck: false, readOnly: !editable, "aria-required": required, "aria-label": label }) })] }));
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ehscan-react-components",
3
- "version": "0.1.54",
3
+ "version": "0.1.56",
4
4
  "description": "components",
5
5
  "main": "dist/Components.js",
6
6
  "types": "dist/Components.d.ts",