@uva-glass/component-library 3.53.6 → 3.53.8
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/assets/TextArea.css +1 -1
- package/dist/components/CopyableText/CopyableText.d.ts +3 -1
- package/dist/components/CopyableText/CopyableText.js +27 -26
- package/dist/components/CopyableText/CopyableText.js.map +1 -1
- package/dist/components/TextArea/TextArea.d.ts +3 -1
- package/dist/components/TextArea/TextArea.js +35 -30
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/package.json +5 -5
package/dist/assets/TextArea.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._text-
|
|
1
|
+
._text-area__wrapper_19dqk_1{display:flex;flex-direction:column;gap:.5rem}._text-area__header_19dqk_7{align-items:flex-end;display:flex;justify-content:space-between}._text-area__label-wrapper_19dqk_13{display:flex;flex-direction:column;gap:.5rem}._text-area__label_19dqk_13{font-family:inherit;font-size:inherit;font-weight:var(--semibold)}._text-area__label_19dqk_13._required_19dqk_25:after{color:var(--color-red-600);content:"★";font-size:.5rem;margin-left:.25rem;vertical-align:top}._text-area__sub-label_19dqk_33{color:var(--color-grey-700);font-size:var(--font-size-text-non-essential)}._text-area__word-count_19dqk_38{color:var(--color-grey-600);font-size:var(--font-size-text-non-essential)}._text-area__word-count--alert_19dqk_43{color:var(--color-red-600);font-weight:700}._text-area_19dqk_1{border-radius:.5rem;font-family:inherit;font-size:inherit;min-height:5.25rem;overflow:hidden;padding:.5rem;resize:none;white-space:pre-wrap;width:100%;word-wrap:break-word}._text-area--oneLine_19dqk_61{max-height:2.5rem;min-height:2.5rem}._text-area_19dqk_1._not-valid_19dqk_66{border-color:var(--color-red-600)}
|
|
@@ -7,5 +7,7 @@ export interface CopyableTextProps {
|
|
|
7
7
|
ariaLabelCopy?: string;
|
|
8
8
|
/** ARIA label for the copied state */
|
|
9
9
|
ariaLabelHasBeenCopied?: string;
|
|
10
|
+
/** custom value to be copied in place of the display text */
|
|
11
|
+
customCopyValue?: string;
|
|
10
12
|
}
|
|
11
|
-
export declare const CopyableText: ({ text, additionalClassName, ariaLabelCopy, ariaLabelHasBeenCopied, }: CopyableTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const CopyableText: ({ text, additionalClassName, ariaLabelCopy, ariaLabelHasBeenCopied, customCopyValue, }: CopyableTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { jsxs as u, jsx as y } from "react/jsx-runtime";
|
|
2
2
|
import { c as b } from "../../clsx-OuTLNxxd.js";
|
|
3
|
-
import { useState as f, useRef as m, useEffect as
|
|
4
|
-
import { Icon as
|
|
3
|
+
import { useState as f, useRef as m, useEffect as C } from "react";
|
|
4
|
+
import { Icon as _ } from "../Icon/Icon.js";
|
|
5
5
|
import '../../assets/CopyableText.css';const a = {
|
|
6
6
|
"copyable-text-container": "_copyable-text-container_l97qt_1",
|
|
7
7
|
"copyable-text-copy-button": "_copyable-text-copy-button_l97qt_8",
|
|
8
8
|
"copyable-text-copy-visually-hidden": "_copyable-text-copy-visually-hidden_l97qt_32"
|
|
9
|
-
},
|
|
10
|
-
text:
|
|
9
|
+
}, v = 2e3, g = ({
|
|
10
|
+
text: n,
|
|
11
11
|
additionalClassName: r = "",
|
|
12
12
|
ariaLabelCopy: s,
|
|
13
|
-
ariaLabelHasBeenCopied: p
|
|
13
|
+
ariaLabelHasBeenCopied: p,
|
|
14
|
+
customCopyValue: x
|
|
14
15
|
}) => {
|
|
15
|
-
const [
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const [o, c] = f(!1), l = m(null), d = m(null), [h, e] = f(!1);
|
|
17
|
+
C(() => () => {
|
|
18
|
+
l.current && clearTimeout(l.current);
|
|
18
19
|
}, []);
|
|
19
|
-
const i = () => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
20
|
+
const i = (t) => {
|
|
21
|
+
t.stopPropagation(), t.preventDefault(), c(!0), l.current = setTimeout(() => {
|
|
22
|
+
c(!1), e(!1);
|
|
23
|
+
}, v), navigator.clipboard.writeText(x ?? n).catch(() => c(!1));
|
|
23
24
|
};
|
|
24
25
|
return /* @__PURE__ */ u(
|
|
25
26
|
"span",
|
|
@@ -27,29 +28,29 @@ import '../../assets/CopyableText.css';const a = {
|
|
|
27
28
|
className: b(a["copyable-text-container"], r),
|
|
28
29
|
role: "button",
|
|
29
30
|
tabIndex: 0,
|
|
30
|
-
onFocus: () =>
|
|
31
|
-
onBlur: () => !
|
|
32
|
-
onKeyDown: (
|
|
33
|
-
|
|
31
|
+
onFocus: () => e(!0),
|
|
32
|
+
onBlur: () => !o && e(!1),
|
|
33
|
+
onKeyDown: (t) => {
|
|
34
|
+
e(!0), (t.key === "Enter" || t.key === " ") && (t.preventDefault(), i(t));
|
|
34
35
|
},
|
|
35
|
-
onMouseEnter: () =>
|
|
36
|
-
onMouseLeave: () => !
|
|
36
|
+
onMouseEnter: () => e(!0),
|
|
37
|
+
onMouseLeave: () => !o && e(!1),
|
|
37
38
|
children: [
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
n,
|
|
40
|
+
h && /* @__PURE__ */ u(
|
|
40
41
|
"button",
|
|
41
42
|
{
|
|
42
|
-
ref:
|
|
43
|
+
ref: d,
|
|
43
44
|
className: b(a["copyable-text-copy-button"], r),
|
|
44
45
|
onClick: i,
|
|
45
46
|
type: "button",
|
|
46
47
|
"aria-keyshortcuts": "Enter Space",
|
|
47
|
-
"aria-label":
|
|
48
|
+
"aria-label": o ? p ?? "Copied" : s ?? "Copy to clipboard",
|
|
48
49
|
tabIndex: -1,
|
|
49
50
|
children: [
|
|
50
|
-
|
|
51
|
-
/* @__PURE__ */ y(
|
|
52
|
-
/* @__PURE__ */ y("span", { className: a["copyable-text-copy-visually-hidden"], "aria-live": "polite", children:
|
|
51
|
+
n,
|
|
52
|
+
/* @__PURE__ */ y(_, { name: o ? "CheckSmall" : "Copy", size: 20 }),
|
|
53
|
+
/* @__PURE__ */ y("span", { className: a["copyable-text-copy-visually-hidden"], "aria-live": "polite", children: o ? p ?? "Copied" : s ?? "Copy to clipboard" })
|
|
53
54
|
]
|
|
54
55
|
}
|
|
55
56
|
)
|
|
@@ -58,6 +59,6 @@ import '../../assets/CopyableText.css';const a = {
|
|
|
58
59
|
);
|
|
59
60
|
};
|
|
60
61
|
export {
|
|
61
|
-
|
|
62
|
+
g as CopyableText
|
|
62
63
|
};
|
|
63
64
|
//# sourceMappingURL=CopyableText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyableText.js","sources":["../../../src/components/CopyableText/CopyableText.tsx"],"sourcesContent":["import { clsx } from 'clsx';\r\nimport { useState, useRef, useEffect } from 'react';\r\n\r\nimport styles from './CopyableText.module.css';\r\n\r\nimport { Icon } from 'components/Icon';\r\n\r\nexport interface CopyableTextProps {\r\n /** The text to be copied */\r\n text: string;\r\n /** Additional class name to style the text so it suits the design */\r\n additionalClassName?: string;\r\n /** ARIA label for the copy button */\r\n ariaLabelCopy?: string;\r\n /** ARIA label for the copied state */\r\n ariaLabelHasBeenCopied?: string;\r\n}\r\n\r\nconst COPYTIME = 2000;\r\n\r\nexport const CopyableText = ({\r\n text,\r\n additionalClassName = '',\r\n ariaLabelCopy,\r\n ariaLabelHasBeenCopied,\r\n}: CopyableTextProps) => {\r\n const [isCopying, setIsCopying] = useState(false);\r\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n const buttonRef = useRef<HTMLButtonElement | null>(null);\r\n const [buttonActive, setButtonActive] = useState(false);\r\n\r\n useEffect(() => {\r\n return () => {\r\n if (timeoutRef.current) clearTimeout(timeoutRef.current);\r\n };\r\n }, []);\r\n\r\n const handleCopy = () => {\r\n setIsCopying(true);\r\n timeoutRef.current = setTimeout(() => {\r\n setIsCopying(false);\r\n setButtonActive(false);\r\n }, COPYTIME);\r\n navigator.clipboard.writeText(text).catch(() => setIsCopying(false));\r\n };\r\n\r\n return (\r\n <span\r\n className={clsx(styles['copyable-text-container'], additionalClassName)}\r\n role=\"button\"\r\n tabIndex={0}\r\n onFocus={() => setButtonActive(true)}\r\n onBlur={() => !isCopying && setButtonActive(false)}\r\n onKeyDown={(event) => {\r\n setButtonActive(true);\r\n if (event.key === 'Enter' || event.key === ' ') {\r\n event.preventDefault();\r\n handleCopy();\r\n }\r\n }}\r\n onMouseEnter={() => setButtonActive(true)}\r\n onMouseLeave={() => !isCopying && setButtonActive(false)}\r\n >\r\n {text}\r\n {buttonActive && (\r\n <button\r\n ref={buttonRef}\r\n className={clsx(styles['copyable-text-copy-button'], additionalClassName)}\r\n onClick={handleCopy}\r\n type=\"button\"\r\n aria-keyshortcuts=\"Enter Space\"\r\n aria-label={isCopying ? (ariaLabelHasBeenCopied ?? 'Copied') : (ariaLabelCopy ?? 'Copy to clipboard')}\r\n tabIndex={-1}\r\n >\r\n {text}\r\n <Icon name={isCopying ? 'CheckSmall' : 'Copy'} size={20} />\r\n <span className={styles['copyable-text-copy-visually-hidden']} aria-live=\"polite\">\r\n {isCopying ? (ariaLabelHasBeenCopied ?? 'Copied') : (ariaLabelCopy ?? 'Copy to clipboard')}\r\n </span>\r\n </button>\r\n )}\r\n </span>\r\n );\r\n};\r\n"],"names":["COPYTIME","CopyableText","text","additionalClassName","ariaLabelCopy","ariaLabelHasBeenCopied","isCopying","setIsCopying","useState","timeoutRef","useRef","buttonRef","buttonActive","setButtonActive","useEffect","handleCopy","jsxs","clsx","styles","
|
|
1
|
+
{"version":3,"file":"CopyableText.js","sources":["../../../src/components/CopyableText/CopyableText.tsx"],"sourcesContent":["import { clsx } from 'clsx';\r\nimport { useState, useRef, useEffect } from 'react';\r\n\r\nimport type { KeyboardEvent, MouseEvent } from 'react';\r\n\r\nimport styles from './CopyableText.module.css';\r\n\r\nimport { Icon } from 'components/Icon';\r\n\r\nexport interface CopyableTextProps {\r\n /** The text to be copied */\r\n text: string;\r\n /** Additional class name to style the text so it suits the design */\r\n additionalClassName?: string;\r\n /** ARIA label for the copy button */\r\n ariaLabelCopy?: string;\r\n /** ARIA label for the copied state */\r\n ariaLabelHasBeenCopied?: string;\r\n /** custom value to be copied in place of the display text */\r\n customCopyValue?: string;\r\n}\r\n\r\nconst COPYTIME = 2000;\r\n\r\nexport const CopyableText = ({\r\n text,\r\n additionalClassName = '',\r\n ariaLabelCopy,\r\n ariaLabelHasBeenCopied,\r\n customCopyValue,\r\n}: CopyableTextProps) => {\r\n const [isCopying, setIsCopying] = useState(false);\r\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n const buttonRef = useRef<HTMLButtonElement | null>(null);\r\n const [buttonActive, setButtonActive] = useState(false);\r\n\r\n useEffect(() => {\r\n return () => {\r\n if (timeoutRef.current) clearTimeout(timeoutRef.current);\r\n };\r\n }, []);\r\n\r\n const handleCopy = (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLSpanElement>) => {\r\n // prevent event bubbling if placed inside another clikable element\r\n event.stopPropagation();\r\n event.preventDefault();\r\n\r\n setIsCopying(true);\r\n timeoutRef.current = setTimeout(() => {\r\n setIsCopying(false);\r\n setButtonActive(false);\r\n }, COPYTIME);\r\n navigator.clipboard.writeText(customCopyValue ?? text).catch(() => setIsCopying(false));\r\n };\r\n\r\n return (\r\n <span\r\n className={clsx(styles['copyable-text-container'], additionalClassName)}\r\n role=\"button\"\r\n tabIndex={0}\r\n onFocus={() => setButtonActive(true)}\r\n onBlur={() => !isCopying && setButtonActive(false)}\r\n onKeyDown={(event) => {\r\n setButtonActive(true);\r\n if (event.key === 'Enter' || event.key === ' ') {\r\n event.preventDefault();\r\n handleCopy(event);\r\n }\r\n }}\r\n onMouseEnter={() => setButtonActive(true)}\r\n onMouseLeave={() => !isCopying && setButtonActive(false)}\r\n >\r\n {text}\r\n {buttonActive && (\r\n <button\r\n ref={buttonRef}\r\n className={clsx(styles['copyable-text-copy-button'], additionalClassName)}\r\n onClick={handleCopy}\r\n type=\"button\"\r\n aria-keyshortcuts=\"Enter Space\"\r\n aria-label={isCopying ? (ariaLabelHasBeenCopied ?? 'Copied') : (ariaLabelCopy ?? 'Copy to clipboard')}\r\n tabIndex={-1}\r\n >\r\n {text}\r\n <Icon name={isCopying ? 'CheckSmall' : 'Copy'} size={20} />\r\n <span className={styles['copyable-text-copy-visually-hidden']} aria-live=\"polite\">\r\n {isCopying ? (ariaLabelHasBeenCopied ?? 'Copied') : (ariaLabelCopy ?? 'Copy to clipboard')}\r\n </span>\r\n </button>\r\n )}\r\n </span>\r\n );\r\n};\r\n"],"names":["COPYTIME","CopyableText","text","additionalClassName","ariaLabelCopy","ariaLabelHasBeenCopied","customCopyValue","isCopying","setIsCopying","useState","timeoutRef","useRef","buttonRef","buttonActive","setButtonActive","useEffect","handleCopy","event","jsxs","clsx","styles","Icon","jsx"],"mappings":";;;;;;;;GAsBMA,IAAW,KAEJC,IAAe,CAAC;AAAA,EAC3B,MAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,eAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,iBAAAC;AACF,MAAyB;AACvB,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1CC,IAAaC,EAA6C,IAAI,GAC9DC,IAAYD,EAAiC,IAAI,GACjD,CAACE,GAAcC,CAAe,IAAIL,EAAS,EAAK;AAEtD,EAAAM,EAAU,MACD,MAAM;AACX,IAAIL,EAAW,WAAS,aAAaA,EAAW,OAAO;AAAA,EACzD,GACC,CAAA,CAAE;AAEL,QAAMM,IAAa,CAACC,MAA0E;AAE5F,IAAAA,EAAM,gBAAA,GACNA,EAAM,eAAA,GAENT,EAAa,EAAI,GACjBE,EAAW,UAAU,WAAW,MAAM;AACpC,MAAAF,EAAa,EAAK,GAClBM,EAAgB,EAAK;AAAA,IACvB,GAAGd,CAAQ,GACX,UAAU,UAAU,UAAUM,KAAmBJ,CAAI,EAAE,MAAM,MAAMM,EAAa,EAAK,CAAC;AAAA,EACxF;AAEA,SACE,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAKC,EAAO,yBAAyB,GAAGjB,CAAmB;AAAA,MACtE,MAAK;AAAA,MACL,UAAU;AAAA,MACV,SAAS,MAAMW,EAAgB,EAAI;AAAA,MACnC,QAAQ,MAAM,CAACP,KAAaO,EAAgB,EAAK;AAAA,MACjD,WAAW,CAACG,MAAU;AACpB,QAAAH,EAAgB,EAAI,IAChBG,EAAM,QAAQ,WAAWA,EAAM,QAAQ,SACzCA,EAAM,eAAA,GACND,EAAWC,CAAK;AAAA,MAEpB;AAAA,MACA,cAAc,MAAMH,EAAgB,EAAI;AAAA,MACxC,cAAc,MAAM,CAACP,KAAaO,EAAgB,EAAK;AAAA,MAEtD,UAAA;AAAA,QAAAZ;AAAA,QACAW,KACC,gBAAAK;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAKN;AAAA,YACL,WAAWO,EAAKC,EAAO,2BAA2B,GAAGjB,CAAmB;AAAA,YACxE,SAASa;AAAA,YACT,MAAK;AAAA,YACL,qBAAkB;AAAA,YAClB,cAAYT,IAAaF,KAA0B,WAAaD,KAAiB;AAAA,YACjF,UAAU;AAAA,YAET,UAAA;AAAA,cAAAF;AAAA,gCACAmB,GAAA,EAAK,MAAMd,IAAY,eAAe,QAAQ,MAAM,IAAI;AAAA,cACzD,gBAAAe,EAAC,QAAA,EAAK,WAAWF,EAAO,oCAAoC,GAAG,aAAU,UACtE,UAAAb,IAAaF,KAA0B,WAAaD,KAAiB,oBAAA,CACxE;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -7,6 +7,8 @@ export interface TextAreaProps {
|
|
|
7
7
|
subLabel?: string;
|
|
8
8
|
/** The max amount of allowed charecters in the text area */
|
|
9
9
|
maxCharacters?: number;
|
|
10
|
+
/** The max number of visible lines in the text area */
|
|
11
|
+
heightAsTextField?: boolean;
|
|
10
12
|
/** The default value for the text area */
|
|
11
13
|
defaultValue?: string;
|
|
12
14
|
/** `true` to show an asterisk to indicate an item is required; otherwise, `false`. */
|
|
@@ -14,4 +16,4 @@ export interface TextAreaProps {
|
|
|
14
16
|
/** `true` to color border red to show not valid; otherwise, `false`. */
|
|
15
17
|
notValid?: boolean;
|
|
16
18
|
}
|
|
17
|
-
export declare function TextArea({ onChange, label, subLabel, maxCharacters, defaultValue, required, notValid, }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function TextArea({ onChange, label, subLabel, maxCharacters, heightAsTextField, defaultValue, required, notValid, }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { jsxs as r, jsx as _ } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import '../../assets/TextArea.css';const
|
|
5
|
-
"text-area__wrapper": "_text-
|
|
6
|
-
"text-area__header": "_text-
|
|
7
|
-
"text-area__label-wrapper": "_text-area__label-
|
|
8
|
-
"text-area__label": "_text-
|
|
9
|
-
required:
|
|
10
|
-
"text-area__sub-label": "_text-area__sub-
|
|
11
|
-
"text-area__word-count": "_text-area__word-
|
|
12
|
-
"text-area__word-count--alert": "_text-area__word-count--
|
|
13
|
-
"text-area": "_text-
|
|
14
|
-
"
|
|
2
|
+
import { useRef as q, useState as w } from "react";
|
|
3
|
+
import { c as l } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import '../../assets/TextArea.css';const k = "_required_19dqk_25", e = {
|
|
5
|
+
"text-area__wrapper": "_text-area__wrapper_19dqk_1",
|
|
6
|
+
"text-area__header": "_text-area__header_19dqk_7",
|
|
7
|
+
"text-area__label-wrapper": "_text-area__label-wrapper_19dqk_13",
|
|
8
|
+
"text-area__label": "_text-area__label_19dqk_13",
|
|
9
|
+
required: k,
|
|
10
|
+
"text-area__sub-label": "_text-area__sub-label_19dqk_33",
|
|
11
|
+
"text-area__word-count": "_text-area__word-count_19dqk_38",
|
|
12
|
+
"text-area__word-count--alert": "_text-area__word-count--alert_19dqk_43",
|
|
13
|
+
"text-area": "_text-area_19dqk_1",
|
|
14
|
+
"text-area--oneLine": "_text-area--oneLine_19dqk_61",
|
|
15
|
+
"not-valid": "_not-valid_19dqk_66"
|
|
15
16
|
};
|
|
16
|
-
function
|
|
17
|
-
onChange:
|
|
18
|
-
label:
|
|
19
|
-
subLabel:
|
|
17
|
+
function b({
|
|
18
|
+
onChange: c,
|
|
19
|
+
label: n,
|
|
20
|
+
subLabel: d,
|
|
20
21
|
maxCharacters: a = 0,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
heightAsTextField: x = !1,
|
|
23
|
+
defaultValue: s = "",
|
|
24
|
+
required: i = !1,
|
|
25
|
+
notValid: u = !1
|
|
24
26
|
}) {
|
|
25
|
-
const t =
|
|
26
|
-
t.current && (t.current.style.height = "auto", t.current.style.height = `${t.current.scrollHeight}px`,
|
|
27
|
+
const t = q(null), [o, p] = w(s.length), h = () => {
|
|
28
|
+
t.current && (t.current.style.height = "auto", t.current.style.height = `${t.current.scrollHeight}px`, p(t.current.value.length), c(t.current.value.trim()));
|
|
27
29
|
};
|
|
28
30
|
return /* @__PURE__ */ r("div", { className: e["text-area__wrapper"], children: [
|
|
29
|
-
(
|
|
31
|
+
(n || a > 0) && /* @__PURE__ */ r("div", { className: e["text-area__header"], children: [
|
|
30
32
|
/* @__PURE__ */ r("span", { className: e["text-area__label-wrapper"], children: [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
n && /* @__PURE__ */ _("span", { className: l(e["text-area__label"], { [e.required]: i }), children: n }),
|
|
34
|
+
d && /* @__PURE__ */ _("span", { className: e["text-area__sub-label"], children: d })
|
|
33
35
|
] }),
|
|
34
36
|
a > 0 && /* @__PURE__ */ r("div", { className: e["text-area__word-count"], children: [
|
|
35
|
-
/* @__PURE__ */ _("span", { className:
|
|
37
|
+
/* @__PURE__ */ _("span", { className: l({ [e["text-area__word-count--alert"]]: o === a }), children: o }),
|
|
36
38
|
" / ",
|
|
37
39
|
a
|
|
38
40
|
] })
|
|
@@ -41,15 +43,18 @@ function N({
|
|
|
41
43
|
"textarea",
|
|
42
44
|
{
|
|
43
45
|
ref: t,
|
|
44
|
-
className:
|
|
46
|
+
className: l(e["text-area"], {
|
|
47
|
+
[e["not-valid"]]: u,
|
|
48
|
+
[e["text-area--oneLine"]]: x
|
|
49
|
+
}),
|
|
45
50
|
maxLength: a > 0 ? a : void 0,
|
|
46
|
-
onInput:
|
|
47
|
-
defaultValue:
|
|
51
|
+
onInput: h,
|
|
52
|
+
defaultValue: s
|
|
48
53
|
}
|
|
49
54
|
)
|
|
50
55
|
] });
|
|
51
56
|
}
|
|
52
57
|
export {
|
|
53
|
-
|
|
58
|
+
b as TextArea
|
|
54
59
|
};
|
|
55
60
|
//# sourceMappingURL=TextArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.js","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport styles from './TextArea.module.css';\n\nexport interface TextAreaProps {\n /** Returns entered values as trimmed string */\n onChange: (value: string) => void;\n /** The label for the text area */\n label?: string;\n /** Optional sub label for the text area */\n subLabel?: string;\n /** The max amount of allowed charecters in the text area */\n maxCharacters?: number;\n /** The default value for the text area */\n defaultValue?: string;\n /** `true` to show an asterisk to indicate an item is required; otherwise, `false`. */\n required?: boolean;\n /** `true` to color border red to show not valid; otherwise, `false`. */\n notValid?: boolean;\n}\n\nexport function TextArea({\n onChange,\n label,\n subLabel,\n maxCharacters = 0,\n defaultValue = '',\n required = false,\n notValid = false,\n}: TextAreaProps) {\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n const [characterCount, setCharacterCount] = useState(defaultValue.length);\n\n const handleInput = () => {\n if (textAreaRef.current) {\n textAreaRef.current.style.height = 'auto';\n textAreaRef.current.style.height = `${textAreaRef.current.scrollHeight}px`;\n\n setCharacterCount(textAreaRef.current.value.length);\n onChange(textAreaRef.current.value.trim());\n }\n };\n\n return (\n <div className={styles['text-area__wrapper']}>\n {(label || maxCharacters > 0) && (\n <div className={styles['text-area__header']}>\n <span className={styles['text-area__label-wrapper']}>\n {label && (\n <span className={clsx(styles['text-area__label'], { [styles['required']]: required })}>{label}</span>\n )}\n {subLabel && <span className={styles['text-area__sub-label']}>{subLabel}</span>}\n </span>\n {maxCharacters > 0 && (\n <div className={styles['text-area__word-count']}>\n <span className={clsx({ [styles['text-area__word-count--alert']]: characterCount === maxCharacters })}>\n {characterCount}\n </span>\n / {maxCharacters}\n </div>\n )}\n </div>\n )}\n\n <textarea\n ref={textAreaRef}\n className={clsx(styles['text-area'], {
|
|
1
|
+
{"version":3,"file":"TextArea.js","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { clsx } from 'clsx';\n\nimport styles from './TextArea.module.css';\n\nexport interface TextAreaProps {\n /** Returns entered values as trimmed string */\n onChange: (value: string) => void;\n /** The label for the text area */\n label?: string;\n /** Optional sub label for the text area */\n subLabel?: string;\n /** The max amount of allowed charecters in the text area */\n maxCharacters?: number;\n /** The max number of visible lines in the text area */\n heightAsTextField?: boolean;\n /** The default value for the text area */\n defaultValue?: string;\n /** `true` to show an asterisk to indicate an item is required; otherwise, `false`. */\n required?: boolean;\n /** `true` to color border red to show not valid; otherwise, `false`. */\n notValid?: boolean;\n}\n\nexport function TextArea({\n onChange,\n label,\n subLabel,\n maxCharacters = 0,\n heightAsTextField = false,\n defaultValue = '',\n required = false,\n notValid = false,\n}: TextAreaProps) {\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n const [characterCount, setCharacterCount] = useState(defaultValue.length);\n\n const handleInput = () => {\n if (textAreaRef.current) {\n textAreaRef.current.style.height = 'auto';\n textAreaRef.current.style.height = `${textAreaRef.current.scrollHeight}px`;\n\n setCharacterCount(textAreaRef.current.value.length);\n onChange(textAreaRef.current.value.trim());\n }\n };\n\n return (\n <div className={styles['text-area__wrapper']}>\n {(label || maxCharacters > 0) && (\n <div className={styles['text-area__header']}>\n <span className={styles['text-area__label-wrapper']}>\n {label && (\n <span className={clsx(styles['text-area__label'], { [styles['required']]: required })}>{label}</span>\n )}\n {subLabel && <span className={styles['text-area__sub-label']}>{subLabel}</span>}\n </span>\n {maxCharacters > 0 && (\n <div className={styles['text-area__word-count']}>\n <span className={clsx({ [styles['text-area__word-count--alert']]: characterCount === maxCharacters })}>\n {characterCount}\n </span>\n / {maxCharacters}\n </div>\n )}\n </div>\n )}\n\n <textarea\n ref={textAreaRef}\n className={clsx(styles['text-area'], {\n [styles['not-valid']]: notValid,\n [styles['text-area--oneLine']]: heightAsTextField,\n })}\n maxLength={maxCharacters > 0 ? maxCharacters : undefined}\n onInput={handleInput}\n defaultValue={defaultValue}\n />\n </div>\n );\n}\n"],"names":["TextArea","onChange","label","subLabel","maxCharacters","heightAsTextField","defaultValue","required","notValid","textAreaRef","useRef","characterCount","setCharacterCount","useState","handleInput","jsxs","styles","clsx","jsx"],"mappings":";;;;;;;;;;;;;;;;AAwBO,SAASA,EAAS;AAAA,EACvB,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,mBAAAC,IAAoB;AAAA,EACpB,cAAAC,IAAe;AAAA,EACf,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW;AACb,GAAkB;AAChB,QAAMC,IAAcC,EAA4B,IAAI,GAC9C,CAACC,GAAgBC,CAAiB,IAAIC,EAASP,EAAa,MAAM,GAElEQ,IAAc,MAAM;AACxB,IAAIL,EAAY,YACdA,EAAY,QAAQ,MAAM,SAAS,QACnCA,EAAY,QAAQ,MAAM,SAAS,GAAGA,EAAY,QAAQ,YAAY,MAEtEG,EAAkBH,EAAY,QAAQ,MAAM,MAAM,GAClDR,EAASQ,EAAY,QAAQ,MAAM,KAAA,CAAM;AAAA,EAE7C;AAEA,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAWC,EAAO,oBAAoB,GACvC,UAAA;AAAA,KAAAd,KAASE,IAAgB,MACzB,gBAAAW,EAAC,SAAI,WAAWC,EAAO,mBAAmB,GACxC,UAAA;AAAA,MAAA,gBAAAD,EAAC,QAAA,EAAK,WAAWC,EAAO,0BAA0B,GAC/C,UAAA;AAAA,QAAAd,uBACE,QAAA,EAAK,WAAWe,EAAKD,EAAO,kBAAkB,GAAG,EAAE,CAACA,EAAO,QAAW,GAAGT,EAAA,CAAU,GAAI,UAAAL,GAAM;AAAA,QAE/FC,KAAY,gBAAAe,EAAC,QAAA,EAAK,WAAWF,EAAO,sBAAsB,GAAI,UAAAb,EAAA,CAAS;AAAA,MAAA,GAC1E;AAAA,MACCC,IAAgB,KACf,gBAAAW,EAAC,SAAI,WAAWC,EAAO,uBAAuB,GAC5C,UAAA;AAAA,QAAA,gBAAAE,EAAC,QAAA,EAAK,WAAWD,EAAK,EAAE,CAACD,EAAO,8BAA8B,CAAC,GAAGL,MAAmBP,EAAA,CAAe,GACjG,UAAAO,EAAA,CACH;AAAA,QAAO;AAAA,QACOP;AAAA,MAAA,EAAA,CAChB;AAAA,IAAA,GAEJ;AAAA,IAGF,gBAAAc;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKT;AAAA,QACL,WAAWQ,EAAKD,EAAO,WAAW,GAAG;AAAA,UACnC,CAACA,EAAO,WAAW,CAAC,GAAGR;AAAA,UACvB,CAACQ,EAAO,oBAAoB,CAAC,GAAGX;AAAA,QAAA,CACjC;AAAA,QACD,WAAWD,IAAgB,IAAIA,IAAgB;AAAA,QAC/C,SAASU;AAAA,QACT,cAAAR;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uva-glass/component-library",
|
|
3
3
|
"author": "Team Glass - Frontend vrienden",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "3.53.
|
|
5
|
+
"version": "3.53.8",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"@testing-library/jest-dom": "^6.9.1",
|
|
62
62
|
"@testing-library/react": "^16.3.1",
|
|
63
63
|
"@types/jest": "^30.0.0",
|
|
64
|
-
"@types/node": "^25.0.
|
|
65
|
-
"@types/react": "^19.2.
|
|
64
|
+
"@types/node": "^25.0.6",
|
|
65
|
+
"@types/react": "^19.2.8",
|
|
66
66
|
"@types/react-dom": "^19.2.3",
|
|
67
67
|
"@uva-glass/eslint-config": "^1.3.11",
|
|
68
68
|
"@uva-glass/stylelint-config": "^1.2.3",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
97
97
|
"vite-plugin-static-copy": "^3.1.4",
|
|
98
98
|
"vite-plugin-svgr": "^4.5.0",
|
|
99
|
-
"vite-tsconfig-paths": "^6.0.
|
|
99
|
+
"vite-tsconfig-paths": "^6.0.4"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"@babel/preset-env": "^7.28.5",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"lexical": "^0.39.0"
|
|
110
110
|
},
|
|
111
111
|
"optionalDependencies": {
|
|
112
|
-
"@ast-grep/napi-linux-x64-gnu": "0.40.
|
|
112
|
+
"@ast-grep/napi-linux-x64-gnu": "0.40.5",
|
|
113
113
|
"@rollup/rollup-linux-x64-gnu": "^4.55.1",
|
|
114
114
|
"@rspack/binding-darwin-arm64": "1.7.1",
|
|
115
115
|
"@rspack/binding-linux-x64-gnu": "1.7.1"
|