@indico-data/design-system 2.10.0 → 2.11.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.
Files changed (43) hide show
  1. package/lib/index.css +7 -8
  2. package/lib/index.d.ts +18 -13
  3. package/lib/index.esm.css +7 -8
  4. package/lib/index.esm.js +28 -28
  5. package/lib/index.esm.js.map +1 -1
  6. package/lib/index.js +28 -28
  7. package/lib/index.js.map +1 -1
  8. package/lib/src/components/forms/checkbox/Checkbox.d.ts +2 -1
  9. package/lib/src/components/forms/form/Form.d.ts +14 -0
  10. package/lib/src/components/forms/form/Form.stories.d.ts +8 -0
  11. package/lib/src/components/forms/input/Input.d.ts +4 -4
  12. package/lib/src/components/forms/passwordInput/PasswordInput.d.ts +4 -3
  13. package/lib/src/components/forms/radio/Radio.d.ts +2 -1
  14. package/lib/src/components/forms/subcomponents/DisplayFormError.d.ts +5 -0
  15. package/lib/src/components/forms/textarea/Textarea.d.ts +4 -3
  16. package/lib/src/components/forms/toggle/Toggle.d.ts +2 -1
  17. package/package.json +5 -2
  18. package/src/components/forms/checkbox/Checkbox.stories.tsx +2 -2
  19. package/src/components/forms/checkbox/Checkbox.tsx +32 -41
  20. package/src/components/forms/form/Form.mdx +134 -0
  21. package/src/components/forms/form/Form.stories.tsx +413 -0
  22. package/src/components/forms/form/Form.tsx +64 -0
  23. package/src/components/forms/form/__tests__/Form.test.tsx +35 -0
  24. package/src/components/forms/form/index.ts +0 -0
  25. package/src/components/forms/form/styles/Form.scss +3 -0
  26. package/src/components/forms/input/Input.tsx +66 -65
  27. package/src/components/forms/input/__tests__/Input.test.tsx +2 -13
  28. package/src/components/forms/input/styles/Input.scss +1 -8
  29. package/src/components/forms/passwordInput/PasswordInput.stories.tsx +11 -12
  30. package/src/components/forms/passwordInput/PasswordInput.tsx +63 -59
  31. package/src/components/forms/passwordInput/__tests__/PasswordInput.test.tsx +1 -1
  32. package/src/components/forms/radio/Radio.tsx +32 -35
  33. package/src/components/forms/subcomponents/DisplayFormError.tsx +7 -0
  34. package/src/components/forms/textarea/Textarea.stories.tsx +15 -21
  35. package/src/components/forms/textarea/Textarea.tsx +64 -62
  36. package/src/components/forms/textarea/__tests__/Textarea.test.tsx +1 -1
  37. package/src/components/forms/textarea/styles/Textarea.scss +1 -1
  38. package/src/components/forms/toggle/Toggle.tsx +30 -37
  39. package/src/styles/index.scss +1 -0
  40. package/lib/src/components/forms/subcomponents/ErrorList.d.ts +0 -6
  41. package/src/components/forms/subcomponents/ErrorList.tsx +0 -14
  42. package/src/components/forms/subcomponents/__tests__/ErrorList.test.tsx +0 -16
  43. /package/lib/src/components/forms/{subcomponents/__tests__/ErrorList.test.d.ts → form/__tests__/Form.test.d.ts} +0 -0
package/lib/index.css CHANGED
@@ -928,13 +928,8 @@
928
928
  padding-left: var(--pf-padding-7);
929
929
  }
930
930
 
931
- .form-control .error-list {
932
- list-style: none;
933
- padding: 0;
934
- margin: 0;
935
- margin-top: var(--pf-margin-2);
936
- margin-bottom: var(--pf-margin-2);
937
- color: var(--pf-error-color);
931
+ .form-control {
932
+ margin-bottom: var(--pf-margin-3);
938
933
  }
939
934
  .form-control .help-text {
940
935
  margin-top: var(--pf-margin-2);
@@ -1215,7 +1210,7 @@
1215
1210
  padding-left: var(--pf-padding-7);
1216
1211
  }
1217
1212
 
1218
- .form-control .error-list {
1213
+ .form-control .form-errors {
1219
1214
  list-style: none;
1220
1215
  padding: 0;
1221
1216
  margin: 0;
@@ -1355,6 +1350,10 @@
1355
1350
  margin-bottom: var(--pf-margin-2);
1356
1351
  }
1357
1352
 
1353
+ form {
1354
+ width: 100%;
1355
+ }
1356
+
1358
1357
  :root,
1359
1358
  :root [data-theme=light],
1360
1359
  :root [data-theme=dark] {
package/lib/index.d.ts CHANGED
@@ -923,22 +923,22 @@ type TableProps<T> = Omit<TableProps$1<T>, 'disabled' | 'progressPending' | 'dir
923
923
  declare const Table: <T>(props: TableProps<T>) => react_jsx_runtime.JSX.Element;
924
924
 
925
925
  interface InputProps {
926
- ref?: React$1.LegacyRef<HTMLInputElement>;
927
926
  label: string;
928
927
  name: string;
928
+ value?: string | undefined;
929
929
  placeholder: string;
930
- value: string;
931
930
  onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
932
931
  isRequired?: boolean;
933
932
  isDisabled?: boolean;
934
- errorList?: string[];
933
+ errorMessage?: string | undefined;
935
934
  helpText?: string;
936
935
  hasHiddenLabel?: boolean;
937
936
  iconName?: IconName$1;
938
937
  isClearable?: boolean;
939
938
  className?: string;
939
+ defaultValue?: string;
940
940
  }
941
- declare const Input: ({ ref, label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, iconName, hasHiddenLabel, isClearable, className, ...rest }: InputProps) => react_jsx_runtime.JSX.Element;
941
+ declare const Input: React$1.ForwardRefExoticComponent<InputProps & React$1.RefAttributes<HTMLInputElement>>;
942
942
 
943
943
  interface RadioProps {
944
944
  ref?: React$1.LegacyRef<HTMLInputElement>;
@@ -948,8 +948,9 @@ interface RadioProps {
948
948
  value?: string;
949
949
  onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
950
950
  isDisabled?: boolean;
951
+ defaultChecked?: boolean;
951
952
  }
952
- declare const Radio: ({ ref, id, label, name, value, onChange, isDisabled, ...rest }: RadioProps) => react_jsx_runtime.JSX.Element;
953
+ declare const Radio: React$1.ForwardRefExoticComponent<Omit<RadioProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
953
954
 
954
955
  interface CheckboxProps {
955
956
  ref?: React$1.LegacyRef<HTMLInputElement>;
@@ -960,8 +961,9 @@ interface CheckboxProps {
960
961
  isChecked?: boolean | undefined;
961
962
  onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
962
963
  isDisabled?: boolean;
964
+ defaultChecked?: boolean;
963
965
  }
964
- declare const Checkbox: ({ ref, id, label, name, value, onChange, isDisabled, isChecked, ...rest }: CheckboxProps) => react_jsx_runtime.JSX.Element;
966
+ declare const Checkbox: React$1.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
965
967
 
966
968
  interface ToggleProps {
967
969
  ref?: React$1.LegacyRef<HTMLInputElement>;
@@ -972,19 +974,20 @@ interface ToggleProps {
972
974
  onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
973
975
  isDisabled?: boolean;
974
976
  isChecked?: boolean;
977
+ defaultChecked?: boolean;
975
978
  }
976
- declare const Toggle: ({ ref, id, label, name, value, onChange, isDisabled, isChecked, ...rest }: ToggleProps) => react_jsx_runtime.JSX.Element;
979
+ declare const Toggle: React$1.ForwardRefExoticComponent<Omit<ToggleProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
977
980
 
978
981
  interface TextareaProps {
979
982
  ref?: React$1.LegacyRef<HTMLTextAreaElement>;
980
983
  label: string;
981
984
  name: string;
982
985
  placeholder: string;
983
- value: string;
986
+ value?: string | undefined;
984
987
  onChange: (e: React$1.ChangeEvent<HTMLTextAreaElement>) => void;
985
988
  isRequired?: boolean;
986
989
  isDisabled?: boolean;
987
- errorList?: string[];
990
+ errorMessage?: string | undefined;
988
991
  helpText?: string;
989
992
  hasHiddenLabel?: boolean;
990
993
  rows?: number;
@@ -994,23 +997,25 @@ interface TextareaProps {
994
997
  form?: string;
995
998
  maxLength?: number;
996
999
  autofocus?: boolean;
1000
+ defaultValue?: string;
997
1001
  }
998
- declare const Textarea: ({ ref, label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, hasHiddenLabel, rows, cols, readonly, wrap, form, maxLength, autofocus, ...rest }: TextareaProps) => react_jsx_runtime.JSX.Element;
1002
+ declare const Textarea: React$1.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
999
1003
 
1000
1004
  interface PasswordInputProps {
1001
1005
  ref?: React$1.LegacyRef<HTMLInputElement>;
1002
1006
  label: string;
1007
+ value?: string | undefined;
1003
1008
  name: string;
1004
1009
  placeholder: string;
1005
- value: string;
1006
1010
  onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
1007
1011
  isRequired?: boolean;
1008
1012
  isDisabled?: boolean;
1009
- errorList?: string[];
1013
+ errorMessage?: string | undefined;
1010
1014
  helpText?: string;
1011
1015
  hasHiddenLabel?: boolean;
1012
1016
  hasShowPassword?: boolean;
1017
+ defaultValue?: string;
1013
1018
  }
1014
- declare const PasswordInput: ({ label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, hasHiddenLabel, hasShowPassword, ...rest }: PasswordInputProps) => react_jsx_runtime.JSX.Element;
1019
+ declare const PasswordInput: React$1.ForwardRefExoticComponent<Omit<PasswordInputProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
1015
1020
 
1016
1021
  export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button, allColors as COLORS, Checkbox, CirclePulse, CircleSpinner, Col, ConfirmModal, Container, DatePicker, EditableInput, GlobalStyles, Icon, IconButton, Input, Button$1 as LegacyButton, ListTable, LoadingAwareContainer, LoadingList, margin as MARGINS, MATH, mediaQueries as MEDIA_QUERIES, ModalBase, MultiCombobox, NoInputDatePicker, NumberInput, padding as PADDINGS, Pagination, PasswordInput, PercentageRing, Radio$2 as Radio, RadioGroup$1 as RadioGroup, Radio as RadioInput, RandomLoadingMessage, Row, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, typography as TYPOGRAPHY, Table, TextInput, TextTruncate, Textarea, Toggle$1 as Toggle, Toggle as ToggleInput, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
package/lib/index.esm.css CHANGED
@@ -928,13 +928,8 @@
928
928
  padding-left: var(--pf-padding-7);
929
929
  }
930
930
 
931
- .form-control .error-list {
932
- list-style: none;
933
- padding: 0;
934
- margin: 0;
935
- margin-top: var(--pf-margin-2);
936
- margin-bottom: var(--pf-margin-2);
937
- color: var(--pf-error-color);
931
+ .form-control {
932
+ margin-bottom: var(--pf-margin-3);
938
933
  }
939
934
  .form-control .help-text {
940
935
  margin-top: var(--pf-margin-2);
@@ -1215,7 +1210,7 @@
1215
1210
  padding-left: var(--pf-padding-7);
1216
1211
  }
1217
1212
 
1218
- .form-control .error-list {
1213
+ .form-control .form-errors {
1219
1214
  list-style: none;
1220
1215
  padding: 0;
1221
1216
  margin: 0;
@@ -1355,6 +1350,10 @@
1355
1350
  margin-bottom: var(--pf-margin-2);
1356
1351
  }
1357
1352
 
1353
+ form {
1354
+ width: 100%;
1355
+ }
1356
+
1358
1357
  :root,
1359
1358
  :root [data-theme=light],
1360
1359
  :root [data-theme=dark] {
package/lib/index.esm.js CHANGED
@@ -18636,49 +18636,49 @@ const Label = ({ label, name, isRequired, hasHiddenLabel }) => {
18636
18636
  return (jsx("div", { "data-testid": `${name}-testId`, className: `form-label ${hasHiddenLabel ? 'is-visually-hidden' : ''}`, children: jsxs("label", { htmlFor: `${name}`, children: [label, isRequired ? jsx("span", { className: "text-error", children: " *" }) : ''] }) }));
18637
18637
  };
18638
18638
 
18639
- const ErrorList = ({ errorList, name }) => {
18640
- return (jsx("ul", { className: "error-list", id: `${name}-helper`, children: (errorList !== null && errorList !== void 0 ? errorList : []).map((error, index) => (jsx("li", { children: error }, index))) }));
18639
+ const DisplayFormError = ({ message }) => {
18640
+ return jsx("p", { className: "form-errors", children: message });
18641
18641
  };
18642
18642
 
18643
- const Input = (_a) => {
18644
- var { ref, label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, iconName, hasHiddenLabel, isClearable, className = '' } = _a, rest = __rest$1(_a, ["ref", "label", "name", "placeholder", "value", "onChange", "isRequired", "isDisabled", "errorList", "helpText", "iconName", "hasHiddenLabel", "isClearable", "className"]);
18645
- const hasErrors = errorList && errorList.length > 0;
18643
+ const Input = e__default.forwardRef((_a, ref) => {
18644
+ var { label, name, placeholder, onChange, isRequired, isDisabled, isClearable, errorMessage, helpText, iconName, hasHiddenLabel, className } = _a, rest = __rest$1(_a, ["label", "name", "placeholder", "onChange", "isRequired", "isDisabled", "isClearable", "errorMessage", "helpText", "iconName", "hasHiddenLabel", "className"]);
18645
+ const hasErrors = errorMessage && errorMessage.length > 0;
18646
18646
  const handleClear = () => {
18647
18647
  onChange({ target: { value: '' } });
18648
18648
  };
18649
- return (jsxs("div", { className: "form-control", children: [jsx(Label, { label: label, name: name, isRequired: isRequired, hasHiddenLabel: hasHiddenLabel }), jsxs("div", { className: "input-wrapper", children: [iconName && (jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsx("input", Object.assign({ ref: ref, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, required: isRequired, placeholder: placeholder, value: value, onChange: onChange, className: `input ${hasErrors ? 'error' : ''} ${iconName ? 'input--has-icon' : ''} ${className}`, "aria-invalid": hasErrors, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, "aria-label": label }, rest)), isClearable && (jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsx(ErrorList, { errorList: errorList, name: name }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
18650
- };
18649
+ return (jsxs("div", { className: "form-control", children: [jsx(Label, { label: label, name: name, isRequired: isRequired, hasHiddenLabel: hasHiddenLabel }), jsxs("div", { className: "input-wrapper", children: [iconName && (jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsx("input", Object.assign({ ref: ref, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, onChange: onChange, className: `input ${hasErrors ? 'error' : ''} ${iconName ? 'input--has-icon' : ''} ${className}`, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, "aria-label": label }, rest)), isClearable && (jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
18650
+ });
18651
18651
 
18652
- const Radio$2 = (_a) => {
18653
- var { ref, id, label, name, value, onChange, isDisabled } = _a, rest = __rest$1(_a, ["ref", "id", "label", "name", "value", "onChange", "isDisabled"]);
18654
- return (jsx("div", { className: "form-control", children: jsxs("div", { className: "radio-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-radio-input-${name}` }, rest, { className: "radio-input", type: "radio", id: id, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label })), jsx("label", { htmlFor: id, className: "radio-input-label", "data-testid": `label-radio-input-${name}`, children: label })] }) }));
18655
- };
18652
+ const Radio$2 = e__default.forwardRef((_a, ref) => {
18653
+ var { id, label, name, value, onChange, isDisabled } = _a, rest = __rest$1(_a, ["id", "label", "name", "value", "onChange", "isDisabled"]);
18654
+ return (jsx("div", { className: "form-control", children: jsxs("div", { className: "radio-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-radio-input-${name}`, className: "radio-input", type: "radio", id: id, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsx("label", { htmlFor: id, className: "radio-input-label", "data-testid": `label-radio-input-${name}`, children: label })] }) }));
18655
+ });
18656
18656
 
18657
- const Checkbox = (_a) => {
18658
- var { ref, id, label, name, value, onChange, isDisabled, isChecked = false } = _a, rest = __rest$1(_a, ["ref", "id", "label", "name", "value", "onChange", "isDisabled", "isChecked"]);
18659
- return (jsx("div", { className: "form-control", children: jsxs("div", { className: "checkbox-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-checkbox-input-${name}`, className: "checkbox-input", type: "checkbox", id: id, checked: isChecked, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsx("label", { htmlFor: id, className: "checkbox-input-label", "data-testid": `label-checkbox-input-${name}`, children: label })] }) }));
18660
- };
18657
+ const Checkbox = e__default.forwardRef((_a, ref) => {
18658
+ var { id, label, name, value, onChange, isDisabled, isChecked = false } = _a, rest = __rest$1(_a, ["id", "label", "name", "value", "onChange", "isDisabled", "isChecked"]);
18659
+ return (jsx("div", { className: "form-control", children: jsxs("div", { className: "checkbox-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-checkbox-input-${name}`, className: "checkbox-input", type: "checkbox", id: id, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsx("label", { htmlFor: id, className: "checkbox-input-label", "data-testid": `label-checkbox-input-${name}`, children: label })] }) }));
18660
+ });
18661
18661
 
18662
- const Toggle$1 = (_a) => {
18663
- var { ref, id, label, name, value, onChange, isDisabled, isChecked } = _a, rest = __rest$1(_a, ["ref", "id", "label", "name", "value", "onChange", "isDisabled", "isChecked"]);
18662
+ const Toggle$1 = e__default.forwardRef((_a, ref) => {
18663
+ var { id, label, name, value, onChange, isDisabled, isChecked } = _a, rest = __rest$1(_a, ["id", "label", "name", "value", "onChange", "isDisabled", "isChecked"]);
18664
18664
  return (jsx("div", { className: "form-control", children: jsxs("div", { className: "toggle-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-toggle-input-${name}`, className: "toggle-input", type: "checkbox", id: id, checked: isChecked, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsx("label", { htmlFor: id, className: "switch" }), jsx("label", { className: 'toggle-label', htmlFor: id, children: label })] }) }));
18665
- };
18665
+ });
18666
18666
 
18667
- const Textarea = (_a) => {
18668
- var { ref, label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, hasHiddenLabel, rows, cols, readonly, wrap, form, maxLength, autofocus } = _a, rest = __rest$1(_a, ["ref", "label", "name", "placeholder", "value", "onChange", "isRequired", "isDisabled", "errorList", "helpText", "hasHiddenLabel", "rows", "cols", "readonly", "wrap", "form", "maxLength", "autofocus"]);
18669
- const hasErrors = errorList && errorList.length > 0;
18670
- return (jsxs("div", { className: "form-control", children: [jsx(Label, { label: label, name: name, isRequired: isRequired, hasHiddenLabel: hasHiddenLabel }), jsx("div", { className: "textarea-wrapper", children: jsx("textarea", Object.assign({ ref: ref, rows: rows, cols: cols, autoFocus: autofocus, wrap: wrap, form: form, value: value, maxLength: maxLength, readOnly: readonly, "data-testid": `form-textarea-${name}`, name: name, disabled: isDisabled, required: isRequired, placeholder: placeholder, onChange: onChange, className: `textarea ${hasErrors ? 'error' : ''}`, "aria-invalid": hasErrors, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, "aria-label": label }, rest)) }), hasErrors && jsx(ErrorList, { errorList: errorList, name: name }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
18671
- };
18667
+ const Textarea = e__default.forwardRef((_a, ref) => {
18668
+ var { label, name, placeholder, value, onChange, isRequired, isDisabled, errorMessage, helpText, hasHiddenLabel, rows, cols, readonly, wrap, form, maxLength, autofocus } = _a, rest = __rest$1(_a, ["label", "name", "placeholder", "value", "onChange", "isRequired", "isDisabled", "errorMessage", "helpText", "hasHiddenLabel", "rows", "cols", "readonly", "wrap", "form", "maxLength", "autofocus"]);
18669
+ const hasErrors = errorMessage && errorMessage.length > 0;
18670
+ return (jsxs("div", { className: "form-control", children: [jsx(Label, { label: label, name: name, isRequired: isRequired, hasHiddenLabel: hasHiddenLabel }), jsx("div", { className: "textarea-wrapper", children: jsx("textarea", Object.assign({ ref: ref, rows: rows, cols: cols, autoFocus: autofocus, wrap: wrap, form: form, maxLength: maxLength, readOnly: readonly, "data-testid": `form-textarea-${name}`, name: name, disabled: isDisabled, placeholder: placeholder, onChange: onChange, className: `textarea ${hasErrors ? 'error' : ''}`, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, "aria-label": label }, rest)) }), hasErrors && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
18671
+ });
18672
18672
 
18673
- const PasswordInput = (_a) => {
18674
- var { label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, hasHiddenLabel, hasShowPassword = true } = _a, rest = __rest$1(_a, ["label", "name", "placeholder", "value", "onChange", "isRequired", "isDisabled", "errorList", "helpText", "hasHiddenLabel", "hasShowPassword"]);
18675
- const hasErrors = errorList && errorList.length > 0;
18673
+ const PasswordInput = e__default.forwardRef((_a, ref) => {
18674
+ var { label, name, placeholder, onChange, isRequired, isDisabled, errorMessage, helpText, hasHiddenLabel, hasShowPassword = true } = _a, rest = __rest$1(_a, ["label", "name", "placeholder", "onChange", "isRequired", "isDisabled", "errorMessage", "helpText", "hasHiddenLabel", "hasShowPassword"]);
18675
+ const hasErrors = errorMessage && errorMessage.length > 0;
18676
18676
  const [showPassword, setShowPassword] = useState(false);
18677
18677
  const handleShowPassword = () => {
18678
18678
  setShowPassword((prevShowPassword) => !prevShowPassword);
18679
18679
  };
18680
- return (jsxs("div", { className: "form-control", children: [jsx(Label, { label: label, name: name, isRequired: isRequired, hasHiddenLabel: hasHiddenLabel }), jsxs("div", { className: "password-input-wrapper", children: [jsx(Icon, { name: "lock", "data-testid": `${name}-embedded-icon`, className: "embedded-icon" }), jsx("input", Object.assign({ "data-testid": `form-password-input-${name}`, name: name, type: showPassword ? 'text' : 'password', disabled: isDisabled, required: isRequired, placeholder: placeholder, value: value, onChange: onChange, className: `password-input ${hasErrors ? 'error' : ''} password-input--has-icon`, "aria-invalid": hasErrors, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, "aria-label": label }, rest)), hasShowPassword && (jsx(Icon, { name: showPassword ? 'fa-eye-slash' : 'eye', "data-testid": `${name}-${showPassword ? 'hide' : 'show'}-password-icon`, size: "md", onClick: handleShowPassword, className: "toggle-show-password-icon" }))] }), hasErrors && jsx(ErrorList, { errorList: errorList, name: name }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
18681
- };
18680
+ return (jsxs("div", { className: "form-control", children: [jsx(Label, { label: label, name: name, isRequired: isRequired, hasHiddenLabel: hasHiddenLabel }), jsxs("div", { className: "password-input-wrapper", children: [jsx(Icon, { name: "lock", "data-testid": `${name}-embedded-icon`, className: "embedded-icon" }), jsx("input", Object.assign({ ref: ref, "data-testid": `form-password-input-${name}`, name: name, type: showPassword ? 'text' : 'password', disabled: isDisabled, placeholder: placeholder, onChange: onChange, className: `password-input ${hasErrors ? 'error' : ''} password-input--has-icon`, "aria-invalid": hasErrors ? 'true' : 'false', "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, "aria-label": label }, rest)), hasShowPassword && (jsx(Icon, { name: showPassword ? 'fa-eye-slash' : 'eye', "data-testid": `${name}-${showPassword ? 'hide' : 'show'}-password-icon`, size: "md", onClick: handleShowPassword, className: "toggle-show-password-icon" }))] }), hasErrors && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
18681
+ });
18682
18682
 
18683
18683
  const StyledAccordion = styled.details `
18684
18684
  summary {