@dxc-technology/halstack-react 0.0.0-2d619b4 → 0.0.0-2f08981

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 (172) hide show
  1. package/README.md +1 -1
  2. package/dist/ThemeContext.js +74 -64
  3. package/dist/V3Select/V3Select.js +549 -0
  4. package/dist/V3Select/index.d.ts +27 -0
  5. package/dist/V3Textarea/V3Textarea.js +264 -0
  6. package/dist/V3Textarea/index.d.ts +27 -0
  7. package/dist/accordion/index.d.ts +28 -0
  8. package/dist/accordion-group/index.d.ts +16 -0
  9. package/dist/alert/Alert.js +5 -5
  10. package/dist/box/index.d.ts +25 -0
  11. package/dist/button/Button.js +3 -3
  12. package/dist/button/index.d.ts +24 -0
  13. package/dist/card/index.d.ts +22 -0
  14. package/dist/checkbox/Checkbox.js +4 -5
  15. package/dist/checkbox/index.d.ts +24 -0
  16. package/dist/chip/index.d.ts +22 -0
  17. package/dist/common/variables.js +231 -91
  18. package/dist/date/index.d.ts +27 -0
  19. package/dist/{new-date/NewDate.js → date-input/DateInput.js} +62 -62
  20. package/dist/{new-date → date-input}/index.d.ts +25 -16
  21. package/dist/dialog/index.d.ts +18 -0
  22. package/dist/dropdown/index.d.ts +26 -0
  23. package/dist/file-input/FileInput.js +13 -10
  24. package/dist/file-input/FileItem.js +33 -9
  25. package/dist/file-input/index.d.ts +81 -0
  26. package/dist/footer/Footer.js +44 -18
  27. package/dist/footer/Icons.js +77 -0
  28. package/dist/footer/index.d.ts +25 -0
  29. package/dist/header/Header.js +122 -55
  30. package/dist/header/Icons.js +59 -0
  31. package/dist/header/index.d.ts +25 -0
  32. package/dist/heading/Heading.js +12 -0
  33. package/dist/heading/index.d.ts +17 -0
  34. package/dist/input-text/Icons.js +22 -0
  35. package/dist/input-text/InputText.js +4 -6
  36. package/dist/input-text/index.d.ts +36 -0
  37. package/dist/layout/ApplicationLayout.js +4 -8
  38. package/dist/layout/Icons.js +55 -0
  39. package/dist/link/index.d.ts +23 -0
  40. package/dist/main.d.ts +39 -5
  41. package/dist/main.js +30 -30
  42. package/dist/{number/Number.js → number-input/NumberInput.js} +9 -11
  43. package/dist/{number/NumberContext.js → number-input/NumberInputContext.js} +2 -2
  44. package/dist/{number → number-input}/index.d.ts +27 -9
  45. package/dist/paginator/Icons.js +66 -0
  46. package/dist/paginator/Paginator.js +53 -37
  47. package/dist/paginator/index.d.ts +20 -0
  48. package/dist/{password/Password.js → password-input/PasswordInput.js} +14 -11
  49. package/dist/{password → password-input}/index.d.ts +30 -16
  50. package/dist/progress-bar/index.d.ts +18 -0
  51. package/dist/radio/index.d.ts +23 -0
  52. package/dist/resultsetTable/index.d.ts +19 -0
  53. package/dist/select/Select.js +848 -301
  54. package/dist/select/index.d.ts +53 -0
  55. package/dist/sidenav/index.d.ts +13 -0
  56. package/dist/slider/Slider.js +104 -19
  57. package/dist/slider/index.d.ts +29 -0
  58. package/dist/spinner/index.d.ts +17 -0
  59. package/dist/switch/index.d.ts +24 -0
  60. package/dist/table/index.d.ts +13 -0
  61. package/dist/tabs/index.d.ts +19 -0
  62. package/dist/tag/index.d.ts +24 -0
  63. package/dist/{new-input-text/NewInputText.js → text-input/TextInput.js} +132 -135
  64. package/dist/{new-input-text → text-input}/index.d.ts +31 -16
  65. package/dist/textarea/Textarea.js +227 -122
  66. package/dist/{new-textarea → textarea}/index.d.ts +34 -18
  67. package/dist/toggle/index.d.ts +21 -0
  68. package/dist/toggle-group/ToggleGroup.js +132 -28
  69. package/dist/toggle-group/index.d.ts +21 -0
  70. package/dist/upload/buttons-upload/ButtonsUpload.js +7 -11
  71. package/dist/upload/buttons-upload/Icons.js +40 -0
  72. package/dist/upload/dragAndDropArea/DragAndDropArea.js +14 -14
  73. package/dist/upload/dragAndDropArea/Icons.js +39 -0
  74. package/dist/upload/file-upload/FileToUpload.js +26 -21
  75. package/dist/upload/file-upload/Icons.js +66 -0
  76. package/dist/upload/index.d.ts +15 -0
  77. package/dist/upload/transaction/Icons.js +160 -0
  78. package/dist/upload/transaction/Transaction.js +11 -38
  79. package/dist/wizard/Icons.js +65 -0
  80. package/dist/wizard/Wizard.js +3 -9
  81. package/dist/wizard/index.d.ts +18 -0
  82. package/package.json +5 -9
  83. package/test/Date.test.js +13 -11
  84. package/test/{NewDate.test.js → DateInput.test.js} +66 -27
  85. package/test/FileInput.test.js +164 -2
  86. package/test/Footer.test.js +2 -7
  87. package/test/Header.test.js +5 -10
  88. package/test/Heading.test.js +60 -12
  89. package/test/{Number.test.js → NumberInput.test.js} +84 -66
  90. package/test/Paginator.test.js +5 -1
  91. package/test/PasswordInput.test.js +83 -0
  92. package/test/ResultsetTable.test.js +5 -4
  93. package/test/Select.test.js +374 -171
  94. package/test/Slider.test.js +9 -17
  95. package/test/{NewInputText.test.js → TextInput.test.js} +138 -272
  96. package/test/Textarea.test.js +193 -0
  97. package/test/ToggleGroup.test.js +5 -1
  98. package/test/Upload.test.js +1 -1
  99. package/test/V3Select.test.js +212 -0
  100. package/test/{TextArea.test.js → V3TextArea.test.js} +6 -7
  101. package/dist/checkbox/Checkbox.stories.js +0 -144
  102. package/dist/checkbox/readme.md +0 -116
  103. package/dist/date/Date.stories.js +0 -205
  104. package/dist/date/readme.md +0 -73
  105. package/dist/footer/Footer.stories.js +0 -94
  106. package/dist/footer/dxc_logo.svg +0 -15
  107. package/dist/footer/readme.md +0 -41
  108. package/dist/header/Header.stories.js +0 -176
  109. package/dist/header/close_icon.svg +0 -1
  110. package/dist/header/dxc_logo_black.svg +0 -8
  111. package/dist/header/hamb_menu_black.svg +0 -1
  112. package/dist/header/hamb_menu_white.svg +0 -1
  113. package/dist/header/readme.md +0 -33
  114. package/dist/input-text/InputText.stories.js +0 -209
  115. package/dist/input-text/error.svg +0 -1
  116. package/dist/input-text/readme.md +0 -91
  117. package/dist/layout/facebook.svg +0 -45
  118. package/dist/layout/linkedin.svg +0 -50
  119. package/dist/layout/twitter.svg +0 -53
  120. package/dist/link/readme.md +0 -51
  121. package/dist/new-textarea/NewTextarea.js +0 -365
  122. package/dist/paginator/images/next.svg +0 -3
  123. package/dist/paginator/images/nextPage.svg +0 -3
  124. package/dist/paginator/images/previous.svg +0 -3
  125. package/dist/paginator/images/previousPage.svg +0 -3
  126. package/dist/paginator/readme.md +0 -50
  127. package/dist/password/styles.css +0 -3
  128. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  129. package/dist/progress-bar/readme.md +0 -63
  130. package/dist/radio/Radio.stories.js +0 -166
  131. package/dist/radio/readme.md +0 -70
  132. package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
  133. package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
  134. package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
  135. package/dist/slider/Slider.stories.js +0 -241
  136. package/dist/slider/readme.md +0 -64
  137. package/dist/spinner/Spinner.stories.js +0 -183
  138. package/dist/spinner/readme.md +0 -65
  139. package/dist/switch/Switch.stories.js +0 -134
  140. package/dist/switch/readme.md +0 -133
  141. package/dist/tabs/Tabs.stories.js +0 -130
  142. package/dist/tabs/readme.md +0 -78
  143. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  144. package/dist/tabs-for-sections/readme.md +0 -78
  145. package/dist/toggle/Toggle.stories.js +0 -297
  146. package/dist/toggle/readme.md +0 -80
  147. package/dist/upload/Upload.stories.js +0 -72
  148. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  149. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  150. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  151. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  152. package/dist/upload/file-upload/audio-icon.svg +0 -4
  153. package/dist/upload/file-upload/close.svg +0 -4
  154. package/dist/upload/file-upload/file-icon.svg +0 -4
  155. package/dist/upload/file-upload/video-icon.svg +0 -4
  156. package/dist/upload/readme.md +0 -37
  157. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  158. package/dist/upload/transaction/audio-icon.svg +0 -4
  159. package/dist/upload/transaction/error-icon.svg +0 -4
  160. package/dist/upload/transaction/file-icon-err.svg +0 -4
  161. package/dist/upload/transaction/file-icon.svg +0 -4
  162. package/dist/upload/transaction/image-icon-err.svg +0 -4
  163. package/dist/upload/transaction/image-icon.svg +0 -4
  164. package/dist/upload/transaction/success-icon.svg +0 -4
  165. package/dist/upload/transaction/video-icon-err.svg +0 -4
  166. package/dist/upload/transaction/video-icon.svg +0 -4
  167. package/dist/wizard/invalid_icon.svg +0 -5
  168. package/dist/wizard/valid_icon.svg +0 -5
  169. package/dist/wizard/validation-wrong.svg +0 -6
  170. package/test/NewTextarea.test.js +0 -252
  171. package/test/Password.test.js +0 -76
  172. package/test/TabsForSections.test.js +0 -34
@@ -37,7 +37,7 @@ var _variables = require("../common/variables.js");
37
37
 
38
38
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
39
39
 
40
- var _NewInputText = _interopRequireDefault(require("../new-input-text/NewInputText"));
40
+ var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
41
41
 
42
42
  function _templateObject() {
43
43
  var data = (0, _taggedTemplateLiteral2["default"])([""]);
@@ -49,7 +49,7 @@ function _templateObject() {
49
49
  return data;
50
50
  }
51
51
 
52
- var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
52
+ var DxcDateInput = _react["default"].forwardRef(function (_ref, ref) {
53
53
  var _ref$label = _ref.label,
54
54
  label = _ref$label === void 0 ? "" : _ref$label,
55
55
  _ref$name = _ref.name,
@@ -84,20 +84,15 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
84
84
  innerValue = _useState2[0],
85
85
  setInnerValue = _useState2[1];
86
86
 
87
- var _useState3 = (0, _react.useState)(""),
87
+ var _useState3 = (0, _react.useState)(false),
88
88
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
89
- validationError = _useState4[0],
90
- setValidationError = _useState4[1];
89
+ isOpen = _useState4[0],
90
+ setIsOpen = _useState4[1];
91
91
 
92
- var _useState5 = (0, _react.useState)(false),
92
+ var _useState5 = (0, _react.useState)(null),
93
93
  _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
94
- isOpen = _useState6[0],
95
- setIsOpen = _useState6[1];
96
-
97
- var _useState7 = (0, _react.useState)(null),
98
- _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
99
- anchorEl = _useState8[0],
100
- setAnchorEl = _useState8[1];
94
+ anchorEl = _useState6[0],
95
+ setAnchorEl = _useState6[1];
101
96
 
102
97
  var colorsTheme = (0, _useTheme["default"])();
103
98
 
@@ -112,31 +107,36 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
112
107
  };
113
108
 
114
109
  var handleCalendarOnClick = function handleCalendarOnClick(newDate) {
115
- var string = (0, _moment["default"])(newDate).format(format.toUpperCase());
116
- value !== null && value !== void 0 ? value : setInnerValue(string);
117
- typeof onChange === "function" && onChange({
118
- value: string,
110
+ var newValue = (0, _moment["default"])(newDate).format(format.toUpperCase());
111
+ value !== null && value !== void 0 ? value : setInnerValue(newValue);
112
+ onChange === null || onChange === void 0 ? void 0 : onChange({
113
+ value: newValue,
114
+ error: null,
119
115
  date: newDate && newDate.toJSON() ? newDate : null
120
116
  });
121
117
  };
122
118
 
123
- var handleIOnChange = function handleIOnChange(string) {
124
- var momentDate = (0, _moment["default"])(string, format.toUpperCase(), true);
125
- value !== null && value !== void 0 ? value : setInnerValue(string);
126
- typeof onChange === "function" && onChange({
127
- value: string,
119
+ var handleIOnChange = function handleIOnChange(_ref2) {
120
+ var newValue = _ref2.value,
121
+ inputError = _ref2.error;
122
+ value !== null && value !== void 0 ? value : setInnerValue(newValue);
123
+ var momentDate = (0, _moment["default"])(newValue, format.toUpperCase(), true);
124
+ var invalidDateMessage = newValue !== "" && !momentDate.isValid() ? "Invalid date." : null;
125
+ onChange === null || onChange === void 0 ? void 0 : onChange({
126
+ value: newValue,
127
+ error: inputError || invalidDateMessage,
128
128
  date: momentDate.isValid() ? momentDate._d : null
129
129
  });
130
130
  };
131
131
 
132
- var handleIOnBlur = function handleIOnBlur(_ref2) {
133
- var value = _ref2.value;
132
+ var handleIOnBlur = function handleIOnBlur(_ref3) {
133
+ var value = _ref3.value,
134
+ inputError = _ref3.error;
134
135
  var momentDate = (0, _moment["default"])(value, format.toUpperCase(), true);
135
136
  var invalidDateMessage = value !== "" && !momentDate.isValid() ? "Invalid date." : null;
136
- setValidationError(invalidDateMessage);
137
- typeof onBlur === "function" && onBlur({
137
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur({
138
138
  value: value,
139
- error: invalidDateMessage,
139
+ error: inputError || invalidDateMessage,
140
140
  date: momentDate.isValid() ? momentDate._d : null
141
141
  });
142
142
  };
@@ -175,12 +175,12 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
175
175
  overrides: {
176
176
  MuiTypography: {
177
177
  root: {
178
- fontFamily: "".concat(colorsTheme.newDate.pickerFontFamily, " !important")
178
+ fontFamily: "".concat(colorsTheme.dateInput.pickerFontFamily, " !important")
179
179
  }
180
180
  },
181
181
  MuiPickersYearSelection: {
182
182
  container: {
183
- color: colorsTheme.newDate.pickerYearFontColor,
183
+ color: colorsTheme.dateInput.pickerYearFontColor,
184
184
  "&::-webkit-scrollbar": {
185
185
  width: "3px"
186
186
  },
@@ -196,8 +196,8 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
196
196
  },
197
197
  MuiPickersToolbar: {
198
198
  toolbar: {
199
- backgroundColor: colorsTheme.newDate.pickerBackgroundColor,
200
- color: colorsTheme.newDate.pickerDayFontColor
199
+ backgroundColor: colorsTheme.dateInput.pickerBackgroundColor,
200
+ color: colorsTheme.dateInput.pickerDayFontColor
201
201
  }
202
202
  },
203
203
  MuiIconButton: {
@@ -215,7 +215,7 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
215
215
  MuiButtonBase: {
216
216
  root: {
217
217
  "&:focus": {
218
- outline: colorsTheme.newDate.pickerFocusColor + " solid 2px"
218
+ outline: colorsTheme.dateInput.pickerFocusColor + " solid 2px"
219
219
  }
220
220
  }
221
221
  },
@@ -225,38 +225,38 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
225
225
  maxWidth: "unset",
226
226
  minHeight: "unset",
227
227
  padding: "0px 10px",
228
- height: colorsTheme.newDate.pickerHeight,
229
- width: colorsTheme.newDate.pickerWidth,
230
- backgroundColor: colorsTheme.newDate.pickerBackgroundColor,
231
- fontFamily: colorsTheme.newDate.pickerFontFamily
228
+ height: colorsTheme.dateInput.pickerHeight,
229
+ width: colorsTheme.dateInput.pickerWidth,
230
+ backgroundColor: colorsTheme.dateInput.pickerBackgroundColor,
231
+ fontFamily: colorsTheme.dateInput.pickerFontFamily
232
232
  }
233
233
  },
234
234
  MuiPickersToolbarText: {
235
235
  toolbarTxt: {
236
- color: colorsTheme.newDate.pickerActualDateFontColor,
237
- fontFamily: colorsTheme.newDate.pickerFontFamily,
236
+ color: colorsTheme.dateInput.pickerActualDateFontColor,
237
+ fontFamily: colorsTheme.dateInput.pickerFontFamily,
238
238
  fontSize: "2rem"
239
239
  },
240
240
  toolbarBtnSelected: {
241
- color: colorsTheme.newDate.pickerActualDateFontColor
241
+ color: colorsTheme.dateInput.pickerActualDateFontColor
242
242
  }
243
243
  },
244
244
  MuiPickersCalendarHeader: {
245
245
  transitionContainer: {
246
- color: colorsTheme.newDate.pickerMonthFontColor
246
+ color: colorsTheme.dateInput.pickerMonthFontColor
247
247
  },
248
248
  dayLabel: {
249
- color: colorsTheme.newDate.pickerWeekFontColor,
250
- fontFamily: colorsTheme.newDate.pickerFontFamily
249
+ color: colorsTheme.dateInput.pickerWeekFontColor,
250
+ fontFamily: colorsTheme.dateInput.pickerFontFamily
251
251
  },
252
252
  switchHeader: {
253
253
  backgroundColor: "#ffffff",
254
- color: colorsTheme.newDate.pickerDayFontColor
254
+ color: colorsTheme.dateInput.pickerDayFontColor
255
255
  },
256
256
  iconButton: {
257
- backgroundColor: colorsTheme.newDate.pickerMonthArrowsBackgroundColor,
257
+ backgroundColor: colorsTheme.dateInput.pickerMonthArrowsBackgroundColor,
258
258
  "&:hover": {
259
- backgroundColor: colorsTheme.newDate.pickerMonthArrowsBackgroundColor
259
+ backgroundColor: colorsTheme.dateInput.pickerMonthArrowsBackgroundColor
260
260
  }
261
261
  }
262
262
  },
@@ -267,37 +267,37 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
267
267
  },
268
268
  MuiPickersDay: {
269
269
  current: {
270
- color: colorsTheme.newDate.pickerDayFontColor
270
+ color: colorsTheme.dateInput.pickerDayFontColor
271
271
  },
272
272
  day: {
273
- fontFamily: colorsTheme.newDate.pickerFontFamily,
274
- color: colorsTheme.newDate.pickerDayFontColor,
273
+ fontFamily: colorsTheme.dateInput.pickerFontFamily,
274
+ color: colorsTheme.dateInput.pickerDayFontColor,
275
275
  "&:hover": {
276
- backgroundColor: colorsTheme.newDate.pickerHoverDateBackgroundColor,
277
- color: colorsTheme.newDate.pickerHoverDateFontColor
276
+ backgroundColor: colorsTheme.dateInput.pickerHoverDateBackgroundColor,
277
+ color: colorsTheme.dateInput.pickerHoverDateFontColor
278
278
  }
279
279
  },
280
280
  daySelected: {
281
- backgroundColor: colorsTheme.newDate.pickerSelectedDateBackgroundColor,
282
- color: colorsTheme.newDate.pickerSelectedDateColor,
281
+ backgroundColor: colorsTheme.dateInput.pickerSelectedDateBackgroundColor,
282
+ color: colorsTheme.dateInput.pickerSelectedDateColor,
283
283
  "&:hover": {
284
- backgroundColor: colorsTheme.newDate.pickerSelectedDateBackgroundColor,
285
- color: colorsTheme.newDate.pickerSelectedDateColor,
284
+ backgroundColor: colorsTheme.dateInput.pickerSelectedDateBackgroundColor,
285
+ color: colorsTheme.dateInput.pickerSelectedDateColor,
286
286
  opacity: "1"
287
287
  }
288
288
  }
289
289
  },
290
290
  MuiPickersYear: {
291
291
  yearSelected: {
292
- color: colorsTheme.newDate.pickerSelectedDateColor,
293
- backgroundColor: colorsTheme.newDate.pickerSelectedDateBackgroundColor,
292
+ color: colorsTheme.dateInput.pickerSelectedDateColor,
293
+ backgroundColor: colorsTheme.dateInput.pickerSelectedDateBackgroundColor,
294
294
  margin: "0px 100px",
295
295
  borderRadius: "20px"
296
296
  },
297
297
  root: {
298
298
  "&:focus": {
299
- color: colorsTheme.newDate.pickerHoverDateFontColor,
300
- backgroundColor: colorsTheme.newDate.pickerHoverDateBackgroundColor
299
+ color: colorsTheme.dateInput.pickerHoverDateFontColor,
300
+ backgroundColor: colorsTheme.dateInput.pickerHoverDateBackgroundColor
301
301
  }
302
302
  }
303
303
  },
@@ -314,7 +314,7 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
314
314
  theme: dateTheme
315
315
  }, _react["default"].createElement(_pickers.MuiPickersUtilsProvider, {
316
316
  utils: _dateFns["default"]
317
- }, _react["default"].createElement(StyledDPicker, null, _react["default"].createElement(_NewInputText["default"], {
317
+ }, _react["default"].createElement(StyledDPicker, null, _react["default"].createElement(_TextInput["default"], {
318
318
  label: label,
319
319
  name: name,
320
320
  value: value !== null && value !== void 0 ? value : innerValue,
@@ -326,7 +326,7 @@ var DxcNewDate = _react["default"].forwardRef(function (_ref, ref) {
326
326
  optional: optional,
327
327
  onChange: handleIOnChange,
328
328
  onBlur: handleIOnBlur,
329
- error: error || validationError,
329
+ error: error,
330
330
  autocomplete: autocomplete,
331
331
  margin: margin,
332
332
  size: size,
@@ -373,7 +373,7 @@ var sizes = {
373
373
 
374
374
  var StyledDPicker = _styledComponents["default"].div(_templateObject());
375
375
 
376
- DxcNewDate.propTypes = {
376
+ DxcDateInput.propTypes = {
377
377
  label: _propTypes["default"].string,
378
378
  name: _propTypes["default"].string,
379
379
  value: _propTypes["default"].string,
@@ -396,5 +396,5 @@ DxcNewDate.propTypes = {
396
396
  }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
397
397
  tabIndex: _propTypes["default"].number
398
398
  };
399
- var _default = DxcNewDate;
399
+ var _default = DxcDateInput;
400
400
  exports["default"] = _default;
@@ -33,7 +33,7 @@ type Props = {
33
33
  */
34
34
  placeholder?: boolean;
35
35
  /**
36
- * If true, the date will have an action to clear the entered value.
36
+ * If true, the date input will have an action to clear the entered value.
37
37
  */
38
38
  clearable?: boolean;
39
39
  /**
@@ -41,22 +41,31 @@ type Props = {
41
41
  */
42
42
  disabled?: boolean;
43
43
  /**
44
- * If true, the date will be optional, showing (Optional) next to the label.
44
+ * If true, the date will be optional, showing '(Optional)'
45
+ * next to the label. Otherwise, the field will be considered required and an error will be
46
+ * passed as a parameter to the OnBlur and onChange functions when it has
47
+ * not been filled.
45
48
  */
46
49
  optional?: boolean;
47
- /**
48
- * This function will be called when the user types within the input element of the component.
49
- * An object including the current string value and the date value will be passed to this function.
50
- * If the string value is not a valid date, date will be null.
51
- */
52
- onChange?: (value: string) => void;
53
- /**
54
- * This function will be called when the input element loses the focus. An object including the string value, the error and the date value will be passed to this function.
55
- * If the string value is a valid date, error will be null. Also, if the string value is not a valid date, date will be null.
56
- */
57
- onBlur?: (val: { value: string; error: string }) => void;
58
- /**
59
- * If it is defined, the component will change its appearance, showing the error below the date component. If it is not defined, the error messages will be created and managed internally.
50
+ /**
51
+ * This function will be called when the user types within the input
52
+ * element of the component. An object including the string value, the
53
+ * error and the date value will be passed to this function.
54
+ * If the string value is a valid date, error will
55
+ * be null. Also, if the string value is not a valid date, date will be null.
56
+ */
57
+ onChange?: (val: { value: string; error: string; date: Date }) => void;
58
+ /**
59
+ * This function will be called when the input element loses the focus.
60
+ * An object including the string value, the error and the date value
61
+ * will be passed to this function. If the string value is a valid date, error will
62
+ * be null. Also, if the string value is not a valid date, date will be null.
63
+ */
64
+ onBlur?: (val: { value: string; error: string; date: Date }) => void;
65
+ /**
66
+ * If it is defined, the component will change its appearance, showing
67
+ * the error below the date input component. If it is not defined, the error
68
+ * messages will be managed internally, but never displayed on its own.
60
69
  */
61
70
  error?: string;
62
71
  /**
@@ -83,4 +92,4 @@ type Props = {
83
92
  ref?: React.RefObject<HTMLDivElement>;
84
93
  };
85
94
 
86
- export default function DxcNewDate(props: Props): JSX.Element;
95
+ export default function DxcDateInput(props: Props): JSX.Element;
@@ -0,0 +1,18 @@
1
+ type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2
+ type Padding = {
3
+ top?: Space;
4
+ bottom?: Space;
5
+ left?: Space;
6
+ right?: Space;
7
+ };
8
+
9
+ type Props = {
10
+ isCloseVisible?: boolean;
11
+ onCloseClick?: void;
12
+ overlay?: boolean;
13
+ onBackgroundClick?: void;
14
+ padding?: Padding,
15
+ tabIndex?: number;
16
+ };
17
+
18
+ export default function DxcDialog(props: Props): JSX.Element;
@@ -0,0 +1,26 @@
1
+ type Size = "small" | "medium" | "large" | "fillParent" | "fitContent";
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
+ options?: any;
12
+ optionsIconPosition?: "before" | "after";
13
+ icon?: any;
14
+ iconSrc?: string;
15
+ iconPosition?: "before" | "after";
16
+ label?: string;
17
+ disabled?: boolean;
18
+ caretHidden?: boolean;
19
+ onSelectOption?: void;
20
+ expandOnHover?: boolean;
21
+ margin?: Space | Margin;
22
+ size?: Size;
23
+ tabIndex?: number;
24
+ };
25
+
26
+ export default function DxcDropdown(props: Props): JSX.Element;
@@ -58,7 +58,7 @@ function _templateObject10() {
58
58
  }
59
59
 
60
60
  function _templateObject9() {
61
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n"]);
61
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin-top: 0.25rem;\n"]);
62
62
 
63
63
  _templateObject9 = function _templateObject9() {
64
64
  return data;
@@ -88,7 +88,7 @@ function _templateObject7() {
88
88
  }
89
89
 
90
90
  function _templateObject6() {
91
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n\n input[type=\"file\"] {\n visibility: hidden;\n position: absolute;\n width: 0px;\n height: 0px;\n }\n"]);
91
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin-top: 0.25rem;\n\n input[type=\"file\"] {\n visibility: hidden;\n position: absolute;\n width: 0px;\n height: 0px;\n }\n"]);
92
92
 
93
93
  _templateObject6 = function _templateObject6() {
94
94
  return data;
@@ -108,7 +108,7 @@ function _templateObject5() {
108
108
  }
109
109
 
110
110
  function _templateObject4() {
111
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: calc(320px - 2px);\n display: flex;\n flex-direction: ", ";\n align-items: center;\n border-radius: ", ";\n background-color: ", ";\n border: ", ";\n border-color: ", ";\n cursor: ", ";\n"]);
111
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: calc(320px - 2px);\n display: flex;\n flex-direction: ", ";\n align-items: center;\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n background-color: ", ";\n border-color: ", ";\n cursor: ", ";\n"]);
112
112
 
113
113
  _templateObject4 = function _templateObject4() {
114
114
  return data;
@@ -138,7 +138,7 @@ function _templateObject2() {
138
138
  }
139
139
 
140
140
  function _templateObject() {
141
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
141
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: fit-content;\n"]);
142
142
 
143
143
  _templateObject = function _templateObject() {
144
144
  return data;
@@ -219,9 +219,11 @@ var DxcFileInput = function DxcFileInput(_ref) {
219
219
  files = _useState4[0],
220
220
  setFiles = _useState4[1];
221
221
 
222
+ var _useState5 = (0, _react.useState)("file-input-".concat((0, _uuid.v4)())),
223
+ _useState6 = (0, _slicedToArray2["default"])(_useState5, 1),
224
+ fileInputId = _useState6[0];
225
+
222
226
  var colorsTheme = (0, _useTheme["default"])();
223
- var fileInputId = "file-input-".concat((0, _uuid.v4)());
224
- var labelFileInputId = "label-".concat(fileInputId);
225
227
  (0, _react.useEffect)(function () {
226
228
  if (value) {
227
229
  setFiles(value);
@@ -442,7 +444,7 @@ var DxcFileInput = function DxcFileInput(_ref) {
442
444
  name: name,
443
445
  tabIndex: tabIndex
444
446
  }, _react["default"].createElement(Label, {
445
- "for": labelFileInputId,
447
+ htmlFor: fileInputId,
446
448
  disabled: disabled
447
449
  }, label), _react["default"].createElement(HelperText, {
448
450
  disabled: disabled
@@ -566,9 +568,11 @@ var DragDropArea = _styledComponents["default"].div(_templateObject4(), function
566
568
  }, function (props) {
567
569
  return props.theme.dropBorderRadius;
568
570
  }, function (props) {
569
- return props.isDragging && props.theme.focusDropBackgroundColor;
571
+ return !props.isDragging ? props.theme.dropBorderThickness : "2px";
570
572
  }, function (props) {
571
- return !props.isDragging ? props.theme.dropBorder : "solid 2px";
573
+ return !props.isDragging ? props.theme.dropBorderStyle : "solid";
574
+ }, function (props) {
575
+ return props.isDragging && props.theme.focusDropBackgroundColor;
572
576
  }, function (props) {
573
577
  return props.disabled ? props.theme.disabledDropBorderColor : props.isDragging ? props.theme.focusDropBorderColor : props.theme.dropBorderColor;
574
578
  }, function (props) {
@@ -626,7 +630,6 @@ DxcFileInput.propTypes = {
626
630
  multiple: _propTypes["default"].bool,
627
631
  showPreview: _propTypes["default"].bool,
628
632
  disabled: _propTypes["default"].bool,
629
- error: _propTypes["default"].string,
630
633
  callbackFile: _propTypes["default"].func,
631
634
  value: _propTypes["default"].array,
632
635
  tabIndex: _propTypes["default"].number,
@@ -30,7 +30,7 @@ function _templateObject10() {
30
30
  }
31
31
 
32
32
  function _templateObject9() {
33
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 4px;\n margin-left: 4px;\n background-color: transparent;\n padding: 3px;\n cursor: pointer;\n svg {\n line-height: 18px;\n }\n"]);
33
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 4px;\n margin-left: 4px;\n background-color: transparent;\n padding: 3px;\n cursor: pointer;\n svg {\n line-height: 18px;\n }\n &:hover {\n background-color: ", ";\n }\n &:focus {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"]);
34
34
 
35
35
  _templateObject9 = function _templateObject9() {
36
36
  return data;
@@ -90,7 +90,7 @@ function _templateObject4() {
90
90
  }
91
91
 
92
92
  function _templateObject3() {
93
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n"]);
93
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"]);
94
94
 
95
95
  _templateObject3 = function _templateObject3() {
96
96
  return data;
@@ -110,7 +110,7 @@ function _templateObject2() {
110
110
  }
111
111
 
112
112
  function _templateObject() {
113
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n padding: ", ";\n background-color: ", ";\n border-radius: ", ";\n width: ", ";\n height: ", ";\n border: ", "\n ", ";\n"]);
113
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n padding: ", ";\n background-color: ", ";\n border-radius: ", ";\n width: ", ";\n min-height: ", ";\n border-color: ", ";\n border-width: ", ";\n border-style: ", ";\n display: flex;\n justify-content: center;\n"]);
114
114
 
115
115
  _templateObject = function _templateObject() {
116
116
  return data;
@@ -156,6 +156,19 @@ var FileItem = function FileItem(_ref) {
156
156
  onDelete = _ref.onDelete;
157
157
  var colorsTheme = (0, _useTheme["default"])();
158
158
  var isImage = type.includes("image");
159
+
160
+ var getIconAriaLabel = function getIconAriaLabel() {
161
+ if (type.includes("video")) {
162
+ return "video";
163
+ }
164
+
165
+ if (type.includes("audio")) {
166
+ return "audio";
167
+ }
168
+
169
+ return "file";
170
+ };
171
+
159
172
  return _react["default"].createElement(_styledComponents.ThemeProvider, {
160
173
  theme: colorsTheme.fileInput
161
174
  }, _react["default"].createElement(Container, {
@@ -165,9 +178,11 @@ var FileItem = function FileItem(_ref) {
165
178
  showPreview: showPreview,
166
179
  numFiles: numFiles
167
180
  }, showPreview && (isImage ? _react["default"].createElement(ImagePreview, {
168
- src: preview
181
+ src: preview,
182
+ alt: name
169
183
  }) : _react["default"].createElement(IconPreviewContainer, {
170
- error: error
184
+ error: error,
185
+ "aria-label": getIconAriaLabel()
171
186
  }, _react["default"].createElement(IconPreview, {
172
187
  error: error
173
188
  }, preview))), _react["default"].createElement(FileItemContent, null, _react["default"].createElement(FileItemContainer, null, _react["default"].createElement(FileName, {
@@ -179,10 +194,11 @@ var FileItem = function FileItem(_ref) {
179
194
  }, name), error && _react["default"].createElement(ErrorIcon, {
180
195
  "aria-label": "Error"
181
196
  }, errorIcon), _react["default"].createElement(DeleteIcon, {
197
+ error: error,
182
198
  onClick: function onClick() {
183
199
  return onDelete(name);
184
200
  },
185
- "aria-label": "Remove"
201
+ "aria-label": "Remove ".concat(name)
186
202
  }, deleteIcon)), error && (multiple || numFiles > 1) && _react["default"].createElement(ErrorMessage, null, error))));
187
203
  };
188
204
 
@@ -199,7 +215,9 @@ var Container = _styledComponents["default"].div(_templateObject(), function (pr
199
215
  }, function (props) {
200
216
  return props.error ? props.theme.errorFileItemBorderColor : props.theme.fileItemBorderColor;
201
217
  }, function (props) {
202
- return props.theme.fileItemBorder;
218
+ return props.theme.fileItemBorderThickness;
219
+ }, function (props) {
220
+ return props.theme.fileItemBorderStyle;
203
221
  });
204
222
 
205
223
  var FileItemContent = _styledComponents["default"].div(_templateObject2());
@@ -209,9 +227,9 @@ var FileItemContainer = _styledComponents["default"].div(_templateObject3());
209
227
  var ImagePreview = _styledComponents["default"].img(_templateObject4());
210
228
 
211
229
  var IconPreviewContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
212
- return props.error ? "#ffccd3" : "#f2f2f2";
230
+ return props.error ? props.theme.errorFileItemIconBackgroundColor : props.theme.fileItemIconBackgroundColor;
213
231
  }, function (props) {
214
- return props.error ? "#d0011b" : "#808080";
232
+ return props.error ? props.theme.errorFileItemIconColor : props.theme.fileItemIconColor;
215
233
  });
216
234
 
217
235
  var IconPreview = _styledComponents["default"].div(_templateObject6());
@@ -234,6 +252,12 @@ var ErrorIcon = _styledComponents["default"].span(_templateObject8());
234
252
 
235
253
  var DeleteIcon = _styledComponents["default"].button(_templateObject9(), function (props) {
236
254
  return props.theme.fontFamily;
255
+ }, function (props) {
256
+ return props.error ? props.theme.errorHoverDeleteFileItemBackgroundColor : props.theme.hoverDeleteFileItemBackgroundColor;
257
+ }, function (props) {
258
+ return props.error ? props.theme.errorHoverDeleteFileItemBackgroundColor : props.theme.hoverDeleteFileItemBackgroundColor;
259
+ }, function (props) {
260
+ return props.error ? props.theme.errorActiveDeleteFileItemBackgroundColor : props.theme.activeDeleteFileItemBackgroundColor;
237
261
  });
238
262
 
239
263
  var ErrorMessage = _styledComponents["default"].span(_templateObject10(), function (props) {
@@ -0,0 +1,81 @@
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 FileData = {
10
+ error?: string;
11
+ file?: File;
12
+ preview?: string;
13
+ };
14
+
15
+ type Props = {
16
+ /**
17
+ * Name attribute of the file input element.
18
+ */
19
+ name?: string;
20
+ /**
21
+ * Text to be placed above the file input.
22
+ */
23
+ label?: string;
24
+ /**
25
+ * Uses one of the available file input modes:
26
+ * 'file': Files are selected by clicking the button and selecting it through the file explorer.
27
+ * 'filedrop': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
28
+ * 'dropzone': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
29
+ * The drag and drop area of this mode is bigger than the one of the filedrop mode.
30
+ */
31
+ mode?: "file" | "filedrop" | "dropzone";
32
+ /**
33
+ * Helper text to be placed above the file input.
34
+ */
35
+ helperText?: string;
36
+ /**
37
+ * Defines the file types accepted by the component. It is not possible to select a file with a non valid type.
38
+ */
39
+ accept?: string;
40
+ /**
41
+ * An array of FileData representing the selected files.
42
+ */
43
+ value?: FileData[];
44
+ /**
45
+ * Minimum file size allowed (in bytes). If the file size does not comply the minSize, an error will be passed to the FileData.
46
+ */
47
+ minSize?: number;
48
+ /**
49
+ * Maximum file size allowed (in bytes). If the file size does not comply the maxSize, an error will be passed to the FileData.
50
+ */
51
+ maxSize?: number;
52
+ /**
53
+ * If true and if the file is an image, a preview of it will be shown. If it is not an image, an icon refering to the file's type will be shown.
54
+ * If mode is not multiple and there is one file already selected, the file will be replaced by the last selected one.
55
+ */
56
+ showPreview?: boolean;
57
+ /**
58
+ * If true, more than one file can be selected. If false, only one file can be selected.
59
+ */
60
+ multiple?: boolean;
61
+ /**
62
+ * If true, the component will be disabled.
63
+ */
64
+ disabled?: boolean;
65
+ /**
66
+ * This function will be called when the user selects or drops a file. The list of files will be sent as a parameter.
67
+ * In this function, the files can be updated or returned as they come. These files must be passed to the value in order to be shown.
68
+ */
69
+ callbackFile?: (files: FileData[]) => void;
70
+ /**
71
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
72
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
73
+ */
74
+ margin?: Space | Margin;
75
+ /**
76
+ * Value of the tabindex attribute.
77
+ */
78
+ tabIndex?: number;
79
+ };
80
+
81
+ export default function DxcFileInput(props: Props): JSX.Element;