@uva-glass/component-library 3.3.0 → 3.5.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.
- package/dist/_commonjsHelpers-DaMA6jEr.js +9 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
- package/dist/assets/RadioGroup.css +1 -1
- package/dist/assets/TextArea.css +1 -0
- package/dist/components/Accordion/Accordion.test.js +3 -3
- package/dist/components/AccordionCard/AccordionCard.test.js +3 -3
- package/dist/components/ActionList/ActionList.test.js +3 -3
- package/dist/components/AppStatusBar/AppStatusBar.test.js +2 -2
- package/dist/components/Attention/Attention.test.js +2 -2
- package/dist/components/Backdrop/Backdrop.test.js +2 -2
- package/dist/components/Buttons/Button.test.js +2 -2
- package/dist/components/Buttons/LinkButton.test.js +2 -2
- package/dist/components/Buttons/MenuButton.test.js +2 -2
- package/dist/components/Card/Card.test.js +2 -2
- package/dist/components/Checkbox/Checkbox.test.js +2 -2
- package/dist/components/CheckboxButton/CheckboxButton.test.js +2 -2
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +2 -2
- package/dist/components/FeedbackBar/FeedbackBar.test.js +2 -2
- package/dist/components/Icon/icons/index.d.ts +12 -0
- package/dist/components/Icon/icons/index.js +49 -39
- package/dist/components/Icon/icons/index.js.map +1 -1
- package/dist/components/Label/Label.test.js +2 -2
- package/dist/components/RadioGroup/RadioGroup.js +27 -26
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/RadioGroup/Radiogroup.test.js +2 -2
- package/dist/components/StatusBadge/StatusBadge.test.js +2 -2
- package/dist/components/TextArea/TextArea.d.ts +9 -0
- package/dist/components/TextArea/TextArea.js +39 -0
- package/dist/components/TextArea/TextArea.js.map +1 -0
- package/dist/components/TextArea/TextArea.stories.d.ts +5 -0
- package/dist/components/TextArea/TextArea.stories.js +30 -0
- package/dist/components/TextArea/TextArea.stories.js.map +1 -0
- package/dist/components/TextArea/TextArea.test.d.ts +0 -0
- package/dist/components/TextArea/TextArea.test.js +25 -0
- package/dist/components/TextArea/TextArea.test.js.map +1 -0
- package/dist/components/TextArea/index.d.ts +1 -0
- package/dist/components/TextArea/index.js +5 -0
- package/dist/components/TextArea/index.js.map +1 -0
- package/dist/components/Timeline/Timeline.test.js +2 -2
- package/dist/components/VarIndicator/VarIndicator.test.js +3 -3
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +52 -48
- package/dist/components/index.js.map +1 -1
- package/dist/{index-Z7qwJmRM.js → index-dmBn99rF.js} +284 -289
- package/dist/{index-Z7qwJmRM.js.map → index-dmBn99rF.js.map} +1 -1
- package/dist/{index-COab4Oy9.js → index-hwMTfLfH.js} +2 -2
- package/dist/{index-COab4Oy9.js.map → index-hwMTfLfH.js.map} +1 -1
- package/dist/index.js +52 -48
- package/dist/index.js.map +1 -1
- package/dist/{react.esm-B8teOYlo.js → react.esm-DI5ilWeT.js} +6 -5
- package/dist/{react.esm-B8teOYlo.js.map → react.esm-DI5ilWeT.js.map} +1 -1
- package/dist/setupTests.js +2 -1
- package/dist/setupTests.js.map +1 -1
- package/dist/storybook__react.d.js +8 -2
- package/dist/storybook__react.d.js.map +1 -1
- package/dist/{test-utils-Brqoydie.js → test-utils-B2AIdiiO.js} +134 -132
- package/dist/{test-utils-Brqoydie.js.map → test-utils-B2AIdiiO.js.map} +1 -1
- package/package.json +14 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import "../../index-
|
|
3
|
-
import { r as t, s as l } from "../../react.esm-
|
|
2
|
+
import "../../index-dmBn99rF.js";
|
|
3
|
+
import { r as t, s as l } from "../../react.esm-DI5ilWeT.js";
|
|
4
4
|
import { Label as r } from "./Label.js";
|
|
5
5
|
describe("Label", () => {
|
|
6
6
|
it("should render", () => {
|
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as u, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useState as h } from "react";
|
|
3
|
-
import { c as
|
|
3
|
+
import { c as m } from "../../clsx-OuTLNxxd.js";
|
|
4
4
|
import { RadioButton as k } from "../RadioButton/RadioButton.js";
|
|
5
|
-
import '../../assets/RadioGroup.css';const
|
|
6
|
-
"radio-
|
|
7
|
-
"radio-
|
|
8
|
-
"radio-
|
|
9
|
-
"radio-group__option
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import '../../assets/RadioGroup.css';const r = {
|
|
6
|
+
"radio-group__wrapper": "_radio-group__wrapper_1khqv_1",
|
|
7
|
+
"radio-group__header": "_radio-group__header_1khqv_7",
|
|
8
|
+
"radio-group": "_radio-group_1khqv_1",
|
|
9
|
+
"radio-group__option": "_radio-group__option_1khqv_21",
|
|
10
|
+
"radio-group__option--disabled": "_radio-group__option--disabled_1khqv_36"
|
|
11
|
+
}, x = ({ label: d, options: t, onChange: n, disabled: _ }) => {
|
|
12
|
+
const [s, c] = h(null), p = (o) => {
|
|
13
|
+
_ || (c(o), n(o));
|
|
13
14
|
};
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */ i("h2", { className:
|
|
16
|
-
/* @__PURE__ */ i("div", { className:
|
|
15
|
+
return /* @__PURE__ */ u("div", { className: r["radio-group__wrapper"], children: [
|
|
16
|
+
/* @__PURE__ */ i("h2", { className: r["radio-group__header"], children: d }),
|
|
17
|
+
/* @__PURE__ */ i("div", { className: r["radio-group"], children: t.map(({ id: o, descriptionLabel: g, titleLabel: l, value: e }) => /* @__PURE__ */ i(
|
|
17
18
|
"div",
|
|
18
19
|
{
|
|
19
|
-
className:
|
|
20
|
-
[
|
|
20
|
+
className: m(r["radio-group__option"], {
|
|
21
|
+
[r["radio-group__option--disabled"]]: _
|
|
21
22
|
}),
|
|
22
|
-
onClick: () =>
|
|
23
|
-
onKeyDown: (
|
|
24
|
-
(
|
|
23
|
+
onClick: () => p(e),
|
|
24
|
+
onKeyDown: (a) => {
|
|
25
|
+
(a.key === "Enter" || a.key === " ") && p(e);
|
|
25
26
|
},
|
|
26
27
|
role: "presentation",
|
|
27
28
|
children: /* @__PURE__ */ i(
|
|
28
29
|
k,
|
|
29
30
|
{
|
|
30
31
|
id: o,
|
|
31
|
-
label:
|
|
32
|
-
description:
|
|
32
|
+
label: l,
|
|
33
|
+
description: g,
|
|
33
34
|
name: d,
|
|
34
|
-
onChange: (
|
|
35
|
-
|
|
35
|
+
onChange: (a) => {
|
|
36
|
+
p(a.target.value);
|
|
36
37
|
},
|
|
37
|
-
value:
|
|
38
|
-
checked: s ===
|
|
39
|
-
disabled:
|
|
38
|
+
value: e,
|
|
39
|
+
checked: s === e,
|
|
40
|
+
disabled: _,
|
|
40
41
|
gap: "large"
|
|
41
42
|
}
|
|
42
43
|
)
|
|
@@ -46,6 +47,6 @@ import '../../assets/RadioGroup.css';const a = {
|
|
|
46
47
|
] });
|
|
47
48
|
};
|
|
48
49
|
export {
|
|
49
|
-
|
|
50
|
+
x as RadioGroup
|
|
50
51
|
};
|
|
51
52
|
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sources":["../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import { useState } from 'react';\nimport clsx from 'clsx';\n\nimport styles from './RadioGroup.module.css';\n\nimport { RadioButton } from 'components/RadioButton/RadioButton';\n\ntype Option = {\n id: string;\n titleLabel: string;\n descriptionLabel?: string;\n value: string;\n};\n\nexport interface RadioGroupProps {\n /** The label of the radio group */\n label: string;\n /** Radio options. */\n options: Option[];\n /** Returns selected values as string */\n onChange: (value: string) => void;\n /** If true, the whole group will be disabled. */\n disabled?: boolean;\n}\n\n/** Represents a component for dispalying grouped styled radio buttons. */\nexport const RadioGroup = ({ label, options, onChange, disabled }: RadioGroupProps) => {\n const [selectedValue, setSelectedValue] = useState<string | null>(null);\n\n const handleSelection = (value: string) => {\n if (!disabled) {\n setSelectedValue(value);\n onChange(value);\n }\n };\n\n return (\n
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","sources":["../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import { useState } from 'react';\nimport clsx from 'clsx';\n\nimport styles from './RadioGroup.module.css';\n\nimport { RadioButton } from 'components/RadioButton/RadioButton';\n\ntype Option = {\n id: string;\n titleLabel: string;\n descriptionLabel?: string;\n value: string;\n};\n\nexport interface RadioGroupProps {\n /** The label of the radio group */\n label: string;\n /** Radio options. */\n options: Option[];\n /** Returns selected values as string */\n onChange: (value: string) => void;\n /** If true, the whole group will be disabled. */\n disabled?: boolean;\n}\n\n/** Represents a component for dispalying grouped styled radio buttons. */\nexport const RadioGroup = ({ label, options, onChange, disabled }: RadioGroupProps) => {\n const [selectedValue, setSelectedValue] = useState<string | null>(null);\n\n const handleSelection = (value: string) => {\n if (!disabled) {\n setSelectedValue(value);\n onChange(value);\n }\n };\n\n return (\n <div className={styles['radio-group__wrapper']}>\n <h2 className={styles['radio-group__header']}>{label}</h2>\n <div className={styles['radio-group']}>\n {options.map(({ id, descriptionLabel, titleLabel, value }) => (\n <div\n className={clsx(styles['radio-group__option'], {\n [styles['radio-group__option--disabled']]: disabled,\n })}\n key={id}\n onClick={() => handleSelection(value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n handleSelection(value);\n }\n }}\n role=\"presentation\"\n >\n <RadioButton\n id={id}\n label={titleLabel}\n description={descriptionLabel}\n name={label}\n onChange={(event) => {\n handleSelection(event.target.value);\n }}\n value={value}\n checked={selectedValue === value}\n disabled={disabled}\n gap=\"large\"\n />\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["RadioGroup","label","options","onChange","disabled","selectedValue","setSelectedValue","useState","handleSelection","value","jsxs","styles","jsx","id","descriptionLabel","titleLabel","clsx","event","RadioButton"],"mappings":";;;;;;;;;;GA0BaA,IAAa,CAAC,EAAE,OAAAC,GAAO,SAAAC,GAAS,UAAAC,GAAU,UAAAC,QAAgC;AACrF,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAwB,IAAI,GAEhEC,IAAkB,CAACC,MAAkB;AACzC,IAAKL,MACHE,EAAiBG,CAAK,GACtBN,EAASM,CAAK;AAAA,EAElB;AAEA,SACG,gBAAAC,EAAA,OAAA,EAAI,WAAWC,EAAO,sBAAsB,GAC3C,UAAA;AAAA,IAAA,gBAAAC,EAAC,MAAG,EAAA,WAAWD,EAAO,qBAAqB,GAAI,UAAMV,GAAA;AAAA,IACpD,gBAAAW,EAAA,OAAA,EAAI,WAAWD,EAAO,aAAa,GACjC,UAAAT,EAAQ,IAAI,CAAC,EAAE,IAAAW,GAAI,kBAAAC,GAAkB,YAAAC,GAAY,OAAAN,QAChD,gBAAAG;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWI,EAAKL,EAAO,qBAAqB,GAAG;AAAA,UAC7C,CAACA,EAAO,+BAA+B,CAAC,GAAGP;AAAA,QAAA,CAC5C;AAAA,QAED,SAAS,MAAMI,EAAgBC,CAAK;AAAA,QACpC,WAAW,CAACQ,MAAU;AACpB,WAAIA,EAAM,QAAQ,WAAWA,EAAM,QAAQ,QACzCT,EAAgBC,CAAK;AAAA,QAEzB;AAAA,QACA,MAAK;AAAA,QAEL,UAAA,gBAAAG;AAAA,UAACM;AAAA,UAAA;AAAA,YACC,IAAAL;AAAA,YACA,OAAOE;AAAA,YACP,aAAaD;AAAA,YACb,MAAMb;AAAA,YACN,UAAU,CAACgB,MAAU;AACH,cAAAT,EAAAS,EAAM,OAAO,KAAK;AAAA,YACpC;AAAA,YACA,OAAAR;AAAA,YACA,SAASJ,MAAkBI;AAAA,YAC3B,UAAAL;AAAA,YACA,KAAI;AAAA,UAAA;AAAA,QAAA;AAAA,MACN;AAAA,MArBKS;AAAA,IAAA,CAuBR,EACH,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import "../../index-
|
|
3
|
-
import { r as l, s as t, f as s } from "../../react.esm-
|
|
2
|
+
import "../../index-dmBn99rF.js";
|
|
3
|
+
import { r as l, s as t, f as s } from "../../react.esm-DI5ilWeT.js";
|
|
4
4
|
import { RadioGroup as a } from "./RadioGroup.js";
|
|
5
5
|
const i = [
|
|
6
6
|
{ id: "1", titleLabel: "Option 1", value: "option1" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import "../../index-
|
|
3
|
-
import { r as t, s } from "../../react.esm-
|
|
2
|
+
import "../../index-dmBn99rF.js";
|
|
3
|
+
import { r as t, s } from "../../react.esm-DI5ilWeT.js";
|
|
4
4
|
import { StatusBadge as a } from "./StatusBage.js";
|
|
5
5
|
describe("StatusBadge", () => {
|
|
6
6
|
it("should render with message", () => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface TextAreaProps {
|
|
2
|
+
/** Returns entered values as trimmed string */
|
|
3
|
+
onChange: (value: string) => void;
|
|
4
|
+
/** The label for the text area */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** The max amount of allowed charecters in the text area */
|
|
7
|
+
maxCharacters?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function TextArea({ onChange, label, maxCharacters }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs as r, jsx as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as u, useState as i } from "react";
|
|
3
|
+
import { c as x } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import '../../assets/TextArea.css';const t = {
|
|
5
|
+
"text-area__wrapper": "_text-area__wrapper_13ivw_1",
|
|
6
|
+
"text-area__header": "_text-area__header_13ivw_7",
|
|
7
|
+
"text-area__label": "_text-area__label_13ivw_13",
|
|
8
|
+
"text-area__word-count": "_text-area__word-count_13ivw_20",
|
|
9
|
+
"text-area__word-count--alert": "_text-area__word-count--alert_13ivw_25",
|
|
10
|
+
"text-area": "_text-area_13ivw_1"
|
|
11
|
+
};
|
|
12
|
+
function h({ onChange: l, label: c, maxCharacters: a = 0 }) {
|
|
13
|
+
const e = u(null), [n, o] = i(0), s = () => {
|
|
14
|
+
e.current && (e.current.style.height = "auto", e.current.style.height = `${e.current.scrollHeight}px`, o(e.current.value.length), l(e.current.value.trim()));
|
|
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: x({ [t["text-area__word-count--alert"]]: n === a }), children: n }),
|
|
21
|
+
" / ",
|
|
22
|
+
a
|
|
23
|
+
] })
|
|
24
|
+
] }),
|
|
25
|
+
/* @__PURE__ */ _(
|
|
26
|
+
"textarea",
|
|
27
|
+
{
|
|
28
|
+
ref: e,
|
|
29
|
+
className: t["text-area"],
|
|
30
|
+
maxLength: a > 0 ? a : void 0,
|
|
31
|
+
onInput: s
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
] });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
h as TextArea
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=TextArea.js.map
|
|
@@ -0,0 +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}\n\nexport function TextArea({ onChange, label, maxCharacters = 0 }: 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 / {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 />\n </div>\n );\n}\n"],"names":["TextArea","onChange","label","maxCharacters","textAreaRef","useRef","characterCount","setCharacterCount","useState","handleInput","jsxs","styles","jsx","clsx"],"mappings":";;;;;;;;;;;AAcO,SAASA,EAAS,EAAE,UAAAC,GAAU,OAAAC,GAAO,eAAAC,IAAgB,KAAoB;AACxE,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,GAClDH,EAASG,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,UAAMT,GAAA;AAAA,MACnDC,IAAgB,KACf,gBAAAO,EAAC,SAAI,WAAWC,EAAO,uBAAuB,GAC5C,UAAA;AAAA,QAAA,gBAAAC,EAAC,QAAK,EAAA,WAAWC,EAAK,EAAE,CAACF,EAAO,8BAA8B,CAAC,GAAGL,MAAmBH,EAAc,CAAC,GACjG,UACHG,EAAA,CAAA;AAAA,QAAO;AAAA,QACOH;AAAA,MAAA,EAChB,CAAA;AAAA,IAAA,GAEJ;AAAA,IAEA,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKR;AAAA,QACL,WAAWO,EAAO,WAAW;AAAA,QAC7B,WAAWR,IAAgB,IAAIA,IAAgB;AAAA,QAC/C,SAASM;AAAA,MAAA;AAAA,IAAA;AAAA,EACX,GACF;AAEJ;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { TextAreaProps } from './TextArea';
|
|
3
|
+
declare const _default: Meta<TextAreaProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const TextAreaExample: import('@storybook/core/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, TextAreaProps>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { fn as r } from "../../index-DXR-TB1d.js";
|
|
3
|
+
import { TextArea as e } from "./TextArea.js";
|
|
4
|
+
const o = `
|
|
5
|
+
<TextArea label={label} maxCharacters={maxCharacters} /> `, x = {
|
|
6
|
+
title: "Atoms/TextArea",
|
|
7
|
+
component: e,
|
|
8
|
+
argTypes: {
|
|
9
|
+
label: {
|
|
10
|
+
control: "text"
|
|
11
|
+
},
|
|
12
|
+
maxCharacters: {
|
|
13
|
+
control: "number"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
parameters: {
|
|
17
|
+
inspectComponent: e,
|
|
18
|
+
codeString: o
|
|
19
|
+
}
|
|
20
|
+
}, m = (a) => /* @__PURE__ */ t(e, { ...a }), n = m.bind({});
|
|
21
|
+
n.args = {
|
|
22
|
+
label: "Sample label",
|
|
23
|
+
maxCharacters: 140,
|
|
24
|
+
onChange: r()
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
n as TextAreaExample,
|
|
28
|
+
x as default
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=TextArea.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.stories.js","sources":["../../../src/components/TextArea/TextArea.stories.tsx"],"sourcesContent":["import { fn } from '@storybook/test';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { TextAreaProps } from './TextArea';\n\nimport { TextArea } from './TextArea';\n\nconst codeString = `\n <TextArea label={label} maxCharacters={maxCharacters} /> `;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/TextArea',\n component: TextArea,\n argTypes: {\n label: {\n control: 'text',\n },\n maxCharacters: {\n control: 'number',\n },\n },\n parameters: {\n inspectComponent: TextArea,\n codeString: codeString,\n },\n} as Meta<TextAreaProps>;\n\nconst Template: StoryFn<TextAreaProps> = (args) => <TextArea {...args} />;\n\nexport const TextAreaExample = Template.bind({});\nTextAreaExample.args = {\n label: 'Sample label',\n maxCharacters: 140,\n onChange: fn(),\n};\n"],"names":["codeString","TextArea_stories","TextArea","Template","args","jsx","TextAreaExample","fn"],"mappings":";;;AAOA,MAAMA,IAAa;AAAA,8DAIJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,OAAO;AAAA,MACL,SAAS;AAAA,IACX;AAAA,IACA,eAAe;AAAA,MACb,SAAS;AAAA,IAAA;AAAA,EAEb;AAAA,EACA,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EAAA;AAEJ,GAEMG,IAAmC,CAACC,MAAU,gBAAAC,EAAAH,GAAA,EAAU,GAAGE,GAAM,GAE1DE,IAAkBH,EAAS,KAAK,CAAE,CAAA;AAC/CG,EAAgB,OAAO;AAAA,EACrB,OAAO;AAAA,EACP,eAAe;AAAA,EACf,UAAUC,EAAG;AACf;"}
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import "../../index-dmBn99rF.js";
|
|
3
|
+
import { r as n, s as t, f as r } from "../../react.esm-DI5ilWeT.js";
|
|
4
|
+
import { userEvent as s } from "../../index-DXR-TB1d.js";
|
|
5
|
+
import { TextArea as o } from "./TextArea.js";
|
|
6
|
+
describe("TextArea", () => {
|
|
7
|
+
it("should render correctly with label", () => {
|
|
8
|
+
n(/* @__PURE__ */ a(o, { onChange: jest.fn(), label: "Test Label" })), expect(t.getByText("Test Label")).toBeInTheDocument();
|
|
9
|
+
}), it("should call onChange when text is entered", () => {
|
|
10
|
+
const e = jest.fn();
|
|
11
|
+
n(/* @__PURE__ */ a(o, { onChange: e }));
|
|
12
|
+
const l = t.getByRole("textbox");
|
|
13
|
+
r.input(l, { target: { value: "Hello" } }), expect(e).toHaveBeenCalledWith("Hello");
|
|
14
|
+
}), it("should update character count", () => {
|
|
15
|
+
n(/* @__PURE__ */ a(o, { onChange: jest.fn(), label: "Test", maxCharacters: 10 }));
|
|
16
|
+
const e = t.getByRole("textbox");
|
|
17
|
+
r.input(e, { target: { value: "Test" } }), expect(t.getByText("4")).toBeInTheDocument(), expect(t.getByText("/ 10")).toBeInTheDocument();
|
|
18
|
+
}), it("should not exceed max characters limit", async () => {
|
|
19
|
+
const e = jest.fn();
|
|
20
|
+
n(/* @__PURE__ */ a(o, { onChange: e, maxCharacters: 5 }));
|
|
21
|
+
const l = t.getByRole("textbox");
|
|
22
|
+
await s.type(l, "ExceedsLimit"), expect(e).toHaveBeenCalled(), expect(e.mock.calls[e.mock.calls.length - 1][0].length).toBe(5);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=TextArea.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.test.js","sources":["../../../src/components/TextArea/TextArea.test.tsx"],"sourcesContent":["import '@testing-library/jest-dom';\nimport { render, screen, fireEvent } from '@testing-library/react';\nimport { userEvent } from '@storybook/test';\n\nimport { TextArea } from './TextArea';\n\ndescribe('TextArea', () => {\n it('should render correctly with label', () => {\n render(<TextArea onChange={jest.fn()} label=\"Test Label\" />);\n expect(screen.getByText('Test Label')).toBeInTheDocument();\n });\n\n it('should call onChange when text is entered', () => {\n const handleChange = jest.fn();\n render(<TextArea onChange={handleChange} />);\n\n const textarea = screen.getByRole('textbox');\n fireEvent.input(textarea, { target: { value: 'Hello' } });\n expect(handleChange).toHaveBeenCalledWith('Hello');\n });\n\n it('should update character count', () => {\n render(<TextArea onChange={jest.fn()} label=\"Test\" maxCharacters={10} />);\n\n const textarea = screen.getByRole('textbox');\n fireEvent.input(textarea, { target: { value: 'Test' } });\n\n expect(screen.getByText('4')).toBeInTheDocument();\n expect(screen.getByText('/ 10')).toBeInTheDocument();\n });\n\n it('should not exceed max characters limit', async () => {\n const handleChange = jest.fn();\n render(<TextArea onChange={handleChange} maxCharacters={5} />);\n\n const textarea = screen.getByRole('textbox');\n\n await userEvent.type(textarea, 'ExceedsLimit');\n\n expect(handleChange).toHaveBeenCalled();\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n expect(handleChange.mock.calls[handleChange.mock.calls.length - 1][0].length).toBe(5);\n });\n});\n"],"names":["render","jsx","TextArea","screen","handleChange","textarea","fireEvent","userEvent"],"mappings":";;;;;AAMA,SAAS,YAAY,MAAM;AACzB,KAAG,sCAAsC,MAAM;AACtC,IAAAA,EAAA,gBAAAC,EAACC,KAAS,UAAU,KAAK,MAAM,OAAM,cAAa,CAAE,GAC3D,OAAOC,EAAO,UAAU,YAAY,CAAC,EAAE,kBAAkB;AAAA,EAAA,CAC1D,GAED,GAAG,6CAA6C,MAAM;AAC9C,UAAAC,IAAe,KAAK,GAAG;AAC7B,IAAAJ,EAAQ,gBAAAC,EAAAC,GAAA,EAAS,UAAUE,EAAc,CAAA,CAAE;AAErC,UAAAC,IAAWF,EAAO,UAAU,SAAS;AACjC,IAAAG,EAAA,MAAMD,GAAU,EAAE,QAAQ,EAAE,OAAO,QAAA,GAAW,GACjD,OAAAD,CAAY,EAAE,qBAAqB,OAAO;AAAA,EAAA,CAClD,GAED,GAAG,iCAAiC,MAAM;AACjC,IAAAJ,EAAA,gBAAAC,EAACC,GAAS,EAAA,UAAU,KAAK,MAAM,OAAM,QAAO,eAAe,GAAI,CAAA,CAAE;AAElE,UAAAG,IAAWF,EAAO,UAAU,SAAS;AACjC,IAAAG,EAAA,MAAMD,GAAU,EAAE,QAAQ,EAAE,OAAO,OAAA,GAAU,GAEvD,OAAOF,EAAO,UAAU,GAAG,CAAC,EAAE,kBAAkB,GAChD,OAAOA,EAAO,UAAU,MAAM,CAAC,EAAE,kBAAkB;AAAA,EAAA,CACpD,GAED,GAAG,0CAA0C,YAAY;AACjD,UAAAC,IAAe,KAAK,GAAG;AAC7B,IAAAJ,oBAAQE,GAAS,EAAA,UAAUE,GAAc,eAAe,GAAG,CAAE;AAEvD,UAAAC,IAAWF,EAAO,UAAU,SAAS;AAErC,UAAAI,EAAU,KAAKF,GAAU,cAAc,GAEtC,OAAAD,CAAY,EAAE,iBAAiB,GAEtC,OAAOA,EAAa,KAAK,MAAMA,EAAa,KAAK,MAAM,SAAS,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC;AAAA,EAAA,CACrF;AACH,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TextArea';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import "../../index-
|
|
3
|
-
import { r as n, s as e, f as i } from "../../react.esm-
|
|
2
|
+
import "../../index-dmBn99rF.js";
|
|
3
|
+
import { r as n, s as e, f as i } from "../../react.esm-DI5ilWeT.js";
|
|
4
4
|
import { MOCK_TIMELINE_ITEM as r } from "./mockTimelineItem.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "../Buttons/Button.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import "../../index-
|
|
3
|
-
import { r as l, s as e, w as a } from "../../react.esm-
|
|
4
|
-
import { u as i } from "../../index-
|
|
2
|
+
import "../../index-dmBn99rF.js";
|
|
3
|
+
import { r as l, s as e, w as a } from "../../react.esm-DI5ilWeT.js";
|
|
4
|
+
import { u as i } from "../../index-hwMTfLfH.js";
|
|
5
5
|
import { useState as s } from "react";
|
|
6
6
|
import { VarIndicator as n } from "./VarIndicator.js";
|
|
7
7
|
const o = {
|
|
@@ -39,6 +39,7 @@ export * from './Periods';
|
|
|
39
39
|
export * from './PeriodSelector';
|
|
40
40
|
export * from './ProgrammeCard';
|
|
41
41
|
export * from './RadioButton';
|
|
42
|
+
export * from './RadioGroup';
|
|
42
43
|
export * from './Repeater';
|
|
43
44
|
export * from './RteEditor';
|
|
44
45
|
export * from './SectionNotification';
|
|
@@ -48,6 +49,7 @@ export * from './Sortable';
|
|
|
48
49
|
export * from './Spinner';
|
|
49
50
|
export * from './StatusBadge';
|
|
50
51
|
export * from './StatusPill';
|
|
52
|
+
export * from './TextArea';
|
|
51
53
|
export * from './Timeline';
|
|
52
54
|
export * from './ToggleSwitch';
|
|
53
55
|
export * from './Tooltip';
|
package/dist/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Accordion as t } from "./Accordion/Accordion.js";
|
|
2
2
|
import { AccordionCard as p } from "./AccordionCard/AccordionCard.js";
|
|
3
|
-
import { ActionList as
|
|
3
|
+
import { ActionList as m } from "./ActionList/ActionList.js";
|
|
4
4
|
import { AppStatusBar as a } from "./AppStatusBar/AppStatusBar.js";
|
|
5
5
|
import { Attention as n } from "./Attention/Attention.js";
|
|
6
6
|
import { Backdrop as c } from "./Backdrop/Backdrop.js";
|
|
@@ -11,11 +11,11 @@ import { MenuButton as C } from "./Buttons/MenuButton.js";
|
|
|
11
11
|
import { Card as g } from "./Card/Card.js";
|
|
12
12
|
import { Checkbox as L } from "./Checkbox/Checkbox.js";
|
|
13
13
|
import { CheckboxButton as h } from "./CheckboxButton/CheckboxButton.js";
|
|
14
|
-
import { CheckboxButtonBar as
|
|
15
|
-
import { CheckboxTree as
|
|
16
|
-
import { Chip as
|
|
14
|
+
import { CheckboxButtonBar as P } from "./CheckboxButtonBar/CheckboxButtonBar.js";
|
|
15
|
+
import { CheckboxTree as y } from "./CheckboxTree/CheckboxTree.js";
|
|
16
|
+
import { Chip as T } from "./Chip/Chip.js";
|
|
17
17
|
import { Drawer as w } from "./Drawer/Drawer.js";
|
|
18
|
-
import { EmptyStateDataDisplay as
|
|
18
|
+
import { EmptyStateDataDisplay as O } from "./EmptyStateDataDisplay/EmptyStateDataDisplay.js";
|
|
19
19
|
import { FeedbackBar as H } from "./FeedbackBar/FeedbackBar.js";
|
|
20
20
|
import { FeedbackBox as N } from "./FeedbackBox/FeedbackBox.js";
|
|
21
21
|
import { FieldHint as j } from "./FieldHint/FieldHint.js";
|
|
@@ -27,7 +27,7 @@ import { HorizontalList as _ } from "./HorizontalList/HorizontalList.js";
|
|
|
27
27
|
import { Icon as oo } from "./Icon/Icon.js";
|
|
28
28
|
import { IconButton as to } from "./IconButton/IconButton.js";
|
|
29
29
|
import { InfoMessage as po } from "./InfoMessage/InfoMessage.js";
|
|
30
|
-
import { Input as
|
|
30
|
+
import { Input as mo } from "./Input/Input.js";
|
|
31
31
|
import { InputField as ao } from "./InputField/InputField.js";
|
|
32
32
|
import { Label as no } from "./Label/Label.js";
|
|
33
33
|
import { MenuLink as co } from "./MenuLink/MenuLink.js";
|
|
@@ -37,27 +37,29 @@ import { M as ko } from "../TablePlugin-MjKuocl4.js";
|
|
|
37
37
|
import { OverlayCloseButton as Fo } from "./OverlayCloseButton/OverlayCloseButton.js";
|
|
38
38
|
import { OverlayStepBar as Io } from "./OverlayStepBar/OverlayStepBar.js";
|
|
39
39
|
import { PageOverlay as Mo } from "./PageOverlay/PageOverlay.js";
|
|
40
|
-
import { Periods as
|
|
41
|
-
import { PeriodSelector as
|
|
42
|
-
import { ProgrammeCard as
|
|
43
|
-
import { RadioButton as
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
40
|
+
import { Periods as Ao } from "./Periods/Periods.js";
|
|
41
|
+
import { PeriodSelector as Ro } from "./PeriodSelector/PeriodSelector.js";
|
|
42
|
+
import { ProgrammeCard as Do } from "./ProgrammeCard/ProgrammeCard.js";
|
|
43
|
+
import { RadioButton as vo } from "./RadioButton/RadioButton.js";
|
|
44
|
+
import { RadioGroup as Go } from "./RadioGroup/RadioGroup.js";
|
|
45
|
+
import { Repeater as Eo } from "./Repeater/Repeater.js";
|
|
46
|
+
import { Rte as zo, RteEditor as No } from "./RteEditor/RteEditor.js";
|
|
47
|
+
import { SectionNotification as jo } from "./SectionNotification/SectionNotification.js";
|
|
48
|
+
import { SelectListbox as Jo } from "./SelectListbox/SelectListbox.js";
|
|
49
|
+
import { SelectProvider as Qo, useSelect as Uo } from "./SelectListbox/SelectProvider.js";
|
|
50
|
+
import { Sortable as Xo } from "./Sortable/Sortable.js";
|
|
51
|
+
import { Spinner as Zo } from "./Spinner/Spinner.js";
|
|
52
|
+
import { StatusBadge as $o } from "./StatusBadge/StatusBage.js";
|
|
53
|
+
import { StatusPill as rr } from "./StatusPill/StatusPill.js";
|
|
54
|
+
import { TextArea as er } from "./TextArea/TextArea.js";
|
|
55
|
+
import { Timeline as xr } from "./Timeline/Timeline.js";
|
|
56
|
+
import { ToggleSwitch as fr } from "./ToggleSwitch/ToggleSwitch.js";
|
|
57
|
+
import { Tooltip as ir } from "./Tooltip/Tooltip.js";
|
|
58
|
+
import { VarIndicator as lr } from "./VarIndicator/VarIndicator.js";
|
|
57
59
|
export {
|
|
58
60
|
t as Accordion,
|
|
59
61
|
p as AccordionCard,
|
|
60
|
-
|
|
62
|
+
m as ActionList,
|
|
61
63
|
a as AppStatusBar,
|
|
62
64
|
n as Attention,
|
|
63
65
|
c as Backdrop,
|
|
@@ -66,11 +68,11 @@ export {
|
|
|
66
68
|
g as Card,
|
|
67
69
|
L as Checkbox,
|
|
68
70
|
h as CheckboxButton,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
P as CheckboxButtonBar,
|
|
72
|
+
y as CheckboxTree,
|
|
73
|
+
T as Chip,
|
|
72
74
|
w as Drawer,
|
|
73
|
-
|
|
75
|
+
O as EmptyStateDataDisplay,
|
|
74
76
|
H as FeedbackBar,
|
|
75
77
|
N as FeedbackBox,
|
|
76
78
|
j as FieldHint,
|
|
@@ -82,7 +84,7 @@ export {
|
|
|
82
84
|
oo as Icon,
|
|
83
85
|
to as IconButton,
|
|
84
86
|
po as InfoMessage,
|
|
85
|
-
|
|
87
|
+
mo as Input,
|
|
86
88
|
ao as InputField,
|
|
87
89
|
no as Label,
|
|
88
90
|
b as LinkButton,
|
|
@@ -94,24 +96,26 @@ export {
|
|
|
94
96
|
Fo as OverlayCloseButton,
|
|
95
97
|
Io as OverlayStepBar,
|
|
96
98
|
Mo as PageOverlay,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
No as
|
|
105
|
-
jo as
|
|
106
|
-
Jo as
|
|
107
|
-
|
|
108
|
-
Xo as
|
|
109
|
-
Zo as
|
|
110
|
-
$o as
|
|
111
|
-
rr as
|
|
112
|
-
er as
|
|
113
|
-
|
|
114
|
-
fr as
|
|
115
|
-
|
|
99
|
+
Ro as PeriodSelector,
|
|
100
|
+
Ao as Periods,
|
|
101
|
+
Do as ProgrammeCard,
|
|
102
|
+
vo as RadioButton,
|
|
103
|
+
Go as RadioGroup,
|
|
104
|
+
Eo as Repeater,
|
|
105
|
+
zo as Rte,
|
|
106
|
+
No as RteEditor,
|
|
107
|
+
jo as SectionNotification,
|
|
108
|
+
Jo as SelectListbox,
|
|
109
|
+
Qo as SelectProvider,
|
|
110
|
+
Xo as Sortable,
|
|
111
|
+
Zo as Spinner,
|
|
112
|
+
$o as StatusBadge,
|
|
113
|
+
rr as StatusPill,
|
|
114
|
+
er as TextArea,
|
|
115
|
+
xr as Timeline,
|
|
116
|
+
fr as ToggleSwitch,
|
|
117
|
+
ir as Tooltip,
|
|
118
|
+
lr as VarIndicator,
|
|
119
|
+
Uo as useSelect
|
|
116
120
|
};
|
|
117
121
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|