@indico-data/design-system 2.9.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 (54) hide show
  1. package/lib/index.css +119 -8
  2. package/lib/index.d.ts +52 -8
  3. package/lib/index.esm.css +119 -8
  4. package/lib/index.esm.js +35 -19
  5. package/lib/index.esm.js.map +1 -1
  6. package/lib/index.js +36 -18
  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 +5 -4
  12. package/lib/src/components/forms/passwordInput/PasswordInput.d.ts +17 -0
  13. package/lib/src/components/forms/passwordInput/PasswordInput.stories.d.ts +11 -0
  14. package/lib/src/components/forms/passwordInput/__tests__/PasswordInput.test.d.ts +1 -0
  15. package/lib/src/components/forms/passwordInput/index.d.ts +1 -0
  16. package/lib/src/components/forms/radio/Radio.d.ts +2 -1
  17. package/lib/src/components/forms/subcomponents/DisplayFormError.d.ts +5 -0
  18. package/lib/src/components/forms/textarea/Textarea.d.ts +4 -3
  19. package/lib/src/components/forms/toggle/Toggle.d.ts +2 -1
  20. package/lib/src/components/index.d.ts +2 -0
  21. package/lib/src/index.d.ts +2 -0
  22. package/package.json +5 -2
  23. package/src/components/forms/checkbox/Checkbox.stories.tsx +2 -2
  24. package/src/components/forms/checkbox/Checkbox.tsx +32 -41
  25. package/src/components/forms/form/Form.mdx +134 -0
  26. package/src/components/forms/form/Form.stories.tsx +413 -0
  27. package/src/components/forms/form/Form.tsx +64 -0
  28. package/src/components/forms/form/__tests__/Form.test.tsx +35 -0
  29. package/src/components/forms/form/index.ts +0 -0
  30. package/src/components/forms/form/styles/Form.scss +3 -0
  31. package/src/components/forms/input/Input.stories.tsx +0 -5
  32. package/src/components/forms/input/Input.tsx +67 -64
  33. package/src/components/forms/input/__tests__/Input.test.tsx +2 -13
  34. package/src/components/forms/input/styles/Input.scss +2 -8
  35. package/src/components/forms/passwordInput/PasswordInput.mdx +28 -0
  36. package/src/components/forms/passwordInput/PasswordInput.stories.tsx +268 -0
  37. package/src/components/forms/passwordInput/PasswordInput.tsx +86 -0
  38. package/src/components/forms/passwordInput/__tests__/PasswordInput.test.tsx +129 -0
  39. package/src/components/forms/passwordInput/index.ts +1 -0
  40. package/src/components/forms/passwordInput/styles/PasswordInput.scss +120 -0
  41. package/src/components/forms/radio/Radio.tsx +32 -35
  42. package/src/components/forms/subcomponents/DisplayFormError.tsx +7 -0
  43. package/src/components/forms/textarea/Textarea.stories.tsx +15 -21
  44. package/src/components/forms/textarea/Textarea.tsx +64 -62
  45. package/src/components/forms/textarea/__tests__/Textarea.test.tsx +1 -1
  46. package/src/components/forms/textarea/styles/Textarea.scss +1 -1
  47. package/src/components/forms/toggle/Toggle.tsx +30 -37
  48. package/src/components/index.ts +2 -0
  49. package/src/index.ts +2 -0
  50. package/src/styles/index.scss +2 -0
  51. package/lib/src/components/forms/subcomponents/ErrorList.d.ts +0 -6
  52. package/src/components/forms/subcomponents/ErrorList.tsx +0 -14
  53. package/src/components/forms/subcomponents/__tests__/ErrorList.test.tsx +0 -16
  54. /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);
@@ -956,6 +951,7 @@
956
951
  top: var(--pf-margin-3);
957
952
  right: var(--pf-margin-2);
958
953
  color: var(--pf-input-text-color);
954
+ cursor: pointer;
959
955
  }
960
956
  .form-control .is-visually-hidden {
961
957
  position: absolute;
@@ -1214,7 +1210,7 @@
1214
1210
  padding-left: var(--pf-padding-7);
1215
1211
  }
1216
1212
 
1217
- .form-control .error-list {
1213
+ .form-control .form-errors {
1218
1214
  list-style: none;
1219
1215
  padding: 0;
1220
1216
  margin: 0;
@@ -1243,6 +1239,121 @@
1243
1239
  margin-bottom: var(--pf-margin-2);
1244
1240
  }
1245
1241
 
1242
+ :root,
1243
+ :root [data-theme=light],
1244
+ :root [data-theme=dark] {
1245
+ --pf-password-input-background-color: var(--pf-white-color);
1246
+ --pf-password-input-border-color: var(--pf-gray-color);
1247
+ --pf-password-input-text-color: var(--pf-gray-color);
1248
+ --pf-password-input-placeholder-text-color: var(--pf-gray-color-300);
1249
+ --pf-password-input-help-text-color: var(--pf-gray-color-400);
1250
+ --pf-password-input-disabled-background-color: var(--pf-gray-color-100);
1251
+ --pf-password-input-border-color: var(--pf-gray-color);
1252
+ --pf-password-input-disabled-color: var(--pf-gray-color-400);
1253
+ --pf-password-input-border-color: var(--pf-gray-color);
1254
+ --pf-password-input-rounded: var(--pf-rounded);
1255
+ }
1256
+
1257
+ :root [data-theme=dark] {
1258
+ --pf-password-input-background-color: var(--pf-primary-color);
1259
+ --pf-password-input-border-color: var(--pf-gray-color-100);
1260
+ --pf-password-input-text-color: var(--pf-gray-color-100);
1261
+ --pf-password-input-placeholder-text-color: var(--pf-gray-color);
1262
+ --pf-password-input-help-text-color: var(--pf-gray-color-200);
1263
+ --pf-password-input-disabled-background-color: var(--pf-primary-color-200);
1264
+ --pf-password-input-disabled-border-color: var(--pf-gray-color-300);
1265
+ --pf-password-input-disabled-color: var(--pf-gray-color-400);
1266
+ }
1267
+
1268
+ .password-input {
1269
+ background-color: var(--pf-password-input-background-color);
1270
+ border: 1px solid var(--pf-password-input-border-color);
1271
+ border-radius: var(--pf-password-input-rounded);
1272
+ color: var(--pf-password-input-text-color);
1273
+ padding: 10px;
1274
+ width: 100%;
1275
+ box-sizing: border-box;
1276
+ height: 36px;
1277
+ }
1278
+ .password-input::-moz-placeholder {
1279
+ color: var(--pf-password-input-placeholder-text-color);
1280
+ }
1281
+ .password-input::placeholder {
1282
+ color: var(--pf-password-input-placeholder-text-color);
1283
+ }
1284
+ .password-input:focus {
1285
+ border-color: var(--pf-primary-color);
1286
+ }
1287
+ .password-input.error {
1288
+ border-color: var(--pf-error-color);
1289
+ }
1290
+ .password-input.success {
1291
+ border-color: var(--pf-success-color);
1292
+ }
1293
+ .password-input.warning {
1294
+ border-color: var(--pf-warning-color);
1295
+ }
1296
+ .password-input.info {
1297
+ border-color: var(--pf-info-color);
1298
+ }
1299
+ .password-input:disabled {
1300
+ background-color: var(--pf-password-input-disabled-background-color);
1301
+ border-color: var(--pf-password-input-disabled-border-color);
1302
+ color: var(--pf-password-input-disabled-color);
1303
+ }
1304
+ .password-input--has-icon {
1305
+ padding-left: var(--pf-padding-7);
1306
+ }
1307
+
1308
+ .form-control .error-list {
1309
+ list-style: none;
1310
+ padding: 0;
1311
+ margin: 0;
1312
+ margin-top: var(--pf-margin-2);
1313
+ margin-bottom: var(--pf-margin-2);
1314
+ color: var(--pf-error-color);
1315
+ }
1316
+ .form-control .help-text {
1317
+ margin-top: var(--pf-margin-2);
1318
+ margin-bottom: var(--pf-margin-2);
1319
+ color: var(--pf-password-input-help-text-color);
1320
+ font-size: var(--pf-font-size-subtitle2);
1321
+ }
1322
+ .form-control .password-input-wrapper {
1323
+ position: relative;
1324
+ }
1325
+ .form-control .password-input-wrapper .embedded-icon {
1326
+ position: absolute;
1327
+ top: 10px;
1328
+ left: var(--pf-margin-2);
1329
+ color: var(--pf-password-input-text-color);
1330
+ }
1331
+ .form-control .password-input-wrapper .toggle-show-password-icon {
1332
+ position: absolute;
1333
+ top: var(--pf-margin-3);
1334
+ right: var(--pf-margin-2);
1335
+ color: var(--pf-password-input-text-color);
1336
+ cursor: pointer;
1337
+ }
1338
+ .form-control .is-visually-hidden {
1339
+ position: absolute;
1340
+ width: 1px;
1341
+ height: 1px;
1342
+ padding: 0;
1343
+ margin: -1px;
1344
+ overflow: hidden;
1345
+ clip: rect(0, 0, 0, 0);
1346
+ white-space: nowrap;
1347
+ border: 0;
1348
+ }
1349
+ .form-control .form-label {
1350
+ margin-bottom: var(--pf-margin-2);
1351
+ }
1352
+
1353
+ form {
1354
+ width: 100%;
1355
+ }
1356
+
1246
1357
  :root,
1247
1358
  :root [data-theme=light],
1248
1359
  :root [data-theme=dark] {
package/lib/index.d.ts CHANGED
@@ -923,21 +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;
938
+ className?: string;
939
+ defaultValue?: string;
939
940
  }
940
- declare const Input: ({ ref, label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, iconName, hasHiddenLabel, isClearable, ...rest }: InputProps) => react_jsx_runtime.JSX.Element;
941
+ declare const Input: React$1.ForwardRefExoticComponent<InputProps & React$1.RefAttributes<HTMLInputElement>>;
941
942
 
942
943
  interface RadioProps {
943
944
  ref?: React$1.LegacyRef<HTMLInputElement>;
@@ -947,8 +948,9 @@ interface RadioProps {
947
948
  value?: string;
948
949
  onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
949
950
  isDisabled?: boolean;
951
+ defaultChecked?: boolean;
950
952
  }
951
- 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>>;
952
954
 
953
955
  interface CheckboxProps {
954
956
  ref?: React$1.LegacyRef<HTMLInputElement>;
@@ -959,8 +961,9 @@ interface CheckboxProps {
959
961
  isChecked?: boolean | undefined;
960
962
  onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
961
963
  isDisabled?: boolean;
964
+ defaultChecked?: boolean;
962
965
  }
963
- 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>>;
964
967
 
965
968
  interface ToggleProps {
966
969
  ref?: React$1.LegacyRef<HTMLInputElement>;
@@ -971,7 +974,48 @@ interface ToggleProps {
971
974
  onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
972
975
  isDisabled?: boolean;
973
976
  isChecked?: boolean;
977
+ defaultChecked?: boolean;
978
+ }
979
+ declare const Toggle: React$1.ForwardRefExoticComponent<Omit<ToggleProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
980
+
981
+ interface TextareaProps {
982
+ ref?: React$1.LegacyRef<HTMLTextAreaElement>;
983
+ label: string;
984
+ name: string;
985
+ placeholder: string;
986
+ value?: string | undefined;
987
+ onChange: (e: React$1.ChangeEvent<HTMLTextAreaElement>) => void;
988
+ isRequired?: boolean;
989
+ isDisabled?: boolean;
990
+ errorMessage?: string | undefined;
991
+ helpText?: string;
992
+ hasHiddenLabel?: boolean;
993
+ rows?: number;
994
+ cols?: number;
995
+ readonly?: boolean;
996
+ wrap?: 'hard' | 'soft';
997
+ form?: string;
998
+ maxLength?: number;
999
+ autofocus?: boolean;
1000
+ defaultValue?: string;
1001
+ }
1002
+ declare const Textarea: React$1.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
1003
+
1004
+ interface PasswordInputProps {
1005
+ ref?: React$1.LegacyRef<HTMLInputElement>;
1006
+ label: string;
1007
+ value?: string | undefined;
1008
+ name: string;
1009
+ placeholder: string;
1010
+ onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
1011
+ isRequired?: boolean;
1012
+ isDisabled?: boolean;
1013
+ errorMessage?: string | undefined;
1014
+ helpText?: string;
1015
+ hasHiddenLabel?: boolean;
1016
+ hasShowPassword?: boolean;
1017
+ defaultValue?: string;
974
1018
  }
975
- declare const Toggle: ({ ref, id, label, name, value, onChange, isDisabled, isChecked, ...rest }: ToggleProps) => react_jsx_runtime.JSX.Element;
1019
+ declare const PasswordInput: React$1.ForwardRefExoticComponent<Omit<PasswordInputProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
976
1020
 
977
- 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, 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, Toggle$1 as Toggle, Toggle as ToggleInput, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
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);
@@ -956,6 +951,7 @@
956
951
  top: var(--pf-margin-3);
957
952
  right: var(--pf-margin-2);
958
953
  color: var(--pf-input-text-color);
954
+ cursor: pointer;
959
955
  }
960
956
  .form-control .is-visually-hidden {
961
957
  position: absolute;
@@ -1214,7 +1210,7 @@
1214
1210
  padding-left: var(--pf-padding-7);
1215
1211
  }
1216
1212
 
1217
- .form-control .error-list {
1213
+ .form-control .form-errors {
1218
1214
  list-style: none;
1219
1215
  padding: 0;
1220
1216
  margin: 0;
@@ -1243,6 +1239,121 @@
1243
1239
  margin-bottom: var(--pf-margin-2);
1244
1240
  }
1245
1241
 
1242
+ :root,
1243
+ :root [data-theme=light],
1244
+ :root [data-theme=dark] {
1245
+ --pf-password-input-background-color: var(--pf-white-color);
1246
+ --pf-password-input-border-color: var(--pf-gray-color);
1247
+ --pf-password-input-text-color: var(--pf-gray-color);
1248
+ --pf-password-input-placeholder-text-color: var(--pf-gray-color-300);
1249
+ --pf-password-input-help-text-color: var(--pf-gray-color-400);
1250
+ --pf-password-input-disabled-background-color: var(--pf-gray-color-100);
1251
+ --pf-password-input-border-color: var(--pf-gray-color);
1252
+ --pf-password-input-disabled-color: var(--pf-gray-color-400);
1253
+ --pf-password-input-border-color: var(--pf-gray-color);
1254
+ --pf-password-input-rounded: var(--pf-rounded);
1255
+ }
1256
+
1257
+ :root [data-theme=dark] {
1258
+ --pf-password-input-background-color: var(--pf-primary-color);
1259
+ --pf-password-input-border-color: var(--pf-gray-color-100);
1260
+ --pf-password-input-text-color: var(--pf-gray-color-100);
1261
+ --pf-password-input-placeholder-text-color: var(--pf-gray-color);
1262
+ --pf-password-input-help-text-color: var(--pf-gray-color-200);
1263
+ --pf-password-input-disabled-background-color: var(--pf-primary-color-200);
1264
+ --pf-password-input-disabled-border-color: var(--pf-gray-color-300);
1265
+ --pf-password-input-disabled-color: var(--pf-gray-color-400);
1266
+ }
1267
+
1268
+ .password-input {
1269
+ background-color: var(--pf-password-input-background-color);
1270
+ border: 1px solid var(--pf-password-input-border-color);
1271
+ border-radius: var(--pf-password-input-rounded);
1272
+ color: var(--pf-password-input-text-color);
1273
+ padding: 10px;
1274
+ width: 100%;
1275
+ box-sizing: border-box;
1276
+ height: 36px;
1277
+ }
1278
+ .password-input::-moz-placeholder {
1279
+ color: var(--pf-password-input-placeholder-text-color);
1280
+ }
1281
+ .password-input::placeholder {
1282
+ color: var(--pf-password-input-placeholder-text-color);
1283
+ }
1284
+ .password-input:focus {
1285
+ border-color: var(--pf-primary-color);
1286
+ }
1287
+ .password-input.error {
1288
+ border-color: var(--pf-error-color);
1289
+ }
1290
+ .password-input.success {
1291
+ border-color: var(--pf-success-color);
1292
+ }
1293
+ .password-input.warning {
1294
+ border-color: var(--pf-warning-color);
1295
+ }
1296
+ .password-input.info {
1297
+ border-color: var(--pf-info-color);
1298
+ }
1299
+ .password-input:disabled {
1300
+ background-color: var(--pf-password-input-disabled-background-color);
1301
+ border-color: var(--pf-password-input-disabled-border-color);
1302
+ color: var(--pf-password-input-disabled-color);
1303
+ }
1304
+ .password-input--has-icon {
1305
+ padding-left: var(--pf-padding-7);
1306
+ }
1307
+
1308
+ .form-control .error-list {
1309
+ list-style: none;
1310
+ padding: 0;
1311
+ margin: 0;
1312
+ margin-top: var(--pf-margin-2);
1313
+ margin-bottom: var(--pf-margin-2);
1314
+ color: var(--pf-error-color);
1315
+ }
1316
+ .form-control .help-text {
1317
+ margin-top: var(--pf-margin-2);
1318
+ margin-bottom: var(--pf-margin-2);
1319
+ color: var(--pf-password-input-help-text-color);
1320
+ font-size: var(--pf-font-size-subtitle2);
1321
+ }
1322
+ .form-control .password-input-wrapper {
1323
+ position: relative;
1324
+ }
1325
+ .form-control .password-input-wrapper .embedded-icon {
1326
+ position: absolute;
1327
+ top: 10px;
1328
+ left: var(--pf-margin-2);
1329
+ color: var(--pf-password-input-text-color);
1330
+ }
1331
+ .form-control .password-input-wrapper .toggle-show-password-icon {
1332
+ position: absolute;
1333
+ top: var(--pf-margin-3);
1334
+ right: var(--pf-margin-2);
1335
+ color: var(--pf-password-input-text-color);
1336
+ cursor: pointer;
1337
+ }
1338
+ .form-control .is-visually-hidden {
1339
+ position: absolute;
1340
+ width: 1px;
1341
+ height: 1px;
1342
+ padding: 0;
1343
+ margin: -1px;
1344
+ overflow: hidden;
1345
+ clip: rect(0, 0, 0, 0);
1346
+ white-space: nowrap;
1347
+ border: 0;
1348
+ }
1349
+ .form-control .form-label {
1350
+ margin-bottom: var(--pf-margin-2);
1351
+ }
1352
+
1353
+ form {
1354
+ width: 100%;
1355
+ }
1356
+
1246
1357
  :root,
1247
1358
  :root [data-theme=light],
1248
1359
  :root [data-theme=dark] {
package/lib/index.esm.js CHANGED
@@ -18636,33 +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 } = _a, rest = __rest$1(_a, ["ref", "label", "name", "placeholder", "value", "onChange", "isRequired", "isDisabled", "errorList", "helpText", "iconName", "hasHiddenLabel", "isClearable"]);
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' : ''}`, "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
+
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
+
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
+ const [showPassword, setShowPassword] = useState(false);
18677
+ const handleShowPassword = () => {
18678
+ setShowPassword((prevShowPassword) => !prevShowPassword);
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({ 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
+ });
18666
18682
 
18667
18683
  const StyledAccordion = styled.details `
18668
18684
  summary {
@@ -41485,5 +41501,5 @@ const Tooltip = (props) => {
41485
41501
  openOnClick: props.clickToShow, id: props.for, delayShow: props.delayShow, delayHide: props.delayHide, children: props.children })] }));
41486
41502
  };
41487
41503
 
41488
- export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup$1 as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button$2 as 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, PercentageRing, Radio, RadioGroup, Radio$2 as RadioInput, RandomLoadingMessage, Row$1 as Row, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, typography as TYPOGRAPHY, Table$1 as Table, TextInput, TextTruncate, Toggle, Toggle$1 as ToggleInput, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
41504
+ export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup$1 as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button$2 as 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, RadioGroup, Radio$2 as RadioInput, RandomLoadingMessage, Row$1 as Row, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, typography as TYPOGRAPHY, Table$1 as Table, TextInput, TextTruncate, Textarea, Toggle, Toggle$1 as ToggleInput, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
41489
41505
  //# sourceMappingURL=index.esm.js.map