@uva-glass/component-library 3.53.7 → 3.53.9

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.
@@ -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 h, useState as w } from "react";
3
- import { c as n } from "../../clsx-OuTLNxxd.js";
4
- import '../../assets/TextArea.css';const m = "_required_di3u1_25", e = {
5
- "text-area__wrapper": "_text-area__wrapper_di3u1_1",
6
- "text-area__header": "_text-area__header_di3u1_7",
7
- "text-area__label-wrapper": "_text-area__label-wrapper_di3u1_13",
8
- "text-area__label": "_text-area__label_di3u1_13",
9
- required: m,
10
- "text-area__sub-label": "_text-area__sub-label_di3u1_33",
11
- "text-area__word-count": "_text-area__word-count_di3u1_38",
12
- "text-area__word-count--alert": "_text-area__word-count--alert_di3u1_43",
13
- "text-area": "_text-area_di3u1_1",
14
- "not-valid": "_not-valid_di3u1_61"
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 N({
17
- onChange: s,
18
- label: l,
19
- subLabel: u,
17
+ function b({
18
+ onChange: c,
19
+ label: n,
20
+ subLabel: d,
20
21
  maxCharacters: a = 0,
21
- defaultValue: d = "",
22
- required: c = !1,
23
- notValid: o = !1
22
+ heightAsTextField: x = !1,
23
+ defaultValue: s = "",
24
+ required: i = !1,
25
+ notValid: u = !1
24
26
  }) {
25
- const t = h(null), [i, x] = w(d.length), p = () => {
26
- t.current && (t.current.style.height = "auto", t.current.style.height = `${t.current.scrollHeight}px`, x(t.current.value.length), s(t.current.value.trim()));
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
- (l || a > 0) && /* @__PURE__ */ r("div", { className: e["text-area__header"], children: [
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
- l && /* @__PURE__ */ _("span", { className: n(e["text-area__label"], { [e.required]: c }), children: l }),
32
- u && /* @__PURE__ */ _("span", { className: e["text-area__sub-label"], children: u })
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: n({ [e["text-area__word-count--alert"]]: i === a }), children: i }),
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: n(e["text-area"], { [e["not-valid"]]: o }),
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: p,
47
- defaultValue: d
51
+ onInput: h,
52
+ defaultValue: s
48
53
  }
49
54
  )
50
55
  ] });
51
56
  }
52
57
  export {
53
- N as TextArea
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 &nbsp;/&nbsp;{maxCharacters}\n </div>\n )}\n </div>\n )}\n\n <textarea\n ref={textAreaRef}\n className={clsx(styles['text-area'], { [styles['not-valid']]: notValid })}\n maxLength={maxCharacters > 0 ? maxCharacters : undefined}\n onInput={handleInput}\n defaultValue={defaultValue}\n />\n </div>\n );\n}\n"],"names":["TextArea","onChange","label","subLabel","maxCharacters","defaultValue","required","notValid","textAreaRef","useRef","characterCount","setCharacterCount","useState","handleInput","jsxs","styles","clsx","jsx"],"mappings":";;;;;;;;;;;;;;;AAsBO,SAASA,EAAS;AAAA,EACvB,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,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,GAClDP,EAASO,EAAY,QAAQ,MAAM,KAAA,CAAM;AAAA,EAE7C;AAEA,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAWC,EAAO,oBAAoB,GACvC,UAAA;AAAA,KAAAb,KAASE,IAAgB,MACzB,gBAAAU,EAAC,SAAI,WAAWC,EAAO,mBAAmB,GACxC,UAAA;AAAA,MAAA,gBAAAD,EAAC,QAAA,EAAK,WAAWC,EAAO,0BAA0B,GAC/C,UAAA;AAAA,QAAAb,uBACE,QAAA,EAAK,WAAWc,EAAKD,EAAO,kBAAkB,GAAG,EAAE,CAACA,EAAO,QAAW,GAAGT,EAAA,CAAU,GAAI,UAAAJ,GAAM;AAAA,QAE/FC,KAAY,gBAAAc,EAAC,QAAA,EAAK,WAAWF,EAAO,sBAAsB,GAAI,UAAAZ,EAAA,CAAS;AAAA,MAAA,GAC1E;AAAA,MACCC,IAAgB,KACf,gBAAAU,EAAC,SAAI,WAAWC,EAAO,uBAAuB,GAC5C,UAAA;AAAA,QAAA,gBAAAE,EAAC,QAAA,EAAK,WAAWD,EAAK,EAAE,CAACD,EAAO,8BAA8B,CAAC,GAAGL,MAAmBN,EAAA,CAAe,GACjG,UAAAM,EAAA,CACH;AAAA,QAAO;AAAA,QACON;AAAA,MAAA,EAAA,CAChB;AAAA,IAAA,GAEJ;AAAA,IAGF,gBAAAa;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKT;AAAA,QACL,WAAWQ,EAAKD,EAAO,WAAW,GAAG,EAAE,CAACA,EAAO,WAAW,CAAC,GAAGR,GAAU;AAAA,QACxE,WAAWH,IAAgB,IAAIA,IAAgB;AAAA,QAC/C,SAASS;AAAA,QACT,cAAAR;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
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 &nbsp;/&nbsp;{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.7",
5
+ "version": "3.53.9",
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.5",
65
- "@types/react": "^19.2.7",
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",
@@ -109,7 +109,7 @@
109
109
  "lexical": "^0.39.0"
110
110
  },
111
111
  "optionalDependencies": {
112
- "@ast-grep/napi-linux-x64-gnu": "0.40.4",
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"