@uva-glass/component-library 3.52.0 → 3.52.2

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.
Files changed (37) hide show
  1. package/dist/assets/TextArea.css +1 -1
  2. package/dist/components/Buttons/Button.stories.js +1 -1
  3. package/dist/components/Buttons/LinkButton.stories.js +1 -1
  4. package/dist/components/Buttons/MenuButton.stories.js +1 -1
  5. package/dist/components/Checkbox/Checkbox.stories.js +1 -1
  6. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +1 -1
  7. package/dist/components/CheckboxTree/CheckboxTree.stories.js +2 -2
  8. package/dist/components/Chip/Chip.stories.js +1 -1
  9. package/dist/components/ControlsButton/ControlsButton.stories.js +1 -1
  10. package/dist/components/Drawer/Drawer.stories.js +1 -1
  11. package/dist/components/FormInput/FormInput.stories.js +1 -1
  12. package/dist/components/IconButton/IconButton.stories.js +1 -1
  13. package/dist/components/InputField/InputField.stories.js +1 -1
  14. package/dist/components/ModalDialog/ModalDialog.stories.js +1 -1
  15. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  16. package/dist/components/MultiSelectBox/MultiSelectBox.stories.js +1 -1
  17. package/dist/components/Notification/Notification.stories.js +1 -1
  18. package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +1 -1
  19. package/dist/components/PeriodSelector/PeriodSelector.stories.js +1 -1
  20. package/dist/components/RadioGroup/RadioGroup.stories.js +1 -1
  21. package/dist/components/RadioTabSelector/RadioTabSelector.stories.js +1 -1
  22. package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
  23. package/dist/components/Sortable/Sortable.stories.js +1 -1
  24. package/dist/components/TextArea/TextArea.d.ts +5 -1
  25. package/dist/components/TextArea/TextArea.js +31 -21
  26. package/dist/components/TextArea/TextArea.js.map +1 -1
  27. package/dist/components/TextArea/TextArea.stories.js +1 -1
  28. package/dist/components/TextArea/TextArea.test.js +1 -1
  29. package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
  30. package/dist/components/VarIndicator/VarIndicator.stories.js +1 -1
  31. package/dist/{index-DvUwfXNb.js → index-BJRrLdmi.js} +1426 -1423
  32. package/dist/index-BJRrLdmi.js.map +1 -0
  33. package/dist/{index-BfMTX2kB.js → index-fdIFY6eP.js} +458 -456
  34. package/dist/{index-BfMTX2kB.js.map → index-fdIFY6eP.js.map} +1 -1
  35. package/dist/storybook__react.d.js +3 -3
  36. package/package.json +14 -14
  37. package/dist/index-DvUwfXNb.js.map +0 -1
@@ -1 +1 @@
1
- ._text-area__wrapper_1kj5x_1{display:flex;flex-direction:column;gap:.5rem}._text-area__header_1kj5x_7{align-items:flex-end;display:flex;justify-content:space-between}._text-area__label-wrapper_1kj5x_13{display:flex;flex-direction:column;gap:.5rem}._text-area__label_1kj5x_13{font-family:inherit;font-size:inherit;font-weight:var(--semibold)}._text-area__sub-label_1kj5x_25{color:var(--color-grey-700);font-size:var(--font-size-text-non-essential)}._text-area__word-count_1kj5x_30{color:var(--color-grey-600);font-size:var(--font-size-text-non-essential)}._text-area__word-count--alert_1kj5x_35{color:var(--color-red-600);font-weight:700}._text-area_1kj5x_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}
1
+ ._text-area__wrapper_di3u1_1{display:flex;flex-direction:column;gap:.5rem}._text-area__header_di3u1_7{align-items:flex-end;display:flex;justify-content:space-between}._text-area__label-wrapper_di3u1_13{display:flex;flex-direction:column;gap:.5rem}._text-area__label_di3u1_13{font-family:inherit;font-size:inherit;font-weight:var(--semibold)}._text-area__label_di3u1_13._required_di3u1_25:after{color:var(--color-red-600);content:"★";font-size:.5rem;margin-left:.25rem;vertical-align:top}._text-area__sub-label_di3u1_33{color:var(--color-grey-700);font-size:var(--font-size-text-non-essential)}._text-area__word-count_di3u1_38{color:var(--color-grey-600);font-size:var(--font-size-text-non-essential)}._text-area__word-count--alert_di3u1_43{color:var(--color-red-600);font-weight:700}._text-area_di3u1_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_di3u1_1._not-valid_di3u1_61{border-color:var(--color-red-600)}
@@ -1,5 +1,5 @@
1
1
  import { jsx as t, jsxs as a, Fragment as s } from "react/jsx-runtime";
2
- import { l } from "../../index-DvUwfXNb.js";
2
+ import { l } from "../../index-BJRrLdmi.js";
3
3
  import { Button as n } from "./Button.js";
4
4
  const c = "<Button variant={variant} onClick={onClictFunction}>{children}</Button>", h = {
5
5
  title: "Atoms/Buttons/Button",
@@ -1,5 +1,5 @@
1
1
  import { jsx as t, jsxs as a, Fragment as l } from "react/jsx-runtime";
2
- import { l as s } from "../../index-DvUwfXNb.js";
2
+ import { l as s } from "../../index-BJRrLdmi.js";
3
3
  import { BrowserRouter as c } from "react-router";
4
4
  import { LinkButton as e } from "./LinkButton.js";
5
5
  const d = `
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as l, Fragment as s } from "react/jsx-runtime";
2
- import { l as c } from "../../index-DvUwfXNb.js";
2
+ import { l as c } from "../../index-BJRrLdmi.js";
3
3
  import { MenuButton as n } from "./MenuButton.js";
4
4
  const d = `
5
5
  // Has all LabelHTMLAttributes props available except "className" and "style"
@@ -1,5 +1,5 @@
1
1
  import { jsxs as g, jsx as o } from "react/jsx-runtime";
2
- import { l as e } from "../../index-DvUwfXNb.js";
2
+ import { l as e } from "../../index-BJRrLdmi.js";
3
3
  import { Checkbox as n } from "./Checkbox.js";
4
4
  import { FormField as t } from "../FormField/FormField.js";
5
5
  import { Label as i } from "../Label/Label.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as t, Fragment as l } from "react/jsx-runtime";
2
- import { l as o } from "../../index-DvUwfXNb.js";
2
+ import { l as o } from "../../index-BJRrLdmi.js";
3
3
  import { CheckboxButtonBar as i } from "./CheckboxButtonBar.js";
4
4
  const u = "<CheckboxButtonBar checkboxes={} defaultValues={} label={} labelPosition={} required={} notValidatedText={} disableGroup={} onSetValues={} />", v = {
5
5
  title: "Molecules/CheckboxButtonBar",
@@ -1,6 +1,6 @@
1
1
  import { jsx as d, jsxs as _ } from "react/jsx-runtime";
2
- import { s as T, l as C } from "../../index-DvUwfXNb.js";
3
- import { G as v, _ as w } from "../../index-BfMTX2kB.js";
2
+ import { s as T, l as C } from "../../index-BJRrLdmi.js";
3
+ import { G as v, _ as w } from "../../index-fdIFY6eP.js";
4
4
  import { useState as R } from "react";
5
5
  import { CheckboxTree as b } from "./CheckboxTree.js";
6
6
  import { Chip as S } from "../Chip/Chip.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { l as t } from "../../index-DvUwfXNb.js";
2
+ import { l as t } from "../../index-BJRrLdmi.js";
3
3
  import { Chip as e } from "./Chip.js";
4
4
  const s = "<Chip label={string} onDelete={onDeleteFunction(label)}/>", b = {
5
5
  title: "Atoms/Chip",
@@ -1,5 +1,5 @@
1
1
  import { jsx as r, jsxs as l, Fragment as s } from "react/jsx-runtime";
2
- import { l as e } from "../../index-DvUwfXNb.js";
2
+ import { l as e } from "../../index-BJRrLdmi.js";
3
3
  import { ControlsButton as t } from "./ControlsButton.js";
4
4
  import { Icons as a } from "../Icon/icons/index.js";
5
5
  import { Periods as i } from "../Periods/Periods.js";
@@ -1,6 +1,6 @@
1
1
  import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
2
  import { OverlayProvider as p } from "@react-aria/overlays";
3
- import { l as m } from "../../index-DvUwfXNb.js";
3
+ import { l as m } from "../../index-BJRrLdmi.js";
4
4
  import { useState as c } from "react";
5
5
  import { Drawer as r } from "./Drawer.js";
6
6
  import { Button as o } from "../Buttons/Button.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { l as i } from "../../index-DvUwfXNb.js";
2
+ import { l as i } from "../../index-BJRrLdmi.js";
3
3
  import { FormInput as a } from "./FormInput.js";
4
4
  import { SelectListbox as o } from "../SelectListbox/SelectListbox.js";
5
5
  const m = `
@@ -1,5 +1,5 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { l as r } from "../../index-DvUwfXNb.js";
2
+ import { l as r } from "../../index-BJRrLdmi.js";
3
3
  import { IconButton as t } from "./IconButton.js";
4
4
  import { Icon as i } from "../Icon/Icon.js";
5
5
  const l = `<IconButton variant={variant} aria-label={aria-label} onClick={onClickFunction}>
@@ -1,6 +1,6 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { useState as d, useRef as g } from "react";
3
- import { l as p } from "../../index-DvUwfXNb.js";
3
+ import { l as p } from "../../index-BJRrLdmi.js";
4
4
  import { InputField as e } from "./InputField.js";
5
5
  import { Container as u } from "../../storyComponents/Container/Container.js";
6
6
  import "../Accordion/Accordion.js";
@@ -1,6 +1,6 @@
1
1
  import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
2
  import { ModalProvider as n } from "@react-aria/overlays";
3
- import { l as i } from "../../index-DvUwfXNb.js";
3
+ import { l as i } from "../../index-BJRrLdmi.js";
4
4
  import { ModalDialog as t } from "./ModalDialog.js";
5
5
  import { Button as l } from "../Buttons/Button.js";
6
6
  import "../Buttons/LinkButton.js";
@@ -1,5 +1,5 @@
1
1
  import { jsxs as S, jsx as r } from "react/jsx-runtime";
2
- import { l as d } from "../../index-DvUwfXNb.js";
2
+ import { l as d } from "../../index-BJRrLdmi.js";
3
3
  import { useState as p } from "react";
4
4
  import { M as e } from "../../TablePlugin-BLbsvcuu.js";
5
5
  import { Container as M } from "../../storyComponents/Container/Container.js";
@@ -1,5 +1,5 @@
1
1
  import { jsxs as m, jsx as a } from "react/jsx-runtime";
2
- import { l as u } from "../../index-DvUwfXNb.js";
2
+ import { l as u } from "../../index-BJRrLdmi.js";
3
3
  import { useState as r } from "react";
4
4
  import { MultiSelectBox as t } from "./MultiSelectBox.js";
5
5
  const b = "<MultiSelectBox selectData={[{label, value}]} onChange={fn} labelSuffix={string} />", S = {
@@ -1,5 +1,5 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { l as a } from "../../index-DvUwfXNb.js";
2
+ import { l as a } from "../../index-BJRrLdmi.js";
3
3
  import { Notification as t } from "./Notification.js";
4
4
  const l = `<Notification title={title} subtitle={subtitle} action={action}
5
5
  level={level} variant={variant} onClose={() => {}} />`, m = {
@@ -1,5 +1,5 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { l as t } from "../../index-DvUwfXNb.js";
2
+ import { l as t } from "../../index-BJRrLdmi.js";
3
3
  import { OverlayCloseButton as o } from "./OverlayCloseButton.js";
4
4
  import { Container as a } from "../../storyComponents/Container/Container.js";
5
5
  const r = "<OverlayCloseButton aria-label={aria-label} onClick={onClickFunction} />", c = {
@@ -1,5 +1,5 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { l as t } from "../../index-DvUwfXNb.js";
2
+ import { l as t } from "../../index-BJRrLdmi.js";
3
3
  import { PeriodSelector as e } from "./PeriodSelector.js";
4
4
  const i = "<PeriodSelector maxPeriods={} defaultValues={} label={} labelPosition={} required={} onChange={} />", m = {
5
5
  title: "Organisms/PeriodSelector",
@@ -1,5 +1,5 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { l as a } from "../../index-DvUwfXNb.js";
2
+ import { l as a } from "../../index-BJRrLdmi.js";
3
3
  import { RadioGroup as o } from "./RadioGroup.js";
4
4
  const l = `
5
5
  <RadioGroup label={label} options={options}
@@ -1,5 +1,5 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { l as t } from "../../index-DvUwfXNb.js";
2
+ import { l as t } from "../../index-BJRrLdmi.js";
3
3
  import { RadioTabSelector as e } from "./RadioTabSelector.js";
4
4
  const i = "<RadioTabSelector radioButtons={} defaultValue={} label={} labelPosition={} required={} notValidatedText={} onSetValue={} />", b = {
5
5
  title: "Molecules/RadioTabSelector",
@@ -1,5 +1,5 @@
1
1
  import { jsx as a, jsxs as M } from "react/jsx-runtime";
2
- import { l as i } from "../../index-DvUwfXNb.js";
2
+ import { l as i } from "../../index-BJRrLdmi.js";
3
3
  import { SelectListbox as r } from "./SelectListbox.js";
4
4
  import * as e from "react";
5
5
  const E = ({
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as i, Fragment as m } from "react/jsx-runtime";
2
- import { l as s } from "../../index-DvUwfXNb.js";
2
+ import { l as s } from "../../index-BJRrLdmi.js";
3
3
  import { Sortable as l } from "./Sortable.js";
4
4
  import { InputField as d } from "../InputField/InputField.js";
5
5
  import { Icon as c } from "../Icon/Icon.js";
@@ -9,5 +9,9 @@ export interface TextAreaProps {
9
9
  maxCharacters?: number;
10
10
  /** The default value for the text area */
11
11
  defaultValue?: string;
12
+ /** `true` to show an asterisk to indicate an item is required; otherwise, `false`. */
13
+ required?: boolean;
14
+ /** `true` to color border red to show not valid; otherwise, `false`. */
15
+ notValid?: boolean;
12
16
  }
13
- export declare function TextArea({ onChange, label, subLabel, maxCharacters, defaultValue }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function TextArea({ onChange, label, subLabel, maxCharacters, defaultValue, required, notValid, }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
@@ -1,28 +1,38 @@
1
1
  import { jsxs as r, jsx as _ } from "react/jsx-runtime";
2
- import { useRef as p, useState as d } from "react";
3
- import { c as i } from "../../clsx-OuTLNxxd.js";
4
- import '../../assets/TextArea.css';const e = {
5
- "text-area__wrapper": "_text-area__wrapper_1kj5x_1",
6
- "text-area__header": "_text-area__header_1kj5x_7",
7
- "text-area__label-wrapper": "_text-area__label-wrapper_1kj5x_13",
8
- "text-area__label": "_text-area__label_1kj5x_13",
9
- "text-area__sub-label": "_text-area__sub-label_1kj5x_25",
10
- "text-area__word-count": "_text-area__word-count_1kj5x_30",
11
- "text-area__word-count--alert": "_text-area__word-count--alert_1kj5x_35",
12
- "text-area": "_text-area_1kj5x_1"
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"
13
15
  };
14
- function j({ onChange: c, label: l, subLabel: n, maxCharacters: a = 0, defaultValue: x = "" }) {
15
- const t = p(null), [s, o] = d(x.length), u = () => {
16
- t.current && (t.current.style.height = "auto", t.current.style.height = `${t.current.scrollHeight}px`, o(t.current.value.length), c(t.current.value.trim()));
16
+ function N({
17
+ onChange: s,
18
+ label: l,
19
+ subLabel: u,
20
+ maxCharacters: a = 0,
21
+ defaultValue: d = "",
22
+ required: c = !1,
23
+ notValid: o = !1
24
+ }) {
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()));
17
27
  };
18
28
  return /* @__PURE__ */ r("div", { className: e["text-area__wrapper"], children: [
19
29
  (l || a > 0) && /* @__PURE__ */ r("div", { className: e["text-area__header"], children: [
20
30
  /* @__PURE__ */ r("span", { className: e["text-area__label-wrapper"], children: [
21
- l && /* @__PURE__ */ _("span", { className: e["text-area__label"], children: l }),
22
- n && /* @__PURE__ */ _("span", { className: e["text-area__sub-label"], children: n })
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 })
23
33
  ] }),
24
34
  a > 0 && /* @__PURE__ */ r("div", { className: e["text-area__word-count"], children: [
25
- /* @__PURE__ */ _("span", { className: i({ [e["text-area__word-count--alert"]]: s === a }), children: s }),
35
+ /* @__PURE__ */ _("span", { className: n({ [e["text-area__word-count--alert"]]: i === a }), children: i }),
26
36
  " / ",
27
37
  a
28
38
  ] })
@@ -31,15 +41,15 @@ function j({ onChange: c, label: l, subLabel: n, maxCharacters: a = 0, defaultVa
31
41
  "textarea",
32
42
  {
33
43
  ref: t,
34
- className: e["text-area"],
44
+ className: n(e["text-area"], { [e["not-valid"]]: o }),
35
45
  maxLength: a > 0 ? a : void 0,
36
- onInput: u,
37
- defaultValue: x
46
+ onInput: p,
47
+ defaultValue: d
38
48
  }
39
49
  )
40
50
  ] });
41
51
  }
42
52
  export {
43
- j as TextArea
53
+ N as TextArea
44
54
  };
45
55
  //# 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}\n\nexport function TextArea({ onChange, label, subLabel, maxCharacters = 0, defaultValue = '' }: 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 && <span className={styles['text-area__label']}>{label}</span>}\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={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","subLabel","maxCharacters","defaultValue","textAreaRef","useRef","characterCount","setCharacterCount","useState","handleInput","jsxs","styles","jsx","clsx"],"mappings":";;;;;;;;;;;;;AAkBO,SAASA,EAAS,EAAE,UAAAC,GAAU,OAAAC,GAAO,UAAAC,GAAU,eAAAC,IAAgB,GAAG,cAAAC,IAAe,MAAqB;AAC3G,QAAMC,IAAcC,EAA4B,IAAI,GAC9C,CAACC,GAAgBC,CAAiB,IAAIC,EAASL,EAAa,MAAM,GAElEM,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,GAClDL,EAASK,EAAY,QAAQ,MAAM,KAAA,CAAM;AAAA,EAE7C;AAEA,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAWC,EAAO,oBAAoB,GACvC,UAAA;AAAA,KAAAX,KAASE,IAAgB,MACzB,gBAAAQ,EAAC,SAAI,WAAWC,EAAO,mBAAmB,GACxC,UAAA;AAAA,MAAA,gBAAAD,EAAC,QAAA,EAAK,WAAWC,EAAO,0BAA0B,GAC/C,UAAA;AAAA,QAAAX,uBAAU,QAAA,EAAK,WAAWW,EAAO,kBAAkB,GAAI,UAAAX,GAAM;AAAA,QAC7DC,KAAY,gBAAAW,EAAC,QAAA,EAAK,WAAWD,EAAO,sBAAsB,GAAI,UAAAV,EAAA,CAAS;AAAA,MAAA,GAC1E;AAAA,MACCC,IAAgB,KACf,gBAAAQ,EAAC,SAAI,WAAWC,EAAO,uBAAuB,GAC5C,UAAA;AAAA,QAAA,gBAAAC,EAAC,QAAA,EAAK,WAAWC,EAAK,EAAE,CAACF,EAAO,8BAA8B,CAAC,GAAGL,MAAmBJ,EAAA,CAAe,GACjG,UAAAI,EAAA,CACH;AAAA,QAAO;AAAA,QACOJ;AAAA,MAAA,EAAA,CAChB;AAAA,IAAA,GAEJ;AAAA,IAGF,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 /** 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,5 +1,5 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { l as a } from "../../index-DvUwfXNb.js";
2
+ import { l as a } from "../../index-BJRrLdmi.js";
3
3
  import { TextArea as e } from "./TextArea.js";
4
4
  const o = `
5
5
  <TextArea label={label} maxCharacters={maxCharacters} defaultValue={string}/> `, x = {
@@ -1,7 +1,7 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
2
  import "../../index-DYPpFe2R.js";
3
3
  import { r as o, s as t, f as r } from "../../react.esm-DdELhthz.js";
4
- import { J as c } from "../../index-DvUwfXNb.js";
4
+ import { J as c } from "../../index-BJRrLdmi.js";
5
5
  import { TextArea as n } from "./TextArea.js";
6
6
  describe("TextArea", () => {
7
7
  it("should render correctly with label", () => {
@@ -1,5 +1,5 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { l } from "../../index-DvUwfXNb.js";
2
+ import { l } from "../../index-BJRrLdmi.js";
3
3
  import { ToggleSwitch as e } from "./ToggleSwitch.js";
4
4
  const a = `
5
5
  // Has all InputHTMLAttributes props available except "className" and "style"
@@ -1,5 +1,5 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { l as n } from "../../index-DvUwfXNb.js";
2
+ import { l as n } from "../../index-BJRrLdmi.js";
3
3
  import { VarIndicator as t } from "./VarIndicator.js";
4
4
  const o = {
5
5
  DRAFT: "Concept",