@dxc-technology/halstack-react 0.0.0-eb2a4cc → 0.0.0-ebb089f

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 (229) hide show
  1. package/README.md +2 -2
  2. package/babel.config.js +5 -2
  3. package/dist/BackgroundColorContext.js +46 -0
  4. package/dist/ThemeContext.js +237 -2
  5. package/dist/V3Select/V3Select.js +549 -0
  6. package/dist/V3Select/index.d.ts +27 -0
  7. package/dist/V3Textarea/V3Textarea.js +264 -0
  8. package/dist/V3Textarea/index.d.ts +27 -0
  9. package/dist/accordion/Accordion.js +170 -81
  10. package/dist/accordion/index.d.ts +28 -0
  11. package/dist/accordion-group/AccordionGroup.js +186 -0
  12. package/dist/accordion-group/index.d.ts +16 -0
  13. package/dist/alert/Alert.js +184 -83
  14. package/dist/alert/index.d.ts +51 -0
  15. package/dist/badge/Badge.js +63 -0
  16. package/dist/box/Box.js +31 -23
  17. package/dist/box/index.d.ts +25 -0
  18. package/dist/button/Button.js +84 -29
  19. package/dist/button/Button.stories.js +14 -211
  20. package/dist/button/index.d.ts +24 -0
  21. package/dist/card/Card.js +72 -35
  22. package/dist/card/index.d.ts +22 -0
  23. package/dist/checkbox/Checkbox.js +107 -32
  24. package/dist/checkbox/index.d.ts +24 -0
  25. package/dist/chip/Chip.js +135 -40
  26. package/dist/chip/index.d.ts +22 -0
  27. package/dist/common/RequiredComponent.js +2 -8
  28. package/dist/common/utils.js +2 -22
  29. package/dist/common/variables.js +1472 -159
  30. package/dist/date/Date.js +81 -59
  31. package/dist/date/index.d.ts +27 -0
  32. package/dist/date-input/DateInput.js +400 -0
  33. package/dist/date-input/index.d.ts +95 -0
  34. package/dist/dialog/Dialog.js +61 -36
  35. package/dist/dialog/index.d.ts +18 -0
  36. package/dist/dropdown/Dropdown.js +226 -94
  37. package/dist/dropdown/index.d.ts +26 -0
  38. package/dist/file-input/FileInput.js +644 -0
  39. package/dist/file-input/FileItem.js +287 -0
  40. package/dist/file-input/index.d.ts +81 -0
  41. package/dist/footer/Footer.js +122 -47
  42. package/dist/footer/Icons.js +77 -0
  43. package/dist/footer/index.d.ts +25 -0
  44. package/dist/header/Header.js +211 -91
  45. package/dist/header/Icons.js +59 -0
  46. package/dist/header/index.d.ts +25 -0
  47. package/dist/heading/Heading.js +93 -22
  48. package/dist/heading/index.d.ts +17 -0
  49. package/dist/input-text/Icons.js +22 -0
  50. package/dist/input-text/InputText.js +290 -104
  51. package/dist/input-text/index.d.ts +36 -0
  52. package/dist/layout/ApplicationLayout.js +327 -0
  53. package/dist/layout/Icons.js +55 -0
  54. package/dist/link/Link.js +136 -35
  55. package/dist/link/index.d.ts +23 -0
  56. package/dist/main.d.ts +40 -0
  57. package/dist/main.js +112 -16
  58. package/dist/number-input/NumberInput.js +136 -0
  59. package/dist/number-input/NumberInputContext.js +16 -0
  60. package/dist/number-input/index.d.ts +113 -0
  61. package/dist/paginator/Icons.js +66 -0
  62. package/dist/paginator/Paginator.js +184 -57
  63. package/dist/paginator/index.d.ts +20 -0
  64. package/dist/password-input/PasswordInput.js +203 -0
  65. package/dist/password-input/index.d.ts +94 -0
  66. package/dist/progress-bar/ProgressBar.js +97 -44
  67. package/dist/progress-bar/index.d.ts +18 -0
  68. package/dist/radio/Radio.js +39 -21
  69. package/dist/radio/index.d.ts +23 -0
  70. package/dist/resultsetTable/ResultsetTable.js +93 -69
  71. package/dist/resultsetTable/index.d.ts +19 -0
  72. package/dist/select/Select.js +957 -262
  73. package/dist/select/index.d.ts +131 -0
  74. package/dist/sidenav/Sidenav.js +87 -125
  75. package/dist/sidenav/index.d.ts +13 -0
  76. package/dist/slider/Slider.js +219 -73
  77. package/dist/slider/index.d.ts +29 -0
  78. package/dist/spinner/Spinner.js +249 -64
  79. package/dist/spinner/index.d.ts +17 -0
  80. package/dist/switch/Switch.js +51 -26
  81. package/dist/switch/index.d.ts +24 -0
  82. package/dist/table/Table.js +63 -15
  83. package/dist/table/index.d.ts +13 -0
  84. package/dist/tabs/Tabs.js +208 -35
  85. package/dist/tabs/index.d.ts +19 -0
  86. package/dist/tag/Tag.js +100 -35
  87. package/dist/tag/index.d.ts +24 -0
  88. package/dist/text-input/TextInput.js +974 -0
  89. package/dist/text-input/index.d.ts +135 -0
  90. package/dist/textarea/Textarea.js +250 -107
  91. package/dist/textarea/index.d.ts +117 -0
  92. package/dist/toggle/Toggle.js +16 -19
  93. package/dist/toggle/index.d.ts +21 -0
  94. package/dist/toggle-group/ToggleGroup.js +327 -0
  95. package/dist/toggle-group/index.d.ts +21 -0
  96. package/dist/upload/Upload.js +13 -8
  97. package/dist/upload/buttons-upload/ButtonsUpload.js +35 -25
  98. package/dist/upload/buttons-upload/Icons.js +40 -0
  99. package/dist/upload/dragAndDropArea/DragAndDropArea.js +84 -37
  100. package/dist/upload/dragAndDropArea/Icons.js +39 -0
  101. package/dist/upload/file-upload/FileToUpload.js +64 -33
  102. package/dist/upload/file-upload/Icons.js +66 -0
  103. package/dist/upload/files-upload/FilesToUpload.js +16 -16
  104. package/dist/upload/index.d.ts +15 -0
  105. package/dist/upload/transaction/Icons.js +160 -0
  106. package/dist/upload/transaction/Transaction.js +42 -49
  107. package/dist/upload/transactions/Transactions.js +38 -20
  108. package/dist/useTheme.js +22 -0
  109. package/dist/wizard/Icons.js +65 -0
  110. package/dist/wizard/Wizard.js +156 -61
  111. package/dist/wizard/index.d.ts +18 -0
  112. package/package.json +26 -14
  113. package/test/AccordionGroup.test.js +125 -0
  114. package/test/Date.test.js +15 -13
  115. package/test/DateInput.test.js +242 -0
  116. package/test/Dropdown.test.js +19 -4
  117. package/test/FileInput.test.js +201 -0
  118. package/test/Footer.test.js +2 -7
  119. package/test/Header.test.js +5 -10
  120. package/test/Heading.test.js +60 -12
  121. package/test/InputText.test.js +31 -28
  122. package/test/Link.test.js +25 -7
  123. package/test/NumberInput.test.js +259 -0
  124. package/test/Paginator.test.js +76 -60
  125. package/test/PasswordInput.test.js +83 -0
  126. package/test/ResultsetTable.test.js +65 -17
  127. package/test/Select.test.js +869 -132
  128. package/test/Sidenav.test.js +22 -64
  129. package/test/Slider.test.js +24 -15
  130. package/test/Spinner.test.js +5 -0
  131. package/test/Tabs.test.js +21 -0
  132. package/test/TextInput.test.js +731 -0
  133. package/test/Textarea.test.js +193 -0
  134. package/test/ToggleGroup.test.js +85 -0
  135. package/test/Upload.test.js +1 -1
  136. package/test/V3Select.test.js +212 -0
  137. package/test/{TextArea.test.js → V3TextArea.test.js} +6 -7
  138. package/dist/accordion/Accordion.stories.js +0 -207
  139. package/dist/accordion/readme.md +0 -96
  140. package/dist/alert/Alert.stories.js +0 -158
  141. package/dist/alert/close.svg +0 -4
  142. package/dist/alert/error.svg +0 -4
  143. package/dist/alert/info.svg +0 -4
  144. package/dist/alert/readme.md +0 -43
  145. package/dist/alert/success.svg +0 -4
  146. package/dist/alert/warning.svg +0 -4
  147. package/dist/button/readme.md +0 -93
  148. package/dist/checkbox/Checkbox.stories.js +0 -144
  149. package/dist/checkbox/readme.md +0 -116
  150. package/dist/common/services/example-service.js +0 -10
  151. package/dist/common/services/example-service.test.js +0 -12
  152. package/dist/date/Date.stories.js +0 -205
  153. package/dist/date/calendar.svg +0 -1
  154. package/dist/date/calendar_dark.svg +0 -1
  155. package/dist/date/readme.md +0 -73
  156. package/dist/dialog/Dialog.stories.js +0 -217
  157. package/dist/dialog/readme.md +0 -32
  158. package/dist/dropdown/Dropdown.stories.js +0 -249
  159. package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
  160. package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
  161. package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
  162. package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
  163. package/dist/dropdown/readme.md +0 -69
  164. package/dist/footer/Footer.stories.js +0 -94
  165. package/dist/footer/dxc_logo_wht.png +0 -0
  166. package/dist/footer/readme.md +0 -41
  167. package/dist/header/Header.stories.js +0 -176
  168. package/dist/header/close_icon.svg +0 -1
  169. package/dist/header/dxc_logo_black.png +0 -0
  170. package/dist/header/dxc_logo_white.png +0 -0
  171. package/dist/header/hamb_menu_black.svg +0 -1
  172. package/dist/header/hamb_menu_white.svg +0 -1
  173. package/dist/header/readme.md +0 -33
  174. package/dist/input-text/InputText.stories.js +0 -209
  175. package/dist/input-text/error.svg +0 -1
  176. package/dist/input-text/readme.md +0 -91
  177. package/dist/link/readme.md +0 -51
  178. package/dist/paginator/images/next.svg +0 -3
  179. package/dist/paginator/images/nextPage.svg +0 -3
  180. package/dist/paginator/images/previous.svg +0 -3
  181. package/dist/paginator/images/previousPage.svg +0 -3
  182. package/dist/paginator/readme.md +0 -50
  183. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  184. package/dist/progress-bar/readme.md +0 -63
  185. package/dist/radio/Radio.stories.js +0 -166
  186. package/dist/radio/readme.md +0 -70
  187. package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
  188. package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
  189. package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
  190. package/dist/select/Select.stories.js +0 -235
  191. package/dist/select/readme.md +0 -72
  192. package/dist/sidenav/arrow_icon.svg +0 -3
  193. package/dist/slider/Slider.stories.js +0 -241
  194. package/dist/slider/readme.md +0 -64
  195. package/dist/spinner/Spinner.stories.js +0 -183
  196. package/dist/spinner/readme.md +0 -65
  197. package/dist/switch/Switch.stories.js +0 -134
  198. package/dist/switch/readme.md +0 -133
  199. package/dist/tabs/Tabs.stories.js +0 -130
  200. package/dist/tabs/readme.md +0 -78
  201. package/dist/tabs-for-sections/TabsForSections.js +0 -107
  202. package/dist/tabs-for-sections/readme.md +0 -78
  203. package/dist/toggle/Toggle.stories.js +0 -297
  204. package/dist/toggle/readme.md +0 -80
  205. package/dist/upload/Upload.stories.js +0 -72
  206. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  207. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  208. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  209. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  210. package/dist/upload/file-upload/audio-icon.svg +0 -4
  211. package/dist/upload/file-upload/close.svg +0 -4
  212. package/dist/upload/file-upload/file-icon.svg +0 -4
  213. package/dist/upload/file-upload/video-icon.svg +0 -4
  214. package/dist/upload/readme.md +0 -37
  215. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  216. package/dist/upload/transaction/audio-icon.svg +0 -4
  217. package/dist/upload/transaction/error-icon.svg +0 -4
  218. package/dist/upload/transaction/file-icon-err.svg +0 -4
  219. package/dist/upload/transaction/file-icon.svg +0 -4
  220. package/dist/upload/transaction/image-icon-err.svg +0 -4
  221. package/dist/upload/transaction/image-icon.svg +0 -4
  222. package/dist/upload/transaction/success-icon.svg +0 -4
  223. package/dist/upload/transaction/video-icon-err.svg +0 -4
  224. package/dist/upload/transaction/video-icon.svg +0 -4
  225. package/dist/wizard/invalid_icon.svg +0 -6
  226. package/dist/wizard/valid_icon.svg +0 -6
  227. package/dist/wizard/validation-wrong.svg +0 -6
  228. package/test/TabsForSections.test.js +0 -34
  229. package/test/Toggle.test.js +0 -43
@@ -0,0 +1,287 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _propTypes = _interopRequireDefault(require("prop-types"));
17
+
18
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
+
20
+ var _useTheme = _interopRequireDefault(require("../useTheme.js"));
21
+
22
+ function _templateObject10() {
23
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
24
+
25
+ _templateObject10 = function _templateObject10() {
26
+ return data;
27
+ };
28
+
29
+ return data;
30
+ }
31
+
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 &:hover {\n background-color: ", ";\n }\n &:focus {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\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 display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n color: #d0011b;\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 color: ", ";\n width: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
54
+
55
+ _templateObject7 = function _templateObject7() {
56
+ return data;
57
+ };
58
+
59
+ return data;
60
+ }
61
+
62
+ function _templateObject6() {
63
+ var data = (0, _taggedTemplateLiteral2["default"])([""]);
64
+
65
+ _templateObject6 = function _templateObject6() {
66
+ return data;
67
+ };
68
+
69
+ return data;
70
+ }
71
+
72
+ function _templateObject5() {
73
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 12px;\n background-color: ", ";\n width: 48px;\n height: 48px;\n border-radius: 2px;\n color: ", ";\n"]);
74
+
75
+ _templateObject5 = function _templateObject5() {
76
+ return data;
77
+ };
78
+
79
+ return data;
80
+ }
81
+
82
+ function _templateObject4() {
83
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 48px;\n height: 48px;\n object-fit: contain;\n margin-right: 12px;\n border-radius: 2px;\n"]);
84
+
85
+ _templateObject4 = function _templateObject4() {
86
+ return data;
87
+ };
88
+
89
+ return data;
90
+ }
91
+
92
+ function _templateObject3() {
93
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"]);
94
+
95
+ _templateObject3 = function _templateObject3() {
96
+ return data;
97
+ };
98
+
99
+ return data;
100
+ }
101
+
102
+ function _templateObject2() {
103
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n"]);
104
+
105
+ _templateObject2 = function _templateObject2() {
106
+ return data;
107
+ };
108
+
109
+ return data;
110
+ }
111
+
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 min-height: ", ";\n border-color: ", ";\n border-width: ", ";\n border-style: ", ";\n display: flex;\n justify-content: center;\n"]);
114
+
115
+ _templateObject = function _templateObject() {
116
+ return data;
117
+ };
118
+
119
+ return data;
120
+ }
121
+
122
+ var deleteIcon = _react["default"].createElement("svg", {
123
+ xmlns: "http://www.w3.org/2000/svg",
124
+ width: "24",
125
+ height: "24",
126
+ viewBox: "0 0 24 24",
127
+ fill: "currentColor"
128
+ }, _react["default"].createElement("path", {
129
+ d: "M0 0h24v24H0V0z",
130
+ fill: "none"
131
+ }), _react["default"].createElement("path", {
132
+ d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
133
+ }));
134
+
135
+ var errorIcon = _react["default"].createElement("svg", {
136
+ xmlns: "http://www.w3.org/2000/svg",
137
+ height: "24px",
138
+ viewBox: "0 0 24 24",
139
+ width: "24px",
140
+ fill: "currentColor"
141
+ }, _react["default"].createElement("path", {
142
+ d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
143
+ }));
144
+
145
+ var FileItem = function FileItem(_ref) {
146
+ var mode = _ref.mode,
147
+ multiple = _ref.multiple,
148
+ _ref$name = _ref.name,
149
+ name = _ref$name === void 0 ? "" : _ref$name,
150
+ _ref$error = _ref.error,
151
+ error = _ref$error === void 0 ? "" : _ref$error,
152
+ showPreview = _ref.showPreview,
153
+ preview = _ref.preview,
154
+ type = _ref.type,
155
+ numFiles = _ref.numFiles,
156
+ onDelete = _ref.onDelete;
157
+ var colorsTheme = (0, _useTheme["default"])();
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
+
172
+ return _react["default"].createElement(_styledComponents.ThemeProvider, {
173
+ theme: colorsTheme.fileInput
174
+ }, _react["default"].createElement(Container, {
175
+ mode: mode,
176
+ multiple: multiple,
177
+ error: error,
178
+ showPreview: showPreview,
179
+ numFiles: numFiles
180
+ }, showPreview && (isImage ? _react["default"].createElement(ImagePreview, {
181
+ src: preview,
182
+ alt: name
183
+ }) : _react["default"].createElement(IconPreviewContainer, {
184
+ error: error,
185
+ "aria-label": getIconAriaLabel()
186
+ }, _react["default"].createElement(IconPreview, {
187
+ error: error
188
+ }, preview))), _react["default"].createElement(FileItemContent, null, _react["default"].createElement(FileItemContainer, null, _react["default"].createElement(FileName, {
189
+ mode: mode,
190
+ multiple: multiple,
191
+ error: error,
192
+ showPreview: showPreview,
193
+ numFiles: numFiles
194
+ }, name), error && _react["default"].createElement(ErrorIcon, {
195
+ "aria-label": "Error"
196
+ }, errorIcon), _react["default"].createElement(DeleteIcon, {
197
+ error: error,
198
+ onClick: function onClick() {
199
+ return onDelete(name);
200
+ },
201
+ "aria-label": "Remove ".concat(name)
202
+ }, deleteIcon)), error && (multiple || numFiles > 1) && _react["default"].createElement(ErrorMessage, null, error))));
203
+ };
204
+
205
+ var Container = _styledComponents["default"].div(_templateObject(), function (props) {
206
+ return props.showPreview ? "8px" : "8px 8px 8px 16px";
207
+ }, function (props) {
208
+ return props.error && props.theme.errorFileItemBackgroundColor;
209
+ }, function (props) {
210
+ return props.theme.fileItemBorderRadius;
211
+ }, function (props) {
212
+ return props.mode === "file" && !props.multiple && props.numFiles === 1 ? "calc(230px - 26px)" : !props.showPreview ? "calc(320px - 26px)" : props.showPreview && "calc(320px - 18px)";
213
+ }, function (props) {
214
+ return props.mode === "file" && !props.multiple && props.numFiles === 1 || !props.showPreview && !props.error ? "calc(40px - 18px)" : !props.showPreview && props.error ? "calc(59px - 18px)" : "calc(64px - 18px)";
215
+ }, function (props) {
216
+ return props.error ? props.theme.errorFileItemBorderColor : props.theme.fileItemBorderColor;
217
+ }, function (props) {
218
+ return props.theme.fileItemBorderThickness;
219
+ }, function (props) {
220
+ return props.theme.fileItemBorderStyle;
221
+ });
222
+
223
+ var FileItemContent = _styledComponents["default"].div(_templateObject2());
224
+
225
+ var FileItemContainer = _styledComponents["default"].div(_templateObject3());
226
+
227
+ var ImagePreview = _styledComponents["default"].img(_templateObject4());
228
+
229
+ var IconPreviewContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
230
+ return props.error ? props.theme.errorFileItemIconBackgroundColor : props.theme.fileItemIconBackgroundColor;
231
+ }, function (props) {
232
+ return props.error ? props.theme.errorFileItemIconColor : props.theme.fileItemIconColor;
233
+ });
234
+
235
+ var IconPreview = _styledComponents["default"].div(_templateObject6());
236
+
237
+ var FileName = _styledComponents["default"].span(_templateObject7(), function (props) {
238
+ return props.theme.fileNameFontColor;
239
+ }, function (props) {
240
+ return props.mode === "file" && !props.multiple && props.error && props.numFiles === 1 ? "calc(230px - 76px)" : props.mode === "file" && !props.multiple && !props.error && props.numFiles === 1 ? "calc(230px - 50px)" : !props.showPreview && !props.error ? "calc(320px - 52px)" : !props.showPreview && props.error ? "calc(320px - 76px)" : props.showPreview && props.error ? "calc(320px - 128px)" : props.showPreview && !props.error && "calc(320px - 102px)";
241
+ }, function (props) {
242
+ return props.theme.fileItemFontFamily;
243
+ }, function (props) {
244
+ return props.theme.fileItemFontSize;
245
+ }, function (props) {
246
+ return props.theme.fileItemFontWeight;
247
+ }, function (props) {
248
+ return props.theme.fileItemLineHeight;
249
+ });
250
+
251
+ var ErrorIcon = _styledComponents["default"].span(_templateObject8());
252
+
253
+ var DeleteIcon = _styledComponents["default"].button(_templateObject9(), function (props) {
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;
261
+ });
262
+
263
+ var ErrorMessage = _styledComponents["default"].span(_templateObject10(), function (props) {
264
+ return props.theme.errorMessageFontColor;
265
+ }, function (props) {
266
+ return props.theme.errorMessageFontFamily;
267
+ }, function (props) {
268
+ return props.theme.errorMessageFontSize;
269
+ }, function (props) {
270
+ return props.theme.errorMessageFontWeight;
271
+ }, function (props) {
272
+ return props.theme.errorMessageLineHeight;
273
+ });
274
+
275
+ FileItem.propTypes = {
276
+ mode: _propTypes["default"].string,
277
+ multiple: _propTypes["default"].bool,
278
+ name: _propTypes["default"].string,
279
+ type: _propTypes["default"].string,
280
+ showPreview: _propTypes["default"]["boolean"],
281
+ numFiles: _propTypes["default"].number,
282
+ preview: _propTypes["default"].string,
283
+ error: _propTypes["default"].string,
284
+ onDelete: _propTypes["default"].func
285
+ };
286
+ var _default = FileItem;
287
+ exports["default"] = _default;
@@ -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;