@uva-glass/component-library 3.26.4 → 3.27.0

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.
@@ -1,7 +1,7 @@
1
- import { jsxs as r, jsx as _ } from "react/jsx-runtime";
1
+ import { jsxs as _, jsx as n } from "react/jsx-runtime";
2
2
  import { useRef as x, useState as d } from "react";
3
3
  import { c as i } from "../../clsx-OuTLNxxd.js";
4
- import '../../assets/TextArea.css';const t = {
4
+ import '../../assets/TextArea.css';const r = {
5
5
  "text-area__wrapper": "_text-area__wrapper_13728_1",
6
6
  "text-area__header": "_text-area__header_13728_7",
7
7
  "text-area__label": "_text-area__label_13728_13",
@@ -9,27 +9,27 @@ import '../../assets/TextArea.css';const t = {
9
9
  "text-area__word-count--alert": "_text-area__word-count--alert_13728_25",
10
10
  "text-area": "_text-area_13728_1"
11
11
  };
12
- function w({ onChange: l, label: c, maxCharacters: a = 0, defaultValue: o = "" }) {
13
- const e = x(null), [n, s] = d(0), u = () => {
14
- e.current && (e.current.style.height = "auto", e.current.style.height = `${e.current.scrollHeight}px`, s(e.current.value.length), l(e.current.value.trim()));
12
+ function w({ onChange: c, label: a, maxCharacters: t = 0, defaultValue: l = "" }) {
13
+ const e = x(null), [o, s] = d(0), u = () => {
14
+ e.current && (e.current.style.height = "auto", e.current.style.height = `${e.current.scrollHeight}px`, s(e.current.value.length), c(e.current.value.trim()));
15
15
  };
16
- return /* @__PURE__ */ r("div", { className: t["text-area__wrapper"], children: [
17
- /* @__PURE__ */ r("div", { className: t["text-area__header"], children: [
18
- /* @__PURE__ */ _("span", { className: t["text-area__label"], children: c }),
19
- a > 0 && /* @__PURE__ */ r("div", { className: t["text-area__word-count"], children: [
20
- /* @__PURE__ */ _("span", { className: i({ [t["text-area__word-count--alert"]]: n === a }), children: n }),
16
+ return /* @__PURE__ */ _("div", { className: r["text-area__wrapper"], children: [
17
+ (a || t > 0) && /* @__PURE__ */ _("div", { className: r["text-area__header"], children: [
18
+ a && /* @__PURE__ */ n("span", { className: r["text-area__label"], children: a }),
19
+ t > 0 && /* @__PURE__ */ _("div", { className: r["text-area__word-count"], children: [
20
+ /* @__PURE__ */ n("span", { className: i({ [r["text-area__word-count--alert"]]: o === t }), children: o }),
21
21
  " / ",
22
- a
22
+ t
23
23
  ] })
24
24
  ] }),
25
- /* @__PURE__ */ _(
25
+ /* @__PURE__ */ n(
26
26
  "textarea",
27
27
  {
28
28
  ref: e,
29
- className: t["text-area"],
30
- maxLength: a > 0 ? a : void 0,
29
+ className: r["text-area"],
30
+ maxLength: t > 0 ? t : void 0,
31
31
  onInput: u,
32
- defaultValue: o
32
+ defaultValue: l
33
33
  }
34
34
  )
35
35
  ] });
@@ -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 /** 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}\n\nexport function TextArea({ onChange, label, maxCharacters = 0, defaultValue = '' }: TextAreaProps) {\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n const [characterCount, setCharacterCount] = useState(0);\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 <div className={styles['text-area__header']}>\n <span className={styles['text-area__label']}>{label}</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 <textarea\n ref={textAreaRef}\n className={styles['text-area']}\n maxLength={maxCharacters > 0 ? maxCharacters : undefined}\n onInput={handleInput}\n defaultValue={defaultValue}\n />\n </div>\n );\n}\n"],"names":["TextArea","onChange","label","maxCharacters","defaultValue","textAreaRef","useRef","characterCount","setCharacterCount","useState","handleInput","jsxs","styles","jsx","clsx"],"mappings":";;;;;;;;;;;AAgBgB,SAAAA,EAAS,EAAE,UAAAC,GAAU,OAAAC,GAAO,eAAAC,IAAgB,GAAG,cAAAC,IAAe,MAAqB;AAC3F,QAAAC,IAAcC,EAA4B,IAAI,GAC9C,CAACC,GAAgBC,CAAiB,IAAIC,EAAS,CAAC,GAEhDC,IAAc,MAAM;AACxB,IAAIL,EAAY,YACFA,EAAA,QAAQ,MAAM,SAAS,QACnCA,EAAY,QAAQ,MAAM,SAAS,GAAGA,EAAY,QAAQ,YAAY,MAEpDG,EAAAH,EAAY,QAAQ,MAAM,MAAM,GAClDJ,EAASI,EAAY,QAAQ,MAAM,KAAA,CAAM;AAAA,EAE7C;AAEA,SACG,gBAAAM,EAAA,OAAA,EAAI,WAAWC,EAAO,oBAAoB,GACzC,UAAA;AAAA,IAAA,gBAAAD,EAAC,OAAI,EAAA,WAAWC,EAAO,mBAAmB,GACxC,UAAA;AAAA,MAAA,gBAAAC,EAAC,QAAK,EAAA,WAAWD,EAAO,kBAAkB,GAAI,UAAMV,GAAA;AAAA,MACnDC,IAAgB,KACf,gBAAAQ,EAAC,SAAI,WAAWC,EAAO,uBAAuB,GAC5C,UAAA;AAAA,QAAA,gBAAAC,EAAC,QAAK,EAAA,WAAWC,EAAK,EAAE,CAACF,EAAO,8BAA8B,CAAC,GAAGL,MAAmBJ,EAAc,CAAC,GACjG,UACHI,EAAA,CAAA;AAAA,QAAO;AAAA,QACOJ;AAAA,MAAA,EAChB,CAAA;AAAA,IAAA,GAEJ;AAAA,IAEA,gBAAAU;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKR;AAAA,QACL,WAAWO,EAAO,WAAW;AAAA,QAC7B,WAAWT,IAAgB,IAAIA,IAAgB;AAAA,QAC/C,SAASO;AAAA,QACT,cAAAN;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 /** 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}\n\nexport function TextArea({ onChange, label, maxCharacters = 0, defaultValue = '' }: TextAreaProps) {\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n const [characterCount, setCharacterCount] = useState(0);\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 {label && <span className={styles['text-area__label']}>{label}</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={styles['text-area']}\n maxLength={maxCharacters > 0 ? maxCharacters : undefined}\n onInput={handleInput}\n defaultValue={defaultValue}\n />\n </div>\n );\n}\n"],"names":["TextArea","onChange","label","maxCharacters","defaultValue","textAreaRef","useRef","characterCount","setCharacterCount","useState","handleInput","jsxs","styles","jsx","clsx"],"mappings":";;;;;;;;;;;AAgBgB,SAAAA,EAAS,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
- "version": "3.26.4",
5
+ "version": "3.27.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",