@dxc-technology/halstack-react 0.0.0-67a8cc5 → 0.0.0-6bc7b92

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 (192) hide show
  1. package/dist/BackgroundColorContext.js +46 -0
  2. package/dist/ThemeContext.js +168 -105
  3. package/dist/V3Textarea/V3Textarea.js +264 -0
  4. package/dist/accordion/Accordion.js +122 -47
  5. package/dist/accordion-group/AccordionGroup.js +34 -4
  6. package/dist/alert/Alert.js +174 -81
  7. package/dist/alert/index.d.ts +51 -0
  8. package/dist/badge/Badge.js +28 -7
  9. package/dist/box/Box.js +28 -19
  10. package/dist/button/Button.js +44 -19
  11. package/dist/card/Card.js +15 -6
  12. package/dist/checkbox/Checkbox.js +88 -23
  13. package/dist/chip/Chip.js +62 -20
  14. package/dist/common/utils.js +2 -22
  15. package/dist/common/variables.js +1377 -239
  16. package/dist/date/Date.js +65 -41
  17. package/dist/date-input/DateInput.js +400 -0
  18. package/dist/date-input/index.d.ts +95 -0
  19. package/dist/dialog/Dialog.js +44 -31
  20. package/dist/dropdown/Dropdown.js +162 -74
  21. package/dist/file-input/FileInput.js +644 -0
  22. package/dist/file-input/FileItem.js +280 -0
  23. package/dist/file-input/index.d.ts +81 -0
  24. package/dist/footer/Footer.js +80 -36
  25. package/dist/footer/Icons.js +77 -0
  26. package/dist/header/Header.js +122 -67
  27. package/dist/header/Icons.js +59 -0
  28. package/dist/heading/Heading.js +86 -23
  29. package/dist/input-text/Icons.js +22 -0
  30. package/dist/input-text/InputText.js +184 -76
  31. package/dist/layout/ApplicationLayout.js +14 -18
  32. package/dist/layout/Icons.js +55 -0
  33. package/dist/link/Link.js +78 -34
  34. package/dist/main.d.ts +8 -0
  35. package/dist/main.js +71 -7
  36. package/dist/new-select/NewSelect.js +836 -0
  37. package/dist/new-select/index.d.ts +53 -0
  38. package/dist/number-input/NumberInput.js +136 -0
  39. package/dist/number-input/NumberInputContext.js +16 -0
  40. package/dist/number-input/index.d.ts +113 -0
  41. package/dist/paginator/Icons.js +66 -0
  42. package/dist/paginator/Paginator.js +46 -24
  43. package/dist/password-input/PasswordInput.js +198 -0
  44. package/dist/password-input/index.d.ts +94 -0
  45. package/dist/progress-bar/ProgressBar.js +89 -37
  46. package/dist/radio/Radio.js +28 -11
  47. package/dist/resultsetTable/ResultsetTable.js +67 -40
  48. package/dist/select/Select.js +207 -148
  49. package/dist/sidenav/Sidenav.js +64 -12
  50. package/dist/slider/Slider.js +204 -67
  51. package/dist/spinner/Spinner.js +245 -60
  52. package/dist/switch/Switch.js +42 -16
  53. package/dist/table/Table.js +46 -10
  54. package/dist/tabs/Tabs.js +38 -18
  55. package/dist/tag/Tag.js +56 -31
  56. package/dist/text-input/TextInput.js +971 -0
  57. package/dist/text-input/index.d.ts +135 -0
  58. package/dist/textarea/Textarea.js +239 -108
  59. package/dist/textarea/index.d.ts +117 -0
  60. package/dist/toggle/Toggle.js +0 -2
  61. package/dist/toggle-group/ToggleGroup.js +142 -32
  62. package/dist/upload/Upload.js +4 -8
  63. package/dist/upload/buttons-upload/ButtonsUpload.js +29 -17
  64. package/dist/upload/buttons-upload/Icons.js +40 -0
  65. package/dist/upload/dragAndDropArea/DragAndDropArea.js +64 -24
  66. package/dist/upload/dragAndDropArea/Icons.js +39 -0
  67. package/dist/upload/file-upload/FileToUpload.js +53 -26
  68. package/dist/upload/file-upload/Icons.js +66 -0
  69. package/dist/upload/files-upload/FilesToUpload.js +3 -5
  70. package/dist/upload/transaction/Icons.js +160 -0
  71. package/dist/upload/transaction/Transaction.js +37 -43
  72. package/dist/upload/transactions/Transactions.js +27 -11
  73. package/dist/wizard/Icons.js +65 -0
  74. package/dist/wizard/Wizard.js +114 -52
  75. package/package.json +6 -4
  76. package/test/AccordionGroup.test.js +16 -0
  77. package/test/Date.test.js +49 -45
  78. package/test/DateInput.test.js +242 -0
  79. package/test/Dropdown.test.js +15 -0
  80. package/test/FileInput.test.js +201 -0
  81. package/test/Footer.test.js +2 -7
  82. package/test/Header.test.js +5 -10
  83. package/test/InputText.test.js +24 -16
  84. package/test/Link.test.js +3 -2
  85. package/test/NumberInput.test.js +259 -0
  86. package/test/Paginator.test.js +1 -1
  87. package/test/PasswordInput.test.js +83 -0
  88. package/test/ResultsetTable.test.js +1 -2
  89. package/test/Select.test.js +44 -24
  90. package/test/Slider.test.js +9 -17
  91. package/test/Spinner.test.js +5 -0
  92. package/test/TextInput.test.js +732 -0
  93. package/test/Textarea.test.js +193 -0
  94. package/test/ToggleGroup.test.js +5 -1
  95. package/test/Upload.test.js +5 -5
  96. package/test/{TextArea.test.js → V3TextArea.test.js} +6 -7
  97. package/dist/accordion/Accordion.stories.js +0 -207
  98. package/dist/accordion/readme.md +0 -96
  99. package/dist/accordion-group/AccordionGroup.stories.js +0 -207
  100. package/dist/accordion-group/readme.md +0 -70
  101. package/dist/alert/Alert.stories.js +0 -158
  102. package/dist/alert/close.svg +0 -4
  103. package/dist/alert/error.svg +0 -4
  104. package/dist/alert/info.svg +0 -4
  105. package/dist/alert/readme.md +0 -43
  106. package/dist/alert/success.svg +0 -4
  107. package/dist/alert/warning.svg +0 -4
  108. package/dist/button/Button.stories.js +0 -224
  109. package/dist/button/readme.md +0 -93
  110. package/dist/checkbox/Checkbox.stories.js +0 -144
  111. package/dist/checkbox/readme.md +0 -116
  112. package/dist/common/services/example-service.js +0 -10
  113. package/dist/common/services/example-service.test.js +0 -12
  114. package/dist/date/Date.stories.js +0 -205
  115. package/dist/date/calendar.svg +0 -1
  116. package/dist/date/calendar_dark.svg +0 -1
  117. package/dist/date/readme.md +0 -73
  118. package/dist/dialog/Dialog.stories.js +0 -217
  119. package/dist/dialog/readme.md +0 -32
  120. package/dist/dropdown/Dropdown.stories.js +0 -249
  121. package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
  122. package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
  123. package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
  124. package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
  125. package/dist/dropdown/readme.md +0 -69
  126. package/dist/footer/Footer.stories.js +0 -94
  127. package/dist/footer/dxc_logo_wht.png +0 -0
  128. package/dist/footer/readme.md +0 -41
  129. package/dist/header/Header.stories.js +0 -176
  130. package/dist/header/close_icon.svg +0 -1
  131. package/dist/header/dxc_logo_black.png +0 -0
  132. package/dist/header/dxc_logo_blk_rgb.svg +0 -6
  133. package/dist/header/dxc_logo_white.png +0 -0
  134. package/dist/header/hamb_menu_black.svg +0 -1
  135. package/dist/header/hamb_menu_white.svg +0 -1
  136. package/dist/header/readme.md +0 -33
  137. package/dist/input-text/InputText.stories.js +0 -209
  138. package/dist/input-text/error.svg +0 -1
  139. package/dist/input-text/readme.md +0 -91
  140. package/dist/layout/facebook.svg +0 -45
  141. package/dist/layout/linkedin.svg +0 -50
  142. package/dist/layout/twitter.svg +0 -53
  143. package/dist/link/readme.md +0 -51
  144. package/dist/paginator/images/next.svg +0 -3
  145. package/dist/paginator/images/nextPage.svg +0 -3
  146. package/dist/paginator/images/previous.svg +0 -3
  147. package/dist/paginator/images/previousPage.svg +0 -3
  148. package/dist/paginator/readme.md +0 -50
  149. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  150. package/dist/progress-bar/readme.md +0 -63
  151. package/dist/radio/Radio.stories.js +0 -166
  152. package/dist/radio/readme.md +0 -70
  153. package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
  154. package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
  155. package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
  156. package/dist/select/Select.stories.js +0 -235
  157. package/dist/select/readme.md +0 -72
  158. package/dist/slider/Slider.stories.js +0 -241
  159. package/dist/slider/readme.md +0 -64
  160. package/dist/spinner/Spinner.stories.js +0 -183
  161. package/dist/spinner/readme.md +0 -65
  162. package/dist/switch/Switch.stories.js +0 -134
  163. package/dist/switch/readme.md +0 -133
  164. package/dist/tabs/Tabs.stories.js +0 -130
  165. package/dist/tabs/readme.md +0 -78
  166. package/dist/tabs-for-sections/readme.md +0 -78
  167. package/dist/toggle/Toggle.stories.js +0 -297
  168. package/dist/toggle/readme.md +0 -80
  169. package/dist/toggle-group/readme.md +0 -82
  170. package/dist/upload/Upload.stories.js +0 -72
  171. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  172. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  173. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  174. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  175. package/dist/upload/file-upload/audio-icon.svg +0 -4
  176. package/dist/upload/file-upload/close.svg +0 -4
  177. package/dist/upload/file-upload/file-icon.svg +0 -4
  178. package/dist/upload/file-upload/video-icon.svg +0 -4
  179. package/dist/upload/readme.md +0 -37
  180. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  181. package/dist/upload/transaction/audio-icon.svg +0 -4
  182. package/dist/upload/transaction/error-icon.svg +0 -4
  183. package/dist/upload/transaction/file-icon-err.svg +0 -4
  184. package/dist/upload/transaction/file-icon.svg +0 -4
  185. package/dist/upload/transaction/image-icon-err.svg +0 -4
  186. package/dist/upload/transaction/image-icon.svg +0 -4
  187. package/dist/upload/transaction/success-icon.svg +0 -4
  188. package/dist/upload/transaction/video-icon-err.svg +0 -4
  189. package/dist/upload/transaction/video-icon.svg +0 -4
  190. package/dist/wizard/invalid_icon.svg +0 -6
  191. package/dist/wizard/valid_icon.svg +0 -6
  192. package/dist/wizard/validation-wrong.svg +0 -6
@@ -0,0 +1,117 @@
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
+
10
+ type Props = {
11
+ /**
12
+ * Text to be placed above the textarea.
13
+ */
14
+ label?: string;
15
+ /**
16
+ * Name attribute of the textarea element.
17
+ */
18
+ name?: string;
19
+ /**
20
+ * Value of the textarea. If undefined, the component will be uncontrolled and the value will be managed internally.
21
+ */
22
+ value?: string;
23
+ /**
24
+ * Helper text to be placed above the textarea.
25
+ */
26
+ helperText?: string;
27
+ /**
28
+ * Text to be put as placeholder of the textarea.
29
+ */
30
+ placeholder?: string;
31
+ /**
32
+ * If true, the component will be disabled.
33
+ */
34
+ disabled?: boolean;
35
+ /**
36
+ * If true, the textarea will be optional, showing '(Optional)'
37
+ * next to the label. Otherwise, the field will be considered required
38
+ * and an error will be passed as a parameter to the OnBlur and onChange functions
39
+ * when it has not been filled.
40
+ */
41
+ optional?: boolean;
42
+ /**
43
+ * Defines the textarea's ability to resize vertically. It can be:
44
+ * - 'auto': The textarea grows or shrinks automatically in order to fit the content.
45
+ * - 'manual': The height of the textarea is enabled to be manually modified.
46
+ * - 'none': The textarea has a fixed height and can't be modified.
47
+ */
48
+ verticalGrow?: "auto" | "manual" | "none";
49
+ /**
50
+ * Number of rows of the textarea.
51
+ */
52
+ rows?: number;
53
+ /**
54
+ * This function will be called when the user types within the textarea.
55
+ * An object including the current value and the error (if the value
56
+ * entered is not valid) will be passed to this function.
57
+ * If there is no error, error will be null.
58
+ */
59
+ onChange?: (val: { value: string; error: string }) => void;
60
+ /**
61
+ * This function will be called when the textarea loses the focus. An
62
+ * object including the textarea value and the error (if the value entered
63
+ * is not valid) will be passed to this function. If there is no error,
64
+ * error will be null.
65
+ */
66
+ onBlur?: (val: { value: string; error: string }) => void;
67
+ /**
68
+ * If it is defined, the component will change its appearance, showing
69
+ * the error below the textarea. If it is not defined, the error
70
+ * messages will be managed internally, but never displayed on its own.
71
+ */
72
+ error?: string;
73
+ /**
74
+ * Regular expression that defines the valid format allowed by the
75
+ * textarea. This will be checked both when the textarea loses the focus
76
+ * and while typing within it. If the string entered does not match the
77
+ * pattern, the onBlur and onChange functions will be called with the
78
+ * current value and an internal error informing that this value does not
79
+ * match the pattern. If the pattern is met, the error parameter of both
80
+ * events will be null.
81
+ */
82
+ pattern?: string;
83
+ /**
84
+ * Specifies the minimun and maximum length allowed by the textarea.
85
+ * This will be checked both when the textarea loses the
86
+ * focus and while typing within it. If the string entered does not
87
+ * comply the length, the onBlur and onChange functions will be called
88
+ * with the current value and an internal error informing that the value
89
+ * length does not comply the specified range. If a valid length is
90
+ * reached, the error parameter of both events will be null.
91
+ */
92
+ length?: { min: number; max: number };
93
+ /**
94
+ * HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the textarea value.
95
+ * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
96
+ */
97
+ autocomplete?: string;
98
+ /**
99
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
100
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
101
+ */
102
+ margin?: Space | Margin;
103
+ /**
104
+ * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
105
+ */
106
+ size?: Size;
107
+ /**
108
+ * Value of the tabindex attribute.
109
+ */
110
+ tabIndex?: number;
111
+ /**
112
+ * Reference to the component.
113
+ */
114
+ ref?: React.RefObject<HTMLDivElement>;
115
+ };
116
+
117
+ export default function DxcTextarea(props: Props): JSX.Element;
@@ -23,8 +23,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
23
23
 
24
24
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
25
25
 
26
- require("../common/OpenSans.css");
27
-
28
26
  var _utils = require("../common/utils.js");
29
27
 
30
28
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
@@ -21,16 +21,46 @@ var _react = _interopRequireWildcard(require("react"));
21
21
 
22
22
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
23
 
24
- var _propTypes = _interopRequireDefault(require("prop-types"));
24
+ var _uuid = require("uuid");
25
25
 
26
- require("../common/OpenSans.css");
26
+ var _propTypes = _interopRequireDefault(require("prop-types"));
27
27
 
28
28
  var _variables = require("../common/variables.js");
29
29
 
30
30
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
31
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
+
32
62
  function _templateObject6() {
33
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: 20px;\n width: 20px;\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"]);
34
64
 
35
65
  _templateObject6 = function _templateObject6() {
36
66
  return data;
@@ -40,7 +70,7 @@ function _templateObject6() {
40
70
  }
41
71
 
42
72
  function _templateObject5() {
43
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: 20px;\n width: 20px;\n"]);
73
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-right: ", ";\n\n ", "\n"]);
44
74
 
45
75
  _templateObject5 = function _templateObject5() {
46
76
  return data;
@@ -50,7 +80,7 @@ function _templateObject5() {
50
80
  }
51
81
 
52
82
  function _templateObject4() {
53
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n letter-spacing: 1.25px;\n text-transform: uppercase;\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"]);
54
84
 
55
85
  _templateObject4 = function _templateObject4() {
56
86
  return data;
@@ -60,7 +90,7 @@ function _templateObject4() {
60
90
  }
61
91
 
62
92
  function _templateObject3() {
63
- 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"]);
64
94
 
65
95
  _templateObject3 = function _templateObject3() {
66
96
  return data;
@@ -70,7 +100,7 @@ function _templateObject3() {
70
100
  }
71
101
 
72
102
  function _templateObject2() {
73
- 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"]);
74
104
 
75
105
  _templateObject2 = function _templateObject2() {
76
106
  return data;
@@ -80,7 +110,7 @@ function _templateObject2() {
80
110
  }
81
111
 
82
112
  function _templateObject() {
83
- 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 ", "\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"]);
84
114
 
85
115
  _templateObject = function _templateObject() {
86
116
  return data;
@@ -90,7 +120,9 @@ function _templateObject() {
90
120
  }
91
121
 
92
122
  var DxcToggleGroup = function DxcToggleGroup(_ref) {
93
- var value = _ref.value,
123
+ var label = _ref.label,
124
+ helperText = _ref.helperText,
125
+ value = _ref.value,
94
126
  onChange = _ref.onChange,
95
127
  _ref$disabled = _ref.disabled,
96
128
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
@@ -108,6 +140,10 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
108
140
  selectedValue = _useState2[0],
109
141
  setSelectedValue = _useState2[1];
110
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
+
111
147
  var handleToggleChange = function handleToggleChange(selectedOption) {
112
148
  var newSelectedOptions;
113
149
 
@@ -125,19 +161,25 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
125
161
  }
126
162
 
127
163
  setSelectedValue(newSelectedOptions);
128
- } else {
129
- setSelectedValue(selectedOption === selectedValue ? null : selectedOption);
130
- }
164
+ } else setSelectedValue(selectedOption === selectedValue ? null : selectedOption);
131
165
  } else if (multiple) {
132
166
  newSelectedOptions = value.map(function (v) {
133
167
  return v;
134
168
  });
135
- newSelectedOptions.push(selectedOption);
136
- }
137
169
 
138
- if (typeof onChange === "function") {
139
- 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);
140
175
  }
176
+
177
+ typeof onChange === "function" && onChange(multiple ? newSelectedOptions : selectedOption);
178
+ };
179
+
180
+ var handleKeyPress = function handleKeyPress(event, optionValue) {
181
+ event.preventDefault();
182
+ if (!disabled && (event.nativeEvent.code === "Enter" || event.nativeEvent.code === "Space")) handleToggleChange(optionValue);
141
183
  };
142
184
 
143
185
  return _react["default"].createElement(_styledComponents.ThemeProvider, {
@@ -145,9 +187,19 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
145
187
  }, _react["default"].createElement(ToggleGroup, {
146
188
  margin: margin,
147
189
  disabled: disabled
148
- }, _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) {
149
199
  return _react["default"].createElement(ToggleContainer, {
150
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,
151
203
  tabIndex: !disabled ? tabIndex : -1,
152
204
  onClick: function onClick() {
153
205
  return !disabled && handleToggleChange(option.value);
@@ -155,15 +207,50 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
155
207
  isFirst: i === 0,
156
208
  isLast: i === options.length - 1,
157
209
  isIcon: option.iconSrc || option.icon,
210
+ optionLabel: option.label,
158
211
  disabled: disabled,
212
+ onKeyPress: function onKeyPress(event) {
213
+ handleKeyPress(event, option.value);
214
+ },
159
215
  key: "toggle-".concat(i, "-").concat(option.label)
160
- }, 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, {
161
- src: option.iconSrc
162
- }) : _react["default"].createElement(LabelContainer, null, 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)));
163
222
  }))));
164
223
  };
165
224
 
166
- 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) {
167
254
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
168
255
  }, function (props) {
169
256
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -173,28 +260,51 @@ var ToggleGroup = _styledComponents["default"].div(_templateObject(), function (
173
260
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
174
261
  }, function (props) {
175
262
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
176
- }, function (props) {
177
- return props.disabled && "opacity: ".concat(props.theme.disabledOpacity, ";");
178
263
  });
179
264
 
180
- var ToggleGroupContainer = _styledComponents["default"].div(_templateObject2());
265
+ var OptionsContainer = _styledComponents["default"].div(_templateObject4(), function (props) {
266
+ return props.theme.containerBorderThickness;
267
+ }, function (props) {
268
+ return props.theme.containerBorderStyle;
269
+ }, function (props) {
270
+ return props.theme.containerBorderRadius;
271
+ }, function (props) {
272
+ return props.theme.containerBorderColor;
273
+ }, function (props) {
274
+ return props.theme.containerBackgroundColor;
275
+ }, function (props) {
276
+ return props.theme.containerMarginTop;
277
+ });
181
278
 
182
- var ToggleContainer = _styledComponents["default"].div(_templateObject3(), function (props) {
183
- return "\n background-color: ".concat(props.selected ? props.disabled ? props.theme.disabledSelectedBackgroundColor : props.theme.selectedBackgroundColor : props.disabled ? props.theme.disabledUnselectedBackgroundColor : props.theme.unselectedBackgroundColor, ";\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 ? "10px 12px" : "12px 30px", ";\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 ");
279
+ var ToggleContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
280
+ return !props.isLast && "4px";
281
+ }, function (props) {
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 ");
184
283
  });
185
284
 
186
- var LabelContainer = _styledComponents["default"].span(_templateObject4(), function (props) {
187
- return props.theme.fontSize;
285
+ var LabelContainer = _styledComponents["default"].span(_templateObject6(), function (props) {
286
+ return props.theme.optionLabelFontFamily;
287
+ }, function (props) {
288
+ return props.theme.optionLabelFontSize;
289
+ }, function (props) {
290
+ return props.theme.optionLabelFontStyle;
188
291
  }, function (props) {
189
- return props.theme.fontFamily;
292
+ return props.theme.optionLabelFontWeight;
190
293
  });
191
294
 
192
- var Icon = _styledComponents["default"].img(_templateObject5());
295
+ var OptionContent = _styledComponents["default"].div(_templateObject7());
193
296
 
194
- var IconContainer = _styledComponents["default"].div(_templateObject6());
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;
303
+ });
195
304
 
196
305
  DxcToggleGroup.propTypes = {
197
- //label: PropTypes.string,
306
+ label: _propTypes["default"].string,
307
+ helperText: _propTypes["default"].string,
198
308
  value: _propTypes["default"].any,
199
309
  onChange: _propTypes["default"].func,
200
310
  disabled: _propTypes["default"].bool,
@@ -21,8 +21,6 @@ var _react = _interopRequireWildcard(require("react"));
21
21
 
22
22
  var _styledComponents = _interopRequireDefault(require("styled-components"));
23
23
 
24
- require("../common/OpenSans.css");
25
-
26
24
  var _propTypes = _interopRequireDefault(require("prop-types"));
27
25
 
28
26
  var _DragAndDropArea = _interopRequireDefault(require("./dragAndDropArea/DragAndDropArea"));
@@ -34,7 +32,7 @@ var _Transactions = _interopRequireDefault(require("./transactions/Transactions"
34
32
  var _variables = require("../common/variables.js");
35
33
 
36
34
  function _templateObject() {
37
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n max-width: 100%;\n height: 400px;\n box-shadow: 0px 3px 6px #00000029;\n border-radius: 4px;\n display: flex;\n flex-direction: row;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
35
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n max-width: 100%;\n height: 400px;\n box-shadow: 0px 3px 6px #00000029;\n border-radius: 4px;\n display: flex;\n flex-direction: row;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
38
36
 
39
37
  _templateObject = function _templateObject() {
40
38
  return data;
@@ -43,7 +41,7 @@ function _templateObject() {
43
41
  return data;
44
42
  }
45
43
 
46
- var DxcUpload = function DxcUpload(_ref) {
44
+ var V3DxcUpload = function V3DxcUpload(_ref) {
47
45
  var callbackUpload = _ref.callbackUpload,
48
46
  margin = _ref.margin,
49
47
  _ref$tabIndex = _ref.tabIndex,
@@ -180,7 +178,7 @@ var DxcUpload = function DxcUpload(_ref) {
180
178
  }));
181
179
  };
182
180
 
183
- DxcUpload.propTypes = {
181
+ V3DxcUpload.propTypes = {
184
182
  callbackUpload: _propTypes["default"].func,
185
183
  margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
186
184
  top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
@@ -192,8 +190,6 @@ DxcUpload.propTypes = {
192
190
  };
193
191
 
194
192
  var DXCUpload = _styledComponents["default"].div(_templateObject(), function (props) {
195
- return props.theme.fontFamily;
196
- }, function (props) {
197
193
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
198
194
  }, function (props) {
199
195
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -205,5 +201,5 @@ var DXCUpload = _styledComponents["default"].div(_templateObject(), function (pr
205
201
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
206
202
  });
207
203
 
208
- var _default = DxcUpload;
204
+ var _default = V3DxcUpload;
209
205
  exports["default"] = _default;
@@ -17,18 +17,16 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
17
17
 
18
18
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
19
 
20
- require("../../common/OpenSans.css");
21
-
22
20
  var _Button = _interopRequireDefault(require("../../button/Button"));
23
21
 
24
- var _uploadButton = _interopRequireDefault(require("./upload-button.svg"));
25
-
26
- var _dragDropIcon = _interopRequireDefault(require("./drag-drop-icon.svg"));
22
+ var _Icons = require("./Icons");
27
23
 
28
24
  var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
29
25
 
26
+ var _BackgroundColorContext = require("../../BackgroundColorContext.js");
27
+
30
28
  function _templateObject3() {
31
- var data = (0, _taggedTemplateLiteral2["default"])(["\n background: url(\"", "\") no-repeat padding-box;\n width: 24px;\n height: 24px;\n margin-right: 5px;\n"]);
29
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n margin-right: 5px;\n & svg {\n fill: ", ";\n }\n"]);
32
30
 
33
31
  _templateObject3 = function _templateObject3() {
34
32
  return data;
@@ -38,7 +36,7 @@ function _templateObject3() {
38
36
  }
39
37
 
40
38
  function _templateObject2() {
41
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n font-style: italic;\n font-size: ", ";\n color: ", ";\n margin-right: 50px;\n"]);
39
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-right: 50px;\n"]);
42
40
 
43
41
  _templateObject2 = function _templateObject2() {
44
42
  return data;
@@ -48,7 +46,7 @@ function _templateObject2() {
48
46
  }
49
47
 
50
48
  function _templateObject() {
51
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n margin-right: 80px;\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n"]);
49
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 80px;\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n"]);
52
50
 
53
51
  _templateObject = function _templateObject() {
54
52
  return data;
@@ -79,7 +77,9 @@ var DxcButtonsUpload = function DxcButtonsUpload(_ref) {
79
77
 
80
78
  return _react["default"].createElement(_styledComponents.ThemeProvider, {
81
79
  theme: colorsTheme.upload
82
- }, _react["default"].createElement(DXCButtonsUpload, null, _react["default"].createElement(DragAndDropLabel, null, _react["default"].createElement(DragAndDropIcon, null), "Drag and Drop area"), _react["default"].createElement(_Button["default"], {
80
+ }, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
81
+ color: colorsTheme.upload.backgroundColor
82
+ }, _react["default"].createElement(DXCButtonsUpload, null, _react["default"].createElement(DragAndDropLabel, null, _react["default"].createElement(DragAndDropIconContainer, null, _Icons.dragAndDropIcon), "Drag and Drop area"), _react["default"].createElement(_Button["default"], {
83
83
  margin: {
84
84
  right: "small"
85
85
  },
@@ -97,9 +97,9 @@ var DxcButtonsUpload = function DxcButtonsUpload(_ref) {
97
97
  }), _react["default"].createElement(_Button["default"], {
98
98
  label: "UPLOAD",
99
99
  iconPosition: "after",
100
- iconSrc: _uploadButton["default"],
100
+ icon: _Icons.uploadIcon,
101
101
  onClick: onUpload
102
- })));
102
+ }))));
103
103
  };
104
104
 
105
105
  DxcButtonsUpload.propTypes = {
@@ -107,17 +107,29 @@ DxcButtonsUpload.propTypes = {
107
107
  onUpload: _propTypes["default"].func
108
108
  };
109
109
 
110
- var DXCButtonsUpload = _styledComponents["default"].div(_templateObject(), function (props) {
111
- return props.theme.fontFamily;
112
- });
110
+ var DXCButtonsUpload = _styledComponents["default"].div(_templateObject());
113
111
 
114
112
  var DragAndDropLabel = _styledComponents["default"].div(_templateObject2(), function (props) {
115
- return props.theme.fontSize12;
113
+ return props.theme.fontFamily;
114
+ }, function (props) {
115
+ return props.theme.dragAndDropAreaTextFontSize;
116
116
  }, function (props) {
117
- return props.theme.fontColor;
117
+ return props.theme.dragAndDropAreaTextFontStyle;
118
+ }, function (props) {
119
+ return props.theme.dragAndDropAreaTextFontWeight;
120
+ }, function (props) {
121
+ return props.theme.dragAndDropAreaTextFontTextTransform;
122
+ }, function (props) {
123
+ return props.theme.dragAndDropAreaTextFontColor;
118
124
  });
119
125
 
120
- var DragAndDropIcon = _styledComponents["default"].div(_templateObject3(), _dragDropIcon["default"]);
126
+ var DragAndDropIconContainer = _styledComponents["default"].div(_templateObject3(), function (props) {
127
+ return props.theme.dragAndDropAreaIconSize;
128
+ }, function (props) {
129
+ return props.theme.dragAndDropAreaIconSize;
130
+ }, function (props) {
131
+ return props.theme.dragAndDropAreaIconColor;
132
+ });
121
133
 
122
134
  var _default = DxcButtonsUpload;
123
135
  exports["default"] = _default;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.dragAndDropIcon = exports.uploadIcon = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var uploadIcon = _react["default"].createElement("svg", {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: "24",
15
+ height: "24",
16
+ viewBox: "0 0 24 24",
17
+ fill: "#FFFFFF"
18
+ }, _react["default"].createElement("path", {
19
+ d: "M0 0h24v24H0z",
20
+ fill: "none"
21
+ }), _react["default"].createElement("path", {
22
+ d: "M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"
23
+ }));
24
+
25
+ exports.uploadIcon = uploadIcon;
26
+
27
+ var dragAndDropIcon = _react["default"].createElement("svg", {
28
+ xmlns: "http://www.w3.org/2000/svg",
29
+ width: "24",
30
+ height: "24",
31
+ viewBox: "0 0 24 24",
32
+ fill: "#666666"
33
+ }, _react["default"].createElement("path", {
34
+ fill: "none",
35
+ d: "M0 0h24v24H0V0z"
36
+ }), _react["default"].createElement("path", {
37
+ d: "M3 13h2v-2H3v2zm0 4h2v-2H3v2zm2 4v-2H3c0 1.1.89 2 2 2zM3 9h2V7H3v2zm12 12h2v-2h-2v2zm4-18H9c-1.11 0-2 .9-2 2v10c0 1.1.89 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12H9V5h10v10zm-8 6h2v-2h-2v2zm-4 0h2v-2H7v2z"
38
+ }));
39
+
40
+ exports.dragAndDropIcon = dragAndDropIcon;