@dxc-technology/halstack-react 0.0.0-89339f9 → 0.0.0-8c3739a

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 (109) hide show
  1. package/dist/ThemeContext.js +131 -99
  2. package/dist/accordion/Accordion.js +72 -59
  3. package/dist/accordion-group/AccordionGroup.js +1 -3
  4. package/dist/alert/Alert.js +126 -111
  5. package/dist/alert/index.d.ts +51 -0
  6. package/dist/badge/Badge.js +3 -1
  7. package/dist/box/Box.js +1 -9
  8. package/dist/button/Button.js +30 -20
  9. package/dist/card/Card.js +2 -4
  10. package/dist/checkbox/Checkbox.js +30 -21
  11. package/dist/chip/Chip.js +30 -28
  12. package/dist/common/variables.js +987 -572
  13. package/dist/date/Date.js +17 -29
  14. package/dist/date-input/DateInput.js +400 -0
  15. package/dist/date-input/index.d.ts +95 -0
  16. package/dist/dialog/Dialog.js +21 -39
  17. package/dist/dropdown/Dropdown.js +123 -71
  18. package/dist/file-input/FileInput.js +644 -0
  19. package/dist/file-input/FileItem.js +280 -0
  20. package/dist/file-input/index.d.ts +81 -0
  21. package/dist/footer/Footer.js +25 -35
  22. package/dist/footer/dxc_logo.svg +15 -0
  23. package/dist/header/Header.js +14 -42
  24. package/dist/header/dxc_logo_black.svg +8 -0
  25. package/dist/heading/Heading.js +1 -5
  26. package/dist/input-text/InputText.js +96 -58
  27. package/dist/layout/ApplicationLayout.js +1 -1
  28. package/dist/link/Link.js +23 -26
  29. package/dist/main.d.ts +8 -0
  30. package/dist/main.js +57 -1
  31. package/dist/new-select/NewSelect.js +836 -0
  32. package/dist/new-select/index.d.ts +53 -0
  33. package/dist/new-textarea/NewTextarea.js +369 -0
  34. package/dist/new-textarea/index.d.ts +117 -0
  35. package/dist/number-input/NumberInput.js +136 -0
  36. package/dist/number-input/NumberInputContext.js +16 -0
  37. package/dist/number-input/index.d.ts +113 -0
  38. package/dist/paginator/Paginator.js +10 -4
  39. package/dist/password-input/PasswordInput.js +198 -0
  40. package/dist/password-input/index.d.ts +94 -0
  41. package/dist/progress-bar/ProgressBar.js +63 -27
  42. package/dist/resultsetTable/ResultsetTable.js +5 -22
  43. package/dist/select/Select.js +189 -185
  44. package/dist/sidenav/Sidenav.js +11 -15
  45. package/dist/slider/Slider.js +145 -66
  46. package/dist/spinner/Spinner.js +226 -59
  47. package/dist/switch/Switch.js +3 -3
  48. package/dist/table/Table.js +15 -5
  49. package/dist/tabs/Tabs.js +4 -8
  50. package/dist/tag/Tag.js +38 -36
  51. package/dist/text-input/TextInput.js +971 -0
  52. package/dist/text-input/index.d.ts +135 -0
  53. package/dist/textarea/Textarea.js +26 -22
  54. package/dist/toggle-group/ToggleGroup.js +130 -44
  55. package/dist/upload/buttons-upload/ButtonsUpload.js +8 -4
  56. package/dist/upload/dragAndDropArea/DragAndDropArea.js +16 -12
  57. package/dist/upload/file-upload/FileToUpload.js +4 -4
  58. package/dist/upload/transaction/Transaction.js +13 -9
  59. package/dist/upload/transactions/Transactions.js +11 -11
  60. package/dist/wizard/Wizard.js +84 -56
  61. package/dist/wizard/invalid_icon.svg +4 -5
  62. package/dist/wizard/valid_icon.svg +4 -5
  63. package/package.json +4 -2
  64. package/test/DateInput.test.js +242 -0
  65. package/test/Dropdown.test.js +15 -0
  66. package/test/FileInput.test.js +201 -0
  67. package/test/InputText.test.js +24 -16
  68. package/test/NewTextarea.test.js +195 -0
  69. package/test/NumberInput.test.js +259 -0
  70. package/test/Paginator.test.js +1 -1
  71. package/test/PasswordInput.test.js +83 -0
  72. package/test/ResultsetTable.test.js +1 -2
  73. package/test/Select.test.js +44 -24
  74. package/test/Spinner.test.js +5 -0
  75. package/test/TextInput.test.js +732 -0
  76. package/test/ToggleGroup.test.js +5 -1
  77. package/dist/accordion/Accordion.stories.js +0 -207
  78. package/dist/accordion/readme.md +0 -96
  79. package/dist/accordion-group/AccordionGroup.stories.js +0 -207
  80. package/dist/accordion-group/readme.md +0 -70
  81. package/dist/alert/Alert.stories.js +0 -158
  82. package/dist/alert/close.svg +0 -4
  83. package/dist/alert/error.svg +0 -4
  84. package/dist/alert/info.svg +0 -4
  85. package/dist/alert/readme.md +0 -43
  86. package/dist/alert/success.svg +0 -4
  87. package/dist/alert/warning.svg +0 -4
  88. package/dist/button/Button.stories.js +0 -224
  89. package/dist/button/readme.md +0 -93
  90. package/dist/date/calendar.svg +0 -1
  91. package/dist/date/calendar_dark.svg +0 -1
  92. package/dist/dialog/Dialog.stories.js +0 -217
  93. package/dist/dialog/readme.md +0 -32
  94. package/dist/dropdown/Dropdown.stories.js +0 -249
  95. package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
  96. package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
  97. package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
  98. package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
  99. package/dist/dropdown/readme.md +0 -69
  100. package/dist/footer/Footer.stories.js +0 -94
  101. package/dist/footer/dxc_logo_wht.png +0 -0
  102. package/dist/header/dxc_logo_black.png +0 -0
  103. package/dist/header/dxc_logo_blk_rgb.svg +0 -6
  104. package/dist/header/dxc_logo_white.png +0 -0
  105. package/dist/input-text/InputText.stories.js +0 -209
  106. package/dist/select/Select.stories.js +0 -235
  107. package/dist/select/readme.md +0 -72
  108. package/dist/slider/Slider.stories.js +0 -241
  109. package/dist/toggle-group/readme.md +0 -82
@@ -0,0 +1,135 @@
1
+ type Size = "small" | "medium" | "large" | "fillParent";
2
+ type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ type Margin = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ type SVG = string | (HTMLElement & SVGElement);
10
+ type Action = {
11
+ onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
12
+ icon: SVG;
13
+ };
14
+
15
+ type Props = {
16
+ /**
17
+ * Text to be placed above the input. This label will be used as the aria-label attribute of the list of suggestions.
18
+ */
19
+ label?: string;
20
+ /**
21
+ * Name attribute of the input element.
22
+ */
23
+ name?: string;
24
+ /**
25
+ * Value of the input. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
26
+ */
27
+ value?: string;
28
+ /**
29
+ * Helper text to be placed above the input.
30
+ */
31
+ helperText?: string;
32
+ /**
33
+ * Text to be put as placeholder of the input.
34
+ */
35
+ placeholder?: string;
36
+ /**
37
+ * Action to be shown in the input. This is an object composed of an onClick function and an icon,
38
+ * being the latter either an inline svg or a URL to the image.
39
+ */
40
+ action?: Action;
41
+ /**
42
+ * If true, the input will have an action to clear the entered value.
43
+ */
44
+ clearable?: boolean;
45
+ /**
46
+ * If true, the component will be disabled.
47
+ */
48
+ disabled?: boolean;
49
+ /**
50
+ * If true, the input will be optional, showing '(Optional)'
51
+ * next to the label. Otherwise, the field will be considered required and an error will be
52
+ * passed as a parameter to the OnBlur and onChange functions when it has
53
+ * not been filled.
54
+ */
55
+ optional?: boolean;
56
+ /**
57
+ * Prefix to be placed before the input value.
58
+ */
59
+ prefix?: string;
60
+ /**
61
+ * Suffix to be placed after the input value.
62
+ */
63
+ suffix?: string;
64
+ /**
65
+ * This function will be called when the user types within the input
66
+ * element of the component. An object including the current value and
67
+ * the error (if the value entered is not valid) will be passed to this
68
+ * function. If there is no error, error will be null.
69
+ */
70
+ onChange?: (val: { value: string; error: string }) => void;
71
+ /**
72
+ * This function will be called when the input element loses the focus.
73
+ * An object including the input value and the error (if the value
74
+ * entered is not valid) will be passed to this function. If there is no error,
75
+ * error will be null.
76
+ */
77
+ onBlur?: (obj: { value: string; error: string }) => void;
78
+ /**
79
+ * If it is defined, the component will change its appearance, showing
80
+ * the error below the input component. If it is not defined, the error
81
+ * messages will be managed internally, but never displayed on its own.
82
+ */
83
+ error?: string;
84
+ /**
85
+ * These are the options to be displayed as suggestions. It can be either an array or a function:
86
+ * - Array: Array of options that will be filtered by the component.
87
+ * - Function: This function will be called when the user changes the value, we will send as a parameter the new value;
88
+ * apart from that this function should return one promise on which we should make 'then' to get the suggestions filtered.
89
+ */
90
+ suggestions?: string[] | (() => void);
91
+ /**
92
+ * Regular expression that defines the valid format allowed by the input.
93
+ * This will be checked both when the input element loses the focus and
94
+ * while typing within it. If the string entered does not match the
95
+ * pattern, the onBlur and onChange functions will be called with the
96
+ * current value and an internal error informing that this value does not
97
+ * match the pattern. If the pattern is met, the error parameter of both
98
+ * events will be null.
99
+ */
100
+ pattern?: string;
101
+ /**
102
+ * Specifies the minimun and maximum length allowed by the input.
103
+ * This will be checked both when the input element loses the
104
+ * focus and while typing within it. If the string entered does not
105
+ * comply the length, the onBlur and onChange functions will be called
106
+ * with the current value and an internal error informing that the value
107
+ * length does not comply the specified range. If a valid length is
108
+ * reached, the error parameter of both events will be null.
109
+ */
110
+ length?: { min?: number; max?: number };
111
+ /**
112
+ * HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
113
+ * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
114
+ */
115
+ autocomplete?: string;
116
+ /**
117
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
118
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
119
+ */
120
+ margin?: Space | Margin;
121
+ /**
122
+ * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
123
+ */
124
+ size?: Size;
125
+ /**
126
+ * Value of the tabindex attribute.
127
+ */
128
+ tabIndex?: number;
129
+ /**
130
+ * Reference to the component.
131
+ */
132
+ ref?: React.RefObject<HTMLDivElement>;
133
+ };
134
+
135
+ export default function DxcTextInput(props: Props): JSX.Element;
@@ -36,7 +36,7 @@ var _RequiredComponent = _interopRequireDefault(require("../common/RequiredCompo
36
36
  var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
37
37
 
38
38
  function _templateObject() {
39
- var data = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n display: inline-block;\n position: relative;\n height: auto;\n width: ", ";\n\n .MuiTextField-root {\n width: 100%;\n\n .MuiFormHelperText-root {\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n margin-top: 6px;\n }\n .MuiFormLabel-root {\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n padding-left: \"inherit\";\n\n &.Mui-disabled {\n color: ", " !important;\n cursor: not-allowed;\n }\n\n &.Mui-focused {\n color: ", ";\n &.MuiInputLabel-shrink {\n transform: \"translate(0, 1.5px) scale(0.75);\";\n }\n }\n\n &.MuiInputLabel-shrink {\n font-family: ", ";\n transform: \"translate(0, 1.5px) scale(0.75)\";\n }\n\n &.Mui-error {\n color: ", ";\n }\n\n &:not(.MuiInputLabel-shrink) {\n font-family: ", ";\n color: ", ";\n & + div,\n & + div + p {\n color: ", ";\n }\n }\n\n &.MuiInputLabel-shrink {\n & + div::before {\n border-color: ", ";\n }\n & + div + p {\n color: ", ";\n }\n }\n }\n .MuiInputBase-root.MuiInput-root.MuiInput-underline {\n &::before {\n border-bottom: ", ";\n }\n &:not(.Mui-error)::before,\n &:not(&.Mui-focused)::before {\n border-bottom: ", ";\n }\n &::after {\n border-bottom: ", ";\n }\n\n .MuiInputBase-inputMultiline {\n overflow: auto !important;\n\n ::-webkit-scrollbar {\n width: 3px;\n }\n\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n }\n\n &.Mui-error {\n &::before {\n border-width: 1px;\n border-color: ", ";\n }\n &::after {\n transform: scaleX(0);\n }\n }\n\n &.Mui-focused {\n &::after {\n border-width: 2px;\n border-color: ", ";\n transform: scaleX(1);\n }\n &.Mui-error::after {\n border-color: ", ";\n }\n }\n\n &.Mui-disabled {\n cursor: not-allowed;\n\n &::before {\n border-bottom: ", ";\n border-bottom-style: solid;\n }\n }\n\n .MuiInputBase-input {\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n line-height: ", ";\n padding-left: \"inherit\";\n text-overflow: ellipsis;\n\n &.Mui-disabled {\n cursor: not-allowed;\n color: ", ";\n }\n }\n\n &:hover:not(.Mui-disabled):before &:hover:not(.Mui-error):before {\n border-bottom: ", ";\n }\n }\n\n & > p {\n &.Mui-error {\n color: ", ";\n }\n &.Mui-disabled {\n color: ", " !important;\n cursor: not-allowed;\n }\n }\n }\n"]);
39
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n display: inline-block;\n position: relative;\n height: auto;\n width: ", ";\n\n .MuiTextField-root {\n width: 100%;\n\n .MuiFormHelperText-root {\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n margin-top: 6px;\n }\n .MuiFormLabel-root {\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n padding-left: \"inherit\";\n\n &.Mui-disabled {\n color: ", " !important;\n cursor: not-allowed;\n }\n\n &.Mui-focused {\n color: ", ";\n &.MuiInputLabel-shrink {\n transform: \"translate(0, 1.5px) scale(0.75);\";\n }\n }\n\n &.MuiInputLabel-shrink {\n font-family: ", ";\n transform: \"translate(0, 1.5px) scale(0.75)\";\n }\n\n &.Mui-error {\n color: ", ";\n }\n\n &:not(.MuiInputLabel-shrink) {\n font-family: ", ";\n color: ", ";\n & + div,\n & + div + p {\n color: ", ";\n }\n }\n\n &.MuiInputLabel-shrink {\n & + div::before {\n border-color: ", ";\n }\n & + div + p {\n color: ", ";\n }\n }\n }\n .MuiInputBase-root.MuiInput-root.MuiInput-underline {\n &::before {\n border-bottom: ", ";\n }\n\n &:not(.Mui-error)::before,\n &:not(&.Mui-focused)::before {\n border-bottom: ", ";\n }\n\n &::after {\n border-bottom: ", ";\n }\n\n .MuiInputBase-inputMultiline {\n overflow: auto !important;\n\n ::-webkit-scrollbar {\n width: 3px;\n }\n\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n }\n\n &.Mui-error {\n &::before {\n border-width: ", ";\n border-color: ", ";\n }\n &::after {\n transform: scaleX(0);\n }\n }\n\n &.Mui-focused {\n &::after {\n border-width: calc(", " + 1px);\n border-color: ", ";\n }\n &.Mui-error::after {\n border-color: ", ";\n }\n }\n\n &.Mui-disabled {\n cursor: not-allowed;\n\n &::before {\n border-bottom: ", ";\n border-bottom-style: solid;\n }\n }\n\n .MuiInputBase-input {\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n line-height: ", ";\n padding-left: \"inherit\";\n text-overflow: ellipsis;\n\n &.Mui-disabled {\n cursor: not-allowed;\n color: ", ";\n }\n }\n\n &:hover:not(.Mui-disabled):before &:hover:not(.Mui-error):before {\n border-bottom-color: ", ";\n }\n }\n\n & > p {\n &.Mui-error {\n color: ", ";\n }\n &.Mui-disabled {\n color: ", " !important;\n cursor: not-allowed;\n }\n }\n }\n"]);
40
40
 
41
41
  _templateObject = function _templateObject() {
42
42
  return data;
@@ -156,7 +156,7 @@ var TextContainer = _styledComponents["default"].div(_templateObject(), function
156
156
  }, function (props) {
157
157
  return calculateWidth(props.margin, props.size);
158
158
  }, function (props) {
159
- return props.theme.assistiveTextFontFamily;
159
+ return props.theme.fontFamily;
160
160
  }, function (props) {
161
161
  return props.theme.assistiveTextFontSize;
162
162
  }, function (props) {
@@ -176,63 +176,67 @@ var TextContainer = _styledComponents["default"].div(_templateObject(), function
176
176
  }, function (props) {
177
177
  return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
178
178
  }, function (props) {
179
- return props.backgroundType === "dark" ? props.theme.disabledFontColorOnDark : props.theme.disabledFontColor;
179
+ return props.backgroundType === "dark" ? props.theme.disabledColorOnDark : props.theme.disabledColor;
180
180
  }, function (props) {
181
181
  return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
182
182
  }, function (props) {
183
- return props.theme.labelFontFamily;
183
+ return props.theme.fontFamily;
184
184
  }, function (props) {
185
185
  return props.backgroundType === "dark" ? props.theme.errorColorOnDark : props.theme.errorColor;
186
186
  }, function (props) {
187
- return props.theme.labelFontFamily;
187
+ return props.theme.fontFamily;
188
188
  }, function (props) {
189
189
  return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
190
190
  }, function (props) {
191
191
  return props.backgroundType === "dark" ? props.theme.assistiveTextFontColorOnDark : props.theme.assistiveTextFontColor;
192
192
  }, function (props) {
193
- return props.backgroundType ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
193
+ return props.backgroundType ? props.theme.underlineColorOnDark : props.theme.underlineColor;
194
194
  }, function (props) {
195
- return props.backgroundType === "dark" ? props.theme.assistiveTextFontColorOnDark : props.theme.assistiveTextFontColor;
195
+ return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
196
196
  }, function (props) {
197
- return "1px solid ".concat(props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor);
197
+ return "".concat(props.theme.underlineThickness, " solid ").concat(props.backgroundType === "dark" ? props.theme.underlineColorOnDark : props.theme.underlineColor);
198
198
  }, function (props) {
199
- return "1px solid ".concat(props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor);
199
+ return "".concat(props.theme.underlineThickness, " solid ").concat(props.backgroundType === "dark" ? props.theme.underlineColorOnDark : props.theme.underlineColor);
200
200
  }, function (props) {
201
- return "2px solid ".concat(props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor);
201
+ return "calc(".concat(props.theme.underlineThickness, " + 1px) solid ").concat(props.backgroundType === "dark" ? props.theme.underlineFocusColorOnDark : props.theme.underlineFocusColor);
202
202
  }, function (props) {
203
203
  return props.backgroundType === "dark" ? props.theme.scrollBarTrackColorOnDark : props.theme.scrollBarTrackColor;
204
204
  }, function (props) {
205
205
  return props.backgroundType === "dark" ? props.theme.scrollBarThumbColorOnDark : props.theme.scrollBarThumbColor;
206
+ }, function (props) {
207
+ return props.theme.underlineThickness;
206
208
  }, function (props) {
207
209
  return props.backgroundType === "dark" ? props.theme.errorColorOnDark : props.theme.errorColor;
208
210
  }, function (props) {
209
- return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
211
+ return props.theme.underlineThickness;
212
+ }, function (props) {
213
+ return props.backgroundType === "dark" ? props.theme.underlineFocusColorOnDark : props.theme.underlineFocusColor;
210
214
  }, function (props) {
211
215
  return props.backgroundType === "dark" ? props.theme.errorColorOnDark : props.theme.errorColor;
212
216
  }, function (props) {
213
- return "1px solid ".concat(props.backgroundType === "dark" ? props.theme.disabledFontColorOnDark : props.theme.disabledFontColor, " !important");
217
+ return "".concat(props.theme.underlineThickness, " solid ").concat(props.backgroundType === "dark" ? props.theme.disabledColorOnDark : props.theme.disabledColor, " !important");
214
218
  }, function (props) {
215
- return props.theme.customContentFontFamily;
219
+ return props.theme.fontFamily;
216
220
  }, function (props) {
217
- return props.theme.customContentFontSize;
221
+ return props.theme.valueFontSize;
218
222
  }, function (props) {
219
- return props.theme.customContentFontStyle;
223
+ return props.theme.valueFontStyle;
220
224
  }, function (props) {
221
- return props.theme.customContentFontWeight;
225
+ return props.theme.valueFontWeight;
222
226
  }, function (props) {
223
- return props.theme.customContentLetterSpacing;
227
+ return props.theme.valueLetterSpacing;
224
228
  }, function (props) {
225
- return props.backgroundType === "dark" ? props.theme.customContentFontColorOnDark : props.theme.customContentFontColor;
229
+ return props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
226
230
  }, function (props) {
227
- return props.theme.customContentLineHeight;
231
+ return props.theme.valueLineHeight;
228
232
  }, function (props) {
229
- return props.backgroundType === "dark" ? props.theme.disabledFontColorOnDark : props.theme.disabledFontColor;
233
+ return props.backgroundType === "dark" ? props.theme.disabledColorOnDark : props.theme.disabledColor;
230
234
  }, function (props) {
231
- return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
235
+ return props.backgroundType === "dark" ? props.theme.underlineFocusColorOnDark : props.theme.underlineFocusColor;
232
236
  }, function (props) {
233
237
  return "".concat(props.backgroundType === "dark" ? props.theme.errorColorOnDark : props.theme.errorColor, " !important");
234
238
  }, function (props) {
235
- return props.backgroundType === "dark" ? props.theme.disabledFontColorOnDark : props.theme.disabledFontColor;
239
+ return props.backgroundType === "dark" ? props.theme.disabledColorOnDark : props.theme.disabledColor;
236
240
  });
237
241
 
238
242
  DxcTextarea.propTypes = {
@@ -21,14 +21,46 @@ var _react = _interopRequireWildcard(require("react"));
21
21
 
22
22
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
23
 
24
+ var _uuid = require("uuid");
25
+
24
26
  var _propTypes = _interopRequireDefault(require("prop-types"));
25
27
 
26
28
  var _variables = require("../common/variables.js");
27
29
 
28
30
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
29
31
 
32
+ function _templateObject9() {
33
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: ", ";\n height: 24px;\n width: 24px;\n overflow: hidden;\n display: flex;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"]);
34
+
35
+ _templateObject9 = function _templateObject9() {
36
+ return data;
37
+ };
38
+
39
+ return data;
40
+ }
41
+
42
+ function _templateObject8() {
43
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n height: 24px;\n width: 24px;\n margin-right: ", ";\n"]);
44
+
45
+ _templateObject8 = function _templateObject8() {
46
+ return data;
47
+ };
48
+
49
+ return data;
50
+ }
51
+
52
+ function _templateObject7() {
53
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n"]);
54
+
55
+ _templateObject7 = function _templateObject7() {
56
+ return data;
57
+ };
58
+
59
+ return data;
60
+ }
61
+
30
62
  function _templateObject6() {
31
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n overflow: hidden;\n display: flex;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"]);
63
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"]);
32
64
 
33
65
  _templateObject6 = function _templateObject6() {
34
66
  return data;
@@ -38,7 +70,7 @@ function _templateObject6() {
38
70
  }
39
71
 
40
72
  function _templateObject5() {
41
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n"]);
73
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-right: ", ";\n\n ", "\n"]);
42
74
 
43
75
  _templateObject5 = function _templateObject5() {
44
76
  return data;
@@ -48,7 +80,7 @@ function _templateObject5() {
48
80
  }
49
81
 
50
82
  function _templateObject4() {
51
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n letter-spacing: ", ";\n"]);
83
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n opacity: 1;\n height: calc(48px - 4px - 4px);\n border-width: ", ";\n border-style: ", ";\n border-radius: ", ";\n border-color: ", ";\n background-color: ", ";\n padding: 4px;\n margin-top: ", ";\n"]);
52
84
 
53
85
  _templateObject4 = function _templateObject4() {
54
86
  return data;
@@ -58,7 +90,7 @@ function _templateObject4() {
58
90
  }
59
91
 
60
92
  function _templateObject3() {
61
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n\n ", "\n"]);
93
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n flex-direction: column;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
62
94
 
63
95
  _templateObject3 = function _templateObject3() {
64
96
  return data;
@@ -68,7 +100,7 @@ function _templateObject3() {
68
100
  }
69
101
 
70
102
  function _templateObject2() {
71
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n"]);
103
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
72
104
 
73
105
  _templateObject2 = function _templateObject2() {
74
106
  return data;
@@ -78,7 +110,7 @@ function _templateObject2() {
78
110
  }
79
111
 
80
112
  function _templateObject() {
81
- var data = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n display: flex;\n flex-direction: column;\n opacity: 1;\n"]);
113
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
82
114
 
83
115
  _templateObject = function _templateObject() {
84
116
  return data;
@@ -88,7 +120,9 @@ function _templateObject() {
88
120
  }
89
121
 
90
122
  var DxcToggleGroup = function DxcToggleGroup(_ref) {
91
- var value = _ref.value,
123
+ var label = _ref.label,
124
+ helperText = _ref.helperText,
125
+ value = _ref.value,
92
126
  onChange = _ref.onChange,
93
127
  _ref$disabled = _ref.disabled,
94
128
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
@@ -106,6 +140,10 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
106
140
  selectedValue = _useState2[0],
107
141
  setSelectedValue = _useState2[1];
108
142
 
143
+ var _useState3 = (0, _react.useState)("toggle-group-".concat((0, _uuid.v4)())),
144
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 1),
145
+ toggleGroupId = _useState4[0];
146
+
109
147
  var handleToggleChange = function handleToggleChange(selectedOption) {
110
148
  var newSelectedOptions;
111
149
 
@@ -123,27 +161,25 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
123
161
  }
124
162
 
125
163
  setSelectedValue(newSelectedOptions);
126
- } else {
127
- setSelectedValue(selectedOption === selectedValue ? null : selectedOption);
128
- }
164
+ } else setSelectedValue(selectedOption === selectedValue ? null : selectedOption);
129
165
  } else if (multiple) {
130
166
  newSelectedOptions = value.map(function (v) {
131
167
  return v;
132
168
  });
133
- newSelectedOptions.push(selectedOption);
134
- }
135
169
 
136
- if (typeof onChange === "function") {
137
- onChange(multiple ? newSelectedOptions : selectedOption);
170
+ if (newSelectedOptions.includes(selectedOption)) {
171
+ var _index = newSelectedOptions.indexOf(selectedOption);
172
+
173
+ newSelectedOptions.splice(_index, 1);
174
+ } else newSelectedOptions.push(selectedOption);
138
175
  }
176
+
177
+ typeof onChange === "function" && onChange(multiple ? newSelectedOptions : selectedOption);
139
178
  };
140
179
 
141
180
  var handleKeyPress = function handleKeyPress(event, optionValue) {
142
181
  event.preventDefault();
143
-
144
- if (!disabled && (event.nativeEvent.code === "Enter" || event.nativeEvent.code === "Space")) {
145
- handleToggleChange(optionValue);
146
- }
182
+ if (!disabled && (event.nativeEvent.code === "Enter" || event.nativeEvent.code === "Space")) handleToggleChange(optionValue);
147
183
  };
148
184
 
149
185
  return _react["default"].createElement(_styledComponents.ThemeProvider, {
@@ -151,9 +187,19 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
151
187
  }, _react["default"].createElement(ToggleGroup, {
152
188
  margin: margin,
153
189
  disabled: disabled
154
- }, _react["default"].createElement(ToggleGroupContainer, null, options.map(function (option, i) {
190
+ }, _react["default"].createElement(Label, {
191
+ htmlFor: toggleGroupId,
192
+ disabled: disabled
193
+ }, label), _react["default"].createElement(HelperText, {
194
+ disabled: disabled
195
+ }, helperText), _react["default"].createElement(OptionsContainer, {
196
+ id: toggleGroupId,
197
+ role: multiple ? "group" : "radiogroup"
198
+ }, options.map(function (option, i) {
155
199
  return _react["default"].createElement(ToggleContainer, {
156
200
  selected: multiple ? value ? value.includes(option.value) : selectedValue.includes(option.value) : value ? option.value === value : option.value === selectedValue,
201
+ role: multiple ? "switch" : "radio",
202
+ "aria-checked": multiple ? value ? value.includes(option.value) : selectedValue.includes(option.value) : value ? option.value === value : option.value === selectedValue,
157
203
  tabIndex: !disabled ? tabIndex : -1,
158
204
  onClick: function onClick() {
159
205
  return !disabled && handleToggleChange(option.value);
@@ -161,20 +207,50 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
161
207
  isFirst: i === 0,
162
208
  isLast: i === options.length - 1,
163
209
  isIcon: option.iconSrc || option.icon,
210
+ optionLabel: option.label,
164
211
  disabled: disabled,
165
212
  onKeyPress: function onKeyPress(event) {
166
213
  handleKeyPress(event, option.value);
167
214
  },
168
215
  key: "toggle-".concat(i, "-").concat(option.label)
169
- }, option.icon ? _react["default"].createElement(IconContainer, null, (0, _typeof2["default"])(option.icon) === "object" ? option.icon : _react["default"].createElement(option.icon)) : option.iconSrc ? _react["default"].createElement(Icon, {
170
- src: option.iconSrc
171
- }) : _react["default"].createElement(LabelContainer, {
172
- disabled: disabled
173
- }, option.label));
216
+ }, _react["default"].createElement(OptionContent, null, option.icon && _react["default"].createElement(IconContainer, {
217
+ optionLabel: option.label
218
+ }, (0, _typeof2["default"])(option.icon) === "object" ? option.icon : _react["default"].createElement(option.icon)), option.iconSrc && _react["default"].createElement(Icon, {
219
+ src: option.iconSrc,
220
+ optionLabel: option.label
221
+ }), option.label && _react["default"].createElement(LabelContainer, null, option.label)));
174
222
  }))));
175
223
  };
176
224
 
177
- var ToggleGroup = _styledComponents["default"].div(_templateObject(), function (props) {
225
+ var Label = _styledComponents["default"].label(_templateObject(), function (props) {
226
+ return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
227
+ }, function (props) {
228
+ return props.theme.labelFontFamily;
229
+ }, function (props) {
230
+ return props.theme.labelFontSize;
231
+ }, function (props) {
232
+ return props.theme.labelFontStyle;
233
+ }, function (props) {
234
+ return props.theme.labelFontWeight;
235
+ }, function (props) {
236
+ return props.theme.labelLineHeight;
237
+ });
238
+
239
+ var HelperText = _styledComponents["default"].span(_templateObject2(), function (props) {
240
+ return props.disabled ? props.theme.disabledHelperTextFontcolor : props.theme.helperTextFontColor;
241
+ }, function (props) {
242
+ return props.theme.helperTextFontFamily;
243
+ }, function (props) {
244
+ return props.theme.helperTextFontSize;
245
+ }, function (props) {
246
+ return props.theme.helperTextFontStyle;
247
+ }, function (props) {
248
+ return props.theme.helperTextFontWeight;
249
+ }, function (props) {
250
+ return props.theme.helperTextLineHeight;
251
+ });
252
+
253
+ var ToggleGroup = _styledComponents["default"].div(_templateObject3(), function (props) {
178
254
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
179
255
  }, function (props) {
180
256
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -186,39 +262,49 @@ var ToggleGroup = _styledComponents["default"].div(_templateObject(), function (
186
262
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
187
263
  });
188
264
 
189
- var ToggleGroupContainer = _styledComponents["default"].div(_templateObject2());
190
-
191
- var ToggleContainer = _styledComponents["default"].div(_templateObject3(), function (props) {
192
- return "\n background-color: ".concat(props.selected ? props.disabled ? props.theme.disabledSelectedBackgroundColor : props.theme.selectedBackgroundColor : props.disabled ? props.theme.disabledUnselectedBackgroundColor : props.theme.unselectedBackgroundColor, ";\n &:focus {\n outline: ").concat(props.theme.focusColor, " auto 1px;\n }\n border-radius: ").concat(props.isFirst ? "4px 0 0 4px" : props.isLast ? "0 4px 4px 0" : "0", ";\n color: ").concat(props.selected ? props.theme.selectedFontColor : props.theme.unselectedFontColor, ";\n padding: ").concat(props.isIcon ? "".concat(props.theme.iconPaddingTop, " ").concat(props.theme.iconPaddingRight, " ").concat(props.theme.iconPaddingBottom, " ").concat(props.theme.iconPaddingLeft) : "".concat(props.theme.labelPaddingTop, " ").concat(props.theme.labelPaddingRight, " ").concat(props.theme.labelPaddingBottom, " ").concat(props.theme.labelPaddingLeft), ";\n ").concat(!props.disabled ? "&:hover {\n background-color: ".concat(props.selected ? props.theme.selectedBackgroundHoverColor : props.theme.unselectedBackgroundHoverColor, ";\n color: ").concat(props.selected ? props.theme.selectedHoverFontColor : props.theme.unselectedHoverFontColor, " !important;\n }\n cursor: pointer;") : "color: ".concat(props.selected ? props.theme.disabledSelectedFontColor : props.theme.disabledUnselectedFontColor, " !important;\n cursor: not-allowed;"), "\n ");
193
- });
194
-
195
- var LabelContainer = _styledComponents["default"].span(_templateObject4(), function (props) {
196
- return props.theme.fontFamily;
265
+ var OptionsContainer = _styledComponents["default"].div(_templateObject4(), function (props) {
266
+ return props.theme.containerBorderThickness;
197
267
  }, function (props) {
198
- return props.theme.fontSize;
268
+ return props.theme.containerBorderStyle;
199
269
  }, function (props) {
200
- return props.theme.fontStyle;
270
+ return props.theme.containerBorderRadius;
201
271
  }, function (props) {
202
- return props.theme.fontWeight;
272
+ return props.theme.containerBorderColor;
203
273
  }, function (props) {
204
- return props.theme.fontTextTransform;
274
+ return props.theme.containerBackgroundColor;
205
275
  }, function (props) {
206
- return props.theme.fontLetterSpacing;
276
+ return props.theme.containerMarginTop;
207
277
  });
208
278
 
209
- var Icon = _styledComponents["default"].img(_templateObject5(), function (props) {
210
- return props.theme.iconHeight;
279
+ var ToggleContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
280
+ return !props.isLast && "4px";
211
281
  }, function (props) {
212
- return props.theme.iconWidth;
282
+ return "\n background-color: ".concat(props.selected ? props.disabled ? props.theme.selectedDisabledBackgroundColor : props.theme.selectedBackgroundColor : props.disabled ? props.theme.unselectedDisabledBackgroundColor : props.theme.unselectedBackgroundColor, ";\n border-width: ").concat(props.theme.optionBorderThickness, ";\n border-style: ").concat(props.theme.optionBorderStyle, ";\n border-radius: ").concat(props.theme.optionBorderRadius, ";\n padding-left: ").concat(props.optionLabel && props.isIcon || props.optionLabel && !props.isIcon ? props.theme.labelPaddingLeft : props.theme.iconPaddingLeft, ";\n padding-right: ").concat(props.optionLabel && props.isIcon || props.optionLabel && !props.isIcon ? props.theme.labelPaddingRight : props.theme.iconPaddingRight, ";\n ").concat(!props.disabled ? ":hover {\n background-color: ".concat(props.selected ? props.theme.selectedHoverBackgroundColor : props.theme.unselectedHoverBackgroundColor, ";\n }\n :active {\n background-color: ").concat(props.selected ? props.theme.selectedActiveBackgroundColor : props.theme.unselectedActiveBackgroundColor, ";\n color: #ffffff;\n } \n :focus {\n border-color: transparent;\n box-shadow: 0 0 0 ").concat(props.theme.optionFocusBorderThickness, " ").concat(props.backgroundType === "dark" ? props.theme.focusColorOnDark : props.theme.focusColor, ";\n }\n &:focus-visible {\n outline: none;\n }\n cursor: pointer;\n color: ").concat(props.selected ? props.theme.selectedFontColor : props.theme.unselectedFontColor, ";\n") : "color: ".concat(props.selected ? props.theme.selectedDisabledFontColor : props.theme.unselectedDisabledFontColor, ";\n cursor: not-allowed;"), "\n ");
213
283
  });
214
284
 
215
- var IconContainer = _styledComponents["default"].div(_templateObject6(), function (props) {
216
- return props.theme.iconHeight;
285
+ var LabelContainer = _styledComponents["default"].span(_templateObject6(), function (props) {
286
+ return props.theme.optionLabelFontFamily;
287
+ }, function (props) {
288
+ return props.theme.optionLabelFontSize;
217
289
  }, function (props) {
218
- return props.theme.iconWidth;
290
+ return props.theme.optionLabelFontStyle;
291
+ }, function (props) {
292
+ return props.theme.optionLabelFontWeight;
293
+ });
294
+
295
+ var OptionContent = _styledComponents["default"].div(_templateObject7());
296
+
297
+ var Icon = _styledComponents["default"].img(_templateObject8(), function (props) {
298
+ return props.optionLabel && props.theme.iconMarginRight;
299
+ });
300
+
301
+ var IconContainer = _styledComponents["default"].div(_templateObject9(), function (props) {
302
+ return props.optionLabel && props.theme.iconMarginRight;
219
303
  });
220
304
 
221
305
  DxcToggleGroup.propTypes = {
306
+ label: _propTypes["default"].string,
307
+ helperText: _propTypes["default"].string,
222
308
  value: _propTypes["default"].any,
223
309
  onChange: _propTypes["default"].func,
224
310
  disabled: _propTypes["default"].bool,
@@ -25,6 +25,8 @@ var _dragDropIcon = _interopRequireDefault(require("./drag-drop-icon.svg"));
25
25
 
26
26
  var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
27
27
 
28
+ var _BackgroundColorContext = require("../../BackgroundColorContext.js");
29
+
28
30
  function _templateObject3() {
29
31
  var data = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n mask: url(", ") no-repeat center;\n mask-size: ", ";\n height: ", ";\n width: ", ";\n margin-right: 5px;\n"]);
30
32
 
@@ -77,6 +79,8 @@ var DxcButtonsUpload = function DxcButtonsUpload(_ref) {
77
79
 
78
80
  return _react["default"].createElement(_styledComponents.ThemeProvider, {
79
81
  theme: colorsTheme.upload
82
+ }, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
83
+ color: colorsTheme.upload.backgroundColor
80
84
  }, _react["default"].createElement(DXCButtonsUpload, null, _react["default"].createElement(DragAndDropLabel, null, _react["default"].createElement(DragAndDropIcon, null), "Drag and Drop area"), _react["default"].createElement(_Button["default"], {
81
85
  margin: {
82
86
  right: "small"
@@ -97,7 +101,7 @@ var DxcButtonsUpload = function DxcButtonsUpload(_ref) {
97
101
  iconPosition: "after",
98
102
  iconSrc: _uploadButton["default"],
99
103
  onClick: onUpload
100
- })));
104
+ }))));
101
105
  };
102
106
 
103
107
  DxcButtonsUpload.propTypes = {
@@ -124,11 +128,11 @@ var DragAndDropLabel = _styledComponents["default"].div(_templateObject2(), func
124
128
  var DragAndDropIcon = _styledComponents["default"].div(_templateObject3(), function (props) {
125
129
  return props.theme.dragAndDropAreaIconColor;
126
130
  }, _dragDropIcon["default"], function (props) {
127
- return "".concat(props.theme.dragAndDropAreaIconWidth, " ").concat(props.theme.dragAndDropAreaIconHeight);
131
+ return "".concat(props.theme.dragAndDropAreaIconSize, " ").concat(props.theme.dragAndDropAreaIconSize);
128
132
  }, function (props) {
129
- return props.theme.dragAndDropAreaIconHeight;
133
+ return props.theme.dragAndDropAreaIconSize;
130
134
  }, function (props) {
131
- return props.theme.dragAndDropAreaIconWidth;
135
+ return props.theme.dragAndDropAreaIconSize;
132
136
  });
133
137
 
134
138
  var _default = DxcButtonsUpload;