@indico-data/design-system 2.4.2 → 2.6.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 (44) hide show
  1. package/.storybook/preview.ts +4 -14
  2. package/lib/index.css +208 -0
  3. package/lib/index.d.ts +31 -3
  4. package/lib/index.esm.css +208 -0
  5. package/lib/index.esm.js +23 -1
  6. package/lib/index.esm.js.map +1 -1
  7. package/lib/index.js +24 -0
  8. package/lib/index.js.map +1 -1
  9. package/lib/src/components/forms/input/Input.d.ts +18 -0
  10. package/lib/src/components/forms/input/Input.stories.d.ts +12 -0
  11. package/lib/src/components/forms/input/__tests__/Input.test.d.ts +1 -0
  12. package/lib/src/components/forms/input/index.d.ts +1 -0
  13. package/lib/src/components/forms/radio/Radio.d.ts +11 -0
  14. package/lib/src/components/forms/radio/Radio.stories.d.ts +6 -0
  15. package/lib/src/components/forms/radio/__tests__/Radio.test.d.ts +1 -0
  16. package/lib/src/components/forms/radio/index.d.ts +1 -0
  17. package/lib/src/components/forms/subcomponents/ErrorList.d.ts +6 -0
  18. package/lib/src/components/forms/subcomponents/Label.d.ts +8 -0
  19. package/lib/src/components/forms/subcomponents/__tests__/ErrorList.test.d.ts +1 -0
  20. package/lib/src/components/forms/subcomponents/__tests__/Label.test.d.ts +1 -0
  21. package/lib/src/components/index.d.ts +2 -0
  22. package/lib/src/index.d.ts +2 -0
  23. package/package.json +1 -1
  24. package/src/components/forms/input/Input.mdx +19 -0
  25. package/src/components/forms/input/Input.stories.tsx +301 -0
  26. package/src/components/forms/input/Input.tsx +86 -0
  27. package/src/components/forms/input/__tests__/Input.test.tsx +213 -0
  28. package/src/components/forms/input/index.ts +1 -0
  29. package/src/components/forms/input/styles/Input.scss +112 -0
  30. package/src/components/forms/radio/Radio.mdx +83 -0
  31. package/src/components/forms/radio/Radio.stories.tsx +121 -0
  32. package/src/components/forms/radio/Radio.tsx +47 -0
  33. package/src/components/forms/radio/__tests__/Radio.test.tsx +35 -0
  34. package/src/components/forms/radio/index.ts +1 -0
  35. package/src/components/forms/radio/styles/Radio.scss +98 -0
  36. package/src/components/forms/subcomponents/ErrorList.tsx +14 -0
  37. package/src/components/forms/subcomponents/Label.tsx +20 -0
  38. package/src/components/forms/subcomponents/__tests__/ErrorList.test.tsx +16 -0
  39. package/src/components/forms/subcomponents/__tests__/Label.test.tsx +33 -0
  40. package/src/components/index.ts +2 -0
  41. package/src/index.ts +2 -0
  42. package/src/styles/_typography.scss +29 -11
  43. package/src/styles/index.scss +2 -0
  44. package/src/styles/storybook.scss +15 -0
@@ -1,26 +1,14 @@
1
1
  import type { Preview, ReactRenderer } from '@storybook/react';
2
2
  import { withThemeByDataAttribute } from '@storybook/addon-themes';
3
- // import { withThemeFromJSXProvider } from '@storybook/addon-themes';
4
- // import { GlobalStyles } from '../src/legacy/styles/globals'; // TODO -- replace
5
3
  import '@/styles/index.scss';
6
-
7
- // export const decorators = [
8
- // withThemeFromJSXProvider({
9
- // GlobalStyles, // Adds your GlobalStyle component to all stories
10
- // }),
11
- // ];
4
+ import '@/styles/storybook.scss';
12
5
 
13
6
  import React from 'react';
14
7
 
15
8
  const preview: Preview = {
16
9
  decorators: [
17
10
  (Story: React.ComponentType) =>
18
- React.createElement(
19
- 'div',
20
- { style: { padding: '1em' } },
21
- // 👇 Decorators in Storybook also accept a function. Replace <Story/> with Story() to enable it
22
- React.createElement(Story),
23
- ),
11
+ React.createElement('div', { style: { padding: '1em' } }, React.createElement(Story)),
24
12
  withThemeByDataAttribute({
25
13
  themes: {
26
14
  light: 'light',
@@ -30,6 +18,8 @@ const preview: Preview = {
30
18
  attributeName: 'data-theme',
31
19
  parentSelector: 'body',
32
20
  }),
21
+ (Story: React.ComponentType) =>
22
+ React.createElement('div', { className: 'sb__story' }, React.createElement(Story)),
33
23
  ],
34
24
  parameters: {
35
25
  backgrounds: { disable: true },
package/lib/index.css CHANGED
@@ -862,6 +862,198 @@
862
862
  fill: var(--pf-gray-color-300);
863
863
  }
864
864
 
865
+ :root,
866
+ :root [data-theme=light],
867
+ :root [data-theme=dark] {
868
+ --pf-input-background-color: var(--pf-white-color);
869
+ --pf-input-border-color: var(--pf-gray-color);
870
+ --pf-input-text-color: var(--pf-gray-color);
871
+ --pf-input-placeholder-text-color: var(--pf-gray-color-300);
872
+ --pf-input-help-text-color: var(--pf-gray-color-400);
873
+ --pf-input-rounded: var(--pf-rounded);
874
+ }
875
+
876
+ :root [data-theme=dark] {
877
+ --pf-input-background-color: var(--pf-primary-color);
878
+ --pf-input-border-color: var(--pf-gray-color-100);
879
+ --pf-input-text-color: var(--pf-gray-color-100);
880
+ --pf-input-placeholder-text-color: var(--pf-gray-color);
881
+ --pf-input-help-text-color: var(--pf-gray-color-200);
882
+ }
883
+
884
+ .input {
885
+ background-color: var(--pf-input-background-color);
886
+ border: 1px solid var(--pf-input-border-color);
887
+ border-radius: var(--pf-input-rounded);
888
+ color: var(--pf-input-text-color);
889
+ padding: 10px;
890
+ width: 100%;
891
+ box-sizing: border-box;
892
+ height: 36px;
893
+ }
894
+ .input::-moz-placeholder {
895
+ color: var(--pf-input-placeholder-text-color);
896
+ }
897
+ .input::placeholder {
898
+ color: var(--pf-input-placeholder-text-color);
899
+ }
900
+ .input:focus {
901
+ border-color: var(--pf-primary-color);
902
+ }
903
+ .input.error {
904
+ border-color: var(--pf-error-color);
905
+ }
906
+ .input.success {
907
+ border-color: var(--pf-success-color);
908
+ }
909
+ .input.warning {
910
+ border-color: var(--pf-warning-color);
911
+ }
912
+ .input.info {
913
+ border-color: var(--pf-info-color);
914
+ }
915
+ .input:disabled {
916
+ background-color: var(--pf-gray-color-100);
917
+ border-color: var(--pf-gray-color-300);
918
+ color: var(--pf-gray-color-400);
919
+ }
920
+ .input--has-icon {
921
+ padding-left: var(--pf-padding-7);
922
+ }
923
+
924
+ .form-control .error-list {
925
+ list-style: none;
926
+ padding: 0;
927
+ margin: 0;
928
+ margin-top: var(--pf-margin-2);
929
+ margin-bottom: var(--pf-margin-2);
930
+ color: var(--pf-error-color);
931
+ }
932
+ .form-control .help-text {
933
+ margin-top: var(--pf-margin-2);
934
+ margin-bottom: var(--pf-margin-2);
935
+ color: var(--pf-input-help-text-color);
936
+ font-size: var(--pf-font-size-subtitle2);
937
+ }
938
+ .form-control .input-wrapper {
939
+ position: relative;
940
+ }
941
+ .form-control .input-wrapper .embedded-icon {
942
+ position: absolute;
943
+ top: 10px;
944
+ left: var(--pf-margin-2);
945
+ color: var(--pf-input-text-color);
946
+ }
947
+ .form-control .input-wrapper .clearable-icon {
948
+ position: absolute;
949
+ top: var(--pf-margin-3);
950
+ right: var(--pf-margin-2);
951
+ color: var(--pf-input-text-color);
952
+ }
953
+ .form-control .is-visually-hidden {
954
+ position: absolute;
955
+ width: 1px;
956
+ height: 1px;
957
+ padding: 0;
958
+ margin: -1px;
959
+ overflow: hidden;
960
+ clip: rect(0, 0, 0, 0);
961
+ white-space: nowrap;
962
+ border: 0;
963
+ }
964
+ .form-control .form-label {
965
+ margin-bottom: var(--pf-margin-2);
966
+ }
967
+
968
+ :root,
969
+ :root [data-theme=light],
970
+ :root [data-theme=dark] {
971
+ --pf-radio-background-color: var(--pf-white-color);
972
+ --pf-radio-check-color: var(--pf-primary-color);
973
+ --pf-radio-border-color: var(--pf-gray-color);
974
+ --pf-radio-disabled-color: var(--pf-gray-color-400);
975
+ }
976
+
977
+ :root [data-theme=dark] {
978
+ --pf-radio-background-color: transparent;
979
+ --pf-radio-check-color: var(--pf-white-color);
980
+ --pf-radio-border-color: var(--pf-white-color);
981
+ --pf-radio-disabled-color: var(--pf-gray-color-300);
982
+ }
983
+
984
+ .form-control .radio-wrapper {
985
+ display: flex;
986
+ margin-bottom: var(--pf-margin-2);
987
+ align-items: center;
988
+ }
989
+ .form-control .radio-input {
990
+ margin: 0;
991
+ margin-right: var(--pf-margin-2);
992
+ cursor: pointer;
993
+ }
994
+ .form-control .radio-input-label {
995
+ cursor: pointer;
996
+ }
997
+ .form-control [type=radio]:checked,
998
+ .form-control [type=radio]:not(:checked) {
999
+ position: absolute;
1000
+ left: -9999px;
1001
+ }
1002
+ .form-control [type=radio]:checked + label,
1003
+ .form-control [type=radio]:not(:checked) + label {
1004
+ position: relative;
1005
+ padding-left: var(--pf-padding-7);
1006
+ cursor: pointer;
1007
+ line-height: 20px;
1008
+ display: inline-block;
1009
+ }
1010
+ .form-control [type=radio]:checked + label:before,
1011
+ .form-control [type=radio]:not(:checked) + label:before {
1012
+ content: "";
1013
+ position: absolute;
1014
+ left: 0;
1015
+ top: 0;
1016
+ width: 18px;
1017
+ height: 18px;
1018
+ border: 1px solid var(--pf-radio-border-color);
1019
+ border-radius: 100%;
1020
+ background: var(--pf-radio-background-color);
1021
+ }
1022
+ .form-control [type=radio]:checked + label:after,
1023
+ .form-control [type=radio]:not(:checked) + label:after {
1024
+ content: "";
1025
+ width: 12px;
1026
+ height: 12px;
1027
+ background: var(--pf-radio-check-color);
1028
+ position: absolute;
1029
+ top: 4px;
1030
+ left: 4px;
1031
+ border-radius: 100%;
1032
+ transition: all 0.2s ease;
1033
+ }
1034
+ .form-control [type=radio]:not(:checked) + label:after {
1035
+ opacity: 0;
1036
+ transform: scale(0);
1037
+ }
1038
+ .form-control [type=radio]:checked + label:after {
1039
+ opacity: 1;
1040
+ transform: scale(1);
1041
+ }
1042
+ .form-control [type=radio]:disabled,
1043
+ .form-control [type=radio]:disabled + label {
1044
+ cursor: not-allowed;
1045
+ }
1046
+ .form-control [type=radio]:disabled + label {
1047
+ color: var(--pf-radio-disabled-color);
1048
+ opacity: 0.5;
1049
+ }
1050
+ .form-control [type=radio]:disabled + label:before {
1051
+ border-color: var(--pf-radio-disabled-color);
1052
+ }
1053
+ .form-control [type=radio]:disabled + label:after {
1054
+ background: var(--pf-radio-disabled-color);
1055
+ }
1056
+
865
1057
  :root {
866
1058
  --pf-font-family-base: "Mulish", sans-serif;
867
1059
  --pf-font-size-base: 1rem;
@@ -1119,6 +1311,22 @@ p,
1119
1311
  overflow-wrap: break-word;
1120
1312
  }
1121
1313
 
1314
+ .text-error {
1315
+ color: var(--pf-error-color);
1316
+ }
1317
+
1318
+ .text-warning {
1319
+ color: var(--pf-warning-color);
1320
+ }
1321
+
1322
+ .text-success {
1323
+ color: var(--pf-success-color);
1324
+ }
1325
+
1326
+ .text-info {
1327
+ color: var(--pf-info-color);
1328
+ }
1329
+
1122
1330
  .color-primary {
1123
1331
  color: var(--pf-primary-color);
1124
1332
  }
package/lib/index.d.ts CHANGED
@@ -525,7 +525,7 @@ declare function RadioGroup$1({ children, ...props }: Props$d): react_jsx_runtim
525
525
  /**
526
526
  * A single radio button and its label.
527
527
  */
528
- declare function Radio$1({ children, ...props }: AriaRadioProps): react_jsx_runtime.JSX.Element;
528
+ declare function Radio$2({ children, ...props }: AriaRadioProps): react_jsx_runtime.JSX.Element;
529
529
 
530
530
  type RadioGroupProps = PermafrostComponent$1 & {
531
531
  value?: string;
@@ -545,7 +545,7 @@ declare function RadioGroup(props: RadioGroupProps): react_jsx_runtime.JSX.Eleme
545
545
  * A single radio button and its label; no styling is applied, and the native
546
546
  * radio button is visually hidden.
547
547
  */
548
- declare function Radio(props: AriaRadioProps & {
548
+ declare function Radio$1(props: AriaRadioProps & {
549
549
  className?: string;
550
550
  isVisuallySelected?: (selectedValue: string) => void;
551
551
  }): react_jsx_runtime.JSX.Element;
@@ -922,4 +922,32 @@ type TableProps<T> = Omit<TableProps$1<T>, 'disabled' | 'progressPending' | 'dir
922
922
  };
923
923
  declare const Table: <T>(props: TableProps<T>) => react_jsx_runtime.JSX.Element;
924
924
 
925
- export { animation as ANIMATION, Radio as AbstractRadio, RadioGroup as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button, allColors as COLORS, CirclePulse, CircleSpinner, Col, ConfirmModal, Container, DatePicker, EditableInput, GlobalStyles, Icon, IconButton, 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$1 as Radio, RadioGroup$1 as RadioGroup, RandomLoadingMessage, Row, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, typography as TYPOGRAPHY, Table, TextInput, TextTruncate, Toggle, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
925
+ interface InputProps {
926
+ ref?: React$1.LegacyRef<HTMLInputElement>;
927
+ label: string;
928
+ name: string;
929
+ placeholder: string;
930
+ value: string;
931
+ onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
932
+ isRequired?: boolean;
933
+ isDisabled?: boolean;
934
+ errorList?: string[];
935
+ helpText?: string;
936
+ hasHiddenLabel?: boolean;
937
+ iconName?: IconName$1;
938
+ isClearable?: boolean;
939
+ }
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
+
942
+ interface RadioProps {
943
+ ref?: React$1.LegacyRef<HTMLInputElement>;
944
+ id: string;
945
+ label: string;
946
+ name: string;
947
+ value?: string;
948
+ onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
949
+ isDisabled?: boolean;
950
+ }
951
+ declare const Radio: ({ ref, id, label, name, value, onChange, isDisabled, ...rest }: RadioProps) => react_jsx_runtime.JSX.Element;
952
+
953
+ export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button, allColors as COLORS, 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, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
package/lib/index.esm.css CHANGED
@@ -862,6 +862,198 @@
862
862
  fill: var(--pf-gray-color-300);
863
863
  }
864
864
 
865
+ :root,
866
+ :root [data-theme=light],
867
+ :root [data-theme=dark] {
868
+ --pf-input-background-color: var(--pf-white-color);
869
+ --pf-input-border-color: var(--pf-gray-color);
870
+ --pf-input-text-color: var(--pf-gray-color);
871
+ --pf-input-placeholder-text-color: var(--pf-gray-color-300);
872
+ --pf-input-help-text-color: var(--pf-gray-color-400);
873
+ --pf-input-rounded: var(--pf-rounded);
874
+ }
875
+
876
+ :root [data-theme=dark] {
877
+ --pf-input-background-color: var(--pf-primary-color);
878
+ --pf-input-border-color: var(--pf-gray-color-100);
879
+ --pf-input-text-color: var(--pf-gray-color-100);
880
+ --pf-input-placeholder-text-color: var(--pf-gray-color);
881
+ --pf-input-help-text-color: var(--pf-gray-color-200);
882
+ }
883
+
884
+ .input {
885
+ background-color: var(--pf-input-background-color);
886
+ border: 1px solid var(--pf-input-border-color);
887
+ border-radius: var(--pf-input-rounded);
888
+ color: var(--pf-input-text-color);
889
+ padding: 10px;
890
+ width: 100%;
891
+ box-sizing: border-box;
892
+ height: 36px;
893
+ }
894
+ .input::-moz-placeholder {
895
+ color: var(--pf-input-placeholder-text-color);
896
+ }
897
+ .input::placeholder {
898
+ color: var(--pf-input-placeholder-text-color);
899
+ }
900
+ .input:focus {
901
+ border-color: var(--pf-primary-color);
902
+ }
903
+ .input.error {
904
+ border-color: var(--pf-error-color);
905
+ }
906
+ .input.success {
907
+ border-color: var(--pf-success-color);
908
+ }
909
+ .input.warning {
910
+ border-color: var(--pf-warning-color);
911
+ }
912
+ .input.info {
913
+ border-color: var(--pf-info-color);
914
+ }
915
+ .input:disabled {
916
+ background-color: var(--pf-gray-color-100);
917
+ border-color: var(--pf-gray-color-300);
918
+ color: var(--pf-gray-color-400);
919
+ }
920
+ .input--has-icon {
921
+ padding-left: var(--pf-padding-7);
922
+ }
923
+
924
+ .form-control .error-list {
925
+ list-style: none;
926
+ padding: 0;
927
+ margin: 0;
928
+ margin-top: var(--pf-margin-2);
929
+ margin-bottom: var(--pf-margin-2);
930
+ color: var(--pf-error-color);
931
+ }
932
+ .form-control .help-text {
933
+ margin-top: var(--pf-margin-2);
934
+ margin-bottom: var(--pf-margin-2);
935
+ color: var(--pf-input-help-text-color);
936
+ font-size: var(--pf-font-size-subtitle2);
937
+ }
938
+ .form-control .input-wrapper {
939
+ position: relative;
940
+ }
941
+ .form-control .input-wrapper .embedded-icon {
942
+ position: absolute;
943
+ top: 10px;
944
+ left: var(--pf-margin-2);
945
+ color: var(--pf-input-text-color);
946
+ }
947
+ .form-control .input-wrapper .clearable-icon {
948
+ position: absolute;
949
+ top: var(--pf-margin-3);
950
+ right: var(--pf-margin-2);
951
+ color: var(--pf-input-text-color);
952
+ }
953
+ .form-control .is-visually-hidden {
954
+ position: absolute;
955
+ width: 1px;
956
+ height: 1px;
957
+ padding: 0;
958
+ margin: -1px;
959
+ overflow: hidden;
960
+ clip: rect(0, 0, 0, 0);
961
+ white-space: nowrap;
962
+ border: 0;
963
+ }
964
+ .form-control .form-label {
965
+ margin-bottom: var(--pf-margin-2);
966
+ }
967
+
968
+ :root,
969
+ :root [data-theme=light],
970
+ :root [data-theme=dark] {
971
+ --pf-radio-background-color: var(--pf-white-color);
972
+ --pf-radio-check-color: var(--pf-primary-color);
973
+ --pf-radio-border-color: var(--pf-gray-color);
974
+ --pf-radio-disabled-color: var(--pf-gray-color-400);
975
+ }
976
+
977
+ :root [data-theme=dark] {
978
+ --pf-radio-background-color: transparent;
979
+ --pf-radio-check-color: var(--pf-white-color);
980
+ --pf-radio-border-color: var(--pf-white-color);
981
+ --pf-radio-disabled-color: var(--pf-gray-color-300);
982
+ }
983
+
984
+ .form-control .radio-wrapper {
985
+ display: flex;
986
+ margin-bottom: var(--pf-margin-2);
987
+ align-items: center;
988
+ }
989
+ .form-control .radio-input {
990
+ margin: 0;
991
+ margin-right: var(--pf-margin-2);
992
+ cursor: pointer;
993
+ }
994
+ .form-control .radio-input-label {
995
+ cursor: pointer;
996
+ }
997
+ .form-control [type=radio]:checked,
998
+ .form-control [type=radio]:not(:checked) {
999
+ position: absolute;
1000
+ left: -9999px;
1001
+ }
1002
+ .form-control [type=radio]:checked + label,
1003
+ .form-control [type=radio]:not(:checked) + label {
1004
+ position: relative;
1005
+ padding-left: var(--pf-padding-7);
1006
+ cursor: pointer;
1007
+ line-height: 20px;
1008
+ display: inline-block;
1009
+ }
1010
+ .form-control [type=radio]:checked + label:before,
1011
+ .form-control [type=radio]:not(:checked) + label:before {
1012
+ content: "";
1013
+ position: absolute;
1014
+ left: 0;
1015
+ top: 0;
1016
+ width: 18px;
1017
+ height: 18px;
1018
+ border: 1px solid var(--pf-radio-border-color);
1019
+ border-radius: 100%;
1020
+ background: var(--pf-radio-background-color);
1021
+ }
1022
+ .form-control [type=radio]:checked + label:after,
1023
+ .form-control [type=radio]:not(:checked) + label:after {
1024
+ content: "";
1025
+ width: 12px;
1026
+ height: 12px;
1027
+ background: var(--pf-radio-check-color);
1028
+ position: absolute;
1029
+ top: 4px;
1030
+ left: 4px;
1031
+ border-radius: 100%;
1032
+ transition: all 0.2s ease;
1033
+ }
1034
+ .form-control [type=radio]:not(:checked) + label:after {
1035
+ opacity: 0;
1036
+ transform: scale(0);
1037
+ }
1038
+ .form-control [type=radio]:checked + label:after {
1039
+ opacity: 1;
1040
+ transform: scale(1);
1041
+ }
1042
+ .form-control [type=radio]:disabled,
1043
+ .form-control [type=radio]:disabled + label {
1044
+ cursor: not-allowed;
1045
+ }
1046
+ .form-control [type=radio]:disabled + label {
1047
+ color: var(--pf-radio-disabled-color);
1048
+ opacity: 0.5;
1049
+ }
1050
+ .form-control [type=radio]:disabled + label:before {
1051
+ border-color: var(--pf-radio-disabled-color);
1052
+ }
1053
+ .form-control [type=radio]:disabled + label:after {
1054
+ background: var(--pf-radio-disabled-color);
1055
+ }
1056
+
865
1057
  :root {
866
1058
  --pf-font-family-base: "Mulish", sans-serif;
867
1059
  --pf-font-size-base: 1rem;
@@ -1119,6 +1311,22 @@ p,
1119
1311
  overflow-wrap: break-word;
1120
1312
  }
1121
1313
 
1314
+ .text-error {
1315
+ color: var(--pf-error-color);
1316
+ }
1317
+
1318
+ .text-warning {
1319
+ color: var(--pf-warning-color);
1320
+ }
1321
+
1322
+ .text-success {
1323
+ color: var(--pf-success-color);
1324
+ }
1325
+
1326
+ .text-info {
1327
+ color: var(--pf-info-color);
1328
+ }
1329
+
1122
1330
  .color-primary {
1123
1331
  color: var(--pf-primary-color);
1124
1332
  }
package/lib/index.esm.js CHANGED
@@ -18632,6 +18632,28 @@ const Table$1 = (props) => {
18632
18632
  return (jsx("div", { className: "table-wrapper", children: jsx(Xe, Object.assign({ responsive: responsive, direction: direction, subHeaderAlign: subHeaderAlign, keyField: keyField, striped: striped, className: `${striped ? 'pf__table--striped' : ''}`, disabled: isDisabled, noDataComponent: noDataComponent, progressPending: isLoading, progressComponent: jsx(LoadingComponent, {}) }, rest)) }));
18633
18633
  };
18634
18634
 
18635
+ const Label = ({ label, name, isRequired, hasHiddenLabel }) => {
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
+ };
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))) }));
18641
+ };
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;
18646
+ const handleClear = () => {
18647
+ onChange({ target: { value: '' } });
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
+ };
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
+ };
18656
+
18635
18657
  const StyledAccordion = styled.details `
18636
18658
  summary {
18637
18659
  display: inherit;
@@ -41453,5 +41475,5 @@ const Tooltip = (props) => {
41453
41475
  openOnClick: props.clickToShow, id: props.for, delayShow: props.delayShow, delayHide: props.delayHide, children: props.children })] }));
41454
41476
  };
41455
41477
 
41456
- 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, CirclePulse, CircleSpinner, Col, ConfirmModal, Container, DatePicker, EditableInput, GlobalStyles, Icon, IconButton, 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, 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, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
41478
+ 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, 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, Tooltip, color as colorUtils, number as numberUtils, string as stringUtils };
41457
41479
  //# sourceMappingURL=index.esm.js.map